blob: c017be9e08b173d990d7f4a3d921957e6867c80c [file] [log] [blame]
Laura Abbott03e3cd72013-02-09 09:35:30 -08001/* Copyright (c) 2011-2013, 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>
Matt Wagantalld55b90f2012-02-23 23:27:44 -0800102#include "clock.h"
Naveen Ramaraj76483ad2011-09-06 14:25:44 -0700103#include "smd_private.h"
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -0600104#include "pm-boot.h"
Jeff Ohlstein7e668552011-10-06 16:17:25 -0700105#include "msm_watchdog.h"
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800106
Ming-yi Lin2d43cd52012-10-17 11:50:15 +0800107#if defined(CONFIG_BT) && defined(CONFIG_BT_HCIUART_ATH3K)
108#include <linux/wlan_plat.h>
109#include <linux/mutex.h>
110#endif
111
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700112static struct platform_device msm_fm_platform_init = {
113 .name = "iris_fm",
114 .id = -1,
115};
116
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700117#define KS8851_RST_GPIO 89
118#define KS8851_IRQ_GPIO 90
Mohan Pallaka5e490392011-09-09 15:18:41 +0530119
Manoj Rao14648742012-03-30 19:42:12 -0700120#define MHL_GPIO_INT 4
121#define MHL_GPIO_RESET 15
122
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700123#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700124
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800125struct sx150x_platform_data msm8960_sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700126 [SX150X_CAM] = {
127 .gpio_base = GPIO_CAM_EXPANDER_BASE,
128 .oscio_is_gpo = false,
129 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530130 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700131 .io_open_drain_ena = 0x0,
132 .irq_summary = -1,
133 },
Amir Samuelov755616d2011-12-13 16:34:46 +0200134 [SX150X_LIQUID] = {
135 .gpio_base = GPIO_LIQUID_EXPANDER_BASE,
136 .oscio_is_gpo = false,
137 .io_pullup_ena = 0x0c08,
138 .io_pulldn_ena = 0x4060,
139 .io_open_drain_ena = 0x000c,
140 .io_polarity = 0,
141 .irq_summary = -1,
142 },
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700143};
Nishant Pandit474f2252011-07-23 23:17:56 +0530144
145#endif
146
Olav Haugana21169d2012-01-04 09:17:06 -0800147#define MSM_PMEM_ADSP_SIZE 0x7800000
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -0700148#define MSM_PMEM_AUDIO_SIZE 0x4CF000
Mathew Karimpanal15fa5c42011-12-14 21:28:10 -0800149#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800150#define MSM_LIQUID_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800151#define MSM_HDMI_PRIM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Laura Abbott2d1760b2011-09-29 21:31:24 -0700152
153#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Deepak Kotur35825522012-06-06 15:49:14 -0700154#define HOLE_SIZE 0x20000
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700155#define MSM_CONTIG_MEM_SIZE 0x65000
Olav Haugan32594552012-03-13 11:40:05 -0700156#ifdef CONFIG_MSM_IOMMU
Olav Haugan8726caf2012-05-10 15:11:35 -0700157#define MSM_ION_MM_SIZE 0x3800000 /* Need to be multiple of 64K */
Olav Haugan32594552012-03-13 11:40:05 -0700158#define MSM_ION_SF_SIZE 0x0
Olav Hauganfbbf05b2012-04-05 14:33:41 -0700159#define MSM_ION_QSECOM_SIZE 0x780000 /* (7.5MB) */
Laura Abbott03e3cd72013-02-09 09:35:30 -0800160#define MSM_ION_HEAP_NUM 8
Olav Haugan32594552012-03-13 11:40:05 -0700161#else
162#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
163#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Hauganfbbf05b2012-04-05 14:33:41 -0700164#define MSM_ION_QSECOM_SIZE 0x600000 /* (6MB) */
Olav Haugan32594552012-03-13 11:40:05 -0700165#define MSM_ION_HEAP_NUM 8
166#endif
Deepak Kotur35825522012-06-06 15:49:14 -0700167#define MSM_ION_MM_FW_SIZE (0x200000 - HOLE_SIZE) /* 128kb */
Praveen Chavand0857552013-01-31 20:06:07 -0800168#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan7355db02012-01-13 16:59:13 -0800169#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Olav Haugan32594552012-03-13 11:40:05 -0700170
Olav Hauganb5be7992011-11-18 14:29:02 -0800171#define MSM_LIQUID_ION_MM_SIZE (MSM_ION_MM_SIZE + 0x600000)
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800172#define MSM_LIQUID_ION_SF_SIZE MSM_LIQUID_PMEM_SIZE
173#define MSM_HDMI_PRIM_ION_SF_SIZE MSM_HDMI_PRIM_PMEM_SIZE
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700174
Deepak Kotur35825522012-06-06 15:49:14 -0700175#define MSM_MM_FW_SIZE (0x200000 - HOLE_SIZE) /* 2mb -128kb*/
176#define MSM8960_FIXED_AREA_START (0xa0000000 - (MSM_ION_MM_FW_SIZE + \
177 HOLE_SIZE))
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700178#define MAX_FIXED_AREA_SIZE 0x10000000
Deepak Kotur35825522012-06-06 15:49:14 -0700179#define MSM8960_FW_START MSM8960_FIXED_AREA_START
Laura Abbott03e3cd72013-02-09 09:35:30 -0800180#define MSM_ION_ADSP_SIZE SZ_8M
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700181
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800182static unsigned msm_ion_sf_size = MSM_ION_SF_SIZE;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700183#else
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700184#define MSM_CONTIG_MEM_SIZE 0x110C000
Olav Hauganb5be7992011-11-18 14:29:02 -0800185#define MSM_ION_HEAP_NUM 1
Laura Abbott2d1760b2011-09-29 21:31:24 -0700186#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700187
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700188#ifdef CONFIG_KERNEL_MSM_CONTIG_MEM_REGION
189static unsigned msm_contig_mem_size = MSM_CONTIG_MEM_SIZE;
190static int __init msm_contig_mem_size_setup(char *p)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700191{
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700192 msm_contig_mem_size = memparse(p, NULL);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700193 return 0;
194}
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700195early_param("msm_contig_mem_size", msm_contig_mem_size_setup);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700196#endif
197
198#ifdef CONFIG_ANDROID_PMEM
199static unsigned pmem_size = MSM_PMEM_SIZE;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800200static unsigned pmem_param_set;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700201static int __init pmem_size_setup(char *p)
202{
203 pmem_size = memparse(p, NULL);
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800204 pmem_param_set = 1;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700205 return 0;
206}
207early_param("pmem_size", pmem_size_setup);
208
209static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
210
211static int __init pmem_adsp_size_setup(char *p)
212{
213 pmem_adsp_size = memparse(p, NULL);
214 return 0;
215}
216early_param("pmem_adsp_size", pmem_adsp_size_setup);
217
218static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
219
220static int __init pmem_audio_size_setup(char *p)
221{
222 pmem_audio_size = memparse(p, NULL);
223 return 0;
224}
225early_param("pmem_audio_size", pmem_audio_size_setup);
226#endif
227
228#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700229#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700230static struct android_pmem_platform_data android_pmem_pdata = {
231 .name = "pmem",
232 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
233 .cached = 1,
234 .memory_type = MEMTYPE_EBI1,
235};
236
Laura Abbottb93525f2012-04-12 09:57:19 -0700237static struct platform_device msm8960_android_pmem_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700238 .name = "android_pmem",
239 .id = 0,
240 .dev = {.platform_data = &android_pmem_pdata},
241};
242
243static struct android_pmem_platform_data android_pmem_adsp_pdata = {
244 .name = "pmem_adsp",
245 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
246 .cached = 0,
247 .memory_type = MEMTYPE_EBI1,
248};
Laura Abbottb93525f2012-04-12 09:57:19 -0700249static struct platform_device msm8960_android_pmem_adsp_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700250 .name = "android_pmem",
251 .id = 2,
252 .dev = { .platform_data = &android_pmem_adsp_pdata },
253};
254
255static struct android_pmem_platform_data android_pmem_audio_pdata = {
256 .name = "pmem_audio",
257 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
258 .cached = 0,
259 .memory_type = MEMTYPE_EBI1,
260};
261
Laura Abbottb93525f2012-04-12 09:57:19 -0700262static struct platform_device msm8960_android_pmem_audio_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700263 .name = "android_pmem",
264 .id = 4,
265 .dev = { .platform_data = &android_pmem_audio_pdata },
266};
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700267#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
268#endif /*CONFIG_ANDROID_PMEM*/
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700269
Laura Abbottb93525f2012-04-12 09:57:19 -0700270struct fmem_platform_data msm8960_fmem_pdata = {
Larry Bassel41a055b2011-12-06 16:15:14 -0800271};
272
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700273#define DSP_RAM_BASE_8960 0x8da00000
274#define DSP_RAM_SIZE_8960 0x1800000
275static int dspcrashd_pdata_8960 = 0xDEADDEAD;
276
277static struct resource resources_dspcrashd_8960[] = {
278 {
279 .name = "msm_dspcrashd",
280 .start = DSP_RAM_BASE_8960,
281 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
282 .flags = IORESOURCE_DMA,
283 },
284};
285
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800286static struct platform_device msm_device_dspcrashd_8960 = {
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700287 .name = "msm_dspcrashd",
288 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
289 .resource = resources_dspcrashd_8960,
290 .dev = { .platform_data = &dspcrashd_pdata_8960 },
291};
292
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700293static struct memtype_reserve msm8960_reserve_table[] __initdata = {
294 [MEMTYPE_SMI] = {
295 },
296 [MEMTYPE_EBI0] = {
297 .flags = MEMTYPE_FLAGS_1M_ALIGN,
298 },
299 [MEMTYPE_EBI1] = {
300 .flags = MEMTYPE_FLAGS_1M_ALIGN,
301 },
302};
303
Laura Abbottf8c03b92012-02-16 14:57:58 -0800304static void __init reserve_rtb_memory(void)
305{
306#if defined(CONFIG_MSM_RTB)
Laura Abbottb93525f2012-04-12 09:57:19 -0700307 msm8960_reserve_table[MEMTYPE_EBI1].size += msm8960_rtb_pdata.size;
Chitti Babu Theegalaa7458c12013-05-06 21:03:20 +0530308 pr_info("mem_map: rtb reserved with size 0x%x in pool\n",
309 msm8960_rtb_pdata.size);
Laura Abbottf8c03b92012-02-16 14:57:58 -0800310#endif
311}
312
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700313static void __init size_pmem_devices(void)
314{
315#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700316#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700317 android_pmem_adsp_pdata.size = pmem_adsp_size;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800318
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800319 if (!pmem_param_set) {
320 if (machine_is_msm8960_liquid())
321 pmem_size = MSM_LIQUID_PMEM_SIZE;
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700322 if (msm8960_hdmi_as_primary_selected())
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800323 pmem_size = MSM_HDMI_PRIM_PMEM_SIZE;
324 }
325
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700326 android_pmem_pdata.size = pmem_size;
327 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700328#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
329#endif /*CONFIG_ANDROID_PMEM*/
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700330}
331
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700332#ifdef CONFIG_ANDROID_PMEM
333#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700334static void __init reserve_memory_for(struct android_pmem_platform_data *p)
335{
336 msm8960_reserve_table[p->memory_type].size += p->size;
337}
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700338#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
339#endif /*CONFIG_ANDROID_PMEM*/
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700340
341static void __init reserve_pmem_memory(void)
342{
343#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700344#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700345 reserve_memory_for(&android_pmem_adsp_pdata);
346 reserve_memory_for(&android_pmem_pdata);
347 reserve_memory_for(&android_pmem_audio_pdata);
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700348#endif
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700349 msm8960_reserve_table[MEMTYPE_EBI1].size += msm_contig_mem_size;
Chitti Babu Theegalaa7458c12013-05-06 21:03:20 +0530350 pr_info("mem_map: contig_mem reserved with size 0x%x in pool\n",
351 msm_contig_mem_size);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700352#endif
353}
354
Larry Basselb4126da2011-07-18 14:31:33 -0700355static int msm8960_paddr_to_memtype(unsigned int paddr)
356{
357 return MEMTYPE_EBI1;
358}
359
Steve Mucklef132c6c2012-06-06 18:30:57 -0700360#define FMEM_ENABLED 0
Olav Hauganf6dc7742012-02-15 09:11:55 -0800361
Laura Abbottd6183792011-08-19 13:42:24 -0700362#ifdef CONFIG_ION_MSM
Olav Haugan0703dbf2011-12-19 17:53:38 -0800363#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -0700364static struct ion_cp_heap_pdata cp_mm_msm8960_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800365 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugan8726caf2012-05-10 15:11:35 -0700366 .align = SZ_64K,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800367 .reusable = FMEM_ENABLED,
368 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700369 .fixed_position = FIXED_MIDDLE,
Olav Haugan8726caf2012-05-10 15:11:35 -0700370 .iommu_map_all = 1,
371 .iommu_2x_map_domain = VIDEO_DOMAIN,
Laura Abbottadec9c72012-12-05 11:49:59 -0800372 .is_cma = 1,
Laura Abbott5249a052012-12-11 15:09:03 -0800373 .no_nonsecure_alloc = 1,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800374};
375
Laura Abbottb93525f2012-04-12 09:57:19 -0700376static struct ion_cp_heap_pdata cp_mfc_msm8960_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800377 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugan42ebe712012-01-10 16:30:58 -0800378 .align = PAGE_SIZE,
Olav Haugan65f4bd82011-12-13 11:50:08 -0800379 .reusable = 0,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800380 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700381 .fixed_position = FIXED_HIGH,
Laura Abbott5249a052012-12-11 15:09:03 -0800382 .no_nonsecure_alloc = 1,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800383};
384
Laura Abbottb93525f2012-04-12 09:57:19 -0700385static struct ion_co_heap_pdata co_msm8960_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800386 .adjacent_mem_id = INVALID_HEAP_ID,
387 .align = PAGE_SIZE,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800388 .mem_is_fmem = 0,
Olav Haugan42ebe712012-01-10 16:30:58 -0800389};
390
Laura Abbottb93525f2012-04-12 09:57:19 -0700391static struct ion_co_heap_pdata fw_co_msm8960_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800392 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
393 .align = SZ_128K,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800394 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700395 .fixed_position = FIXED_LOW,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800396};
397#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800398
Laura Abbott354d40f2012-08-03 17:32:09 -0700399static u64 msm_dmamask = DMA_BIT_MASK(32);
400
401static struct platform_device ion_mm_heap_device = {
402 .name = "ion-mm-heap-device",
403 .id = -1,
404 .dev = {
405 .dma_mask = &msm_dmamask,
406 .coherent_dma_mask = DMA_BIT_MASK(32),
407 }
408};
409
Laura Abbott03e3cd72013-02-09 09:35:30 -0800410static struct platform_device ion_adsp_heap_device = {
411 .name = "ion-adsp-heap-device",
412 .id = -1,
413 .dev = {
414 .dma_mask = &msm_dmamask,
415 .coherent_dma_mask = DMA_BIT_MASK(32),
416 }
417};
418
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800419/**
420 * These heaps are listed in the order they will be allocated. Due to
421 * video hardware restrictions and content protection the FW heap has to
422 * be allocated adjacent (below) the MM heap and the MFC heap has to be
423 * allocated after the MM heap to ensure MFC heap is not more than 256MB
424 * away from the base address of the FW heap.
425 * However, the order of FW heap and MM heap doesn't matter since these
426 * two heaps are taken care of by separate code to ensure they are adjacent
427 * to each other.
428 * Don't swap the order unless you know what you are doing!
429 */
Benjamin Gaignardb2d367c2012-06-25 15:27:30 -0700430struct ion_platform_heap msm8960_heaps[] = {
Laura Abbottd6183792011-08-19 13:42:24 -0700431 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800432 .id = ION_SYSTEM_HEAP_ID,
Laura Abbottd6183792011-08-19 13:42:24 -0700433 .type = ION_HEAP_TYPE_SYSTEM,
Laura Abbottd6183792011-08-19 13:42:24 -0700434 .name = ION_VMALLOC_HEAP_NAME,
435 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700436#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -0700437 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800438 .id = ION_CP_MM_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800439 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800440 .name = ION_MM_HEAP_NAME,
441 .size = MSM_ION_MM_SIZE,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700442 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700443 .extra_data = (void *) &cp_mm_msm8960_ion_pdata,
Laura Abbott354d40f2012-08-03 17:32:09 -0700444 .priv = &ion_mm_heap_device.dev,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700445 },
Laura Abbott8c017362011-09-22 20:59:12 -0700446 {
Olav Haugan42ebe712012-01-10 16:30:58 -0800447 .id = ION_MM_FIRMWARE_HEAP_ID,
448 .type = ION_HEAP_TYPE_CARVEOUT,
449 .name = ION_MM_FIRMWARE_HEAP_NAME,
450 .size = MSM_ION_MM_FW_SIZE,
451 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700452 .extra_data = (void *) &fw_co_msm8960_ion_pdata,
Olav Haugan42ebe712012-01-10 16:30:58 -0800453 },
454 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800455 .id = ION_CP_MFC_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800456 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800457 .name = ION_MFC_HEAP_NAME,
458 .size = MSM_ION_MFC_SIZE,
459 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700460 .extra_data = (void *) &cp_mfc_msm8960_ion_pdata,
Olav Hauganb5be7992011-11-18 14:29:02 -0800461 },
Olav Haugan32594552012-03-13 11:40:05 -0700462#ifndef CONFIG_MSM_IOMMU
Olav Hauganb5be7992011-11-18 14:29:02 -0800463 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800464 .id = ION_SF_HEAP_ID,
465 .type = ION_HEAP_TYPE_CARVEOUT,
466 .name = ION_SF_HEAP_NAME,
467 .size = MSM_ION_SF_SIZE,
468 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700469 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800470 },
Olav Haugan32594552012-03-13 11:40:05 -0700471#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800472 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800473 .id = ION_IOMMU_HEAP_ID,
Laura Abbott8c017362011-09-22 20:59:12 -0700474 .type = ION_HEAP_TYPE_IOMMU,
475 .name = ION_IOMMU_HEAP_NAME,
476 },
Olav Haugan80854eb2012-01-12 12:00:23 -0800477 {
478 .id = ION_QSECOM_HEAP_ID,
479 .type = ION_HEAP_TYPE_CARVEOUT,
480 .name = ION_QSECOM_HEAP_NAME,
481 .size = MSM_ION_QSECOM_SIZE,
482 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700483 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan80854eb2012-01-12 12:00:23 -0800484 },
Olav Haugan7355db02012-01-13 16:59:13 -0800485 {
486 .id = ION_AUDIO_HEAP_ID,
487 .type = ION_HEAP_TYPE_CARVEOUT,
488 .name = ION_AUDIO_HEAP_NAME,
489 .size = MSM_ION_AUDIO_SIZE,
490 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700491 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan7355db02012-01-13 16:59:13 -0800492 },
Laura Abbott03e3cd72013-02-09 09:35:30 -0800493 {
494 .id = ION_ADSP_HEAP_ID,
495 .type = ION_HEAP_TYPE_DMA,
496 .name = ION_ADSP_HEAP_NAME,
497 .size = MSM_ION_ADSP_SIZE,
498 .memory_type = ION_EBI_TYPE,
499 .extra_data = (void *) &co_msm8960_ion_pdata,
500 .priv = &ion_adsp_heap_device.dev,
501 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700502#endif
Benjamin Gaignardb2d367c2012-06-25 15:27:30 -0700503};
504
505static struct ion_platform_data msm8960_ion_pdata = {
506 .nr = MSM_ION_HEAP_NUM,
507 .heaps = msm8960_heaps,
Laura Abbottd6183792011-08-19 13:42:24 -0700508};
509
Laura Abbottb93525f2012-04-12 09:57:19 -0700510static struct platform_device msm8960_ion_dev = {
Laura Abbottd6183792011-08-19 13:42:24 -0700511 .name = "ion-msm",
512 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700513 .dev = { .platform_data = &msm8960_ion_pdata },
Laura Abbottd6183792011-08-19 13:42:24 -0700514};
515#endif
516
Laura Abbottb93525f2012-04-12 09:57:19 -0700517struct platform_device msm8960_fmem_device = {
Larry Bassel41a055b2011-12-06 16:15:14 -0800518 .name = "fmem",
519 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700520 .dev = { .platform_data = &msm8960_fmem_pdata },
Larry Bassel41a055b2011-12-06 16:15:14 -0800521};
522
Olav Haugan65f4bd82011-12-13 11:50:08 -0800523static void __init adjust_mem_for_liquid(void)
Laura Abbottd6183792011-08-19 13:42:24 -0700524{
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800525 unsigned int i;
526
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800527 if (!pmem_param_set) {
528 if (machine_is_msm8960_liquid())
529 msm_ion_sf_size = MSM_LIQUID_ION_SF_SIZE;
530
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700531 if (msm8960_hdmi_as_primary_selected())
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800532 msm_ion_sf_size = MSM_HDMI_PRIM_ION_SF_SIZE;
533
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700534 if (machine_is_msm8960_liquid() ||
535 msm8960_hdmi_as_primary_selected()) {
Laura Abbottb93525f2012-04-12 09:57:19 -0700536 for (i = 0; i < msm8960_ion_pdata.nr; i++) {
537 if (msm8960_ion_pdata.heaps[i].id ==
538 ION_SF_HEAP_ID) {
539 msm8960_ion_pdata.heaps[i].size =
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800540 msm_ion_sf_size;
541 pr_debug("msm_ion_sf_size 0x%x\n",
542 msm_ion_sf_size);
543 break;
544 }
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800545 }
546 }
547 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800548}
549
550static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
551 unsigned long size)
552{
553 msm8960_reserve_table[mem_type].size += size;
554}
555
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700556static void __init msm8960_reserve_fixed_area(unsigned long fixed_area_size)
557{
558#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
559 int ret;
560
561 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
562 panic("fixed area size is larger than %dM\n",
563 MAX_FIXED_AREA_SIZE >> 20);
564
565 reserve_info->fixed_area_size = fixed_area_size;
566 reserve_info->fixed_area_start = MSM8960_FW_START;
567
568 ret = memblock_remove(reserve_info->fixed_area_start,
569 reserve_info->fixed_area_size);
Chitti Babu Theegalaa7458c12013-05-06 21:03:20 +0530570 pr_info("mem_map: fixed_area reserved at 0x%lx with size 0x%lx\n",
571 reserve_info->fixed_area_start,
572 reserve_info->fixed_area_size);
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700573 BUG_ON(ret);
574#endif
575}
576
Olav Haugan65f4bd82011-12-13 11:50:08 -0800577/**
578 * Reserve memory for ION and calculate amount of reusable memory for fmem.
579 * We only reserve memory for heaps that are not reusable. However, we only
580 * support one reusable heap at the moment so we ignore the reusable flag for
581 * other than the first heap with reusable flag set. Also handle special case
Olav Hauganf6dc7742012-02-15 09:11:55 -0800582 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
583 * at a higher address than FW in addition to not more than 256MB away from the
584 * base address of the firmware. This means that if MM is reusable the other
585 * two heaps must be allocated in the same region as FW. This is handled by the
586 * mem_is_fmem flag in the platform data. In addition the MM heap must be
587 * adjacent to the FW heap for content protection purposes.
Olav Haugan65f4bd82011-12-13 11:50:08 -0800588 */
589static void __init reserve_ion_memory(void)
590{
591#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
592 unsigned int i;
Laura Abbott354d40f2012-08-03 17:32:09 -0700593 int ret;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700594 unsigned int fixed_size = 0;
595 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
596 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
Laura Abbott354d40f2012-08-03 17:32:09 -0700597 unsigned long cma_alignment;
598 unsigned int low_use_cma = 0;
599 unsigned int middle_use_cma = 0;
600 unsigned int high_use_cma = 0;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800601
602 adjust_mem_for_liquid();
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700603 fixed_low_size = 0;
604 fixed_middle_size = 0;
605 fixed_high_size = 0;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800606
Laura Abbott354d40f2012-08-03 17:32:09 -0700607 cma_alignment = PAGE_SIZE << max(MAX_ORDER, pageblock_order);
608
Laura Abbottb93525f2012-04-12 09:57:19 -0700609 for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
Olav Haugan8726caf2012-05-10 15:11:35 -0700610 struct ion_platform_heap *heap =
Laura Abbottb93525f2012-04-12 09:57:19 -0700611 &(msm8960_ion_pdata.heaps[i]);
Olav Haugan8726caf2012-05-10 15:11:35 -0700612 int align = SZ_4K;
613 int iommu_map_all = 0;
614 int adjacent_mem_id = INVALID_HEAP_ID;
Laura Abbott354d40f2012-08-03 17:32:09 -0700615 int use_cma = 0;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800616
617 if (heap->extra_data) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700618 int fixed_position = NOT_FIXED;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700619
Mitchel Humpherysdc4d01d2012-09-13 10:53:22 -0700620 switch ((int) heap->type) {
Olav Haugan65f4bd82011-12-13 11:50:08 -0800621 case ION_HEAP_TYPE_CP:
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700622 fixed_position = ((struct ion_cp_heap_pdata *)
623 heap->extra_data)->fixed_position;
Olav Haugan8726caf2012-05-10 15:11:35 -0700624 align = ((struct ion_cp_heap_pdata *)
625 heap->extra_data)->align;
626 iommu_map_all =
627 ((struct ion_cp_heap_pdata *)
628 heap->extra_data)->iommu_map_all;
Laura Abbott354d40f2012-08-03 17:32:09 -0700629 if (((struct ion_cp_heap_pdata *)
630 heap->extra_data)->is_cma) {
631 heap->size = ALIGN(heap->size,
632 cma_alignment);
633 use_cma = 1;
634 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800635 break;
Laura Abbott354d40f2012-08-03 17:32:09 -0700636 case ION_HEAP_TYPE_DMA:
637 use_cma = 1;
638 /* Purposely fall through here */
Olav Haugan65f4bd82011-12-13 11:50:08 -0800639 case ION_HEAP_TYPE_CARVEOUT:
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700640 fixed_position = ((struct ion_co_heap_pdata *)
641 heap->extra_data)->fixed_position;
Olav Haugan8726caf2012-05-10 15:11:35 -0700642 adjacent_mem_id = ((struct ion_co_heap_pdata *)
643 heap->extra_data)->adjacent_mem_id;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700644 break;
645 default:
646 break;
647 }
648
Olav Haugan8726caf2012-05-10 15:11:35 -0700649 if (iommu_map_all) {
650 if (heap->size & (SZ_64K-1)) {
651 heap->size = ALIGN(heap->size, SZ_64K);
652 pr_info("Heap %s not aligned to 64K. Adjusting size to %x\n",
653 heap->name, heap->size);
654 }
655 }
656
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700657 if (fixed_position != NOT_FIXED)
658 fixed_size += heap->size;
Chintan Pandya2eab21d2013-04-12 14:50:29 +0530659 else if (!use_cma)
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700660 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
661
Laura Abbott354d40f2012-08-03 17:32:09 -0700662 if (fixed_position == FIXED_LOW) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700663 fixed_low_size += heap->size;
Laura Abbott354d40f2012-08-03 17:32:09 -0700664 low_use_cma = use_cma;
665 } else if (fixed_position == FIXED_MIDDLE) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700666 fixed_middle_size += heap->size;
Laura Abbott354d40f2012-08-03 17:32:09 -0700667 middle_use_cma = use_cma;
668 } else if (fixed_position == FIXED_HIGH) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700669 fixed_high_size += heap->size;
Laura Abbott354d40f2012-08-03 17:32:09 -0700670 high_use_cma = use_cma;
671 } else if (use_cma) {
672 /*
673 * Heaps that use CMA but are not part of the
674 * fixed set. Create wherever.
675 */
676 dma_declare_contiguous(
677 heap->priv,
678 heap->size,
679 0,
680 0xb0000000);
681 }
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700682 }
683 }
684
685 if (!fixed_size)
686 return;
687
Laura Abbott354d40f2012-08-03 17:32:09 -0700688 /*
689 * Given the setup for the fixed area, we can't round up all sizes.
690 * Some sizes must be set up exactly and aligned correctly. Incorrect
691 * alignments are considered a configuration issue
Larry Bassel4d4f4482012-04-04 11:26:09 -0700692 */
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700693
694 fixed_low_start = MSM8960_FIXED_AREA_START;
Laura Abbott354d40f2012-08-03 17:32:09 -0700695 if (low_use_cma) {
696 BUG_ON(!IS_ALIGNED(fixed_low_start, cma_alignment));
697 BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, cma_alignment));
698 } else {
699 BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, SECTION_SIZE));
700 ret = memblock_remove(fixed_low_start,
701 fixed_low_size + HOLE_SIZE);
Chitti Babu Theegalaa7458c12013-05-06 21:03:20 +0530702 pr_info("mem_map: fixed_low_area reserved at 0x%lx with size \
703 0x%x\n", fixed_low_start,
704 fixed_low_size + HOLE_SIZE);
Laura Abbott354d40f2012-08-03 17:32:09 -0700705 BUG_ON(ret);
706 }
707
Deepak Kotur35825522012-06-06 15:49:14 -0700708 fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE;
Laura Abbott354d40f2012-08-03 17:32:09 -0700709 if (middle_use_cma) {
710 BUG_ON(!IS_ALIGNED(fixed_middle_start, cma_alignment));
711 BUG_ON(!IS_ALIGNED(fixed_middle_size, cma_alignment));
712 } else {
713 BUG_ON(!IS_ALIGNED(fixed_middle_size, SECTION_SIZE));
714 ret = memblock_remove(fixed_middle_start, fixed_middle_size);
Chitti Babu Theegalaa7458c12013-05-06 21:03:20 +0530715 pr_info("mem_map: fixed_middle_area reserved at 0x%lx with \
716 size 0x%x\n", fixed_middle_start,
717 fixed_middle_size);
Laura Abbott354d40f2012-08-03 17:32:09 -0700718 BUG_ON(ret);
719 }
720
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700721 fixed_high_start = fixed_middle_start + fixed_middle_size;
Laura Abbott354d40f2012-08-03 17:32:09 -0700722 if (high_use_cma) {
723 fixed_high_size = ALIGN(fixed_high_size, cma_alignment);
724 BUG_ON(!IS_ALIGNED(fixed_high_start, cma_alignment));
725 } else {
726 /* This is the end of the fixed area so it's okay to round up */
727 fixed_high_size = ALIGN(fixed_high_size, SECTION_SIZE);
728 ret = memblock_remove(fixed_high_start, fixed_high_size);
Chitti Babu Theegalaa7458c12013-05-06 21:03:20 +0530729 pr_info("mem_map: fixed_high_area reserved at 0x%lx with size \
730 0x%x\n", fixed_high_start,
731 fixed_high_size);
Laura Abbott354d40f2012-08-03 17:32:09 -0700732 BUG_ON(ret);
733 }
734
735
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700736
Laura Abbottb93525f2012-04-12 09:57:19 -0700737 for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
738 struct ion_platform_heap *heap = &(msm8960_ion_pdata.heaps[i]);
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700739
740 if (heap->extra_data) {
741 int fixed_position = NOT_FIXED;
Steve Muckle75c34ca2012-06-12 14:27:40 -0700742 struct ion_cp_heap_pdata *pdata = NULL;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700743
Mitchel Humpherysdc4d01d2012-09-13 10:53:22 -0700744 switch ((int) heap->type) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700745 case ION_HEAP_TYPE_CP:
Deepak Kotur35825522012-06-06 15:49:14 -0700746 pdata =
747 (struct ion_cp_heap_pdata *)heap->extra_data;
748 fixed_position = pdata->fixed_position;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700749 break;
750 case ION_HEAP_TYPE_CARVEOUT:
Laura Abbott354d40f2012-08-03 17:32:09 -0700751 case ION_HEAP_TYPE_DMA:
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700752 fixed_position = ((struct ion_co_heap_pdata *)
753 heap->extra_data)->fixed_position;
754 break;
755 default:
756 break;
757 }
758
759 switch (fixed_position) {
760 case FIXED_LOW:
761 heap->base = fixed_low_start;
762 break;
763 case FIXED_MIDDLE:
764 heap->base = fixed_middle_start;
Laura Abbott354d40f2012-08-03 17:32:09 -0700765 if (middle_use_cma) {
766 ret = dma_declare_contiguous(
767 &ion_mm_heap_device.dev,
768 heap->size,
769 fixed_middle_start,
770 0xa0000000);
771 WARN_ON(ret);
772 }
Deepak Kotur35825522012-06-06 15:49:14 -0700773 pdata->secure_base = fixed_middle_start
774 - HOLE_SIZE;
775 pdata->secure_size = HOLE_SIZE + heap->size;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700776 break;
777 case FIXED_HIGH:
778 heap->base = fixed_high_start;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800779 break;
780 default:
781 break;
782 }
783 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800784 }
Laura Abbottd6183792011-08-19 13:42:24 -0700785#endif
786}
Huaibin Yanga5419422011-12-08 23:52:10 -0800787
788static void __init reserve_mdp_memory(void)
789{
790 msm8960_mdp_writeback(msm8960_reserve_table);
791}
792
Stephen Boyd668d7652012-04-25 11:31:01 -0700793static void __init reserve_cache_dump_memory(void)
Laura Abbott306bcc22012-03-08 11:24:53 -0800794{
795#ifdef CONFIG_MSM_CACHE_DUMP
Laura Abbott306bcc22012-03-08 11:24:53 -0800796 unsigned int total;
Laura Abbott306bcc22012-03-08 11:24:53 -0800797
Laura Abbott155ab6f2012-05-25 08:52:18 -0700798 total = msm8960_cache_dump_pdata.l1_size +
799 msm8960_cache_dump_pdata.l2_size;
Laura Abbott306bcc22012-03-08 11:24:53 -0800800 msm8960_reserve_table[MEMTYPE_EBI1].size += total;
Chitti Babu Theegalaa7458c12013-05-06 21:03:20 +0530801 pr_info("mem_map: cache_dump reserved with size 0x%x in pool\n",
802 total);
Laura Abbott306bcc22012-03-08 11:24:53 -0800803#endif
804}
805
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700806static void __init msm8960_calculate_reserve_sizes(void)
807{
808 size_pmem_devices();
809 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700810 reserve_ion_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800811 reserve_mdp_memory();
Laura Abbottf8c03b92012-02-16 14:57:58 -0800812 reserve_rtb_memory();
Laura Abbott306bcc22012-03-08 11:24:53 -0800813 reserve_cache_dump_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700814}
815
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700816static struct reserve_info msm8960_reserve_info __initdata = {
817 .memtype_reserve_table = msm8960_reserve_table,
818 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700819 .reserve_fixed_area = msm8960_reserve_fixed_area,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700820 .paddr_to_memtype = msm8960_paddr_to_memtype,
821};
822
Larry Basselb830e182011-10-14 10:46:55 -0700823static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700824{
825 reserve_info = &msm8960_reserve_info;
Larry Basselb830e182011-10-14 10:46:55 -0700826}
827
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800828static char prim_panel_name[PANEL_NAME_MAX_LEN];
829static char ext_panel_name[PANEL_NAME_MAX_LEN];
830static int __init prim_display_setup(char *param)
831{
832 if (strnlen(param, PANEL_NAME_MAX_LEN))
833 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
834 return 0;
835}
836early_param("prim_display", prim_display_setup);
837
838static int __init ext_display_setup(char *param)
839{
840 if (strnlen(param, PANEL_NAME_MAX_LEN))
841 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
842 return 0;
843}
844early_param("ext_display", ext_display_setup);
845
Larry Basselb830e182011-10-14 10:46:55 -0700846static void __init msm8960_reserve(void)
847{
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800848 msm8960_set_display_params(prim_panel_name, ext_panel_name);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700849 msm_reserve();
850}
851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700852static void __init msm8960_allocate_memory_regions(void)
853{
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800854 msm8960_allocate_fb_region();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700855}
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800856
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700857#ifdef CONFIG_WCD9310_CODEC
858
859#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
860
Patrick Lai3043fba2011-08-01 14:15:57 -0700861/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
862 * 4 micbiases are used to power various analog and digital
863 * microphones operating at 1800 mV. Technically, all micbiases
864 * can source from single cfilter since all microphones operate
865 * at the same voltage level. The arrangement below is to make
866 * sure all cfilters are exercised. LDO_H regulator ouput level
867 * does not need to be as high as 2.85V. It is choosen for
868 * microphone sensitivity purpose.
869 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530870static struct wcd9xxx_pdata tabla_platform_data = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700871 .slimbus_slave_device = {
872 .name = "tabla-slave",
873 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
874 },
875 .irq = MSM_GPIO_TO_INT(62),
876 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530877 .num_irqs = NR_WCD9XXX_IRQS,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700878 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -0700879 .micbias = {
880 .ldoh_v = TABLA_LDOH_2P85_V,
881 .cfilt1_mv = 1800,
Joonwoo Parkcf473b42012-03-29 19:48:16 -0700882 .cfilt2_mv = 2700,
Patrick Lai3043fba2011-08-01 14:15:57 -0700883 .cfilt3_mv = 1800,
884 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
885 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
886 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
887 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530888 },
889 .regulator = {
890 {
891 .name = "CDC_VDD_CP",
892 .min_uV = 1800000,
893 .max_uV = 1800000,
894 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
895 },
896 {
897 .name = "CDC_VDDA_RX",
898 .min_uV = 1800000,
899 .max_uV = 1800000,
900 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
901 },
902 {
903 .name = "CDC_VDDA_TX",
904 .min_uV = 1800000,
905 .max_uV = 1800000,
906 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
907 },
908 {
909 .name = "VDDIO_CDC",
910 .min_uV = 1800000,
911 .max_uV = 1800000,
912 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
913 },
914 {
915 .name = "VDDD_CDC_D",
916 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700917 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530918 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
919 },
920 {
921 .name = "CDC_VDDA_A_1P2V",
922 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700923 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530924 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
925 },
926 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700927};
928
929static struct slim_device msm_slim_tabla = {
930 .name = "tabla-slim",
931 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
932 .dev = {
933 .platform_data = &tabla_platform_data,
934 },
935};
Santosh Mardi60e19d92011-10-28 01:15:14 +0530936
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530937static struct wcd9xxx_pdata tabla20_platform_data = {
Santosh Mardi60e19d92011-10-28 01:15:14 +0530938 .slimbus_slave_device = {
939 .name = "tabla-slave",
940 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
941 },
942 .irq = MSM_GPIO_TO_INT(62),
943 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530944 .num_irqs = NR_WCD9XXX_IRQS,
Santosh Mardi60e19d92011-10-28 01:15:14 +0530945 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
946 .micbias = {
947 .ldoh_v = TABLA_LDOH_2P85_V,
948 .cfilt1_mv = 1800,
Joonwoo Parkcf473b42012-03-29 19:48:16 -0700949 .cfilt2_mv = 2700,
Santosh Mardi60e19d92011-10-28 01:15:14 +0530950 .cfilt3_mv = 1800,
951 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
952 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
953 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
954 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530955 },
956 .regulator = {
957 {
958 .name = "CDC_VDD_CP",
959 .min_uV = 1800000,
960 .max_uV = 1800000,
961 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
962 },
963 {
964 .name = "CDC_VDDA_RX",
965 .min_uV = 1800000,
966 .max_uV = 1800000,
967 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
968 },
969 {
970 .name = "CDC_VDDA_TX",
971 .min_uV = 1800000,
972 .max_uV = 1800000,
973 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
974 },
975 {
976 .name = "VDDIO_CDC",
977 .min_uV = 1800000,
978 .max_uV = 1800000,
979 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
980 },
981 {
982 .name = "VDDD_CDC_D",
983 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700984 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530985 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
986 },
987 {
988 .name = "CDC_VDDA_A_1P2V",
989 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700990 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530991 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
992 },
993 },
Santosh Mardi60e19d92011-10-28 01:15:14 +0530994};
995
996static struct slim_device msm_slim_tabla20 = {
997 .name = "tabla2x-slim",
998 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
999 .dev = {
1000 .platform_data = &tabla20_platform_data,
1001 },
1002};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001003#endif
1004
1005static struct slim_boardinfo msm_slim_devices[] = {
1006#ifdef CONFIG_WCD9310_CODEC
1007 {
1008 .bus_num = 1,
1009 .slim_slave = &msm_slim_tabla,
1010 },
Santosh Mardi60e19d92011-10-28 01:15:14 +05301011 {
1012 .bus_num = 1,
1013 .slim_slave = &msm_slim_tabla20,
1014 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001015#endif
1016 /* add more slimbus slaves as needed */
1017};
1018
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001019#define MSM_WCNSS_PHYS 0x03000000
1020#define MSM_WCNSS_SIZE 0x280000
1021
1022static struct resource resources_wcnss_wlan[] = {
1023 {
1024 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1025 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1026 .name = "wcnss_wlanrx_irq",
1027 .flags = IORESOURCE_IRQ,
1028 },
1029 {
1030 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1031 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1032 .name = "wcnss_wlantx_irq",
1033 .flags = IORESOURCE_IRQ,
1034 },
1035 {
1036 .start = MSM_WCNSS_PHYS,
1037 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1038 .name = "wcnss_mmio",
1039 .flags = IORESOURCE_MEM,
1040 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -07001041 {
1042 .start = 84,
1043 .end = 88,
1044 .name = "wcnss_gpios_5wire",
1045 .flags = IORESOURCE_IO,
1046 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001047};
1048
Ankur Nandwanib0039b02011-08-09 14:00:45 -07001049static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1050 .has_48mhz_xo = 1,
1051};
1052
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001053static struct platform_device msm_device_wcnss_wlan = {
1054 .name = "wcnss_wlan",
1055 .id = 0,
1056 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1057 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07001058 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001059};
1060
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001061#ifdef CONFIG_QSEECOM
1062/* qseecom bus scaling */
1063static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
1064 {
1065 .src = MSM_BUS_MASTER_SPS,
1066 .dst = MSM_BUS_SLAVE_EBI_CH0,
1067 .ib = 0,
1068 .ab = 0,
1069 },
1070 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001071 .src = MSM_BUS_MASTER_SPS,
1072 .dst = MSM_BUS_SLAVE_SPS,
1073 .ib = 0,
1074 .ab = 0,
1075 },
1076 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001077 .src = MSM_BUS_MASTER_SPDM,
1078 .dst = MSM_BUS_SLAVE_SPDM,
1079 .ib = 0,
1080 .ab = 0,
1081 },
1082};
1083
1084static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
1085 {
1086 .src = MSM_BUS_MASTER_SPS,
1087 .dst = MSM_BUS_SLAVE_EBI_CH0,
1088 .ib = (492 * 8) * 1000000UL,
1089 .ab = (492 * 8) * 100000UL,
1090 },
1091 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001092 .src = MSM_BUS_MASTER_SPS,
1093 .dst = MSM_BUS_SLAVE_SPS,
1094 .ib = (492 * 8) * 1000000UL,
1095 .ab = (492 * 8) * 100000UL,
1096 },
1097 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001098 .src = MSM_BUS_MASTER_SPDM,
1099 .dst = MSM_BUS_SLAVE_SPDM,
1100 .ib = 0,
1101 .ab = 0,
1102 },
1103};
1104
1105static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1106 {
1107 .src = MSM_BUS_MASTER_SPS,
1108 .dst = MSM_BUS_SLAVE_EBI_CH0,
1109 .ib = 0,
1110 .ab = 0,
1111 },
1112 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001113 .src = MSM_BUS_MASTER_SPS,
1114 .dst = MSM_BUS_SLAVE_SPS,
1115 .ib = 0,
1116 .ab = 0,
1117 },
1118 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001119 .src = MSM_BUS_MASTER_SPDM,
1120 .dst = MSM_BUS_SLAVE_SPDM,
1121 .ib = (64 * 8) * 1000000UL,
1122 .ab = (64 * 8) * 100000UL,
1123 },
1124};
1125
Ramesh Masavarapu4f091cb2012-10-03 10:18:06 -07001126static struct msm_bus_vectors qseecom_enable_dfab_sfpb_vectors[] = {
1127 {
1128 .src = MSM_BUS_MASTER_SPS,
1129 .dst = MSM_BUS_SLAVE_EBI_CH0,
1130 .ib = (492 * 8) * 1000000UL,
1131 .ab = (492 * 8) * 100000UL,
1132 },
1133 {
1134 .src = MSM_BUS_MASTER_SPS,
1135 .dst = MSM_BUS_SLAVE_SPS,
1136 .ib = (492 * 8) * 1000000UL,
1137 .ab = (492 * 8) * 100000UL,
1138 },
1139 {
1140 .src = MSM_BUS_MASTER_SPDM,
1141 .dst = MSM_BUS_SLAVE_SPDM,
1142 .ib = (64 * 8) * 1000000UL,
1143 .ab = (64 * 8) * 100000UL,
1144 },
1145};
1146
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001147static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1148 {
1149 ARRAY_SIZE(qseecom_clks_init_vectors),
1150 qseecom_clks_init_vectors,
1151 },
1152 {
1153 ARRAY_SIZE(qseecom_enable_dfab_vectors),
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001154 qseecom_enable_dfab_vectors,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001155 },
1156 {
1157 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1158 qseecom_enable_sfpb_vectors,
1159 },
Ramesh Masavarapu4f091cb2012-10-03 10:18:06 -07001160 {
1161 ARRAY_SIZE(qseecom_enable_dfab_sfpb_vectors),
1162 qseecom_enable_dfab_sfpb_vectors,
1163 },
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001164};
1165
1166static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1167 qseecom_hw_bus_scale_usecases,
1168 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1169 .name = "qsee",
1170};
1171
1172static struct platform_device qseecom_device = {
1173 .name = "qseecom",
1174 .id = 0,
1175 .dev = {
1176 .platform_data = &qseecom_bus_pdata,
1177 },
1178};
1179#endif
1180
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001181#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1182 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1183 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1184 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1185
1186#define QCE_SIZE 0x10000
1187#define QCE_0_BASE 0x18500000
1188
1189#define QCE_HW_KEY_SUPPORT 0
1190#define QCE_SHA_HMAC_SUPPORT 1
1191#define QCE_SHARE_CE_RESOURCE 1
1192#define QCE_CE_SHARED 0
1193
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001194/* Begin Bus scaling definitions */
1195static struct msm_bus_vectors crypto_hw_init_vectors[] = {
1196 {
1197 .src = MSM_BUS_MASTER_ADM_PORT0,
1198 .dst = MSM_BUS_SLAVE_EBI_CH0,
1199 .ab = 0,
1200 .ib = 0,
1201 },
1202 {
1203 .src = MSM_BUS_MASTER_ADM_PORT1,
1204 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1205 .ab = 0,
1206 .ib = 0,
1207 },
1208};
1209
1210static struct msm_bus_vectors crypto_hw_active_vectors[] = {
1211 {
1212 .src = MSM_BUS_MASTER_ADM_PORT0,
1213 .dst = MSM_BUS_SLAVE_EBI_CH0,
1214 .ab = 70000000UL,
1215 .ib = 70000000UL,
1216 },
1217 {
1218 .src = MSM_BUS_MASTER_ADM_PORT1,
1219 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1220 .ab = 2480000000UL,
1221 .ib = 2480000000UL,
1222 },
1223};
1224
1225static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
1226 {
1227 ARRAY_SIZE(crypto_hw_init_vectors),
1228 crypto_hw_init_vectors,
1229 },
1230 {
1231 ARRAY_SIZE(crypto_hw_active_vectors),
1232 crypto_hw_active_vectors,
1233 },
1234};
1235
1236static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
1237 crypto_hw_bus_scale_usecases,
1238 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
1239 .name = "cryptohw",
1240};
1241/* End Bus Scaling Definitions*/
1242
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001243static struct resource qcrypto_resources[] = {
1244 [0] = {
1245 .start = QCE_0_BASE,
1246 .end = QCE_0_BASE + QCE_SIZE - 1,
1247 .flags = IORESOURCE_MEM,
1248 },
1249 [1] = {
1250 .name = "crypto_channels",
1251 .start = DMOV_CE_IN_CHAN,
1252 .end = DMOV_CE_OUT_CHAN,
1253 .flags = IORESOURCE_DMA,
1254 },
1255 [2] = {
1256 .name = "crypto_crci_in",
1257 .start = DMOV_CE_IN_CRCI,
1258 .end = DMOV_CE_IN_CRCI,
1259 .flags = IORESOURCE_DMA,
1260 },
1261 [3] = {
1262 .name = "crypto_crci_out",
1263 .start = DMOV_CE_OUT_CRCI,
1264 .end = DMOV_CE_OUT_CRCI,
1265 .flags = IORESOURCE_DMA,
1266 },
1267};
1268
1269static struct resource qcedev_resources[] = {
1270 [0] = {
1271 .start = QCE_0_BASE,
1272 .end = QCE_0_BASE + QCE_SIZE - 1,
1273 .flags = IORESOURCE_MEM,
1274 },
1275 [1] = {
1276 .name = "crypto_channels",
1277 .start = DMOV_CE_IN_CHAN,
1278 .end = DMOV_CE_OUT_CHAN,
1279 .flags = IORESOURCE_DMA,
1280 },
1281 [2] = {
1282 .name = "crypto_crci_in",
1283 .start = DMOV_CE_IN_CRCI,
1284 .end = DMOV_CE_IN_CRCI,
1285 .flags = IORESOURCE_DMA,
1286 },
1287 [3] = {
1288 .name = "crypto_crci_out",
1289 .start = DMOV_CE_OUT_CRCI,
1290 .end = DMOV_CE_OUT_CRCI,
1291 .flags = IORESOURCE_DMA,
1292 },
1293};
1294
1295#endif
1296
1297#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1298 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1299
1300static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1301 .ce_shared = QCE_CE_SHARED,
1302 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1303 .hw_key_support = QCE_HW_KEY_SUPPORT,
1304 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001305 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001306};
1307
1308static struct platform_device qcrypto_device = {
1309 .name = "qcrypto",
1310 .id = 0,
1311 .num_resources = ARRAY_SIZE(qcrypto_resources),
1312 .resource = qcrypto_resources,
1313 .dev = {
1314 .coherent_dma_mask = DMA_BIT_MASK(32),
1315 .platform_data = &qcrypto_ce_hw_suppport,
1316 },
1317};
1318#endif
1319
1320#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1321 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1322
1323static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1324 .ce_shared = QCE_CE_SHARED,
1325 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1326 .hw_key_support = QCE_HW_KEY_SUPPORT,
1327 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001328 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001329};
1330
1331static struct platform_device qcedev_device = {
1332 .name = "qce",
1333 .id = 0,
1334 .num_resources = ARRAY_SIZE(qcedev_resources),
1335 .resource = qcedev_resources,
1336 .dev = {
1337 .coherent_dma_mask = DMA_BIT_MASK(32),
1338 .platform_data = &qcedev_ce_hw_suppport,
1339 },
1340};
1341#endif
1342
Joel King0cbf5d82012-05-24 15:21:38 -07001343static struct mdm_platform_data sglte_platform_data = {
1344 .mdm_version = "4.0",
1345 .ramdump_delay_ms = 1000,
Taniya Das21274cf2013-01-15 11:28:14 +05301346 /* delay between two PS_HOLDs */
1347 .ps_hold_delay_ms = 500,
Joel King63ce8332012-06-01 09:59:26 -07001348 .soft_reset_inverted = 1,
Joel King0cbf5d82012-05-24 15:21:38 -07001349 .peripheral_platform_device = NULL,
Ameya Thakurc9a7a842012-06-24 22:47:52 -07001350 .ramdump_timeout_ms = 600000,
Ameya Thakura98bde52012-06-28 18:55:19 -07001351 .no_powerdown_after_ramdumps = 1,
Ameya Thakur43248fd2012-07-10 18:50:52 -07001352 .image_upgrade_supported = 1,
Joel Kingb8352a12011-11-15 18:46:24 -08001353};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001354
Joel Nider266a2642011-10-16 10:58:05 +02001355#define MSM_TSIF0_PHYS (0x18200000)
1356#define MSM_TSIF1_PHYS (0x18201000)
1357#define MSM_TSIF_SIZE (0x200)
1358#define MSM_TSPP_PHYS (0x18202000)
1359#define MSM_TSPP_SIZE (0x1000)
1360#define MSM_TSPP_BAM_PHYS (0x18204000)
1361#define MSM_TSPP_BAM_SIZE (0x2000)
1362
1363#define TSIF_0_CLK GPIO_CFG(75, 1, GPIO_CFG_INPUT, \
1364 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1365#define TSIF_0_EN GPIO_CFG(76, 1, GPIO_CFG_INPUT, \
1366 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1367#define TSIF_0_DATA GPIO_CFG(77, 1, GPIO_CFG_INPUT, \
1368 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1369#define TSIF_0_SYNC GPIO_CFG(82, 1, GPIO_CFG_INPUT, \
1370 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1371#define TSIF_1_CLK GPIO_CFG(79, 1, GPIO_CFG_INPUT, \
1372 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1373#define TSIF_1_EN GPIO_CFG(80, 1, GPIO_CFG_INPUT, \
1374 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1375#define TSIF_1_DATA GPIO_CFG(81, 1, GPIO_CFG_INPUT, \
1376 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1377#define TSIF_1_SYNC GPIO_CFG(78, 1, GPIO_CFG_INPUT, \
1378 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1379
1380static const struct msm_gpio tsif_gpios[] = {
1381 { .gpio_cfg = TSIF_0_CLK, .label = "tsif0_clk", },
1382 { .gpio_cfg = TSIF_0_EN, .label = "tsif0_en", },
1383 { .gpio_cfg = TSIF_0_DATA, .label = "tsif0_data", },
1384 { .gpio_cfg = TSIF_0_SYNC, .label = "tsif0_sync", },
1385 { .gpio_cfg = TSIF_1_CLK, .label = "tsif1_clk", },
1386 { .gpio_cfg = TSIF_1_EN, .label = "tsif1_en", },
1387 { .gpio_cfg = TSIF_1_DATA, .label = "tsif1_data", },
1388 { .gpio_cfg = TSIF_1_SYNC, .label = "tsif1_sync", },
1389};
1390
1391static struct resource tspp_resources[] = {
1392 [0] = {
Liron Kuch8fa85b02013-01-01 18:29:47 +02001393 .name = "TSIF_TSPP_IRQ",
Joel Nider266a2642011-10-16 10:58:05 +02001394 .flags = IORESOURCE_IRQ,
1395 .start = TSIF_TSPP_IRQ,
Liron Kuch8fa85b02013-01-01 18:29:47 +02001396 .end = TSIF_TSPP_IRQ,
Joel Nider266a2642011-10-16 10:58:05 +02001397 },
1398 [1] = {
Liron Kuch8fa85b02013-01-01 18:29:47 +02001399 .name = "TSIF0_IRQ",
1400 .flags = IORESOURCE_IRQ,
1401 .start = TSIF1_IRQ,
1402 .end = TSIF1_IRQ,
1403 },
1404 [2] = {
1405 .name = "TSIF1_IRQ",
1406 .flags = IORESOURCE_IRQ,
1407 .start = TSIF2_IRQ,
1408 .end = TSIF2_IRQ,
1409 },
1410 [3] = {
1411 .name = "TSIF_BAM_IRQ",
1412 .flags = IORESOURCE_IRQ,
1413 .start = TSIF_BAM_IRQ,
1414 .end = TSIF_BAM_IRQ,
1415 },
1416 [4] = {
1417 .name = "MSM_TSIF0_PHYS",
Joel Nider266a2642011-10-16 10:58:05 +02001418 .flags = IORESOURCE_MEM,
1419 .start = MSM_TSIF0_PHYS,
1420 .end = MSM_TSIF0_PHYS + MSM_TSIF_SIZE - 1,
1421 },
Liron Kuch8fa85b02013-01-01 18:29:47 +02001422 [5] = {
1423 .name = "MSM_TSIF1_PHYS",
Joel Nider266a2642011-10-16 10:58:05 +02001424 .flags = IORESOURCE_MEM,
1425 .start = MSM_TSIF1_PHYS,
1426 .end = MSM_TSIF1_PHYS + MSM_TSIF_SIZE - 1,
1427 },
Liron Kuch8fa85b02013-01-01 18:29:47 +02001428 [6] = {
1429 .name = "MSM_TSPP_PHYS",
Joel Nider266a2642011-10-16 10:58:05 +02001430 .flags = IORESOURCE_MEM,
1431 .start = MSM_TSPP_PHYS,
1432 .end = MSM_TSPP_PHYS + MSM_TSPP_SIZE - 1,
1433 },
Liron Kuch8fa85b02013-01-01 18:29:47 +02001434 [7] = {
1435 .name = "MSM_TSPP_BAM_PHYS",
Joel Nider266a2642011-10-16 10:58:05 +02001436 .flags = IORESOURCE_MEM,
1437 .start = MSM_TSPP_BAM_PHYS,
1438 .end = MSM_TSPP_BAM_PHYS + MSM_TSPP_BAM_SIZE - 1,
1439 },
1440};
1441
1442static struct msm_tspp_platform_data tspp_platform_data = {
1443 .num_gpios = ARRAY_SIZE(tsif_gpios),
1444 .gpios = tsif_gpios,
1445 .tsif_pclk = "tsif_pclk",
1446 .tsif_ref_clk = "tsif_ref_clk",
1447};
1448
1449static struct platform_device msm_device_tspp = {
1450 .name = "msm_tspp",
1451 .id = 0,
1452 .num_resources = ARRAY_SIZE(tspp_resources),
1453 .resource = tspp_resources,
1454 .dev = {
1455 .platform_data = &tspp_platform_data
1456 },
1457};
1458
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001459#define MSM_SHARED_RAM_PHYS 0x80000000
1460
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001461static void __init msm8960_map_io(void)
1462{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001463 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001464 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001465
1466 if (socinfo_init() < 0)
1467 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001468}
1469
1470static void __init msm8960_init_irq(void)
1471{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001472 struct msm_mpm_device_data *data = NULL;
1473
1474#ifdef CONFIG_MSM_MPM
1475 data = &msm8960_mpm_dev_data;
1476#endif
1477
1478 msm_mpm_irq_extn_init(data);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001479 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001480 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001481}
1482
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001483static void __init msm8960_init_buses(void)
1484{
1485#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -06001486 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -06001487 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
1488 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
Gagan Macae154c4b2011-10-05 19:24:43 -06001489 msm_bus_apps_fabric.dev.platform_data =
1490 &msm_bus_8960_apps_fabric_pdata;
1491 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
Gagan Mac680bfc02012-07-19 19:11:00 -06001492 if (cpu_is_msm8960ab()) {
1493 msm_bus_8960_sg_mm_fabric_pdata.rpm_enabled = 1;
1494 msm_bus_mm_fabric.dev.platform_data =
1495 &msm_bus_8960_sg_mm_fabric_pdata;
1496 } else {
1497 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
1498 msm_bus_mm_fabric.dev.platform_data =
1499 &msm_bus_8960_mm_fabric_pdata;
1500 }
Gagan Macae154c4b2011-10-05 19:24:43 -06001501 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
1502 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001503#endif
1504}
1505
1506static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
1507 .max_clock_speed = 15060000,
Kiran Gunda2b285652012-07-30 13:22:39 +05301508 .infinite_mode = 0xFFC0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001509};
1510
1511#ifdef CONFIG_USB_MSM_OTG_72K
1512static struct msm_otg_platform_data msm_otg_pdata;
1513#else
Anji jonnalaa8b8d732011-12-06 10:03:24 +05301514static int wr_phy_init_seq[] = {
1515 0x44, 0x80, /* set VBUS valid threshold
1516 and disconnect valid threshold */
1517 0x38, 0x81, /* update DC voltage level */
1518 0x14, 0x82, /* set preemphasis and rise/fall time */
1519 0x13, 0x83, /* set source impedance adjusment */
1520 -1};
1521
1522static int liquid_v1_phy_init_seq[] = {
1523 0x44, 0x80,/* set VBUS valid threshold
1524 and disconnect valid threshold */
1525 0x3C, 0x81,/* update DC voltage level */
1526 0x18, 0x82,/* set preemphasis and rise/fall time */
1527 0x23, 0x83,/* set source impedance sdjusment */
1528 -1};
1529
Mayank Ranaa1f507b2012-08-14 10:57:00 +05301530static int sglte_phy_init_seq[] = {
1531 0x44, 0x80, /* set VBUS valid threshold
1532 and disconnect valid threshold */
1533 0x3A, 0x81, /* update DC voltage level */
1534 0x24, 0x82, /* set preemphasis and rise/fall time */
1535 0x13, 0x83, /* set source impedance adjusment */
1536 -1};
1537
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301538#ifdef CONFIG_MSM_BUS_SCALING
1539/* Bandwidth requests (zero) if no vote placed */
1540static struct msm_bus_vectors usb_init_vectors[] = {
1541 {
1542 .src = MSM_BUS_MASTER_SPS,
1543 .dst = MSM_BUS_SLAVE_EBI_CH0,
1544 .ab = 0,
1545 .ib = 0,
1546 },
1547};
1548
1549/* Bus bandwidth requests in Bytes/sec */
1550static struct msm_bus_vectors usb_max_vectors[] = {
1551 {
1552 .src = MSM_BUS_MASTER_SPS,
1553 .dst = MSM_BUS_SLAVE_EBI_CH0,
1554 .ab = 60000000, /* At least 480Mbps on bus. */
1555 .ib = 960000000, /* MAX bursts rate */
1556 },
1557};
1558
1559static struct msm_bus_paths usb_bus_scale_usecases[] = {
1560 {
1561 ARRAY_SIZE(usb_init_vectors),
1562 usb_init_vectors,
1563 },
1564 {
1565 ARRAY_SIZE(usb_max_vectors),
1566 usb_max_vectors,
1567 },
1568};
1569
1570static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
1571 usb_bus_scale_usecases,
1572 ARRAY_SIZE(usb_bus_scale_usecases),
1573 .name = "usb",
1574};
1575#endif
1576
Jack Pham87f202f2012-08-06 00:24:22 -07001577#define MSM_MPM_PIN_USB1_OTGSESSVLD 40
1578
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001579static struct msm_otg_platform_data msm_otg_pdata = {
1580 .mode = USB_OTG,
1581 .otg_control = OTG_PMIC_CONTROL,
1582 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001583 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
Anji jonnala4e3e6772011-09-15 18:53:42 +05301584 .power_budget = 750,
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301585#ifdef CONFIG_MSM_BUS_SCALING
1586 .bus_scale_table = &usb_bus_scale_pdata,
Jack Pham87f202f2012-08-06 00:24:22 -07001587 .mpm_otgsessvld_int = MSM_MPM_PIN_USB1_OTGSESSVLD,
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301588#endif
Pavankumar Kondeti2aec9f32012-06-13 09:06:03 +05301589#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
1590 .mhl_dev_name = "sii8334",
1591#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001592};
1593#endif
1594
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301595#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05301596#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301597static struct msm_hsic_host_platform_data msm_hsic_pdata = {
1598 .strobe = 150,
1599 .data = 151,
1600};
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301601
1602static struct smsc_hub_platform_data hsic_hub_pdata = {
1603 .hub_reset = HSIC_HUB_RESET_GPIO,
1604};
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301605#else
1606static struct msm_hsic_host_platform_data msm_hsic_pdata;
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301607static struct smsc_hub_platform_data hsic_hub_pdata;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301608#endif
1609
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301610static struct platform_device smsc_hub_device = {
1611 .name = "msm_smsc_hub",
1612 .id = -1,
1613 .dev = {
1614 .platform_data = &hsic_hub_pdata,
1615 },
1616};
1617
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001618#define PID_MAGIC_ID 0x71432909
1619#define SERIAL_NUM_MAGIC_ID 0x61945374
1620#define SERIAL_NUMBER_LENGTH 127
1621#define DLOAD_USB_BASE_ADD 0x2A03F0C8
1622
1623struct magic_num_struct {
1624 uint32_t pid;
1625 uint32_t serial_num;
1626};
1627
1628struct dload_struct {
1629 uint32_t reserved1;
1630 uint32_t reserved2;
1631 uint32_t reserved3;
1632 uint16_t reserved4;
1633 uint16_t pid;
1634 char serial_number[SERIAL_NUMBER_LENGTH];
1635 uint16_t reserved5;
1636 struct magic_num_struct magic_struct;
1637};
1638
1639static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
1640{
1641 struct dload_struct __iomem *dload = 0;
1642
1643 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
1644 if (!dload) {
1645 pr_err("%s: cannot remap I/O memory region: %08x\n",
1646 __func__, DLOAD_USB_BASE_ADD);
1647 return -ENXIO;
1648 }
1649
1650 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
1651 __func__, dload, pid, snum);
1652 /* update pid */
1653 dload->magic_struct.pid = PID_MAGIC_ID;
1654 dload->pid = pid;
1655
1656 /* update serial number */
1657 dload->magic_struct.serial_num = 0;
1658 if (!snum) {
1659 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
1660 goto out;
1661 }
1662
1663 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -07001664 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001665out:
1666 iounmap(dload);
1667 return 0;
1668}
1669
1670static struct android_usb_platform_data android_usb_pdata = {
1671 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1672};
1673
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001674static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001675 .name = "android_usb",
1676 .id = -1,
1677 .dev = {
1678 .platform_data = &android_usb_pdata,
1679 },
1680};
1681
1682static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1683 0x03, 0x0f,
1684};
1685
Anji Jonnala85b29ff2013-01-15 14:12:45 +05301686static uint8_t spm_retention_cmd_sequence[] __initdata = {
1687 0x00, 0x05, 0x03, 0x0D,
1688 0x0B, 0x00, 0x0f,
1689};
1690
Anji Jonnala786b39e2013-01-29 13:34:10 +05301691static uint8_t spm_retention_with_krait_v3_cmd_sequence[] __initdata = {
1692 0x42, 0x1B, 0x00,
1693 0x05, 0x03, 0x0D, 0x0B,
1694 0x00, 0x42, 0x1B,
1695 0x0f,
1696};
1697
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001698static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1699 0x00, 0x24, 0x54, 0x10,
1700 0x09, 0x03, 0x01,
1701 0x10, 0x54, 0x30, 0x0C,
1702 0x24, 0x30, 0x0f,
1703};
1704
1705static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1706 0x00, 0x24, 0x54, 0x10,
1707 0x09, 0x07, 0x01, 0x0B,
1708 0x10, 0x54, 0x30, 0x0C,
1709 0x24, 0x30, 0x0f,
1710};
1711
Anji Jonnala0f297a92013-01-19 11:22:25 +05301712/* 8960AB has a different command to assert apc_pdn */
1713static uint8_t spm_power_collapse_without_rpm_krait_v3[] __initdata = {
1714 0x00, 0x24, 0x84, 0x10,
1715 0x09, 0x03, 0x01,
1716 0x10, 0x84, 0x30, 0x0C,
1717 0x24, 0x30, 0x0f,
1718};
1719
1720static uint8_t spm_power_collapse_with_rpm_krait_v3[] __initdata = {
1721 0x00, 0x24, 0x84, 0x10,
1722 0x09, 0x07, 0x01, 0x0B,
1723 0x10, 0x84, 0x30, 0x0C,
1724 0x24, 0x30, 0x0f,
1725};
1726
Anji Jonnala85b29ff2013-01-15 14:12:45 +05301727static struct msm_spm_seq_entry msm_spm_boot_cpu_seq_list[] __initdata = {
1728 [0] = {
1729 .mode = MSM_SPM_MODE_CLOCK_GATING,
1730 .notify_rpm = false,
1731 .cmd = spm_wfi_cmd_sequence,
1732 },
1733
1734 [1] = {
1735 .mode = MSM_SPM_MODE_POWER_RETENTION,
1736 .notify_rpm = false,
1737 .cmd = spm_retention_cmd_sequence,
1738 },
1739
1740 [2] = {
1741 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1742 .notify_rpm = false,
1743 .cmd = spm_power_collapse_without_rpm,
1744 },
1745 [3] = {
1746 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1747 .notify_rpm = true,
1748 .cmd = spm_power_collapse_with_rpm,
1749 },
1750};
1751
1752static struct msm_spm_seq_entry msm_spm_nonboot_cpu_seq_list[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001753 [0] = {
1754 .mode = MSM_SPM_MODE_CLOCK_GATING,
1755 .notify_rpm = false,
1756 .cmd = spm_wfi_cmd_sequence,
1757 },
Anji Jonnala786b39e2013-01-29 13:34:10 +05301758
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001759 [1] = {
Anji Jonnala786b39e2013-01-29 13:34:10 +05301760 .mode = MSM_SPM_MODE_POWER_RETENTION,
1761 .notify_rpm = false,
1762 .cmd = spm_retention_cmd_sequence,
1763 },
1764
1765 [2] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001766 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1767 .notify_rpm = false,
1768 .cmd = spm_power_collapse_without_rpm,
1769 },
Anji Jonnala786b39e2013-01-29 13:34:10 +05301770
1771 [3] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001772 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1773 .notify_rpm = true,
1774 .cmd = spm_power_collapse_with_rpm,
1775 },
1776};
1777
1778static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1779 [0] = {
1780 .reg_base_addr = MSM_SAW0_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001781 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001782#if defined(CONFIG_MSM_AVS_HW)
Anji Jonnalafb119af2012-11-26 15:56:26 +05301783 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x58589464,
Praveen Chidambaramd3c5eaf2012-03-16 12:08:42 -06001784 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00020000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001785#endif
1786 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Anji Jonnala85b29ff2013-01-15 14:12:45 +05301787 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004,
1788 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C,
1789 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001790 .vctl_timeout_us = 50,
Anji Jonnala85b29ff2013-01-15 14:12:45 +05301791 .num_modes = ARRAY_SIZE(msm_spm_boot_cpu_seq_list),
1792 .modes = msm_spm_boot_cpu_seq_list,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001793 },
1794 [1] = {
1795 .reg_base_addr = MSM_SAW1_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001796 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001797#if defined(CONFIG_MSM_AVS_HW)
Anji Jonnalafb119af2012-11-26 15:56:26 +05301798 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x58589464,
Praveen Chidambaramd3c5eaf2012-03-16 12:08:42 -06001799 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00020000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001800#endif
1801 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Anji Jonnala786b39e2013-01-29 13:34:10 +05301802 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004,
1803 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C,
1804 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001805 .vctl_timeout_us = 50,
Anji Jonnala85b29ff2013-01-15 14:12:45 +05301806 .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
1807 .modes = msm_spm_nonboot_cpu_seq_list,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001808 },
1809};
1810
1811static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1812 0x00, 0x20, 0x03, 0x20,
1813 0x00, 0x0f,
1814};
1815
1816static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1817 0x00, 0x20, 0x34, 0x64,
1818 0x48, 0x07, 0x48, 0x20,
1819 0x50, 0x64, 0x04, 0x34,
1820 0x50, 0x0f,
1821};
1822static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1823 0x00, 0x10, 0x34, 0x64,
1824 0x48, 0x07, 0x48, 0x10,
1825 0x50, 0x64, 0x04, 0x34,
1826 0x50, 0x0F,
1827};
1828
1829static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1830 [0] = {
1831 .mode = MSM_SPM_L2_MODE_RETENTION,
1832 .notify_rpm = false,
1833 .cmd = l2_spm_wfi_cmd_sequence,
1834 },
1835 [1] = {
1836 .mode = MSM_SPM_L2_MODE_GDHS,
1837 .notify_rpm = true,
1838 .cmd = l2_spm_gdhs_cmd_sequence,
1839 },
1840 [2] = {
1841 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1842 .notify_rpm = true,
1843 .cmd = l2_spm_power_off_cmd_sequence,
1844 },
1845};
1846
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001847static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1848 [0] = {
1849 .reg_base_addr = MSM_SAW_L2_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001850 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001851 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001852 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1853 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1854 .modes = msm_spm_l2_seq_list,
1855 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1856 },
1857};
1858
Anirudh Ghayal15698162012-07-31 11:51:32 +05301859#define HAP_SHIFT_LVL_OE_GPIO 47
1860#define HAP_SHIFT_LVL_OE_GPIO_SGLTE 89
Mohan Pallaka5e490392011-09-09 15:18:41 +05301861#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1862#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
1863
1864static struct msm_xo_voter *xo_handle_d1;
1865
1866static int isa1200_power(int on)
1867{
1868 int rc = 0;
Anirudh Ghayal15698162012-07-31 11:51:32 +05301869 int hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO;
Mohan Pallaka5e490392011-09-09 15:18:41 +05301870
Anirudh Ghayal15698162012-07-31 11:51:32 +05301871 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
1872 hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO_SGLTE;
1873
1874
1875 gpio_set_value(hap_oe_gpio, !!on);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301876
1877 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
1878 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
1879 if (rc < 0) {
1880 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
1881 __func__, on ? "" : "de-", rc);
1882 goto err_xo_vote;
1883 }
1884
1885 return 0;
1886
1887err_xo_vote:
Anirudh Ghayal15698162012-07-31 11:51:32 +05301888 gpio_set_value(hap_oe_gpio, !on);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301889 return rc;
1890}
1891
1892static int isa1200_dev_setup(bool enable)
1893{
1894 int rc = 0;
Anirudh Ghayal15698162012-07-31 11:51:32 +05301895 int hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO;
Mohan Pallaka5e490392011-09-09 15:18:41 +05301896
1897 struct pm_gpio hap_gpio_config = {
1898 .direction = PM_GPIO_DIR_OUT,
1899 .pull = PM_GPIO_PULL_NO,
1900 .out_strength = PM_GPIO_STRENGTH_HIGH,
1901 .function = PM_GPIO_FUNC_NORMAL,
1902 .inv_int_pol = 0,
1903 .vin_sel = 2,
1904 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1905 .output_value = 0,
1906 };
1907
Anirudh Ghayal15698162012-07-31 11:51:32 +05301908 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
1909 hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO_SGLTE;
1910
Mohan Pallaka5e490392011-09-09 15:18:41 +05301911 if (enable == true) {
1912 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
1913 if (rc) {
1914 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1915 __func__, PM_HAP_EN_GPIO, rc);
1916 return rc;
1917 }
1918
1919 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
1920 if (rc) {
1921 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1922 __func__, PM_HAP_LEN_GPIO, rc);
1923 return rc;
1924 }
1925
Anirudh Ghayal15698162012-07-31 11:51:32 +05301926 rc = gpio_request(hap_oe_gpio, "hap_shft_lvl_oe");
Mohan Pallaka5e490392011-09-09 15:18:41 +05301927 if (rc) {
1928 pr_err("%s: unable to request gpio %d (%d)\n",
Anirudh Ghayal15698162012-07-31 11:51:32 +05301929 __func__, hap_oe_gpio, rc);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301930 return rc;
1931 }
1932
Anirudh Ghayal15698162012-07-31 11:51:32 +05301933 rc = gpio_direction_output(hap_oe_gpio, 0);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301934 if (rc) {
1935 pr_err("%s: Unable to set direction\n", __func__);
1936 goto free_gpio;
1937 }
1938
1939 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
1940 if (IS_ERR(xo_handle_d1)) {
1941 rc = PTR_ERR(xo_handle_d1);
1942 pr_err("%s: failed to get the handle for D1(%d)\n",
1943 __func__, rc);
1944 goto gpio_set_dir;
1945 }
1946 } else {
Anirudh Ghayal15698162012-07-31 11:51:32 +05301947 gpio_free(hap_oe_gpio);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301948
1949 msm_xo_put(xo_handle_d1);
1950 }
1951
1952 return 0;
1953
1954gpio_set_dir:
Anirudh Ghayal15698162012-07-31 11:51:32 +05301955 gpio_set_value(hap_oe_gpio, 0);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301956free_gpio:
Anirudh Ghayal15698162012-07-31 11:51:32 +05301957 gpio_free(hap_oe_gpio);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301958 return rc;
1959}
1960
1961static struct isa1200_regulator isa1200_reg_data[] = {
1962 {
1963 .name = "vcc_i2c",
1964 .min_uV = ISA_I2C_VTG_MIN_UV,
1965 .max_uV = ISA_I2C_VTG_MAX_UV,
1966 .load_uA = ISA_I2C_CURR_UA,
1967 },
1968};
1969
1970static struct isa1200_platform_data isa1200_1_pdata = {
1971 .name = "vibrator",
1972 .dev_setup = isa1200_dev_setup,
1973 .power_on = isa1200_power,
1974 .hap_en_gpio = PM_HAP_EN_GPIO,
1975 .hap_len_gpio = PM_HAP_LEN_GPIO,
1976 .max_timeout = 15000,
1977 .mode_ctrl = PWM_GEN_MODE,
1978 .pwm_fd = {
1979 .pwm_div = 256,
1980 },
1981 .is_erm = false,
1982 .smart_en = true,
1983 .ext_clk_en = true,
1984 .chip_en = 1,
1985 .regulator_info = isa1200_reg_data,
1986 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1987};
1988
1989static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1990 {
1991 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
Mohan Pallaka5e490392011-09-09 15:18:41 +05301992 },
1993};
1994
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001995#define CYTTSP_TS_GPIO_IRQ 11
1996#define CYTTSP_TS_SLEEP_GPIO 50
1997#define CYTTSP_TS_RESOUT_N_GPIO 52
1998
1999/*virtual key support */
2000static ssize_t tma340_vkeys_show(struct kobject *kobj,
2001 struct kobj_attribute *attr, char *buf)
2002{
2003 return snprintf(buf, 200,
2004 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
2005 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
2006 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
2007 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
2008 "\n");
2009}
2010
2011static struct kobj_attribute tma340_vkeys_attr = {
2012 .attr = {
2013 .mode = S_IRUGO,
2014 },
2015 .show = &tma340_vkeys_show,
2016};
2017
2018static struct attribute *tma340_properties_attrs[] = {
2019 &tma340_vkeys_attr.attr,
2020 NULL
2021};
2022
2023static struct attribute_group tma340_properties_attr_group = {
2024 .attrs = tma340_properties_attrs,
2025};
2026
2027
2028static int cyttsp_platform_init(struct i2c_client *client)
2029{
2030 int rc = 0;
2031 static struct kobject *tma340_properties_kobj;
2032
2033 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
2034 tma340_properties_kobj = kobject_create_and_add("board_properties",
2035 NULL);
2036 if (tma340_properties_kobj)
2037 rc = sysfs_create_group(tma340_properties_kobj,
2038 &tma340_properties_attr_group);
2039 if (!tma340_properties_kobj || rc)
2040 pr_err("%s: failed to create board_properties\n",
2041 __func__);
2042
2043 return 0;
2044}
2045
2046static struct cyttsp_regulator regulator_data[] = {
2047 {
2048 .name = "vdd",
2049 .min_uV = CY_TMA300_VTG_MIN_UV,
2050 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05302051 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
2052 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002053 },
2054 /* TODO: Remove after runtime PM is enabled in I2C driver */
2055 {
2056 .name = "vcc_i2c",
2057 .min_uV = CY_I2C_VTG_MIN_UV,
2058 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05302059 .hpm_load_uA = CY_I2C_CURR_UA,
2060 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002061 },
2062};
2063
2064static struct cyttsp_platform_data cyttsp_pdata = {
2065 .panel_maxx = 634,
2066 .panel_maxy = 1166,
2067 .disp_maxx = 616,
2068 .disp_maxy = 1023,
2069 .disp_minx = 0,
2070 .disp_miny = 16,
2071 .flags = 0x01,
2072 .gen = CY_GEN3, /* or */
2073 .use_st = CY_USE_ST,
2074 .use_mt = CY_USE_MT,
2075 .use_hndshk = CY_SEND_HNDSHK,
2076 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05302077 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002078 .use_gestures = CY_USE_GESTURES,
2079 .fw_fname = "cyttsp_8960_cdp.hex",
2080 /* activate up to 4 groups
2081 * and set active distance
2082 */
2083 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
2084 CY_GEST_GRP3 | CY_GEST_GRP4 |
2085 CY_ACT_DIST,
Amy Maloche7b741b22012-06-14 14:37:22 -07002086 .act_intrvl = 10,
2087 .tch_tmout = 200,
2088 .lp_intrvl = 30,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002089 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
2090 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
2091 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
2092 .regulator_info = regulator_data,
2093 .num_regulators = ARRAY_SIZE(regulator_data),
2094 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05302095 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002096};
2097
2098static struct i2c_board_info cyttsp_info[] __initdata = {
2099 {
2100 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
2101 .platform_data = &cyttsp_pdata,
2102#ifndef CY_USE_TIMER
2103 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
2104#endif /* CY_USE_TIMER */
2105 },
2106};
2107
Jing Lindc4413c2012-01-16 15:22:52 -08002108/* configuration data for mxt1386 */
2109static const u8 mxt1386_config_data[] = {
Mohan Pallaka50837382011-09-07 11:00:57 +05302110 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002111 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302112 /* T38 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002113 11, 2, 0, 11, 11, 11, 0, 0, 0, 0,
Jing Lin2f863172011-10-17 10:56:58 -07002114 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2115 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2116 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2117 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2118 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2119 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302120 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002121 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05302122 /* T8 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002123 8, 0, 0, 0, 0, 0, 8, 14, 50, 215,
Mohan Pallaka50837382011-09-07 11:00:57 +05302124 /* T9 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002125 131, 0, 0, 26, 42, 0, 32, 63, 3, 5,
2126 0, 2, 1, 113, 10, 10, 8, 10, 255, 2,
2127 85, 5, 0, 0, 20, 20, 75, 25, 202, 29,
2128 10, 10, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05302129 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002130 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2131 0,
Anirudh Ghayaldab4e0d2012-01-09 14:59:27 +05302132 /* T18 Object */
2133 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302134 /* T22 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002135 5, 0, 0, 0, 0, 0, 0, 0, 30, 0,
2136 0, 0, 5, 8, 10, 13, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302137 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002138 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2139 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302140 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002141 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
2142 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302143 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002144 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302145 /* T28 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002146 0, 0, 0, 8, 12, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05302147 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002148 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302149 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002150 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302151 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002152 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302153};
2154
Jing Lin33b007d2011-12-21 17:40:23 -08002155/* configuration data for mxt1386e using V1.0 firmware */
2156static const u8 mxt1386e_config_data_v1_0[] = {
2157 /* T6 Object */
2158 0, 0, 0, 0, 0, 0,
2159 /* T38 Object */
2160 12, 1, 0, 17, 1, 12, 0, 0, 0, 0,
2161 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2162 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2163 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2164 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2165 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2166 0, 0, 0, 0,
2167 /* T7 Object */
2168 100, 16, 50,
2169 /* T8 Object */
2170 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
2171 /* T9 Object */
2172 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
2173 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
2174 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
2175 10, 5, 0, 0, 0,
2176 /* T18 Object */
2177 0, 0,
2178 /* T24 Object */
2179 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2180 0, 0, 0, 0, 0, 0, 0, 0, 0,
2181 /* T25 Object */
2182 3, 0, 60, 115, 156, 99,
2183 /* T27 Object */
2184 0, 0, 0, 0, 0, 0, 0,
2185 /* T40 Object */
2186 0, 0, 0, 0, 0,
2187 /* T42 Object */
2188 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
2189 /* T43 Object */
2190 0, 0, 0, 0, 0, 0, 0,
2191 /* T46 Object */
2192 64, 0, 20, 20, 0, 0, 0, 0, 0,
2193 /* T47 Object */
2194 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2195 /* T48 Object */
2196 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
2197 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
2198 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
2199 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
2200 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2201 0, 0, 0, 0,
2202 /* T56 Object */
2203 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2204 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2205 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2206 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2207 2, 99, 33,
2208};
2209
2210/* configuration data for mxt1386e using V2.1 firmware */
2211static const u8 mxt1386e_config_data_v2_1[] = {
2212 /* T6 Object */
2213 0, 0, 0, 0, 0, 0,
2214 /* T38 Object */
Jing Lina0bc4102012-07-06 17:03:45 -07002215 12, 4, 0, 5, 7, 12, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002216 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2217 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2218 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2219 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2220 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2221 0, 0, 0, 0,
2222 /* T7 Object */
2223 100, 16, 50,
2224 /* T8 Object */
2225 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
2226 /* T9 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002227 139, 0, 0, 26, 42, 0, 32, 80, 2, 5,
Jing Lina0bc4102012-07-06 17:03:45 -07002228 0, 5, 5, 79, 10, 30, 10, 10, 255, 2,
Jing Lin33b007d2011-12-21 17:40:23 -08002229 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
2230 10, 5, 0, 0, 0,
2231 /* T18 Object */
2232 0, 0,
2233 /* T24 Object */
2234 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2235 0, 0, 0, 0, 0, 0, 0, 0, 0,
2236 /* T25 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002237 1, 0, 60, 115, 156, 99,
Jing Lin33b007d2011-12-21 17:40:23 -08002238 /* T27 Object */
2239 0, 0, 0, 0, 0, 0, 0,
2240 /* T40 Object */
2241 0, 0, 0, 0, 0,
2242 /* T42 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002243 0, 0, 255, 0, 255, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002244 /* T43 Object */
2245 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
2246 16,
2247 /* T46 Object */
Jing Lina0bc4102012-07-06 17:03:45 -07002248 64, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002249 /* T47 Object */
2250 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2251 /* T48 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002252 1, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002253 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
2254 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
2255 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
2256 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2257 0, 0, 0, 0,
2258 /* T56 Object */
2259 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2260 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2261 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2262 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2263 2, 99, 33, 0, 149, 24, 193, 255, 255, 255,
2264 255,
2265};
2266
Jing Lineec88ca2012-02-08 11:18:30 -08002267/* configuration data for mxt1386e on 3D SKU using V2.1 firmware */
2268static const u8 mxt1386e_config_data_3d[] = {
2269 /* T6 Object */
2270 0, 0, 0, 0, 0, 0,
2271 /* T38 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002272 13, 1, 0, 23, 2, 12, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002273 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2274 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2275 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2276 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2277 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2278 0, 0, 0, 0,
2279 /* T7 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002280 100, 10, 50,
Jing Lineec88ca2012-02-08 11:18:30 -08002281 /* T8 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002282 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002283 /* T9 Object */
2284 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
2285 0, 5, 5, 0, 10, 30, 10, 10, 175, 4,
Jing Lin66ba78b2012-02-24 21:25:12 -08002286 127, 7, 26, 21, 17, 19, 143, 35, 207, 40,
2287 20, 5, 54, 49, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002288 /* T18 Object */
2289 0, 0,
2290 /* T24 Object */
2291 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2292 0, 0, 0, 0, 0, 0, 0, 0, 0,
2293 /* T25 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002294 0, 0, 72, 113, 168, 97,
Jing Lineec88ca2012-02-08 11:18:30 -08002295 /* T27 Object */
2296 0, 0, 0, 0, 0, 0, 0,
2297 /* T40 Object */
2298 0, 0, 0, 0, 0,
2299 /* T42 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002300 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002301 /* T43 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002302 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2303 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002304 /* T46 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002305 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002306 /* T47 Object */
2307 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2308 /* T48 Object */
2309 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08002310 32, 50, 0, 10, 10, 0, 0, 100, 10, 90,
2311 0, 0, 0, 0, 0, 0, 0, 10, 1, 30,
2312 52, 10, 5, 0, 33, 0, 1, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002313 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2314 0, 0, 0, 0,
2315 /* T56 Object */
2316 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2317 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2318 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2319 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08002320 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2321 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002322};
2323
Amy Maloche08266db2011-11-04 11:07:16 -07002324#define MXT_TS_GPIO_IRQ 11
2325#define MXT_TS_LDO_EN_GPIO 50
2326#define MXT_TS_RESET_GPIO 52
Mohan Pallaka50837382011-09-07 11:00:57 +05302327
2328static void mxt_init_hw_liquid(void)
2329{
2330 int rc;
2331
Mohan Pallaka50837382011-09-07 11:00:57 +05302332 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
2333 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07002334 pr_err("%s: unable to request mxt_ldo_en_gpio [%d]\n",
2335 __func__, MXT_TS_LDO_EN_GPIO);
2336 return;
Mohan Pallaka50837382011-09-07 11:00:57 +05302337 }
2338
2339 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
2340 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07002341 pr_err("%s: unable to set_direction for mxt_ldo_en_gpio [%d]\n",
2342 __func__, MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05302343 goto err_ldo_gpio_req;
2344 }
2345
Mohan Pallaka50837382011-09-07 11:00:57 +05302346 return;
2347
Mohan Pallaka50837382011-09-07 11:00:57 +05302348err_ldo_gpio_req:
2349 gpio_free(MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05302350}
2351
Jing Lineec88ca2012-02-08 11:18:30 -08002352static struct mxt_config_info mxt_config_array_2d[] = {
Jing Lindc4413c2012-01-16 15:22:52 -08002353 {
2354 .config = mxt1386_config_data,
2355 .config_length = ARRAY_SIZE(mxt1386_config_data),
2356 .family_id = 0xA0,
2357 .variant_id = 0x0,
2358 .version = 0x10,
2359 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002360 .bootldr_id = MXT_BOOTLOADER_ID_1386,
Jing Lindc4413c2012-01-16 15:22:52 -08002361 },
Jing Lin33b007d2011-12-21 17:40:23 -08002362 {
2363 .config = mxt1386e_config_data_v1_0,
2364 .config_length = ARRAY_SIZE(mxt1386e_config_data_v1_0),
2365 .family_id = 0xA0,
2366 .variant_id = 0x2,
2367 .version = 0x10,
2368 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002369 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Linaeaeed52012-03-26 14:57:15 -07002370 .fw_name = "atmel_8960_liquid_v2_2_AA.hex",
Jing Lin33b007d2011-12-21 17:40:23 -08002371 },
2372 {
2373 .config = mxt1386e_config_data_v2_1,
2374 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
2375 .family_id = 0xA0,
2376 .variant_id = 0x7,
2377 .version = 0x21,
2378 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002379 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Linaeaeed52012-03-26 14:57:15 -07002380 .fw_name = "atmel_8960_liquid_v2_2_AA.hex",
2381 },
2382 {
2383 /* The config data for V2.2.AA is the same as for V2.1.AA */
2384 .config = mxt1386e_config_data_v2_1,
2385 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
2386 .family_id = 0xA0,
2387 .variant_id = 0x7,
2388 .version = 0x22,
2389 .build = 0xAA,
2390 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin33b007d2011-12-21 17:40:23 -08002391 },
Jing Lindc4413c2012-01-16 15:22:52 -08002392};
2393
Jing Lineec88ca2012-02-08 11:18:30 -08002394static struct mxt_platform_data mxt_platform_data_2d = {
2395 .config_array = mxt_config_array_2d,
2396 .config_array_size = ARRAY_SIZE(mxt_config_array_2d),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002397 .panel_minx = 0,
2398 .panel_maxx = 1365,
2399 .panel_miny = 0,
2400 .panel_maxy = 767,
2401 .disp_minx = 0,
2402 .disp_maxx = 1365,
2403 .disp_miny = 0,
2404 .disp_maxy = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05302405 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07002406 .i2c_pull_up = true,
Amy Maloche08266db2011-11-04 11:07:16 -07002407 .reset_gpio = MXT_TS_RESET_GPIO,
2408 .irq_gpio = MXT_TS_GPIO_IRQ,
Mohan Pallaka50837382011-09-07 11:00:57 +05302409};
2410
Jing Lineec88ca2012-02-08 11:18:30 -08002411static struct mxt_config_info mxt_config_array_3d[] = {
2412 {
2413 .config = mxt1386e_config_data_3d,
2414 .config_length = ARRAY_SIZE(mxt1386e_config_data_3d),
2415 .family_id = 0xA0,
2416 .variant_id = 0x7,
2417 .version = 0x21,
2418 .build = 0xAA,
2419 },
2420};
2421
2422static struct mxt_platform_data mxt_platform_data_3d = {
2423 .config_array = mxt_config_array_3d,
2424 .config_array_size = ARRAY_SIZE(mxt_config_array_3d),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002425 .panel_minx = 0,
2426 .panel_maxx = 1919,
2427 .panel_miny = 0,
2428 .panel_maxy = 1199,
2429 .disp_minx = 0,
2430 .disp_maxx = 1919,
2431 .disp_miny = 0,
2432 .disp_maxy = 1199,
Jing Lineec88ca2012-02-08 11:18:30 -08002433 .irqflags = IRQF_TRIGGER_FALLING,
2434 .i2c_pull_up = true,
2435 .reset_gpio = MXT_TS_RESET_GPIO,
2436 .irq_gpio = MXT_TS_GPIO_IRQ,
2437};
2438
Mohan Pallaka50837382011-09-07 11:00:57 +05302439static struct i2c_board_info mxt_device_info[] __initdata = {
2440 {
2441 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
Mohan Pallaka50837382011-09-07 11:00:57 +05302442 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
2443 },
2444};
2445
Manoj Rao14648742012-03-30 19:42:12 -07002446static struct msm_mhl_platform_data mhl_platform_data = {
2447 .irq = MSM_GPIO_TO_INT(4),
Manoj Raoc6d904c2012-06-22 00:32:14 -07002448 .gpio_mhl_int = MHL_GPIO_INT,
2449 .gpio_mhl_reset = MHL_GPIO_RESET,
2450 .gpio_mhl_power = 0,
2451 .gpio_hdmi_mhl_mux = 0,
Manoj Rao14648742012-03-30 19:42:12 -07002452};
Manoj Rao14648742012-03-30 19:42:12 -07002453
Eugene Yasmand2316b82011-12-07 18:23:48 +02002454static struct i2c_board_info sii_device_info[] __initdata = {
2455 {
Manoj Rao14648742012-03-30 19:42:12 -07002456#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
2457 /*
2458 * keeps SI 8334 as the default
2459 * MHL TX
2460 */
2461 I2C_BOARD_INFO("sii8334", 0x39),
2462 .platform_data = &mhl_platform_data,
2463#endif
2464#ifdef CONFIG_FB_MSM_HDMI_MHL_9244
Eugene Yasmand2316b82011-12-07 18:23:48 +02002465 I2C_BOARD_INFO("Sil-9244", 0x39),
Eugene Yasmand2316b82011-12-07 18:23:48 +02002466 .irq = MSM_GPIO_TO_INT(15),
Manoj Rao14648742012-03-30 19:42:12 -07002467#endif /* CONFIG_MSM_HDMI_MHL */
2468 .flags = I2C_CLIENT_WAKE,
Eugene Yasmand2316b82011-12-07 18:23:48 +02002469 },
2470};
2471
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002472static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
2473 .clk_freq = 100000,
2474 .src_clk_rate = 24000000,
Kiran Gundab4696c72012-08-16 18:37:46 +05302475 .keep_ahb_clk_on = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002476};
2477
2478static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
2479 .clk_freq = 100000,
2480 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002481};
2482
2483static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
2484 .clk_freq = 100000,
2485 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002486};
2487
2488static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
2489 .clk_freq = 100000,
2490 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002491};
2492
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002493static struct ks8851_pdata spi_eth_pdata = {
2494 .irq_gpio = KS8851_IRQ_GPIO,
2495 .rst_gpio = KS8851_RST_GPIO,
2496};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06002497
Anirudh Ghayal50137fb2012-07-31 16:58:53 +05302498static struct spi_board_info spi_eth_info[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002499 {
2500 .modalias = "ks8851",
2501 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2502 .max_speed_hz = 19200000,
2503 .bus_num = 0,
2504 .chip_select = 0,
2505 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002506 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002507 },
Anirudh Ghayal50137fb2012-07-31 16:58:53 +05302508};
2509static struct spi_board_info spi_board_info[] __initdata = {
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07002510 {
2511 .modalias = "dsi_novatek_3d_panel_spi",
2512 .max_speed_hz = 10800000,
2513 .bus_num = 0,
2514 .chip_select = 1,
2515 .mode = SPI_MODE_0,
2516 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002517};
2518
2519static struct platform_device msm_device_saw_core0 = {
2520 .name = "saw-regulator",
2521 .id = 0,
2522 .dev = {
2523 .platform_data = &msm_saw_regulator_pdata_s5,
2524 },
2525};
2526
2527static struct platform_device msm_device_saw_core1 = {
2528 .name = "saw-regulator",
2529 .id = 1,
2530 .dev = {
2531 .platform_data = &msm_saw_regulator_pdata_s6,
2532 },
2533};
2534
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002535static struct tsens_platform_data msm_tsens_pdata = {
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002536 .slope = {910, 910, 910, 910, 910},
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002537 .tsens_factor = 1000,
2538 .hw_type = MSM_8960,
2539 .tsens_num_sensor = 5,
2540};
2541
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002542static struct platform_device msm_tsens_device = {
2543 .name = "tsens8960-tm",
2544 .id = -1,
2545};
2546
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002547static struct msm_thermal_data msm_thermal_pdata = {
2548 .sensor_id = 0,
Eugene Seah2ee4a5d2012-06-25 18:16:41 -06002549 .poll_ms = 250,
2550 .limit_temp_degC = 60,
2551 .temp_hysteresis_degC = 10,
2552 .freq_step = 2,
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002553};
2554
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002555#ifdef CONFIG_MSM_FAKE_BATTERY
2556static struct platform_device fish_battery_device = {
2557 .name = "fish_battery",
2558};
2559#endif
2560
Anji Jonnalafde57a32013-03-20 17:22:39 +05302561#ifdef CONFIG_BATTERY_BCL
2562static struct platform_device battery_bcl_device = {
2563 .name = "battery_current_limit",
2564 .id = -1,
2565 };
2566#endif
2567
David Collins26f05562011-06-20 09:56:28 -07002568static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002569 .name = GPIO_REGULATOR_DEV_NAME,
2570 .id = PM8921_MPP_PM_TO_SYS(7),
2571 .dev = {
2572 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2573 },
2574};
2575
David Collins26f05562011-06-20 09:56:28 -07002576static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002577 .name = GPIO_REGULATOR_DEV_NAME,
2578 .id = 91,
2579 .dev = {
2580 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2581 },
2582};
2583
David Collinsb10be1d2011-09-02 10:29:31 -07002584static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
2585 .name = GPIO_REGULATOR_DEV_NAME,
2586 .id = PM8921_GPIO_PM_TO_SYS(17),
2587 .dev = {
2588 .platform_data =
2589 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2590 },
2591};
2592
David Collins35a78f52011-12-14 15:54:25 -08002593static struct platform_device msm8960_device_ext_otg_sw_vreg __devinitdata = {
2594 .name = GPIO_REGULATOR_DEV_NAME,
2595 .id = PM8921_GPIO_PM_TO_SYS(42),
2596 .dev = {
2597 .platform_data =
2598 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_OTG_SW],
2599 },
2600};
2601
David Collins26f05562011-06-20 09:56:28 -07002602static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
2603 .name = "rpm-regulator",
2604 .id = -1,
2605 .dev = {
2606 .platform_data = &msm_rpm_regulator_pdata,
2607 },
2608};
Mayank Ranae009c922012-03-22 03:02:06 +05302609#ifdef CONFIG_SERIAL_MSM_HS
Mayank Ranae009c922012-03-22 03:02:06 +05302610static struct msm_serial_hs_platform_data msm_uart_dm9_pdata = {
Mayank Rana60ae1af2013-03-08 14:09:51 +05302611 .config_gpio = 4,
2612 .uart_tx_gpio = 93,
2613 .uart_rx_gpio = 94,
2614 .uart_cts_gpio = 95,
2615 .uart_rfr_gpio = 96,
Mayank Ranae009c922012-03-22 03:02:06 +05302616};
Mayank Rana1f02d952012-07-04 19:11:20 +05302617
Mayank Rana1f02d952012-07-04 19:11:20 +05302618static struct msm_serial_hs_platform_data msm_uart_dm8_pdata = {
Mayank Rana60ae1af2013-03-08 14:09:51 +05302619 .config_gpio = 4,
2620 .uart_tx_gpio = 34,
2621 .uart_rx_gpio = 35,
2622 .uart_cts_gpio = 36,
2623 .uart_rfr_gpio = 37,
Mayank Rana1f02d952012-07-04 19:11:20 +05302624};
Mayank Ranae009c922012-03-22 03:02:06 +05302625#else
Mayank Rana1f02d952012-07-04 19:11:20 +05302626static struct msm_serial_hs_platform_data msm_uart_dm8_pdata;
Mayank Ranae009c922012-03-22 03:02:06 +05302627static struct msm_serial_hs_platform_data msm_uart_dm9_pdata;
2628#endif
David Collins26f05562011-06-20 09:56:28 -07002629
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302630#if defined(CONFIG_BT) && defined(CONFIG_BT_HCIUART_ATH3K)
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002631enum WLANBT_STATUS {
2632 WLANOFF_BTOFF = 1,
2633 WLANOFF_BTON,
2634 WLANON_BTOFF,
2635 WLANON_BTON
2636};
2637
2638static DEFINE_MUTEX(ath_wlanbt_mutex);
2639static int gpio_wlan_sys_rest_en = 26;
2640static int ath_wlanbt_status = WLANOFF_BTOFF;
2641
2642static int ath6kl_power_control(int on)
2643{
2644 int rc;
2645
2646 if (on) {
2647 rc = gpio_request(gpio_wlan_sys_rest_en, "wlan sys_rst_n");
2648 if (rc) {
2649 pr_err("%s: unable to request gpio %d (%d)\n",
2650 __func__, gpio_wlan_sys_rest_en, rc);
2651 return rc;
2652 }
2653 rc = gpio_direction_output(gpio_wlan_sys_rest_en, 0);
2654 msleep(200);
2655 rc = gpio_direction_output(gpio_wlan_sys_rest_en, 1);
2656 msleep(100);
2657 } else {
2658 gpio_set_value(gpio_wlan_sys_rest_en, 0);
2659 rc = gpio_direction_input(gpio_wlan_sys_rest_en);
2660 msleep(100);
2661 gpio_free(gpio_wlan_sys_rest_en);
2662 }
2663 return 0;
2664};
2665
2666static int ath6kl_wlan_power(int on)
2667{
2668 int ret = 0;
2669
2670 mutex_lock(&ath_wlanbt_mutex);
2671 if (on) {
2672 if (ath_wlanbt_status == WLANOFF_BTOFF) {
2673 ret = ath6kl_power_control(1);
2674 ath_wlanbt_status = WLANON_BTOFF;
2675 } else if (ath_wlanbt_status == WLANOFF_BTON)
2676 ath_wlanbt_status = WLANON_BTON;
2677 } else {
2678 if (ath_wlanbt_status == WLANON_BTOFF) {
2679 ret = ath6kl_power_control(0);
2680 ath_wlanbt_status = WLANOFF_BTOFF;
2681 } else if (ath_wlanbt_status == WLANON_BTON)
2682 ath_wlanbt_status = WLANOFF_BTON;
2683 }
2684 mutex_unlock(&ath_wlanbt_mutex);
2685 pr_debug("%s on= %d, wlan_status= %d\n",
2686 __func__, on, ath_wlanbt_status);
2687 return ret;
2688};
2689
2690static struct wifi_platform_data ath6kl_wifi_control = {
2691 .set_power = ath6kl_wlan_power,
2692};
2693
2694static struct platform_device msm_wlan_power_device = {
2695 .name = "ath6kl_power",
2696 .dev = {
2697 .platform_data = &ath6kl_wifi_control,
2698 },
2699};
2700
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302701static struct resource bluesleep_resources[] = {
2702 {
2703 .name = "gpio_host_wake",
2704 .start = 27,
2705 .end = 27,
2706 .flags = IORESOURCE_IO,
2707 },
2708 {
2709 .name = "gpio_ext_wake",
2710 .start = 29,
2711 .end = 29,
2712 .flags = IORESOURCE_IO,
2713 },
2714 {
2715 .name = "host_wake",
2716 .start = MSM_GPIO_TO_INT(27),
2717 .end = MSM_GPIO_TO_INT(27),
2718 .flags = IORESOURCE_IRQ,
2719 },
2720};
2721
2722static struct platform_device msm_bluesleep_device = {
2723 .name = "bluesleep",
2724 .id = -1,
2725 .num_resources = ARRAY_SIZE(bluesleep_resources),
2726 .resource = bluesleep_resources,
2727};
2728
2729static struct platform_device msm_bt_power_device = {
2730 .name = "bt_power",
2731};
2732
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002733static int gpio_bt_sys_rest_en = 28;
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302734
2735static int bluetooth_power(int on)
2736{
2737 int rc;
2738
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002739 mutex_lock(&ath_wlanbt_mutex);
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302740 if (on) {
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002741 if (ath_wlanbt_status == WLANOFF_BTOFF) {
2742 ath6kl_power_control(1);
2743 ath_wlanbt_status = WLANOFF_BTON;
2744 } else if (ath_wlanbt_status == WLANON_BTOFF)
2745 ath_wlanbt_status = WLANON_BTON;
2746
Ram Mohan Korukondab07c2632012-08-18 22:24:03 +05302747 rc = gpio_request(gpio_bt_sys_rest_en, "bt sys_rst_n");
2748 if (rc) {
2749 pr_err("%s: unable to request gpio %d (%d)\n",
2750 __func__, gpio_bt_sys_rest_en, rc);
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002751 mutex_unlock(&ath_wlanbt_mutex);
2752 return rc;
Ram Mohan Korukondab07c2632012-08-18 22:24:03 +05302753 }
2754 rc = gpio_direction_output(gpio_bt_sys_rest_en, 0);
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002755 msleep(20);
2756 rc = gpio_direction_output(gpio_bt_sys_rest_en, 1);
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302757 msleep(100);
2758 } else {
2759 gpio_set_value(gpio_bt_sys_rest_en, 0);
2760 rc = gpio_direction_input(gpio_bt_sys_rest_en);
2761 msleep(100);
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002762 gpio_free(gpio_bt_sys_rest_en);
Ram Mohan Korukondab07c2632012-08-18 22:24:03 +05302763
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002764 if (ath_wlanbt_status == WLANOFF_BTON) {
2765 ath6kl_power_control(0);
2766 ath_wlanbt_status = WLANOFF_BTOFF;
2767 } else if (ath_wlanbt_status == WLANON_BTON)
2768 ath_wlanbt_status = WLANON_BTOFF;
2769 }
2770 mutex_unlock(&ath_wlanbt_mutex);
2771 pr_debug("%s on= %d, wlan_status= %d\n",
2772 __func__, on, ath_wlanbt_status);
2773 return 0;
2774};
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302775
2776static void __init bt_power_init(void)
2777{
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302778 msm_bt_power_device.dev.platform_data = &bluetooth_power;
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302779 return;
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002780};
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302781#else
2782#define bt_power_init(x) do {} while (0)
2783#endif
2784
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002785static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07002786 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002787 &msm_device_smd,
Mayank Rana9f51f582011-08-04 18:35:59 +05302788 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002789 &msm_device_saw_core0,
2790 &msm_device_saw_core1,
2791 &msm8960_device_ext_5v_vreg,
David Collins87579612012-01-30 16:00:15 -08002792 &msm8960_device_ssbi_pmic,
David Collins96aa3e12012-02-29 10:31:34 -08002793 &msm8960_device_ext_otg_sw_vreg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002794 &msm8960_device_qup_spi_gsbi1,
2795 &msm8960_device_qup_i2c_gsbi3,
2796 &msm8960_device_qup_i2c_gsbi4,
2797 &msm8960_device_qup_i2c_gsbi10,
2798#ifndef CONFIG_MSM_DSPS
2799 &msm8960_device_qup_i2c_gsbi12,
2800#endif
2801 &msm_slim_ctrl,
2802 &msm_device_wcnss_wlan,
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302803#if defined(CONFIG_BT) && defined(CONFIG_BT_HCIUART_ATH3K)
2804 &msm_bluesleep_device,
2805 &msm_bt_power_device,
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002806 &msm_wlan_power_device,
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302807#endif
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002808#if defined(CONFIG_QSEECOM)
2809 &qseecom_device,
2810#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002811#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2812 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2813 &qcrypto_device,
2814#endif
2815
2816#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2817 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2818 &qcedev_device,
2819#endif
2820#ifdef CONFIG_MSM_ROTATOR
2821 &msm_rotator_device,
2822#endif
2823 &msm_device_sps,
2824#ifdef CONFIG_MSM_FAKE_BATTERY
2825 &fish_battery_device,
2826#endif
Anji Jonnalafde57a32013-03-20 17:22:39 +05302827#ifdef CONFIG_BATTERY_BCL
2828 &battery_bcl_device,
2829#endif
Laura Abbottb93525f2012-04-12 09:57:19 -07002830 &msm8960_fmem_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002831#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07002832#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002833 &msm8960_android_pmem_device,
2834 &msm8960_android_pmem_adsp_device,
2835 &msm8960_android_pmem_audio_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002836#endif
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -07002837#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002838 &msm_device_bam_dmux,
2839 &msm_fm_platform_init,
Joel Nidera1261942011-09-12 16:30:09 +03002840#if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE)
2841#ifdef CONFIG_MSM_USE_TSIF1
2842 &msm_device_tsif[1],
2843#else
2844 &msm_device_tsif[0],
2845#endif
2846#endif
Joel Nider266a2642011-10-16 10:58:05 +02002847 &msm_device_tspp,
Mona Hossain9c430e32011-07-27 11:04:47 -07002848#ifdef CONFIG_HW_RANDOM_MSM
2849 &msm_device_rng,
2850#endif
Laura Abbottd6183792011-08-19 13:42:24 -07002851#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002852 &msm8960_ion_dev,
Laura Abbottd6183792011-08-19 13:42:24 -07002853#endif
Praveen Chidambaram78499012011-11-01 17:15:17 -06002854 &msm8960_rpm_device,
2855 &msm8960_rpm_log_device,
2856 &msm8960_rpm_stat_device,
Anji Jonnala2a8bd312012-11-01 13:11:42 +05302857 &msm8960_rpm_master_stat_device,
Mona Hossain11c03ac2011-10-26 12:42:10 -07002858 &msm_device_tz_log,
Pratik Patel3b0ca882012-06-01 16:54:14 -07002859 &coresight_tpiu_device,
2860 &coresight_etb_device,
2861 &coresight_funnel_device,
2862 &coresight_etm0_device,
2863 &coresight_etm1_device,
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07002864 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002865 &msm8960_device_watchdog,
Laura Abbottb93525f2012-04-12 09:57:19 -07002866 &msm8960_rtb_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002867 &msm8960_device_cache_erp,
Stepan Moskovchenkoc0557252012-06-07 17:39:14 -07002868 &msm8960_device_ebi1_ch0_erp,
2869 &msm8960_device_ebi1_ch1_erp,
Laura Abbottb93525f2012-04-12 09:57:19 -07002870 &msm8960_cache_dump_device,
Laura Abbott0577d7b2012-04-17 11:14:30 -07002871 &msm8960_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002872 &msm_tsens_device,
Anji Jonnalae84292b2012-09-21 13:34:44 +05302873 &msm8960_pc_cntr,
Anji Jonnala4bf6c0c2013-04-16 17:07:52 +05302874 &msm8960_cpu_slp_status,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002875};
2876
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002877static struct platform_device *cdp_devices[] __initdata = {
Stephen Boydeb819882011-08-29 14:46:30 -07002878 &msm_8960_q6_lpass,
Stephen Boyd322a9922011-09-20 01:05:54 -07002879 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07002880 &msm_pil_tzapps,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07002881 &msm_pil_dsps,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002882 &msm_pil_vidc,
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002883 &msm8960_device_otg,
2884 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002885 &msm_device_hsusb_host,
2886 &android_usb_device,
2887 &msm_pcm,
Kiran Kandi5e809b02012-01-31 00:24:33 -08002888 &msm_multi_ch_pcm,
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -07002889 &msm_lowlatency_pcm,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002890 &msm_pcm_routing,
2891 &msm_cpudai0,
2892 &msm_cpudai1,
Kiran Kandi97fe19d2012-05-20 22:34:04 -07002893 &msm8960_cpudai_slimbus_2_rx,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002894 &msm8960_cpudai_slimbus_2_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002895 &msm_cpudai_hdmi_rx,
2896 &msm_cpudai_bt_rx,
2897 &msm_cpudai_bt_tx,
2898 &msm_cpudai_fm_rx,
2899 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002900 &msm_cpudai_auxpcm_rx,
2901 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002902 &msm_cpu_fe,
2903 &msm_stub_codec,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002904#ifdef CONFIG_MSM_GEMINI
2905 &msm8960_gemini_device,
2906#endif
Kalyani Oruganti465d1e12012-05-15 10:23:05 -07002907#ifdef CONFIG_MSM_MERCURY
2908 &msm8960_mercury_device,
2909#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002910 &msm_voice,
2911 &msm_voip,
2912 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05302913 &msm_cpudai_afe_01_rx,
2914 &msm_cpudai_afe_01_tx,
2915 &msm_cpudai_afe_02_rx,
2916 &msm_cpudai_afe_02_tx,
2917 &msm_pcm_afe,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05302918 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07002919 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07002920 &msm_cpudai_incall_record_rx,
2921 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002922 &msm_pcm_hostless,
2923 &msm_bus_apps_fabric,
2924 &msm_bus_sys_fabric,
2925 &msm_bus_mm_fabric,
2926 &msm_bus_sys_fpb,
2927 &msm_bus_cpss_fpb,
2928};
2929
2930static void __init msm8960_i2c_init(void)
2931{
2932 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2933 &msm8960_i2c_qup_gsbi4_pdata;
2934
2935 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2936 &msm8960_i2c_qup_gsbi3_pdata;
2937
2938 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2939 &msm8960_i2c_qup_gsbi10_pdata;
2940
2941 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2942 &msm8960_i2c_qup_gsbi12_pdata;
2943}
2944
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002945static void __init msm8960_gfx_init(void)
2946{
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002947 struct kgsl_device_platform_data *kgsl_3d0_pdata =
2948 msm_kgsl_3d0.dev.platform_data;
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06002949 uint32_t soc_platform_version = socinfo_get_version();
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002950
Carter Cooper3852cbb2012-08-20 22:11:42 -06002951 /* Fixup data that needs to change based on GPU ID */
Carter Cooperffe7ea12012-08-22 13:27:58 -06002952 if (cpu_is_msm8960ab()) {
2953 kgsl_3d0_pdata->chipid = ADRENO_CHIPID(3, 2, 1, 0);
Suman Tatiraju20372242012-10-29 18:24:53 -07002954 /* 8960PRO nominal clock rate is 320Mhz */
2955 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 320000000;
Carter Cooper3852cbb2012-08-20 22:11:42 -06002956 } else {
2957 kgsl_3d0_pdata->iommu_count = 1;
2958 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
2959 kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
2960 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
2961 }
2962 if (SOCINFO_VERSION_MAJOR(soc_platform_version) >= 3) {
2963 /* 8960v3 GPU registers returns 5 for patch release
2964 * but it should be 6, so dummy up the chipid here
2965 * based the platform type
2966 */
2967 kgsl_3d0_pdata->chipid = ADRENO_CHIPID(2, 2, 0, 6);
2968 }
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002969 }
Carter Cooper6307eb992012-08-20 15:17:23 -06002970
2971 /* Register the 3D core */
2972 platform_device_register(&msm_kgsl_3d0);
2973
2974 /* Register the 2D cores if we are not 8960PRO */
2975 if (!cpu_is_msm8960ab()) {
2976 platform_device_register(&msm_kgsl_2d0);
2977 platform_device_register(&msm_kgsl_2d1);
2978 }
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002979}
2980
Subhash Jadavani933e6a62011-12-26 18:05:04 +05302981static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002982 {
2983 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2984 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2985 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002986 1, 784, 180000, 100,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002987 },
2988
2989 {
Anji Jonnala85b29ff2013-01-15 14:12:45 +05302990 MSM_PM_SLEEP_MODE_RETENTION,
2991 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2992 true,
2993 415, 715, 340827, 475,
2994 },
2995
2996 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002997 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2998 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2999 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06003000 1300, 228, 1200000, 2000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003001 },
3002
3003 {
3004 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3005 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
3006 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06003007 2000, 138, 1208400, 3200,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003008 },
3009
3010 {
3011 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06003012 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
3013 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06003014 6000, 119, 1850300, 9000,
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06003015 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003016
3017 {
3018 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3019 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
3020 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06003021 9200, 68, 2839200, 16400,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003022 },
3023
3024 {
3025 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3026 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
3027 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06003028 10300, 63, 3128000, 18200,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003029 },
3030
3031 {
3032 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3033 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
3034 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06003035 18000, 10, 4602600, 27000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003036 },
3037
3038 {
3039 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3040 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
3041 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06003042 20000, 2, 5752000, 32000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003043 },
3044};
3045
Anji Jonnala85b29ff2013-01-15 14:12:45 +05303046
Praveen Chidambaram78499012011-11-01 17:15:17 -06003047static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
3048 .levels = &msm_rpmrs_levels[0],
3049 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
3050 .vdd_mem_levels = {
3051 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
3052 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
3053 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
3054 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
3055 },
3056 .vdd_dig_levels = {
3057 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
3058 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
3059 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
3060 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
3061 },
3062 .vdd_mask = 0x7FFFFF,
3063 .rpmrs_target_id = {
3064 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
3065 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
3066 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
3067 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
3068 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
3069 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
3070 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
3071 },
3072};
3073
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06003074static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
3075 .mode = MSM_PM_BOOT_CONFIG_TZ,
3076};
3077
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003078#ifdef CONFIG_I2C
3079#define I2C_SURF 1
3080#define I2C_FFA (1 << 1)
3081#define I2C_RUMI (1 << 2)
3082#define I2C_SIM (1 << 3)
3083#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03003084#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003085
3086struct i2c_registry {
3087 u8 machs;
3088 int bus;
3089 struct i2c_board_info *info;
3090 int len;
3091};
3092
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003093/* Sensors DSPS platform data */
3094#ifdef CONFIG_MSM_DSPS
3095#define DSPS_PIL_GENERIC_NAME "dsps"
3096#endif /* CONFIG_MSM_DSPS */
3097
3098static void __init msm8960_init_dsps(void)
3099{
3100#ifdef CONFIG_MSM_DSPS
3101 struct msm_dsps_platform_data *pdata =
3102 msm_dsps_device.dev.platform_data;
3103 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
3104 pdata->gpios = NULL;
3105 pdata->gpios_num = 0;
3106
3107 platform_device_register(&msm_dsps_device);
3108#endif /* CONFIG_MSM_DSPS */
3109}
3110
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -08003111static int hsic_peripheral_status = 1;
3112static DEFINE_MUTEX(hsic_status_lock);
3113
3114void peripheral_connect()
3115{
3116 mutex_lock(&hsic_status_lock);
3117 if (hsic_peripheral_status)
3118 goto out;
3119 platform_device_add(&msm_device_hsic_host);
3120 hsic_peripheral_status = 1;
3121out:
3122 mutex_unlock(&hsic_status_lock);
3123}
3124EXPORT_SYMBOL(peripheral_connect);
3125
3126void peripheral_disconnect()
3127{
3128 mutex_lock(&hsic_status_lock);
3129 if (!hsic_peripheral_status)
3130 goto out;
3131 platform_device_del(&msm_device_hsic_host);
3132 hsic_peripheral_status = 0;
3133out:
3134 mutex_unlock(&hsic_status_lock);
3135}
3136EXPORT_SYMBOL(peripheral_disconnect);
3137
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303138static void __init msm8960_init_smsc_hub(void)
3139{
3140 uint32_t version = socinfo_get_version();
3141
3142 if (SOCINFO_VERSION_MAJOR(version) == 1)
3143 return;
3144
3145 if (machine_is_msm8960_liquid())
3146 platform_device_register(&smsc_hub_device);
3147}
3148
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003149static void __init msm8960_init_hsic(void)
3150{
3151#ifdef CONFIG_USB_EHCI_MSM_HSIC
3152 uint32_t version = socinfo_get_version();
3153
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08003154 if (SOCINFO_VERSION_MAJOR(version) == 1)
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003155 return;
3156
Joel King0cbf5d82012-05-24 15:21:38 -07003157 if (machine_is_msm8960_liquid())
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08003158 platform_device_register(&msm_device_hsic_host);
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003159#endif
3160}
3161
Amir Samuelov5137e392011-09-21 17:31:25 +03003162#ifdef CONFIG_ISL9519_CHARGER
3163static struct isl_platform_data isl_data __initdata = {
3164 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
3165 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
3166 .max_system_voltage = 4200,
3167 .min_system_voltage = 3200,
Amir Samuelov95f49ff2012-01-29 09:14:08 +02003168 .chgcurrent = 1900,
3169 .term_current = 0,
Amir Samuelov5137e392011-09-21 17:31:25 +03003170 .input_current = 2048,
3171};
3172
3173static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
3174 {
3175 I2C_BOARD_INFO("isl9519q", 0x9),
3176 .irq = 0, /* Not required when notify-by-pmic */
3177 .platform_data = &isl_data,
3178 },
3179};
3180#endif /* CONFIG_ISL9519_CHARGER */
3181
Hanumant Singhbcd8ae72013-01-03 15:13:52 -08003182#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
Amir Samuelov755616d2011-12-13 16:34:46 +02003183static struct i2c_board_info liquid_io_expander_i2c_info[] __initdata = {
3184 {
3185 I2C_BOARD_INFO("sx1508q", 0x20),
3186 .platform_data = &msm8960_sx150x_data[SX150X_LIQUID]
3187 },
3188};
Hanumant Singhbcd8ae72013-01-03 15:13:52 -08003189#endif
Amir Samuelov755616d2011-12-13 16:34:46 +02003190
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003191static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Amir Samuelov5137e392011-09-21 17:31:25 +03003192#ifdef CONFIG_ISL9519_CHARGER
3193 {
3194 I2C_LIQUID,
3195 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
3196 isl_charger_i2c_info,
3197 ARRAY_SIZE(isl_charger_i2c_info),
3198 },
3199#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003200 {
3201 I2C_SURF | I2C_FFA | I2C_FLUID,
3202 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3203 cyttsp_info,
3204 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07003205 },
Mohan Pallaka50837382011-09-07 11:00:57 +05303206 {
3207 I2C_LIQUID,
3208 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3209 mxt_device_info,
3210 ARRAY_SIZE(mxt_device_info),
3211 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05303212 {
Manoj Rao14648742012-03-30 19:42:12 -07003213 I2C_SURF | I2C_FFA | I2C_LIQUID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05303214 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Eugene Yasmand2316b82011-12-07 18:23:48 +02003215 sii_device_info,
3216 ARRAY_SIZE(sii_device_info),
3217 },
3218 {
Anirudh Ghayal15698162012-07-31 11:51:32 +05303219 I2C_LIQUID | I2C_FFA,
Eugene Yasmand2316b82011-12-07 18:23:48 +02003220 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05303221 msm_isa1200_board_info,
3222 ARRAY_SIZE(msm_isa1200_board_info),
3223 },
Hanumant Singhbcd8ae72013-01-03 15:13:52 -08003224#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
Amir Samuelov755616d2011-12-13 16:34:46 +02003225 {
3226 I2C_LIQUID,
3227 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
3228 liquid_io_expander_i2c_info,
3229 ARRAY_SIZE(liquid_io_expander_i2c_info),
3230 },
Hanumant Singhbcd8ae72013-01-03 15:13:52 -08003231#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003232};
3233#endif /* CONFIG_I2C */
3234
3235static void __init register_i2c_devices(void)
3236{
3237#ifdef CONFIG_I2C
3238 u8 mach_mask = 0;
3239 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08003240#ifdef CONFIG_MSM_CAMERA
3241 struct i2c_registry msm8960_camera_i2c_devices = {
3242 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
3243 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
3244 msm8960_camera_board_info.board_info,
3245 msm8960_camera_board_info.num_i2c_board_info,
3246 };
3247#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003248
3249 /* Build the matching 'supported_machs' bitmask */
3250 if (machine_is_msm8960_cdp())
3251 mach_mask = I2C_SURF;
Amy Maloche2d028032011-07-20 14:08:06 -07003252 else if (machine_is_msm8960_fluid())
3253 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03003254 else if (machine_is_msm8960_liquid())
3255 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07003256 else if (machine_is_msm8960_mtp())
3257 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003258 else
3259 pr_err("unmatched machine ID in register_i2c_devices\n");
3260
Jing Lineec88ca2012-02-08 11:18:30 -08003261 if (machine_is_msm8960_liquid()) {
3262 if (SOCINFO_VERSION_MAJOR(socinfo_get_platform_version()) == 3)
3263 mxt_device_info[0].platform_data =
3264 &mxt_platform_data_3d;
3265 else
3266 mxt_device_info[0].platform_data =
3267 &mxt_platform_data_2d;
3268 }
3269
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003270 /* Run the array and install devices as appropriate */
3271 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
3272 if (msm8960_i2c_devices[i].machs & mach_mask)
3273 i2c_register_board_info(msm8960_i2c_devices[i].bus,
3274 msm8960_i2c_devices[i].info,
3275 msm8960_i2c_devices[i].len);
3276 }
Manoj Raoc6d904c2012-06-22 00:32:14 -07003277
3278 if (!mhl_platform_data.gpio_mhl_power)
3279 pr_debug("mhl device configured for ext debug board\n");
3280
Kevin Chan09f4e662011-12-16 08:17:02 -08003281#ifdef CONFIG_MSM_CAMERA
3282 if (msm8960_camera_i2c_devices.machs & mach_mask)
3283 i2c_register_board_info(msm8960_camera_i2c_devices.bus,
3284 msm8960_camera_i2c_devices.info,
3285 msm8960_camera_i2c_devices.len);
3286#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003287#endif
3288}
3289
Siddartha Mohanadoss9e1417c2012-09-26 09:42:32 -07003290static void __init msm8960_tsens_init(void)
3291{
3292 if (cpu_is_msm8960())
3293 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) == 1)
3294 return;
3295
3296 msm_tsens_early_init(&msm_tsens_pdata);
3297}
3298
Anji Jonnala0f297a92013-01-19 11:22:25 +05303299static void __init msm8960ab_update_krait_spm(void)
3300 {
3301 int i;
3302
Anji Jonnala0f297a92013-01-19 11:22:25 +05303303
3304 /* Update the SPM sequences for SPC and PC */
3305 for (i = 0; i < ARRAY_SIZE(msm_spm_data); i++) {
3306 int j;
3307 struct msm_spm_platform_data *pdata = &msm_spm_data[i];
3308 for (j = 0; j < pdata->num_modes; j++) {
3309 if (pdata->modes[j].cmd ==
3310 spm_power_collapse_without_rpm)
3311 pdata->modes[j].cmd =
3312 spm_power_collapse_without_rpm_krait_v3;
3313 else if (pdata->modes[j].cmd ==
3314 spm_power_collapse_with_rpm)
3315 pdata->modes[j].cmd =
3316 spm_power_collapse_with_rpm_krait_v3;
3317 }
3318 }
3319}
3320
Anji Jonnala786b39e2013-01-29 13:34:10 +05303321static void __init msm8960ab_update_retention_spm(void)
3322{
3323 int i;
3324
3325 /* Update the SPM sequences for krait retention on all cores */
3326 for (i = 0; i < ARRAY_SIZE(msm_spm_data); i++) {
3327 int j;
3328 struct msm_spm_platform_data *pdata = &msm_spm_data[i];
3329 for (j = 0; j < pdata->num_modes; j++) {
3330 if (pdata->modes[j].cmd ==
3331 spm_retention_cmd_sequence)
3332 pdata->modes[j].cmd =
3333 spm_retention_with_krait_v3_cmd_sequence;
3334 }
3335 }
3336}
3337
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003338static void __init msm8960_cdp_init(void)
3339{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07003340 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
3341 pr_err("meminfo_init() failed!\n");
3342
Rohit Vaswanib1cc4932012-07-23 21:30:11 -07003343 platform_device_register(&msm_gpio_device);
Siddartha Mohanadoss9e1417c2012-09-26 09:42:32 -07003344 msm8960_tsens_init();
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06003345 msm_thermal_init(&msm_thermal_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06003346 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
3347 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07003348
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003349 regulator_suppress_info_printing();
3350 if (msm_xo_init())
3351 pr_err("Failed to initialize XO votes\n");
David Collins4c93ce92012-09-04 15:44:19 -07003352 configure_msm8960_power_grid();
David Collins26f05562011-06-20 09:56:28 -07003353 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07003354 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05303355 if (machine_is_msm8960_liquid())
3356 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003357 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05303358 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
3359 machine_is_msm8960_cdp()) {
Mayank Ranaa1f507b2012-08-14 10:57:00 +05303360 /* Due to availability of USB Switch in SGLTE Platform
3361 * it requires different HSUSB PHY settings compare to
3362 * 8960 MTP/CDP platform.
3363 */
3364 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
3365 msm_otg_pdata.phy_init_seq = sglte_phy_init_seq;
3366 else
3367 msm_otg_pdata.phy_init_seq = wr_phy_init_seq;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05303368 } else if (machine_is_msm8960_liquid()) {
3369 msm_otg_pdata.phy_init_seq =
3370 liquid_v1_phy_init_seq;
3371 }
Ofir Cohen94213a72012-05-03 14:26:32 +03003372 android_usb_pdata.swfi_latency =
Anji jonnalaa7c1c5c2011-12-12 12:20:36 +05303373 msm_rpmrs_levels[0].latency_us;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303374 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303375 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2 &&
3376 machine_is_msm8960_liquid())
3377 msm_device_hsic_host.dev.parent = &smsc_hub_device.dev;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08003378 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003379 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3380 &msm8960_qup_spi_gsbi1_pdata;
3381 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Anirudh Ghayal50137fb2012-07-31 16:58:53 +05303382 if (socinfo_get_platform_subtype() != PLATFORM_SUBTYPE_SGLTE)
3383 spi_register_board_info(spi_eth_info, ARRAY_SIZE(spi_eth_info));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003384
3385 msm8960_init_pmic();
Anirudh Ghayal15698162012-07-31 11:51:32 +05303386 if (machine_is_msm8960_liquid() || (machine_is_msm8960_mtp() &&
Shantanu Jain4ffd8122012-12-03 15:09:39 +05303387 (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE ||
3388 cpu_is_msm8960ab())))
Mohan Pallakaf69f0492011-11-21 13:08:33 +05303389 msm_isa1200_board_info[0].platform_data = &isa1200_1_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003390 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003391 msm8960_gfx_init();
Anji Jonnala0f297a92013-01-19 11:22:25 +05303392 if (cpu_is_msm8960ab())
3393 msm8960ab_update_krait_spm();
Anji Jonnala786b39e2013-01-29 13:34:10 +05303394 if (cpu_is_krait_v3()) {
3395 msm_pm_set_tz_retention_flag(0);
3396 msm8960ab_update_retention_spm();
3397 } else {
3398 msm_pm_set_tz_retention_flag(1);
3399 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003400 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3401 msm_spm_l2_init(msm_spm_l2_data);
3402 msm8960_init_buses();
Stephen Boyd6716bd92012-10-25 11:46:04 -07003403 if (cpu_is_msm8960ab()) {
3404 platform_add_devices(msm8960ab_footswitch,
3405 msm8960ab_num_footswitch);
3406 } else {
3407 platform_add_devices(msm8960_footswitch,
3408 msm8960_num_footswitch);
3409 }
David Collinsb10be1d2011-09-02 10:29:31 -07003410 if (machine_is_msm8960_liquid())
3411 platform_device_register(&msm8960_device_ext_3p3v_vreg);
David Collinsd5a40732011-11-29 15:53:56 -08003412 if (machine_is_msm8960_cdp())
3413 platform_device_register(&msm8960_device_ext_l2_vreg);
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07003414
3415 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
3416 platform_device_register(&msm8960_device_uart_gsbi8);
3417 else
3418 platform_device_register(&msm8960_device_uart_gsbi5);
3419
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003420 /* For 8960 Fusion 2.2 Primary IPC */
Mayank Ranad85a5082012-04-29 17:24:13 -07003421 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE) {
3422 msm_uart_dm9_pdata.wakeup_irq = gpio_to_irq(94); /* GSBI9(2) */
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003423 msm_device_uart_dm9.dev.platform_data = &msm_uart_dm9_pdata;
Mayank Rana77f83c22012-07-10 09:31:02 +05303424 platform_device_register(&msm_device_uart_dm9);
Mayank Ranad85a5082012-04-29 17:24:13 -07003425 }
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003426
Mayank Rana1f02d952012-07-04 19:11:20 +05303427 /* For 8960 Standalone External Bluetooth Interface */
3428 if (socinfo_get_platform_subtype() != PLATFORM_SUBTYPE_SGLTE) {
3429 msm_device_uart_dm8.dev.platform_data = &msm_uart_dm8_pdata;
3430 platform_device_register(&msm_device_uart_dm8);
3431 }
Patrick Daly6578e0c2012-07-19 18:50:02 -07003432 if (cpu_is_msm8960ab())
3433 platform_device_register(&msm8960ab_device_acpuclk);
3434 else
3435 platform_device_register(&msm8960_device_acpuclk);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003436 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Arun Menond4837f62012-08-20 15:25:50 -07003437 msm8960_add_vidc_device();
Patrick Daly6578e0c2012-07-19 18:50:02 -07003438
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003439 msm8960_pm8921_gpio_mpp_init();
Stephen Boyd0ea1b762012-09-13 12:41:31 -07003440 /* Don't add modem devices on APQ targets */
3441 if (socinfo_get_id() != 124) {
3442 platform_device_register(&msm_8960_q6_mss_fw);
3443 platform_device_register(&msm_8960_q6_mss_sw);
3444 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003445 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303446 msm8960_init_smsc_hub();
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003447 msm8960_init_hsic();
Steve Mucklef132c6c2012-06-06 18:30:57 -07003448#ifdef CONFIG_MSM_CAMERA
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003449 msm8960_init_cam();
Steve Mucklef132c6c2012-06-06 18:30:57 -07003450#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003451 msm8960_init_mmc();
Mohan Pallaka50837382011-09-07 11:00:57 +05303452 if (machine_is_msm8960_liquid())
3453 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003454 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08003455 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003456 slim_register_board_info(msm_slim_devices,
3457 ARRAY_SIZE(msm_slim_devices));
3458 msm8960_init_dsps();
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06003459 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05303460 bt_power_init();
Joel King0cbf5d82012-05-24 15:21:38 -07003461 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE) {
3462 mdm_sglte_device.dev.platform_data = &sglte_platform_data;
3463 platform_device_register(&mdm_sglte_device);
3464 }
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003465}
3466
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003467MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
3468 .map_io = msm8960_map_io,
3469 .reserve = msm8960_reserve,
3470 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303471 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003472 .timer = &msm_timer,
3473 .init_machine = msm8960_cdp_init,
3474 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003475 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003476 .restart = msm_restart,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003477MACHINE_END
3478
3479MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
3480 .map_io = msm8960_map_io,
3481 .reserve = msm8960_reserve,
3482 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303483 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003484 .timer = &msm_timer,
3485 .init_machine = msm8960_cdp_init,
3486 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003487 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003488 .restart = msm_restart,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003489MACHINE_END
3490
3491MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
3492 .map_io = msm8960_map_io,
3493 .reserve = msm8960_reserve,
3494 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303495 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003496 .timer = &msm_timer,
3497 .init_machine = msm8960_cdp_init,
3498 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003499 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003500 .restart = msm_restart,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003501MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003502
3503MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
3504 .map_io = msm8960_map_io,
3505 .reserve = msm8960_reserve,
3506 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303507 .handle_irq = gic_handle_irq,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003508 .timer = &msm_timer,
3509 .init_machine = msm8960_cdp_init,
3510 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003511 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003512 .restart = msm_restart,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003513MACHINE_END