blob: 3ce99affc49b93e0fbb2ee9bb60c8bb408933f1b [file] [log] [blame]
Praveen Chavand0857552013-01-31 20:06:07 -08001/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080012 */
13#include <linux/kernel.h>
14#include <linux/platform_device.h>
15#include <linux/io.h>
16#include <linux/irq.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070017#include <linux/i2c.h>
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -070018#include <linux/i2c/sx150x.h>
Amir Samuelov5137e392011-09-21 17:31:25 +030019#include <linux/i2c/isl9519.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070020#include <linux/gpio.h>
21#include <linux/msm_ssbi.h>
Steve Mucklef132c6c2012-06-06 18:30:57 -070022#include <linux/regulator/msm-gpio-regulator.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070023#include <linux/mfd/pm8xxx/pm8921.h>
Siddartha Mohanadossaf91d902011-10-20 10:23:34 -070024#include <linux/mfd/pm8xxx/pm8xxx-adc.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070025#include <linux/regulator/consumer.h>
26#include <linux/spi/spi.h>
27#include <linux/slimbus/slimbus.h>
28#include <linux/bootmem.h>
29#ifdef CONFIG_ANDROID_PMEM
30#include <linux/android_pmem.h>
31#endif
Steve Mucklef132c6c2012-06-06 18:30:57 -070032#include <linux/cyttsp-qc.h>
Laura Abbott354d40f2012-08-03 17:32:09 -070033#include <linux/dma-contiguous.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070034#include <linux/dma-mapping.h>
35#include <linux/platform_data/qcom_crypto_device.h>
Ankur Nandwanib0039b02011-08-09 14:00:45 -070036#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070037#include <linux/leds.h>
38#include <linux/leds-pm8xxx.h>
Mohan Pallaka50837382011-09-07 11:00:57 +053039#include <linux/i2c/atmel_mxt_ts.h>
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -070040#include <linux/msm_tsens.h>
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -070041#include <linux/ks8851.h>
Mohan Pallaka5e490392011-09-09 15:18:41 +053042#include <linux/i2c/isa1200.h>
Jack Cheung0b1987e2011-11-18 13:36:29 -080043#include <linux/memory.h>
Larry Bassel2d8b42d2012-03-12 10:41:26 -070044#include <linux/memblock.h>
Praveen Chidambaram877d7a42012-06-05 14:33:20 -060045#include <linux/msm_thermal.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080046
47#include <asm/mach-types.h>
48#include <asm/mach/arch.h>
Larry Basselb4126da2011-07-18 14:31:33 -070049#include <asm/setup.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080050#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070051#include <asm/mach/mmc.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080052
53#include <mach/board.h>
Joel Nider266a2642011-10-16 10:58:05 +020054#include <mach/msm_tspp.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080055#include <mach/msm_iomap.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070056#include <mach/msm_spi.h>
Mayank Ranae009c922012-03-22 03:02:06 +053057#include <mach/msm_serial_hs.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070058#ifdef CONFIG_USB_MSM_OTG_72K
59#include <mach/msm_hsusb.h>
60#else
61#include <linux/usb/msm_hsusb.h>
62#endif
63#include <linux/usb/android.h>
64#include <mach/usbdiag.h>
65#include <mach/socinfo.h>
66#include <mach/rpm.h>
Rohit Vaswania513aa8d2011-07-18 15:14:28 -070067#include <mach/gpiomux.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070068#include <mach/msm_bus_board.h>
69#include <mach/msm_memtypes.h>
70#include <mach/dma.h>
71#include <mach/msm_dsps.h>
72#include <mach/msm_xo.h>
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -070073#include <mach/restart.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080074
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070075#ifdef CONFIG_WCD9310_CODEC
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +053076#include <linux/mfd/wcd9xxx/core.h>
77#include <linux/mfd/wcd9xxx/pdata.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070078#endif
79
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +053080#include <linux/smsc3503.h>
Mitchel Humpherys9dc32cf2012-09-06 11:34:03 -070081#include <linux/msm_ion.h>
Laura Abbottd6183792011-08-19 13:42:24 -070082#include <mach/ion.h>
Joel Kingb8352a12011-11-15 18:46:24 -080083#include <mach/mdm2.h>
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -080084#include <mach/mdm-peripheral.h>
Laura Abbottf8c03b92012-02-16 14:57:58 -080085#include <mach/msm_rtb.h>
Laura Abbott306bcc22012-03-08 11:24:53 -080086#include <mach/msm_cache_dump.h>
87#include <mach/scm.h>
Olav Haugan8726caf2012-05-10 15:11:35 -070088#include <mach/iommu_domains.h>
Laura Abbottd6183792011-08-19 13:42:24 -070089
Jordan Crouse914de9b2012-07-09 13:49:46 -060090#include <mach/kgsl.h>
Larry Bassel41a055b2011-12-06 16:15:14 -080091#include <linux/fmem.h>
92
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070093#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080094#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070095#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070096#include "spm.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080097#include "board-8960.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080098#include "pm.h"
Abhijeet Dharmapurikarefaca4f2011-12-27 16:24:07 -080099#include <mach/cpuidle.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700100#include "rpm_resources.h"
Subhash Jadavani909e04f2012-04-12 10:52:50 +0530101#include <mach/mpm.h>
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) */
Olav Haugan32594552012-03-13 11:40:05 -0700160#define MSM_ION_HEAP_NUM 7
161#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
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700180
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800181static unsigned msm_ion_sf_size = MSM_ION_SF_SIZE;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700182#else
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700183#define MSM_CONTIG_MEM_SIZE 0x110C000
Olav Hauganb5be7992011-11-18 14:29:02 -0800184#define MSM_ION_HEAP_NUM 1
Laura Abbott2d1760b2011-09-29 21:31:24 -0700185#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700186
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700187#ifdef CONFIG_KERNEL_MSM_CONTIG_MEM_REGION
188static unsigned msm_contig_mem_size = MSM_CONTIG_MEM_SIZE;
189static int __init msm_contig_mem_size_setup(char *p)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700190{
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700191 msm_contig_mem_size = memparse(p, NULL);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700192 return 0;
193}
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700194early_param("msm_contig_mem_size", msm_contig_mem_size_setup);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700195#endif
196
197#ifdef CONFIG_ANDROID_PMEM
198static unsigned pmem_size = MSM_PMEM_SIZE;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800199static unsigned pmem_param_set;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700200static int __init pmem_size_setup(char *p)
201{
202 pmem_size = memparse(p, NULL);
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800203 pmem_param_set = 1;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700204 return 0;
205}
206early_param("pmem_size", pmem_size_setup);
207
208static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
209
210static int __init pmem_adsp_size_setup(char *p)
211{
212 pmem_adsp_size = memparse(p, NULL);
213 return 0;
214}
215early_param("pmem_adsp_size", pmem_adsp_size_setup);
216
217static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
218
219static int __init pmem_audio_size_setup(char *p)
220{
221 pmem_audio_size = memparse(p, NULL);
222 return 0;
223}
224early_param("pmem_audio_size", pmem_audio_size_setup);
225#endif
226
227#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700228#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700229static struct android_pmem_platform_data android_pmem_pdata = {
230 .name = "pmem",
231 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
232 .cached = 1,
233 .memory_type = MEMTYPE_EBI1,
234};
235
Laura Abbottb93525f2012-04-12 09:57:19 -0700236static struct platform_device msm8960_android_pmem_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700237 .name = "android_pmem",
238 .id = 0,
239 .dev = {.platform_data = &android_pmem_pdata},
240};
241
242static struct android_pmem_platform_data android_pmem_adsp_pdata = {
243 .name = "pmem_adsp",
244 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
245 .cached = 0,
246 .memory_type = MEMTYPE_EBI1,
247};
Laura Abbottb93525f2012-04-12 09:57:19 -0700248static struct platform_device msm8960_android_pmem_adsp_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700249 .name = "android_pmem",
250 .id = 2,
251 .dev = { .platform_data = &android_pmem_adsp_pdata },
252};
253
254static struct android_pmem_platform_data android_pmem_audio_pdata = {
255 .name = "pmem_audio",
256 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
257 .cached = 0,
258 .memory_type = MEMTYPE_EBI1,
259};
260
Laura Abbottb93525f2012-04-12 09:57:19 -0700261static struct platform_device msm8960_android_pmem_audio_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700262 .name = "android_pmem",
263 .id = 4,
264 .dev = { .platform_data = &android_pmem_audio_pdata },
265};
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700266#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
267#endif /*CONFIG_ANDROID_PMEM*/
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700268
Laura Abbottb93525f2012-04-12 09:57:19 -0700269struct fmem_platform_data msm8960_fmem_pdata = {
Larry Bassel41a055b2011-12-06 16:15:14 -0800270};
271
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700272#define DSP_RAM_BASE_8960 0x8da00000
273#define DSP_RAM_SIZE_8960 0x1800000
274static int dspcrashd_pdata_8960 = 0xDEADDEAD;
275
276static struct resource resources_dspcrashd_8960[] = {
277 {
278 .name = "msm_dspcrashd",
279 .start = DSP_RAM_BASE_8960,
280 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
281 .flags = IORESOURCE_DMA,
282 },
283};
284
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800285static struct platform_device msm_device_dspcrashd_8960 = {
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700286 .name = "msm_dspcrashd",
287 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
288 .resource = resources_dspcrashd_8960,
289 .dev = { .platform_data = &dspcrashd_pdata_8960 },
290};
291
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700292static struct memtype_reserve msm8960_reserve_table[] __initdata = {
293 [MEMTYPE_SMI] = {
294 },
295 [MEMTYPE_EBI0] = {
296 .flags = MEMTYPE_FLAGS_1M_ALIGN,
297 },
298 [MEMTYPE_EBI1] = {
299 .flags = MEMTYPE_FLAGS_1M_ALIGN,
300 },
301};
302
Laura Abbottf8c03b92012-02-16 14:57:58 -0800303static void __init reserve_rtb_memory(void)
304{
305#if defined(CONFIG_MSM_RTB)
Laura Abbottb93525f2012-04-12 09:57:19 -0700306 msm8960_reserve_table[MEMTYPE_EBI1].size += msm8960_rtb_pdata.size;
Laura Abbottf8c03b92012-02-16 14:57:58 -0800307#endif
308}
309
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700310static void __init size_pmem_devices(void)
311{
312#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700313#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700314 android_pmem_adsp_pdata.size = pmem_adsp_size;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800315
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800316 if (!pmem_param_set) {
317 if (machine_is_msm8960_liquid())
318 pmem_size = MSM_LIQUID_PMEM_SIZE;
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700319 if (msm8960_hdmi_as_primary_selected())
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800320 pmem_size = MSM_HDMI_PRIM_PMEM_SIZE;
321 }
322
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700323 android_pmem_pdata.size = pmem_size;
324 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700325#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
326#endif /*CONFIG_ANDROID_PMEM*/
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700327}
328
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700329#ifdef CONFIG_ANDROID_PMEM
330#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700331static void __init reserve_memory_for(struct android_pmem_platform_data *p)
332{
333 msm8960_reserve_table[p->memory_type].size += p->size;
334}
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700335#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
336#endif /*CONFIG_ANDROID_PMEM*/
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700337
338static void __init reserve_pmem_memory(void)
339{
340#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700341#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700342 reserve_memory_for(&android_pmem_adsp_pdata);
343 reserve_memory_for(&android_pmem_pdata);
344 reserve_memory_for(&android_pmem_audio_pdata);
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700345#endif
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700346 msm8960_reserve_table[MEMTYPE_EBI1].size += msm_contig_mem_size;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700347#endif
348}
349
Larry Basselb4126da2011-07-18 14:31:33 -0700350static int msm8960_paddr_to_memtype(unsigned int paddr)
351{
352 return MEMTYPE_EBI1;
353}
354
Steve Mucklef132c6c2012-06-06 18:30:57 -0700355#define FMEM_ENABLED 0
Olav Hauganf6dc7742012-02-15 09:11:55 -0800356
Laura Abbottd6183792011-08-19 13:42:24 -0700357#ifdef CONFIG_ION_MSM
Olav Haugan0703dbf2011-12-19 17:53:38 -0800358#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -0700359static struct ion_cp_heap_pdata cp_mm_msm8960_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800360 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugan8726caf2012-05-10 15:11:35 -0700361 .align = SZ_64K,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800362 .reusable = FMEM_ENABLED,
363 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700364 .fixed_position = FIXED_MIDDLE,
Olav Haugan8726caf2012-05-10 15:11:35 -0700365 .iommu_map_all = 1,
366 .iommu_2x_map_domain = VIDEO_DOMAIN,
Laura Abbottadec9c72012-12-05 11:49:59 -0800367 .is_cma = 1,
Laura Abbott5249a052012-12-11 15:09:03 -0800368 .no_nonsecure_alloc = 1,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800369};
370
Laura Abbottb93525f2012-04-12 09:57:19 -0700371static struct ion_cp_heap_pdata cp_mfc_msm8960_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800372 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugan42ebe712012-01-10 16:30:58 -0800373 .align = PAGE_SIZE,
Olav Haugan65f4bd82011-12-13 11:50:08 -0800374 .reusable = 0,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800375 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700376 .fixed_position = FIXED_HIGH,
Laura Abbott5249a052012-12-11 15:09:03 -0800377 .no_nonsecure_alloc = 1,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800378};
379
Laura Abbottb93525f2012-04-12 09:57:19 -0700380static struct ion_co_heap_pdata co_msm8960_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800381 .adjacent_mem_id = INVALID_HEAP_ID,
382 .align = PAGE_SIZE,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800383 .mem_is_fmem = 0,
Olav Haugan42ebe712012-01-10 16:30:58 -0800384};
385
Laura Abbottb93525f2012-04-12 09:57:19 -0700386static struct ion_co_heap_pdata fw_co_msm8960_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800387 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
388 .align = SZ_128K,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800389 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700390 .fixed_position = FIXED_LOW,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800391};
392#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800393
Laura Abbott354d40f2012-08-03 17:32:09 -0700394static u64 msm_dmamask = DMA_BIT_MASK(32);
395
396static struct platform_device ion_mm_heap_device = {
397 .name = "ion-mm-heap-device",
398 .id = -1,
399 .dev = {
400 .dma_mask = &msm_dmamask,
401 .coherent_dma_mask = DMA_BIT_MASK(32),
402 }
403};
404
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800405/**
406 * These heaps are listed in the order they will be allocated. Due to
407 * video hardware restrictions and content protection the FW heap has to
408 * be allocated adjacent (below) the MM heap and the MFC heap has to be
409 * allocated after the MM heap to ensure MFC heap is not more than 256MB
410 * away from the base address of the FW heap.
411 * However, the order of FW heap and MM heap doesn't matter since these
412 * two heaps are taken care of by separate code to ensure they are adjacent
413 * to each other.
414 * Don't swap the order unless you know what you are doing!
415 */
Benjamin Gaignardb2d367c2012-06-25 15:27:30 -0700416struct ion_platform_heap msm8960_heaps[] = {
Laura Abbottd6183792011-08-19 13:42:24 -0700417 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800418 .id = ION_SYSTEM_HEAP_ID,
Laura Abbottd6183792011-08-19 13:42:24 -0700419 .type = ION_HEAP_TYPE_SYSTEM,
Laura Abbottd6183792011-08-19 13:42:24 -0700420 .name = ION_VMALLOC_HEAP_NAME,
421 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700422#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -0700423 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800424 .id = ION_CP_MM_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800425 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800426 .name = ION_MM_HEAP_NAME,
427 .size = MSM_ION_MM_SIZE,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700428 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700429 .extra_data = (void *) &cp_mm_msm8960_ion_pdata,
Laura Abbott354d40f2012-08-03 17:32:09 -0700430 .priv = &ion_mm_heap_device.dev,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700431 },
Laura Abbott8c017362011-09-22 20:59:12 -0700432 {
Olav Haugan42ebe712012-01-10 16:30:58 -0800433 .id = ION_MM_FIRMWARE_HEAP_ID,
434 .type = ION_HEAP_TYPE_CARVEOUT,
435 .name = ION_MM_FIRMWARE_HEAP_NAME,
436 .size = MSM_ION_MM_FW_SIZE,
437 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700438 .extra_data = (void *) &fw_co_msm8960_ion_pdata,
Olav Haugan42ebe712012-01-10 16:30:58 -0800439 },
440 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800441 .id = ION_CP_MFC_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800442 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800443 .name = ION_MFC_HEAP_NAME,
444 .size = MSM_ION_MFC_SIZE,
445 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700446 .extra_data = (void *) &cp_mfc_msm8960_ion_pdata,
Olav Hauganb5be7992011-11-18 14:29:02 -0800447 },
Olav Haugan32594552012-03-13 11:40:05 -0700448#ifndef CONFIG_MSM_IOMMU
Olav Hauganb5be7992011-11-18 14:29:02 -0800449 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800450 .id = ION_SF_HEAP_ID,
451 .type = ION_HEAP_TYPE_CARVEOUT,
452 .name = ION_SF_HEAP_NAME,
453 .size = MSM_ION_SF_SIZE,
454 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700455 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800456 },
Olav Haugan32594552012-03-13 11:40:05 -0700457#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800458 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800459 .id = ION_IOMMU_HEAP_ID,
Laura Abbott8c017362011-09-22 20:59:12 -0700460 .type = ION_HEAP_TYPE_IOMMU,
461 .name = ION_IOMMU_HEAP_NAME,
462 },
Olav Haugan80854eb2012-01-12 12:00:23 -0800463 {
464 .id = ION_QSECOM_HEAP_ID,
465 .type = ION_HEAP_TYPE_CARVEOUT,
466 .name = ION_QSECOM_HEAP_NAME,
467 .size = MSM_ION_QSECOM_SIZE,
468 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700469 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan80854eb2012-01-12 12:00:23 -0800470 },
Olav Haugan7355db02012-01-13 16:59:13 -0800471 {
472 .id = ION_AUDIO_HEAP_ID,
473 .type = ION_HEAP_TYPE_CARVEOUT,
474 .name = ION_AUDIO_HEAP_NAME,
475 .size = MSM_ION_AUDIO_SIZE,
476 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700477 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan7355db02012-01-13 16:59:13 -0800478 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700479#endif
Benjamin Gaignardb2d367c2012-06-25 15:27:30 -0700480};
481
482static struct ion_platform_data msm8960_ion_pdata = {
483 .nr = MSM_ION_HEAP_NUM,
484 .heaps = msm8960_heaps,
Laura Abbottd6183792011-08-19 13:42:24 -0700485};
486
Laura Abbottb93525f2012-04-12 09:57:19 -0700487static struct platform_device msm8960_ion_dev = {
Laura Abbottd6183792011-08-19 13:42:24 -0700488 .name = "ion-msm",
489 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700490 .dev = { .platform_data = &msm8960_ion_pdata },
Laura Abbottd6183792011-08-19 13:42:24 -0700491};
492#endif
493
Laura Abbottb93525f2012-04-12 09:57:19 -0700494struct platform_device msm8960_fmem_device = {
Larry Bassel41a055b2011-12-06 16:15:14 -0800495 .name = "fmem",
496 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700497 .dev = { .platform_data = &msm8960_fmem_pdata },
Larry Bassel41a055b2011-12-06 16:15:14 -0800498};
499
Olav Haugan65f4bd82011-12-13 11:50:08 -0800500static void __init adjust_mem_for_liquid(void)
Laura Abbottd6183792011-08-19 13:42:24 -0700501{
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800502 unsigned int i;
503
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800504 if (!pmem_param_set) {
505 if (machine_is_msm8960_liquid())
506 msm_ion_sf_size = MSM_LIQUID_ION_SF_SIZE;
507
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700508 if (msm8960_hdmi_as_primary_selected())
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800509 msm_ion_sf_size = MSM_HDMI_PRIM_ION_SF_SIZE;
510
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700511 if (machine_is_msm8960_liquid() ||
512 msm8960_hdmi_as_primary_selected()) {
Laura Abbottb93525f2012-04-12 09:57:19 -0700513 for (i = 0; i < msm8960_ion_pdata.nr; i++) {
514 if (msm8960_ion_pdata.heaps[i].id ==
515 ION_SF_HEAP_ID) {
516 msm8960_ion_pdata.heaps[i].size =
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800517 msm_ion_sf_size;
518 pr_debug("msm_ion_sf_size 0x%x\n",
519 msm_ion_sf_size);
520 break;
521 }
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800522 }
523 }
524 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800525}
526
527static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
528 unsigned long size)
529{
530 msm8960_reserve_table[mem_type].size += size;
531}
532
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700533static void __init msm8960_reserve_fixed_area(unsigned long fixed_area_size)
534{
535#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
536 int ret;
537
538 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
539 panic("fixed area size is larger than %dM\n",
540 MAX_FIXED_AREA_SIZE >> 20);
541
542 reserve_info->fixed_area_size = fixed_area_size;
543 reserve_info->fixed_area_start = MSM8960_FW_START;
544
545 ret = memblock_remove(reserve_info->fixed_area_start,
546 reserve_info->fixed_area_size);
547 BUG_ON(ret);
548#endif
549}
550
Olav Haugan65f4bd82011-12-13 11:50:08 -0800551/**
552 * Reserve memory for ION and calculate amount of reusable memory for fmem.
553 * We only reserve memory for heaps that are not reusable. However, we only
554 * support one reusable heap at the moment so we ignore the reusable flag for
555 * other than the first heap with reusable flag set. Also handle special case
Olav Hauganf6dc7742012-02-15 09:11:55 -0800556 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
557 * at a higher address than FW in addition to not more than 256MB away from the
558 * base address of the firmware. This means that if MM is reusable the other
559 * two heaps must be allocated in the same region as FW. This is handled by the
560 * mem_is_fmem flag in the platform data. In addition the MM heap must be
561 * adjacent to the FW heap for content protection purposes.
Olav Haugan65f4bd82011-12-13 11:50:08 -0800562 */
563static void __init reserve_ion_memory(void)
564{
565#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
566 unsigned int i;
Laura Abbott354d40f2012-08-03 17:32:09 -0700567 int ret;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700568 unsigned int fixed_size = 0;
569 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
570 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
Laura Abbott354d40f2012-08-03 17:32:09 -0700571 unsigned long cma_alignment;
572 unsigned int low_use_cma = 0;
573 unsigned int middle_use_cma = 0;
574 unsigned int high_use_cma = 0;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800575
576 adjust_mem_for_liquid();
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700577 fixed_low_size = 0;
578 fixed_middle_size = 0;
579 fixed_high_size = 0;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800580
Laura Abbott354d40f2012-08-03 17:32:09 -0700581 cma_alignment = PAGE_SIZE << max(MAX_ORDER, pageblock_order);
582
Laura Abbottb93525f2012-04-12 09:57:19 -0700583 for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
Olav Haugan8726caf2012-05-10 15:11:35 -0700584 struct ion_platform_heap *heap =
Laura Abbottb93525f2012-04-12 09:57:19 -0700585 &(msm8960_ion_pdata.heaps[i]);
Olav Haugan8726caf2012-05-10 15:11:35 -0700586 int align = SZ_4K;
587 int iommu_map_all = 0;
588 int adjacent_mem_id = INVALID_HEAP_ID;
Laura Abbott354d40f2012-08-03 17:32:09 -0700589 int use_cma = 0;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800590
591 if (heap->extra_data) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700592 int fixed_position = NOT_FIXED;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700593
Mitchel Humpherysdc4d01d2012-09-13 10:53:22 -0700594 switch ((int) heap->type) {
Olav Haugan65f4bd82011-12-13 11:50:08 -0800595 case ION_HEAP_TYPE_CP:
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700596 fixed_position = ((struct ion_cp_heap_pdata *)
597 heap->extra_data)->fixed_position;
Olav Haugan8726caf2012-05-10 15:11:35 -0700598 align = ((struct ion_cp_heap_pdata *)
599 heap->extra_data)->align;
600 iommu_map_all =
601 ((struct ion_cp_heap_pdata *)
602 heap->extra_data)->iommu_map_all;
Laura Abbott354d40f2012-08-03 17:32:09 -0700603 if (((struct ion_cp_heap_pdata *)
604 heap->extra_data)->is_cma) {
605 heap->size = ALIGN(heap->size,
606 cma_alignment);
607 use_cma = 1;
608 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800609 break;
Laura Abbott354d40f2012-08-03 17:32:09 -0700610 case ION_HEAP_TYPE_DMA:
611 use_cma = 1;
612 /* Purposely fall through here */
Olav Haugan65f4bd82011-12-13 11:50:08 -0800613 case ION_HEAP_TYPE_CARVEOUT:
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700614 fixed_position = ((struct ion_co_heap_pdata *)
615 heap->extra_data)->fixed_position;
Olav Haugan8726caf2012-05-10 15:11:35 -0700616 adjacent_mem_id = ((struct ion_co_heap_pdata *)
617 heap->extra_data)->adjacent_mem_id;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700618 break;
619 default:
620 break;
621 }
622
Olav Haugan8726caf2012-05-10 15:11:35 -0700623 if (iommu_map_all) {
624 if (heap->size & (SZ_64K-1)) {
625 heap->size = ALIGN(heap->size, SZ_64K);
626 pr_info("Heap %s not aligned to 64K. Adjusting size to %x\n",
627 heap->name, heap->size);
628 }
629 }
630
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700631 if (fixed_position != NOT_FIXED)
632 fixed_size += heap->size;
633 else
634 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
635
Laura Abbott354d40f2012-08-03 17:32:09 -0700636 if (fixed_position == FIXED_LOW) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700637 fixed_low_size += heap->size;
Laura Abbott354d40f2012-08-03 17:32:09 -0700638 low_use_cma = use_cma;
639 } else if (fixed_position == FIXED_MIDDLE) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700640 fixed_middle_size += heap->size;
Laura Abbott354d40f2012-08-03 17:32:09 -0700641 middle_use_cma = use_cma;
642 } else if (fixed_position == FIXED_HIGH) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700643 fixed_high_size += heap->size;
Laura Abbott354d40f2012-08-03 17:32:09 -0700644 high_use_cma = use_cma;
645 } else if (use_cma) {
646 /*
647 * Heaps that use CMA but are not part of the
648 * fixed set. Create wherever.
649 */
650 dma_declare_contiguous(
651 heap->priv,
652 heap->size,
653 0,
654 0xb0000000);
655 }
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700656 }
657 }
658
659 if (!fixed_size)
660 return;
661
Laura Abbott354d40f2012-08-03 17:32:09 -0700662 /*
663 * Given the setup for the fixed area, we can't round up all sizes.
664 * Some sizes must be set up exactly and aligned correctly. Incorrect
665 * alignments are considered a configuration issue
Larry Bassel4d4f4482012-04-04 11:26:09 -0700666 */
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700667
668 fixed_low_start = MSM8960_FIXED_AREA_START;
Laura Abbott354d40f2012-08-03 17:32:09 -0700669 if (low_use_cma) {
670 BUG_ON(!IS_ALIGNED(fixed_low_start, cma_alignment));
671 BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, cma_alignment));
672 } else {
673 BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, SECTION_SIZE));
674 ret = memblock_remove(fixed_low_start,
675 fixed_low_size + HOLE_SIZE);
676 BUG_ON(ret);
677 }
678
Deepak Kotur35825522012-06-06 15:49:14 -0700679 fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE;
Laura Abbott354d40f2012-08-03 17:32:09 -0700680 if (middle_use_cma) {
681 BUG_ON(!IS_ALIGNED(fixed_middle_start, cma_alignment));
682 BUG_ON(!IS_ALIGNED(fixed_middle_size, cma_alignment));
683 } else {
684 BUG_ON(!IS_ALIGNED(fixed_middle_size, SECTION_SIZE));
685 ret = memblock_remove(fixed_middle_start, fixed_middle_size);
686 BUG_ON(ret);
687 }
688
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700689 fixed_high_start = fixed_middle_start + fixed_middle_size;
Laura Abbott354d40f2012-08-03 17:32:09 -0700690 if (high_use_cma) {
691 fixed_high_size = ALIGN(fixed_high_size, cma_alignment);
692 BUG_ON(!IS_ALIGNED(fixed_high_start, cma_alignment));
693 } else {
694 /* This is the end of the fixed area so it's okay to round up */
695 fixed_high_size = ALIGN(fixed_high_size, SECTION_SIZE);
696 ret = memblock_remove(fixed_high_start, fixed_high_size);
697 BUG_ON(ret);
698 }
699
700
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700701
Laura Abbottb93525f2012-04-12 09:57:19 -0700702 for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
703 struct ion_platform_heap *heap = &(msm8960_ion_pdata.heaps[i]);
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700704
705 if (heap->extra_data) {
706 int fixed_position = NOT_FIXED;
Steve Muckle75c34ca2012-06-12 14:27:40 -0700707 struct ion_cp_heap_pdata *pdata = NULL;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700708
Mitchel Humpherysdc4d01d2012-09-13 10:53:22 -0700709 switch ((int) heap->type) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700710 case ION_HEAP_TYPE_CP:
Deepak Kotur35825522012-06-06 15:49:14 -0700711 pdata =
712 (struct ion_cp_heap_pdata *)heap->extra_data;
713 fixed_position = pdata->fixed_position;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700714 break;
715 case ION_HEAP_TYPE_CARVEOUT:
Laura Abbott354d40f2012-08-03 17:32:09 -0700716 case ION_HEAP_TYPE_DMA:
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700717 fixed_position = ((struct ion_co_heap_pdata *)
718 heap->extra_data)->fixed_position;
719 break;
720 default:
721 break;
722 }
723
724 switch (fixed_position) {
725 case FIXED_LOW:
726 heap->base = fixed_low_start;
727 break;
728 case FIXED_MIDDLE:
729 heap->base = fixed_middle_start;
Laura Abbott354d40f2012-08-03 17:32:09 -0700730 if (middle_use_cma) {
731 ret = dma_declare_contiguous(
732 &ion_mm_heap_device.dev,
733 heap->size,
734 fixed_middle_start,
735 0xa0000000);
736 WARN_ON(ret);
737 }
Deepak Kotur35825522012-06-06 15:49:14 -0700738 pdata->secure_base = fixed_middle_start
739 - HOLE_SIZE;
740 pdata->secure_size = HOLE_SIZE + heap->size;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700741 break;
742 case FIXED_HIGH:
743 heap->base = fixed_high_start;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800744 break;
745 default:
746 break;
747 }
748 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800749 }
Laura Abbottd6183792011-08-19 13:42:24 -0700750#endif
751}
Huaibin Yanga5419422011-12-08 23:52:10 -0800752
Laura Abbott5249a052012-12-11 15:09:03 -0800753static void ion_adjust_secure_allocation(void)
754{
755 int i;
756
757 for (i = 0; i < msm8960_ion_pdata.nr; i++) {
758 struct ion_platform_heap *heap =
759 &(msm8960_ion_pdata.heaps[i]);
760
761
762 if (heap->extra_data) {
763 switch ((int) heap->type) {
764 case ION_HEAP_TYPE_CP:
765 if (cpu_is_msm8960()) {
766 ((struct ion_cp_heap_pdata *)
767 heap->extra_data)->no_nonsecure_alloc =
768 0;
769 }
770
771 }
772 }
773 }
774}
775
Huaibin Yanga5419422011-12-08 23:52:10 -0800776static void __init reserve_mdp_memory(void)
777{
778 msm8960_mdp_writeback(msm8960_reserve_table);
779}
780
Stephen Boyd668d7652012-04-25 11:31:01 -0700781static void __init reserve_cache_dump_memory(void)
Laura Abbott306bcc22012-03-08 11:24:53 -0800782{
783#ifdef CONFIG_MSM_CACHE_DUMP
Laura Abbott306bcc22012-03-08 11:24:53 -0800784 unsigned int total;
Laura Abbott306bcc22012-03-08 11:24:53 -0800785
Laura Abbott155ab6f2012-05-25 08:52:18 -0700786 total = msm8960_cache_dump_pdata.l1_size +
787 msm8960_cache_dump_pdata.l2_size;
Laura Abbott306bcc22012-03-08 11:24:53 -0800788 msm8960_reserve_table[MEMTYPE_EBI1].size += total;
Laura Abbott306bcc22012-03-08 11:24:53 -0800789#endif
790}
791
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700792static void __init msm8960_calculate_reserve_sizes(void)
793{
794 size_pmem_devices();
795 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700796 reserve_ion_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800797 reserve_mdp_memory();
Laura Abbottf8c03b92012-02-16 14:57:58 -0800798 reserve_rtb_memory();
Laura Abbott306bcc22012-03-08 11:24:53 -0800799 reserve_cache_dump_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700800}
801
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700802static struct reserve_info msm8960_reserve_info __initdata = {
803 .memtype_reserve_table = msm8960_reserve_table,
804 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700805 .reserve_fixed_area = msm8960_reserve_fixed_area,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700806 .paddr_to_memtype = msm8960_paddr_to_memtype,
807};
808
Larry Basselb4126da2011-07-18 14:31:33 -0700809static int msm8960_memory_bank_size(void)
810{
811 return 1<<29;
812}
813
814static void __init locate_unstable_memory(void)
815{
816 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
817 unsigned long bank_size;
818 unsigned long low, high;
819
820 bank_size = msm8960_memory_bank_size();
Larry Bassel4d4f4482012-04-04 11:26:09 -0700821 msm8960_reserve_info.bank_size = bank_size;
822
Larry Basselb4126da2011-07-18 14:31:33 -0700823 low = meminfo.bank[0].start;
824 high = mb->start + mb->size;
Olav Haugan62052e42011-10-28 14:28:32 -0700825
826 /* Check if 32 bit overflow occured */
827 if (high < mb->start)
828 high = ~0UL;
829
Larry Bassel4d4f4482012-04-04 11:26:09 -0700830 if (high < MAX_FIXED_AREA_SIZE + MSM8960_FIXED_AREA_START)
831 panic("fixed area extends beyond end of memory\n");
832
Larry Basselb4126da2011-07-18 14:31:33 -0700833 low &= ~(bank_size - 1);
834
835 if (high - low <= bank_size)
Larry Bassel4d4f4482012-04-04 11:26:09 -0700836 goto no_dmm;
Larry Basselb8d61022012-02-24 10:49:45 -0800837
Larry Basselb8d61022012-02-24 10:49:45 -0800838#ifdef CONFIG_ENABLE_DMM
Jack Cheung60eaeab2012-01-09 16:40:26 -0800839 msm8960_reserve_info.low_unstable_address = mb->start -
840 MIN_MEMORY_BLOCK_SIZE + mb->size;
Jack Cheung0b1987e2011-11-18 13:36:29 -0800841 msm8960_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
Larry Basselb4126da2011-07-18 14:31:33 -0700842 pr_info("low unstable address %lx max size %lx bank size %lx\n",
843 msm8960_reserve_info.low_unstable_address,
844 msm8960_reserve_info.max_unstable_size,
845 msm8960_reserve_info.bank_size);
Larry Bassel4d4f4482012-04-04 11:26:09 -0700846 return;
Larry Basselb8d61022012-02-24 10:49:45 -0800847#endif
Larry Bassel4d4f4482012-04-04 11:26:09 -0700848no_dmm:
849 msm8960_reserve_info.low_unstable_address = high;
850 msm8960_reserve_info.max_unstable_size = 0;
Larry Basselb4126da2011-07-18 14:31:33 -0700851}
852
Larry Basselb830e182011-10-14 10:46:55 -0700853static void __init place_movable_zone(void)
854{
Larry Basselb8d61022012-02-24 10:49:45 -0800855#ifdef CONFIG_ENABLE_DMM
Larry Basselb830e182011-10-14 10:46:55 -0700856 movable_reserved_start = msm8960_reserve_info.low_unstable_address;
857 movable_reserved_size = msm8960_reserve_info.max_unstable_size;
858 pr_info("movable zone start %lx size %lx\n",
859 movable_reserved_start, movable_reserved_size);
Larry Basselb8d61022012-02-24 10:49:45 -0800860#endif
Larry Basselb830e182011-10-14 10:46:55 -0700861}
862
863static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700864{
865 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700866 locate_unstable_memory();
Larry Basselb830e182011-10-14 10:46:55 -0700867 place_movable_zone();
868}
869
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800870static char prim_panel_name[PANEL_NAME_MAX_LEN];
871static char ext_panel_name[PANEL_NAME_MAX_LEN];
872static int __init prim_display_setup(char *param)
873{
874 if (strnlen(param, PANEL_NAME_MAX_LEN))
875 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
876 return 0;
877}
878early_param("prim_display", prim_display_setup);
879
880static int __init ext_display_setup(char *param)
881{
882 if (strnlen(param, PANEL_NAME_MAX_LEN))
883 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
884 return 0;
885}
886early_param("ext_display", ext_display_setup);
887
Larry Basselb830e182011-10-14 10:46:55 -0700888static void __init msm8960_reserve(void)
889{
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800890 msm8960_set_display_params(prim_panel_name, ext_panel_name);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700891 msm_reserve();
892}
893
Larry Bassela4414b12011-08-04 11:11:02 -0700894static int msm8960_change_memory_power(u64 start, u64 size,
895 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700896{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -0700897 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -0700898}
899
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700900static void __init msm8960_allocate_memory_regions(void)
901{
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800902 msm8960_allocate_fb_region();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700903}
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800904
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700905#ifdef CONFIG_WCD9310_CODEC
906
907#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
908
Patrick Lai3043fba2011-08-01 14:15:57 -0700909/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
910 * 4 micbiases are used to power various analog and digital
911 * microphones operating at 1800 mV. Technically, all micbiases
912 * can source from single cfilter since all microphones operate
913 * at the same voltage level. The arrangement below is to make
914 * sure all cfilters are exercised. LDO_H regulator ouput level
915 * does not need to be as high as 2.85V. It is choosen for
916 * microphone sensitivity purpose.
917 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530918static struct wcd9xxx_pdata tabla_platform_data = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700919 .slimbus_slave_device = {
920 .name = "tabla-slave",
921 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
922 },
923 .irq = MSM_GPIO_TO_INT(62),
924 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530925 .num_irqs = NR_WCD9XXX_IRQS,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700926 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -0700927 .micbias = {
928 .ldoh_v = TABLA_LDOH_2P85_V,
929 .cfilt1_mv = 1800,
Joonwoo Parkcf473b42012-03-29 19:48:16 -0700930 .cfilt2_mv = 2700,
Patrick Lai3043fba2011-08-01 14:15:57 -0700931 .cfilt3_mv = 1800,
932 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
933 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
934 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
935 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530936 },
937 .regulator = {
938 {
939 .name = "CDC_VDD_CP",
940 .min_uV = 1800000,
941 .max_uV = 1800000,
942 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
943 },
944 {
945 .name = "CDC_VDDA_RX",
946 .min_uV = 1800000,
947 .max_uV = 1800000,
948 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
949 },
950 {
951 .name = "CDC_VDDA_TX",
952 .min_uV = 1800000,
953 .max_uV = 1800000,
954 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
955 },
956 {
957 .name = "VDDIO_CDC",
958 .min_uV = 1800000,
959 .max_uV = 1800000,
960 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
961 },
962 {
963 .name = "VDDD_CDC_D",
964 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700965 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530966 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
967 },
968 {
969 .name = "CDC_VDDA_A_1P2V",
970 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700971 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530972 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
973 },
974 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700975};
976
977static struct slim_device msm_slim_tabla = {
978 .name = "tabla-slim",
979 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
980 .dev = {
981 .platform_data = &tabla_platform_data,
982 },
983};
Santosh Mardi60e19d92011-10-28 01:15:14 +0530984
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530985static struct wcd9xxx_pdata tabla20_platform_data = {
Santosh Mardi60e19d92011-10-28 01:15:14 +0530986 .slimbus_slave_device = {
987 .name = "tabla-slave",
988 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
989 },
990 .irq = MSM_GPIO_TO_INT(62),
991 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530992 .num_irqs = NR_WCD9XXX_IRQS,
Santosh Mardi60e19d92011-10-28 01:15:14 +0530993 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
994 .micbias = {
995 .ldoh_v = TABLA_LDOH_2P85_V,
996 .cfilt1_mv = 1800,
Joonwoo Parkcf473b42012-03-29 19:48:16 -0700997 .cfilt2_mv = 2700,
Santosh Mardi60e19d92011-10-28 01:15:14 +0530998 .cfilt3_mv = 1800,
999 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
1000 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
1001 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
1002 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301003 },
1004 .regulator = {
1005 {
1006 .name = "CDC_VDD_CP",
1007 .min_uV = 1800000,
1008 .max_uV = 1800000,
1009 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
1010 },
1011 {
1012 .name = "CDC_VDDA_RX",
1013 .min_uV = 1800000,
1014 .max_uV = 1800000,
1015 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
1016 },
1017 {
1018 .name = "CDC_VDDA_TX",
1019 .min_uV = 1800000,
1020 .max_uV = 1800000,
1021 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
1022 },
1023 {
1024 .name = "VDDIO_CDC",
1025 .min_uV = 1800000,
1026 .max_uV = 1800000,
1027 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1028 },
1029 {
1030 .name = "VDDD_CDC_D",
1031 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -07001032 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301033 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1034 },
1035 {
1036 .name = "CDC_VDDA_A_1P2V",
1037 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -07001038 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301039 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1040 },
1041 },
Santosh Mardi60e19d92011-10-28 01:15:14 +05301042};
1043
1044static struct slim_device msm_slim_tabla20 = {
1045 .name = "tabla2x-slim",
1046 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
1047 .dev = {
1048 .platform_data = &tabla20_platform_data,
1049 },
1050};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001051#endif
1052
1053static struct slim_boardinfo msm_slim_devices[] = {
1054#ifdef CONFIG_WCD9310_CODEC
1055 {
1056 .bus_num = 1,
1057 .slim_slave = &msm_slim_tabla,
1058 },
Santosh Mardi60e19d92011-10-28 01:15:14 +05301059 {
1060 .bus_num = 1,
1061 .slim_slave = &msm_slim_tabla20,
1062 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001063#endif
1064 /* add more slimbus slaves as needed */
1065};
1066
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001067#define MSM_WCNSS_PHYS 0x03000000
1068#define MSM_WCNSS_SIZE 0x280000
1069
1070static struct resource resources_wcnss_wlan[] = {
1071 {
1072 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1073 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1074 .name = "wcnss_wlanrx_irq",
1075 .flags = IORESOURCE_IRQ,
1076 },
1077 {
1078 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1079 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1080 .name = "wcnss_wlantx_irq",
1081 .flags = IORESOURCE_IRQ,
1082 },
1083 {
1084 .start = MSM_WCNSS_PHYS,
1085 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1086 .name = "wcnss_mmio",
1087 .flags = IORESOURCE_MEM,
1088 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -07001089 {
1090 .start = 84,
1091 .end = 88,
1092 .name = "wcnss_gpios_5wire",
1093 .flags = IORESOURCE_IO,
1094 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001095};
1096
Ankur Nandwanib0039b02011-08-09 14:00:45 -07001097static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1098 .has_48mhz_xo = 1,
1099};
1100
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001101static struct platform_device msm_device_wcnss_wlan = {
1102 .name = "wcnss_wlan",
1103 .id = 0,
1104 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1105 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07001106 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001107};
1108
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001109#ifdef CONFIG_QSEECOM
1110/* qseecom bus scaling */
1111static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
1112 {
1113 .src = MSM_BUS_MASTER_SPS,
1114 .dst = MSM_BUS_SLAVE_EBI_CH0,
1115 .ib = 0,
1116 .ab = 0,
1117 },
1118 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001119 .src = MSM_BUS_MASTER_SPS,
1120 .dst = MSM_BUS_SLAVE_SPS,
1121 .ib = 0,
1122 .ab = 0,
1123 },
1124 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001125 .src = MSM_BUS_MASTER_SPDM,
1126 .dst = MSM_BUS_SLAVE_SPDM,
1127 .ib = 0,
1128 .ab = 0,
1129 },
1130};
1131
1132static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
1133 {
1134 .src = MSM_BUS_MASTER_SPS,
1135 .dst = MSM_BUS_SLAVE_EBI_CH0,
1136 .ib = (492 * 8) * 1000000UL,
1137 .ab = (492 * 8) * 100000UL,
1138 },
1139 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001140 .src = MSM_BUS_MASTER_SPS,
1141 .dst = MSM_BUS_SLAVE_SPS,
1142 .ib = (492 * 8) * 1000000UL,
1143 .ab = (492 * 8) * 100000UL,
1144 },
1145 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001146 .src = MSM_BUS_MASTER_SPDM,
1147 .dst = MSM_BUS_SLAVE_SPDM,
1148 .ib = 0,
1149 .ab = 0,
1150 },
1151};
1152
1153static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1154 {
1155 .src = MSM_BUS_MASTER_SPS,
1156 .dst = MSM_BUS_SLAVE_EBI_CH0,
1157 .ib = 0,
1158 .ab = 0,
1159 },
1160 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001161 .src = MSM_BUS_MASTER_SPS,
1162 .dst = MSM_BUS_SLAVE_SPS,
1163 .ib = 0,
1164 .ab = 0,
1165 },
1166 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001167 .src = MSM_BUS_MASTER_SPDM,
1168 .dst = MSM_BUS_SLAVE_SPDM,
1169 .ib = (64 * 8) * 1000000UL,
1170 .ab = (64 * 8) * 100000UL,
1171 },
1172};
1173
Ramesh Masavarapu4f091cb2012-10-03 10:18:06 -07001174static struct msm_bus_vectors qseecom_enable_dfab_sfpb_vectors[] = {
1175 {
1176 .src = MSM_BUS_MASTER_SPS,
1177 .dst = MSM_BUS_SLAVE_EBI_CH0,
1178 .ib = (492 * 8) * 1000000UL,
1179 .ab = (492 * 8) * 100000UL,
1180 },
1181 {
1182 .src = MSM_BUS_MASTER_SPS,
1183 .dst = MSM_BUS_SLAVE_SPS,
1184 .ib = (492 * 8) * 1000000UL,
1185 .ab = (492 * 8) * 100000UL,
1186 },
1187 {
1188 .src = MSM_BUS_MASTER_SPDM,
1189 .dst = MSM_BUS_SLAVE_SPDM,
1190 .ib = (64 * 8) * 1000000UL,
1191 .ab = (64 * 8) * 100000UL,
1192 },
1193};
1194
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001195static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1196 {
1197 ARRAY_SIZE(qseecom_clks_init_vectors),
1198 qseecom_clks_init_vectors,
1199 },
1200 {
1201 ARRAY_SIZE(qseecom_enable_dfab_vectors),
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001202 qseecom_enable_dfab_vectors,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001203 },
1204 {
1205 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1206 qseecom_enable_sfpb_vectors,
1207 },
Ramesh Masavarapu4f091cb2012-10-03 10:18:06 -07001208 {
1209 ARRAY_SIZE(qseecom_enable_dfab_sfpb_vectors),
1210 qseecom_enable_dfab_sfpb_vectors,
1211 },
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001212};
1213
1214static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1215 qseecom_hw_bus_scale_usecases,
1216 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1217 .name = "qsee",
1218};
1219
1220static struct platform_device qseecom_device = {
1221 .name = "qseecom",
1222 .id = 0,
1223 .dev = {
1224 .platform_data = &qseecom_bus_pdata,
1225 },
1226};
1227#endif
1228
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001229#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1230 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1231 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1232 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1233
1234#define QCE_SIZE 0x10000
1235#define QCE_0_BASE 0x18500000
1236
1237#define QCE_HW_KEY_SUPPORT 0
1238#define QCE_SHA_HMAC_SUPPORT 1
1239#define QCE_SHARE_CE_RESOURCE 1
1240#define QCE_CE_SHARED 0
1241
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001242/* Begin Bus scaling definitions */
1243static struct msm_bus_vectors crypto_hw_init_vectors[] = {
1244 {
1245 .src = MSM_BUS_MASTER_ADM_PORT0,
1246 .dst = MSM_BUS_SLAVE_EBI_CH0,
1247 .ab = 0,
1248 .ib = 0,
1249 },
1250 {
1251 .src = MSM_BUS_MASTER_ADM_PORT1,
1252 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1253 .ab = 0,
1254 .ib = 0,
1255 },
1256};
1257
1258static struct msm_bus_vectors crypto_hw_active_vectors[] = {
1259 {
1260 .src = MSM_BUS_MASTER_ADM_PORT0,
1261 .dst = MSM_BUS_SLAVE_EBI_CH0,
1262 .ab = 70000000UL,
1263 .ib = 70000000UL,
1264 },
1265 {
1266 .src = MSM_BUS_MASTER_ADM_PORT1,
1267 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1268 .ab = 2480000000UL,
1269 .ib = 2480000000UL,
1270 },
1271};
1272
1273static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
1274 {
1275 ARRAY_SIZE(crypto_hw_init_vectors),
1276 crypto_hw_init_vectors,
1277 },
1278 {
1279 ARRAY_SIZE(crypto_hw_active_vectors),
1280 crypto_hw_active_vectors,
1281 },
1282};
1283
1284static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
1285 crypto_hw_bus_scale_usecases,
1286 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
1287 .name = "cryptohw",
1288};
1289/* End Bus Scaling Definitions*/
1290
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001291static struct resource qcrypto_resources[] = {
1292 [0] = {
1293 .start = QCE_0_BASE,
1294 .end = QCE_0_BASE + QCE_SIZE - 1,
1295 .flags = IORESOURCE_MEM,
1296 },
1297 [1] = {
1298 .name = "crypto_channels",
1299 .start = DMOV_CE_IN_CHAN,
1300 .end = DMOV_CE_OUT_CHAN,
1301 .flags = IORESOURCE_DMA,
1302 },
1303 [2] = {
1304 .name = "crypto_crci_in",
1305 .start = DMOV_CE_IN_CRCI,
1306 .end = DMOV_CE_IN_CRCI,
1307 .flags = IORESOURCE_DMA,
1308 },
1309 [3] = {
1310 .name = "crypto_crci_out",
1311 .start = DMOV_CE_OUT_CRCI,
1312 .end = DMOV_CE_OUT_CRCI,
1313 .flags = IORESOURCE_DMA,
1314 },
1315};
1316
1317static struct resource qcedev_resources[] = {
1318 [0] = {
1319 .start = QCE_0_BASE,
1320 .end = QCE_0_BASE + QCE_SIZE - 1,
1321 .flags = IORESOURCE_MEM,
1322 },
1323 [1] = {
1324 .name = "crypto_channels",
1325 .start = DMOV_CE_IN_CHAN,
1326 .end = DMOV_CE_OUT_CHAN,
1327 .flags = IORESOURCE_DMA,
1328 },
1329 [2] = {
1330 .name = "crypto_crci_in",
1331 .start = DMOV_CE_IN_CRCI,
1332 .end = DMOV_CE_IN_CRCI,
1333 .flags = IORESOURCE_DMA,
1334 },
1335 [3] = {
1336 .name = "crypto_crci_out",
1337 .start = DMOV_CE_OUT_CRCI,
1338 .end = DMOV_CE_OUT_CRCI,
1339 .flags = IORESOURCE_DMA,
1340 },
1341};
1342
1343#endif
1344
1345#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1346 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1347
1348static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1349 .ce_shared = QCE_CE_SHARED,
1350 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1351 .hw_key_support = QCE_HW_KEY_SUPPORT,
1352 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001353 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001354};
1355
1356static struct platform_device qcrypto_device = {
1357 .name = "qcrypto",
1358 .id = 0,
1359 .num_resources = ARRAY_SIZE(qcrypto_resources),
1360 .resource = qcrypto_resources,
1361 .dev = {
1362 .coherent_dma_mask = DMA_BIT_MASK(32),
1363 .platform_data = &qcrypto_ce_hw_suppport,
1364 },
1365};
1366#endif
1367
1368#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1369 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1370
1371static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1372 .ce_shared = QCE_CE_SHARED,
1373 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1374 .hw_key_support = QCE_HW_KEY_SUPPORT,
1375 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001376 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001377};
1378
1379static struct platform_device qcedev_device = {
1380 .name = "qce",
1381 .id = 0,
1382 .num_resources = ARRAY_SIZE(qcedev_resources),
1383 .resource = qcedev_resources,
1384 .dev = {
1385 .coherent_dma_mask = DMA_BIT_MASK(32),
1386 .platform_data = &qcedev_ce_hw_suppport,
1387 },
1388};
1389#endif
1390
Joel King0cbf5d82012-05-24 15:21:38 -07001391static struct mdm_platform_data sglte_platform_data = {
1392 .mdm_version = "4.0",
1393 .ramdump_delay_ms = 1000,
Joel King63ce8332012-06-01 09:59:26 -07001394 .soft_reset_inverted = 1,
Joel King0cbf5d82012-05-24 15:21:38 -07001395 .peripheral_platform_device = NULL,
Ameya Thakurc9a7a842012-06-24 22:47:52 -07001396 .ramdump_timeout_ms = 600000,
Ameya Thakura98bde52012-06-28 18:55:19 -07001397 .no_powerdown_after_ramdumps = 1,
Ameya Thakur43248fd2012-07-10 18:50:52 -07001398 .image_upgrade_supported = 1,
Joel Kingb8352a12011-11-15 18:46:24 -08001399};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001400
Joel Nider266a2642011-10-16 10:58:05 +02001401#define MSM_TSIF0_PHYS (0x18200000)
1402#define MSM_TSIF1_PHYS (0x18201000)
1403#define MSM_TSIF_SIZE (0x200)
1404#define MSM_TSPP_PHYS (0x18202000)
1405#define MSM_TSPP_SIZE (0x1000)
1406#define MSM_TSPP_BAM_PHYS (0x18204000)
1407#define MSM_TSPP_BAM_SIZE (0x2000)
1408
1409#define TSIF_0_CLK GPIO_CFG(75, 1, GPIO_CFG_INPUT, \
1410 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1411#define TSIF_0_EN GPIO_CFG(76, 1, GPIO_CFG_INPUT, \
1412 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1413#define TSIF_0_DATA GPIO_CFG(77, 1, GPIO_CFG_INPUT, \
1414 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1415#define TSIF_0_SYNC GPIO_CFG(82, 1, GPIO_CFG_INPUT, \
1416 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1417#define TSIF_1_CLK GPIO_CFG(79, 1, GPIO_CFG_INPUT, \
1418 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1419#define TSIF_1_EN GPIO_CFG(80, 1, GPIO_CFG_INPUT, \
1420 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1421#define TSIF_1_DATA GPIO_CFG(81, 1, GPIO_CFG_INPUT, \
1422 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1423#define TSIF_1_SYNC GPIO_CFG(78, 1, GPIO_CFG_INPUT, \
1424 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1425
1426static const struct msm_gpio tsif_gpios[] = {
1427 { .gpio_cfg = TSIF_0_CLK, .label = "tsif0_clk", },
1428 { .gpio_cfg = TSIF_0_EN, .label = "tsif0_en", },
1429 { .gpio_cfg = TSIF_0_DATA, .label = "tsif0_data", },
1430 { .gpio_cfg = TSIF_0_SYNC, .label = "tsif0_sync", },
1431 { .gpio_cfg = TSIF_1_CLK, .label = "tsif1_clk", },
1432 { .gpio_cfg = TSIF_1_EN, .label = "tsif1_en", },
1433 { .gpio_cfg = TSIF_1_DATA, .label = "tsif1_data", },
1434 { .gpio_cfg = TSIF_1_SYNC, .label = "tsif1_sync", },
1435};
1436
1437static struct resource tspp_resources[] = {
1438 [0] = {
1439 .flags = IORESOURCE_IRQ,
1440 .start = TSIF_TSPP_IRQ,
1441 .end = TSIF1_IRQ,
1442 },
1443 [1] = {
1444 .flags = IORESOURCE_MEM,
1445 .start = MSM_TSIF0_PHYS,
1446 .end = MSM_TSIF0_PHYS + MSM_TSIF_SIZE - 1,
1447 },
1448 [2] = {
1449 .flags = IORESOURCE_MEM,
1450 .start = MSM_TSIF1_PHYS,
1451 .end = MSM_TSIF1_PHYS + MSM_TSIF_SIZE - 1,
1452 },
1453 [3] = {
1454 .flags = IORESOURCE_MEM,
1455 .start = MSM_TSPP_PHYS,
1456 .end = MSM_TSPP_PHYS + MSM_TSPP_SIZE - 1,
1457 },
1458 [4] = {
1459 .flags = IORESOURCE_MEM,
1460 .start = MSM_TSPP_BAM_PHYS,
1461 .end = MSM_TSPP_BAM_PHYS + MSM_TSPP_BAM_SIZE - 1,
1462 },
1463};
1464
1465static struct msm_tspp_platform_data tspp_platform_data = {
1466 .num_gpios = ARRAY_SIZE(tsif_gpios),
1467 .gpios = tsif_gpios,
1468 .tsif_pclk = "tsif_pclk",
1469 .tsif_ref_clk = "tsif_ref_clk",
1470};
1471
1472static struct platform_device msm_device_tspp = {
1473 .name = "msm_tspp",
1474 .id = 0,
1475 .num_resources = ARRAY_SIZE(tspp_resources),
1476 .resource = tspp_resources,
1477 .dev = {
1478 .platform_data = &tspp_platform_data
1479 },
1480};
1481
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001482#define MSM_SHARED_RAM_PHYS 0x80000000
1483
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001484static void __init msm8960_map_io(void)
1485{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001486 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001487 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001488
1489 if (socinfo_init() < 0)
1490 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001491}
1492
1493static void __init msm8960_init_irq(void)
1494{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001495 struct msm_mpm_device_data *data = NULL;
1496
1497#ifdef CONFIG_MSM_MPM
1498 data = &msm8960_mpm_dev_data;
1499#endif
1500
1501 msm_mpm_irq_extn_init(data);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001502 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001503 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001504}
1505
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001506static void __init msm8960_init_buses(void)
1507{
1508#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -06001509 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -06001510 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
1511 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
Gagan Macae154c4b2011-10-05 19:24:43 -06001512 msm_bus_apps_fabric.dev.platform_data =
1513 &msm_bus_8960_apps_fabric_pdata;
1514 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
Gagan Mac680bfc02012-07-19 19:11:00 -06001515 if (cpu_is_msm8960ab()) {
1516 msm_bus_8960_sg_mm_fabric_pdata.rpm_enabled = 1;
1517 msm_bus_mm_fabric.dev.platform_data =
1518 &msm_bus_8960_sg_mm_fabric_pdata;
1519 } else {
1520 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
1521 msm_bus_mm_fabric.dev.platform_data =
1522 &msm_bus_8960_mm_fabric_pdata;
1523 }
Gagan Macae154c4b2011-10-05 19:24:43 -06001524 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
1525 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001526#endif
1527}
1528
1529static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
1530 .max_clock_speed = 15060000,
Kiran Gunda2b285652012-07-30 13:22:39 +05301531 .infinite_mode = 0xFFC0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001532};
1533
1534#ifdef CONFIG_USB_MSM_OTG_72K
1535static struct msm_otg_platform_data msm_otg_pdata;
1536#else
Anji jonnalaa8b8d732011-12-06 10:03:24 +05301537static int wr_phy_init_seq[] = {
1538 0x44, 0x80, /* set VBUS valid threshold
1539 and disconnect valid threshold */
1540 0x38, 0x81, /* update DC voltage level */
1541 0x14, 0x82, /* set preemphasis and rise/fall time */
1542 0x13, 0x83, /* set source impedance adjusment */
1543 -1};
1544
1545static int liquid_v1_phy_init_seq[] = {
1546 0x44, 0x80,/* set VBUS valid threshold
1547 and disconnect valid threshold */
1548 0x3C, 0x81,/* update DC voltage level */
1549 0x18, 0x82,/* set preemphasis and rise/fall time */
1550 0x23, 0x83,/* set source impedance sdjusment */
1551 -1};
1552
Mayank Ranaa1f507b2012-08-14 10:57:00 +05301553static int sglte_phy_init_seq[] = {
1554 0x44, 0x80, /* set VBUS valid threshold
1555 and disconnect valid threshold */
1556 0x3A, 0x81, /* update DC voltage level */
1557 0x24, 0x82, /* set preemphasis and rise/fall time */
1558 0x13, 0x83, /* set source impedance adjusment */
1559 -1};
1560
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301561#ifdef CONFIG_MSM_BUS_SCALING
1562/* Bandwidth requests (zero) if no vote placed */
1563static struct msm_bus_vectors usb_init_vectors[] = {
1564 {
1565 .src = MSM_BUS_MASTER_SPS,
1566 .dst = MSM_BUS_SLAVE_EBI_CH0,
1567 .ab = 0,
1568 .ib = 0,
1569 },
1570};
1571
1572/* Bus bandwidth requests in Bytes/sec */
1573static struct msm_bus_vectors usb_max_vectors[] = {
1574 {
1575 .src = MSM_BUS_MASTER_SPS,
1576 .dst = MSM_BUS_SLAVE_EBI_CH0,
1577 .ab = 60000000, /* At least 480Mbps on bus. */
1578 .ib = 960000000, /* MAX bursts rate */
1579 },
1580};
1581
1582static struct msm_bus_paths usb_bus_scale_usecases[] = {
1583 {
1584 ARRAY_SIZE(usb_init_vectors),
1585 usb_init_vectors,
1586 },
1587 {
1588 ARRAY_SIZE(usb_max_vectors),
1589 usb_max_vectors,
1590 },
1591};
1592
1593static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
1594 usb_bus_scale_usecases,
1595 ARRAY_SIZE(usb_bus_scale_usecases),
1596 .name = "usb",
1597};
1598#endif
1599
Jack Pham87f202f2012-08-06 00:24:22 -07001600#define MSM_MPM_PIN_USB1_OTGSESSVLD 40
1601
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001602static struct msm_otg_platform_data msm_otg_pdata = {
1603 .mode = USB_OTG,
1604 .otg_control = OTG_PMIC_CONTROL,
1605 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001606 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
Anji jonnala4e3e6772011-09-15 18:53:42 +05301607 .power_budget = 750,
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301608#ifdef CONFIG_MSM_BUS_SCALING
1609 .bus_scale_table = &usb_bus_scale_pdata,
Jack Pham87f202f2012-08-06 00:24:22 -07001610 .mpm_otgsessvld_int = MSM_MPM_PIN_USB1_OTGSESSVLD,
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301611#endif
Pavankumar Kondeti2aec9f32012-06-13 09:06:03 +05301612#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
1613 .mhl_dev_name = "sii8334",
1614#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001615};
1616#endif
1617
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301618#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05301619#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301620static struct msm_hsic_host_platform_data msm_hsic_pdata = {
1621 .strobe = 150,
1622 .data = 151,
1623};
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301624
1625static struct smsc_hub_platform_data hsic_hub_pdata = {
1626 .hub_reset = HSIC_HUB_RESET_GPIO,
1627};
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301628#else
1629static struct msm_hsic_host_platform_data msm_hsic_pdata;
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301630static struct smsc_hub_platform_data hsic_hub_pdata;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301631#endif
1632
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301633static struct platform_device smsc_hub_device = {
1634 .name = "msm_smsc_hub",
1635 .id = -1,
1636 .dev = {
1637 .platform_data = &hsic_hub_pdata,
1638 },
1639};
1640
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001641#define PID_MAGIC_ID 0x71432909
1642#define SERIAL_NUM_MAGIC_ID 0x61945374
1643#define SERIAL_NUMBER_LENGTH 127
1644#define DLOAD_USB_BASE_ADD 0x2A03F0C8
1645
1646struct magic_num_struct {
1647 uint32_t pid;
1648 uint32_t serial_num;
1649};
1650
1651struct dload_struct {
1652 uint32_t reserved1;
1653 uint32_t reserved2;
1654 uint32_t reserved3;
1655 uint16_t reserved4;
1656 uint16_t pid;
1657 char serial_number[SERIAL_NUMBER_LENGTH];
1658 uint16_t reserved5;
1659 struct magic_num_struct magic_struct;
1660};
1661
1662static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
1663{
1664 struct dload_struct __iomem *dload = 0;
1665
1666 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
1667 if (!dload) {
1668 pr_err("%s: cannot remap I/O memory region: %08x\n",
1669 __func__, DLOAD_USB_BASE_ADD);
1670 return -ENXIO;
1671 }
1672
1673 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
1674 __func__, dload, pid, snum);
1675 /* update pid */
1676 dload->magic_struct.pid = PID_MAGIC_ID;
1677 dload->pid = pid;
1678
1679 /* update serial number */
1680 dload->magic_struct.serial_num = 0;
1681 if (!snum) {
1682 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
1683 goto out;
1684 }
1685
1686 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -07001687 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001688out:
1689 iounmap(dload);
1690 return 0;
1691}
1692
1693static struct android_usb_platform_data android_usb_pdata = {
1694 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1695};
1696
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001697static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001698 .name = "android_usb",
1699 .id = -1,
1700 .dev = {
1701 .platform_data = &android_usb_pdata,
1702 },
1703};
1704
1705static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1706 0x03, 0x0f,
1707};
1708
Anji Jonnala85b29ff2013-01-15 14:12:45 +05301709static uint8_t spm_retention_cmd_sequence[] __initdata = {
1710 0x00, 0x05, 0x03, 0x0D,
1711 0x0B, 0x00, 0x0f,
1712};
1713
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001714static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1715 0x00, 0x24, 0x54, 0x10,
1716 0x09, 0x03, 0x01,
1717 0x10, 0x54, 0x30, 0x0C,
1718 0x24, 0x30, 0x0f,
1719};
1720
1721static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1722 0x00, 0x24, 0x54, 0x10,
1723 0x09, 0x07, 0x01, 0x0B,
1724 0x10, 0x54, 0x30, 0x0C,
1725 0x24, 0x30, 0x0f,
1726};
1727
Anji Jonnala0f297a92013-01-19 11:22:25 +05301728/* 8960AB has a different command to assert apc_pdn */
1729static uint8_t spm_power_collapse_without_rpm_krait_v3[] __initdata = {
1730 0x00, 0x24, 0x84, 0x10,
1731 0x09, 0x03, 0x01,
1732 0x10, 0x84, 0x30, 0x0C,
1733 0x24, 0x30, 0x0f,
1734};
1735
1736static uint8_t spm_power_collapse_with_rpm_krait_v3[] __initdata = {
1737 0x00, 0x24, 0x84, 0x10,
1738 0x09, 0x07, 0x01, 0x0B,
1739 0x10, 0x84, 0x30, 0x0C,
1740 0x24, 0x30, 0x0f,
1741};
1742
Anji Jonnala85b29ff2013-01-15 14:12:45 +05301743static struct msm_spm_seq_entry msm_spm_boot_cpu_seq_list[] __initdata = {
1744 [0] = {
1745 .mode = MSM_SPM_MODE_CLOCK_GATING,
1746 .notify_rpm = false,
1747 .cmd = spm_wfi_cmd_sequence,
1748 },
1749
1750 [1] = {
1751 .mode = MSM_SPM_MODE_POWER_RETENTION,
1752 .notify_rpm = false,
1753 .cmd = spm_retention_cmd_sequence,
1754 },
1755
1756 [2] = {
1757 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1758 .notify_rpm = false,
1759 .cmd = spm_power_collapse_without_rpm,
1760 },
1761 [3] = {
1762 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1763 .notify_rpm = true,
1764 .cmd = spm_power_collapse_with_rpm,
1765 },
1766};
1767
1768static struct msm_spm_seq_entry msm_spm_nonboot_cpu_seq_list[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001769 [0] = {
1770 .mode = MSM_SPM_MODE_CLOCK_GATING,
1771 .notify_rpm = false,
1772 .cmd = spm_wfi_cmd_sequence,
1773 },
1774 [1] = {
1775 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1776 .notify_rpm = false,
1777 .cmd = spm_power_collapse_without_rpm,
1778 },
1779 [2] = {
1780 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1781 .notify_rpm = true,
1782 .cmd = spm_power_collapse_with_rpm,
1783 },
1784};
1785
1786static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1787 [0] = {
1788 .reg_base_addr = MSM_SAW0_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001789 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001790#if defined(CONFIG_MSM_AVS_HW)
Anji Jonnalafb119af2012-11-26 15:56:26 +05301791 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x58589464,
Praveen Chidambaramd3c5eaf2012-03-16 12:08:42 -06001792 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00020000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001793#endif
1794 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Anji Jonnala85b29ff2013-01-15 14:12:45 +05301795 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004,
1796 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C,
1797 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001798 .vctl_timeout_us = 50,
Anji Jonnala85b29ff2013-01-15 14:12:45 +05301799 .num_modes = ARRAY_SIZE(msm_spm_boot_cpu_seq_list),
1800 .modes = msm_spm_boot_cpu_seq_list,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001801 },
1802 [1] = {
1803 .reg_base_addr = MSM_SAW1_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001804 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001805#if defined(CONFIG_MSM_AVS_HW)
Anji Jonnalafb119af2012-11-26 15:56:26 +05301806 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x58589464,
Praveen Chidambaramd3c5eaf2012-03-16 12:08:42 -06001807 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00020000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001808#endif
1809 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001810 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001811 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1812 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1813 .vctl_timeout_us = 50,
Anji Jonnala85b29ff2013-01-15 14:12:45 +05301814 .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
1815 .modes = msm_spm_nonboot_cpu_seq_list,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001816 },
1817};
1818
1819static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1820 0x00, 0x20, 0x03, 0x20,
1821 0x00, 0x0f,
1822};
1823
1824static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1825 0x00, 0x20, 0x34, 0x64,
1826 0x48, 0x07, 0x48, 0x20,
1827 0x50, 0x64, 0x04, 0x34,
1828 0x50, 0x0f,
1829};
1830static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1831 0x00, 0x10, 0x34, 0x64,
1832 0x48, 0x07, 0x48, 0x10,
1833 0x50, 0x64, 0x04, 0x34,
1834 0x50, 0x0F,
1835};
1836
1837static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1838 [0] = {
1839 .mode = MSM_SPM_L2_MODE_RETENTION,
1840 .notify_rpm = false,
1841 .cmd = l2_spm_wfi_cmd_sequence,
1842 },
1843 [1] = {
1844 .mode = MSM_SPM_L2_MODE_GDHS,
1845 .notify_rpm = true,
1846 .cmd = l2_spm_gdhs_cmd_sequence,
1847 },
1848 [2] = {
1849 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1850 .notify_rpm = true,
1851 .cmd = l2_spm_power_off_cmd_sequence,
1852 },
1853};
1854
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001855static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1856 [0] = {
1857 .reg_base_addr = MSM_SAW_L2_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001858 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001859 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001860 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1861 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1862 .modes = msm_spm_l2_seq_list,
1863 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1864 },
1865};
1866
Anirudh Ghayal15698162012-07-31 11:51:32 +05301867#define HAP_SHIFT_LVL_OE_GPIO 47
1868#define HAP_SHIFT_LVL_OE_GPIO_SGLTE 89
Mohan Pallaka5e490392011-09-09 15:18:41 +05301869#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1870#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
1871
1872static struct msm_xo_voter *xo_handle_d1;
1873
1874static int isa1200_power(int on)
1875{
1876 int rc = 0;
Anirudh Ghayal15698162012-07-31 11:51:32 +05301877 int hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO;
Mohan Pallaka5e490392011-09-09 15:18:41 +05301878
Anirudh Ghayal15698162012-07-31 11:51:32 +05301879 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
1880 hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO_SGLTE;
1881
1882
1883 gpio_set_value(hap_oe_gpio, !!on);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301884
1885 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
1886 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
1887 if (rc < 0) {
1888 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
1889 __func__, on ? "" : "de-", rc);
1890 goto err_xo_vote;
1891 }
1892
1893 return 0;
1894
1895err_xo_vote:
Anirudh Ghayal15698162012-07-31 11:51:32 +05301896 gpio_set_value(hap_oe_gpio, !on);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301897 return rc;
1898}
1899
1900static int isa1200_dev_setup(bool enable)
1901{
1902 int rc = 0;
Anirudh Ghayal15698162012-07-31 11:51:32 +05301903 int hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO;
Mohan Pallaka5e490392011-09-09 15:18:41 +05301904
1905 struct pm_gpio hap_gpio_config = {
1906 .direction = PM_GPIO_DIR_OUT,
1907 .pull = PM_GPIO_PULL_NO,
1908 .out_strength = PM_GPIO_STRENGTH_HIGH,
1909 .function = PM_GPIO_FUNC_NORMAL,
1910 .inv_int_pol = 0,
1911 .vin_sel = 2,
1912 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1913 .output_value = 0,
1914 };
1915
Anirudh Ghayal15698162012-07-31 11:51:32 +05301916 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
1917 hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO_SGLTE;
1918
Mohan Pallaka5e490392011-09-09 15:18:41 +05301919 if (enable == true) {
1920 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
1921 if (rc) {
1922 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1923 __func__, PM_HAP_EN_GPIO, rc);
1924 return rc;
1925 }
1926
1927 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
1928 if (rc) {
1929 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1930 __func__, PM_HAP_LEN_GPIO, rc);
1931 return rc;
1932 }
1933
Anirudh Ghayal15698162012-07-31 11:51:32 +05301934 rc = gpio_request(hap_oe_gpio, "hap_shft_lvl_oe");
Mohan Pallaka5e490392011-09-09 15:18:41 +05301935 if (rc) {
1936 pr_err("%s: unable to request gpio %d (%d)\n",
Anirudh Ghayal15698162012-07-31 11:51:32 +05301937 __func__, hap_oe_gpio, rc);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301938 return rc;
1939 }
1940
Anirudh Ghayal15698162012-07-31 11:51:32 +05301941 rc = gpio_direction_output(hap_oe_gpio, 0);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301942 if (rc) {
1943 pr_err("%s: Unable to set direction\n", __func__);
1944 goto free_gpio;
1945 }
1946
1947 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
1948 if (IS_ERR(xo_handle_d1)) {
1949 rc = PTR_ERR(xo_handle_d1);
1950 pr_err("%s: failed to get the handle for D1(%d)\n",
1951 __func__, rc);
1952 goto gpio_set_dir;
1953 }
1954 } else {
Anirudh Ghayal15698162012-07-31 11:51:32 +05301955 gpio_free(hap_oe_gpio);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301956
1957 msm_xo_put(xo_handle_d1);
1958 }
1959
1960 return 0;
1961
1962gpio_set_dir:
Anirudh Ghayal15698162012-07-31 11:51:32 +05301963 gpio_set_value(hap_oe_gpio, 0);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301964free_gpio:
Anirudh Ghayal15698162012-07-31 11:51:32 +05301965 gpio_free(hap_oe_gpio);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301966 return rc;
1967}
1968
1969static struct isa1200_regulator isa1200_reg_data[] = {
1970 {
1971 .name = "vcc_i2c",
1972 .min_uV = ISA_I2C_VTG_MIN_UV,
1973 .max_uV = ISA_I2C_VTG_MAX_UV,
1974 .load_uA = ISA_I2C_CURR_UA,
1975 },
1976};
1977
1978static struct isa1200_platform_data isa1200_1_pdata = {
1979 .name = "vibrator",
1980 .dev_setup = isa1200_dev_setup,
1981 .power_on = isa1200_power,
1982 .hap_en_gpio = PM_HAP_EN_GPIO,
1983 .hap_len_gpio = PM_HAP_LEN_GPIO,
1984 .max_timeout = 15000,
1985 .mode_ctrl = PWM_GEN_MODE,
1986 .pwm_fd = {
1987 .pwm_div = 256,
1988 },
1989 .is_erm = false,
1990 .smart_en = true,
1991 .ext_clk_en = true,
1992 .chip_en = 1,
1993 .regulator_info = isa1200_reg_data,
1994 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1995};
1996
1997static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1998 {
1999 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
Mohan Pallaka5e490392011-09-09 15:18:41 +05302000 },
2001};
2002
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002003#define CYTTSP_TS_GPIO_IRQ 11
2004#define CYTTSP_TS_SLEEP_GPIO 50
2005#define CYTTSP_TS_RESOUT_N_GPIO 52
2006
2007/*virtual key support */
2008static ssize_t tma340_vkeys_show(struct kobject *kobj,
2009 struct kobj_attribute *attr, char *buf)
2010{
2011 return snprintf(buf, 200,
2012 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
2013 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
2014 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
2015 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
2016 "\n");
2017}
2018
2019static struct kobj_attribute tma340_vkeys_attr = {
2020 .attr = {
2021 .mode = S_IRUGO,
2022 },
2023 .show = &tma340_vkeys_show,
2024};
2025
2026static struct attribute *tma340_properties_attrs[] = {
2027 &tma340_vkeys_attr.attr,
2028 NULL
2029};
2030
2031static struct attribute_group tma340_properties_attr_group = {
2032 .attrs = tma340_properties_attrs,
2033};
2034
2035
2036static int cyttsp_platform_init(struct i2c_client *client)
2037{
2038 int rc = 0;
2039 static struct kobject *tma340_properties_kobj;
2040
2041 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
2042 tma340_properties_kobj = kobject_create_and_add("board_properties",
2043 NULL);
2044 if (tma340_properties_kobj)
2045 rc = sysfs_create_group(tma340_properties_kobj,
2046 &tma340_properties_attr_group);
2047 if (!tma340_properties_kobj || rc)
2048 pr_err("%s: failed to create board_properties\n",
2049 __func__);
2050
2051 return 0;
2052}
2053
2054static struct cyttsp_regulator regulator_data[] = {
2055 {
2056 .name = "vdd",
2057 .min_uV = CY_TMA300_VTG_MIN_UV,
2058 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05302059 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
2060 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002061 },
2062 /* TODO: Remove after runtime PM is enabled in I2C driver */
2063 {
2064 .name = "vcc_i2c",
2065 .min_uV = CY_I2C_VTG_MIN_UV,
2066 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05302067 .hpm_load_uA = CY_I2C_CURR_UA,
2068 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002069 },
2070};
2071
2072static struct cyttsp_platform_data cyttsp_pdata = {
2073 .panel_maxx = 634,
2074 .panel_maxy = 1166,
2075 .disp_maxx = 616,
2076 .disp_maxy = 1023,
2077 .disp_minx = 0,
2078 .disp_miny = 16,
2079 .flags = 0x01,
2080 .gen = CY_GEN3, /* or */
2081 .use_st = CY_USE_ST,
2082 .use_mt = CY_USE_MT,
2083 .use_hndshk = CY_SEND_HNDSHK,
2084 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05302085 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002086 .use_gestures = CY_USE_GESTURES,
2087 .fw_fname = "cyttsp_8960_cdp.hex",
2088 /* activate up to 4 groups
2089 * and set active distance
2090 */
2091 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
2092 CY_GEST_GRP3 | CY_GEST_GRP4 |
2093 CY_ACT_DIST,
Amy Maloche7b741b22012-06-14 14:37:22 -07002094 .act_intrvl = 10,
2095 .tch_tmout = 200,
2096 .lp_intrvl = 30,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002097 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
2098 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
2099 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
2100 .regulator_info = regulator_data,
2101 .num_regulators = ARRAY_SIZE(regulator_data),
2102 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05302103 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002104};
2105
2106static struct i2c_board_info cyttsp_info[] __initdata = {
2107 {
2108 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
2109 .platform_data = &cyttsp_pdata,
2110#ifndef CY_USE_TIMER
2111 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
2112#endif /* CY_USE_TIMER */
2113 },
2114};
2115
Jing Lindc4413c2012-01-16 15:22:52 -08002116/* configuration data for mxt1386 */
2117static const u8 mxt1386_config_data[] = {
Mohan Pallaka50837382011-09-07 11:00:57 +05302118 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002119 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302120 /* T38 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002121 11, 2, 0, 11, 11, 11, 0, 0, 0, 0,
Jing Lin2f863172011-10-17 10:56:58 -07002122 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2123 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2124 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2125 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2126 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2127 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302128 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002129 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05302130 /* T8 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002131 8, 0, 0, 0, 0, 0, 8, 14, 50, 215,
Mohan Pallaka50837382011-09-07 11:00:57 +05302132 /* T9 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002133 131, 0, 0, 26, 42, 0, 32, 63, 3, 5,
2134 0, 2, 1, 113, 10, 10, 8, 10, 255, 2,
2135 85, 5, 0, 0, 20, 20, 75, 25, 202, 29,
2136 10, 10, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05302137 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002138 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2139 0,
Anirudh Ghayaldab4e0d2012-01-09 14:59:27 +05302140 /* T18 Object */
2141 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302142 /* T22 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002143 5, 0, 0, 0, 0, 0, 0, 0, 30, 0,
2144 0, 0, 5, 8, 10, 13, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302145 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002146 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2147 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302148 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002149 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
2150 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302151 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002152 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302153 /* T28 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002154 0, 0, 0, 8, 12, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05302155 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002156 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302157 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002158 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302159 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002160 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302161};
2162
Jing Lin33b007d2011-12-21 17:40:23 -08002163/* configuration data for mxt1386e using V1.0 firmware */
2164static const u8 mxt1386e_config_data_v1_0[] = {
2165 /* T6 Object */
2166 0, 0, 0, 0, 0, 0,
2167 /* T38 Object */
2168 12, 1, 0, 17, 1, 12, 0, 0, 0, 0,
2169 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2170 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2171 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2172 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2173 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2174 0, 0, 0, 0,
2175 /* T7 Object */
2176 100, 16, 50,
2177 /* T8 Object */
2178 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
2179 /* T9 Object */
2180 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
2181 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
2182 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
2183 10, 5, 0, 0, 0,
2184 /* T18 Object */
2185 0, 0,
2186 /* T24 Object */
2187 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2188 0, 0, 0, 0, 0, 0, 0, 0, 0,
2189 /* T25 Object */
2190 3, 0, 60, 115, 156, 99,
2191 /* T27 Object */
2192 0, 0, 0, 0, 0, 0, 0,
2193 /* T40 Object */
2194 0, 0, 0, 0, 0,
2195 /* T42 Object */
2196 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
2197 /* T43 Object */
2198 0, 0, 0, 0, 0, 0, 0,
2199 /* T46 Object */
2200 64, 0, 20, 20, 0, 0, 0, 0, 0,
2201 /* T47 Object */
2202 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2203 /* T48 Object */
2204 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
2205 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
2206 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
2207 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
2208 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2209 0, 0, 0, 0,
2210 /* T56 Object */
2211 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2212 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2213 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2214 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2215 2, 99, 33,
2216};
2217
2218/* configuration data for mxt1386e using V2.1 firmware */
2219static const u8 mxt1386e_config_data_v2_1[] = {
2220 /* T6 Object */
2221 0, 0, 0, 0, 0, 0,
2222 /* T38 Object */
Jing Lina0bc4102012-07-06 17:03:45 -07002223 12, 4, 0, 5, 7, 12, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002224 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2225 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2226 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2227 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2228 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2229 0, 0, 0, 0,
2230 /* T7 Object */
2231 100, 16, 50,
2232 /* T8 Object */
2233 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
2234 /* T9 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002235 139, 0, 0, 26, 42, 0, 32, 80, 2, 5,
Jing Lina0bc4102012-07-06 17:03:45 -07002236 0, 5, 5, 79, 10, 30, 10, 10, 255, 2,
Jing Lin33b007d2011-12-21 17:40:23 -08002237 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
2238 10, 5, 0, 0, 0,
2239 /* T18 Object */
2240 0, 0,
2241 /* T24 Object */
2242 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2243 0, 0, 0, 0, 0, 0, 0, 0, 0,
2244 /* T25 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002245 1, 0, 60, 115, 156, 99,
Jing Lin33b007d2011-12-21 17:40:23 -08002246 /* T27 Object */
2247 0, 0, 0, 0, 0, 0, 0,
2248 /* T40 Object */
2249 0, 0, 0, 0, 0,
2250 /* T42 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002251 0, 0, 255, 0, 255, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002252 /* T43 Object */
2253 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
2254 16,
2255 /* T46 Object */
Jing Lina0bc4102012-07-06 17:03:45 -07002256 64, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002257 /* T47 Object */
2258 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2259 /* T48 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002260 1, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002261 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
2262 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
2263 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
2264 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2265 0, 0, 0, 0,
2266 /* T56 Object */
2267 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2268 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2269 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2270 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2271 2, 99, 33, 0, 149, 24, 193, 255, 255, 255,
2272 255,
2273};
2274
Jing Lineec88ca2012-02-08 11:18:30 -08002275/* configuration data for mxt1386e on 3D SKU using V2.1 firmware */
2276static const u8 mxt1386e_config_data_3d[] = {
2277 /* T6 Object */
2278 0, 0, 0, 0, 0, 0,
2279 /* T38 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002280 13, 1, 0, 23, 2, 12, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002281 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2282 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2283 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2284 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2285 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2286 0, 0, 0, 0,
2287 /* T7 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002288 100, 10, 50,
Jing Lineec88ca2012-02-08 11:18:30 -08002289 /* T8 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002290 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002291 /* T9 Object */
2292 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
2293 0, 5, 5, 0, 10, 30, 10, 10, 175, 4,
Jing Lin66ba78b2012-02-24 21:25:12 -08002294 127, 7, 26, 21, 17, 19, 143, 35, 207, 40,
2295 20, 5, 54, 49, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002296 /* T18 Object */
2297 0, 0,
2298 /* T24 Object */
2299 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2300 0, 0, 0, 0, 0, 0, 0, 0, 0,
2301 /* T25 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002302 0, 0, 72, 113, 168, 97,
Jing Lineec88ca2012-02-08 11:18:30 -08002303 /* T27 Object */
2304 0, 0, 0, 0, 0, 0, 0,
2305 /* T40 Object */
2306 0, 0, 0, 0, 0,
2307 /* T42 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002308 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002309 /* T43 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002310 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2311 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002312 /* T46 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002313 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002314 /* T47 Object */
2315 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2316 /* T48 Object */
2317 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08002318 32, 50, 0, 10, 10, 0, 0, 100, 10, 90,
2319 0, 0, 0, 0, 0, 0, 0, 10, 1, 30,
2320 52, 10, 5, 0, 33, 0, 1, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002321 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2322 0, 0, 0, 0,
2323 /* T56 Object */
2324 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2325 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2326 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2327 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08002328 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2329 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002330};
2331
Amy Maloche08266db2011-11-04 11:07:16 -07002332#define MXT_TS_GPIO_IRQ 11
2333#define MXT_TS_LDO_EN_GPIO 50
2334#define MXT_TS_RESET_GPIO 52
Mohan Pallaka50837382011-09-07 11:00:57 +05302335
2336static void mxt_init_hw_liquid(void)
2337{
2338 int rc;
2339
Mohan Pallaka50837382011-09-07 11:00:57 +05302340 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
2341 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07002342 pr_err("%s: unable to request mxt_ldo_en_gpio [%d]\n",
2343 __func__, MXT_TS_LDO_EN_GPIO);
2344 return;
Mohan Pallaka50837382011-09-07 11:00:57 +05302345 }
2346
2347 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
2348 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07002349 pr_err("%s: unable to set_direction for mxt_ldo_en_gpio [%d]\n",
2350 __func__, MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05302351 goto err_ldo_gpio_req;
2352 }
2353
Mohan Pallaka50837382011-09-07 11:00:57 +05302354 return;
2355
Mohan Pallaka50837382011-09-07 11:00:57 +05302356err_ldo_gpio_req:
2357 gpio_free(MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05302358}
2359
Jing Lineec88ca2012-02-08 11:18:30 -08002360static struct mxt_config_info mxt_config_array_2d[] = {
Jing Lindc4413c2012-01-16 15:22:52 -08002361 {
2362 .config = mxt1386_config_data,
2363 .config_length = ARRAY_SIZE(mxt1386_config_data),
2364 .family_id = 0xA0,
2365 .variant_id = 0x0,
2366 .version = 0x10,
2367 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002368 .bootldr_id = MXT_BOOTLOADER_ID_1386,
Jing Lindc4413c2012-01-16 15:22:52 -08002369 },
Jing Lin33b007d2011-12-21 17:40:23 -08002370 {
2371 .config = mxt1386e_config_data_v1_0,
2372 .config_length = ARRAY_SIZE(mxt1386e_config_data_v1_0),
2373 .family_id = 0xA0,
2374 .variant_id = 0x2,
2375 .version = 0x10,
2376 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002377 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Linaeaeed52012-03-26 14:57:15 -07002378 .fw_name = "atmel_8960_liquid_v2_2_AA.hex",
Jing Lin33b007d2011-12-21 17:40:23 -08002379 },
2380 {
2381 .config = mxt1386e_config_data_v2_1,
2382 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
2383 .family_id = 0xA0,
2384 .variant_id = 0x7,
2385 .version = 0x21,
2386 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002387 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Linaeaeed52012-03-26 14:57:15 -07002388 .fw_name = "atmel_8960_liquid_v2_2_AA.hex",
2389 },
2390 {
2391 /* The config data for V2.2.AA is the same as for V2.1.AA */
2392 .config = mxt1386e_config_data_v2_1,
2393 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
2394 .family_id = 0xA0,
2395 .variant_id = 0x7,
2396 .version = 0x22,
2397 .build = 0xAA,
2398 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin33b007d2011-12-21 17:40:23 -08002399 },
Jing Lindc4413c2012-01-16 15:22:52 -08002400};
2401
Jing Lineec88ca2012-02-08 11:18:30 -08002402static struct mxt_platform_data mxt_platform_data_2d = {
2403 .config_array = mxt_config_array_2d,
2404 .config_array_size = ARRAY_SIZE(mxt_config_array_2d),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002405 .panel_minx = 0,
2406 .panel_maxx = 1365,
2407 .panel_miny = 0,
2408 .panel_maxy = 767,
2409 .disp_minx = 0,
2410 .disp_maxx = 1365,
2411 .disp_miny = 0,
2412 .disp_maxy = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05302413 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07002414 .i2c_pull_up = true,
Amy Maloche08266db2011-11-04 11:07:16 -07002415 .reset_gpio = MXT_TS_RESET_GPIO,
2416 .irq_gpio = MXT_TS_GPIO_IRQ,
Mohan Pallaka50837382011-09-07 11:00:57 +05302417};
2418
Jing Lineec88ca2012-02-08 11:18:30 -08002419static struct mxt_config_info mxt_config_array_3d[] = {
2420 {
2421 .config = mxt1386e_config_data_3d,
2422 .config_length = ARRAY_SIZE(mxt1386e_config_data_3d),
2423 .family_id = 0xA0,
2424 .variant_id = 0x7,
2425 .version = 0x21,
2426 .build = 0xAA,
2427 },
2428};
2429
2430static struct mxt_platform_data mxt_platform_data_3d = {
2431 .config_array = mxt_config_array_3d,
2432 .config_array_size = ARRAY_SIZE(mxt_config_array_3d),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002433 .panel_minx = 0,
2434 .panel_maxx = 1919,
2435 .panel_miny = 0,
2436 .panel_maxy = 1199,
2437 .disp_minx = 0,
2438 .disp_maxx = 1919,
2439 .disp_miny = 0,
2440 .disp_maxy = 1199,
Jing Lineec88ca2012-02-08 11:18:30 -08002441 .irqflags = IRQF_TRIGGER_FALLING,
2442 .i2c_pull_up = true,
2443 .reset_gpio = MXT_TS_RESET_GPIO,
2444 .irq_gpio = MXT_TS_GPIO_IRQ,
2445};
2446
Mohan Pallaka50837382011-09-07 11:00:57 +05302447static struct i2c_board_info mxt_device_info[] __initdata = {
2448 {
2449 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
Mohan Pallaka50837382011-09-07 11:00:57 +05302450 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
2451 },
2452};
2453
Manoj Rao14648742012-03-30 19:42:12 -07002454static struct msm_mhl_platform_data mhl_platform_data = {
2455 .irq = MSM_GPIO_TO_INT(4),
Manoj Raoc6d904c2012-06-22 00:32:14 -07002456 .gpio_mhl_int = MHL_GPIO_INT,
2457 .gpio_mhl_reset = MHL_GPIO_RESET,
2458 .gpio_mhl_power = 0,
2459 .gpio_hdmi_mhl_mux = 0,
Manoj Rao14648742012-03-30 19:42:12 -07002460};
Manoj Rao14648742012-03-30 19:42:12 -07002461
Eugene Yasmand2316b82011-12-07 18:23:48 +02002462static struct i2c_board_info sii_device_info[] __initdata = {
2463 {
Manoj Rao14648742012-03-30 19:42:12 -07002464#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
2465 /*
2466 * keeps SI 8334 as the default
2467 * MHL TX
2468 */
2469 I2C_BOARD_INFO("sii8334", 0x39),
2470 .platform_data = &mhl_platform_data,
2471#endif
2472#ifdef CONFIG_FB_MSM_HDMI_MHL_9244
Eugene Yasmand2316b82011-12-07 18:23:48 +02002473 I2C_BOARD_INFO("Sil-9244", 0x39),
Eugene Yasmand2316b82011-12-07 18:23:48 +02002474 .irq = MSM_GPIO_TO_INT(15),
Manoj Rao14648742012-03-30 19:42:12 -07002475#endif /* CONFIG_MSM_HDMI_MHL */
2476 .flags = I2C_CLIENT_WAKE,
Eugene Yasmand2316b82011-12-07 18:23:48 +02002477 },
2478};
2479
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002480static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
2481 .clk_freq = 100000,
2482 .src_clk_rate = 24000000,
Kiran Gundab4696c72012-08-16 18:37:46 +05302483 .keep_ahb_clk_on = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002484};
2485
2486static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
2487 .clk_freq = 100000,
2488 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002489};
2490
2491static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
2492 .clk_freq = 100000,
2493 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002494};
2495
2496static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
2497 .clk_freq = 100000,
2498 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002499};
2500
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002501static struct ks8851_pdata spi_eth_pdata = {
2502 .irq_gpio = KS8851_IRQ_GPIO,
2503 .rst_gpio = KS8851_RST_GPIO,
2504};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06002505
Anirudh Ghayal50137fb2012-07-31 16:58:53 +05302506static struct spi_board_info spi_eth_info[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002507 {
2508 .modalias = "ks8851",
2509 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2510 .max_speed_hz = 19200000,
2511 .bus_num = 0,
2512 .chip_select = 0,
2513 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002514 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002515 },
Anirudh Ghayal50137fb2012-07-31 16:58:53 +05302516};
2517static struct spi_board_info spi_board_info[] __initdata = {
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07002518 {
2519 .modalias = "dsi_novatek_3d_panel_spi",
2520 .max_speed_hz = 10800000,
2521 .bus_num = 0,
2522 .chip_select = 1,
2523 .mode = SPI_MODE_0,
2524 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002525};
2526
2527static struct platform_device msm_device_saw_core0 = {
2528 .name = "saw-regulator",
2529 .id = 0,
2530 .dev = {
2531 .platform_data = &msm_saw_regulator_pdata_s5,
2532 },
2533};
2534
2535static struct platform_device msm_device_saw_core1 = {
2536 .name = "saw-regulator",
2537 .id = 1,
2538 .dev = {
2539 .platform_data = &msm_saw_regulator_pdata_s6,
2540 },
2541};
2542
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002543static struct tsens_platform_data msm_tsens_pdata = {
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002544 .slope = {910, 910, 910, 910, 910},
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002545 .tsens_factor = 1000,
2546 .hw_type = MSM_8960,
2547 .tsens_num_sensor = 5,
2548};
2549
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002550static struct platform_device msm_tsens_device = {
2551 .name = "tsens8960-tm",
2552 .id = -1,
2553};
2554
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002555static struct msm_thermal_data msm_thermal_pdata = {
2556 .sensor_id = 0,
Eugene Seah2ee4a5d2012-06-25 18:16:41 -06002557 .poll_ms = 250,
2558 .limit_temp_degC = 60,
2559 .temp_hysteresis_degC = 10,
2560 .freq_step = 2,
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002561};
2562
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002563#ifdef CONFIG_MSM_FAKE_BATTERY
2564static struct platform_device fish_battery_device = {
2565 .name = "fish_battery",
2566};
2567#endif
2568
David Collins26f05562011-06-20 09:56:28 -07002569static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002570 .name = GPIO_REGULATOR_DEV_NAME,
2571 .id = PM8921_MPP_PM_TO_SYS(7),
2572 .dev = {
2573 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2574 },
2575};
2576
David Collins26f05562011-06-20 09:56:28 -07002577static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002578 .name = GPIO_REGULATOR_DEV_NAME,
2579 .id = 91,
2580 .dev = {
2581 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2582 },
2583};
2584
David Collinsb10be1d2011-09-02 10:29:31 -07002585static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
2586 .name = GPIO_REGULATOR_DEV_NAME,
2587 .id = PM8921_GPIO_PM_TO_SYS(17),
2588 .dev = {
2589 .platform_data =
2590 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2591 },
2592};
2593
David Collins35a78f52011-12-14 15:54:25 -08002594static struct platform_device msm8960_device_ext_otg_sw_vreg __devinitdata = {
2595 .name = GPIO_REGULATOR_DEV_NAME,
2596 .id = PM8921_GPIO_PM_TO_SYS(42),
2597 .dev = {
2598 .platform_data =
2599 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_OTG_SW],
2600 },
2601};
2602
David Collins26f05562011-06-20 09:56:28 -07002603static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
2604 .name = "rpm-regulator",
2605 .id = -1,
2606 .dev = {
2607 .platform_data = &msm_rpm_regulator_pdata,
2608 },
2609};
Mayank Ranae009c922012-03-22 03:02:06 +05302610#ifdef CONFIG_SERIAL_MSM_HS
2611static int configure_uart_gpios(int on)
2612{
2613 int ret = 0, i;
2614 int uart_gpios[] = {93, 94, 95, 96};
2615
2616 for (i = 0; i < ARRAY_SIZE(uart_gpios); i++) {
2617 if (on) {
2618 ret = gpio_request(uart_gpios[i], NULL);
2619 if (ret) {
2620 pr_err("%s: unable to request uart gpio[%d]\n",
2621 __func__, uart_gpios[i]);
2622 break;
2623 }
2624 } else {
2625 gpio_free(uart_gpios[i]);
2626 }
2627 }
2628
2629 if (ret && on && i)
2630 for (; i >= 0; i--)
2631 gpio_free(uart_gpios[i]);
2632 return ret;
2633}
2634
2635static struct msm_serial_hs_platform_data msm_uart_dm9_pdata = {
Mayank Ranad85a5082012-04-29 17:24:13 -07002636 .gpio_config = configure_uart_gpios,
Mayank Ranae009c922012-03-22 03:02:06 +05302637};
Mayank Rana1f02d952012-07-04 19:11:20 +05302638
2639static int configure_gsbi8_uart_gpios(int on)
2640{
2641 int ret = 0, i;
2642 int uart_gpios[] = {34, 35, 36, 37};
2643
2644 for (i = 0; i < ARRAY_SIZE(uart_gpios); i++) {
2645 if (on) {
2646 ret = gpio_request(uart_gpios[i], NULL);
2647 if (ret) {
2648 pr_err("%s: unable to request uart gpio[%d]\n",
2649 __func__, uart_gpios[i]);
2650 break;
2651 }
2652 } else {
2653 gpio_free(uart_gpios[i]);
2654 }
2655 }
2656
2657 if (ret && on && i)
2658 for (; i >= 0; i--)
2659 gpio_free(uart_gpios[i]);
2660 return ret;
2661}
2662
2663static struct msm_serial_hs_platform_data msm_uart_dm8_pdata = {
2664 .gpio_config = configure_gsbi8_uart_gpios,
2665};
Mayank Ranae009c922012-03-22 03:02:06 +05302666#else
Mayank Rana1f02d952012-07-04 19:11:20 +05302667static struct msm_serial_hs_platform_data msm_uart_dm8_pdata;
Mayank Ranae009c922012-03-22 03:02:06 +05302668static struct msm_serial_hs_platform_data msm_uart_dm9_pdata;
2669#endif
David Collins26f05562011-06-20 09:56:28 -07002670
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302671#if defined(CONFIG_BT) && defined(CONFIG_BT_HCIUART_ATH3K)
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002672enum WLANBT_STATUS {
2673 WLANOFF_BTOFF = 1,
2674 WLANOFF_BTON,
2675 WLANON_BTOFF,
2676 WLANON_BTON
2677};
2678
2679static DEFINE_MUTEX(ath_wlanbt_mutex);
2680static int gpio_wlan_sys_rest_en = 26;
2681static int ath_wlanbt_status = WLANOFF_BTOFF;
2682
2683static int ath6kl_power_control(int on)
2684{
2685 int rc;
2686
2687 if (on) {
2688 rc = gpio_request(gpio_wlan_sys_rest_en, "wlan sys_rst_n");
2689 if (rc) {
2690 pr_err("%s: unable to request gpio %d (%d)\n",
2691 __func__, gpio_wlan_sys_rest_en, rc);
2692 return rc;
2693 }
2694 rc = gpio_direction_output(gpio_wlan_sys_rest_en, 0);
2695 msleep(200);
2696 rc = gpio_direction_output(gpio_wlan_sys_rest_en, 1);
2697 msleep(100);
2698 } else {
2699 gpio_set_value(gpio_wlan_sys_rest_en, 0);
2700 rc = gpio_direction_input(gpio_wlan_sys_rest_en);
2701 msleep(100);
2702 gpio_free(gpio_wlan_sys_rest_en);
2703 }
2704 return 0;
2705};
2706
2707static int ath6kl_wlan_power(int on)
2708{
2709 int ret = 0;
2710
2711 mutex_lock(&ath_wlanbt_mutex);
2712 if (on) {
2713 if (ath_wlanbt_status == WLANOFF_BTOFF) {
2714 ret = ath6kl_power_control(1);
2715 ath_wlanbt_status = WLANON_BTOFF;
2716 } else if (ath_wlanbt_status == WLANOFF_BTON)
2717 ath_wlanbt_status = WLANON_BTON;
2718 } else {
2719 if (ath_wlanbt_status == WLANON_BTOFF) {
2720 ret = ath6kl_power_control(0);
2721 ath_wlanbt_status = WLANOFF_BTOFF;
2722 } else if (ath_wlanbt_status == WLANON_BTON)
2723 ath_wlanbt_status = WLANOFF_BTON;
2724 }
2725 mutex_unlock(&ath_wlanbt_mutex);
2726 pr_debug("%s on= %d, wlan_status= %d\n",
2727 __func__, on, ath_wlanbt_status);
2728 return ret;
2729};
2730
2731static struct wifi_platform_data ath6kl_wifi_control = {
2732 .set_power = ath6kl_wlan_power,
2733};
2734
2735static struct platform_device msm_wlan_power_device = {
2736 .name = "ath6kl_power",
2737 .dev = {
2738 .platform_data = &ath6kl_wifi_control,
2739 },
2740};
2741
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302742static struct resource bluesleep_resources[] = {
2743 {
2744 .name = "gpio_host_wake",
2745 .start = 27,
2746 .end = 27,
2747 .flags = IORESOURCE_IO,
2748 },
2749 {
2750 .name = "gpio_ext_wake",
2751 .start = 29,
2752 .end = 29,
2753 .flags = IORESOURCE_IO,
2754 },
2755 {
2756 .name = "host_wake",
2757 .start = MSM_GPIO_TO_INT(27),
2758 .end = MSM_GPIO_TO_INT(27),
2759 .flags = IORESOURCE_IRQ,
2760 },
2761};
2762
2763static struct platform_device msm_bluesleep_device = {
2764 .name = "bluesleep",
2765 .id = -1,
2766 .num_resources = ARRAY_SIZE(bluesleep_resources),
2767 .resource = bluesleep_resources,
2768};
2769
2770static struct platform_device msm_bt_power_device = {
2771 .name = "bt_power",
2772};
2773
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002774static int gpio_bt_sys_rest_en = 28;
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302775
2776static int bluetooth_power(int on)
2777{
2778 int rc;
2779
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002780 mutex_lock(&ath_wlanbt_mutex);
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302781 if (on) {
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002782 if (ath_wlanbt_status == WLANOFF_BTOFF) {
2783 ath6kl_power_control(1);
2784 ath_wlanbt_status = WLANOFF_BTON;
2785 } else if (ath_wlanbt_status == WLANON_BTOFF)
2786 ath_wlanbt_status = WLANON_BTON;
2787
Ram Mohan Korukondab07c2632012-08-18 22:24:03 +05302788 rc = gpio_request(gpio_bt_sys_rest_en, "bt sys_rst_n");
2789 if (rc) {
2790 pr_err("%s: unable to request gpio %d (%d)\n",
2791 __func__, gpio_bt_sys_rest_en, rc);
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002792 mutex_unlock(&ath_wlanbt_mutex);
2793 return rc;
Ram Mohan Korukondab07c2632012-08-18 22:24:03 +05302794 }
2795 rc = gpio_direction_output(gpio_bt_sys_rest_en, 0);
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002796 msleep(20);
2797 rc = gpio_direction_output(gpio_bt_sys_rest_en, 1);
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302798 msleep(100);
2799 } else {
2800 gpio_set_value(gpio_bt_sys_rest_en, 0);
2801 rc = gpio_direction_input(gpio_bt_sys_rest_en);
2802 msleep(100);
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002803 gpio_free(gpio_bt_sys_rest_en);
Ram Mohan Korukondab07c2632012-08-18 22:24:03 +05302804
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002805 if (ath_wlanbt_status == WLANOFF_BTON) {
2806 ath6kl_power_control(0);
2807 ath_wlanbt_status = WLANOFF_BTOFF;
2808 } else if (ath_wlanbt_status == WLANON_BTON)
2809 ath_wlanbt_status = WLANON_BTOFF;
2810 }
2811 mutex_unlock(&ath_wlanbt_mutex);
2812 pr_debug("%s on= %d, wlan_status= %d\n",
2813 __func__, on, ath_wlanbt_status);
2814 return 0;
2815};
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302816
2817static void __init bt_power_init(void)
2818{
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302819 msm_bt_power_device.dev.platform_data = &bluetooth_power;
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302820 return;
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002821};
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302822#else
2823#define bt_power_init(x) do {} while (0)
2824#endif
2825
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002826static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07002827 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002828 &msm_device_smd,
Mayank Rana9f51f582011-08-04 18:35:59 +05302829 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002830 &msm_device_saw_core0,
2831 &msm_device_saw_core1,
2832 &msm8960_device_ext_5v_vreg,
David Collins87579612012-01-30 16:00:15 -08002833 &msm8960_device_ssbi_pmic,
David Collins96aa3e12012-02-29 10:31:34 -08002834 &msm8960_device_ext_otg_sw_vreg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002835 &msm8960_device_qup_spi_gsbi1,
2836 &msm8960_device_qup_i2c_gsbi3,
2837 &msm8960_device_qup_i2c_gsbi4,
2838 &msm8960_device_qup_i2c_gsbi10,
2839#ifndef CONFIG_MSM_DSPS
2840 &msm8960_device_qup_i2c_gsbi12,
2841#endif
2842 &msm_slim_ctrl,
2843 &msm_device_wcnss_wlan,
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302844#if defined(CONFIG_BT) && defined(CONFIG_BT_HCIUART_ATH3K)
2845 &msm_bluesleep_device,
2846 &msm_bt_power_device,
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002847 &msm_wlan_power_device,
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302848#endif
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002849#if defined(CONFIG_QSEECOM)
2850 &qseecom_device,
2851#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002852#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2853 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2854 &qcrypto_device,
2855#endif
2856
2857#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2858 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2859 &qcedev_device,
2860#endif
2861#ifdef CONFIG_MSM_ROTATOR
2862 &msm_rotator_device,
2863#endif
2864 &msm_device_sps,
2865#ifdef CONFIG_MSM_FAKE_BATTERY
2866 &fish_battery_device,
2867#endif
Laura Abbottb93525f2012-04-12 09:57:19 -07002868 &msm8960_fmem_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002869#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07002870#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002871 &msm8960_android_pmem_device,
2872 &msm8960_android_pmem_adsp_device,
2873 &msm8960_android_pmem_audio_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002874#endif
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -07002875#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002876 &msm_device_bam_dmux,
2877 &msm_fm_platform_init,
Joel Nidera1261942011-09-12 16:30:09 +03002878#if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE)
2879#ifdef CONFIG_MSM_USE_TSIF1
2880 &msm_device_tsif[1],
2881#else
2882 &msm_device_tsif[0],
2883#endif
2884#endif
Joel Nider266a2642011-10-16 10:58:05 +02002885 &msm_device_tspp,
Mona Hossain9c430e32011-07-27 11:04:47 -07002886#ifdef CONFIG_HW_RANDOM_MSM
2887 &msm_device_rng,
2888#endif
Laura Abbottd6183792011-08-19 13:42:24 -07002889#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002890 &msm8960_ion_dev,
Laura Abbottd6183792011-08-19 13:42:24 -07002891#endif
Praveen Chidambaram78499012011-11-01 17:15:17 -06002892 &msm8960_rpm_device,
2893 &msm8960_rpm_log_device,
2894 &msm8960_rpm_stat_device,
Anji Jonnala2a8bd312012-11-01 13:11:42 +05302895 &msm8960_rpm_master_stat_device,
Mona Hossain11c03ac2011-10-26 12:42:10 -07002896 &msm_device_tz_log,
Pratik Patel3b0ca882012-06-01 16:54:14 -07002897 &coresight_tpiu_device,
2898 &coresight_etb_device,
2899 &coresight_funnel_device,
2900 &coresight_etm0_device,
2901 &coresight_etm1_device,
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07002902 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002903 &msm8960_device_watchdog,
Laura Abbottb93525f2012-04-12 09:57:19 -07002904 &msm8960_rtb_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002905 &msm8960_device_cache_erp,
Stepan Moskovchenkoc0557252012-06-07 17:39:14 -07002906 &msm8960_device_ebi1_ch0_erp,
2907 &msm8960_device_ebi1_ch1_erp,
Laura Abbottb93525f2012-04-12 09:57:19 -07002908 &msm8960_cache_dump_device,
Laura Abbott0577d7b2012-04-17 11:14:30 -07002909 &msm8960_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002910 &msm_tsens_device,
Anji Jonnalae84292b2012-09-21 13:34:44 +05302911 &msm8960_pc_cntr,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002912};
2913
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002914static struct platform_device *cdp_devices[] __initdata = {
Stephen Boydeb819882011-08-29 14:46:30 -07002915 &msm_8960_q6_lpass,
Stephen Boyd322a9922011-09-20 01:05:54 -07002916 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07002917 &msm_pil_tzapps,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07002918 &msm_pil_dsps,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002919 &msm_pil_vidc,
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002920 &msm8960_device_otg,
2921 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002922 &msm_device_hsusb_host,
2923 &android_usb_device,
2924 &msm_pcm,
Kiran Kandi5e809b02012-01-31 00:24:33 -08002925 &msm_multi_ch_pcm,
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -07002926 &msm_lowlatency_pcm,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002927 &msm_pcm_routing,
2928 &msm_cpudai0,
2929 &msm_cpudai1,
Kiran Kandi97fe19d2012-05-20 22:34:04 -07002930 &msm8960_cpudai_slimbus_2_rx,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002931 &msm8960_cpudai_slimbus_2_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002932 &msm_cpudai_hdmi_rx,
2933 &msm_cpudai_bt_rx,
2934 &msm_cpudai_bt_tx,
2935 &msm_cpudai_fm_rx,
2936 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002937 &msm_cpudai_auxpcm_rx,
2938 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002939 &msm_cpu_fe,
2940 &msm_stub_codec,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002941#ifdef CONFIG_MSM_GEMINI
2942 &msm8960_gemini_device,
2943#endif
Kalyani Oruganti465d1e12012-05-15 10:23:05 -07002944#ifdef CONFIG_MSM_MERCURY
2945 &msm8960_mercury_device,
2946#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002947 &msm_voice,
2948 &msm_voip,
2949 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05302950 &msm_cpudai_afe_01_rx,
2951 &msm_cpudai_afe_01_tx,
2952 &msm_cpudai_afe_02_rx,
2953 &msm_cpudai_afe_02_tx,
2954 &msm_pcm_afe,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05302955 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07002956 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07002957 &msm_cpudai_incall_record_rx,
2958 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002959 &msm_pcm_hostless,
2960 &msm_bus_apps_fabric,
2961 &msm_bus_sys_fabric,
2962 &msm_bus_mm_fabric,
2963 &msm_bus_sys_fpb,
2964 &msm_bus_cpss_fpb,
2965};
2966
2967static void __init msm8960_i2c_init(void)
2968{
2969 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2970 &msm8960_i2c_qup_gsbi4_pdata;
2971
2972 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2973 &msm8960_i2c_qup_gsbi3_pdata;
2974
2975 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2976 &msm8960_i2c_qup_gsbi10_pdata;
2977
2978 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2979 &msm8960_i2c_qup_gsbi12_pdata;
2980}
2981
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002982static void __init msm8960_gfx_init(void)
2983{
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002984 struct kgsl_device_platform_data *kgsl_3d0_pdata =
2985 msm_kgsl_3d0.dev.platform_data;
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06002986 uint32_t soc_platform_version = socinfo_get_version();
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002987
Carter Cooper3852cbb2012-08-20 22:11:42 -06002988 /* Fixup data that needs to change based on GPU ID */
Carter Cooperffe7ea12012-08-22 13:27:58 -06002989 if (cpu_is_msm8960ab()) {
2990 kgsl_3d0_pdata->chipid = ADRENO_CHIPID(3, 2, 1, 0);
Suman Tatiraju20372242012-10-29 18:24:53 -07002991 /* 8960PRO nominal clock rate is 320Mhz */
2992 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 320000000;
Carter Cooper3852cbb2012-08-20 22:11:42 -06002993 } else {
2994 kgsl_3d0_pdata->iommu_count = 1;
2995 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
2996 kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
2997 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
2998 }
2999 if (SOCINFO_VERSION_MAJOR(soc_platform_version) >= 3) {
3000 /* 8960v3 GPU registers returns 5 for patch release
3001 * but it should be 6, so dummy up the chipid here
3002 * based the platform type
3003 */
3004 kgsl_3d0_pdata->chipid = ADRENO_CHIPID(2, 2, 0, 6);
3005 }
Jordan Crouse4815e9f2012-07-09 15:36:37 -06003006 }
Carter Cooper6307eb992012-08-20 15:17:23 -06003007
3008 /* Register the 3D core */
3009 platform_device_register(&msm_kgsl_3d0);
3010
3011 /* Register the 2D cores if we are not 8960PRO */
3012 if (!cpu_is_msm8960ab()) {
3013 platform_device_register(&msm_kgsl_2d0);
3014 platform_device_register(&msm_kgsl_2d1);
3015 }
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003016}
3017
Subhash Jadavani933e6a62011-12-26 18:05:04 +05303018static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003019 {
3020 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
3021 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
3022 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06003023 1, 784, 180000, 100,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003024 },
3025
3026 {
Anji Jonnala85b29ff2013-01-15 14:12:45 +05303027 MSM_PM_SLEEP_MODE_RETENTION,
3028 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
3029 true,
3030 415, 715, 340827, 475,
3031 },
3032
3033 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003034 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
3035 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
3036 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06003037 1300, 228, 1200000, 2000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003038 },
3039
3040 {
3041 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3042 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
3043 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06003044 2000, 138, 1208400, 3200,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003045 },
3046
3047 {
3048 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06003049 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
3050 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06003051 6000, 119, 1850300, 9000,
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06003052 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003053
3054 {
3055 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3056 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
3057 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06003058 9200, 68, 2839200, 16400,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003059 },
3060
3061 {
3062 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3063 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
3064 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06003065 10300, 63, 3128000, 18200,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003066 },
3067
3068 {
3069 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3070 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
3071 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06003072 18000, 10, 4602600, 27000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003073 },
3074
3075 {
3076 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3077 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
3078 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06003079 20000, 2, 5752000, 32000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003080 },
3081};
3082
Anji Jonnala85b29ff2013-01-15 14:12:45 +05303083
Praveen Chidambaram78499012011-11-01 17:15:17 -06003084static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
3085 .levels = &msm_rpmrs_levels[0],
3086 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
3087 .vdd_mem_levels = {
3088 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
3089 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
3090 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
3091 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
3092 },
3093 .vdd_dig_levels = {
3094 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
3095 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
3096 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
3097 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
3098 },
3099 .vdd_mask = 0x7FFFFF,
3100 .rpmrs_target_id = {
3101 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
3102 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
3103 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
3104 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
3105 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
3106 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
3107 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
3108 },
3109};
3110
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06003111static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
3112 .mode = MSM_PM_BOOT_CONFIG_TZ,
3113};
3114
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003115#ifdef CONFIG_I2C
3116#define I2C_SURF 1
3117#define I2C_FFA (1 << 1)
3118#define I2C_RUMI (1 << 2)
3119#define I2C_SIM (1 << 3)
3120#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03003121#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003122
3123struct i2c_registry {
3124 u8 machs;
3125 int bus;
3126 struct i2c_board_info *info;
3127 int len;
3128};
3129
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003130/* Sensors DSPS platform data */
3131#ifdef CONFIG_MSM_DSPS
3132#define DSPS_PIL_GENERIC_NAME "dsps"
3133#endif /* CONFIG_MSM_DSPS */
3134
3135static void __init msm8960_init_dsps(void)
3136{
3137#ifdef CONFIG_MSM_DSPS
3138 struct msm_dsps_platform_data *pdata =
3139 msm_dsps_device.dev.platform_data;
3140 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
3141 pdata->gpios = NULL;
3142 pdata->gpios_num = 0;
3143
3144 platform_device_register(&msm_dsps_device);
3145#endif /* CONFIG_MSM_DSPS */
3146}
3147
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -08003148static int hsic_peripheral_status = 1;
3149static DEFINE_MUTEX(hsic_status_lock);
3150
3151void peripheral_connect()
3152{
3153 mutex_lock(&hsic_status_lock);
3154 if (hsic_peripheral_status)
3155 goto out;
3156 platform_device_add(&msm_device_hsic_host);
3157 hsic_peripheral_status = 1;
3158out:
3159 mutex_unlock(&hsic_status_lock);
3160}
3161EXPORT_SYMBOL(peripheral_connect);
3162
3163void peripheral_disconnect()
3164{
3165 mutex_lock(&hsic_status_lock);
3166 if (!hsic_peripheral_status)
3167 goto out;
3168 platform_device_del(&msm_device_hsic_host);
3169 hsic_peripheral_status = 0;
3170out:
3171 mutex_unlock(&hsic_status_lock);
3172}
3173EXPORT_SYMBOL(peripheral_disconnect);
3174
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303175static void __init msm8960_init_smsc_hub(void)
3176{
3177 uint32_t version = socinfo_get_version();
3178
3179 if (SOCINFO_VERSION_MAJOR(version) == 1)
3180 return;
3181
3182 if (machine_is_msm8960_liquid())
3183 platform_device_register(&smsc_hub_device);
3184}
3185
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003186static void __init msm8960_init_hsic(void)
3187{
3188#ifdef CONFIG_USB_EHCI_MSM_HSIC
3189 uint32_t version = socinfo_get_version();
3190
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08003191 if (SOCINFO_VERSION_MAJOR(version) == 1)
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003192 return;
3193
Joel King0cbf5d82012-05-24 15:21:38 -07003194 if (machine_is_msm8960_liquid())
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08003195 platform_device_register(&msm_device_hsic_host);
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003196#endif
3197}
3198
Amir Samuelov5137e392011-09-21 17:31:25 +03003199#ifdef CONFIG_ISL9519_CHARGER
3200static struct isl_platform_data isl_data __initdata = {
3201 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
3202 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
3203 .max_system_voltage = 4200,
3204 .min_system_voltage = 3200,
Amir Samuelov95f49ff2012-01-29 09:14:08 +02003205 .chgcurrent = 1900,
3206 .term_current = 0,
Amir Samuelov5137e392011-09-21 17:31:25 +03003207 .input_current = 2048,
3208};
3209
3210static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
3211 {
3212 I2C_BOARD_INFO("isl9519q", 0x9),
3213 .irq = 0, /* Not required when notify-by-pmic */
3214 .platform_data = &isl_data,
3215 },
3216};
3217#endif /* CONFIG_ISL9519_CHARGER */
3218
Hanumant Singhbcd8ae72013-01-03 15:13:52 -08003219#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
Amir Samuelov755616d2011-12-13 16:34:46 +02003220static struct i2c_board_info liquid_io_expander_i2c_info[] __initdata = {
3221 {
3222 I2C_BOARD_INFO("sx1508q", 0x20),
3223 .platform_data = &msm8960_sx150x_data[SX150X_LIQUID]
3224 },
3225};
Hanumant Singhbcd8ae72013-01-03 15:13:52 -08003226#endif
Amir Samuelov755616d2011-12-13 16:34:46 +02003227
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003228static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Amir Samuelov5137e392011-09-21 17:31:25 +03003229#ifdef CONFIG_ISL9519_CHARGER
3230 {
3231 I2C_LIQUID,
3232 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
3233 isl_charger_i2c_info,
3234 ARRAY_SIZE(isl_charger_i2c_info),
3235 },
3236#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003237 {
3238 I2C_SURF | I2C_FFA | I2C_FLUID,
3239 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3240 cyttsp_info,
3241 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07003242 },
Mohan Pallaka50837382011-09-07 11:00:57 +05303243 {
3244 I2C_LIQUID,
3245 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3246 mxt_device_info,
3247 ARRAY_SIZE(mxt_device_info),
3248 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05303249 {
Manoj Rao14648742012-03-30 19:42:12 -07003250 I2C_SURF | I2C_FFA | I2C_LIQUID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05303251 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Eugene Yasmand2316b82011-12-07 18:23:48 +02003252 sii_device_info,
3253 ARRAY_SIZE(sii_device_info),
3254 },
3255 {
Anirudh Ghayal15698162012-07-31 11:51:32 +05303256 I2C_LIQUID | I2C_FFA,
Eugene Yasmand2316b82011-12-07 18:23:48 +02003257 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05303258 msm_isa1200_board_info,
3259 ARRAY_SIZE(msm_isa1200_board_info),
3260 },
Hanumant Singhbcd8ae72013-01-03 15:13:52 -08003261#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
Amir Samuelov755616d2011-12-13 16:34:46 +02003262 {
3263 I2C_LIQUID,
3264 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
3265 liquid_io_expander_i2c_info,
3266 ARRAY_SIZE(liquid_io_expander_i2c_info),
3267 },
Hanumant Singhbcd8ae72013-01-03 15:13:52 -08003268#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003269};
3270#endif /* CONFIG_I2C */
3271
3272static void __init register_i2c_devices(void)
3273{
3274#ifdef CONFIG_I2C
3275 u8 mach_mask = 0;
3276 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08003277#ifdef CONFIG_MSM_CAMERA
3278 struct i2c_registry msm8960_camera_i2c_devices = {
3279 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
3280 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
3281 msm8960_camera_board_info.board_info,
3282 msm8960_camera_board_info.num_i2c_board_info,
3283 };
3284#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003285
3286 /* Build the matching 'supported_machs' bitmask */
3287 if (machine_is_msm8960_cdp())
3288 mach_mask = I2C_SURF;
Amy Maloche2d028032011-07-20 14:08:06 -07003289 else if (machine_is_msm8960_fluid())
3290 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03003291 else if (machine_is_msm8960_liquid())
3292 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07003293 else if (machine_is_msm8960_mtp())
3294 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003295 else
3296 pr_err("unmatched machine ID in register_i2c_devices\n");
3297
Jing Lineec88ca2012-02-08 11:18:30 -08003298 if (machine_is_msm8960_liquid()) {
3299 if (SOCINFO_VERSION_MAJOR(socinfo_get_platform_version()) == 3)
3300 mxt_device_info[0].platform_data =
3301 &mxt_platform_data_3d;
3302 else
3303 mxt_device_info[0].platform_data =
3304 &mxt_platform_data_2d;
3305 }
3306
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003307 /* Run the array and install devices as appropriate */
3308 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
3309 if (msm8960_i2c_devices[i].machs & mach_mask)
3310 i2c_register_board_info(msm8960_i2c_devices[i].bus,
3311 msm8960_i2c_devices[i].info,
3312 msm8960_i2c_devices[i].len);
3313 }
Manoj Raoc6d904c2012-06-22 00:32:14 -07003314
3315 if (!mhl_platform_data.gpio_mhl_power)
3316 pr_debug("mhl device configured for ext debug board\n");
3317
Kevin Chan09f4e662011-12-16 08:17:02 -08003318#ifdef CONFIG_MSM_CAMERA
3319 if (msm8960_camera_i2c_devices.machs & mach_mask)
3320 i2c_register_board_info(msm8960_camera_i2c_devices.bus,
3321 msm8960_camera_i2c_devices.info,
3322 msm8960_camera_i2c_devices.len);
3323#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003324#endif
3325}
3326
Siddartha Mohanadoss9e1417c2012-09-26 09:42:32 -07003327static void __init msm8960_tsens_init(void)
3328{
3329 if (cpu_is_msm8960())
3330 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) == 1)
3331 return;
3332
3333 msm_tsens_early_init(&msm_tsens_pdata);
3334}
3335
Anji Jonnala0f297a92013-01-19 11:22:25 +05303336static void __init msm8960ab_update_krait_spm(void)
3337 {
3338 int i;
3339
Anji Jonnala0f297a92013-01-19 11:22:25 +05303340
3341 /* Update the SPM sequences for SPC and PC */
3342 for (i = 0; i < ARRAY_SIZE(msm_spm_data); i++) {
3343 int j;
3344 struct msm_spm_platform_data *pdata = &msm_spm_data[i];
3345 for (j = 0; j < pdata->num_modes; j++) {
3346 if (pdata->modes[j].cmd ==
3347 spm_power_collapse_without_rpm)
3348 pdata->modes[j].cmd =
3349 spm_power_collapse_without_rpm_krait_v3;
3350 else if (pdata->modes[j].cmd ==
3351 spm_power_collapse_with_rpm)
3352 pdata->modes[j].cmd =
3353 spm_power_collapse_with_rpm_krait_v3;
3354 }
3355 }
3356}
3357
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003358static void __init msm8960_cdp_init(void)
3359{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07003360 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
3361 pr_err("meminfo_init() failed!\n");
3362
Rohit Vaswanib1cc4932012-07-23 21:30:11 -07003363 platform_device_register(&msm_gpio_device);
Siddartha Mohanadoss9e1417c2012-09-26 09:42:32 -07003364 msm8960_tsens_init();
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06003365 msm_thermal_init(&msm_thermal_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06003366 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
3367 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07003368
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003369 regulator_suppress_info_printing();
3370 if (msm_xo_init())
3371 pr_err("Failed to initialize XO votes\n");
David Collins4c93ce92012-09-04 15:44:19 -07003372 configure_msm8960_power_grid();
David Collins26f05562011-06-20 09:56:28 -07003373 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07003374 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05303375 if (machine_is_msm8960_liquid())
3376 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003377 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05303378 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
3379 machine_is_msm8960_cdp()) {
Mayank Ranaa1f507b2012-08-14 10:57:00 +05303380 /* Due to availability of USB Switch in SGLTE Platform
3381 * it requires different HSUSB PHY settings compare to
3382 * 8960 MTP/CDP platform.
3383 */
3384 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
3385 msm_otg_pdata.phy_init_seq = sglte_phy_init_seq;
3386 else
3387 msm_otg_pdata.phy_init_seq = wr_phy_init_seq;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05303388 } else if (machine_is_msm8960_liquid()) {
3389 msm_otg_pdata.phy_init_seq =
3390 liquid_v1_phy_init_seq;
3391 }
Ofir Cohen94213a72012-05-03 14:26:32 +03003392 android_usb_pdata.swfi_latency =
Anji jonnalaa7c1c5c2011-12-12 12:20:36 +05303393 msm_rpmrs_levels[0].latency_us;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303394 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303395 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2 &&
3396 machine_is_msm8960_liquid())
3397 msm_device_hsic_host.dev.parent = &smsc_hub_device.dev;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08003398 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003399 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3400 &msm8960_qup_spi_gsbi1_pdata;
3401 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Anirudh Ghayal50137fb2012-07-31 16:58:53 +05303402 if (socinfo_get_platform_subtype() != PLATFORM_SUBTYPE_SGLTE)
3403 spi_register_board_info(spi_eth_info, ARRAY_SIZE(spi_eth_info));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003404
3405 msm8960_init_pmic();
Anirudh Ghayal15698162012-07-31 11:51:32 +05303406 if (machine_is_msm8960_liquid() || (machine_is_msm8960_mtp() &&
Shantanu Jain4ffd8122012-12-03 15:09:39 +05303407 (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE ||
3408 cpu_is_msm8960ab())))
Mohan Pallakaf69f0492011-11-21 13:08:33 +05303409 msm_isa1200_board_info[0].platform_data = &isa1200_1_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003410 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003411 msm8960_gfx_init();
Anji Jonnala0f297a92013-01-19 11:22:25 +05303412 if (cpu_is_msm8960ab())
3413 msm8960ab_update_krait_spm();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003414 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3415 msm_spm_l2_init(msm_spm_l2_data);
3416 msm8960_init_buses();
Stephen Boyd6716bd92012-10-25 11:46:04 -07003417 if (cpu_is_msm8960ab()) {
3418 platform_add_devices(msm8960ab_footswitch,
3419 msm8960ab_num_footswitch);
3420 } else {
3421 platform_add_devices(msm8960_footswitch,
3422 msm8960_num_footswitch);
3423 }
David Collinsb10be1d2011-09-02 10:29:31 -07003424 if (machine_is_msm8960_liquid())
3425 platform_device_register(&msm8960_device_ext_3p3v_vreg);
David Collinsd5a40732011-11-29 15:53:56 -08003426 if (machine_is_msm8960_cdp())
3427 platform_device_register(&msm8960_device_ext_l2_vreg);
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07003428
3429 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
3430 platform_device_register(&msm8960_device_uart_gsbi8);
3431 else
3432 platform_device_register(&msm8960_device_uart_gsbi5);
3433
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003434 /* For 8960 Fusion 2.2 Primary IPC */
Mayank Ranad85a5082012-04-29 17:24:13 -07003435 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE) {
3436 msm_uart_dm9_pdata.wakeup_irq = gpio_to_irq(94); /* GSBI9(2) */
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003437 msm_device_uart_dm9.dev.platform_data = &msm_uart_dm9_pdata;
Mayank Rana77f83c22012-07-10 09:31:02 +05303438 platform_device_register(&msm_device_uart_dm9);
Mayank Ranad85a5082012-04-29 17:24:13 -07003439 }
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003440
Mayank Rana1f02d952012-07-04 19:11:20 +05303441 /* For 8960 Standalone External Bluetooth Interface */
3442 if (socinfo_get_platform_subtype() != PLATFORM_SUBTYPE_SGLTE) {
3443 msm_device_uart_dm8.dev.platform_data = &msm_uart_dm8_pdata;
3444 platform_device_register(&msm_device_uart_dm8);
3445 }
Patrick Daly6578e0c2012-07-19 18:50:02 -07003446 if (cpu_is_msm8960ab())
3447 platform_device_register(&msm8960ab_device_acpuclk);
3448 else
3449 platform_device_register(&msm8960_device_acpuclk);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003450 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Arun Menond4837f62012-08-20 15:25:50 -07003451 msm8960_add_vidc_device();
Patrick Daly6578e0c2012-07-19 18:50:02 -07003452
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003453 msm8960_pm8921_gpio_mpp_init();
Stephen Boyd0ea1b762012-09-13 12:41:31 -07003454 /* Don't add modem devices on APQ targets */
3455 if (socinfo_get_id() != 124) {
3456 platform_device_register(&msm_8960_q6_mss_fw);
3457 platform_device_register(&msm_8960_q6_mss_sw);
3458 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003459 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303460 msm8960_init_smsc_hub();
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003461 msm8960_init_hsic();
Steve Mucklef132c6c2012-06-06 18:30:57 -07003462#ifdef CONFIG_MSM_CAMERA
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003463 msm8960_init_cam();
Steve Mucklef132c6c2012-06-06 18:30:57 -07003464#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003465 msm8960_init_mmc();
Mohan Pallaka50837382011-09-07 11:00:57 +05303466 if (machine_is_msm8960_liquid())
3467 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003468 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08003469 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003470 slim_register_board_info(msm_slim_devices,
3471 ARRAY_SIZE(msm_slim_devices));
3472 msm8960_init_dsps();
Larry Bassela7eadea2011-07-14 10:46:00 -07003473 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06003474 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05303475 bt_power_init();
Joel King0cbf5d82012-05-24 15:21:38 -07003476 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE) {
3477 mdm_sglte_device.dev.platform_data = &sglte_platform_data;
3478 platform_device_register(&mdm_sglte_device);
3479 }
Anji Jonnala85b29ff2013-01-15 14:12:45 +05303480 msm_pm_set_tz_retention_flag(1);
Laura Abbott5249a052012-12-11 15:09:03 -08003481 ion_adjust_secure_allocation();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003482}
3483
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003484MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
3485 .map_io = msm8960_map_io,
3486 .reserve = msm8960_reserve,
3487 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303488 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003489 .timer = &msm_timer,
3490 .init_machine = msm8960_cdp_init,
3491 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003492 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003493 .restart = msm_restart,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003494MACHINE_END
3495
3496MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
3497 .map_io = msm8960_map_io,
3498 .reserve = msm8960_reserve,
3499 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303500 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003501 .timer = &msm_timer,
3502 .init_machine = msm8960_cdp_init,
3503 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003504 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003505 .restart = msm_restart,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003506MACHINE_END
3507
3508MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
3509 .map_io = msm8960_map_io,
3510 .reserve = msm8960_reserve,
3511 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303512 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003513 .timer = &msm_timer,
3514 .init_machine = msm8960_cdp_init,
3515 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003516 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003517 .restart = msm_restart,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003518MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003519
3520MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
3521 .map_io = msm8960_map_io,
3522 .reserve = msm8960_reserve,
3523 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303524 .handle_irq = gic_handle_irq,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003525 .timer = &msm_timer,
3526 .init_machine = msm8960_cdp_init,
3527 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003528 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003529 .restart = msm_restart,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003530MACHINE_END