blob: 898332f594d8c4a437a3ab3fd0d4bb05c010da5b [file] [log] [blame]
Harini Jayaramana9873ab2011-12-20 17:29:48 -07001/* Copyright (c) 2011-2012, Code Aurora Forum. 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>
Lucille Sylvester34ec3692011-08-16 16:28:04 -060029#include <linux/msm_kgsl.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070030#ifdef CONFIG_ANDROID_PMEM
31#include <linux/android_pmem.h>
32#endif
Steve Mucklef132c6c2012-06-06 18:30:57 -070033#include <linux/cyttsp-qc.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>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080045
46#include <asm/mach-types.h>
47#include <asm/mach/arch.h>
Larry Basselb4126da2011-07-18 14:31:33 -070048#include <asm/setup.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080049#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070050#include <asm/mach/mmc.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080051
52#include <mach/board.h>
53#include <mach/msm_iomap.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070054#include <mach/msm_spi.h>
Mayank Ranae009c922012-03-22 03:02:06 +053055#include <mach/msm_serial_hs.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070056#ifdef CONFIG_USB_MSM_OTG_72K
57#include <mach/msm_hsusb.h>
58#else
59#include <linux/usb/msm_hsusb.h>
60#endif
61#include <linux/usb/android.h>
62#include <mach/usbdiag.h>
63#include <mach/socinfo.h>
64#include <mach/rpm.h>
Rohit Vaswania513aa8d2011-07-18 15:14:28 -070065#include <mach/gpiomux.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070066#include <mach/msm_bus_board.h>
67#include <mach/msm_memtypes.h>
68#include <mach/dma.h>
69#include <mach/msm_dsps.h>
70#include <mach/msm_xo.h>
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -070071#include <mach/restart.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080072
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070073#ifdef CONFIG_WCD9310_CODEC
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +053074#include <linux/mfd/wcd9xxx/core.h>
75#include <linux/mfd/wcd9xxx/pdata.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070076#endif
77
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +053078#include <linux/smsc3503.h>
Laura Abbottd6183792011-08-19 13:42:24 -070079#include <linux/ion.h>
80#include <mach/ion.h>
Joel Kingb8352a12011-11-15 18:46:24 -080081#include <mach/mdm2.h>
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -080082#include <mach/mdm-peripheral.h>
Laura Abbottf8c03b92012-02-16 14:57:58 -080083#include <mach/msm_rtb.h>
Laura Abbott306bcc22012-03-08 11:24:53 -080084#include <mach/msm_cache_dump.h>
85#include <mach/scm.h>
Olav Haugan8726caf2012-05-10 15:11:35 -070086#include <mach/iommu_domains.h>
Laura Abbottd6183792011-08-19 13:42:24 -070087
Larry Bassel41a055b2011-12-06 16:15:14 -080088#include <linux/fmem.h>
89
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070090#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080091#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070092#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070093#include "spm.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080094#include "board-8960.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080095#include "pm.h"
Abhijeet Dharmapurikarefaca4f2011-12-27 16:24:07 -080096#include <mach/cpuidle.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070097#include "rpm_resources.h"
Subhash Jadavani909e04f2012-04-12 10:52:50 +053098#include <mach/mpm.h>
Matt Wagantall6d9ebee2011-08-26 12:15:24 -070099#include "acpuclock.h"
Naveen Ramaraj76483ad2011-09-06 14:25:44 -0700100#include "smd_private.h"
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -0600101#include "pm-boot.h"
Jeff Ohlstein7e668552011-10-06 16:17:25 -0700102#include "msm_watchdog.h"
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800103
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700104static struct platform_device msm_fm_platform_init = {
105 .name = "iris_fm",
106 .id = -1,
107};
108
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700109#define KS8851_RST_GPIO 89
110#define KS8851_IRQ_GPIO 90
Mohan Pallaka5e490392011-09-09 15:18:41 +0530111#define HAP_SHIFT_LVL_OE_GPIO 47
112
Manoj Rao14648742012-03-30 19:42:12 -0700113#define MHL_GPIO_INT 4
114#define MHL_GPIO_RESET 15
115
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700116#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700117
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800118struct sx150x_platform_data msm8960_sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700119 [SX150X_CAM] = {
120 .gpio_base = GPIO_CAM_EXPANDER_BASE,
121 .oscio_is_gpo = false,
122 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530123 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700124 .io_open_drain_ena = 0x0,
125 .irq_summary = -1,
126 },
Amir Samuelov755616d2011-12-13 16:34:46 +0200127 [SX150X_LIQUID] = {
128 .gpio_base = GPIO_LIQUID_EXPANDER_BASE,
129 .oscio_is_gpo = false,
130 .io_pullup_ena = 0x0c08,
131 .io_pulldn_ena = 0x4060,
132 .io_open_drain_ena = 0x000c,
133 .io_polarity = 0,
134 .irq_summary = -1,
135 },
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700136};
Nishant Pandit474f2252011-07-23 23:17:56 +0530137
138#endif
139
Olav Haugana21169d2012-01-04 09:17:06 -0800140#define MSM_PMEM_ADSP_SIZE 0x7800000
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -0700141#define MSM_PMEM_AUDIO_SIZE 0x4CF000
Mathew Karimpanal15fa5c42011-12-14 21:28:10 -0800142#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800143#define MSM_LIQUID_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800144#define MSM_HDMI_PRIM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Laura Abbott2d1760b2011-09-29 21:31:24 -0700145
146#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -0700147#define MSM_PMEM_KERNEL_EBI1_SIZE 0x65000
Olav Haugan32594552012-03-13 11:40:05 -0700148#ifdef CONFIG_MSM_IOMMU
Olav Haugan8726caf2012-05-10 15:11:35 -0700149#define MSM_ION_MM_SIZE 0x3800000 /* Need to be multiple of 64K */
Olav Haugan32594552012-03-13 11:40:05 -0700150#define MSM_ION_SF_SIZE 0x0
Olav Hauganfbbf05b2012-04-05 14:33:41 -0700151#define MSM_ION_QSECOM_SIZE 0x780000 /* (7.5MB) */
Olav Haugan32594552012-03-13 11:40:05 -0700152#define MSM_ION_HEAP_NUM 7
153#else
154#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
155#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Hauganfbbf05b2012-04-05 14:33:41 -0700156#define MSM_ION_QSECOM_SIZE 0x600000 /* (6MB) */
Olav Haugan32594552012-03-13 11:40:05 -0700157#define MSM_ION_HEAP_NUM 8
158#endif
Olav Haugan42ebe712012-01-10 16:30:58 -0800159#define MSM_ION_MM_FW_SIZE 0x200000 /* (2MB) */
Olav Hauganb5be7992011-11-18 14:29:02 -0800160#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan7355db02012-01-13 16:59:13 -0800161#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Olav Haugan32594552012-03-13 11:40:05 -0700162
Olav Hauganb5be7992011-11-18 14:29:02 -0800163#define MSM_LIQUID_ION_MM_SIZE (MSM_ION_MM_SIZE + 0x600000)
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800164#define MSM_LIQUID_ION_SF_SIZE MSM_LIQUID_PMEM_SIZE
165#define MSM_HDMI_PRIM_ION_SF_SIZE MSM_HDMI_PRIM_PMEM_SIZE
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700166
Larry Bassel4d4f4482012-04-04 11:26:09 -0700167#define MSM8960_FIXED_AREA_START 0xa0000000
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700168#define MAX_FIXED_AREA_SIZE 0x10000000
Larry Bassel4d4f4482012-04-04 11:26:09 -0700169#define MSM_MM_FW_SIZE 0x200000
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700170#define MSM8960_FW_START (MSM8960_FIXED_AREA_START - MSM_MM_FW_SIZE)
171
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800172static unsigned msm_ion_sf_size = MSM_ION_SF_SIZE;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700173#else
Laura Abbott6db11c92011-11-04 10:31:43 -0700174#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
Olav Hauganb5be7992011-11-18 14:29:02 -0800175#define MSM_ION_HEAP_NUM 1
Laura Abbott2d1760b2011-09-29 21:31:24 -0700176#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700177
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700178#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
179static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
180static int __init pmem_kernel_ebi1_size_setup(char *p)
181{
182 pmem_kernel_ebi1_size = memparse(p, NULL);
183 return 0;
184}
185early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
186#endif
187
188#ifdef CONFIG_ANDROID_PMEM
189static unsigned pmem_size = MSM_PMEM_SIZE;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800190static unsigned pmem_param_set;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700191static int __init pmem_size_setup(char *p)
192{
193 pmem_size = memparse(p, NULL);
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800194 pmem_param_set = 1;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700195 return 0;
196}
197early_param("pmem_size", pmem_size_setup);
198
199static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
200
201static int __init pmem_adsp_size_setup(char *p)
202{
203 pmem_adsp_size = memparse(p, NULL);
204 return 0;
205}
206early_param("pmem_adsp_size", pmem_adsp_size_setup);
207
208static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
209
210static int __init pmem_audio_size_setup(char *p)
211{
212 pmem_audio_size = memparse(p, NULL);
213 return 0;
214}
215early_param("pmem_audio_size", pmem_audio_size_setup);
216#endif
217
218#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700219#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700220static struct android_pmem_platform_data android_pmem_pdata = {
221 .name = "pmem",
222 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
223 .cached = 1,
224 .memory_type = MEMTYPE_EBI1,
225};
226
Laura Abbottb93525f2012-04-12 09:57:19 -0700227static struct platform_device msm8960_android_pmem_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700228 .name = "android_pmem",
229 .id = 0,
230 .dev = {.platform_data = &android_pmem_pdata},
231};
232
233static struct android_pmem_platform_data android_pmem_adsp_pdata = {
234 .name = "pmem_adsp",
235 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
236 .cached = 0,
237 .memory_type = MEMTYPE_EBI1,
238};
Laura Abbottb93525f2012-04-12 09:57:19 -0700239static struct platform_device msm8960_android_pmem_adsp_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700240 .name = "android_pmem",
241 .id = 2,
242 .dev = { .platform_data = &android_pmem_adsp_pdata },
243};
244
245static struct android_pmem_platform_data android_pmem_audio_pdata = {
246 .name = "pmem_audio",
247 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
248 .cached = 0,
249 .memory_type = MEMTYPE_EBI1,
250};
251
Laura Abbottb93525f2012-04-12 09:57:19 -0700252static struct platform_device msm8960_android_pmem_audio_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700253 .name = "android_pmem",
254 .id = 4,
255 .dev = { .platform_data = &android_pmem_audio_pdata },
256};
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700257#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
258#endif /*CONFIG_ANDROID_PMEM*/
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700259
Laura Abbottb93525f2012-04-12 09:57:19 -0700260struct fmem_platform_data msm8960_fmem_pdata = {
Larry Bassel41a055b2011-12-06 16:15:14 -0800261};
262
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700263#define DSP_RAM_BASE_8960 0x8da00000
264#define DSP_RAM_SIZE_8960 0x1800000
265static int dspcrashd_pdata_8960 = 0xDEADDEAD;
266
267static struct resource resources_dspcrashd_8960[] = {
268 {
269 .name = "msm_dspcrashd",
270 .start = DSP_RAM_BASE_8960,
271 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
272 .flags = IORESOURCE_DMA,
273 },
274};
275
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800276static struct platform_device msm_device_dspcrashd_8960 = {
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700277 .name = "msm_dspcrashd",
278 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
279 .resource = resources_dspcrashd_8960,
280 .dev = { .platform_data = &dspcrashd_pdata_8960 },
281};
282
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700283static struct memtype_reserve msm8960_reserve_table[] __initdata = {
284 [MEMTYPE_SMI] = {
285 },
286 [MEMTYPE_EBI0] = {
287 .flags = MEMTYPE_FLAGS_1M_ALIGN,
288 },
289 [MEMTYPE_EBI1] = {
290 .flags = MEMTYPE_FLAGS_1M_ALIGN,
291 },
292};
293
Laura Abbottf8c03b92012-02-16 14:57:58 -0800294static void __init reserve_rtb_memory(void)
295{
296#if defined(CONFIG_MSM_RTB)
Laura Abbottb93525f2012-04-12 09:57:19 -0700297 msm8960_reserve_table[MEMTYPE_EBI1].size += msm8960_rtb_pdata.size;
Laura Abbottf8c03b92012-02-16 14:57:58 -0800298#endif
299}
300
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700301static void __init size_pmem_devices(void)
302{
303#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700304#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700305 android_pmem_adsp_pdata.size = pmem_adsp_size;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800306
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800307 if (!pmem_param_set) {
308 if (machine_is_msm8960_liquid())
309 pmem_size = MSM_LIQUID_PMEM_SIZE;
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700310 if (msm8960_hdmi_as_primary_selected())
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800311 pmem_size = MSM_HDMI_PRIM_PMEM_SIZE;
312 }
313
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700314 android_pmem_pdata.size = pmem_size;
315 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700316#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
317#endif /*CONFIG_ANDROID_PMEM*/
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700318}
319
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700320#ifdef CONFIG_ANDROID_PMEM
321#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700322static void __init reserve_memory_for(struct android_pmem_platform_data *p)
323{
324 msm8960_reserve_table[p->memory_type].size += p->size;
325}
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700326#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
327#endif /*CONFIG_ANDROID_PMEM*/
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700328
329static void __init reserve_pmem_memory(void)
330{
331#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700332#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700333 reserve_memory_for(&android_pmem_adsp_pdata);
334 reserve_memory_for(&android_pmem_pdata);
335 reserve_memory_for(&android_pmem_audio_pdata);
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700336#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700337 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
338#endif
339}
340
Larry Basselb4126da2011-07-18 14:31:33 -0700341static int msm8960_paddr_to_memtype(unsigned int paddr)
342{
343 return MEMTYPE_EBI1;
344}
345
Steve Mucklef132c6c2012-06-06 18:30:57 -0700346#define FMEM_ENABLED 0
Olav Hauganf6dc7742012-02-15 09:11:55 -0800347
Laura Abbottd6183792011-08-19 13:42:24 -0700348#ifdef CONFIG_ION_MSM
Olav Haugan0703dbf2011-12-19 17:53:38 -0800349#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -0700350static struct ion_cp_heap_pdata cp_mm_msm8960_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800351 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugan8726caf2012-05-10 15:11:35 -0700352 .align = SZ_64K,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800353 .reusable = FMEM_ENABLED,
354 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700355 .fixed_position = FIXED_MIDDLE,
Olav Haugan8726caf2012-05-10 15:11:35 -0700356 .iommu_map_all = 1,
357 .iommu_2x_map_domain = VIDEO_DOMAIN,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800358};
359
Laura Abbottb93525f2012-04-12 09:57:19 -0700360static struct ion_cp_heap_pdata cp_mfc_msm8960_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800361 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugan42ebe712012-01-10 16:30:58 -0800362 .align = PAGE_SIZE,
Olav Haugan65f4bd82011-12-13 11:50:08 -0800363 .reusable = 0,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800364 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700365 .fixed_position = FIXED_HIGH,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800366};
367
Laura Abbottb93525f2012-04-12 09:57:19 -0700368static struct ion_co_heap_pdata co_msm8960_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800369 .adjacent_mem_id = INVALID_HEAP_ID,
370 .align = PAGE_SIZE,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800371 .mem_is_fmem = 0,
Olav Haugan42ebe712012-01-10 16:30:58 -0800372};
373
Laura Abbottb93525f2012-04-12 09:57:19 -0700374static struct ion_co_heap_pdata fw_co_msm8960_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800375 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
376 .align = SZ_128K,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800377 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700378 .fixed_position = FIXED_LOW,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800379};
380#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800381
382/**
383 * These heaps are listed in the order they will be allocated. Due to
384 * video hardware restrictions and content protection the FW heap has to
385 * be allocated adjacent (below) the MM heap and the MFC heap has to be
386 * allocated after the MM heap to ensure MFC heap is not more than 256MB
387 * away from the base address of the FW heap.
388 * However, the order of FW heap and MM heap doesn't matter since these
389 * two heaps are taken care of by separate code to ensure they are adjacent
390 * to each other.
391 * Don't swap the order unless you know what you are doing!
392 */
Laura Abbottb93525f2012-04-12 09:57:19 -0700393static struct ion_platform_data msm8960_ion_pdata = {
Laura Abbott2d1760b2011-09-29 21:31:24 -0700394 .nr = MSM_ION_HEAP_NUM,
Laura Abbottd6183792011-08-19 13:42:24 -0700395 .heaps = {
396 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800397 .id = ION_SYSTEM_HEAP_ID,
Laura Abbottd6183792011-08-19 13:42:24 -0700398 .type = ION_HEAP_TYPE_SYSTEM,
Laura Abbottd6183792011-08-19 13:42:24 -0700399 .name = ION_VMALLOC_HEAP_NAME,
400 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700401#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -0700402 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800403 .id = ION_CP_MM_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800404 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800405 .name = ION_MM_HEAP_NAME,
406 .size = MSM_ION_MM_SIZE,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700407 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700408 .extra_data = (void *) &cp_mm_msm8960_ion_pdata,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700409 },
Laura Abbott8c017362011-09-22 20:59:12 -0700410 {
Olav Haugan42ebe712012-01-10 16:30:58 -0800411 .id = ION_MM_FIRMWARE_HEAP_ID,
412 .type = ION_HEAP_TYPE_CARVEOUT,
413 .name = ION_MM_FIRMWARE_HEAP_NAME,
414 .size = MSM_ION_MM_FW_SIZE,
415 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700416 .extra_data = (void *) &fw_co_msm8960_ion_pdata,
Olav Haugan42ebe712012-01-10 16:30:58 -0800417 },
418 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800419 .id = ION_CP_MFC_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800420 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800421 .name = ION_MFC_HEAP_NAME,
422 .size = MSM_ION_MFC_SIZE,
423 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700424 .extra_data = (void *) &cp_mfc_msm8960_ion_pdata,
Olav Hauganb5be7992011-11-18 14:29:02 -0800425 },
Olav Haugan32594552012-03-13 11:40:05 -0700426#ifndef CONFIG_MSM_IOMMU
Olav Hauganb5be7992011-11-18 14:29:02 -0800427 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800428 .id = ION_SF_HEAP_ID,
429 .type = ION_HEAP_TYPE_CARVEOUT,
430 .name = ION_SF_HEAP_NAME,
431 .size = MSM_ION_SF_SIZE,
432 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700433 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800434 },
Olav Haugan32594552012-03-13 11:40:05 -0700435#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800436 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800437 .id = ION_IOMMU_HEAP_ID,
Laura Abbott8c017362011-09-22 20:59:12 -0700438 .type = ION_HEAP_TYPE_IOMMU,
439 .name = ION_IOMMU_HEAP_NAME,
440 },
Olav Haugan80854eb2012-01-12 12:00:23 -0800441 {
442 .id = ION_QSECOM_HEAP_ID,
443 .type = ION_HEAP_TYPE_CARVEOUT,
444 .name = ION_QSECOM_HEAP_NAME,
445 .size = MSM_ION_QSECOM_SIZE,
446 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700447 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan80854eb2012-01-12 12:00:23 -0800448 },
Olav Haugan7355db02012-01-13 16:59:13 -0800449 {
450 .id = ION_AUDIO_HEAP_ID,
451 .type = ION_HEAP_TYPE_CARVEOUT,
452 .name = ION_AUDIO_HEAP_NAME,
453 .size = MSM_ION_AUDIO_SIZE,
454 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700455 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan7355db02012-01-13 16:59:13 -0800456 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700457#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700458 }
459};
460
Laura Abbottb93525f2012-04-12 09:57:19 -0700461static struct platform_device msm8960_ion_dev = {
Laura Abbottd6183792011-08-19 13:42:24 -0700462 .name = "ion-msm",
463 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700464 .dev = { .platform_data = &msm8960_ion_pdata },
Laura Abbottd6183792011-08-19 13:42:24 -0700465};
466#endif
467
Laura Abbottb93525f2012-04-12 09:57:19 -0700468struct platform_device msm8960_fmem_device = {
Larry Bassel41a055b2011-12-06 16:15:14 -0800469 .name = "fmem",
470 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700471 .dev = { .platform_data = &msm8960_fmem_pdata },
Larry Bassel41a055b2011-12-06 16:15:14 -0800472};
473
Olav Haugan65f4bd82011-12-13 11:50:08 -0800474static void __init adjust_mem_for_liquid(void)
Laura Abbottd6183792011-08-19 13:42:24 -0700475{
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800476 unsigned int i;
477
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800478 if (!pmem_param_set) {
479 if (machine_is_msm8960_liquid())
480 msm_ion_sf_size = MSM_LIQUID_ION_SF_SIZE;
481
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700482 if (msm8960_hdmi_as_primary_selected())
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800483 msm_ion_sf_size = MSM_HDMI_PRIM_ION_SF_SIZE;
484
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700485 if (machine_is_msm8960_liquid() ||
486 msm8960_hdmi_as_primary_selected()) {
Laura Abbottb93525f2012-04-12 09:57:19 -0700487 for (i = 0; i < msm8960_ion_pdata.nr; i++) {
488 if (msm8960_ion_pdata.heaps[i].id ==
489 ION_SF_HEAP_ID) {
490 msm8960_ion_pdata.heaps[i].size =
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800491 msm_ion_sf_size;
492 pr_debug("msm_ion_sf_size 0x%x\n",
493 msm_ion_sf_size);
494 break;
495 }
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800496 }
497 }
498 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800499}
500
501static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
502 unsigned long size)
503{
504 msm8960_reserve_table[mem_type].size += size;
505}
506
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700507static void __init msm8960_reserve_fixed_area(unsigned long fixed_area_size)
508{
509#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
510 int ret;
511
512 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
513 panic("fixed area size is larger than %dM\n",
514 MAX_FIXED_AREA_SIZE >> 20);
515
516 reserve_info->fixed_area_size = fixed_area_size;
517 reserve_info->fixed_area_start = MSM8960_FW_START;
518
519 ret = memblock_remove(reserve_info->fixed_area_start,
520 reserve_info->fixed_area_size);
521 BUG_ON(ret);
522#endif
523}
524
Olav Haugan65f4bd82011-12-13 11:50:08 -0800525/**
526 * Reserve memory for ION and calculate amount of reusable memory for fmem.
527 * We only reserve memory for heaps that are not reusable. However, we only
528 * support one reusable heap at the moment so we ignore the reusable flag for
529 * other than the first heap with reusable flag set. Also handle special case
Olav Hauganf6dc7742012-02-15 09:11:55 -0800530 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
531 * at a higher address than FW in addition to not more than 256MB away from the
532 * base address of the firmware. This means that if MM is reusable the other
533 * two heaps must be allocated in the same region as FW. This is handled by the
534 * mem_is_fmem flag in the platform data. In addition the MM heap must be
535 * adjacent to the FW heap for content protection purposes.
Olav Haugan65f4bd82011-12-13 11:50:08 -0800536 */
537static void __init reserve_ion_memory(void)
538{
539#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
540 unsigned int i;
541 unsigned int reusable_count = 0;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700542 unsigned int fixed_size = 0;
543 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
544 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800545
546 adjust_mem_for_liquid();
Laura Abbottb93525f2012-04-12 09:57:19 -0700547 msm8960_fmem_pdata.size = 0;
548 msm8960_fmem_pdata.reserved_size_low = 0;
549 msm8960_fmem_pdata.reserved_size_high = 0;
Olav Haugan8726caf2012-05-10 15:11:35 -0700550 msm8960_fmem_pdata.align = PAGE_SIZE;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700551 fixed_low_size = 0;
552 fixed_middle_size = 0;
553 fixed_high_size = 0;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800554
555 /* We only support 1 reusable heap. Check if more than one heap
556 * is specified as reusable and set as non-reusable if found.
557 */
Laura Abbottb93525f2012-04-12 09:57:19 -0700558 for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
559 const struct ion_platform_heap *heap =
560 &(msm8960_ion_pdata.heaps[i]);
Olav Haugan65f4bd82011-12-13 11:50:08 -0800561
562 if (heap->type == ION_HEAP_TYPE_CP && heap->extra_data) {
563 struct ion_cp_heap_pdata *data = heap->extra_data;
564
565 reusable_count += (data->reusable) ? 1 : 0;
566
567 if (data->reusable && reusable_count > 1) {
568 pr_err("%s: Too many heaps specified as "
569 "reusable. Heap %s was not configured "
570 "as reusable.\n", __func__, heap->name);
571 data->reusable = 0;
572 }
573 }
574 }
575
Laura Abbottb93525f2012-04-12 09:57:19 -0700576 for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
Olav Haugan8726caf2012-05-10 15:11:35 -0700577 struct ion_platform_heap *heap =
Laura Abbottb93525f2012-04-12 09:57:19 -0700578 &(msm8960_ion_pdata.heaps[i]);
Olav Haugan8726caf2012-05-10 15:11:35 -0700579 int align = SZ_4K;
580 int iommu_map_all = 0;
581 int adjacent_mem_id = INVALID_HEAP_ID;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800582
583 if (heap->extra_data) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700584 int fixed_position = NOT_FIXED;
585 int mem_is_fmem = 0;
586
Olav Haugan65f4bd82011-12-13 11:50:08 -0800587 switch (heap->type) {
588 case ION_HEAP_TYPE_CP:
Olav Hauganf6dc7742012-02-15 09:11:55 -0800589 mem_is_fmem = ((struct ion_cp_heap_pdata *)
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700590 heap->extra_data)->mem_is_fmem;
591 fixed_position = ((struct ion_cp_heap_pdata *)
592 heap->extra_data)->fixed_position;
Olav Haugan8726caf2012-05-10 15:11:35 -0700593 align = ((struct ion_cp_heap_pdata *)
594 heap->extra_data)->align;
595 iommu_map_all =
596 ((struct ion_cp_heap_pdata *)
597 heap->extra_data)->iommu_map_all;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800598 break;
599 case ION_HEAP_TYPE_CARVEOUT:
Olav Hauganf6dc7742012-02-15 09:11:55 -0800600 mem_is_fmem = ((struct ion_co_heap_pdata *)
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700601 heap->extra_data)->mem_is_fmem;
602 fixed_position = ((struct ion_co_heap_pdata *)
603 heap->extra_data)->fixed_position;
Olav Haugan8726caf2012-05-10 15:11:35 -0700604 adjacent_mem_id = ((struct ion_co_heap_pdata *)
605 heap->extra_data)->adjacent_mem_id;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700606 break;
607 default:
608 break;
609 }
610
Olav Haugan8726caf2012-05-10 15:11:35 -0700611 if (iommu_map_all) {
612 if (heap->size & (SZ_64K-1)) {
613 heap->size = ALIGN(heap->size, SZ_64K);
614 pr_info("Heap %s not aligned to 64K. Adjusting size to %x\n",
615 heap->name, heap->size);
616 }
617 }
618
619 if (mem_is_fmem && adjacent_mem_id != INVALID_HEAP_ID)
620 msm8960_fmem_pdata.align = align;
621
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700622 if (fixed_position != NOT_FIXED)
623 fixed_size += heap->size;
624 else
625 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
626
627 if (fixed_position == FIXED_LOW)
628 fixed_low_size += heap->size;
629 else if (fixed_position == FIXED_MIDDLE)
630 fixed_middle_size += heap->size;
631 else if (fixed_position == FIXED_HIGH)
632 fixed_high_size += heap->size;
633
634 if (mem_is_fmem)
Laura Abbottb93525f2012-04-12 09:57:19 -0700635 msm8960_fmem_pdata.size += heap->size;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700636 }
637 }
638
639 if (!fixed_size)
640 return;
641
Laura Abbottb93525f2012-04-12 09:57:19 -0700642 if (msm8960_fmem_pdata.size) {
643 msm8960_fmem_pdata.reserved_size_low = fixed_low_size;
644 msm8960_fmem_pdata.reserved_size_high = fixed_high_size;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700645 }
646
Larry Bassel4d4f4482012-04-04 11:26:09 -0700647 /* Since the fixed area may be carved out of lowmem,
648 * make sure the length is a multiple of 1M.
649 */
650 fixed_size = (fixed_size + MSM_MM_FW_SIZE + SECTION_SIZE - 1)
651 & SECTION_MASK;
652 msm8960_reserve_fixed_area(fixed_size);
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700653
654 fixed_low_start = MSM8960_FIXED_AREA_START;
655 fixed_middle_start = fixed_low_start + fixed_low_size;
656 fixed_high_start = fixed_middle_start + fixed_middle_size;
657
Laura Abbottb93525f2012-04-12 09:57:19 -0700658 for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
659 struct ion_platform_heap *heap = &(msm8960_ion_pdata.heaps[i]);
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700660
661 if (heap->extra_data) {
662 int fixed_position = NOT_FIXED;
663
664 switch (heap->type) {
665 case ION_HEAP_TYPE_CP:
666 fixed_position = ((struct ion_cp_heap_pdata *)
667 heap->extra_data)->fixed_position;
668 break;
669 case ION_HEAP_TYPE_CARVEOUT:
670 fixed_position = ((struct ion_co_heap_pdata *)
671 heap->extra_data)->fixed_position;
672 break;
673 default:
674 break;
675 }
676
677 switch (fixed_position) {
678 case FIXED_LOW:
679 heap->base = fixed_low_start;
680 break;
681 case FIXED_MIDDLE:
682 heap->base = fixed_middle_start;
683 break;
684 case FIXED_HIGH:
685 heap->base = fixed_high_start;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800686 break;
687 default:
688 break;
689 }
690 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800691 }
Laura Abbottd6183792011-08-19 13:42:24 -0700692#endif
693}
Huaibin Yanga5419422011-12-08 23:52:10 -0800694
695static void __init reserve_mdp_memory(void)
696{
697 msm8960_mdp_writeback(msm8960_reserve_table);
698}
699
Stephen Boyd668d7652012-04-25 11:31:01 -0700700static void __init reserve_cache_dump_memory(void)
Laura Abbott306bcc22012-03-08 11:24:53 -0800701{
702#ifdef CONFIG_MSM_CACHE_DUMP
Laura Abbott306bcc22012-03-08 11:24:53 -0800703 unsigned int total;
Laura Abbott306bcc22012-03-08 11:24:53 -0800704
Laura Abbott155ab6f2012-05-25 08:52:18 -0700705 total = msm8960_cache_dump_pdata.l1_size +
706 msm8960_cache_dump_pdata.l2_size;
Laura Abbott306bcc22012-03-08 11:24:53 -0800707 msm8960_reserve_table[MEMTYPE_EBI1].size += total;
Laura Abbott306bcc22012-03-08 11:24:53 -0800708#endif
709}
710
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700711static void __init msm8960_calculate_reserve_sizes(void)
712{
713 size_pmem_devices();
714 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700715 reserve_ion_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800716 reserve_mdp_memory();
Laura Abbottf8c03b92012-02-16 14:57:58 -0800717 reserve_rtb_memory();
Laura Abbott306bcc22012-03-08 11:24:53 -0800718 reserve_cache_dump_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700719}
720
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700721static struct reserve_info msm8960_reserve_info __initdata = {
722 .memtype_reserve_table = msm8960_reserve_table,
723 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700724 .reserve_fixed_area = msm8960_reserve_fixed_area,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700725 .paddr_to_memtype = msm8960_paddr_to_memtype,
726};
727
Larry Basselb4126da2011-07-18 14:31:33 -0700728static int msm8960_memory_bank_size(void)
729{
730 return 1<<29;
731}
732
733static void __init locate_unstable_memory(void)
734{
735 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
736 unsigned long bank_size;
737 unsigned long low, high;
738
739 bank_size = msm8960_memory_bank_size();
Larry Bassel4d4f4482012-04-04 11:26:09 -0700740 msm8960_reserve_info.bank_size = bank_size;
741
Larry Basselb4126da2011-07-18 14:31:33 -0700742 low = meminfo.bank[0].start;
743 high = mb->start + mb->size;
Olav Haugan62052e42011-10-28 14:28:32 -0700744
745 /* Check if 32 bit overflow occured */
746 if (high < mb->start)
747 high = ~0UL;
748
Larry Bassel4d4f4482012-04-04 11:26:09 -0700749 if (high < MAX_FIXED_AREA_SIZE + MSM8960_FIXED_AREA_START)
750 panic("fixed area extends beyond end of memory\n");
751
Larry Basselb4126da2011-07-18 14:31:33 -0700752 low &= ~(bank_size - 1);
753
754 if (high - low <= bank_size)
Larry Bassel4d4f4482012-04-04 11:26:09 -0700755 goto no_dmm;
Larry Basselb8d61022012-02-24 10:49:45 -0800756
Larry Basselb8d61022012-02-24 10:49:45 -0800757#ifdef CONFIG_ENABLE_DMM
Jack Cheung60eaeab2012-01-09 16:40:26 -0800758 msm8960_reserve_info.low_unstable_address = mb->start -
759 MIN_MEMORY_BLOCK_SIZE + mb->size;
Jack Cheung0b1987e2011-11-18 13:36:29 -0800760 msm8960_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
Larry Basselb4126da2011-07-18 14:31:33 -0700761 pr_info("low unstable address %lx max size %lx bank size %lx\n",
762 msm8960_reserve_info.low_unstable_address,
763 msm8960_reserve_info.max_unstable_size,
764 msm8960_reserve_info.bank_size);
Larry Bassel4d4f4482012-04-04 11:26:09 -0700765 return;
Larry Basselb8d61022012-02-24 10:49:45 -0800766#endif
Larry Bassel4d4f4482012-04-04 11:26:09 -0700767no_dmm:
768 msm8960_reserve_info.low_unstable_address = high;
769 msm8960_reserve_info.max_unstable_size = 0;
Larry Basselb4126da2011-07-18 14:31:33 -0700770}
771
Larry Basselb830e182011-10-14 10:46:55 -0700772static void __init place_movable_zone(void)
773{
Larry Basselb8d61022012-02-24 10:49:45 -0800774#ifdef CONFIG_ENABLE_DMM
Larry Basselb830e182011-10-14 10:46:55 -0700775 movable_reserved_start = msm8960_reserve_info.low_unstable_address;
776 movable_reserved_size = msm8960_reserve_info.max_unstable_size;
777 pr_info("movable zone start %lx size %lx\n",
778 movable_reserved_start, movable_reserved_size);
Larry Basselb8d61022012-02-24 10:49:45 -0800779#endif
Larry Basselb830e182011-10-14 10:46:55 -0700780}
781
782static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700783{
784 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700785 locate_unstable_memory();
Larry Basselb830e182011-10-14 10:46:55 -0700786 place_movable_zone();
787}
788
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800789static char prim_panel_name[PANEL_NAME_MAX_LEN];
790static char ext_panel_name[PANEL_NAME_MAX_LEN];
791static int __init prim_display_setup(char *param)
792{
793 if (strnlen(param, PANEL_NAME_MAX_LEN))
794 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
795 return 0;
796}
797early_param("prim_display", prim_display_setup);
798
799static int __init ext_display_setup(char *param)
800{
801 if (strnlen(param, PANEL_NAME_MAX_LEN))
802 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
803 return 0;
804}
805early_param("ext_display", ext_display_setup);
806
Larry Basselb830e182011-10-14 10:46:55 -0700807static void __init msm8960_reserve(void)
808{
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800809 msm8960_set_display_params(prim_panel_name, ext_panel_name);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700810 msm_reserve();
Laura Abbottb93525f2012-04-12 09:57:19 -0700811 if (msm8960_fmem_pdata.size) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700812#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Larry Bassel861985f2012-05-02 15:54:52 -0700813 if (reserve_info->fixed_area_size) {
814 msm8960_fmem_pdata.phys =
815 reserve_info->fixed_area_start + MSM_MM_FW_SIZE;
816 pr_info("mm fw at %lx (fixed) size %x\n",
817 reserve_info->fixed_area_start, MSM_MM_FW_SIZE);
818 pr_info("fmem start %lx (fixed) size %lx\n",
819 msm8960_fmem_pdata.phys,
820 msm8960_fmem_pdata.size);
821 }
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700822#endif
823 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700824}
825
Larry Bassela4414b12011-08-04 11:11:02 -0700826static int msm8960_change_memory_power(u64 start, u64 size,
827 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700828{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -0700829 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -0700830}
831
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700832static void __init msm8960_allocate_memory_regions(void)
833{
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800834 msm8960_allocate_fb_region();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700835}
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800836
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700837#ifdef CONFIG_WCD9310_CODEC
838
839#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
840
Patrick Lai3043fba2011-08-01 14:15:57 -0700841/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
842 * 4 micbiases are used to power various analog and digital
843 * microphones operating at 1800 mV. Technically, all micbiases
844 * can source from single cfilter since all microphones operate
845 * at the same voltage level. The arrangement below is to make
846 * sure all cfilters are exercised. LDO_H regulator ouput level
847 * does not need to be as high as 2.85V. It is choosen for
848 * microphone sensitivity purpose.
849 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530850static struct wcd9xxx_pdata tabla_platform_data = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700851 .slimbus_slave_device = {
852 .name = "tabla-slave",
853 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
854 },
855 .irq = MSM_GPIO_TO_INT(62),
856 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530857 .num_irqs = NR_WCD9XXX_IRQS,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700858 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -0700859 .micbias = {
860 .ldoh_v = TABLA_LDOH_2P85_V,
861 .cfilt1_mv = 1800,
Joonwoo Parkcf473b42012-03-29 19:48:16 -0700862 .cfilt2_mv = 2700,
Patrick Lai3043fba2011-08-01 14:15:57 -0700863 .cfilt3_mv = 1800,
864 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
865 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
866 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
867 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530868 },
869 .regulator = {
870 {
871 .name = "CDC_VDD_CP",
872 .min_uV = 1800000,
873 .max_uV = 1800000,
874 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
875 },
876 {
877 .name = "CDC_VDDA_RX",
878 .min_uV = 1800000,
879 .max_uV = 1800000,
880 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
881 },
882 {
883 .name = "CDC_VDDA_TX",
884 .min_uV = 1800000,
885 .max_uV = 1800000,
886 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
887 },
888 {
889 .name = "VDDIO_CDC",
890 .min_uV = 1800000,
891 .max_uV = 1800000,
892 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
893 },
894 {
895 .name = "VDDD_CDC_D",
896 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700897 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530898 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
899 },
900 {
901 .name = "CDC_VDDA_A_1P2V",
902 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700903 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530904 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
905 },
906 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700907};
908
909static struct slim_device msm_slim_tabla = {
910 .name = "tabla-slim",
911 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
912 .dev = {
913 .platform_data = &tabla_platform_data,
914 },
915};
Santosh Mardi60e19d92011-10-28 01:15:14 +0530916
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530917static struct wcd9xxx_pdata tabla20_platform_data = {
Santosh Mardi60e19d92011-10-28 01:15:14 +0530918 .slimbus_slave_device = {
919 .name = "tabla-slave",
920 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
921 },
922 .irq = MSM_GPIO_TO_INT(62),
923 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530924 .num_irqs = NR_WCD9XXX_IRQS,
Santosh Mardi60e19d92011-10-28 01:15:14 +0530925 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
926 .micbias = {
927 .ldoh_v = TABLA_LDOH_2P85_V,
928 .cfilt1_mv = 1800,
Joonwoo Parkcf473b42012-03-29 19:48:16 -0700929 .cfilt2_mv = 2700,
Santosh Mardi60e19d92011-10-28 01:15:14 +0530930 .cfilt3_mv = 1800,
931 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
932 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
933 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
934 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530935 },
936 .regulator = {
937 {
938 .name = "CDC_VDD_CP",
939 .min_uV = 1800000,
940 .max_uV = 1800000,
941 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
942 },
943 {
944 .name = "CDC_VDDA_RX",
945 .min_uV = 1800000,
946 .max_uV = 1800000,
947 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
948 },
949 {
950 .name = "CDC_VDDA_TX",
951 .min_uV = 1800000,
952 .max_uV = 1800000,
953 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
954 },
955 {
956 .name = "VDDIO_CDC",
957 .min_uV = 1800000,
958 .max_uV = 1800000,
959 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
960 },
961 {
962 .name = "VDDD_CDC_D",
963 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700964 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530965 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
966 },
967 {
968 .name = "CDC_VDDA_A_1P2V",
969 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700970 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530971 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
972 },
973 },
Santosh Mardi60e19d92011-10-28 01:15:14 +0530974};
975
976static struct slim_device msm_slim_tabla20 = {
977 .name = "tabla2x-slim",
978 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
979 .dev = {
980 .platform_data = &tabla20_platform_data,
981 },
982};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700983#endif
984
985static struct slim_boardinfo msm_slim_devices[] = {
986#ifdef CONFIG_WCD9310_CODEC
987 {
988 .bus_num = 1,
989 .slim_slave = &msm_slim_tabla,
990 },
Santosh Mardi60e19d92011-10-28 01:15:14 +0530991 {
992 .bus_num = 1,
993 .slim_slave = &msm_slim_tabla20,
994 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700995#endif
996 /* add more slimbus slaves as needed */
997};
998
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700999#define MSM_WCNSS_PHYS 0x03000000
1000#define MSM_WCNSS_SIZE 0x280000
1001
1002static struct resource resources_wcnss_wlan[] = {
1003 {
1004 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1005 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1006 .name = "wcnss_wlanrx_irq",
1007 .flags = IORESOURCE_IRQ,
1008 },
1009 {
1010 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1011 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1012 .name = "wcnss_wlantx_irq",
1013 .flags = IORESOURCE_IRQ,
1014 },
1015 {
1016 .start = MSM_WCNSS_PHYS,
1017 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1018 .name = "wcnss_mmio",
1019 .flags = IORESOURCE_MEM,
1020 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -07001021 {
1022 .start = 84,
1023 .end = 88,
1024 .name = "wcnss_gpios_5wire",
1025 .flags = IORESOURCE_IO,
1026 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001027};
1028
Ankur Nandwanib0039b02011-08-09 14:00:45 -07001029static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1030 .has_48mhz_xo = 1,
1031};
1032
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001033static struct platform_device msm_device_wcnss_wlan = {
1034 .name = "wcnss_wlan",
1035 .id = 0,
1036 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1037 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07001038 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001039};
1040
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001041#ifdef CONFIG_QSEECOM
1042/* qseecom bus scaling */
1043static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
1044 {
1045 .src = MSM_BUS_MASTER_SPS,
1046 .dst = MSM_BUS_SLAVE_EBI_CH0,
1047 .ib = 0,
1048 .ab = 0,
1049 },
1050 {
1051 .src = MSM_BUS_MASTER_SPDM,
1052 .dst = MSM_BUS_SLAVE_SPDM,
1053 .ib = 0,
1054 .ab = 0,
1055 },
1056};
1057
1058static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
1059 {
1060 .src = MSM_BUS_MASTER_SPS,
1061 .dst = MSM_BUS_SLAVE_EBI_CH0,
1062 .ib = (492 * 8) * 1000000UL,
1063 .ab = (492 * 8) * 100000UL,
1064 },
1065 {
1066 .src = MSM_BUS_MASTER_SPDM,
1067 .dst = MSM_BUS_SLAVE_SPDM,
1068 .ib = 0,
1069 .ab = 0,
1070 },
1071};
1072
1073static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1074 {
1075 .src = MSM_BUS_MASTER_SPS,
1076 .dst = MSM_BUS_SLAVE_EBI_CH0,
1077 .ib = 0,
1078 .ab = 0,
1079 },
1080 {
1081 .src = MSM_BUS_MASTER_SPDM,
1082 .dst = MSM_BUS_SLAVE_SPDM,
1083 .ib = (64 * 8) * 1000000UL,
1084 .ab = (64 * 8) * 100000UL,
1085 },
1086};
1087
1088static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1089 {
1090 ARRAY_SIZE(qseecom_clks_init_vectors),
1091 qseecom_clks_init_vectors,
1092 },
1093 {
1094 ARRAY_SIZE(qseecom_enable_dfab_vectors),
1095 qseecom_enable_sfpb_vectors,
1096 },
1097 {
1098 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1099 qseecom_enable_sfpb_vectors,
1100 },
1101};
1102
1103static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1104 qseecom_hw_bus_scale_usecases,
1105 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1106 .name = "qsee",
1107};
1108
1109static struct platform_device qseecom_device = {
1110 .name = "qseecom",
1111 .id = 0,
1112 .dev = {
1113 .platform_data = &qseecom_bus_pdata,
1114 },
1115};
1116#endif
1117
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001118#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1119 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1120 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1121 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1122
1123#define QCE_SIZE 0x10000
1124#define QCE_0_BASE 0x18500000
1125
1126#define QCE_HW_KEY_SUPPORT 0
1127#define QCE_SHA_HMAC_SUPPORT 1
1128#define QCE_SHARE_CE_RESOURCE 1
1129#define QCE_CE_SHARED 0
1130
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001131/* Begin Bus scaling definitions */
1132static struct msm_bus_vectors crypto_hw_init_vectors[] = {
1133 {
1134 .src = MSM_BUS_MASTER_ADM_PORT0,
1135 .dst = MSM_BUS_SLAVE_EBI_CH0,
1136 .ab = 0,
1137 .ib = 0,
1138 },
1139 {
1140 .src = MSM_BUS_MASTER_ADM_PORT1,
1141 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1142 .ab = 0,
1143 .ib = 0,
1144 },
1145};
1146
1147static struct msm_bus_vectors crypto_hw_active_vectors[] = {
1148 {
1149 .src = MSM_BUS_MASTER_ADM_PORT0,
1150 .dst = MSM_BUS_SLAVE_EBI_CH0,
1151 .ab = 70000000UL,
1152 .ib = 70000000UL,
1153 },
1154 {
1155 .src = MSM_BUS_MASTER_ADM_PORT1,
1156 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1157 .ab = 2480000000UL,
1158 .ib = 2480000000UL,
1159 },
1160};
1161
1162static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
1163 {
1164 ARRAY_SIZE(crypto_hw_init_vectors),
1165 crypto_hw_init_vectors,
1166 },
1167 {
1168 ARRAY_SIZE(crypto_hw_active_vectors),
1169 crypto_hw_active_vectors,
1170 },
1171};
1172
1173static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
1174 crypto_hw_bus_scale_usecases,
1175 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
1176 .name = "cryptohw",
1177};
1178/* End Bus Scaling Definitions*/
1179
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001180static struct resource qcrypto_resources[] = {
1181 [0] = {
1182 .start = QCE_0_BASE,
1183 .end = QCE_0_BASE + QCE_SIZE - 1,
1184 .flags = IORESOURCE_MEM,
1185 },
1186 [1] = {
1187 .name = "crypto_channels",
1188 .start = DMOV_CE_IN_CHAN,
1189 .end = DMOV_CE_OUT_CHAN,
1190 .flags = IORESOURCE_DMA,
1191 },
1192 [2] = {
1193 .name = "crypto_crci_in",
1194 .start = DMOV_CE_IN_CRCI,
1195 .end = DMOV_CE_IN_CRCI,
1196 .flags = IORESOURCE_DMA,
1197 },
1198 [3] = {
1199 .name = "crypto_crci_out",
1200 .start = DMOV_CE_OUT_CRCI,
1201 .end = DMOV_CE_OUT_CRCI,
1202 .flags = IORESOURCE_DMA,
1203 },
1204};
1205
1206static struct resource qcedev_resources[] = {
1207 [0] = {
1208 .start = QCE_0_BASE,
1209 .end = QCE_0_BASE + QCE_SIZE - 1,
1210 .flags = IORESOURCE_MEM,
1211 },
1212 [1] = {
1213 .name = "crypto_channels",
1214 .start = DMOV_CE_IN_CHAN,
1215 .end = DMOV_CE_OUT_CHAN,
1216 .flags = IORESOURCE_DMA,
1217 },
1218 [2] = {
1219 .name = "crypto_crci_in",
1220 .start = DMOV_CE_IN_CRCI,
1221 .end = DMOV_CE_IN_CRCI,
1222 .flags = IORESOURCE_DMA,
1223 },
1224 [3] = {
1225 .name = "crypto_crci_out",
1226 .start = DMOV_CE_OUT_CRCI,
1227 .end = DMOV_CE_OUT_CRCI,
1228 .flags = IORESOURCE_DMA,
1229 },
1230};
1231
1232#endif
1233
1234#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1235 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1236
1237static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1238 .ce_shared = QCE_CE_SHARED,
1239 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1240 .hw_key_support = QCE_HW_KEY_SUPPORT,
1241 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001242 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001243};
1244
1245static struct platform_device qcrypto_device = {
1246 .name = "qcrypto",
1247 .id = 0,
1248 .num_resources = ARRAY_SIZE(qcrypto_resources),
1249 .resource = qcrypto_resources,
1250 .dev = {
1251 .coherent_dma_mask = DMA_BIT_MASK(32),
1252 .platform_data = &qcrypto_ce_hw_suppport,
1253 },
1254};
1255#endif
1256
1257#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1258 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1259
1260static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1261 .ce_shared = QCE_CE_SHARED,
1262 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1263 .hw_key_support = QCE_HW_KEY_SUPPORT,
1264 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001265 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001266};
1267
1268static struct platform_device qcedev_device = {
1269 .name = "qce",
1270 .id = 0,
1271 .num_resources = ARRAY_SIZE(qcedev_resources),
1272 .resource = qcedev_resources,
1273 .dev = {
1274 .coherent_dma_mask = DMA_BIT_MASK(32),
1275 .platform_data = &qcedev_ce_hw_suppport,
1276 },
1277};
1278#endif
1279
Joel King0cbf5d82012-05-24 15:21:38 -07001280static struct mdm_platform_data sglte_platform_data = {
1281 .mdm_version = "4.0",
1282 .ramdump_delay_ms = 1000,
Joel King63ce8332012-06-01 09:59:26 -07001283 .soft_reset_inverted = 1,
Joel King0cbf5d82012-05-24 15:21:38 -07001284 .peripheral_platform_device = NULL,
Joel Kingb8352a12011-11-15 18:46:24 -08001285};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001286
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001287#define MSM_SHARED_RAM_PHYS 0x80000000
1288
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001289static void __init msm8960_map_io(void)
1290{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001291 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001292 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001293
1294 if (socinfo_init() < 0)
1295 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001296}
1297
1298static void __init msm8960_init_irq(void)
1299{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001300 struct msm_mpm_device_data *data = NULL;
1301
1302#ifdef CONFIG_MSM_MPM
1303 data = &msm8960_mpm_dev_data;
1304#endif
1305
1306 msm_mpm_irq_extn_init(data);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001307 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001308 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001309}
1310
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001311static void __init msm8960_init_buses(void)
1312{
1313#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -06001314 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -06001315 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
1316 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
1317 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
1318 msm_bus_apps_fabric.dev.platform_data =
1319 &msm_bus_8960_apps_fabric_pdata;
1320 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
1321 msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
1322 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
1323 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001324#endif
1325}
1326
1327static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
1328 .max_clock_speed = 15060000,
1329};
1330
1331#ifdef CONFIG_USB_MSM_OTG_72K
1332static struct msm_otg_platform_data msm_otg_pdata;
1333#else
Anji jonnalaa8b8d732011-12-06 10:03:24 +05301334static int wr_phy_init_seq[] = {
1335 0x44, 0x80, /* set VBUS valid threshold
1336 and disconnect valid threshold */
1337 0x38, 0x81, /* update DC voltage level */
1338 0x14, 0x82, /* set preemphasis and rise/fall time */
1339 0x13, 0x83, /* set source impedance adjusment */
1340 -1};
1341
1342static int liquid_v1_phy_init_seq[] = {
1343 0x44, 0x80,/* set VBUS valid threshold
1344 and disconnect valid threshold */
1345 0x3C, 0x81,/* update DC voltage level */
1346 0x18, 0x82,/* set preemphasis and rise/fall time */
1347 0x23, 0x83,/* set source impedance sdjusment */
1348 -1};
1349
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301350#ifdef CONFIG_MSM_BUS_SCALING
1351/* Bandwidth requests (zero) if no vote placed */
1352static struct msm_bus_vectors usb_init_vectors[] = {
1353 {
1354 .src = MSM_BUS_MASTER_SPS,
1355 .dst = MSM_BUS_SLAVE_EBI_CH0,
1356 .ab = 0,
1357 .ib = 0,
1358 },
1359};
1360
1361/* Bus bandwidth requests in Bytes/sec */
1362static struct msm_bus_vectors usb_max_vectors[] = {
1363 {
1364 .src = MSM_BUS_MASTER_SPS,
1365 .dst = MSM_BUS_SLAVE_EBI_CH0,
1366 .ab = 60000000, /* At least 480Mbps on bus. */
1367 .ib = 960000000, /* MAX bursts rate */
1368 },
1369};
1370
1371static struct msm_bus_paths usb_bus_scale_usecases[] = {
1372 {
1373 ARRAY_SIZE(usb_init_vectors),
1374 usb_init_vectors,
1375 },
1376 {
1377 ARRAY_SIZE(usb_max_vectors),
1378 usb_max_vectors,
1379 },
1380};
1381
1382static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
1383 usb_bus_scale_usecases,
1384 ARRAY_SIZE(usb_bus_scale_usecases),
1385 .name = "usb",
1386};
1387#endif
1388
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001389static struct msm_otg_platform_data msm_otg_pdata = {
1390 .mode = USB_OTG,
1391 .otg_control = OTG_PMIC_CONTROL,
1392 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001393 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
Anji jonnala4e3e6772011-09-15 18:53:42 +05301394 .power_budget = 750,
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301395#ifdef CONFIG_MSM_BUS_SCALING
1396 .bus_scale_table = &usb_bus_scale_pdata,
1397#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001398};
1399#endif
1400
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301401#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05301402#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301403static struct msm_hsic_host_platform_data msm_hsic_pdata = {
1404 .strobe = 150,
1405 .data = 151,
1406};
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301407
1408static struct smsc_hub_platform_data hsic_hub_pdata = {
1409 .hub_reset = HSIC_HUB_RESET_GPIO,
1410};
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301411#else
1412static struct msm_hsic_host_platform_data msm_hsic_pdata;
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301413static struct smsc_hub_platform_data hsic_hub_pdata;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301414#endif
1415
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301416static struct platform_device smsc_hub_device = {
1417 .name = "msm_smsc_hub",
1418 .id = -1,
1419 .dev = {
1420 .platform_data = &hsic_hub_pdata,
1421 },
1422};
1423
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001424#define PID_MAGIC_ID 0x71432909
1425#define SERIAL_NUM_MAGIC_ID 0x61945374
1426#define SERIAL_NUMBER_LENGTH 127
1427#define DLOAD_USB_BASE_ADD 0x2A03F0C8
1428
1429struct magic_num_struct {
1430 uint32_t pid;
1431 uint32_t serial_num;
1432};
1433
1434struct dload_struct {
1435 uint32_t reserved1;
1436 uint32_t reserved2;
1437 uint32_t reserved3;
1438 uint16_t reserved4;
1439 uint16_t pid;
1440 char serial_number[SERIAL_NUMBER_LENGTH];
1441 uint16_t reserved5;
1442 struct magic_num_struct magic_struct;
1443};
1444
1445static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
1446{
1447 struct dload_struct __iomem *dload = 0;
1448
1449 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
1450 if (!dload) {
1451 pr_err("%s: cannot remap I/O memory region: %08x\n",
1452 __func__, DLOAD_USB_BASE_ADD);
1453 return -ENXIO;
1454 }
1455
1456 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
1457 __func__, dload, pid, snum);
1458 /* update pid */
1459 dload->magic_struct.pid = PID_MAGIC_ID;
1460 dload->pid = pid;
1461
1462 /* update serial number */
1463 dload->magic_struct.serial_num = 0;
1464 if (!snum) {
1465 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
1466 goto out;
1467 }
1468
1469 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -07001470 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001471out:
1472 iounmap(dload);
1473 return 0;
1474}
1475
1476static struct android_usb_platform_data android_usb_pdata = {
1477 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1478};
1479
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001480static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001481 .name = "android_usb",
1482 .id = -1,
1483 .dev = {
1484 .platform_data = &android_usb_pdata,
1485 },
1486};
1487
1488static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1489 0x03, 0x0f,
1490};
1491
1492static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1493 0x00, 0x24, 0x54, 0x10,
1494 0x09, 0x03, 0x01,
1495 0x10, 0x54, 0x30, 0x0C,
1496 0x24, 0x30, 0x0f,
1497};
1498
1499static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1500 0x00, 0x24, 0x54, 0x10,
1501 0x09, 0x07, 0x01, 0x0B,
1502 0x10, 0x54, 0x30, 0x0C,
1503 0x24, 0x30, 0x0f,
1504};
1505
1506static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1507 [0] = {
1508 .mode = MSM_SPM_MODE_CLOCK_GATING,
1509 .notify_rpm = false,
1510 .cmd = spm_wfi_cmd_sequence,
1511 },
1512 [1] = {
1513 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1514 .notify_rpm = false,
1515 .cmd = spm_power_collapse_without_rpm,
1516 },
1517 [2] = {
1518 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1519 .notify_rpm = true,
1520 .cmd = spm_power_collapse_with_rpm,
1521 },
1522};
1523
1524static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1525 [0] = {
1526 .reg_base_addr = MSM_SAW0_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001527 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001528#if defined(CONFIG_MSM_AVS_HW)
1529 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1530 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1531#endif
1532 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001533 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001534 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1535 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1536 .vctl_timeout_us = 50,
1537 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1538 .modes = msm_spm_seq_list,
1539 },
1540 [1] = {
1541 .reg_base_addr = MSM_SAW1_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001542 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001543#if defined(CONFIG_MSM_AVS_HW)
1544 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1545 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1546#endif
1547 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001548 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001549 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1550 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1551 .vctl_timeout_us = 50,
1552 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1553 .modes = msm_spm_seq_list,
1554 },
1555};
1556
1557static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1558 0x00, 0x20, 0x03, 0x20,
1559 0x00, 0x0f,
1560};
1561
1562static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1563 0x00, 0x20, 0x34, 0x64,
1564 0x48, 0x07, 0x48, 0x20,
1565 0x50, 0x64, 0x04, 0x34,
1566 0x50, 0x0f,
1567};
1568static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1569 0x00, 0x10, 0x34, 0x64,
1570 0x48, 0x07, 0x48, 0x10,
1571 0x50, 0x64, 0x04, 0x34,
1572 0x50, 0x0F,
1573};
1574
1575static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1576 [0] = {
1577 .mode = MSM_SPM_L2_MODE_RETENTION,
1578 .notify_rpm = false,
1579 .cmd = l2_spm_wfi_cmd_sequence,
1580 },
1581 [1] = {
1582 .mode = MSM_SPM_L2_MODE_GDHS,
1583 .notify_rpm = true,
1584 .cmd = l2_spm_gdhs_cmd_sequence,
1585 },
1586 [2] = {
1587 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1588 .notify_rpm = true,
1589 .cmd = l2_spm_power_off_cmd_sequence,
1590 },
1591};
1592
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001593static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1594 [0] = {
1595 .reg_base_addr = MSM_SAW_L2_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001596 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001597 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001598 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1599 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1600 .modes = msm_spm_l2_seq_list,
1601 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1602 },
1603};
1604
Mohan Pallaka5e490392011-09-09 15:18:41 +05301605#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1606#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
1607
1608static struct msm_xo_voter *xo_handle_d1;
1609
1610static int isa1200_power(int on)
1611{
1612 int rc = 0;
1613
1614 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !!on);
1615
1616 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
1617 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
1618 if (rc < 0) {
1619 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
1620 __func__, on ? "" : "de-", rc);
1621 goto err_xo_vote;
1622 }
1623
1624 return 0;
1625
1626err_xo_vote:
1627 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !on);
1628 return rc;
1629}
1630
1631static int isa1200_dev_setup(bool enable)
1632{
1633 int rc = 0;
1634
1635 struct pm_gpio hap_gpio_config = {
1636 .direction = PM_GPIO_DIR_OUT,
1637 .pull = PM_GPIO_PULL_NO,
1638 .out_strength = PM_GPIO_STRENGTH_HIGH,
1639 .function = PM_GPIO_FUNC_NORMAL,
1640 .inv_int_pol = 0,
1641 .vin_sel = 2,
1642 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1643 .output_value = 0,
1644 };
1645
1646 if (enable == true) {
1647 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
1648 if (rc) {
1649 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1650 __func__, PM_HAP_EN_GPIO, rc);
1651 return rc;
1652 }
1653
1654 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
1655 if (rc) {
1656 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1657 __func__, PM_HAP_LEN_GPIO, rc);
1658 return rc;
1659 }
1660
1661 rc = gpio_request(HAP_SHIFT_LVL_OE_GPIO, "hap_shft_lvl_oe");
1662 if (rc) {
1663 pr_err("%s: unable to request gpio %d (%d)\n",
1664 __func__, HAP_SHIFT_LVL_OE_GPIO, rc);
1665 return rc;
1666 }
1667
1668 rc = gpio_direction_output(HAP_SHIFT_LVL_OE_GPIO, 0);
1669 if (rc) {
1670 pr_err("%s: Unable to set direction\n", __func__);
1671 goto free_gpio;
1672 }
1673
1674 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
1675 if (IS_ERR(xo_handle_d1)) {
1676 rc = PTR_ERR(xo_handle_d1);
1677 pr_err("%s: failed to get the handle for D1(%d)\n",
1678 __func__, rc);
1679 goto gpio_set_dir;
1680 }
1681 } else {
1682 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1683
1684 msm_xo_put(xo_handle_d1);
1685 }
1686
1687 return 0;
1688
1689gpio_set_dir:
1690 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, 0);
1691free_gpio:
1692 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1693 return rc;
1694}
1695
1696static struct isa1200_regulator isa1200_reg_data[] = {
1697 {
1698 .name = "vcc_i2c",
1699 .min_uV = ISA_I2C_VTG_MIN_UV,
1700 .max_uV = ISA_I2C_VTG_MAX_UV,
1701 .load_uA = ISA_I2C_CURR_UA,
1702 },
1703};
1704
1705static struct isa1200_platform_data isa1200_1_pdata = {
1706 .name = "vibrator",
1707 .dev_setup = isa1200_dev_setup,
1708 .power_on = isa1200_power,
1709 .hap_en_gpio = PM_HAP_EN_GPIO,
1710 .hap_len_gpio = PM_HAP_LEN_GPIO,
1711 .max_timeout = 15000,
1712 .mode_ctrl = PWM_GEN_MODE,
1713 .pwm_fd = {
1714 .pwm_div = 256,
1715 },
1716 .is_erm = false,
1717 .smart_en = true,
1718 .ext_clk_en = true,
1719 .chip_en = 1,
1720 .regulator_info = isa1200_reg_data,
1721 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1722};
1723
1724static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1725 {
1726 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
Mohan Pallaka5e490392011-09-09 15:18:41 +05301727 },
1728};
1729
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001730#define CYTTSP_TS_GPIO_IRQ 11
1731#define CYTTSP_TS_SLEEP_GPIO 50
1732#define CYTTSP_TS_RESOUT_N_GPIO 52
1733
1734/*virtual key support */
1735static ssize_t tma340_vkeys_show(struct kobject *kobj,
1736 struct kobj_attribute *attr, char *buf)
1737{
1738 return snprintf(buf, 200,
1739 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1740 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1741 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1742 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1743 "\n");
1744}
1745
1746static struct kobj_attribute tma340_vkeys_attr = {
1747 .attr = {
1748 .mode = S_IRUGO,
1749 },
1750 .show = &tma340_vkeys_show,
1751};
1752
1753static struct attribute *tma340_properties_attrs[] = {
1754 &tma340_vkeys_attr.attr,
1755 NULL
1756};
1757
1758static struct attribute_group tma340_properties_attr_group = {
1759 .attrs = tma340_properties_attrs,
1760};
1761
1762
1763static int cyttsp_platform_init(struct i2c_client *client)
1764{
1765 int rc = 0;
1766 static struct kobject *tma340_properties_kobj;
1767
1768 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1769 tma340_properties_kobj = kobject_create_and_add("board_properties",
1770 NULL);
1771 if (tma340_properties_kobj)
1772 rc = sysfs_create_group(tma340_properties_kobj,
1773 &tma340_properties_attr_group);
1774 if (!tma340_properties_kobj || rc)
1775 pr_err("%s: failed to create board_properties\n",
1776 __func__);
1777
1778 return 0;
1779}
1780
1781static struct cyttsp_regulator regulator_data[] = {
1782 {
1783 .name = "vdd",
1784 .min_uV = CY_TMA300_VTG_MIN_UV,
1785 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301786 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1787 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001788 },
1789 /* TODO: Remove after runtime PM is enabled in I2C driver */
1790 {
1791 .name = "vcc_i2c",
1792 .min_uV = CY_I2C_VTG_MIN_UV,
1793 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301794 .hpm_load_uA = CY_I2C_CURR_UA,
1795 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001796 },
1797};
1798
1799static struct cyttsp_platform_data cyttsp_pdata = {
1800 .panel_maxx = 634,
1801 .panel_maxy = 1166,
1802 .disp_maxx = 616,
1803 .disp_maxy = 1023,
1804 .disp_minx = 0,
1805 .disp_miny = 16,
1806 .flags = 0x01,
1807 .gen = CY_GEN3, /* or */
1808 .use_st = CY_USE_ST,
1809 .use_mt = CY_USE_MT,
1810 .use_hndshk = CY_SEND_HNDSHK,
1811 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05301812 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001813 .use_gestures = CY_USE_GESTURES,
1814 .fw_fname = "cyttsp_8960_cdp.hex",
1815 /* activate up to 4 groups
1816 * and set active distance
1817 */
1818 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
1819 CY_GEST_GRP3 | CY_GEST_GRP4 |
1820 CY_ACT_DIST,
1821 /* change act_intrvl to customize the Active power state
1822 * scanning/processing refresh interval for Operating mode
1823 */
1824 .act_intrvl = CY_ACT_INTRVL_DFLT,
1825 /* change tch_tmout to customize the touch timeout for the
1826 * Active power state for Operating mode
1827 */
1828 .tch_tmout = CY_TCH_TMOUT_DFLT,
1829 /* change lp_intrvl to customize the Low Power power state
1830 * scanning/processing refresh interval for Operating mode
1831 */
1832 .lp_intrvl = CY_LP_INTRVL_DFLT,
1833 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
1834 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
1835 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1836 .regulator_info = regulator_data,
1837 .num_regulators = ARRAY_SIZE(regulator_data),
1838 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05301839 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001840};
1841
1842static struct i2c_board_info cyttsp_info[] __initdata = {
1843 {
1844 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1845 .platform_data = &cyttsp_pdata,
1846#ifndef CY_USE_TIMER
1847 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1848#endif /* CY_USE_TIMER */
1849 },
1850};
1851
Jing Lindc4413c2012-01-16 15:22:52 -08001852/* configuration data for mxt1386 */
1853static const u8 mxt1386_config_data[] = {
Mohan Pallaka50837382011-09-07 11:00:57 +05301854 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001855 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301856 /* T38 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001857 11, 2, 0, 11, 11, 11, 0, 0, 0, 0,
Jing Lin2f863172011-10-17 10:56:58 -07001858 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1859 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1860 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1861 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1862 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1863 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301864 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001865 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05301866 /* T8 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001867 8, 0, 0, 0, 0, 0, 8, 14, 50, 215,
Mohan Pallaka50837382011-09-07 11:00:57 +05301868 /* T9 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001869 131, 0, 0, 26, 42, 0, 32, 63, 3, 5,
1870 0, 2, 1, 113, 10, 10, 8, 10, 255, 2,
1871 85, 5, 0, 0, 20, 20, 75, 25, 202, 29,
1872 10, 10, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05301873 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001874 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1875 0,
Anirudh Ghayaldab4e0d2012-01-09 14:59:27 +05301876 /* T18 Object */
1877 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301878 /* T22 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001879 5, 0, 0, 0, 0, 0, 0, 0, 30, 0,
1880 0, 0, 5, 8, 10, 13, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301881 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001882 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1883 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301884 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001885 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
1886 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301887 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001888 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301889 /* T28 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001890 0, 0, 0, 8, 12, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05301891 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001892 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301893 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001894 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301895 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001896 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301897};
1898
Jing Lin33b007d2011-12-21 17:40:23 -08001899/* configuration data for mxt1386e using V1.0 firmware */
1900static const u8 mxt1386e_config_data_v1_0[] = {
1901 /* T6 Object */
1902 0, 0, 0, 0, 0, 0,
1903 /* T38 Object */
1904 12, 1, 0, 17, 1, 12, 0, 0, 0, 0,
1905 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1906 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1907 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1908 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1909 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1910 0, 0, 0, 0,
1911 /* T7 Object */
1912 100, 16, 50,
1913 /* T8 Object */
1914 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
1915 /* T9 Object */
1916 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
1917 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
1918 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
1919 10, 5, 0, 0, 0,
1920 /* T18 Object */
1921 0, 0,
1922 /* T24 Object */
1923 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1924 0, 0, 0, 0, 0, 0, 0, 0, 0,
1925 /* T25 Object */
1926 3, 0, 60, 115, 156, 99,
1927 /* T27 Object */
1928 0, 0, 0, 0, 0, 0, 0,
1929 /* T40 Object */
1930 0, 0, 0, 0, 0,
1931 /* T42 Object */
1932 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
1933 /* T43 Object */
1934 0, 0, 0, 0, 0, 0, 0,
1935 /* T46 Object */
1936 64, 0, 20, 20, 0, 0, 0, 0, 0,
1937 /* T47 Object */
1938 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
1939 /* T48 Object */
1940 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
1941 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
1942 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
1943 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
1944 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1945 0, 0, 0, 0,
1946 /* T56 Object */
1947 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1948 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1949 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1950 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1951 2, 99, 33,
1952};
1953
1954/* configuration data for mxt1386e using V2.1 firmware */
1955static const u8 mxt1386e_config_data_v2_1[] = {
1956 /* T6 Object */
1957 0, 0, 0, 0, 0, 0,
1958 /* T38 Object */
Jing Lin763f4772012-05-25 13:39:40 -07001959 12, 3, 0, 24, 5, 12, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08001960 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1961 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1962 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1963 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1964 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1965 0, 0, 0, 0,
1966 /* T7 Object */
1967 100, 16, 50,
1968 /* T8 Object */
1969 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
1970 /* T9 Object */
Jing Lin763f4772012-05-25 13:39:40 -07001971 139, 0, 0, 26, 42, 0, 32, 80, 2, 5,
Jing Lin33b007d2011-12-21 17:40:23 -08001972 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
1973 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
1974 10, 5, 0, 0, 0,
1975 /* T18 Object */
1976 0, 0,
1977 /* T24 Object */
1978 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1979 0, 0, 0, 0, 0, 0, 0, 0, 0,
1980 /* T25 Object */
Jing Lin763f4772012-05-25 13:39:40 -07001981 1, 0, 60, 115, 156, 99,
Jing Lin33b007d2011-12-21 17:40:23 -08001982 /* T27 Object */
1983 0, 0, 0, 0, 0, 0, 0,
1984 /* T40 Object */
1985 0, 0, 0, 0, 0,
1986 /* T42 Object */
Jing Lin763f4772012-05-25 13:39:40 -07001987 0, 0, 255, 0, 255, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08001988 /* T43 Object */
1989 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
1990 16,
1991 /* T46 Object */
1992 64, 0, 20, 20, 0, 0, 0, 0, 0,
1993 /* T47 Object */
1994 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
1995 /* T48 Object */
Jing Lin763f4772012-05-25 13:39:40 -07001996 1, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08001997 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
1998 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
1999 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
2000 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2001 0, 0, 0, 0,
2002 /* T56 Object */
2003 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2004 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2005 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2006 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2007 2, 99, 33, 0, 149, 24, 193, 255, 255, 255,
2008 255,
2009};
2010
Jing Lineec88ca2012-02-08 11:18:30 -08002011/* configuration data for mxt1386e on 3D SKU using V2.1 firmware */
2012static const u8 mxt1386e_config_data_3d[] = {
2013 /* T6 Object */
2014 0, 0, 0, 0, 0, 0,
2015 /* T38 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002016 13, 1, 0, 23, 2, 12, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002017 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2018 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2019 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2020 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2021 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2022 0, 0, 0, 0,
2023 /* T7 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002024 100, 10, 50,
Jing Lineec88ca2012-02-08 11:18:30 -08002025 /* T8 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002026 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002027 /* T9 Object */
2028 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
2029 0, 5, 5, 0, 10, 30, 10, 10, 175, 4,
Jing Lin66ba78b2012-02-24 21:25:12 -08002030 127, 7, 26, 21, 17, 19, 143, 35, 207, 40,
2031 20, 5, 54, 49, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002032 /* T18 Object */
2033 0, 0,
2034 /* T24 Object */
2035 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2036 0, 0, 0, 0, 0, 0, 0, 0, 0,
2037 /* T25 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002038 0, 0, 72, 113, 168, 97,
Jing Lineec88ca2012-02-08 11:18:30 -08002039 /* T27 Object */
2040 0, 0, 0, 0, 0, 0, 0,
2041 /* T40 Object */
2042 0, 0, 0, 0, 0,
2043 /* T42 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002044 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002045 /* T43 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002046 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2047 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002048 /* T46 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002049 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002050 /* T47 Object */
2051 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2052 /* T48 Object */
2053 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08002054 32, 50, 0, 10, 10, 0, 0, 100, 10, 90,
2055 0, 0, 0, 0, 0, 0, 0, 10, 1, 30,
2056 52, 10, 5, 0, 33, 0, 1, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002057 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2058 0, 0, 0, 0,
2059 /* T56 Object */
2060 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2061 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2062 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2063 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08002064 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2065 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002066};
2067
Amy Maloche08266db2011-11-04 11:07:16 -07002068#define MXT_TS_GPIO_IRQ 11
2069#define MXT_TS_LDO_EN_GPIO 50
2070#define MXT_TS_RESET_GPIO 52
Mohan Pallaka50837382011-09-07 11:00:57 +05302071
2072static void mxt_init_hw_liquid(void)
2073{
2074 int rc;
2075
Mohan Pallaka50837382011-09-07 11:00:57 +05302076 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
2077 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07002078 pr_err("%s: unable to request mxt_ldo_en_gpio [%d]\n",
2079 __func__, MXT_TS_LDO_EN_GPIO);
2080 return;
Mohan Pallaka50837382011-09-07 11:00:57 +05302081 }
2082
2083 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
2084 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07002085 pr_err("%s: unable to set_direction for mxt_ldo_en_gpio [%d]\n",
2086 __func__, MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05302087 goto err_ldo_gpio_req;
2088 }
2089
Mohan Pallaka50837382011-09-07 11:00:57 +05302090 return;
2091
Mohan Pallaka50837382011-09-07 11:00:57 +05302092err_ldo_gpio_req:
2093 gpio_free(MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05302094}
2095
Jing Lineec88ca2012-02-08 11:18:30 -08002096static struct mxt_config_info mxt_config_array_2d[] = {
Jing Lindc4413c2012-01-16 15:22:52 -08002097 {
2098 .config = mxt1386_config_data,
2099 .config_length = ARRAY_SIZE(mxt1386_config_data),
2100 .family_id = 0xA0,
2101 .variant_id = 0x0,
2102 .version = 0x10,
2103 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002104 .bootldr_id = MXT_BOOTLOADER_ID_1386,
Jing Lindc4413c2012-01-16 15:22:52 -08002105 },
Jing Lin33b007d2011-12-21 17:40:23 -08002106 {
2107 .config = mxt1386e_config_data_v1_0,
2108 .config_length = ARRAY_SIZE(mxt1386e_config_data_v1_0),
2109 .family_id = 0xA0,
2110 .variant_id = 0x2,
2111 .version = 0x10,
2112 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002113 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Linaeaeed52012-03-26 14:57:15 -07002114 .fw_name = "atmel_8960_liquid_v2_2_AA.hex",
Jing Lin33b007d2011-12-21 17:40:23 -08002115 },
2116 {
2117 .config = mxt1386e_config_data_v2_1,
2118 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
2119 .family_id = 0xA0,
2120 .variant_id = 0x7,
2121 .version = 0x21,
2122 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002123 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Linaeaeed52012-03-26 14:57:15 -07002124 .fw_name = "atmel_8960_liquid_v2_2_AA.hex",
2125 },
2126 {
2127 /* The config data for V2.2.AA is the same as for V2.1.AA */
2128 .config = mxt1386e_config_data_v2_1,
2129 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
2130 .family_id = 0xA0,
2131 .variant_id = 0x7,
2132 .version = 0x22,
2133 .build = 0xAA,
2134 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin33b007d2011-12-21 17:40:23 -08002135 },
Jing Lindc4413c2012-01-16 15:22:52 -08002136};
2137
Jing Lineec88ca2012-02-08 11:18:30 -08002138static struct mxt_platform_data mxt_platform_data_2d = {
2139 .config_array = mxt_config_array_2d,
2140 .config_array_size = ARRAY_SIZE(mxt_config_array_2d),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002141 .panel_minx = 0,
2142 .panel_maxx = 1365,
2143 .panel_miny = 0,
2144 .panel_maxy = 767,
2145 .disp_minx = 0,
2146 .disp_maxx = 1365,
2147 .disp_miny = 0,
2148 .disp_maxy = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05302149 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07002150 .i2c_pull_up = true,
Amy Maloche08266db2011-11-04 11:07:16 -07002151 .reset_gpio = MXT_TS_RESET_GPIO,
2152 .irq_gpio = MXT_TS_GPIO_IRQ,
Mohan Pallaka50837382011-09-07 11:00:57 +05302153};
2154
Jing Lineec88ca2012-02-08 11:18:30 -08002155static struct mxt_config_info mxt_config_array_3d[] = {
2156 {
2157 .config = mxt1386e_config_data_3d,
2158 .config_length = ARRAY_SIZE(mxt1386e_config_data_3d),
2159 .family_id = 0xA0,
2160 .variant_id = 0x7,
2161 .version = 0x21,
2162 .build = 0xAA,
2163 },
2164};
2165
2166static struct mxt_platform_data mxt_platform_data_3d = {
2167 .config_array = mxt_config_array_3d,
2168 .config_array_size = ARRAY_SIZE(mxt_config_array_3d),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002169 .panel_minx = 0,
2170 .panel_maxx = 1919,
2171 .panel_miny = 0,
2172 .panel_maxy = 1199,
2173 .disp_minx = 0,
2174 .disp_maxx = 1919,
2175 .disp_miny = 0,
2176 .disp_maxy = 1199,
Jing Lineec88ca2012-02-08 11:18:30 -08002177 .irqflags = IRQF_TRIGGER_FALLING,
2178 .i2c_pull_up = true,
2179 .reset_gpio = MXT_TS_RESET_GPIO,
2180 .irq_gpio = MXT_TS_GPIO_IRQ,
2181};
2182
Mohan Pallaka50837382011-09-07 11:00:57 +05302183static struct i2c_board_info mxt_device_info[] __initdata = {
2184 {
2185 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
Mohan Pallaka50837382011-09-07 11:00:57 +05302186 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
2187 },
2188};
2189
Manoj Rao14648742012-03-30 19:42:12 -07002190#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
2191static void mhl_sii_reset_gpio(int on)
2192{
2193 gpio_set_value(MHL_GPIO_RESET, on);
2194 return;
2195}
2196
2197/*
2198 * Request for GPIO allocations
2199 * Set appropriate GPIO directions
2200 */
2201static int mhl_sii_gpio_setup(int on)
2202{
2203 int ret;
2204
2205 if (on) {
2206 ret = gpio_request(MHL_GPIO_RESET, "W_RST#");
2207 if (ret < 0) {
2208 pr_err("GPIO RESET request failed: %d\n", ret);
2209 return -EBUSY;
2210 }
2211 ret = gpio_direction_output(MHL_GPIO_RESET, 1);
2212 if (ret < 0) {
2213 pr_err("SET GPIO RESET direction failed: %d\n", ret);
2214 gpio_free(MHL_GPIO_RESET);
2215 return -EBUSY;
2216 }
2217 ret = gpio_request(MHL_GPIO_INT, "W_INT");
2218 if (ret < 0) {
2219 pr_err("GPIO INT request failed: %d\n", ret);
2220 gpio_free(MHL_GPIO_RESET);
2221 return -EBUSY;
2222 }
2223 ret = gpio_direction_input(MHL_GPIO_INT);
2224 if (ret < 0) {
2225 pr_err("SET GPIO INTR direction failed: %d\n", ret);
2226 gpio_free(MHL_GPIO_RESET);
2227 gpio_free(MHL_GPIO_INT);
2228 return -EBUSY;
2229 }
2230 } else {
2231 gpio_free(MHL_GPIO_RESET);
2232 gpio_free(MHL_GPIO_INT);
2233 }
2234
2235 return 0;
2236}
2237
2238static struct msm_mhl_platform_data mhl_platform_data = {
2239 .irq = MSM_GPIO_TO_INT(4),
2240 .gpio_setup = mhl_sii_gpio_setup,
2241 .reset_pin = mhl_sii_reset_gpio,
2242};
2243#endif
2244
Eugene Yasmand2316b82011-12-07 18:23:48 +02002245static struct i2c_board_info sii_device_info[] __initdata = {
2246 {
Manoj Rao14648742012-03-30 19:42:12 -07002247#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
2248 /*
2249 * keeps SI 8334 as the default
2250 * MHL TX
2251 */
2252 I2C_BOARD_INFO("sii8334", 0x39),
2253 .platform_data = &mhl_platform_data,
2254#endif
2255#ifdef CONFIG_FB_MSM_HDMI_MHL_9244
Eugene Yasmand2316b82011-12-07 18:23:48 +02002256 I2C_BOARD_INFO("Sil-9244", 0x39),
Eugene Yasmand2316b82011-12-07 18:23:48 +02002257 .irq = MSM_GPIO_TO_INT(15),
Manoj Rao14648742012-03-30 19:42:12 -07002258#endif /* CONFIG_MSM_HDMI_MHL */
2259 .flags = I2C_CLIENT_WAKE,
Eugene Yasmand2316b82011-12-07 18:23:48 +02002260 },
2261};
2262
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002263static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
2264 .clk_freq = 100000,
2265 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002266};
2267
2268static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
2269 .clk_freq = 100000,
2270 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002271};
2272
2273static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
2274 .clk_freq = 100000,
2275 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002276};
2277
2278static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
2279 .clk_freq = 100000,
2280 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002281};
2282
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06002283static struct msm_pm_sleep_status_data msm_pm_slp_sts_data = {
2284 .base_addr = MSM_ACC0_BASE + 0x08,
2285 .cpu_offset = MSM_ACC1_BASE - MSM_ACC0_BASE,
2286 .mask = 1UL << 13,
2287};
2288
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002289static struct ks8851_pdata spi_eth_pdata = {
2290 .irq_gpio = KS8851_IRQ_GPIO,
2291 .rst_gpio = KS8851_RST_GPIO,
2292};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06002293
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002294static struct spi_board_info spi_board_info[] __initdata = {
2295 {
2296 .modalias = "ks8851",
2297 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2298 .max_speed_hz = 19200000,
2299 .bus_num = 0,
2300 .chip_select = 0,
2301 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002302 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002303 },
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07002304 {
2305 .modalias = "dsi_novatek_3d_panel_spi",
2306 .max_speed_hz = 10800000,
2307 .bus_num = 0,
2308 .chip_select = 1,
2309 .mode = SPI_MODE_0,
2310 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002311};
2312
2313static struct platform_device msm_device_saw_core0 = {
2314 .name = "saw-regulator",
2315 .id = 0,
2316 .dev = {
2317 .platform_data = &msm_saw_regulator_pdata_s5,
2318 },
2319};
2320
2321static struct platform_device msm_device_saw_core1 = {
2322 .name = "saw-regulator",
2323 .id = 1,
2324 .dev = {
2325 .platform_data = &msm_saw_regulator_pdata_s6,
2326 },
2327};
2328
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002329static struct tsens_platform_data msm_tsens_pdata = {
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002330 .slope = {910, 910, 910, 910, 910},
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002331 .tsens_factor = 1000,
2332 .hw_type = MSM_8960,
2333 .tsens_num_sensor = 5,
2334};
2335
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002336static struct platform_device msm_tsens_device = {
2337 .name = "tsens8960-tm",
2338 .id = -1,
2339};
2340
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002341#ifdef CONFIG_MSM_FAKE_BATTERY
2342static struct platform_device fish_battery_device = {
2343 .name = "fish_battery",
2344};
2345#endif
2346
David Collins26f05562011-06-20 09:56:28 -07002347static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002348 .name = GPIO_REGULATOR_DEV_NAME,
2349 .id = PM8921_MPP_PM_TO_SYS(7),
2350 .dev = {
2351 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2352 },
2353};
2354
David Collins26f05562011-06-20 09:56:28 -07002355static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002356 .name = GPIO_REGULATOR_DEV_NAME,
2357 .id = 91,
2358 .dev = {
2359 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2360 },
2361};
2362
David Collinsb10be1d2011-09-02 10:29:31 -07002363static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
2364 .name = GPIO_REGULATOR_DEV_NAME,
2365 .id = PM8921_GPIO_PM_TO_SYS(17),
2366 .dev = {
2367 .platform_data =
2368 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2369 },
2370};
2371
David Collins35a78f52011-12-14 15:54:25 -08002372static struct platform_device msm8960_device_ext_otg_sw_vreg __devinitdata = {
2373 .name = GPIO_REGULATOR_DEV_NAME,
2374 .id = PM8921_GPIO_PM_TO_SYS(42),
2375 .dev = {
2376 .platform_data =
2377 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_OTG_SW],
2378 },
2379};
2380
David Collins26f05562011-06-20 09:56:28 -07002381static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
2382 .name = "rpm-regulator",
2383 .id = -1,
2384 .dev = {
2385 .platform_data = &msm_rpm_regulator_pdata,
2386 },
2387};
Mayank Ranae009c922012-03-22 03:02:06 +05302388#ifdef CONFIG_SERIAL_MSM_HS
2389static int configure_uart_gpios(int on)
2390{
2391 int ret = 0, i;
2392 int uart_gpios[] = {93, 94, 95, 96};
2393
2394 for (i = 0; i < ARRAY_SIZE(uart_gpios); i++) {
2395 if (on) {
2396 ret = gpio_request(uart_gpios[i], NULL);
2397 if (ret) {
2398 pr_err("%s: unable to request uart gpio[%d]\n",
2399 __func__, uart_gpios[i]);
2400 break;
2401 }
2402 } else {
2403 gpio_free(uart_gpios[i]);
2404 }
2405 }
2406
2407 if (ret && on && i)
2408 for (; i >= 0; i--)
2409 gpio_free(uart_gpios[i]);
2410 return ret;
2411}
2412
2413static struct msm_serial_hs_platform_data msm_uart_dm9_pdata = {
Mayank Ranad85a5082012-04-29 17:24:13 -07002414 .gpio_config = configure_uart_gpios,
Mayank Ranae009c922012-03-22 03:02:06 +05302415};
2416#else
2417static struct msm_serial_hs_platform_data msm_uart_dm9_pdata;
2418#endif
David Collins26f05562011-06-20 09:56:28 -07002419
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002420static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07002421 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002422 &msm_device_smd,
Mayank Rana9f51f582011-08-04 18:35:59 +05302423 &msm_device_uart_dm6,
Mayank Ranae009c922012-03-22 03:02:06 +05302424 &msm_device_uart_dm9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002425 &msm_device_saw_core0,
2426 &msm_device_saw_core1,
2427 &msm8960_device_ext_5v_vreg,
David Collins87579612012-01-30 16:00:15 -08002428 &msm8960_device_ssbi_pmic,
David Collins96aa3e12012-02-29 10:31:34 -08002429 &msm8960_device_ext_otg_sw_vreg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002430 &msm8960_device_qup_spi_gsbi1,
2431 &msm8960_device_qup_i2c_gsbi3,
2432 &msm8960_device_qup_i2c_gsbi4,
2433 &msm8960_device_qup_i2c_gsbi10,
2434#ifndef CONFIG_MSM_DSPS
2435 &msm8960_device_qup_i2c_gsbi12,
2436#endif
2437 &msm_slim_ctrl,
2438 &msm_device_wcnss_wlan,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002439#if defined(CONFIG_QSEECOM)
2440 &qseecom_device,
2441#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002442#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2443 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2444 &qcrypto_device,
2445#endif
2446
2447#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2448 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2449 &qcedev_device,
2450#endif
2451#ifdef CONFIG_MSM_ROTATOR
2452 &msm_rotator_device,
2453#endif
2454 &msm_device_sps,
2455#ifdef CONFIG_MSM_FAKE_BATTERY
2456 &fish_battery_device,
2457#endif
Laura Abbottb93525f2012-04-12 09:57:19 -07002458 &msm8960_fmem_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002459#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07002460#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002461 &msm8960_android_pmem_device,
2462 &msm8960_android_pmem_adsp_device,
2463 &msm8960_android_pmem_audio_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002464#endif
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -07002465#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002466 &msm_device_vidc,
2467 &msm_device_bam_dmux,
2468 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07002469
Joel Nidera1261942011-09-12 16:30:09 +03002470#if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE)
2471#ifdef CONFIG_MSM_USE_TSIF1
2472 &msm_device_tsif[1],
2473#else
2474 &msm_device_tsif[0],
2475#endif
2476#endif
2477
Mona Hossain9c430e32011-07-27 11:04:47 -07002478#ifdef CONFIG_HW_RANDOM_MSM
2479 &msm_device_rng,
2480#endif
Laura Abbottd6183792011-08-19 13:42:24 -07002481#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002482 &msm8960_ion_dev,
Laura Abbottd6183792011-08-19 13:42:24 -07002483#endif
Praveen Chidambaram78499012011-11-01 17:15:17 -06002484 &msm8960_rpm_device,
2485 &msm8960_rpm_log_device,
2486 &msm8960_rpm_stat_device,
Mona Hossain11c03ac2011-10-26 12:42:10 -07002487 &msm_device_tz_log,
Pratik Patel7831c082011-06-08 21:44:37 -07002488#ifdef CONFIG_MSM_QDSS
Pratik Patel1403f2a2012-03-21 10:10:00 -07002489 &msm_qdss_device,
Pratik Patel7831c082011-06-08 21:44:37 -07002490 &msm_etb_device,
2491 &msm_tpiu_device,
2492 &msm_funnel_device,
Pratik Patel492b3012012-03-06 14:22:30 -08002493 &msm_etm_device,
Pratik Patel7831c082011-06-08 21:44:37 -07002494#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07002495 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002496 &msm8960_device_watchdog,
Laura Abbottb93525f2012-04-12 09:57:19 -07002497 &msm8960_rtb_device,
Praveen Chidambaram8ea3dcd2011-12-07 14:46:31 -07002498 &msm8960_cpu_idle_device,
Praveen Chidambaram5c8adf22012-02-23 18:44:37 -07002499 &msm8960_msm_gov_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002500 &msm8960_device_cache_erp,
Laura Abbottb93525f2012-04-12 09:57:19 -07002501 &msm8960_cache_dump_device,
Laura Abbott0577d7b2012-04-17 11:14:30 -07002502 &msm8960_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002503 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002504};
2505
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002506static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07002507 &msm8960_device_uart_gsbi5,
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002508 &msm8960_device_otg,
2509 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002510 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05302511 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002512 &android_usb_device,
2513 &msm_device_vidc,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002514 &msm_bus_apps_fabric,
2515 &msm_bus_sys_fabric,
2516 &msm_bus_mm_fabric,
2517 &msm_bus_sys_fpb,
2518 &msm_bus_cpss_fpb,
2519 &msm_pcm,
Kiran Kandi5e809b02012-01-31 00:24:33 -08002520 &msm_multi_ch_pcm,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002521 &msm_pcm_routing,
2522 &msm_cpudai0,
2523 &msm_cpudai1,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002524 &msm8960_cpudai_slimbus_2_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002525 &msm_cpudai_hdmi_rx,
2526 &msm_cpudai_bt_rx,
2527 &msm_cpudai_bt_tx,
2528 &msm_cpudai_fm_rx,
2529 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002530 &msm_cpudai_auxpcm_rx,
2531 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002532 &msm_cpu_fe,
2533 &msm_stub_codec,
2534 &msm_voice,
2535 &msm_voip,
2536 &msm_lpa_pcm,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05302537 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07002538 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07002539 &msm_cpudai_incall_record_rx,
2540 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002541
2542#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2543 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2544 &qcrypto_device,
2545#endif
2546
2547#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2548 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2549 &qcedev_device,
2550#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002551};
2552
2553static struct platform_device *rumi3_devices[] __initdata = {
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07002554 &msm8960_device_uart_gsbi5,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002555 &msm_kgsl_3d0,
2556 &msm_kgsl_2d0,
2557 &msm_kgsl_2d1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002558#ifdef CONFIG_MSM_GEMINI
2559 &msm8960_gemini_device,
2560#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002561};
2562
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002563static struct platform_device *cdp_devices[] __initdata = {
Stephen Boydeb819882011-08-29 14:46:30 -07002564 &msm_8960_q6_lpass,
2565 &msm_8960_q6_mss_fw,
2566 &msm_8960_q6_mss_sw,
Stephen Boyd322a9922011-09-20 01:05:54 -07002567 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07002568 &msm_pil_tzapps,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07002569 &msm_pil_dsps,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002570 &msm_pil_vidc,
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002571 &msm8960_device_otg,
2572 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002573 &msm_device_hsusb_host,
2574 &android_usb_device,
2575 &msm_pcm,
Kiran Kandi5e809b02012-01-31 00:24:33 -08002576 &msm_multi_ch_pcm,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002577 &msm_pcm_routing,
2578 &msm_cpudai0,
2579 &msm_cpudai1,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002580 &msm8960_cpudai_slimbus_2_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002581 &msm_cpudai_hdmi_rx,
2582 &msm_cpudai_bt_rx,
2583 &msm_cpudai_bt_tx,
2584 &msm_cpudai_fm_rx,
2585 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002586 &msm_cpudai_auxpcm_rx,
2587 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002588 &msm_cpu_fe,
2589 &msm_stub_codec,
2590 &msm_kgsl_3d0,
2591#ifdef CONFIG_MSM_KGSL_2D
2592 &msm_kgsl_2d0,
2593 &msm_kgsl_2d1,
2594#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002595#ifdef CONFIG_MSM_GEMINI
2596 &msm8960_gemini_device,
2597#endif
2598 &msm_voice,
2599 &msm_voip,
2600 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05302601 &msm_cpudai_afe_01_rx,
2602 &msm_cpudai_afe_01_tx,
2603 &msm_cpudai_afe_02_rx,
2604 &msm_cpudai_afe_02_tx,
2605 &msm_pcm_afe,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05302606 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07002607 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07002608 &msm_cpudai_incall_record_rx,
2609 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002610 &msm_pcm_hostless,
2611 &msm_bus_apps_fabric,
2612 &msm_bus_sys_fabric,
2613 &msm_bus_mm_fabric,
2614 &msm_bus_sys_fpb,
2615 &msm_bus_cpss_fpb,
2616};
2617
2618static void __init msm8960_i2c_init(void)
2619{
2620 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2621 &msm8960_i2c_qup_gsbi4_pdata;
2622
2623 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2624 &msm8960_i2c_qup_gsbi3_pdata;
2625
2626 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2627 &msm8960_i2c_qup_gsbi10_pdata;
2628
2629 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2630 &msm8960_i2c_qup_gsbi12_pdata;
2631}
2632
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002633static void __init msm8960_gfx_init(void)
2634{
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06002635 uint32_t soc_platform_version = socinfo_get_version();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002636 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
2637 struct kgsl_device_platform_data *kgsl_3d0_pdata =
2638 msm_kgsl_3d0.dev.platform_data;
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -06002639 kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
2640 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002641 }
2642}
2643
Subhash Jadavani933e6a62011-12-26 18:05:04 +05302644static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002645 {
2646 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2647 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2648 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002649 1, 784, 180000, 100,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002650 },
2651
2652 {
2653 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2654 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2655 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002656 1300, 228, 1200000, 2000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002657 },
2658
2659 {
2660 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2661 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2662 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002663 2000, 138, 1208400, 3200,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002664 },
2665
2666 {
2667 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06002668 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2669 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002670 6000, 119, 1850300, 9000,
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06002671 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002672
2673 {
2674 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2675 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2676 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002677 9200, 68, 2839200, 16400,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002678 },
2679
2680 {
2681 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2682 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2683 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002684 10300, 63, 3128000, 18200,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002685 },
2686
2687 {
2688 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2689 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2690 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002691 18000, 10, 4602600, 27000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002692 },
2693
2694 {
2695 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2696 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2697 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002698 20000, 2, 5752000, 32000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002699 },
2700};
2701
Praveen Chidambaram78499012011-11-01 17:15:17 -06002702static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2703 .levels = &msm_rpmrs_levels[0],
2704 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2705 .vdd_mem_levels = {
2706 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2707 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2708 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2709 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2710 },
2711 .vdd_dig_levels = {
2712 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
2713 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
2714 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
2715 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
2716 },
2717 .vdd_mask = 0x7FFFFF,
2718 .rpmrs_target_id = {
2719 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2720 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
2721 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
2722 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
2723 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
2724 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
2725 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2726 },
2727};
2728
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002729static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2730 .mode = MSM_PM_BOOT_CONFIG_TZ,
2731};
2732
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002733#ifdef CONFIG_I2C
2734#define I2C_SURF 1
2735#define I2C_FFA (1 << 1)
2736#define I2C_RUMI (1 << 2)
2737#define I2C_SIM (1 << 3)
2738#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03002739#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002740
2741struct i2c_registry {
2742 u8 machs;
2743 int bus;
2744 struct i2c_board_info *info;
2745 int len;
2746};
2747
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002748/* Sensors DSPS platform data */
2749#ifdef CONFIG_MSM_DSPS
2750#define DSPS_PIL_GENERIC_NAME "dsps"
2751#endif /* CONFIG_MSM_DSPS */
2752
2753static void __init msm8960_init_dsps(void)
2754{
2755#ifdef CONFIG_MSM_DSPS
2756 struct msm_dsps_platform_data *pdata =
2757 msm_dsps_device.dev.platform_data;
2758 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
2759 pdata->gpios = NULL;
2760 pdata->gpios_num = 0;
2761
2762 platform_device_register(&msm_dsps_device);
2763#endif /* CONFIG_MSM_DSPS */
2764}
2765
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -08002766static int hsic_peripheral_status = 1;
2767static DEFINE_MUTEX(hsic_status_lock);
2768
2769void peripheral_connect()
2770{
2771 mutex_lock(&hsic_status_lock);
2772 if (hsic_peripheral_status)
2773 goto out;
2774 platform_device_add(&msm_device_hsic_host);
2775 hsic_peripheral_status = 1;
2776out:
2777 mutex_unlock(&hsic_status_lock);
2778}
2779EXPORT_SYMBOL(peripheral_connect);
2780
2781void peripheral_disconnect()
2782{
2783 mutex_lock(&hsic_status_lock);
2784 if (!hsic_peripheral_status)
2785 goto out;
2786 platform_device_del(&msm_device_hsic_host);
2787 hsic_peripheral_status = 0;
2788out:
2789 mutex_unlock(&hsic_status_lock);
2790}
2791EXPORT_SYMBOL(peripheral_disconnect);
2792
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05302793static void __init msm8960_init_smsc_hub(void)
2794{
2795 uint32_t version = socinfo_get_version();
2796
2797 if (SOCINFO_VERSION_MAJOR(version) == 1)
2798 return;
2799
2800 if (machine_is_msm8960_liquid())
2801 platform_device_register(&smsc_hub_device);
2802}
2803
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002804static void __init msm8960_init_hsic(void)
2805{
2806#ifdef CONFIG_USB_EHCI_MSM_HSIC
2807 uint32_t version = socinfo_get_version();
2808
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08002809 if (SOCINFO_VERSION_MAJOR(version) == 1)
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002810 return;
2811
Joel King0cbf5d82012-05-24 15:21:38 -07002812 if (machine_is_msm8960_liquid())
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08002813 platform_device_register(&msm_device_hsic_host);
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002814#endif
2815}
2816
Amir Samuelov5137e392011-09-21 17:31:25 +03002817#ifdef CONFIG_ISL9519_CHARGER
2818static struct isl_platform_data isl_data __initdata = {
2819 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
2820 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
2821 .max_system_voltage = 4200,
2822 .min_system_voltage = 3200,
Amir Samuelov95f49ff2012-01-29 09:14:08 +02002823 .chgcurrent = 1900,
2824 .term_current = 0,
Amir Samuelov5137e392011-09-21 17:31:25 +03002825 .input_current = 2048,
2826};
2827
2828static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
2829 {
2830 I2C_BOARD_INFO("isl9519q", 0x9),
2831 .irq = 0, /* Not required when notify-by-pmic */
2832 .platform_data = &isl_data,
2833 },
2834};
2835#endif /* CONFIG_ISL9519_CHARGER */
2836
Amir Samuelov755616d2011-12-13 16:34:46 +02002837static struct i2c_board_info liquid_io_expander_i2c_info[] __initdata = {
2838 {
2839 I2C_BOARD_INFO("sx1508q", 0x20),
2840 .platform_data = &msm8960_sx150x_data[SX150X_LIQUID]
2841 },
2842};
2843
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002844static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Amir Samuelov5137e392011-09-21 17:31:25 +03002845#ifdef CONFIG_ISL9519_CHARGER
2846 {
2847 I2C_LIQUID,
2848 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2849 isl_charger_i2c_info,
2850 ARRAY_SIZE(isl_charger_i2c_info),
2851 },
2852#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002853 {
2854 I2C_SURF | I2C_FFA | I2C_FLUID,
2855 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2856 cyttsp_info,
2857 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07002858 },
Mohan Pallaka50837382011-09-07 11:00:57 +05302859 {
2860 I2C_LIQUID,
2861 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2862 mxt_device_info,
2863 ARRAY_SIZE(mxt_device_info),
2864 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05302865 {
Manoj Rao14648742012-03-30 19:42:12 -07002866 I2C_SURF | I2C_FFA | I2C_LIQUID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302867 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Eugene Yasmand2316b82011-12-07 18:23:48 +02002868 sii_device_info,
2869 ARRAY_SIZE(sii_device_info),
2870 },
2871 {
2872 I2C_LIQUID,
2873 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302874 msm_isa1200_board_info,
2875 ARRAY_SIZE(msm_isa1200_board_info),
2876 },
Amir Samuelov755616d2011-12-13 16:34:46 +02002877 {
2878 I2C_LIQUID,
2879 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2880 liquid_io_expander_i2c_info,
2881 ARRAY_SIZE(liquid_io_expander_i2c_info),
2882 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002883};
2884#endif /* CONFIG_I2C */
2885
2886static void __init register_i2c_devices(void)
2887{
2888#ifdef CONFIG_I2C
2889 u8 mach_mask = 0;
2890 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08002891#ifdef CONFIG_MSM_CAMERA
2892 struct i2c_registry msm8960_camera_i2c_devices = {
2893 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
2894 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
2895 msm8960_camera_board_info.board_info,
2896 msm8960_camera_board_info.num_i2c_board_info,
2897 };
2898#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002899
2900 /* Build the matching 'supported_machs' bitmask */
2901 if (machine_is_msm8960_cdp())
2902 mach_mask = I2C_SURF;
2903 else if (machine_is_msm8960_rumi3())
2904 mach_mask = I2C_RUMI;
2905 else if (machine_is_msm8960_sim())
2906 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07002907 else if (machine_is_msm8960_fluid())
2908 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03002909 else if (machine_is_msm8960_liquid())
2910 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07002911 else if (machine_is_msm8960_mtp())
2912 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002913 else
2914 pr_err("unmatched machine ID in register_i2c_devices\n");
2915
Jing Lineec88ca2012-02-08 11:18:30 -08002916 if (machine_is_msm8960_liquid()) {
2917 if (SOCINFO_VERSION_MAJOR(socinfo_get_platform_version()) == 3)
2918 mxt_device_info[0].platform_data =
2919 &mxt_platform_data_3d;
2920 else
2921 mxt_device_info[0].platform_data =
2922 &mxt_platform_data_2d;
2923 }
2924
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002925 /* Run the array and install devices as appropriate */
2926 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
2927 if (msm8960_i2c_devices[i].machs & mach_mask)
2928 i2c_register_board_info(msm8960_i2c_devices[i].bus,
2929 msm8960_i2c_devices[i].info,
2930 msm8960_i2c_devices[i].len);
2931 }
Kevin Chan09f4e662011-12-16 08:17:02 -08002932#ifdef CONFIG_MSM_CAMERA
2933 if (msm8960_camera_i2c_devices.machs & mach_mask)
2934 i2c_register_board_info(msm8960_camera_i2c_devices.bus,
2935 msm8960_camera_i2c_devices.info,
2936 msm8960_camera_i2c_devices.len);
2937#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002938#endif
2939}
2940
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002941static void __init msm8960_sim_init(void)
2942{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002943 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
2944 &msm8960_device_watchdog.dev.platform_data;
2945
2946 wdog_pdata->bark_time = 15000;
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08002947 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002948 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
2949 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002950 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07002951 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002952 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002953 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002954
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002955 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002956 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002957 msm8960_i2c_init();
2958 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2959 msm_spm_l2_init(msm_spm_l2_data);
2960 msm8960_init_buses();
2961 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002962 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002963 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07002964 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002965
2966 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2967 &msm8960_qup_spi_gsbi1_pdata;
2968 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2969
2970 msm8960_init_mmc();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002971 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002972 slim_register_board_info(msm_slim_devices,
2973 ARRAY_SIZE(msm_slim_devices));
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002974 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06002975 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002976}
2977
2978static void __init msm8960_rumi3_init(void)
2979{
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08002980 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002981 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
2982 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002983 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07002984 platform_device_register(&msm8960_device_rpm_regulator);
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002985 msm8960_init_gpiomux();
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002986 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002987 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2988 &msm8960_qup_spi_gsbi1_pdata;
2989 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2990 msm8960_i2c_init();
2991 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2992 msm_spm_l2_init(msm_spm_l2_data);
2993 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002994 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002995 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002996 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002997 register_i2c_devices();
Mayank Ranae009c922012-03-22 03:02:06 +05302998
Mayank Ranae009c922012-03-22 03:02:06 +05302999
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08003000 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003001 slim_register_board_info(msm_slim_devices,
3002 ARRAY_SIZE(msm_slim_devices));
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06003003 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06003004 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003005}
3006
3007static void __init msm8960_cdp_init(void)
3008{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07003009 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
3010 pr_err("meminfo_init() failed!\n");
3011
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08003012 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06003013 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
3014 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07003015
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003016 regulator_suppress_info_printing();
3017 if (msm_xo_init())
3018 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07003019 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07003020 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05303021 if (machine_is_msm8960_liquid())
3022 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003023 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05303024 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
3025 machine_is_msm8960_cdp()) {
3026 msm_otg_pdata.phy_init_seq = wr_phy_init_seq;
3027 } else if (machine_is_msm8960_liquid()) {
3028 msm_otg_pdata.phy_init_seq =
3029 liquid_v1_phy_init_seq;
3030 }
Ofir Cohen94213a72012-05-03 14:26:32 +03003031 android_usb_pdata.swfi_latency =
Anji jonnalaa7c1c5c2011-12-12 12:20:36 +05303032 msm_rpmrs_levels[0].latency_us;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303033 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303034 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2 &&
3035 machine_is_msm8960_liquid())
3036 msm_device_hsic_host.dev.parent = &smsc_hub_device.dev;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08003037 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003038 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3039 &msm8960_qup_spi_gsbi1_pdata;
3040 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003041
3042 msm8960_init_pmic();
Mohan Pallakaf69f0492011-11-21 13:08:33 +05303043 if ((SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2 &&
3044 (machine_is_msm8960_mtp())) || machine_is_msm8960_liquid())
3045 msm_isa1200_board_info[0].platform_data = &isa1200_1_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003046 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003047 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003048 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3049 msm_spm_l2_init(msm_spm_l2_data);
3050 msm8960_init_buses();
Matt Wagantall1f65d9d2012-04-25 14:24:20 -07003051 platform_add_devices(msm8960_footswitch, msm8960_num_footswitch);
David Collinsb10be1d2011-09-02 10:29:31 -07003052 if (machine_is_msm8960_liquid())
3053 platform_device_register(&msm8960_device_ext_3p3v_vreg);
David Collinsd5a40732011-11-29 15:53:56 -08003054 if (machine_is_msm8960_cdp())
3055 platform_device_register(&msm8960_device_ext_l2_vreg);
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07003056
3057 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
3058 platform_device_register(&msm8960_device_uart_gsbi8);
3059 else
3060 platform_device_register(&msm8960_device_uart_gsbi5);
3061
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003062 /* For 8960 Fusion 2.2 Primary IPC */
Mayank Ranad85a5082012-04-29 17:24:13 -07003063 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE) {
3064 msm_uart_dm9_pdata.wakeup_irq = gpio_to_irq(94); /* GSBI9(2) */
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003065 msm_device_uart_dm9.dev.platform_data = &msm_uart_dm9_pdata;
Mayank Ranad85a5082012-04-29 17:24:13 -07003066 }
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003067
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003068 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003069 msm8960_pm8921_gpio_mpp_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003070 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303071 msm8960_init_smsc_hub();
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003072 msm8960_init_hsic();
Steve Mucklef132c6c2012-06-06 18:30:57 -07003073#ifdef CONFIG_MSM_CAMERA
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003074 msm8960_init_cam();
Steve Mucklef132c6c2012-06-06 18:30:57 -07003075#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003076 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07003077 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05303078 if (machine_is_msm8960_liquid())
3079 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003080 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08003081 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003082 slim_register_board_info(msm_slim_devices,
3083 ARRAY_SIZE(msm_slim_devices));
3084 msm8960_init_dsps();
Larry Bassela7eadea2011-07-14 10:46:00 -07003085 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06003086 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06003087 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Joel King0cbf5d82012-05-24 15:21:38 -07003088 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE) {
3089 mdm_sglte_device.dev.platform_data = &sglte_platform_data;
3090 platform_device_register(&mdm_sglte_device);
3091 }
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003092}
3093
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003094MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
3095 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003096 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003097 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303098 .handle_irq = gic_handle_irq,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003099 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003100 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003101 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003102 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003103MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003104
3105MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
3106 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003107 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003108 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303109 .handle_irq = gic_handle_irq,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003110 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003111 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003112 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003113 .init_very_early = msm8960_early_memory,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003114MACHINE_END
3115
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003116MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
3117 .map_io = msm8960_map_io,
3118 .reserve = msm8960_reserve,
3119 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303120 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003121 .timer = &msm_timer,
3122 .init_machine = msm8960_cdp_init,
3123 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003124 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003125MACHINE_END
3126
3127MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
3128 .map_io = msm8960_map_io,
3129 .reserve = msm8960_reserve,
3130 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303131 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003132 .timer = &msm_timer,
3133 .init_machine = msm8960_cdp_init,
3134 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003135 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003136MACHINE_END
3137
3138MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
3139 .map_io = msm8960_map_io,
3140 .reserve = msm8960_reserve,
3141 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303142 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003143 .timer = &msm_timer,
3144 .init_machine = msm8960_cdp_init,
3145 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003146 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003147MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003148
3149MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
3150 .map_io = msm8960_map_io,
3151 .reserve = msm8960_reserve,
3152 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303153 .handle_irq = gic_handle_irq,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003154 .timer = &msm_timer,
3155 .init_machine = msm8960_cdp_init,
3156 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003157 .init_very_early = msm8960_early_memory,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003158MACHINE_END