blob: f3b563015f3d430e0ba90b67aa48e8c6a7594263 [file] [log] [blame]
Abhijeet Dharmapurikar7e37e6e2012-08-23 18:58:44 -07001/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080012 */
13#include <linux/kernel.h>
14#include <linux/platform_device.h>
15#include <linux/io.h>
16#include <linux/irq.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070017#include <linux/i2c.h>
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -070018#include <linux/i2c/sx150x.h>
Amir Samuelov5137e392011-09-21 17:31:25 +030019#include <linux/i2c/isl9519.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070020#include <linux/gpio.h>
21#include <linux/msm_ssbi.h>
Steve Mucklef132c6c2012-06-06 18:30:57 -070022#include <linux/regulator/msm-gpio-regulator.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070023#include <linux/mfd/pm8xxx/pm8921.h>
Siddartha Mohanadossaf91d902011-10-20 10:23:34 -070024#include <linux/mfd/pm8xxx/pm8xxx-adc.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070025#include <linux/regulator/consumer.h>
26#include <linux/spi/spi.h>
27#include <linux/slimbus/slimbus.h>
28#include <linux/bootmem.h>
29#ifdef CONFIG_ANDROID_PMEM
30#include <linux/android_pmem.h>
31#endif
Steve Mucklef132c6c2012-06-06 18:30:57 -070032#include <linux/cyttsp-qc.h>
Laura Abbott354d40f2012-08-03 17:32:09 -070033#include <linux/dma-contiguous.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070034#include <linux/dma-mapping.h>
35#include <linux/platform_data/qcom_crypto_device.h>
Ankur Nandwanib0039b02011-08-09 14:00:45 -070036#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070037#include <linux/leds.h>
38#include <linux/leds-pm8xxx.h>
Mohan Pallaka50837382011-09-07 11:00:57 +053039#include <linux/i2c/atmel_mxt_ts.h>
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -070040#include <linux/msm_tsens.h>
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -070041#include <linux/ks8851.h>
Mohan Pallaka5e490392011-09-09 15:18:41 +053042#include <linux/i2c/isa1200.h>
Jack Cheung0b1987e2011-11-18 13:36:29 -080043#include <linux/memory.h>
Larry Bassel2d8b42d2012-03-12 10:41:26 -070044#include <linux/memblock.h>
Praveen Chidambaram877d7a42012-06-05 14:33:20 -060045#include <linux/msm_thermal.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080046
47#include <asm/mach-types.h>
48#include <asm/mach/arch.h>
Larry Basselb4126da2011-07-18 14:31:33 -070049#include <asm/setup.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080050#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070051#include <asm/mach/mmc.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080052
53#include <mach/board.h>
Joel Nider266a2642011-10-16 10:58:05 +020054#include <mach/msm_tspp.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080055#include <mach/msm_iomap.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070056#include <mach/msm_spi.h>
Mayank Ranae009c922012-03-22 03:02:06 +053057#include <mach/msm_serial_hs.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070058#ifdef CONFIG_USB_MSM_OTG_72K
59#include <mach/msm_hsusb.h>
60#else
61#include <linux/usb/msm_hsusb.h>
62#endif
63#include <linux/usb/android.h>
64#include <mach/usbdiag.h>
65#include <mach/socinfo.h>
66#include <mach/rpm.h>
Rohit Vaswania513aa8d2011-07-18 15:14:28 -070067#include <mach/gpiomux.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070068#include <mach/msm_bus_board.h>
69#include <mach/msm_memtypes.h>
70#include <mach/dma.h>
71#include <mach/msm_dsps.h>
72#include <mach/msm_xo.h>
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -070073#include <mach/restart.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080074
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070075#ifdef CONFIG_WCD9310_CODEC
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +053076#include <linux/mfd/wcd9xxx/core.h>
77#include <linux/mfd/wcd9xxx/pdata.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070078#endif
79
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +053080#include <linux/smsc3503.h>
Mitchel Humpherys9dc32cf2012-09-06 11:34:03 -070081#include <linux/msm_ion.h>
Laura Abbottd6183792011-08-19 13:42:24 -070082#include <mach/ion.h>
Joel Kingb8352a12011-11-15 18:46:24 -080083#include <mach/mdm2.h>
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -080084#include <mach/mdm-peripheral.h>
Laura Abbottf8c03b92012-02-16 14:57:58 -080085#include <mach/msm_rtb.h>
Laura Abbott306bcc22012-03-08 11:24:53 -080086#include <mach/msm_cache_dump.h>
87#include <mach/scm.h>
Olav Haugan8726caf2012-05-10 15:11:35 -070088#include <mach/iommu_domains.h>
Laura Abbottd6183792011-08-19 13:42:24 -070089
Jordan Crouse914de9b2012-07-09 13:49:46 -060090#include <mach/kgsl.h>
Larry Bassel41a055b2011-12-06 16:15:14 -080091#include <linux/fmem.h>
92
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070093#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080094#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070095#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070096#include "spm.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080097#include "board-8960.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080098#include "pm.h"
Abhijeet Dharmapurikarefaca4f2011-12-27 16:24:07 -080099#include <mach/cpuidle.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700100#include "rpm_resources.h"
Subhash Jadavani909e04f2012-04-12 10:52:50 +0530101#include <mach/mpm.h>
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 */
Olav Hauganb5be7992011-11-18 14:29:02 -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
1174static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1175 {
1176 ARRAY_SIZE(qseecom_clks_init_vectors),
1177 qseecom_clks_init_vectors,
1178 },
1179 {
1180 ARRAY_SIZE(qseecom_enable_dfab_vectors),
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001181 qseecom_enable_dfab_vectors,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001182 },
1183 {
1184 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1185 qseecom_enable_sfpb_vectors,
1186 },
1187};
1188
1189static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1190 qseecom_hw_bus_scale_usecases,
1191 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1192 .name = "qsee",
1193};
1194
1195static struct platform_device qseecom_device = {
1196 .name = "qseecom",
1197 .id = 0,
1198 .dev = {
1199 .platform_data = &qseecom_bus_pdata,
1200 },
1201};
1202#endif
1203
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001204#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1205 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1206 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1207 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1208
1209#define QCE_SIZE 0x10000
1210#define QCE_0_BASE 0x18500000
1211
1212#define QCE_HW_KEY_SUPPORT 0
1213#define QCE_SHA_HMAC_SUPPORT 1
1214#define QCE_SHARE_CE_RESOURCE 1
1215#define QCE_CE_SHARED 0
1216
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001217/* Begin Bus scaling definitions */
1218static struct msm_bus_vectors crypto_hw_init_vectors[] = {
1219 {
1220 .src = MSM_BUS_MASTER_ADM_PORT0,
1221 .dst = MSM_BUS_SLAVE_EBI_CH0,
1222 .ab = 0,
1223 .ib = 0,
1224 },
1225 {
1226 .src = MSM_BUS_MASTER_ADM_PORT1,
1227 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1228 .ab = 0,
1229 .ib = 0,
1230 },
1231};
1232
1233static struct msm_bus_vectors crypto_hw_active_vectors[] = {
1234 {
1235 .src = MSM_BUS_MASTER_ADM_PORT0,
1236 .dst = MSM_BUS_SLAVE_EBI_CH0,
1237 .ab = 70000000UL,
1238 .ib = 70000000UL,
1239 },
1240 {
1241 .src = MSM_BUS_MASTER_ADM_PORT1,
1242 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1243 .ab = 2480000000UL,
1244 .ib = 2480000000UL,
1245 },
1246};
1247
1248static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
1249 {
1250 ARRAY_SIZE(crypto_hw_init_vectors),
1251 crypto_hw_init_vectors,
1252 },
1253 {
1254 ARRAY_SIZE(crypto_hw_active_vectors),
1255 crypto_hw_active_vectors,
1256 },
1257};
1258
1259static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
1260 crypto_hw_bus_scale_usecases,
1261 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
1262 .name = "cryptohw",
1263};
1264/* End Bus Scaling Definitions*/
1265
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001266static struct resource qcrypto_resources[] = {
1267 [0] = {
1268 .start = QCE_0_BASE,
1269 .end = QCE_0_BASE + QCE_SIZE - 1,
1270 .flags = IORESOURCE_MEM,
1271 },
1272 [1] = {
1273 .name = "crypto_channels",
1274 .start = DMOV_CE_IN_CHAN,
1275 .end = DMOV_CE_OUT_CHAN,
1276 .flags = IORESOURCE_DMA,
1277 },
1278 [2] = {
1279 .name = "crypto_crci_in",
1280 .start = DMOV_CE_IN_CRCI,
1281 .end = DMOV_CE_IN_CRCI,
1282 .flags = IORESOURCE_DMA,
1283 },
1284 [3] = {
1285 .name = "crypto_crci_out",
1286 .start = DMOV_CE_OUT_CRCI,
1287 .end = DMOV_CE_OUT_CRCI,
1288 .flags = IORESOURCE_DMA,
1289 },
1290};
1291
1292static struct resource qcedev_resources[] = {
1293 [0] = {
1294 .start = QCE_0_BASE,
1295 .end = QCE_0_BASE + QCE_SIZE - 1,
1296 .flags = IORESOURCE_MEM,
1297 },
1298 [1] = {
1299 .name = "crypto_channels",
1300 .start = DMOV_CE_IN_CHAN,
1301 .end = DMOV_CE_OUT_CHAN,
1302 .flags = IORESOURCE_DMA,
1303 },
1304 [2] = {
1305 .name = "crypto_crci_in",
1306 .start = DMOV_CE_IN_CRCI,
1307 .end = DMOV_CE_IN_CRCI,
1308 .flags = IORESOURCE_DMA,
1309 },
1310 [3] = {
1311 .name = "crypto_crci_out",
1312 .start = DMOV_CE_OUT_CRCI,
1313 .end = DMOV_CE_OUT_CRCI,
1314 .flags = IORESOURCE_DMA,
1315 },
1316};
1317
1318#endif
1319
1320#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1321 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1322
1323static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1324 .ce_shared = QCE_CE_SHARED,
1325 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1326 .hw_key_support = QCE_HW_KEY_SUPPORT,
1327 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001328 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001329};
1330
1331static struct platform_device qcrypto_device = {
1332 .name = "qcrypto",
1333 .id = 0,
1334 .num_resources = ARRAY_SIZE(qcrypto_resources),
1335 .resource = qcrypto_resources,
1336 .dev = {
1337 .coherent_dma_mask = DMA_BIT_MASK(32),
1338 .platform_data = &qcrypto_ce_hw_suppport,
1339 },
1340};
1341#endif
1342
1343#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1344 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1345
1346static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1347 .ce_shared = QCE_CE_SHARED,
1348 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1349 .hw_key_support = QCE_HW_KEY_SUPPORT,
1350 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001351 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001352};
1353
1354static struct platform_device qcedev_device = {
1355 .name = "qce",
1356 .id = 0,
1357 .num_resources = ARRAY_SIZE(qcedev_resources),
1358 .resource = qcedev_resources,
1359 .dev = {
1360 .coherent_dma_mask = DMA_BIT_MASK(32),
1361 .platform_data = &qcedev_ce_hw_suppport,
1362 },
1363};
1364#endif
1365
Joel King0cbf5d82012-05-24 15:21:38 -07001366static struct mdm_platform_data sglte_platform_data = {
1367 .mdm_version = "4.0",
1368 .ramdump_delay_ms = 1000,
Joel King63ce8332012-06-01 09:59:26 -07001369 .soft_reset_inverted = 1,
Joel King0cbf5d82012-05-24 15:21:38 -07001370 .peripheral_platform_device = NULL,
Ameya Thakurc9a7a842012-06-24 22:47:52 -07001371 .ramdump_timeout_ms = 600000,
Ameya Thakura98bde52012-06-28 18:55:19 -07001372 .no_powerdown_after_ramdumps = 1,
Ameya Thakur43248fd2012-07-10 18:50:52 -07001373 .image_upgrade_supported = 1,
Joel Kingb8352a12011-11-15 18:46:24 -08001374};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001375
Joel Nider266a2642011-10-16 10:58:05 +02001376#define MSM_TSIF0_PHYS (0x18200000)
1377#define MSM_TSIF1_PHYS (0x18201000)
1378#define MSM_TSIF_SIZE (0x200)
1379#define MSM_TSPP_PHYS (0x18202000)
1380#define MSM_TSPP_SIZE (0x1000)
1381#define MSM_TSPP_BAM_PHYS (0x18204000)
1382#define MSM_TSPP_BAM_SIZE (0x2000)
1383
1384#define TSIF_0_CLK GPIO_CFG(75, 1, GPIO_CFG_INPUT, \
1385 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1386#define TSIF_0_EN GPIO_CFG(76, 1, GPIO_CFG_INPUT, \
1387 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1388#define TSIF_0_DATA GPIO_CFG(77, 1, GPIO_CFG_INPUT, \
1389 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1390#define TSIF_0_SYNC GPIO_CFG(82, 1, GPIO_CFG_INPUT, \
1391 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1392#define TSIF_1_CLK GPIO_CFG(79, 1, GPIO_CFG_INPUT, \
1393 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1394#define TSIF_1_EN GPIO_CFG(80, 1, GPIO_CFG_INPUT, \
1395 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1396#define TSIF_1_DATA GPIO_CFG(81, 1, GPIO_CFG_INPUT, \
1397 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1398#define TSIF_1_SYNC GPIO_CFG(78, 1, GPIO_CFG_INPUT, \
1399 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1400
1401static const struct msm_gpio tsif_gpios[] = {
1402 { .gpio_cfg = TSIF_0_CLK, .label = "tsif0_clk", },
1403 { .gpio_cfg = TSIF_0_EN, .label = "tsif0_en", },
1404 { .gpio_cfg = TSIF_0_DATA, .label = "tsif0_data", },
1405 { .gpio_cfg = TSIF_0_SYNC, .label = "tsif0_sync", },
1406 { .gpio_cfg = TSIF_1_CLK, .label = "tsif1_clk", },
1407 { .gpio_cfg = TSIF_1_EN, .label = "tsif1_en", },
1408 { .gpio_cfg = TSIF_1_DATA, .label = "tsif1_data", },
1409 { .gpio_cfg = TSIF_1_SYNC, .label = "tsif1_sync", },
1410};
1411
1412static struct resource tspp_resources[] = {
1413 [0] = {
1414 .flags = IORESOURCE_IRQ,
1415 .start = TSIF_TSPP_IRQ,
1416 .end = TSIF1_IRQ,
1417 },
1418 [1] = {
1419 .flags = IORESOURCE_MEM,
1420 .start = MSM_TSIF0_PHYS,
1421 .end = MSM_TSIF0_PHYS + MSM_TSIF_SIZE - 1,
1422 },
1423 [2] = {
1424 .flags = IORESOURCE_MEM,
1425 .start = MSM_TSIF1_PHYS,
1426 .end = MSM_TSIF1_PHYS + MSM_TSIF_SIZE - 1,
1427 },
1428 [3] = {
1429 .flags = IORESOURCE_MEM,
1430 .start = MSM_TSPP_PHYS,
1431 .end = MSM_TSPP_PHYS + MSM_TSPP_SIZE - 1,
1432 },
1433 [4] = {
1434 .flags = IORESOURCE_MEM,
1435 .start = MSM_TSPP_BAM_PHYS,
1436 .end = MSM_TSPP_BAM_PHYS + MSM_TSPP_BAM_SIZE - 1,
1437 },
1438};
1439
1440static struct msm_tspp_platform_data tspp_platform_data = {
1441 .num_gpios = ARRAY_SIZE(tsif_gpios),
1442 .gpios = tsif_gpios,
1443 .tsif_pclk = "tsif_pclk",
1444 .tsif_ref_clk = "tsif_ref_clk",
1445};
1446
1447static struct platform_device msm_device_tspp = {
1448 .name = "msm_tspp",
1449 .id = 0,
1450 .num_resources = ARRAY_SIZE(tspp_resources),
1451 .resource = tspp_resources,
1452 .dev = {
1453 .platform_data = &tspp_platform_data
1454 },
1455};
1456
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001457#define MSM_SHARED_RAM_PHYS 0x80000000
1458
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001459static void __init msm8960_map_io(void)
1460{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001461 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001462 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001463
1464 if (socinfo_init() < 0)
1465 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001466}
1467
1468static void __init msm8960_init_irq(void)
1469{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001470 struct msm_mpm_device_data *data = NULL;
1471
1472#ifdef CONFIG_MSM_MPM
1473 data = &msm8960_mpm_dev_data;
1474#endif
1475
1476 msm_mpm_irq_extn_init(data);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001477 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001478 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001479}
1480
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001481static void __init msm8960_init_buses(void)
1482{
1483#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -06001484 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -06001485 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
1486 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
Gagan Macae154c4b2011-10-05 19:24:43 -06001487 msm_bus_apps_fabric.dev.platform_data =
1488 &msm_bus_8960_apps_fabric_pdata;
1489 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
Gagan Mac680bfc02012-07-19 19:11:00 -06001490 if (cpu_is_msm8960ab()) {
1491 msm_bus_8960_sg_mm_fabric_pdata.rpm_enabled = 1;
1492 msm_bus_mm_fabric.dev.platform_data =
1493 &msm_bus_8960_sg_mm_fabric_pdata;
1494 } else {
1495 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
1496 msm_bus_mm_fabric.dev.platform_data =
1497 &msm_bus_8960_mm_fabric_pdata;
1498 }
Gagan Macae154c4b2011-10-05 19:24:43 -06001499 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
1500 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001501#endif
1502}
1503
1504static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
1505 .max_clock_speed = 15060000,
Kiran Gunda2b285652012-07-30 13:22:39 +05301506 .infinite_mode = 0xFFC0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001507};
1508
1509#ifdef CONFIG_USB_MSM_OTG_72K
1510static struct msm_otg_platform_data msm_otg_pdata;
1511#else
Anji jonnalaa8b8d732011-12-06 10:03:24 +05301512static int wr_phy_init_seq[] = {
1513 0x44, 0x80, /* set VBUS valid threshold
1514 and disconnect valid threshold */
1515 0x38, 0x81, /* update DC voltage level */
1516 0x14, 0x82, /* set preemphasis and rise/fall time */
1517 0x13, 0x83, /* set source impedance adjusment */
1518 -1};
1519
1520static int liquid_v1_phy_init_seq[] = {
1521 0x44, 0x80,/* set VBUS valid threshold
1522 and disconnect valid threshold */
1523 0x3C, 0x81,/* update DC voltage level */
1524 0x18, 0x82,/* set preemphasis and rise/fall time */
1525 0x23, 0x83,/* set source impedance sdjusment */
1526 -1};
1527
Mayank Ranaa1f507b2012-08-14 10:57:00 +05301528static int sglte_phy_init_seq[] = {
1529 0x44, 0x80, /* set VBUS valid threshold
1530 and disconnect valid threshold */
1531 0x3A, 0x81, /* update DC voltage level */
1532 0x24, 0x82, /* set preemphasis and rise/fall time */
1533 0x13, 0x83, /* set source impedance adjusment */
1534 -1};
1535
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301536#ifdef CONFIG_MSM_BUS_SCALING
1537/* Bandwidth requests (zero) if no vote placed */
1538static struct msm_bus_vectors usb_init_vectors[] = {
1539 {
1540 .src = MSM_BUS_MASTER_SPS,
1541 .dst = MSM_BUS_SLAVE_EBI_CH0,
1542 .ab = 0,
1543 .ib = 0,
1544 },
1545};
1546
1547/* Bus bandwidth requests in Bytes/sec */
1548static struct msm_bus_vectors usb_max_vectors[] = {
1549 {
1550 .src = MSM_BUS_MASTER_SPS,
1551 .dst = MSM_BUS_SLAVE_EBI_CH0,
1552 .ab = 60000000, /* At least 480Mbps on bus. */
1553 .ib = 960000000, /* MAX bursts rate */
1554 },
1555};
1556
1557static struct msm_bus_paths usb_bus_scale_usecases[] = {
1558 {
1559 ARRAY_SIZE(usb_init_vectors),
1560 usb_init_vectors,
1561 },
1562 {
1563 ARRAY_SIZE(usb_max_vectors),
1564 usb_max_vectors,
1565 },
1566};
1567
1568static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
1569 usb_bus_scale_usecases,
1570 ARRAY_SIZE(usb_bus_scale_usecases),
1571 .name = "usb",
1572};
1573#endif
1574
Jack Pham87f202f2012-08-06 00:24:22 -07001575#define MSM_MPM_PIN_USB1_OTGSESSVLD 40
1576
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001577static struct msm_otg_platform_data msm_otg_pdata = {
1578 .mode = USB_OTG,
1579 .otg_control = OTG_PMIC_CONTROL,
1580 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001581 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
Anji jonnala4e3e6772011-09-15 18:53:42 +05301582 .power_budget = 750,
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301583#ifdef CONFIG_MSM_BUS_SCALING
1584 .bus_scale_table = &usb_bus_scale_pdata,
Jack Pham87f202f2012-08-06 00:24:22 -07001585 .mpm_otgsessvld_int = MSM_MPM_PIN_USB1_OTGSESSVLD,
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301586#endif
Pavankumar Kondeti2aec9f32012-06-13 09:06:03 +05301587#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
1588 .mhl_dev_name = "sii8334",
1589#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001590};
1591#endif
1592
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301593#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05301594#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301595static struct msm_hsic_host_platform_data msm_hsic_pdata = {
1596 .strobe = 150,
1597 .data = 151,
1598};
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301599
1600static struct smsc_hub_platform_data hsic_hub_pdata = {
1601 .hub_reset = HSIC_HUB_RESET_GPIO,
1602};
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301603#else
1604static struct msm_hsic_host_platform_data msm_hsic_pdata;
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301605static struct smsc_hub_platform_data hsic_hub_pdata;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301606#endif
1607
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301608static struct platform_device smsc_hub_device = {
1609 .name = "msm_smsc_hub",
1610 .id = -1,
1611 .dev = {
1612 .platform_data = &hsic_hub_pdata,
1613 },
1614};
1615
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001616#define PID_MAGIC_ID 0x71432909
1617#define SERIAL_NUM_MAGIC_ID 0x61945374
1618#define SERIAL_NUMBER_LENGTH 127
1619#define DLOAD_USB_BASE_ADD 0x2A03F0C8
1620
1621struct magic_num_struct {
1622 uint32_t pid;
1623 uint32_t serial_num;
1624};
1625
1626struct dload_struct {
1627 uint32_t reserved1;
1628 uint32_t reserved2;
1629 uint32_t reserved3;
1630 uint16_t reserved4;
1631 uint16_t pid;
1632 char serial_number[SERIAL_NUMBER_LENGTH];
1633 uint16_t reserved5;
1634 struct magic_num_struct magic_struct;
1635};
1636
1637static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
1638{
1639 struct dload_struct __iomem *dload = 0;
1640
1641 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
1642 if (!dload) {
1643 pr_err("%s: cannot remap I/O memory region: %08x\n",
1644 __func__, DLOAD_USB_BASE_ADD);
1645 return -ENXIO;
1646 }
1647
1648 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
1649 __func__, dload, pid, snum);
1650 /* update pid */
1651 dload->magic_struct.pid = PID_MAGIC_ID;
1652 dload->pid = pid;
1653
1654 /* update serial number */
1655 dload->magic_struct.serial_num = 0;
1656 if (!snum) {
1657 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
1658 goto out;
1659 }
1660
1661 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -07001662 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001663out:
1664 iounmap(dload);
1665 return 0;
1666}
1667
1668static struct android_usb_platform_data android_usb_pdata = {
1669 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1670};
1671
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001672static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001673 .name = "android_usb",
1674 .id = -1,
1675 .dev = {
1676 .platform_data = &android_usb_pdata,
1677 },
1678};
1679
1680static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1681 0x03, 0x0f,
1682};
1683
Anji Jonnala85b29ff2013-01-15 14:12:45 +05301684static uint8_t spm_retention_cmd_sequence[] __initdata = {
1685 0x00, 0x05, 0x03, 0x0D,
1686 0x0B, 0x00, 0x0f,
1687};
1688
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001689static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1690 0x00, 0x24, 0x54, 0x10,
1691 0x09, 0x03, 0x01,
1692 0x10, 0x54, 0x30, 0x0C,
1693 0x24, 0x30, 0x0f,
1694};
1695
1696static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1697 0x00, 0x24, 0x54, 0x10,
1698 0x09, 0x07, 0x01, 0x0B,
1699 0x10, 0x54, 0x30, 0x0C,
1700 0x24, 0x30, 0x0f,
1701};
1702
Anji Jonnala85b29ff2013-01-15 14:12:45 +05301703static struct msm_spm_seq_entry msm_spm_boot_cpu_seq_list[] __initdata = {
1704 [0] = {
1705 .mode = MSM_SPM_MODE_CLOCK_GATING,
1706 .notify_rpm = false,
1707 .cmd = spm_wfi_cmd_sequence,
1708 },
1709
1710 [1] = {
1711 .mode = MSM_SPM_MODE_POWER_RETENTION,
1712 .notify_rpm = false,
1713 .cmd = spm_retention_cmd_sequence,
1714 },
1715
1716 [2] = {
1717 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1718 .notify_rpm = false,
1719 .cmd = spm_power_collapse_without_rpm,
1720 },
1721 [3] = {
1722 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1723 .notify_rpm = true,
1724 .cmd = spm_power_collapse_with_rpm,
1725 },
1726};
1727
1728static struct msm_spm_seq_entry msm_spm_nonboot_cpu_seq_list[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001729 [0] = {
1730 .mode = MSM_SPM_MODE_CLOCK_GATING,
1731 .notify_rpm = false,
1732 .cmd = spm_wfi_cmd_sequence,
1733 },
1734 [1] = {
1735 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1736 .notify_rpm = false,
1737 .cmd = spm_power_collapse_without_rpm,
1738 },
1739 [2] = {
1740 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1741 .notify_rpm = true,
1742 .cmd = spm_power_collapse_with_rpm,
1743 },
1744};
1745
1746static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1747 [0] = {
1748 .reg_base_addr = MSM_SAW0_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001749 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001750#if defined(CONFIG_MSM_AVS_HW)
1751 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1752 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1753#endif
1754 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Anji Jonnala85b29ff2013-01-15 14:12:45 +05301755 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004,
1756 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C,
1757 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001758 .vctl_timeout_us = 50,
Anji Jonnala85b29ff2013-01-15 14:12:45 +05301759 .num_modes = ARRAY_SIZE(msm_spm_boot_cpu_seq_list),
1760 .modes = msm_spm_boot_cpu_seq_list,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001761 },
1762 [1] = {
1763 .reg_base_addr = MSM_SAW1_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001764 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001765#if defined(CONFIG_MSM_AVS_HW)
1766 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1767 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1768#endif
1769 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001770 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001771 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1772 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1773 .vctl_timeout_us = 50,
Anji Jonnala85b29ff2013-01-15 14:12:45 +05301774 .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
1775 .modes = msm_spm_nonboot_cpu_seq_list,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001776 },
1777};
1778
1779static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1780 0x00, 0x20, 0x03, 0x20,
1781 0x00, 0x0f,
1782};
1783
1784static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1785 0x00, 0x20, 0x34, 0x64,
1786 0x48, 0x07, 0x48, 0x20,
1787 0x50, 0x64, 0x04, 0x34,
1788 0x50, 0x0f,
1789};
1790static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1791 0x00, 0x10, 0x34, 0x64,
1792 0x48, 0x07, 0x48, 0x10,
1793 0x50, 0x64, 0x04, 0x34,
1794 0x50, 0x0F,
1795};
1796
1797static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1798 [0] = {
1799 .mode = MSM_SPM_L2_MODE_RETENTION,
1800 .notify_rpm = false,
1801 .cmd = l2_spm_wfi_cmd_sequence,
1802 },
1803 [1] = {
1804 .mode = MSM_SPM_L2_MODE_GDHS,
1805 .notify_rpm = true,
1806 .cmd = l2_spm_gdhs_cmd_sequence,
1807 },
1808 [2] = {
1809 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1810 .notify_rpm = true,
1811 .cmd = l2_spm_power_off_cmd_sequence,
1812 },
1813};
1814
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001815static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1816 [0] = {
1817 .reg_base_addr = MSM_SAW_L2_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001818 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001819 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001820 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1821 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1822 .modes = msm_spm_l2_seq_list,
1823 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1824 },
1825};
1826
Anirudh Ghayal15698162012-07-31 11:51:32 +05301827#define HAP_SHIFT_LVL_OE_GPIO 47
1828#define HAP_SHIFT_LVL_OE_GPIO_SGLTE 89
Mohan Pallaka5e490392011-09-09 15:18:41 +05301829#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1830#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
1831
1832static struct msm_xo_voter *xo_handle_d1;
1833
1834static int isa1200_power(int on)
1835{
1836 int rc = 0;
Anirudh Ghayal15698162012-07-31 11:51:32 +05301837 int hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO;
Mohan Pallaka5e490392011-09-09 15:18:41 +05301838
Anirudh Ghayal15698162012-07-31 11:51:32 +05301839 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
1840 hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO_SGLTE;
1841
1842
1843 gpio_set_value(hap_oe_gpio, !!on);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301844
1845 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
1846 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
1847 if (rc < 0) {
1848 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
1849 __func__, on ? "" : "de-", rc);
1850 goto err_xo_vote;
1851 }
1852
1853 return 0;
1854
1855err_xo_vote:
Anirudh Ghayal15698162012-07-31 11:51:32 +05301856 gpio_set_value(hap_oe_gpio, !on);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301857 return rc;
1858}
1859
1860static int isa1200_dev_setup(bool enable)
1861{
1862 int rc = 0;
Anirudh Ghayal15698162012-07-31 11:51:32 +05301863 int hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO;
Mohan Pallaka5e490392011-09-09 15:18:41 +05301864
1865 struct pm_gpio hap_gpio_config = {
1866 .direction = PM_GPIO_DIR_OUT,
1867 .pull = PM_GPIO_PULL_NO,
1868 .out_strength = PM_GPIO_STRENGTH_HIGH,
1869 .function = PM_GPIO_FUNC_NORMAL,
1870 .inv_int_pol = 0,
1871 .vin_sel = 2,
1872 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1873 .output_value = 0,
1874 };
1875
Anirudh Ghayal15698162012-07-31 11:51:32 +05301876 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
1877 hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO_SGLTE;
1878
Mohan Pallaka5e490392011-09-09 15:18:41 +05301879 if (enable == true) {
1880 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
1881 if (rc) {
1882 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1883 __func__, PM_HAP_EN_GPIO, rc);
1884 return rc;
1885 }
1886
1887 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
1888 if (rc) {
1889 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1890 __func__, PM_HAP_LEN_GPIO, rc);
1891 return rc;
1892 }
1893
Anirudh Ghayal15698162012-07-31 11:51:32 +05301894 rc = gpio_request(hap_oe_gpio, "hap_shft_lvl_oe");
Mohan Pallaka5e490392011-09-09 15:18:41 +05301895 if (rc) {
1896 pr_err("%s: unable to request gpio %d (%d)\n",
Anirudh Ghayal15698162012-07-31 11:51:32 +05301897 __func__, hap_oe_gpio, rc);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301898 return rc;
1899 }
1900
Anirudh Ghayal15698162012-07-31 11:51:32 +05301901 rc = gpio_direction_output(hap_oe_gpio, 0);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301902 if (rc) {
1903 pr_err("%s: Unable to set direction\n", __func__);
1904 goto free_gpio;
1905 }
1906
1907 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
1908 if (IS_ERR(xo_handle_d1)) {
1909 rc = PTR_ERR(xo_handle_d1);
1910 pr_err("%s: failed to get the handle for D1(%d)\n",
1911 __func__, rc);
1912 goto gpio_set_dir;
1913 }
1914 } else {
Anirudh Ghayal15698162012-07-31 11:51:32 +05301915 gpio_free(hap_oe_gpio);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301916
1917 msm_xo_put(xo_handle_d1);
1918 }
1919
1920 return 0;
1921
1922gpio_set_dir:
Anirudh Ghayal15698162012-07-31 11:51:32 +05301923 gpio_set_value(hap_oe_gpio, 0);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301924free_gpio:
Anirudh Ghayal15698162012-07-31 11:51:32 +05301925 gpio_free(hap_oe_gpio);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301926 return rc;
1927}
1928
1929static struct isa1200_regulator isa1200_reg_data[] = {
1930 {
1931 .name = "vcc_i2c",
1932 .min_uV = ISA_I2C_VTG_MIN_UV,
1933 .max_uV = ISA_I2C_VTG_MAX_UV,
1934 .load_uA = ISA_I2C_CURR_UA,
1935 },
1936};
1937
1938static struct isa1200_platform_data isa1200_1_pdata = {
1939 .name = "vibrator",
1940 .dev_setup = isa1200_dev_setup,
1941 .power_on = isa1200_power,
1942 .hap_en_gpio = PM_HAP_EN_GPIO,
1943 .hap_len_gpio = PM_HAP_LEN_GPIO,
1944 .max_timeout = 15000,
1945 .mode_ctrl = PWM_GEN_MODE,
1946 .pwm_fd = {
1947 .pwm_div = 256,
1948 },
1949 .is_erm = false,
1950 .smart_en = true,
1951 .ext_clk_en = true,
1952 .chip_en = 1,
1953 .regulator_info = isa1200_reg_data,
1954 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1955};
1956
1957static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1958 {
1959 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
Mohan Pallaka5e490392011-09-09 15:18:41 +05301960 },
1961};
1962
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001963#define CYTTSP_TS_GPIO_IRQ 11
1964#define CYTTSP_TS_SLEEP_GPIO 50
1965#define CYTTSP_TS_RESOUT_N_GPIO 52
1966
1967/*virtual key support */
1968static ssize_t tma340_vkeys_show(struct kobject *kobj,
1969 struct kobj_attribute *attr, char *buf)
1970{
1971 return snprintf(buf, 200,
1972 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1973 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1974 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1975 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1976 "\n");
1977}
1978
1979static struct kobj_attribute tma340_vkeys_attr = {
1980 .attr = {
1981 .mode = S_IRUGO,
1982 },
1983 .show = &tma340_vkeys_show,
1984};
1985
1986static struct attribute *tma340_properties_attrs[] = {
1987 &tma340_vkeys_attr.attr,
1988 NULL
1989};
1990
1991static struct attribute_group tma340_properties_attr_group = {
1992 .attrs = tma340_properties_attrs,
1993};
1994
1995
1996static int cyttsp_platform_init(struct i2c_client *client)
1997{
1998 int rc = 0;
1999 static struct kobject *tma340_properties_kobj;
2000
2001 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
2002 tma340_properties_kobj = kobject_create_and_add("board_properties",
2003 NULL);
2004 if (tma340_properties_kobj)
2005 rc = sysfs_create_group(tma340_properties_kobj,
2006 &tma340_properties_attr_group);
2007 if (!tma340_properties_kobj || rc)
2008 pr_err("%s: failed to create board_properties\n",
2009 __func__);
2010
2011 return 0;
2012}
2013
2014static struct cyttsp_regulator regulator_data[] = {
2015 {
2016 .name = "vdd",
2017 .min_uV = CY_TMA300_VTG_MIN_UV,
2018 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05302019 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
2020 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002021 },
2022 /* TODO: Remove after runtime PM is enabled in I2C driver */
2023 {
2024 .name = "vcc_i2c",
2025 .min_uV = CY_I2C_VTG_MIN_UV,
2026 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05302027 .hpm_load_uA = CY_I2C_CURR_UA,
2028 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002029 },
2030};
2031
2032static struct cyttsp_platform_data cyttsp_pdata = {
2033 .panel_maxx = 634,
2034 .panel_maxy = 1166,
2035 .disp_maxx = 616,
2036 .disp_maxy = 1023,
2037 .disp_minx = 0,
2038 .disp_miny = 16,
2039 .flags = 0x01,
2040 .gen = CY_GEN3, /* or */
2041 .use_st = CY_USE_ST,
2042 .use_mt = CY_USE_MT,
2043 .use_hndshk = CY_SEND_HNDSHK,
2044 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05302045 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002046 .use_gestures = CY_USE_GESTURES,
2047 .fw_fname = "cyttsp_8960_cdp.hex",
2048 /* activate up to 4 groups
2049 * and set active distance
2050 */
2051 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
2052 CY_GEST_GRP3 | CY_GEST_GRP4 |
2053 CY_ACT_DIST,
Amy Maloche7b741b22012-06-14 14:37:22 -07002054 .act_intrvl = 10,
2055 .tch_tmout = 200,
2056 .lp_intrvl = 30,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002057 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
2058 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
2059 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
2060 .regulator_info = regulator_data,
2061 .num_regulators = ARRAY_SIZE(regulator_data),
2062 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05302063 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002064};
2065
2066static struct i2c_board_info cyttsp_info[] __initdata = {
2067 {
2068 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
2069 .platform_data = &cyttsp_pdata,
2070#ifndef CY_USE_TIMER
2071 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
2072#endif /* CY_USE_TIMER */
2073 },
2074};
2075
Jing Lindc4413c2012-01-16 15:22:52 -08002076/* configuration data for mxt1386 */
2077static const u8 mxt1386_config_data[] = {
Mohan Pallaka50837382011-09-07 11:00:57 +05302078 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002079 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302080 /* T38 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002081 11, 2, 0, 11, 11, 11, 0, 0, 0, 0,
Jing Lin2f863172011-10-17 10:56:58 -07002082 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2083 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2084 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2085 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2086 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2087 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302088 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002089 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05302090 /* T8 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002091 8, 0, 0, 0, 0, 0, 8, 14, 50, 215,
Mohan Pallaka50837382011-09-07 11:00:57 +05302092 /* T9 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002093 131, 0, 0, 26, 42, 0, 32, 63, 3, 5,
2094 0, 2, 1, 113, 10, 10, 8, 10, 255, 2,
2095 85, 5, 0, 0, 20, 20, 75, 25, 202, 29,
2096 10, 10, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05302097 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002098 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2099 0,
Anirudh Ghayaldab4e0d2012-01-09 14:59:27 +05302100 /* T18 Object */
2101 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302102 /* T22 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002103 5, 0, 0, 0, 0, 0, 0, 0, 30, 0,
2104 0, 0, 5, 8, 10, 13, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302105 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002106 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2107 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302108 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002109 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
2110 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302111 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002112 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302113 /* T28 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002114 0, 0, 0, 8, 12, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05302115 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002116 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302117 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002118 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302119 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002120 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302121};
2122
Jing Lin33b007d2011-12-21 17:40:23 -08002123/* configuration data for mxt1386e using V1.0 firmware */
2124static const u8 mxt1386e_config_data_v1_0[] = {
2125 /* T6 Object */
2126 0, 0, 0, 0, 0, 0,
2127 /* T38 Object */
2128 12, 1, 0, 17, 1, 12, 0, 0, 0, 0,
2129 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2130 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2131 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2132 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2133 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2134 0, 0, 0, 0,
2135 /* T7 Object */
2136 100, 16, 50,
2137 /* T8 Object */
2138 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
2139 /* T9 Object */
2140 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
2141 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
2142 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
2143 10, 5, 0, 0, 0,
2144 /* T18 Object */
2145 0, 0,
2146 /* T24 Object */
2147 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2148 0, 0, 0, 0, 0, 0, 0, 0, 0,
2149 /* T25 Object */
2150 3, 0, 60, 115, 156, 99,
2151 /* T27 Object */
2152 0, 0, 0, 0, 0, 0, 0,
2153 /* T40 Object */
2154 0, 0, 0, 0, 0,
2155 /* T42 Object */
2156 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
2157 /* T43 Object */
2158 0, 0, 0, 0, 0, 0, 0,
2159 /* T46 Object */
2160 64, 0, 20, 20, 0, 0, 0, 0, 0,
2161 /* T47 Object */
2162 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2163 /* T48 Object */
2164 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
2165 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
2166 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
2167 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
2168 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2169 0, 0, 0, 0,
2170 /* T56 Object */
2171 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2172 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2173 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2174 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2175 2, 99, 33,
2176};
2177
2178/* configuration data for mxt1386e using V2.1 firmware */
2179static const u8 mxt1386e_config_data_v2_1[] = {
2180 /* T6 Object */
2181 0, 0, 0, 0, 0, 0,
2182 /* T38 Object */
Jing Lina0bc4102012-07-06 17:03:45 -07002183 12, 4, 0, 5, 7, 12, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002184 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2185 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2186 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2187 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2188 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2189 0, 0, 0, 0,
2190 /* T7 Object */
2191 100, 16, 50,
2192 /* T8 Object */
2193 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
2194 /* T9 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002195 139, 0, 0, 26, 42, 0, 32, 80, 2, 5,
Jing Lina0bc4102012-07-06 17:03:45 -07002196 0, 5, 5, 79, 10, 30, 10, 10, 255, 2,
Jing Lin33b007d2011-12-21 17:40:23 -08002197 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
2198 10, 5, 0, 0, 0,
2199 /* T18 Object */
2200 0, 0,
2201 /* T24 Object */
2202 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2203 0, 0, 0, 0, 0, 0, 0, 0, 0,
2204 /* T25 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002205 1, 0, 60, 115, 156, 99,
Jing Lin33b007d2011-12-21 17:40:23 -08002206 /* T27 Object */
2207 0, 0, 0, 0, 0, 0, 0,
2208 /* T40 Object */
2209 0, 0, 0, 0, 0,
2210 /* T42 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002211 0, 0, 255, 0, 255, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002212 /* T43 Object */
2213 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
2214 16,
2215 /* T46 Object */
Jing Lina0bc4102012-07-06 17:03:45 -07002216 64, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002217 /* T47 Object */
2218 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2219 /* T48 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002220 1, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002221 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
2222 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
2223 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
2224 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2225 0, 0, 0, 0,
2226 /* T56 Object */
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, 0, 0, 0, 0, 0, 0,
2230 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2231 2, 99, 33, 0, 149, 24, 193, 255, 255, 255,
2232 255,
2233};
2234
Jing Lineec88ca2012-02-08 11:18:30 -08002235/* configuration data for mxt1386e on 3D SKU using V2.1 firmware */
2236static const u8 mxt1386e_config_data_3d[] = {
2237 /* T6 Object */
2238 0, 0, 0, 0, 0, 0,
2239 /* T38 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002240 13, 1, 0, 23, 2, 12, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002241 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2242 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2243 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2244 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2245 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2246 0, 0, 0, 0,
2247 /* T7 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002248 100, 10, 50,
Jing Lineec88ca2012-02-08 11:18:30 -08002249 /* T8 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002250 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002251 /* T9 Object */
2252 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
2253 0, 5, 5, 0, 10, 30, 10, 10, 175, 4,
Jing Lin66ba78b2012-02-24 21:25:12 -08002254 127, 7, 26, 21, 17, 19, 143, 35, 207, 40,
2255 20, 5, 54, 49, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002256 /* T18 Object */
2257 0, 0,
2258 /* T24 Object */
2259 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2260 0, 0, 0, 0, 0, 0, 0, 0, 0,
2261 /* T25 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002262 0, 0, 72, 113, 168, 97,
Jing Lineec88ca2012-02-08 11:18:30 -08002263 /* T27 Object */
2264 0, 0, 0, 0, 0, 0, 0,
2265 /* T40 Object */
2266 0, 0, 0, 0, 0,
2267 /* T42 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002268 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002269 /* T43 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002270 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2271 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002272 /* T46 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002273 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002274 /* T47 Object */
2275 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2276 /* T48 Object */
2277 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08002278 32, 50, 0, 10, 10, 0, 0, 100, 10, 90,
2279 0, 0, 0, 0, 0, 0, 0, 10, 1, 30,
2280 52, 10, 5, 0, 33, 0, 1, 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,
2283 /* T56 Object */
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, 0, 0, 0, 0, 0, 0,
2287 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08002288 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2289 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002290};
2291
Amy Maloche08266db2011-11-04 11:07:16 -07002292#define MXT_TS_GPIO_IRQ 11
2293#define MXT_TS_LDO_EN_GPIO 50
2294#define MXT_TS_RESET_GPIO 52
Mohan Pallaka50837382011-09-07 11:00:57 +05302295
2296static void mxt_init_hw_liquid(void)
2297{
2298 int rc;
2299
Mohan Pallaka50837382011-09-07 11:00:57 +05302300 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
2301 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07002302 pr_err("%s: unable to request mxt_ldo_en_gpio [%d]\n",
2303 __func__, MXT_TS_LDO_EN_GPIO);
2304 return;
Mohan Pallaka50837382011-09-07 11:00:57 +05302305 }
2306
2307 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
2308 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07002309 pr_err("%s: unable to set_direction for mxt_ldo_en_gpio [%d]\n",
2310 __func__, MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05302311 goto err_ldo_gpio_req;
2312 }
2313
Mohan Pallaka50837382011-09-07 11:00:57 +05302314 return;
2315
Mohan Pallaka50837382011-09-07 11:00:57 +05302316err_ldo_gpio_req:
2317 gpio_free(MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05302318}
2319
Jing Lineec88ca2012-02-08 11:18:30 -08002320static struct mxt_config_info mxt_config_array_2d[] = {
Jing Lindc4413c2012-01-16 15:22:52 -08002321 {
2322 .config = mxt1386_config_data,
2323 .config_length = ARRAY_SIZE(mxt1386_config_data),
2324 .family_id = 0xA0,
2325 .variant_id = 0x0,
2326 .version = 0x10,
2327 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002328 .bootldr_id = MXT_BOOTLOADER_ID_1386,
Jing Lindc4413c2012-01-16 15:22:52 -08002329 },
Jing Lin33b007d2011-12-21 17:40:23 -08002330 {
2331 .config = mxt1386e_config_data_v1_0,
2332 .config_length = ARRAY_SIZE(mxt1386e_config_data_v1_0),
2333 .family_id = 0xA0,
2334 .variant_id = 0x2,
2335 .version = 0x10,
2336 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002337 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Linaeaeed52012-03-26 14:57:15 -07002338 .fw_name = "atmel_8960_liquid_v2_2_AA.hex",
Jing Lin33b007d2011-12-21 17:40:23 -08002339 },
2340 {
2341 .config = mxt1386e_config_data_v2_1,
2342 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
2343 .family_id = 0xA0,
2344 .variant_id = 0x7,
2345 .version = 0x21,
2346 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002347 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Linaeaeed52012-03-26 14:57:15 -07002348 .fw_name = "atmel_8960_liquid_v2_2_AA.hex",
2349 },
2350 {
2351 /* The config data for V2.2.AA is the same as for V2.1.AA */
2352 .config = mxt1386e_config_data_v2_1,
2353 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
2354 .family_id = 0xA0,
2355 .variant_id = 0x7,
2356 .version = 0x22,
2357 .build = 0xAA,
2358 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin33b007d2011-12-21 17:40:23 -08002359 },
Jing Lindc4413c2012-01-16 15:22:52 -08002360};
2361
Jing Lineec88ca2012-02-08 11:18:30 -08002362static struct mxt_platform_data mxt_platform_data_2d = {
2363 .config_array = mxt_config_array_2d,
2364 .config_array_size = ARRAY_SIZE(mxt_config_array_2d),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002365 .panel_minx = 0,
2366 .panel_maxx = 1365,
2367 .panel_miny = 0,
2368 .panel_maxy = 767,
2369 .disp_minx = 0,
2370 .disp_maxx = 1365,
2371 .disp_miny = 0,
2372 .disp_maxy = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05302373 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07002374 .i2c_pull_up = true,
Amy Maloche08266db2011-11-04 11:07:16 -07002375 .reset_gpio = MXT_TS_RESET_GPIO,
2376 .irq_gpio = MXT_TS_GPIO_IRQ,
Mohan Pallaka50837382011-09-07 11:00:57 +05302377};
2378
Jing Lineec88ca2012-02-08 11:18:30 -08002379static struct mxt_config_info mxt_config_array_3d[] = {
2380 {
2381 .config = mxt1386e_config_data_3d,
2382 .config_length = ARRAY_SIZE(mxt1386e_config_data_3d),
2383 .family_id = 0xA0,
2384 .variant_id = 0x7,
2385 .version = 0x21,
2386 .build = 0xAA,
2387 },
2388};
2389
2390static struct mxt_platform_data mxt_platform_data_3d = {
2391 .config_array = mxt_config_array_3d,
2392 .config_array_size = ARRAY_SIZE(mxt_config_array_3d),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002393 .panel_minx = 0,
2394 .panel_maxx = 1919,
2395 .panel_miny = 0,
2396 .panel_maxy = 1199,
2397 .disp_minx = 0,
2398 .disp_maxx = 1919,
2399 .disp_miny = 0,
2400 .disp_maxy = 1199,
Jing Lineec88ca2012-02-08 11:18:30 -08002401 .irqflags = IRQF_TRIGGER_FALLING,
2402 .i2c_pull_up = true,
2403 .reset_gpio = MXT_TS_RESET_GPIO,
2404 .irq_gpio = MXT_TS_GPIO_IRQ,
2405};
2406
Mohan Pallaka50837382011-09-07 11:00:57 +05302407static struct i2c_board_info mxt_device_info[] __initdata = {
2408 {
2409 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
Mohan Pallaka50837382011-09-07 11:00:57 +05302410 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
2411 },
2412};
2413
Manoj Rao14648742012-03-30 19:42:12 -07002414static struct msm_mhl_platform_data mhl_platform_data = {
2415 .irq = MSM_GPIO_TO_INT(4),
Manoj Raoc6d904c2012-06-22 00:32:14 -07002416 .gpio_mhl_int = MHL_GPIO_INT,
2417 .gpio_mhl_reset = MHL_GPIO_RESET,
2418 .gpio_mhl_power = 0,
2419 .gpio_hdmi_mhl_mux = 0,
Manoj Rao14648742012-03-30 19:42:12 -07002420};
Manoj Rao14648742012-03-30 19:42:12 -07002421
Eugene Yasmand2316b82011-12-07 18:23:48 +02002422static struct i2c_board_info sii_device_info[] __initdata = {
2423 {
Manoj Rao14648742012-03-30 19:42:12 -07002424#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
2425 /*
2426 * keeps SI 8334 as the default
2427 * MHL TX
2428 */
2429 I2C_BOARD_INFO("sii8334", 0x39),
2430 .platform_data = &mhl_platform_data,
2431#endif
2432#ifdef CONFIG_FB_MSM_HDMI_MHL_9244
Eugene Yasmand2316b82011-12-07 18:23:48 +02002433 I2C_BOARD_INFO("Sil-9244", 0x39),
Eugene Yasmand2316b82011-12-07 18:23:48 +02002434 .irq = MSM_GPIO_TO_INT(15),
Manoj Rao14648742012-03-30 19:42:12 -07002435#endif /* CONFIG_MSM_HDMI_MHL */
2436 .flags = I2C_CLIENT_WAKE,
Eugene Yasmand2316b82011-12-07 18:23:48 +02002437 },
2438};
2439
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002440static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
2441 .clk_freq = 100000,
2442 .src_clk_rate = 24000000,
Kiran Gundab4696c72012-08-16 18:37:46 +05302443 .keep_ahb_clk_on = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002444};
2445
2446static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
2447 .clk_freq = 100000,
2448 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002449};
2450
2451static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
2452 .clk_freq = 100000,
2453 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002454};
2455
2456static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
2457 .clk_freq = 100000,
2458 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002459};
2460
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002461static struct ks8851_pdata spi_eth_pdata = {
2462 .irq_gpio = KS8851_IRQ_GPIO,
2463 .rst_gpio = KS8851_RST_GPIO,
2464};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06002465
Anirudh Ghayal50137fb2012-07-31 16:58:53 +05302466static struct spi_board_info spi_eth_info[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002467 {
2468 .modalias = "ks8851",
2469 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2470 .max_speed_hz = 19200000,
2471 .bus_num = 0,
2472 .chip_select = 0,
2473 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002474 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002475 },
Anirudh Ghayal50137fb2012-07-31 16:58:53 +05302476};
2477static struct spi_board_info spi_board_info[] __initdata = {
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07002478 {
2479 .modalias = "dsi_novatek_3d_panel_spi",
2480 .max_speed_hz = 10800000,
2481 .bus_num = 0,
2482 .chip_select = 1,
2483 .mode = SPI_MODE_0,
2484 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002485};
2486
2487static struct platform_device msm_device_saw_core0 = {
2488 .name = "saw-regulator",
2489 .id = 0,
2490 .dev = {
2491 .platform_data = &msm_saw_regulator_pdata_s5,
2492 },
2493};
2494
2495static struct platform_device msm_device_saw_core1 = {
2496 .name = "saw-regulator",
2497 .id = 1,
2498 .dev = {
2499 .platform_data = &msm_saw_regulator_pdata_s6,
2500 },
2501};
2502
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002503static struct tsens_platform_data msm_tsens_pdata = {
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002504 .slope = {910, 910, 910, 910, 910},
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002505 .tsens_factor = 1000,
2506 .hw_type = MSM_8960,
2507 .tsens_num_sensor = 5,
2508};
2509
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002510static struct platform_device msm_tsens_device = {
2511 .name = "tsens8960-tm",
2512 .id = -1,
2513};
2514
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002515static struct msm_thermal_data msm_thermal_pdata = {
2516 .sensor_id = 0,
Eugene Seah2ee4a5d2012-06-25 18:16:41 -06002517 .poll_ms = 250,
2518 .limit_temp_degC = 60,
2519 .temp_hysteresis_degC = 10,
2520 .freq_step = 2,
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002521};
2522
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002523#ifdef CONFIG_MSM_FAKE_BATTERY
2524static struct platform_device fish_battery_device = {
2525 .name = "fish_battery",
2526};
2527#endif
2528
David Collins26f05562011-06-20 09:56:28 -07002529static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002530 .name = GPIO_REGULATOR_DEV_NAME,
2531 .id = PM8921_MPP_PM_TO_SYS(7),
2532 .dev = {
2533 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2534 },
2535};
2536
David Collins26f05562011-06-20 09:56:28 -07002537static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002538 .name = GPIO_REGULATOR_DEV_NAME,
2539 .id = 91,
2540 .dev = {
2541 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2542 },
2543};
2544
David Collinsb10be1d2011-09-02 10:29:31 -07002545static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
2546 .name = GPIO_REGULATOR_DEV_NAME,
2547 .id = PM8921_GPIO_PM_TO_SYS(17),
2548 .dev = {
2549 .platform_data =
2550 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2551 },
2552};
2553
David Collins35a78f52011-12-14 15:54:25 -08002554static struct platform_device msm8960_device_ext_otg_sw_vreg __devinitdata = {
2555 .name = GPIO_REGULATOR_DEV_NAME,
2556 .id = PM8921_GPIO_PM_TO_SYS(42),
2557 .dev = {
2558 .platform_data =
2559 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_OTG_SW],
2560 },
2561};
2562
David Collins26f05562011-06-20 09:56:28 -07002563static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
2564 .name = "rpm-regulator",
2565 .id = -1,
2566 .dev = {
2567 .platform_data = &msm_rpm_regulator_pdata,
2568 },
2569};
Mayank Ranae009c922012-03-22 03:02:06 +05302570#ifdef CONFIG_SERIAL_MSM_HS
2571static int configure_uart_gpios(int on)
2572{
2573 int ret = 0, i;
2574 int uart_gpios[] = {93, 94, 95, 96};
2575
2576 for (i = 0; i < ARRAY_SIZE(uart_gpios); i++) {
2577 if (on) {
2578 ret = gpio_request(uart_gpios[i], NULL);
2579 if (ret) {
2580 pr_err("%s: unable to request uart gpio[%d]\n",
2581 __func__, uart_gpios[i]);
2582 break;
2583 }
2584 } else {
2585 gpio_free(uart_gpios[i]);
2586 }
2587 }
2588
2589 if (ret && on && i)
2590 for (; i >= 0; i--)
2591 gpio_free(uart_gpios[i]);
2592 return ret;
2593}
2594
2595static struct msm_serial_hs_platform_data msm_uart_dm9_pdata = {
Mayank Ranad85a5082012-04-29 17:24:13 -07002596 .gpio_config = configure_uart_gpios,
Mayank Ranae009c922012-03-22 03:02:06 +05302597};
Mayank Rana1f02d952012-07-04 19:11:20 +05302598
2599static int configure_gsbi8_uart_gpios(int on)
2600{
2601 int ret = 0, i;
2602 int uart_gpios[] = {34, 35, 36, 37};
2603
2604 for (i = 0; i < ARRAY_SIZE(uart_gpios); i++) {
2605 if (on) {
2606 ret = gpio_request(uart_gpios[i], NULL);
2607 if (ret) {
2608 pr_err("%s: unable to request uart gpio[%d]\n",
2609 __func__, uart_gpios[i]);
2610 break;
2611 }
2612 } else {
2613 gpio_free(uart_gpios[i]);
2614 }
2615 }
2616
2617 if (ret && on && i)
2618 for (; i >= 0; i--)
2619 gpio_free(uart_gpios[i]);
2620 return ret;
2621}
2622
2623static struct msm_serial_hs_platform_data msm_uart_dm8_pdata = {
2624 .gpio_config = configure_gsbi8_uart_gpios,
2625};
Mayank Ranae009c922012-03-22 03:02:06 +05302626#else
Mayank Rana1f02d952012-07-04 19:11:20 +05302627static struct msm_serial_hs_platform_data msm_uart_dm8_pdata;
Mayank Ranae009c922012-03-22 03:02:06 +05302628static struct msm_serial_hs_platform_data msm_uart_dm9_pdata;
2629#endif
David Collins26f05562011-06-20 09:56:28 -07002630
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302631#if defined(CONFIG_BT) && defined(CONFIG_BT_HCIUART_ATH3K)
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002632enum WLANBT_STATUS {
2633 WLANOFF_BTOFF = 1,
2634 WLANOFF_BTON,
2635 WLANON_BTOFF,
2636 WLANON_BTON
2637};
2638
2639static DEFINE_MUTEX(ath_wlanbt_mutex);
2640static int gpio_wlan_sys_rest_en = 26;
2641static int ath_wlanbt_status = WLANOFF_BTOFF;
2642
2643static int ath6kl_power_control(int on)
2644{
2645 int rc;
2646
2647 if (on) {
2648 rc = gpio_request(gpio_wlan_sys_rest_en, "wlan sys_rst_n");
2649 if (rc) {
2650 pr_err("%s: unable to request gpio %d (%d)\n",
2651 __func__, gpio_wlan_sys_rest_en, rc);
2652 return rc;
2653 }
2654 rc = gpio_direction_output(gpio_wlan_sys_rest_en, 0);
2655 msleep(200);
2656 rc = gpio_direction_output(gpio_wlan_sys_rest_en, 1);
2657 msleep(100);
2658 } else {
2659 gpio_set_value(gpio_wlan_sys_rest_en, 0);
2660 rc = gpio_direction_input(gpio_wlan_sys_rest_en);
2661 msleep(100);
2662 gpio_free(gpio_wlan_sys_rest_en);
2663 }
2664 return 0;
2665};
2666
2667static int ath6kl_wlan_power(int on)
2668{
2669 int ret = 0;
2670
2671 mutex_lock(&ath_wlanbt_mutex);
2672 if (on) {
2673 if (ath_wlanbt_status == WLANOFF_BTOFF) {
2674 ret = ath6kl_power_control(1);
2675 ath_wlanbt_status = WLANON_BTOFF;
2676 } else if (ath_wlanbt_status == WLANOFF_BTON)
2677 ath_wlanbt_status = WLANON_BTON;
2678 } else {
2679 if (ath_wlanbt_status == WLANON_BTOFF) {
2680 ret = ath6kl_power_control(0);
2681 ath_wlanbt_status = WLANOFF_BTOFF;
2682 } else if (ath_wlanbt_status == WLANON_BTON)
2683 ath_wlanbt_status = WLANOFF_BTON;
2684 }
2685 mutex_unlock(&ath_wlanbt_mutex);
2686 pr_debug("%s on= %d, wlan_status= %d\n",
2687 __func__, on, ath_wlanbt_status);
2688 return ret;
2689};
2690
2691static struct wifi_platform_data ath6kl_wifi_control = {
2692 .set_power = ath6kl_wlan_power,
2693};
2694
2695static struct platform_device msm_wlan_power_device = {
2696 .name = "ath6kl_power",
2697 .dev = {
2698 .platform_data = &ath6kl_wifi_control,
2699 },
2700};
2701
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302702static struct resource bluesleep_resources[] = {
2703 {
2704 .name = "gpio_host_wake",
2705 .start = 27,
2706 .end = 27,
2707 .flags = IORESOURCE_IO,
2708 },
2709 {
2710 .name = "gpio_ext_wake",
2711 .start = 29,
2712 .end = 29,
2713 .flags = IORESOURCE_IO,
2714 },
2715 {
2716 .name = "host_wake",
2717 .start = MSM_GPIO_TO_INT(27),
2718 .end = MSM_GPIO_TO_INT(27),
2719 .flags = IORESOURCE_IRQ,
2720 },
2721};
2722
2723static struct platform_device msm_bluesleep_device = {
2724 .name = "bluesleep",
2725 .id = -1,
2726 .num_resources = ARRAY_SIZE(bluesleep_resources),
2727 .resource = bluesleep_resources,
2728};
2729
2730static struct platform_device msm_bt_power_device = {
2731 .name = "bt_power",
2732};
2733
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002734static int gpio_bt_sys_rest_en = 28;
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302735
2736static int bluetooth_power(int on)
2737{
2738 int rc;
2739
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002740 mutex_lock(&ath_wlanbt_mutex);
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302741 if (on) {
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002742 if (ath_wlanbt_status == WLANOFF_BTOFF) {
2743 ath6kl_power_control(1);
2744 ath_wlanbt_status = WLANOFF_BTON;
2745 } else if (ath_wlanbt_status == WLANON_BTOFF)
2746 ath_wlanbt_status = WLANON_BTON;
2747
Ram Mohan Korukondab07c2632012-08-18 22:24:03 +05302748 rc = gpio_request(gpio_bt_sys_rest_en, "bt sys_rst_n");
2749 if (rc) {
2750 pr_err("%s: unable to request gpio %d (%d)\n",
2751 __func__, gpio_bt_sys_rest_en, rc);
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002752 mutex_unlock(&ath_wlanbt_mutex);
2753 return rc;
Ram Mohan Korukondab07c2632012-08-18 22:24:03 +05302754 }
2755 rc = gpio_direction_output(gpio_bt_sys_rest_en, 0);
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002756 msleep(20);
2757 rc = gpio_direction_output(gpio_bt_sys_rest_en, 1);
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302758 msleep(100);
2759 } else {
2760 gpio_set_value(gpio_bt_sys_rest_en, 0);
2761 rc = gpio_direction_input(gpio_bt_sys_rest_en);
2762 msleep(100);
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002763 gpio_free(gpio_bt_sys_rest_en);
Ram Mohan Korukondab07c2632012-08-18 22:24:03 +05302764
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002765 if (ath_wlanbt_status == WLANOFF_BTON) {
2766 ath6kl_power_control(0);
2767 ath_wlanbt_status = WLANOFF_BTOFF;
2768 } else if (ath_wlanbt_status == WLANON_BTON)
2769 ath_wlanbt_status = WLANON_BTOFF;
2770 }
2771 mutex_unlock(&ath_wlanbt_mutex);
2772 pr_debug("%s on= %d, wlan_status= %d\n",
2773 __func__, on, ath_wlanbt_status);
2774 return 0;
2775};
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302776
2777static void __init bt_power_init(void)
2778{
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302779 msm_bt_power_device.dev.platform_data = &bluetooth_power;
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302780 return;
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002781};
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302782#else
2783#define bt_power_init(x) do {} while (0)
2784#endif
2785
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002786static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07002787 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002788 &msm_device_smd,
Mayank Rana9f51f582011-08-04 18:35:59 +05302789 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002790 &msm_device_saw_core0,
2791 &msm_device_saw_core1,
2792 &msm8960_device_ext_5v_vreg,
David Collins87579612012-01-30 16:00:15 -08002793 &msm8960_device_ssbi_pmic,
David Collins96aa3e12012-02-29 10:31:34 -08002794 &msm8960_device_ext_otg_sw_vreg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002795 &msm8960_device_qup_spi_gsbi1,
2796 &msm8960_device_qup_i2c_gsbi3,
2797 &msm8960_device_qup_i2c_gsbi4,
2798 &msm8960_device_qup_i2c_gsbi10,
2799#ifndef CONFIG_MSM_DSPS
2800 &msm8960_device_qup_i2c_gsbi12,
2801#endif
2802 &msm_slim_ctrl,
2803 &msm_device_wcnss_wlan,
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302804#if defined(CONFIG_BT) && defined(CONFIG_BT_HCIUART_ATH3K)
2805 &msm_bluesleep_device,
2806 &msm_bt_power_device,
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002807 &msm_wlan_power_device,
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302808#endif
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002809#if defined(CONFIG_QSEECOM)
2810 &qseecom_device,
2811#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002812#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2813 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2814 &qcrypto_device,
2815#endif
2816
2817#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2818 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2819 &qcedev_device,
2820#endif
2821#ifdef CONFIG_MSM_ROTATOR
2822 &msm_rotator_device,
2823#endif
2824 &msm_device_sps,
2825#ifdef CONFIG_MSM_FAKE_BATTERY
2826 &fish_battery_device,
2827#endif
Laura Abbottb93525f2012-04-12 09:57:19 -07002828 &msm8960_fmem_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002829#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07002830#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002831 &msm8960_android_pmem_device,
2832 &msm8960_android_pmem_adsp_device,
2833 &msm8960_android_pmem_audio_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002834#endif
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -07002835#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002836 &msm_device_bam_dmux,
2837 &msm_fm_platform_init,
Joel Nidera1261942011-09-12 16:30:09 +03002838#if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE)
2839#ifdef CONFIG_MSM_USE_TSIF1
2840 &msm_device_tsif[1],
2841#else
2842 &msm_device_tsif[0],
2843#endif
2844#endif
Joel Nider266a2642011-10-16 10:58:05 +02002845 &msm_device_tspp,
Mona Hossain9c430e32011-07-27 11:04:47 -07002846#ifdef CONFIG_HW_RANDOM_MSM
2847 &msm_device_rng,
2848#endif
Laura Abbottd6183792011-08-19 13:42:24 -07002849#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002850 &msm8960_ion_dev,
Laura Abbottd6183792011-08-19 13:42:24 -07002851#endif
Praveen Chidambaram78499012011-11-01 17:15:17 -06002852 &msm8960_rpm_device,
2853 &msm8960_rpm_log_device,
2854 &msm8960_rpm_stat_device,
Anji Jonnala2a8bd312012-11-01 13:11:42 +05302855 &msm8960_rpm_master_stat_device,
Mona Hossain11c03ac2011-10-26 12:42:10 -07002856 &msm_device_tz_log,
Pratik Patel3b0ca882012-06-01 16:54:14 -07002857 &coresight_tpiu_device,
2858 &coresight_etb_device,
2859 &coresight_funnel_device,
2860 &coresight_etm0_device,
2861 &coresight_etm1_device,
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07002862 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002863 &msm8960_device_watchdog,
Laura Abbottb93525f2012-04-12 09:57:19 -07002864 &msm8960_rtb_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002865 &msm8960_device_cache_erp,
Stepan Moskovchenkoc0557252012-06-07 17:39:14 -07002866 &msm8960_device_ebi1_ch0_erp,
2867 &msm8960_device_ebi1_ch1_erp,
Laura Abbottb93525f2012-04-12 09:57:19 -07002868 &msm8960_cache_dump_device,
Laura Abbott0577d7b2012-04-17 11:14:30 -07002869 &msm8960_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002870 &msm_tsens_device,
Anji Jonnalae84292b2012-09-21 13:34:44 +05302871 &msm8960_pc_cntr,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002872};
2873
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002874static struct platform_device *cdp_devices[] __initdata = {
Stephen Boydeb819882011-08-29 14:46:30 -07002875 &msm_8960_q6_lpass,
Stephen Boyd322a9922011-09-20 01:05:54 -07002876 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07002877 &msm_pil_tzapps,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07002878 &msm_pil_dsps,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002879 &msm_pil_vidc,
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002880 &msm8960_device_otg,
2881 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002882 &msm_device_hsusb_host,
2883 &android_usb_device,
2884 &msm_pcm,
Kiran Kandi5e809b02012-01-31 00:24:33 -08002885 &msm_multi_ch_pcm,
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -07002886 &msm_lowlatency_pcm,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002887 &msm_pcm_routing,
2888 &msm_cpudai0,
2889 &msm_cpudai1,
Kiran Kandi97fe19d2012-05-20 22:34:04 -07002890 &msm8960_cpudai_slimbus_2_rx,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002891 &msm8960_cpudai_slimbus_2_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002892 &msm_cpudai_hdmi_rx,
2893 &msm_cpudai_bt_rx,
2894 &msm_cpudai_bt_tx,
2895 &msm_cpudai_fm_rx,
2896 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002897 &msm_cpudai_auxpcm_rx,
2898 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002899 &msm_cpu_fe,
2900 &msm_stub_codec,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002901#ifdef CONFIG_MSM_GEMINI
2902 &msm8960_gemini_device,
2903#endif
Kalyani Oruganti465d1e12012-05-15 10:23:05 -07002904#ifdef CONFIG_MSM_MERCURY
2905 &msm8960_mercury_device,
2906#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002907 &msm_voice,
2908 &msm_voip,
2909 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05302910 &msm_cpudai_afe_01_rx,
2911 &msm_cpudai_afe_01_tx,
2912 &msm_cpudai_afe_02_rx,
2913 &msm_cpudai_afe_02_tx,
2914 &msm_pcm_afe,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05302915 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07002916 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07002917 &msm_cpudai_incall_record_rx,
2918 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002919 &msm_pcm_hostless,
2920 &msm_bus_apps_fabric,
2921 &msm_bus_sys_fabric,
2922 &msm_bus_mm_fabric,
2923 &msm_bus_sys_fpb,
2924 &msm_bus_cpss_fpb,
2925};
2926
2927static void __init msm8960_i2c_init(void)
2928{
2929 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2930 &msm8960_i2c_qup_gsbi4_pdata;
2931
2932 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2933 &msm8960_i2c_qup_gsbi3_pdata;
2934
2935 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2936 &msm8960_i2c_qup_gsbi10_pdata;
2937
2938 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2939 &msm8960_i2c_qup_gsbi12_pdata;
2940}
2941
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002942static void __init msm8960_gfx_init(void)
2943{
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002944 struct kgsl_device_platform_data *kgsl_3d0_pdata =
2945 msm_kgsl_3d0.dev.platform_data;
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06002946 uint32_t soc_platform_version = socinfo_get_version();
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002947
Carter Cooper3852cbb2012-08-20 22:11:42 -06002948 /* Fixup data that needs to change based on GPU ID */
Carter Cooperffe7ea12012-08-22 13:27:58 -06002949 if (cpu_is_msm8960ab()) {
2950 kgsl_3d0_pdata->chipid = ADRENO_CHIPID(3, 2, 1, 0);
Suman Tatiraju20372242012-10-29 18:24:53 -07002951 /* 8960PRO nominal clock rate is 320Mhz */
2952 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 320000000;
Carter Cooper3852cbb2012-08-20 22:11:42 -06002953 } else {
2954 kgsl_3d0_pdata->iommu_count = 1;
2955 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
2956 kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
2957 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
2958 }
2959 if (SOCINFO_VERSION_MAJOR(soc_platform_version) >= 3) {
2960 /* 8960v3 GPU registers returns 5 for patch release
2961 * but it should be 6, so dummy up the chipid here
2962 * based the platform type
2963 */
2964 kgsl_3d0_pdata->chipid = ADRENO_CHIPID(2, 2, 0, 6);
2965 }
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002966 }
Carter Cooper6307eb992012-08-20 15:17:23 -06002967
2968 /* Register the 3D core */
2969 platform_device_register(&msm_kgsl_3d0);
2970
2971 /* Register the 2D cores if we are not 8960PRO */
2972 if (!cpu_is_msm8960ab()) {
2973 platform_device_register(&msm_kgsl_2d0);
2974 platform_device_register(&msm_kgsl_2d1);
2975 }
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002976}
2977
Subhash Jadavani933e6a62011-12-26 18:05:04 +05302978static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002979 {
2980 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2981 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2982 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002983 1, 784, 180000, 100,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002984 },
2985
2986 {
Anji Jonnala85b29ff2013-01-15 14:12:45 +05302987 MSM_PM_SLEEP_MODE_RETENTION,
2988 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2989 true,
2990 415, 715, 340827, 475,
2991 },
2992
2993 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002994 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2995 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2996 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002997 1300, 228, 1200000, 2000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002998 },
2999
3000 {
3001 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3002 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
3003 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06003004 2000, 138, 1208400, 3200,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003005 },
3006
3007 {
3008 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06003009 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
3010 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06003011 6000, 119, 1850300, 9000,
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06003012 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003013
3014 {
3015 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3016 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
3017 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06003018 9200, 68, 2839200, 16400,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003019 },
3020
3021 {
3022 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3023 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
3024 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06003025 10300, 63, 3128000, 18200,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003026 },
3027
3028 {
3029 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3030 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
3031 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06003032 18000, 10, 4602600, 27000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003033 },
3034
3035 {
3036 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3037 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
3038 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06003039 20000, 2, 5752000, 32000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003040 },
3041};
3042
Anji Jonnala85b29ff2013-01-15 14:12:45 +05303043
Praveen Chidambaram78499012011-11-01 17:15:17 -06003044static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
3045 .levels = &msm_rpmrs_levels[0],
3046 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
3047 .vdd_mem_levels = {
3048 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
3049 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
3050 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
3051 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
3052 },
3053 .vdd_dig_levels = {
3054 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
3055 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
3056 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
3057 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
3058 },
3059 .vdd_mask = 0x7FFFFF,
3060 .rpmrs_target_id = {
3061 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
3062 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
3063 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
3064 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
3065 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
3066 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
3067 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
3068 },
3069};
3070
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06003071static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
3072 .mode = MSM_PM_BOOT_CONFIG_TZ,
3073};
3074
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003075#ifdef CONFIG_I2C
3076#define I2C_SURF 1
3077#define I2C_FFA (1 << 1)
3078#define I2C_RUMI (1 << 2)
3079#define I2C_SIM (1 << 3)
3080#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03003081#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003082
3083struct i2c_registry {
3084 u8 machs;
3085 int bus;
3086 struct i2c_board_info *info;
3087 int len;
3088};
3089
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003090/* Sensors DSPS platform data */
3091#ifdef CONFIG_MSM_DSPS
3092#define DSPS_PIL_GENERIC_NAME "dsps"
3093#endif /* CONFIG_MSM_DSPS */
3094
3095static void __init msm8960_init_dsps(void)
3096{
3097#ifdef CONFIG_MSM_DSPS
3098 struct msm_dsps_platform_data *pdata =
3099 msm_dsps_device.dev.platform_data;
3100 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
3101 pdata->gpios = NULL;
3102 pdata->gpios_num = 0;
3103
3104 platform_device_register(&msm_dsps_device);
3105#endif /* CONFIG_MSM_DSPS */
3106}
3107
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -08003108static int hsic_peripheral_status = 1;
3109static DEFINE_MUTEX(hsic_status_lock);
3110
3111void peripheral_connect()
3112{
3113 mutex_lock(&hsic_status_lock);
3114 if (hsic_peripheral_status)
3115 goto out;
3116 platform_device_add(&msm_device_hsic_host);
3117 hsic_peripheral_status = 1;
3118out:
3119 mutex_unlock(&hsic_status_lock);
3120}
3121EXPORT_SYMBOL(peripheral_connect);
3122
3123void peripheral_disconnect()
3124{
3125 mutex_lock(&hsic_status_lock);
3126 if (!hsic_peripheral_status)
3127 goto out;
3128 platform_device_del(&msm_device_hsic_host);
3129 hsic_peripheral_status = 0;
3130out:
3131 mutex_unlock(&hsic_status_lock);
3132}
3133EXPORT_SYMBOL(peripheral_disconnect);
3134
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303135static void __init msm8960_init_smsc_hub(void)
3136{
3137 uint32_t version = socinfo_get_version();
3138
3139 if (SOCINFO_VERSION_MAJOR(version) == 1)
3140 return;
3141
3142 if (machine_is_msm8960_liquid())
3143 platform_device_register(&smsc_hub_device);
3144}
3145
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003146static void __init msm8960_init_hsic(void)
3147{
3148#ifdef CONFIG_USB_EHCI_MSM_HSIC
3149 uint32_t version = socinfo_get_version();
3150
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08003151 if (SOCINFO_VERSION_MAJOR(version) == 1)
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003152 return;
3153
Joel King0cbf5d82012-05-24 15:21:38 -07003154 if (machine_is_msm8960_liquid())
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08003155 platform_device_register(&msm_device_hsic_host);
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003156#endif
3157}
3158
Amir Samuelov5137e392011-09-21 17:31:25 +03003159#ifdef CONFIG_ISL9519_CHARGER
3160static struct isl_platform_data isl_data __initdata = {
3161 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
3162 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
3163 .max_system_voltage = 4200,
3164 .min_system_voltage = 3200,
Amir Samuelov95f49ff2012-01-29 09:14:08 +02003165 .chgcurrent = 1900,
3166 .term_current = 0,
Amir Samuelov5137e392011-09-21 17:31:25 +03003167 .input_current = 2048,
3168};
3169
3170static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
3171 {
3172 I2C_BOARD_INFO("isl9519q", 0x9),
3173 .irq = 0, /* Not required when notify-by-pmic */
3174 .platform_data = &isl_data,
3175 },
3176};
3177#endif /* CONFIG_ISL9519_CHARGER */
3178
Amir Samuelov755616d2011-12-13 16:34:46 +02003179static struct i2c_board_info liquid_io_expander_i2c_info[] __initdata = {
3180 {
3181 I2C_BOARD_INFO("sx1508q", 0x20),
3182 .platform_data = &msm8960_sx150x_data[SX150X_LIQUID]
3183 },
3184};
3185
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003186static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Amir Samuelov5137e392011-09-21 17:31:25 +03003187#ifdef CONFIG_ISL9519_CHARGER
3188 {
3189 I2C_LIQUID,
3190 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
3191 isl_charger_i2c_info,
3192 ARRAY_SIZE(isl_charger_i2c_info),
3193 },
3194#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003195 {
3196 I2C_SURF | I2C_FFA | I2C_FLUID,
3197 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3198 cyttsp_info,
3199 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07003200 },
Mohan Pallaka50837382011-09-07 11:00:57 +05303201 {
3202 I2C_LIQUID,
3203 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3204 mxt_device_info,
3205 ARRAY_SIZE(mxt_device_info),
3206 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05303207 {
Manoj Rao14648742012-03-30 19:42:12 -07003208 I2C_SURF | I2C_FFA | I2C_LIQUID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05303209 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Eugene Yasmand2316b82011-12-07 18:23:48 +02003210 sii_device_info,
3211 ARRAY_SIZE(sii_device_info),
3212 },
3213 {
Anirudh Ghayal15698162012-07-31 11:51:32 +05303214 I2C_LIQUID | I2C_FFA,
Eugene Yasmand2316b82011-12-07 18:23:48 +02003215 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05303216 msm_isa1200_board_info,
3217 ARRAY_SIZE(msm_isa1200_board_info),
3218 },
Amir Samuelov755616d2011-12-13 16:34:46 +02003219 {
3220 I2C_LIQUID,
3221 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
3222 liquid_io_expander_i2c_info,
3223 ARRAY_SIZE(liquid_io_expander_i2c_info),
3224 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003225};
3226#endif /* CONFIG_I2C */
3227
3228static void __init register_i2c_devices(void)
3229{
3230#ifdef CONFIG_I2C
3231 u8 mach_mask = 0;
3232 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08003233#ifdef CONFIG_MSM_CAMERA
3234 struct i2c_registry msm8960_camera_i2c_devices = {
3235 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
3236 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
3237 msm8960_camera_board_info.board_info,
3238 msm8960_camera_board_info.num_i2c_board_info,
3239 };
3240#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003241
3242 /* Build the matching 'supported_machs' bitmask */
3243 if (machine_is_msm8960_cdp())
3244 mach_mask = I2C_SURF;
Amy Maloche2d028032011-07-20 14:08:06 -07003245 else if (machine_is_msm8960_fluid())
3246 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03003247 else if (machine_is_msm8960_liquid())
3248 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07003249 else if (machine_is_msm8960_mtp())
3250 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003251 else
3252 pr_err("unmatched machine ID in register_i2c_devices\n");
3253
Jing Lineec88ca2012-02-08 11:18:30 -08003254 if (machine_is_msm8960_liquid()) {
3255 if (SOCINFO_VERSION_MAJOR(socinfo_get_platform_version()) == 3)
3256 mxt_device_info[0].platform_data =
3257 &mxt_platform_data_3d;
3258 else
3259 mxt_device_info[0].platform_data =
3260 &mxt_platform_data_2d;
3261 }
3262
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003263 /* Run the array and install devices as appropriate */
3264 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
3265 if (msm8960_i2c_devices[i].machs & mach_mask)
3266 i2c_register_board_info(msm8960_i2c_devices[i].bus,
3267 msm8960_i2c_devices[i].info,
3268 msm8960_i2c_devices[i].len);
3269 }
Manoj Raoc6d904c2012-06-22 00:32:14 -07003270
3271 if (!mhl_platform_data.gpio_mhl_power)
3272 pr_debug("mhl device configured for ext debug board\n");
3273
Kevin Chan09f4e662011-12-16 08:17:02 -08003274#ifdef CONFIG_MSM_CAMERA
3275 if (msm8960_camera_i2c_devices.machs & mach_mask)
3276 i2c_register_board_info(msm8960_camera_i2c_devices.bus,
3277 msm8960_camera_i2c_devices.info,
3278 msm8960_camera_i2c_devices.len);
3279#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003280#endif
3281}
3282
Siddartha Mohanadoss9e1417c2012-09-26 09:42:32 -07003283static void __init msm8960_tsens_init(void)
3284{
3285 if (cpu_is_msm8960())
3286 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) == 1)
3287 return;
3288
3289 msm_tsens_early_init(&msm_tsens_pdata);
3290}
3291
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003292static void __init msm8960_cdp_init(void)
3293{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07003294 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
3295 pr_err("meminfo_init() failed!\n");
3296
Rohit Vaswanib1cc4932012-07-23 21:30:11 -07003297 platform_device_register(&msm_gpio_device);
Siddartha Mohanadoss9e1417c2012-09-26 09:42:32 -07003298 msm8960_tsens_init();
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06003299 msm_thermal_init(&msm_thermal_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06003300 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
3301 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07003302
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003303 regulator_suppress_info_printing();
3304 if (msm_xo_init())
3305 pr_err("Failed to initialize XO votes\n");
David Collins4c93ce92012-09-04 15:44:19 -07003306 configure_msm8960_power_grid();
David Collins26f05562011-06-20 09:56:28 -07003307 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07003308 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05303309 if (machine_is_msm8960_liquid())
3310 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003311 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05303312 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
3313 machine_is_msm8960_cdp()) {
Mayank Ranaa1f507b2012-08-14 10:57:00 +05303314 /* Due to availability of USB Switch in SGLTE Platform
3315 * it requires different HSUSB PHY settings compare to
3316 * 8960 MTP/CDP platform.
3317 */
3318 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
3319 msm_otg_pdata.phy_init_seq = sglte_phy_init_seq;
3320 else
3321 msm_otg_pdata.phy_init_seq = wr_phy_init_seq;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05303322 } else if (machine_is_msm8960_liquid()) {
3323 msm_otg_pdata.phy_init_seq =
3324 liquid_v1_phy_init_seq;
3325 }
Ofir Cohen94213a72012-05-03 14:26:32 +03003326 android_usb_pdata.swfi_latency =
Anji jonnalaa7c1c5c2011-12-12 12:20:36 +05303327 msm_rpmrs_levels[0].latency_us;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303328 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303329 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2 &&
3330 machine_is_msm8960_liquid())
3331 msm_device_hsic_host.dev.parent = &smsc_hub_device.dev;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08003332 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003333 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3334 &msm8960_qup_spi_gsbi1_pdata;
3335 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Anirudh Ghayal50137fb2012-07-31 16:58:53 +05303336 if (socinfo_get_platform_subtype() != PLATFORM_SUBTYPE_SGLTE)
3337 spi_register_board_info(spi_eth_info, ARRAY_SIZE(spi_eth_info));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003338
3339 msm8960_init_pmic();
Anirudh Ghayal15698162012-07-31 11:51:32 +05303340 if (machine_is_msm8960_liquid() || (machine_is_msm8960_mtp() &&
Shantanu Jain4ffd8122012-12-03 15:09:39 +05303341 (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE ||
3342 cpu_is_msm8960ab())))
Mohan Pallakaf69f0492011-11-21 13:08:33 +05303343 msm_isa1200_board_info[0].platform_data = &isa1200_1_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003344 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003345 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003346 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3347 msm_spm_l2_init(msm_spm_l2_data);
3348 msm8960_init_buses();
Stephen Boyd6716bd92012-10-25 11:46:04 -07003349 if (cpu_is_msm8960ab()) {
3350 platform_add_devices(msm8960ab_footswitch,
3351 msm8960ab_num_footswitch);
3352 } else {
3353 platform_add_devices(msm8960_footswitch,
3354 msm8960_num_footswitch);
3355 }
David Collinsb10be1d2011-09-02 10:29:31 -07003356 if (machine_is_msm8960_liquid())
3357 platform_device_register(&msm8960_device_ext_3p3v_vreg);
David Collinsd5a40732011-11-29 15:53:56 -08003358 if (machine_is_msm8960_cdp())
3359 platform_device_register(&msm8960_device_ext_l2_vreg);
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07003360
3361 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
3362 platform_device_register(&msm8960_device_uart_gsbi8);
3363 else
3364 platform_device_register(&msm8960_device_uart_gsbi5);
3365
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003366 /* For 8960 Fusion 2.2 Primary IPC */
Mayank Ranad85a5082012-04-29 17:24:13 -07003367 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE) {
3368 msm_uart_dm9_pdata.wakeup_irq = gpio_to_irq(94); /* GSBI9(2) */
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003369 msm_device_uart_dm9.dev.platform_data = &msm_uart_dm9_pdata;
Mayank Rana77f83c22012-07-10 09:31:02 +05303370 platform_device_register(&msm_device_uart_dm9);
Mayank Ranad85a5082012-04-29 17:24:13 -07003371 }
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003372
Mayank Rana1f02d952012-07-04 19:11:20 +05303373 /* For 8960 Standalone External Bluetooth Interface */
3374 if (socinfo_get_platform_subtype() != PLATFORM_SUBTYPE_SGLTE) {
3375 msm_device_uart_dm8.dev.platform_data = &msm_uart_dm8_pdata;
3376 platform_device_register(&msm_device_uart_dm8);
3377 }
Patrick Daly6578e0c2012-07-19 18:50:02 -07003378 if (cpu_is_msm8960ab())
3379 platform_device_register(&msm8960ab_device_acpuclk);
3380 else
3381 platform_device_register(&msm8960_device_acpuclk);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003382 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Arun Menond4837f62012-08-20 15:25:50 -07003383 msm8960_add_vidc_device();
Patrick Daly6578e0c2012-07-19 18:50:02 -07003384
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003385 msm8960_pm8921_gpio_mpp_init();
Stephen Boyd0ea1b762012-09-13 12:41:31 -07003386 /* Don't add modem devices on APQ targets */
3387 if (socinfo_get_id() != 124) {
3388 platform_device_register(&msm_8960_q6_mss_fw);
3389 platform_device_register(&msm_8960_q6_mss_sw);
3390 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003391 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303392 msm8960_init_smsc_hub();
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003393 msm8960_init_hsic();
Steve Mucklef132c6c2012-06-06 18:30:57 -07003394#ifdef CONFIG_MSM_CAMERA
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003395 msm8960_init_cam();
Steve Mucklef132c6c2012-06-06 18:30:57 -07003396#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003397 msm8960_init_mmc();
Mohan Pallaka50837382011-09-07 11:00:57 +05303398 if (machine_is_msm8960_liquid())
3399 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003400 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08003401 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003402 slim_register_board_info(msm_slim_devices,
3403 ARRAY_SIZE(msm_slim_devices));
3404 msm8960_init_dsps();
Larry Bassela7eadea2011-07-14 10:46:00 -07003405 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06003406 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05303407 bt_power_init();
Joel King0cbf5d82012-05-24 15:21:38 -07003408 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE) {
3409 mdm_sglte_device.dev.platform_data = &sglte_platform_data;
3410 platform_device_register(&mdm_sglte_device);
3411 }
Anji Jonnala85b29ff2013-01-15 14:12:45 +05303412 msm_pm_set_tz_retention_flag(1);
Laura Abbott5249a052012-12-11 15:09:03 -08003413 ion_adjust_secure_allocation();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003414}
3415
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003416MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
3417 .map_io = msm8960_map_io,
3418 .reserve = msm8960_reserve,
3419 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303420 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003421 .timer = &msm_timer,
3422 .init_machine = msm8960_cdp_init,
3423 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003424 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003425 .restart = msm_restart,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003426MACHINE_END
3427
3428MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
3429 .map_io = msm8960_map_io,
3430 .reserve = msm8960_reserve,
3431 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303432 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003433 .timer = &msm_timer,
3434 .init_machine = msm8960_cdp_init,
3435 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003436 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003437 .restart = msm_restart,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003438MACHINE_END
3439
3440MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
3441 .map_io = msm8960_map_io,
3442 .reserve = msm8960_reserve,
3443 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303444 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003445 .timer = &msm_timer,
3446 .init_machine = msm8960_cdp_init,
3447 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003448 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003449 .restart = msm_restart,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003450MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003451
3452MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
3453 .map_io = msm8960_map_io,
3454 .reserve = msm8960_reserve,
3455 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303456 .handle_irq = gic_handle_irq,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003457 .timer = &msm_timer,
3458 .init_machine = msm8960_cdp_init,
3459 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003460 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003461 .restart = msm_restart,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003462MACHINE_END