blob: c26b8b99ae9ee4b8706ac6b43b77bdd2884dac8e [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>
22#include <linux/regulator/gpio-regulator.h>
23#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
33#include <linux/cyttsp.h>
34#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>
65#include <mach/gpio.h>
Rohit Vaswania513aa8d2011-07-18 15:14:28 -070066#include <mach/gpiomux.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070067#include <mach/msm_bus_board.h>
68#include <mach/msm_memtypes.h>
69#include <mach/dma.h>
70#include <mach/msm_dsps.h>
71#include <mach/msm_xo.h>
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -070072#include <mach/restart.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080073
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070074#ifdef CONFIG_WCD9310_CODEC
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +053075#include <linux/mfd/wcd9xxx/core.h>
76#include <linux/mfd/wcd9xxx/pdata.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070077#endif
78
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +053079#include <linux/smsc3503.h>
Laura Abbottd6183792011-08-19 13:42:24 -070080#include <linux/ion.h>
81#include <mach/ion.h>
Joel Kingb8352a12011-11-15 18:46:24 -080082#include <mach/mdm2.h>
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -080083#include <mach/mdm-peripheral.h>
Laura Abbottf8c03b92012-02-16 14:57:58 -080084#include <mach/msm_rtb.h>
Laura Abbott306bcc22012-03-08 11:24:53 -080085#include <mach/msm_cache_dump.h>
86#include <mach/scm.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
149#define MSM_ION_MM_SIZE 0x3800000
150#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
Olav Hauganf6dc7742012-02-15 09:11:55 -0800346#define FMEM_ENABLED 1
347
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 Haugan42ebe712012-01-10 16:30:58 -0800352 .align = PAGE_SIZE,
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 Haugan0703dbf2011-12-19 17:53:38 -0800356};
357
Laura Abbottb93525f2012-04-12 09:57:19 -0700358static struct ion_cp_heap_pdata cp_mfc_msm8960_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800359 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugan42ebe712012-01-10 16:30:58 -0800360 .align = PAGE_SIZE,
Olav Haugan65f4bd82011-12-13 11:50:08 -0800361 .reusable = 0,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800362 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700363 .fixed_position = FIXED_HIGH,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800364};
365
Laura Abbottb93525f2012-04-12 09:57:19 -0700366static struct ion_co_heap_pdata co_msm8960_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800367 .adjacent_mem_id = INVALID_HEAP_ID,
368 .align = PAGE_SIZE,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800369 .mem_is_fmem = 0,
Olav Haugan42ebe712012-01-10 16:30:58 -0800370};
371
Laura Abbottb93525f2012-04-12 09:57:19 -0700372static struct ion_co_heap_pdata fw_co_msm8960_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800373 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
374 .align = SZ_128K,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800375 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700376 .fixed_position = FIXED_LOW,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800377};
378#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800379
380/**
381 * These heaps are listed in the order they will be allocated. Due to
382 * video hardware restrictions and content protection the FW heap has to
383 * be allocated adjacent (below) the MM heap and the MFC heap has to be
384 * allocated after the MM heap to ensure MFC heap is not more than 256MB
385 * away from the base address of the FW heap.
386 * However, the order of FW heap and MM heap doesn't matter since these
387 * two heaps are taken care of by separate code to ensure they are adjacent
388 * to each other.
389 * Don't swap the order unless you know what you are doing!
390 */
Laura Abbottb93525f2012-04-12 09:57:19 -0700391static struct ion_platform_data msm8960_ion_pdata = {
Laura Abbott2d1760b2011-09-29 21:31:24 -0700392 .nr = MSM_ION_HEAP_NUM,
Laura Abbottd6183792011-08-19 13:42:24 -0700393 .heaps = {
394 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800395 .id = ION_SYSTEM_HEAP_ID,
Laura Abbottd6183792011-08-19 13:42:24 -0700396 .type = ION_HEAP_TYPE_SYSTEM,
Laura Abbottd6183792011-08-19 13:42:24 -0700397 .name = ION_VMALLOC_HEAP_NAME,
398 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700399#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -0700400 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800401 .id = ION_CP_MM_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800402 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800403 .name = ION_MM_HEAP_NAME,
404 .size = MSM_ION_MM_SIZE,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700405 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700406 .extra_data = (void *) &cp_mm_msm8960_ion_pdata,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700407 },
Laura Abbott8c017362011-09-22 20:59:12 -0700408 {
Olav Haugan42ebe712012-01-10 16:30:58 -0800409 .id = ION_MM_FIRMWARE_HEAP_ID,
410 .type = ION_HEAP_TYPE_CARVEOUT,
411 .name = ION_MM_FIRMWARE_HEAP_NAME,
412 .size = MSM_ION_MM_FW_SIZE,
413 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700414 .extra_data = (void *) &fw_co_msm8960_ion_pdata,
Olav Haugan42ebe712012-01-10 16:30:58 -0800415 },
416 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800417 .id = ION_CP_MFC_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800418 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800419 .name = ION_MFC_HEAP_NAME,
420 .size = MSM_ION_MFC_SIZE,
421 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700422 .extra_data = (void *) &cp_mfc_msm8960_ion_pdata,
Olav Hauganb5be7992011-11-18 14:29:02 -0800423 },
Olav Haugan32594552012-03-13 11:40:05 -0700424#ifndef CONFIG_MSM_IOMMU
Olav Hauganb5be7992011-11-18 14:29:02 -0800425 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800426 .id = ION_SF_HEAP_ID,
427 .type = ION_HEAP_TYPE_CARVEOUT,
428 .name = ION_SF_HEAP_NAME,
429 .size = MSM_ION_SF_SIZE,
430 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700431 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800432 },
Olav Haugan32594552012-03-13 11:40:05 -0700433#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800434 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800435 .id = ION_IOMMU_HEAP_ID,
Laura Abbott8c017362011-09-22 20:59:12 -0700436 .type = ION_HEAP_TYPE_IOMMU,
437 .name = ION_IOMMU_HEAP_NAME,
438 },
Olav Haugan80854eb2012-01-12 12:00:23 -0800439 {
440 .id = ION_QSECOM_HEAP_ID,
441 .type = ION_HEAP_TYPE_CARVEOUT,
442 .name = ION_QSECOM_HEAP_NAME,
443 .size = MSM_ION_QSECOM_SIZE,
444 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700445 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan80854eb2012-01-12 12:00:23 -0800446 },
Olav Haugan7355db02012-01-13 16:59:13 -0800447 {
448 .id = ION_AUDIO_HEAP_ID,
449 .type = ION_HEAP_TYPE_CARVEOUT,
450 .name = ION_AUDIO_HEAP_NAME,
451 .size = MSM_ION_AUDIO_SIZE,
452 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700453 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan7355db02012-01-13 16:59:13 -0800454 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700455#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700456 }
457};
458
Laura Abbottb93525f2012-04-12 09:57:19 -0700459static struct platform_device msm8960_ion_dev = {
Laura Abbottd6183792011-08-19 13:42:24 -0700460 .name = "ion-msm",
461 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700462 .dev = { .platform_data = &msm8960_ion_pdata },
Laura Abbottd6183792011-08-19 13:42:24 -0700463};
464#endif
465
Laura Abbottb93525f2012-04-12 09:57:19 -0700466struct platform_device msm8960_fmem_device = {
Larry Bassel41a055b2011-12-06 16:15:14 -0800467 .name = "fmem",
468 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700469 .dev = { .platform_data = &msm8960_fmem_pdata },
Larry Bassel41a055b2011-12-06 16:15:14 -0800470};
471
Olav Haugan65f4bd82011-12-13 11:50:08 -0800472static void __init adjust_mem_for_liquid(void)
Laura Abbottd6183792011-08-19 13:42:24 -0700473{
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800474 unsigned int i;
475
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800476 if (!pmem_param_set) {
477 if (machine_is_msm8960_liquid())
478 msm_ion_sf_size = MSM_LIQUID_ION_SF_SIZE;
479
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700480 if (msm8960_hdmi_as_primary_selected())
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800481 msm_ion_sf_size = MSM_HDMI_PRIM_ION_SF_SIZE;
482
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700483 if (machine_is_msm8960_liquid() ||
484 msm8960_hdmi_as_primary_selected()) {
Laura Abbottb93525f2012-04-12 09:57:19 -0700485 for (i = 0; i < msm8960_ion_pdata.nr; i++) {
486 if (msm8960_ion_pdata.heaps[i].id ==
487 ION_SF_HEAP_ID) {
488 msm8960_ion_pdata.heaps[i].size =
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800489 msm_ion_sf_size;
490 pr_debug("msm_ion_sf_size 0x%x\n",
491 msm_ion_sf_size);
492 break;
493 }
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800494 }
495 }
496 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800497}
498
499static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
500 unsigned long size)
501{
502 msm8960_reserve_table[mem_type].size += size;
503}
504
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700505static void __init msm8960_reserve_fixed_area(unsigned long fixed_area_size)
506{
507#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
508 int ret;
509
510 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
511 panic("fixed area size is larger than %dM\n",
512 MAX_FIXED_AREA_SIZE >> 20);
513
514 reserve_info->fixed_area_size = fixed_area_size;
515 reserve_info->fixed_area_start = MSM8960_FW_START;
516
517 ret = memblock_remove(reserve_info->fixed_area_start,
518 reserve_info->fixed_area_size);
519 BUG_ON(ret);
520#endif
521}
522
Olav Haugan65f4bd82011-12-13 11:50:08 -0800523/**
524 * Reserve memory for ION and calculate amount of reusable memory for fmem.
525 * We only reserve memory for heaps that are not reusable. However, we only
526 * support one reusable heap at the moment so we ignore the reusable flag for
527 * other than the first heap with reusable flag set. Also handle special case
Olav Hauganf6dc7742012-02-15 09:11:55 -0800528 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
529 * at a higher address than FW in addition to not more than 256MB away from the
530 * base address of the firmware. This means that if MM is reusable the other
531 * two heaps must be allocated in the same region as FW. This is handled by the
532 * mem_is_fmem flag in the platform data. In addition the MM heap must be
533 * adjacent to the FW heap for content protection purposes.
Olav Haugan65f4bd82011-12-13 11:50:08 -0800534 */
535static void __init reserve_ion_memory(void)
536{
537#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
538 unsigned int i;
539 unsigned int reusable_count = 0;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700540 unsigned int fixed_size = 0;
541 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
542 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800543
544 adjust_mem_for_liquid();
Laura Abbottb93525f2012-04-12 09:57:19 -0700545 msm8960_fmem_pdata.size = 0;
546 msm8960_fmem_pdata.reserved_size_low = 0;
547 msm8960_fmem_pdata.reserved_size_high = 0;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700548 fixed_low_size = 0;
549 fixed_middle_size = 0;
550 fixed_high_size = 0;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800551
552 /* We only support 1 reusable heap. Check if more than one heap
553 * is specified as reusable and set as non-reusable if found.
554 */
Laura Abbottb93525f2012-04-12 09:57:19 -0700555 for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
556 const struct ion_platform_heap *heap =
557 &(msm8960_ion_pdata.heaps[i]);
Olav Haugan65f4bd82011-12-13 11:50:08 -0800558
559 if (heap->type == ION_HEAP_TYPE_CP && heap->extra_data) {
560 struct ion_cp_heap_pdata *data = heap->extra_data;
561
562 reusable_count += (data->reusable) ? 1 : 0;
563
564 if (data->reusable && reusable_count > 1) {
565 pr_err("%s: Too many heaps specified as "
566 "reusable. Heap %s was not configured "
567 "as reusable.\n", __func__, heap->name);
568 data->reusable = 0;
569 }
570 }
571 }
572
Laura Abbottb93525f2012-04-12 09:57:19 -0700573 for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
574 const struct ion_platform_heap *heap =
575 &(msm8960_ion_pdata.heaps[i]);
Olav Haugan65f4bd82011-12-13 11:50:08 -0800576
577 if (heap->extra_data) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700578 int fixed_position = NOT_FIXED;
579 int mem_is_fmem = 0;
580
Olav Haugan65f4bd82011-12-13 11:50:08 -0800581 switch (heap->type) {
582 case ION_HEAP_TYPE_CP:
Olav Hauganf6dc7742012-02-15 09:11:55 -0800583 mem_is_fmem = ((struct ion_cp_heap_pdata *)
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700584 heap->extra_data)->mem_is_fmem;
585 fixed_position = ((struct ion_cp_heap_pdata *)
586 heap->extra_data)->fixed_position;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800587 break;
588 case ION_HEAP_TYPE_CARVEOUT:
Olav Hauganf6dc7742012-02-15 09:11:55 -0800589 mem_is_fmem = ((struct ion_co_heap_pdata *)
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700590 heap->extra_data)->mem_is_fmem;
591 fixed_position = ((struct ion_co_heap_pdata *)
592 heap->extra_data)->fixed_position;
593 break;
594 default:
595 break;
596 }
597
598 if (fixed_position != NOT_FIXED)
599 fixed_size += heap->size;
600 else
601 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
602
603 if (fixed_position == FIXED_LOW)
604 fixed_low_size += heap->size;
605 else if (fixed_position == FIXED_MIDDLE)
606 fixed_middle_size += heap->size;
607 else if (fixed_position == FIXED_HIGH)
608 fixed_high_size += heap->size;
609
610 if (mem_is_fmem)
Laura Abbottb93525f2012-04-12 09:57:19 -0700611 msm8960_fmem_pdata.size += heap->size;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700612 }
613 }
614
615 if (!fixed_size)
616 return;
617
Laura Abbottb93525f2012-04-12 09:57:19 -0700618 if (msm8960_fmem_pdata.size) {
619 msm8960_fmem_pdata.reserved_size_low = fixed_low_size;
620 msm8960_fmem_pdata.reserved_size_high = fixed_high_size;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700621 }
622
Larry Bassel4d4f4482012-04-04 11:26:09 -0700623 /* Since the fixed area may be carved out of lowmem,
624 * make sure the length is a multiple of 1M.
625 */
626 fixed_size = (fixed_size + MSM_MM_FW_SIZE + SECTION_SIZE - 1)
627 & SECTION_MASK;
628 msm8960_reserve_fixed_area(fixed_size);
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700629
630 fixed_low_start = MSM8960_FIXED_AREA_START;
631 fixed_middle_start = fixed_low_start + fixed_low_size;
632 fixed_high_start = fixed_middle_start + fixed_middle_size;
633
Laura Abbottb93525f2012-04-12 09:57:19 -0700634 for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
635 struct ion_platform_heap *heap = &(msm8960_ion_pdata.heaps[i]);
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700636
637 if (heap->extra_data) {
638 int fixed_position = NOT_FIXED;
639
640 switch (heap->type) {
641 case ION_HEAP_TYPE_CP:
642 fixed_position = ((struct ion_cp_heap_pdata *)
643 heap->extra_data)->fixed_position;
644 break;
645 case ION_HEAP_TYPE_CARVEOUT:
646 fixed_position = ((struct ion_co_heap_pdata *)
647 heap->extra_data)->fixed_position;
648 break;
649 default:
650 break;
651 }
652
653 switch (fixed_position) {
654 case FIXED_LOW:
655 heap->base = fixed_low_start;
656 break;
657 case FIXED_MIDDLE:
658 heap->base = fixed_middle_start;
659 break;
660 case FIXED_HIGH:
661 heap->base = fixed_high_start;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800662 break;
663 default:
664 break;
665 }
666 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800667 }
Laura Abbottd6183792011-08-19 13:42:24 -0700668#endif
669}
Huaibin Yanga5419422011-12-08 23:52:10 -0800670
671static void __init reserve_mdp_memory(void)
672{
673 msm8960_mdp_writeback(msm8960_reserve_table);
674}
675
Stephen Boyd668d7652012-04-25 11:31:01 -0700676static void __init reserve_cache_dump_memory(void)
Laura Abbott306bcc22012-03-08 11:24:53 -0800677{
678#ifdef CONFIG_MSM_CACHE_DUMP
679 unsigned int spare;
680 unsigned int l1_size;
Laura Abbott7b637362012-03-29 16:43:49 -0700681 unsigned int l2_size;
Laura Abbott306bcc22012-03-08 11:24:53 -0800682 unsigned int total;
683 int ret;
684
685 ret = scm_call(L1C_SERVICE_ID, L1C_BUFFER_GET_SIZE_COMMAND_ID, &spare,
686 sizeof(spare), &l1_size, sizeof(l1_size));
687
688 if (ret)
689 /* Fall back to something reasonable here */
690 l1_size = L1_BUFFER_SIZE;
691
Laura Abbott7b637362012-03-29 16:43:49 -0700692 ret = scm_call(L1C_SERVICE_ID, L2C_BUFFER_GET_SIZE_COMMAND_ID, &spare,
693 sizeof(spare), &l2_size, sizeof(l2_size));
694
695 if (ret)
696 /* Fall back to something reasonable here */
697 l2_size = L2_BUFFER_SIZE;
698
699 total = l1_size + l2_size;
Laura Abbott306bcc22012-03-08 11:24:53 -0800700
701 msm8960_reserve_table[MEMTYPE_EBI1].size += total;
Laura Abbottb93525f2012-04-12 09:57:19 -0700702 msm8960_cache_dump_pdata.l1_size = l1_size;
703 msm8960_cache_dump_pdata.l2_size = l2_size;
Laura Abbott306bcc22012-03-08 11:24:53 -0800704#endif
705}
706
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700707static void __init msm8960_calculate_reserve_sizes(void)
708{
709 size_pmem_devices();
710 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700711 reserve_ion_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800712 reserve_mdp_memory();
Laura Abbottf8c03b92012-02-16 14:57:58 -0800713 reserve_rtb_memory();
Laura Abbott306bcc22012-03-08 11:24:53 -0800714 reserve_cache_dump_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700715}
716
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700717static struct reserve_info msm8960_reserve_info __initdata = {
718 .memtype_reserve_table = msm8960_reserve_table,
719 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700720 .reserve_fixed_area = msm8960_reserve_fixed_area,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700721 .paddr_to_memtype = msm8960_paddr_to_memtype,
722};
723
Larry Basselb4126da2011-07-18 14:31:33 -0700724static int msm8960_memory_bank_size(void)
725{
726 return 1<<29;
727}
728
729static void __init locate_unstable_memory(void)
730{
731 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
732 unsigned long bank_size;
733 unsigned long low, high;
734
735 bank_size = msm8960_memory_bank_size();
Larry Bassel4d4f4482012-04-04 11:26:09 -0700736 msm8960_reserve_info.bank_size = bank_size;
737
Larry Basselb4126da2011-07-18 14:31:33 -0700738 low = meminfo.bank[0].start;
739 high = mb->start + mb->size;
Olav Haugan62052e42011-10-28 14:28:32 -0700740
741 /* Check if 32 bit overflow occured */
742 if (high < mb->start)
743 high = ~0UL;
744
Larry Bassel4d4f4482012-04-04 11:26:09 -0700745 if (high < MAX_FIXED_AREA_SIZE + MSM8960_FIXED_AREA_START)
746 panic("fixed area extends beyond end of memory\n");
747
Larry Basselb4126da2011-07-18 14:31:33 -0700748 low &= ~(bank_size - 1);
749
750 if (high - low <= bank_size)
Larry Bassel4d4f4482012-04-04 11:26:09 -0700751 goto no_dmm;
Larry Basselb8d61022012-02-24 10:49:45 -0800752
Larry Basselb8d61022012-02-24 10:49:45 -0800753#ifdef CONFIG_ENABLE_DMM
Jack Cheung60eaeab2012-01-09 16:40:26 -0800754 msm8960_reserve_info.low_unstable_address = mb->start -
755 MIN_MEMORY_BLOCK_SIZE + mb->size;
Jack Cheung0b1987e2011-11-18 13:36:29 -0800756 msm8960_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
Larry Basselb4126da2011-07-18 14:31:33 -0700757 pr_info("low unstable address %lx max size %lx bank size %lx\n",
758 msm8960_reserve_info.low_unstable_address,
759 msm8960_reserve_info.max_unstable_size,
760 msm8960_reserve_info.bank_size);
Larry Bassel4d4f4482012-04-04 11:26:09 -0700761 return;
Larry Basselb8d61022012-02-24 10:49:45 -0800762#endif
Larry Bassel4d4f4482012-04-04 11:26:09 -0700763no_dmm:
764 msm8960_reserve_info.low_unstable_address = high;
765 msm8960_reserve_info.max_unstable_size = 0;
Larry Basselb4126da2011-07-18 14:31:33 -0700766}
767
Larry Basselb830e182011-10-14 10:46:55 -0700768static void __init place_movable_zone(void)
769{
Larry Basselb8d61022012-02-24 10:49:45 -0800770#ifdef CONFIG_ENABLE_DMM
Larry Basselb830e182011-10-14 10:46:55 -0700771 movable_reserved_start = msm8960_reserve_info.low_unstable_address;
772 movable_reserved_size = msm8960_reserve_info.max_unstable_size;
773 pr_info("movable zone start %lx size %lx\n",
774 movable_reserved_start, movable_reserved_size);
Larry Basselb8d61022012-02-24 10:49:45 -0800775#endif
Larry Basselb830e182011-10-14 10:46:55 -0700776}
777
778static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700779{
780 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700781 locate_unstable_memory();
Larry Basselb830e182011-10-14 10:46:55 -0700782 place_movable_zone();
783}
784
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800785static char prim_panel_name[PANEL_NAME_MAX_LEN];
786static char ext_panel_name[PANEL_NAME_MAX_LEN];
787static int __init prim_display_setup(char *param)
788{
789 if (strnlen(param, PANEL_NAME_MAX_LEN))
790 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
791 return 0;
792}
793early_param("prim_display", prim_display_setup);
794
795static int __init ext_display_setup(char *param)
796{
797 if (strnlen(param, PANEL_NAME_MAX_LEN))
798 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
799 return 0;
800}
801early_param("ext_display", ext_display_setup);
802
Larry Basselb830e182011-10-14 10:46:55 -0700803static void __init msm8960_reserve(void)
804{
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800805 msm8960_set_display_params(prim_panel_name, ext_panel_name);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700806 msm_reserve();
Laura Abbottb93525f2012-04-12 09:57:19 -0700807 if (msm8960_fmem_pdata.size) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700808#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Larry Bassel861985f2012-05-02 15:54:52 -0700809 if (reserve_info->fixed_area_size) {
810 msm8960_fmem_pdata.phys =
811 reserve_info->fixed_area_start + MSM_MM_FW_SIZE;
812 pr_info("mm fw at %lx (fixed) size %x\n",
813 reserve_info->fixed_area_start, MSM_MM_FW_SIZE);
814 pr_info("fmem start %lx (fixed) size %lx\n",
815 msm8960_fmem_pdata.phys,
816 msm8960_fmem_pdata.size);
817 }
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700818#endif
819 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700820}
821
Larry Bassela4414b12011-08-04 11:11:02 -0700822static int msm8960_change_memory_power(u64 start, u64 size,
823 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700824{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -0700825 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -0700826}
827
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700828static void __init msm8960_allocate_memory_regions(void)
829{
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800830 msm8960_allocate_fb_region();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700831}
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800832
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700833#ifdef CONFIG_WCD9310_CODEC
834
835#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
836
Patrick Lai3043fba2011-08-01 14:15:57 -0700837/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
838 * 4 micbiases are used to power various analog and digital
839 * microphones operating at 1800 mV. Technically, all micbiases
840 * can source from single cfilter since all microphones operate
841 * at the same voltage level. The arrangement below is to make
842 * sure all cfilters are exercised. LDO_H regulator ouput level
843 * does not need to be as high as 2.85V. It is choosen for
844 * microphone sensitivity purpose.
845 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530846static struct wcd9xxx_pdata tabla_platform_data = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700847 .slimbus_slave_device = {
848 .name = "tabla-slave",
849 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
850 },
851 .irq = MSM_GPIO_TO_INT(62),
852 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530853 .num_irqs = NR_WCD9XXX_IRQS,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700854 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -0700855 .micbias = {
856 .ldoh_v = TABLA_LDOH_2P85_V,
857 .cfilt1_mv = 1800,
Joonwoo Parkcf473b42012-03-29 19:48:16 -0700858 .cfilt2_mv = 2700,
Patrick Lai3043fba2011-08-01 14:15:57 -0700859 .cfilt3_mv = 1800,
860 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
861 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
862 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
863 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530864 },
865 .regulator = {
866 {
867 .name = "CDC_VDD_CP",
868 .min_uV = 1800000,
869 .max_uV = 1800000,
870 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
871 },
872 {
873 .name = "CDC_VDDA_RX",
874 .min_uV = 1800000,
875 .max_uV = 1800000,
876 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
877 },
878 {
879 .name = "CDC_VDDA_TX",
880 .min_uV = 1800000,
881 .max_uV = 1800000,
882 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
883 },
884 {
885 .name = "VDDIO_CDC",
886 .min_uV = 1800000,
887 .max_uV = 1800000,
888 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
889 },
890 {
891 .name = "VDDD_CDC_D",
892 .min_uV = 1225000,
893 .max_uV = 1225000,
894 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
895 },
896 {
897 .name = "CDC_VDDA_A_1P2V",
898 .min_uV = 1225000,
899 .max_uV = 1225000,
900 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
901 },
902 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700903};
904
905static struct slim_device msm_slim_tabla = {
906 .name = "tabla-slim",
907 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
908 .dev = {
909 .platform_data = &tabla_platform_data,
910 },
911};
Santosh Mardi60e19d92011-10-28 01:15:14 +0530912
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530913static struct wcd9xxx_pdata tabla20_platform_data = {
Santosh Mardi60e19d92011-10-28 01:15:14 +0530914 .slimbus_slave_device = {
915 .name = "tabla-slave",
916 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
917 },
918 .irq = MSM_GPIO_TO_INT(62),
919 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530920 .num_irqs = NR_WCD9XXX_IRQS,
Santosh Mardi60e19d92011-10-28 01:15:14 +0530921 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
922 .micbias = {
923 .ldoh_v = TABLA_LDOH_2P85_V,
924 .cfilt1_mv = 1800,
Joonwoo Parkcf473b42012-03-29 19:48:16 -0700925 .cfilt2_mv = 2700,
Santosh Mardi60e19d92011-10-28 01:15:14 +0530926 .cfilt3_mv = 1800,
927 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
928 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
929 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
930 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530931 },
932 .regulator = {
933 {
934 .name = "CDC_VDD_CP",
935 .min_uV = 1800000,
936 .max_uV = 1800000,
937 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
938 },
939 {
940 .name = "CDC_VDDA_RX",
941 .min_uV = 1800000,
942 .max_uV = 1800000,
943 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
944 },
945 {
946 .name = "CDC_VDDA_TX",
947 .min_uV = 1800000,
948 .max_uV = 1800000,
949 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
950 },
951 {
952 .name = "VDDIO_CDC",
953 .min_uV = 1800000,
954 .max_uV = 1800000,
955 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
956 },
957 {
958 .name = "VDDD_CDC_D",
959 .min_uV = 1225000,
960 .max_uV = 1225000,
961 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
962 },
963 {
964 .name = "CDC_VDDA_A_1P2V",
965 .min_uV = 1225000,
966 .max_uV = 1225000,
967 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
968 },
969 },
Santosh Mardi60e19d92011-10-28 01:15:14 +0530970};
971
972static struct slim_device msm_slim_tabla20 = {
973 .name = "tabla2x-slim",
974 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
975 .dev = {
976 .platform_data = &tabla20_platform_data,
977 },
978};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700979#endif
980
981static struct slim_boardinfo msm_slim_devices[] = {
982#ifdef CONFIG_WCD9310_CODEC
983 {
984 .bus_num = 1,
985 .slim_slave = &msm_slim_tabla,
986 },
Santosh Mardi60e19d92011-10-28 01:15:14 +0530987 {
988 .bus_num = 1,
989 .slim_slave = &msm_slim_tabla20,
990 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700991#endif
992 /* add more slimbus slaves as needed */
993};
994
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700995#define MSM_WCNSS_PHYS 0x03000000
996#define MSM_WCNSS_SIZE 0x280000
997
998static struct resource resources_wcnss_wlan[] = {
999 {
1000 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1001 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1002 .name = "wcnss_wlanrx_irq",
1003 .flags = IORESOURCE_IRQ,
1004 },
1005 {
1006 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1007 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1008 .name = "wcnss_wlantx_irq",
1009 .flags = IORESOURCE_IRQ,
1010 },
1011 {
1012 .start = MSM_WCNSS_PHYS,
1013 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1014 .name = "wcnss_mmio",
1015 .flags = IORESOURCE_MEM,
1016 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -07001017 {
1018 .start = 84,
1019 .end = 88,
1020 .name = "wcnss_gpios_5wire",
1021 .flags = IORESOURCE_IO,
1022 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001023};
1024
Ankur Nandwanib0039b02011-08-09 14:00:45 -07001025static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1026 .has_48mhz_xo = 1,
1027};
1028
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001029static struct platform_device msm_device_wcnss_wlan = {
1030 .name = "wcnss_wlan",
1031 .id = 0,
1032 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1033 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07001034 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001035};
1036
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001037#ifdef CONFIG_QSEECOM
1038/* qseecom bus scaling */
1039static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
1040 {
1041 .src = MSM_BUS_MASTER_SPS,
1042 .dst = MSM_BUS_SLAVE_EBI_CH0,
1043 .ib = 0,
1044 .ab = 0,
1045 },
1046 {
1047 .src = MSM_BUS_MASTER_SPDM,
1048 .dst = MSM_BUS_SLAVE_SPDM,
1049 .ib = 0,
1050 .ab = 0,
1051 },
1052};
1053
1054static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
1055 {
1056 .src = MSM_BUS_MASTER_SPS,
1057 .dst = MSM_BUS_SLAVE_EBI_CH0,
1058 .ib = (492 * 8) * 1000000UL,
1059 .ab = (492 * 8) * 100000UL,
1060 },
1061 {
1062 .src = MSM_BUS_MASTER_SPDM,
1063 .dst = MSM_BUS_SLAVE_SPDM,
1064 .ib = 0,
1065 .ab = 0,
1066 },
1067};
1068
1069static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1070 {
1071 .src = MSM_BUS_MASTER_SPS,
1072 .dst = MSM_BUS_SLAVE_EBI_CH0,
1073 .ib = 0,
1074 .ab = 0,
1075 },
1076 {
1077 .src = MSM_BUS_MASTER_SPDM,
1078 .dst = MSM_BUS_SLAVE_SPDM,
1079 .ib = (64 * 8) * 1000000UL,
1080 .ab = (64 * 8) * 100000UL,
1081 },
1082};
1083
1084static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1085 {
1086 ARRAY_SIZE(qseecom_clks_init_vectors),
1087 qseecom_clks_init_vectors,
1088 },
1089 {
1090 ARRAY_SIZE(qseecom_enable_dfab_vectors),
1091 qseecom_enable_sfpb_vectors,
1092 },
1093 {
1094 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1095 qseecom_enable_sfpb_vectors,
1096 },
1097};
1098
1099static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1100 qseecom_hw_bus_scale_usecases,
1101 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1102 .name = "qsee",
1103};
1104
1105static struct platform_device qseecom_device = {
1106 .name = "qseecom",
1107 .id = 0,
1108 .dev = {
1109 .platform_data = &qseecom_bus_pdata,
1110 },
1111};
1112#endif
1113
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001114#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1115 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1116 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1117 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1118
1119#define QCE_SIZE 0x10000
1120#define QCE_0_BASE 0x18500000
1121
1122#define QCE_HW_KEY_SUPPORT 0
1123#define QCE_SHA_HMAC_SUPPORT 1
1124#define QCE_SHARE_CE_RESOURCE 1
1125#define QCE_CE_SHARED 0
1126
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001127/* Begin Bus scaling definitions */
1128static struct msm_bus_vectors crypto_hw_init_vectors[] = {
1129 {
1130 .src = MSM_BUS_MASTER_ADM_PORT0,
1131 .dst = MSM_BUS_SLAVE_EBI_CH0,
1132 .ab = 0,
1133 .ib = 0,
1134 },
1135 {
1136 .src = MSM_BUS_MASTER_ADM_PORT1,
1137 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1138 .ab = 0,
1139 .ib = 0,
1140 },
1141};
1142
1143static struct msm_bus_vectors crypto_hw_active_vectors[] = {
1144 {
1145 .src = MSM_BUS_MASTER_ADM_PORT0,
1146 .dst = MSM_BUS_SLAVE_EBI_CH0,
1147 .ab = 70000000UL,
1148 .ib = 70000000UL,
1149 },
1150 {
1151 .src = MSM_BUS_MASTER_ADM_PORT1,
1152 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1153 .ab = 2480000000UL,
1154 .ib = 2480000000UL,
1155 },
1156};
1157
1158static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
1159 {
1160 ARRAY_SIZE(crypto_hw_init_vectors),
1161 crypto_hw_init_vectors,
1162 },
1163 {
1164 ARRAY_SIZE(crypto_hw_active_vectors),
1165 crypto_hw_active_vectors,
1166 },
1167};
1168
1169static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
1170 crypto_hw_bus_scale_usecases,
1171 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
1172 .name = "cryptohw",
1173};
1174/* End Bus Scaling Definitions*/
1175
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001176static struct resource qcrypto_resources[] = {
1177 [0] = {
1178 .start = QCE_0_BASE,
1179 .end = QCE_0_BASE + QCE_SIZE - 1,
1180 .flags = IORESOURCE_MEM,
1181 },
1182 [1] = {
1183 .name = "crypto_channels",
1184 .start = DMOV_CE_IN_CHAN,
1185 .end = DMOV_CE_OUT_CHAN,
1186 .flags = IORESOURCE_DMA,
1187 },
1188 [2] = {
1189 .name = "crypto_crci_in",
1190 .start = DMOV_CE_IN_CRCI,
1191 .end = DMOV_CE_IN_CRCI,
1192 .flags = IORESOURCE_DMA,
1193 },
1194 [3] = {
1195 .name = "crypto_crci_out",
1196 .start = DMOV_CE_OUT_CRCI,
1197 .end = DMOV_CE_OUT_CRCI,
1198 .flags = IORESOURCE_DMA,
1199 },
1200};
1201
1202static struct resource qcedev_resources[] = {
1203 [0] = {
1204 .start = QCE_0_BASE,
1205 .end = QCE_0_BASE + QCE_SIZE - 1,
1206 .flags = IORESOURCE_MEM,
1207 },
1208 [1] = {
1209 .name = "crypto_channels",
1210 .start = DMOV_CE_IN_CHAN,
1211 .end = DMOV_CE_OUT_CHAN,
1212 .flags = IORESOURCE_DMA,
1213 },
1214 [2] = {
1215 .name = "crypto_crci_in",
1216 .start = DMOV_CE_IN_CRCI,
1217 .end = DMOV_CE_IN_CRCI,
1218 .flags = IORESOURCE_DMA,
1219 },
1220 [3] = {
1221 .name = "crypto_crci_out",
1222 .start = DMOV_CE_OUT_CRCI,
1223 .end = DMOV_CE_OUT_CRCI,
1224 .flags = IORESOURCE_DMA,
1225 },
1226};
1227
1228#endif
1229
1230#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1231 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1232
1233static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1234 .ce_shared = QCE_CE_SHARED,
1235 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1236 .hw_key_support = QCE_HW_KEY_SUPPORT,
1237 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001238 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001239};
1240
1241static struct platform_device qcrypto_device = {
1242 .name = "qcrypto",
1243 .id = 0,
1244 .num_resources = ARRAY_SIZE(qcrypto_resources),
1245 .resource = qcrypto_resources,
1246 .dev = {
1247 .coherent_dma_mask = DMA_BIT_MASK(32),
1248 .platform_data = &qcrypto_ce_hw_suppport,
1249 },
1250};
1251#endif
1252
1253#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1254 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1255
1256static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1257 .ce_shared = QCE_CE_SHARED,
1258 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1259 .hw_key_support = QCE_HW_KEY_SUPPORT,
1260 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001261 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001262};
1263
1264static struct platform_device qcedev_device = {
1265 .name = "qce",
1266 .id = 0,
1267 .num_resources = ARRAY_SIZE(qcedev_resources),
1268 .resource = qcedev_resources,
1269 .dev = {
1270 .coherent_dma_mask = DMA_BIT_MASK(32),
1271 .platform_data = &qcedev_ce_hw_suppport,
1272 },
1273};
1274#endif
1275
Joel Kingb8352a12011-11-15 18:46:24 -08001276#define MDM2AP_ERRFATAL 70
1277#define AP2MDM_ERRFATAL 95
1278#define MDM2AP_STATUS 69
1279#define AP2MDM_STATUS 94
1280#define AP2MDM_PMIC_RESET_N 80
1281#define AP2MDM_KPDPWR_N 81
1282
Joel Kingb8352a12011-11-15 18:46:24 -08001283static struct resource mdm_resources[] = {
1284 {
1285 .start = MDM2AP_ERRFATAL,
1286 .end = MDM2AP_ERRFATAL,
1287 .name = "MDM2AP_ERRFATAL",
1288 .flags = IORESOURCE_IO,
1289 },
1290 {
1291 .start = AP2MDM_ERRFATAL,
1292 .end = AP2MDM_ERRFATAL,
1293 .name = "AP2MDM_ERRFATAL",
1294 .flags = IORESOURCE_IO,
1295 },
1296 {
1297 .start = MDM2AP_STATUS,
1298 .end = MDM2AP_STATUS,
1299 .name = "MDM2AP_STATUS",
1300 .flags = IORESOURCE_IO,
1301 },
1302 {
1303 .start = AP2MDM_STATUS,
1304 .end = AP2MDM_STATUS,
1305 .name = "AP2MDM_STATUS",
1306 .flags = IORESOURCE_IO,
1307 },
1308 {
1309 .start = AP2MDM_PMIC_RESET_N,
1310 .end = AP2MDM_PMIC_RESET_N,
1311 .name = "AP2MDM_PMIC_RESET_N",
1312 .flags = IORESOURCE_IO,
1313 },
1314 {
1315 .start = AP2MDM_KPDPWR_N,
1316 .end = AP2MDM_KPDPWR_N,
1317 .name = "AP2MDM_KPDPWR_N",
1318 .flags = IORESOURCE_IO,
1319 },
1320};
1321
1322static struct mdm_platform_data mdm_platform_data = {
1323 .mdm_version = "2.5",
1324};
1325
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -08001326static struct platform_device mdm_device = {
Joel Kingb8352a12011-11-15 18:46:24 -08001327 .name = "mdm2_modem",
1328 .id = -1,
1329 .num_resources = ARRAY_SIZE(mdm_resources),
1330 .resource = mdm_resources,
1331 .dev = {
1332 .platform_data = &mdm_platform_data,
1333 },
1334};
1335
1336static struct platform_device *mdm_devices[] __initdata = {
1337 &mdm_device,
1338};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001339
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001340#define MSM_SHARED_RAM_PHYS 0x80000000
1341
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001342static void __init msm8960_map_io(void)
1343{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001344 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001345 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001346
1347 if (socinfo_init() < 0)
1348 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001349}
1350
1351static void __init msm8960_init_irq(void)
1352{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001353 struct msm_mpm_device_data *data = NULL;
1354
1355#ifdef CONFIG_MSM_MPM
1356 data = &msm8960_mpm_dev_data;
1357#endif
1358
1359 msm_mpm_irq_extn_init(data);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001360 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001361 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001362}
1363
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001364static void __init msm8960_init_buses(void)
1365{
1366#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -06001367 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -06001368 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
1369 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
1370 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
1371 msm_bus_apps_fabric.dev.platform_data =
1372 &msm_bus_8960_apps_fabric_pdata;
1373 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
1374 msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
1375 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
1376 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001377#endif
1378}
1379
1380static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
1381 .max_clock_speed = 15060000,
1382};
1383
1384#ifdef CONFIG_USB_MSM_OTG_72K
1385static struct msm_otg_platform_data msm_otg_pdata;
1386#else
Anji jonnalaa8b8d732011-12-06 10:03:24 +05301387static int wr_phy_init_seq[] = {
1388 0x44, 0x80, /* set VBUS valid threshold
1389 and disconnect valid threshold */
1390 0x38, 0x81, /* update DC voltage level */
1391 0x14, 0x82, /* set preemphasis and rise/fall time */
1392 0x13, 0x83, /* set source impedance adjusment */
1393 -1};
1394
1395static int liquid_v1_phy_init_seq[] = {
1396 0x44, 0x80,/* set VBUS valid threshold
1397 and disconnect valid threshold */
1398 0x3C, 0x81,/* update DC voltage level */
1399 0x18, 0x82,/* set preemphasis and rise/fall time */
1400 0x23, 0x83,/* set source impedance sdjusment */
1401 -1};
1402
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301403#ifdef CONFIG_MSM_BUS_SCALING
1404/* Bandwidth requests (zero) if no vote placed */
1405static struct msm_bus_vectors usb_init_vectors[] = {
1406 {
1407 .src = MSM_BUS_MASTER_SPS,
1408 .dst = MSM_BUS_SLAVE_EBI_CH0,
1409 .ab = 0,
1410 .ib = 0,
1411 },
1412};
1413
1414/* Bus bandwidth requests in Bytes/sec */
1415static struct msm_bus_vectors usb_max_vectors[] = {
1416 {
1417 .src = MSM_BUS_MASTER_SPS,
1418 .dst = MSM_BUS_SLAVE_EBI_CH0,
1419 .ab = 60000000, /* At least 480Mbps on bus. */
1420 .ib = 960000000, /* MAX bursts rate */
1421 },
1422};
1423
1424static struct msm_bus_paths usb_bus_scale_usecases[] = {
1425 {
1426 ARRAY_SIZE(usb_init_vectors),
1427 usb_init_vectors,
1428 },
1429 {
1430 ARRAY_SIZE(usb_max_vectors),
1431 usb_max_vectors,
1432 },
1433};
1434
1435static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
1436 usb_bus_scale_usecases,
1437 ARRAY_SIZE(usb_bus_scale_usecases),
1438 .name = "usb",
1439};
1440#endif
1441
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001442static struct msm_otg_platform_data msm_otg_pdata = {
1443 .mode = USB_OTG,
1444 .otg_control = OTG_PMIC_CONTROL,
1445 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001446 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
Anji jonnala4e3e6772011-09-15 18:53:42 +05301447 .power_budget = 750,
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301448#ifdef CONFIG_MSM_BUS_SCALING
1449 .bus_scale_table = &usb_bus_scale_pdata,
1450#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001451};
1452#endif
1453
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301454#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05301455#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301456static struct msm_hsic_host_platform_data msm_hsic_pdata = {
1457 .strobe = 150,
1458 .data = 151,
1459};
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301460
1461static struct smsc_hub_platform_data hsic_hub_pdata = {
1462 .hub_reset = HSIC_HUB_RESET_GPIO,
1463};
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301464#else
1465static struct msm_hsic_host_platform_data msm_hsic_pdata;
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301466static struct smsc_hub_platform_data hsic_hub_pdata;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301467#endif
1468
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301469static struct platform_device smsc_hub_device = {
1470 .name = "msm_smsc_hub",
1471 .id = -1,
1472 .dev = {
1473 .platform_data = &hsic_hub_pdata,
1474 },
1475};
1476
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001477#define PID_MAGIC_ID 0x71432909
1478#define SERIAL_NUM_MAGIC_ID 0x61945374
1479#define SERIAL_NUMBER_LENGTH 127
1480#define DLOAD_USB_BASE_ADD 0x2A03F0C8
1481
1482struct magic_num_struct {
1483 uint32_t pid;
1484 uint32_t serial_num;
1485};
1486
1487struct dload_struct {
1488 uint32_t reserved1;
1489 uint32_t reserved2;
1490 uint32_t reserved3;
1491 uint16_t reserved4;
1492 uint16_t pid;
1493 char serial_number[SERIAL_NUMBER_LENGTH];
1494 uint16_t reserved5;
1495 struct magic_num_struct magic_struct;
1496};
1497
1498static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
1499{
1500 struct dload_struct __iomem *dload = 0;
1501
1502 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
1503 if (!dload) {
1504 pr_err("%s: cannot remap I/O memory region: %08x\n",
1505 __func__, DLOAD_USB_BASE_ADD);
1506 return -ENXIO;
1507 }
1508
1509 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
1510 __func__, dload, pid, snum);
1511 /* update pid */
1512 dload->magic_struct.pid = PID_MAGIC_ID;
1513 dload->pid = pid;
1514
1515 /* update serial number */
1516 dload->magic_struct.serial_num = 0;
1517 if (!snum) {
1518 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
1519 goto out;
1520 }
1521
1522 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -07001523 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001524out:
1525 iounmap(dload);
1526 return 0;
1527}
1528
1529static struct android_usb_platform_data android_usb_pdata = {
1530 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1531};
1532
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001533static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001534 .name = "android_usb",
1535 .id = -1,
1536 .dev = {
1537 .platform_data = &android_usb_pdata,
1538 },
1539};
1540
1541static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1542 0x03, 0x0f,
1543};
1544
1545static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1546 0x00, 0x24, 0x54, 0x10,
1547 0x09, 0x03, 0x01,
1548 0x10, 0x54, 0x30, 0x0C,
1549 0x24, 0x30, 0x0f,
1550};
1551
1552static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1553 0x00, 0x24, 0x54, 0x10,
1554 0x09, 0x07, 0x01, 0x0B,
1555 0x10, 0x54, 0x30, 0x0C,
1556 0x24, 0x30, 0x0f,
1557};
1558
1559static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1560 [0] = {
1561 .mode = MSM_SPM_MODE_CLOCK_GATING,
1562 .notify_rpm = false,
1563 .cmd = spm_wfi_cmd_sequence,
1564 },
1565 [1] = {
1566 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1567 .notify_rpm = false,
1568 .cmd = spm_power_collapse_without_rpm,
1569 },
1570 [2] = {
1571 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1572 .notify_rpm = true,
1573 .cmd = spm_power_collapse_with_rpm,
1574 },
1575};
1576
1577static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1578 [0] = {
1579 .reg_base_addr = MSM_SAW0_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001580 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001581#if defined(CONFIG_MSM_AVS_HW)
1582 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1583 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1584#endif
1585 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001586 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001587 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1588 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1589 .vctl_timeout_us = 50,
1590 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1591 .modes = msm_spm_seq_list,
1592 },
1593 [1] = {
1594 .reg_base_addr = MSM_SAW1_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001595 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001596#if defined(CONFIG_MSM_AVS_HW)
1597 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1598 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1599#endif
1600 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001601 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001602 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1603 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1604 .vctl_timeout_us = 50,
1605 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1606 .modes = msm_spm_seq_list,
1607 },
1608};
1609
1610static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1611 0x00, 0x20, 0x03, 0x20,
1612 0x00, 0x0f,
1613};
1614
1615static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1616 0x00, 0x20, 0x34, 0x64,
1617 0x48, 0x07, 0x48, 0x20,
1618 0x50, 0x64, 0x04, 0x34,
1619 0x50, 0x0f,
1620};
1621static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1622 0x00, 0x10, 0x34, 0x64,
1623 0x48, 0x07, 0x48, 0x10,
1624 0x50, 0x64, 0x04, 0x34,
1625 0x50, 0x0F,
1626};
1627
1628static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1629 [0] = {
1630 .mode = MSM_SPM_L2_MODE_RETENTION,
1631 .notify_rpm = false,
1632 .cmd = l2_spm_wfi_cmd_sequence,
1633 },
1634 [1] = {
1635 .mode = MSM_SPM_L2_MODE_GDHS,
1636 .notify_rpm = true,
1637 .cmd = l2_spm_gdhs_cmd_sequence,
1638 },
1639 [2] = {
1640 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1641 .notify_rpm = true,
1642 .cmd = l2_spm_power_off_cmd_sequence,
1643 },
1644};
1645
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001646static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1647 [0] = {
1648 .reg_base_addr = MSM_SAW_L2_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001649 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001650 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001651 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1652 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1653 .modes = msm_spm_l2_seq_list,
1654 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1655 },
1656};
1657
Mohan Pallaka5e490392011-09-09 15:18:41 +05301658#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1659#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
1660
1661static struct msm_xo_voter *xo_handle_d1;
1662
1663static int isa1200_power(int on)
1664{
1665 int rc = 0;
1666
1667 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !!on);
1668
1669 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
1670 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
1671 if (rc < 0) {
1672 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
1673 __func__, on ? "" : "de-", rc);
1674 goto err_xo_vote;
1675 }
1676
1677 return 0;
1678
1679err_xo_vote:
1680 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !on);
1681 return rc;
1682}
1683
1684static int isa1200_dev_setup(bool enable)
1685{
1686 int rc = 0;
1687
1688 struct pm_gpio hap_gpio_config = {
1689 .direction = PM_GPIO_DIR_OUT,
1690 .pull = PM_GPIO_PULL_NO,
1691 .out_strength = PM_GPIO_STRENGTH_HIGH,
1692 .function = PM_GPIO_FUNC_NORMAL,
1693 .inv_int_pol = 0,
1694 .vin_sel = 2,
1695 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1696 .output_value = 0,
1697 };
1698
1699 if (enable == true) {
1700 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
1701 if (rc) {
1702 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1703 __func__, PM_HAP_EN_GPIO, rc);
1704 return rc;
1705 }
1706
1707 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
1708 if (rc) {
1709 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1710 __func__, PM_HAP_LEN_GPIO, rc);
1711 return rc;
1712 }
1713
1714 rc = gpio_request(HAP_SHIFT_LVL_OE_GPIO, "hap_shft_lvl_oe");
1715 if (rc) {
1716 pr_err("%s: unable to request gpio %d (%d)\n",
1717 __func__, HAP_SHIFT_LVL_OE_GPIO, rc);
1718 return rc;
1719 }
1720
1721 rc = gpio_direction_output(HAP_SHIFT_LVL_OE_GPIO, 0);
1722 if (rc) {
1723 pr_err("%s: Unable to set direction\n", __func__);
1724 goto free_gpio;
1725 }
1726
1727 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
1728 if (IS_ERR(xo_handle_d1)) {
1729 rc = PTR_ERR(xo_handle_d1);
1730 pr_err("%s: failed to get the handle for D1(%d)\n",
1731 __func__, rc);
1732 goto gpio_set_dir;
1733 }
1734 } else {
1735 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1736
1737 msm_xo_put(xo_handle_d1);
1738 }
1739
1740 return 0;
1741
1742gpio_set_dir:
1743 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, 0);
1744free_gpio:
1745 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1746 return rc;
1747}
1748
1749static struct isa1200_regulator isa1200_reg_data[] = {
1750 {
1751 .name = "vcc_i2c",
1752 .min_uV = ISA_I2C_VTG_MIN_UV,
1753 .max_uV = ISA_I2C_VTG_MAX_UV,
1754 .load_uA = ISA_I2C_CURR_UA,
1755 },
1756};
1757
1758static struct isa1200_platform_data isa1200_1_pdata = {
1759 .name = "vibrator",
1760 .dev_setup = isa1200_dev_setup,
1761 .power_on = isa1200_power,
1762 .hap_en_gpio = PM_HAP_EN_GPIO,
1763 .hap_len_gpio = PM_HAP_LEN_GPIO,
1764 .max_timeout = 15000,
1765 .mode_ctrl = PWM_GEN_MODE,
1766 .pwm_fd = {
1767 .pwm_div = 256,
1768 },
1769 .is_erm = false,
1770 .smart_en = true,
1771 .ext_clk_en = true,
1772 .chip_en = 1,
1773 .regulator_info = isa1200_reg_data,
1774 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1775};
1776
1777static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1778 {
1779 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
Mohan Pallaka5e490392011-09-09 15:18:41 +05301780 },
1781};
1782
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001783#define CYTTSP_TS_GPIO_IRQ 11
1784#define CYTTSP_TS_SLEEP_GPIO 50
1785#define CYTTSP_TS_RESOUT_N_GPIO 52
1786
1787/*virtual key support */
1788static ssize_t tma340_vkeys_show(struct kobject *kobj,
1789 struct kobj_attribute *attr, char *buf)
1790{
1791 return snprintf(buf, 200,
1792 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1793 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1794 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1795 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1796 "\n");
1797}
1798
1799static struct kobj_attribute tma340_vkeys_attr = {
1800 .attr = {
1801 .mode = S_IRUGO,
1802 },
1803 .show = &tma340_vkeys_show,
1804};
1805
1806static struct attribute *tma340_properties_attrs[] = {
1807 &tma340_vkeys_attr.attr,
1808 NULL
1809};
1810
1811static struct attribute_group tma340_properties_attr_group = {
1812 .attrs = tma340_properties_attrs,
1813};
1814
1815
1816static int cyttsp_platform_init(struct i2c_client *client)
1817{
1818 int rc = 0;
1819 static struct kobject *tma340_properties_kobj;
1820
1821 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1822 tma340_properties_kobj = kobject_create_and_add("board_properties",
1823 NULL);
1824 if (tma340_properties_kobj)
1825 rc = sysfs_create_group(tma340_properties_kobj,
1826 &tma340_properties_attr_group);
1827 if (!tma340_properties_kobj || rc)
1828 pr_err("%s: failed to create board_properties\n",
1829 __func__);
1830
1831 return 0;
1832}
1833
1834static struct cyttsp_regulator regulator_data[] = {
1835 {
1836 .name = "vdd",
1837 .min_uV = CY_TMA300_VTG_MIN_UV,
1838 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301839 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1840 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001841 },
1842 /* TODO: Remove after runtime PM is enabled in I2C driver */
1843 {
1844 .name = "vcc_i2c",
1845 .min_uV = CY_I2C_VTG_MIN_UV,
1846 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301847 .hpm_load_uA = CY_I2C_CURR_UA,
1848 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001849 },
1850};
1851
1852static struct cyttsp_platform_data cyttsp_pdata = {
1853 .panel_maxx = 634,
1854 .panel_maxy = 1166,
1855 .disp_maxx = 616,
1856 .disp_maxy = 1023,
1857 .disp_minx = 0,
1858 .disp_miny = 16,
1859 .flags = 0x01,
1860 .gen = CY_GEN3, /* or */
1861 .use_st = CY_USE_ST,
1862 .use_mt = CY_USE_MT,
1863 .use_hndshk = CY_SEND_HNDSHK,
1864 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05301865 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001866 .use_gestures = CY_USE_GESTURES,
1867 .fw_fname = "cyttsp_8960_cdp.hex",
1868 /* activate up to 4 groups
1869 * and set active distance
1870 */
1871 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
1872 CY_GEST_GRP3 | CY_GEST_GRP4 |
1873 CY_ACT_DIST,
1874 /* change act_intrvl to customize the Active power state
1875 * scanning/processing refresh interval for Operating mode
1876 */
1877 .act_intrvl = CY_ACT_INTRVL_DFLT,
1878 /* change tch_tmout to customize the touch timeout for the
1879 * Active power state for Operating mode
1880 */
1881 .tch_tmout = CY_TCH_TMOUT_DFLT,
1882 /* change lp_intrvl to customize the Low Power power state
1883 * scanning/processing refresh interval for Operating mode
1884 */
1885 .lp_intrvl = CY_LP_INTRVL_DFLT,
1886 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
1887 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
1888 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1889 .regulator_info = regulator_data,
1890 .num_regulators = ARRAY_SIZE(regulator_data),
1891 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05301892 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001893};
1894
1895static struct i2c_board_info cyttsp_info[] __initdata = {
1896 {
1897 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1898 .platform_data = &cyttsp_pdata,
1899#ifndef CY_USE_TIMER
1900 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1901#endif /* CY_USE_TIMER */
1902 },
1903};
1904
Jing Lindc4413c2012-01-16 15:22:52 -08001905/* configuration data for mxt1386 */
1906static const u8 mxt1386_config_data[] = {
Mohan Pallaka50837382011-09-07 11:00:57 +05301907 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001908 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301909 /* T38 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001910 11, 2, 0, 11, 11, 11, 0, 0, 0, 0,
Jing Lin2f863172011-10-17 10:56:58 -07001911 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1912 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1913 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1914 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1915 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1916 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301917 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001918 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05301919 /* T8 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001920 8, 0, 0, 0, 0, 0, 8, 14, 50, 215,
Mohan Pallaka50837382011-09-07 11:00:57 +05301921 /* T9 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001922 131, 0, 0, 26, 42, 0, 32, 63, 3, 5,
1923 0, 2, 1, 113, 10, 10, 8, 10, 255, 2,
1924 85, 5, 0, 0, 20, 20, 75, 25, 202, 29,
1925 10, 10, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05301926 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001927 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1928 0,
Anirudh Ghayaldab4e0d2012-01-09 14:59:27 +05301929 /* T18 Object */
1930 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301931 /* T22 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001932 5, 0, 0, 0, 0, 0, 0, 0, 30, 0,
1933 0, 0, 5, 8, 10, 13, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301934 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001935 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1936 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301937 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001938 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
1939 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301940 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001941 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301942 /* T28 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001943 0, 0, 0, 8, 12, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05301944 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001945 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301946 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001947 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301948 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001949 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301950};
1951
Jing Lin33b007d2011-12-21 17:40:23 -08001952/* configuration data for mxt1386e using V1.0 firmware */
1953static const u8 mxt1386e_config_data_v1_0[] = {
1954 /* T6 Object */
1955 0, 0, 0, 0, 0, 0,
1956 /* T38 Object */
1957 12, 1, 0, 17, 1, 12, 0, 0, 0, 0,
1958 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1959 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1960 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,
1964 /* T7 Object */
1965 100, 16, 50,
1966 /* T8 Object */
1967 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
1968 /* T9 Object */
1969 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
1970 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
1971 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
1972 10, 5, 0, 0, 0,
1973 /* T18 Object */
1974 0, 0,
1975 /* T24 Object */
1976 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1977 0, 0, 0, 0, 0, 0, 0, 0, 0,
1978 /* T25 Object */
1979 3, 0, 60, 115, 156, 99,
1980 /* T27 Object */
1981 0, 0, 0, 0, 0, 0, 0,
1982 /* T40 Object */
1983 0, 0, 0, 0, 0,
1984 /* T42 Object */
1985 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
1986 /* T43 Object */
1987 0, 0, 0, 0, 0, 0, 0,
1988 /* T46 Object */
1989 64, 0, 20, 20, 0, 0, 0, 0, 0,
1990 /* T47 Object */
1991 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
1992 /* T48 Object */
1993 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
1994 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
1995 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
1996 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
1997 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1998 0, 0, 0, 0,
1999 /* T56 Object */
2000 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2001 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2002 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2003 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2004 2, 99, 33,
2005};
2006
2007/* configuration data for mxt1386e using V2.1 firmware */
2008static const u8 mxt1386e_config_data_v2_1[] = {
2009 /* T6 Object */
2010 0, 0, 0, 0, 0, 0,
2011 /* T38 Object */
2012 12, 2, 0, 17, 1, 12, 0, 0, 0, 0,
2013 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2014 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2015 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2016 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2017 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2018 0, 0, 0, 0,
2019 /* T7 Object */
2020 100, 16, 50,
2021 /* T8 Object */
2022 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
2023 /* T9 Object */
2024 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
2025 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
2026 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
2027 10, 5, 0, 0, 0,
2028 /* T18 Object */
2029 0, 0,
2030 /* T24 Object */
2031 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2032 0, 0, 0, 0, 0, 0, 0, 0, 0,
2033 /* T25 Object */
2034 3, 0, 60, 115, 156, 99,
2035 /* T27 Object */
2036 0, 0, 0, 0, 0, 0, 0,
2037 /* T40 Object */
2038 0, 0, 0, 0, 0,
2039 /* T42 Object */
2040 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
2041 /* T43 Object */
2042 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
2043 16,
2044 /* T46 Object */
2045 64, 0, 20, 20, 0, 0, 0, 0, 0,
2046 /* T47 Object */
2047 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2048 /* T48 Object */
2049 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
2050 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
2051 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
2052 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
2053 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2054 0, 0, 0, 0,
2055 /* T56 Object */
2056 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2057 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2058 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2059 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2060 2, 99, 33, 0, 149, 24, 193, 255, 255, 255,
2061 255,
2062};
2063
Jing Lineec88ca2012-02-08 11:18:30 -08002064/* configuration data for mxt1386e on 3D SKU using V2.1 firmware */
2065static const u8 mxt1386e_config_data_3d[] = {
2066 /* T6 Object */
2067 0, 0, 0, 0, 0, 0,
2068 /* T38 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002069 13, 1, 0, 23, 2, 12, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002070 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2071 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2072 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2073 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2074 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2075 0, 0, 0, 0,
2076 /* T7 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002077 100, 10, 50,
Jing Lineec88ca2012-02-08 11:18:30 -08002078 /* T8 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002079 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002080 /* T9 Object */
2081 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
2082 0, 5, 5, 0, 10, 30, 10, 10, 175, 4,
Jing Lin66ba78b2012-02-24 21:25:12 -08002083 127, 7, 26, 21, 17, 19, 143, 35, 207, 40,
2084 20, 5, 54, 49, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002085 /* T18 Object */
2086 0, 0,
2087 /* T24 Object */
2088 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2089 0, 0, 0, 0, 0, 0, 0, 0, 0,
2090 /* T25 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002091 0, 0, 72, 113, 168, 97,
Jing Lineec88ca2012-02-08 11:18:30 -08002092 /* T27 Object */
2093 0, 0, 0, 0, 0, 0, 0,
2094 /* T40 Object */
2095 0, 0, 0, 0, 0,
2096 /* T42 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002097 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002098 /* T43 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002099 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2100 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002101 /* T46 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002102 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002103 /* T47 Object */
2104 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2105 /* T48 Object */
2106 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08002107 32, 50, 0, 10, 10, 0, 0, 100, 10, 90,
2108 0, 0, 0, 0, 0, 0, 0, 10, 1, 30,
2109 52, 10, 5, 0, 33, 0, 1, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002110 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2111 0, 0, 0, 0,
2112 /* T56 Object */
2113 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2114 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2115 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2116 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08002117 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2118 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002119};
2120
Amy Maloche08266db2011-11-04 11:07:16 -07002121#define MXT_TS_GPIO_IRQ 11
2122#define MXT_TS_LDO_EN_GPIO 50
2123#define MXT_TS_RESET_GPIO 52
Mohan Pallaka50837382011-09-07 11:00:57 +05302124
2125static void mxt_init_hw_liquid(void)
2126{
2127 int rc;
2128
Mohan Pallaka50837382011-09-07 11:00:57 +05302129 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
2130 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07002131 pr_err("%s: unable to request mxt_ldo_en_gpio [%d]\n",
2132 __func__, MXT_TS_LDO_EN_GPIO);
2133 return;
Mohan Pallaka50837382011-09-07 11:00:57 +05302134 }
2135
2136 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
2137 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07002138 pr_err("%s: unable to set_direction for mxt_ldo_en_gpio [%d]\n",
2139 __func__, MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05302140 goto err_ldo_gpio_req;
2141 }
2142
Mohan Pallaka50837382011-09-07 11:00:57 +05302143 return;
2144
Mohan Pallaka50837382011-09-07 11:00:57 +05302145err_ldo_gpio_req:
2146 gpio_free(MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05302147}
2148
Jing Lineec88ca2012-02-08 11:18:30 -08002149static struct mxt_config_info mxt_config_array_2d[] = {
Jing Lindc4413c2012-01-16 15:22:52 -08002150 {
2151 .config = mxt1386_config_data,
2152 .config_length = ARRAY_SIZE(mxt1386_config_data),
2153 .family_id = 0xA0,
2154 .variant_id = 0x0,
2155 .version = 0x10,
2156 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002157 .bootldr_id = MXT_BOOTLOADER_ID_1386,
Jing Lindc4413c2012-01-16 15:22:52 -08002158 },
Jing Lin33b007d2011-12-21 17:40:23 -08002159 {
2160 .config = mxt1386e_config_data_v1_0,
2161 .config_length = ARRAY_SIZE(mxt1386e_config_data_v1_0),
2162 .family_id = 0xA0,
2163 .variant_id = 0x2,
2164 .version = 0x10,
2165 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002166 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Linaeaeed52012-03-26 14:57:15 -07002167 .fw_name = "atmel_8960_liquid_v2_2_AA.hex",
Jing Lin33b007d2011-12-21 17:40:23 -08002168 },
2169 {
2170 .config = mxt1386e_config_data_v2_1,
2171 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
2172 .family_id = 0xA0,
2173 .variant_id = 0x7,
2174 .version = 0x21,
2175 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002176 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Linaeaeed52012-03-26 14:57:15 -07002177 .fw_name = "atmel_8960_liquid_v2_2_AA.hex",
2178 },
2179 {
2180 /* The config data for V2.2.AA is the same as for V2.1.AA */
2181 .config = mxt1386e_config_data_v2_1,
2182 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
2183 .family_id = 0xA0,
2184 .variant_id = 0x7,
2185 .version = 0x22,
2186 .build = 0xAA,
2187 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin33b007d2011-12-21 17:40:23 -08002188 },
Jing Lindc4413c2012-01-16 15:22:52 -08002189};
2190
Jing Lineec88ca2012-02-08 11:18:30 -08002191static struct mxt_platform_data mxt_platform_data_2d = {
2192 .config_array = mxt_config_array_2d,
2193 .config_array_size = ARRAY_SIZE(mxt_config_array_2d),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002194 .panel_minx = 0,
2195 .panel_maxx = 1365,
2196 .panel_miny = 0,
2197 .panel_maxy = 767,
2198 .disp_minx = 0,
2199 .disp_maxx = 1365,
2200 .disp_miny = 0,
2201 .disp_maxy = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05302202 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07002203 .i2c_pull_up = true,
Amy Maloche08266db2011-11-04 11:07:16 -07002204 .reset_gpio = MXT_TS_RESET_GPIO,
2205 .irq_gpio = MXT_TS_GPIO_IRQ,
Mohan Pallaka50837382011-09-07 11:00:57 +05302206};
2207
Jing Lineec88ca2012-02-08 11:18:30 -08002208static struct mxt_config_info mxt_config_array_3d[] = {
2209 {
2210 .config = mxt1386e_config_data_3d,
2211 .config_length = ARRAY_SIZE(mxt1386e_config_data_3d),
2212 .family_id = 0xA0,
2213 .variant_id = 0x7,
2214 .version = 0x21,
2215 .build = 0xAA,
2216 },
2217};
2218
2219static struct mxt_platform_data mxt_platform_data_3d = {
2220 .config_array = mxt_config_array_3d,
2221 .config_array_size = ARRAY_SIZE(mxt_config_array_3d),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002222 .panel_minx = 0,
2223 .panel_maxx = 1919,
2224 .panel_miny = 0,
2225 .panel_maxy = 1199,
2226 .disp_minx = 0,
2227 .disp_maxx = 1919,
2228 .disp_miny = 0,
2229 .disp_maxy = 1199,
Jing Lineec88ca2012-02-08 11:18:30 -08002230 .irqflags = IRQF_TRIGGER_FALLING,
2231 .i2c_pull_up = true,
2232 .reset_gpio = MXT_TS_RESET_GPIO,
2233 .irq_gpio = MXT_TS_GPIO_IRQ,
2234};
2235
Mohan Pallaka50837382011-09-07 11:00:57 +05302236static struct i2c_board_info mxt_device_info[] __initdata = {
2237 {
2238 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
Mohan Pallaka50837382011-09-07 11:00:57 +05302239 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
2240 },
2241};
2242
Manoj Rao14648742012-03-30 19:42:12 -07002243#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
2244static void mhl_sii_reset_gpio(int on)
2245{
2246 gpio_set_value(MHL_GPIO_RESET, on);
2247 return;
2248}
2249
2250/*
2251 * Request for GPIO allocations
2252 * Set appropriate GPIO directions
2253 */
2254static int mhl_sii_gpio_setup(int on)
2255{
2256 int ret;
2257
2258 if (on) {
2259 ret = gpio_request(MHL_GPIO_RESET, "W_RST#");
2260 if (ret < 0) {
2261 pr_err("GPIO RESET request failed: %d\n", ret);
2262 return -EBUSY;
2263 }
2264 ret = gpio_direction_output(MHL_GPIO_RESET, 1);
2265 if (ret < 0) {
2266 pr_err("SET GPIO RESET direction failed: %d\n", ret);
2267 gpio_free(MHL_GPIO_RESET);
2268 return -EBUSY;
2269 }
2270 ret = gpio_request(MHL_GPIO_INT, "W_INT");
2271 if (ret < 0) {
2272 pr_err("GPIO INT request failed: %d\n", ret);
2273 gpio_free(MHL_GPIO_RESET);
2274 return -EBUSY;
2275 }
2276 ret = gpio_direction_input(MHL_GPIO_INT);
2277 if (ret < 0) {
2278 pr_err("SET GPIO INTR direction failed: %d\n", ret);
2279 gpio_free(MHL_GPIO_RESET);
2280 gpio_free(MHL_GPIO_INT);
2281 return -EBUSY;
2282 }
2283 } else {
2284 gpio_free(MHL_GPIO_RESET);
2285 gpio_free(MHL_GPIO_INT);
2286 }
2287
2288 return 0;
2289}
2290
2291static struct msm_mhl_platform_data mhl_platform_data = {
2292 .irq = MSM_GPIO_TO_INT(4),
2293 .gpio_setup = mhl_sii_gpio_setup,
2294 .reset_pin = mhl_sii_reset_gpio,
2295};
2296#endif
2297
Eugene Yasmand2316b82011-12-07 18:23:48 +02002298static struct i2c_board_info sii_device_info[] __initdata = {
2299 {
Manoj Rao14648742012-03-30 19:42:12 -07002300#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
2301 /*
2302 * keeps SI 8334 as the default
2303 * MHL TX
2304 */
2305 I2C_BOARD_INFO("sii8334", 0x39),
2306 .platform_data = &mhl_platform_data,
2307#endif
2308#ifdef CONFIG_FB_MSM_HDMI_MHL_9244
Eugene Yasmand2316b82011-12-07 18:23:48 +02002309 I2C_BOARD_INFO("Sil-9244", 0x39),
Eugene Yasmand2316b82011-12-07 18:23:48 +02002310 .irq = MSM_GPIO_TO_INT(15),
Manoj Rao14648742012-03-30 19:42:12 -07002311#endif /* CONFIG_MSM_HDMI_MHL */
2312 .flags = I2C_CLIENT_WAKE,
Eugene Yasmand2316b82011-12-07 18:23:48 +02002313 },
2314};
2315
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002316static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
2317 .clk_freq = 100000,
2318 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002319};
2320
2321static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
2322 .clk_freq = 100000,
2323 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002324};
2325
2326static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
2327 .clk_freq = 100000,
2328 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002329};
2330
2331static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
2332 .clk_freq = 100000,
2333 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002334};
2335
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06002336static struct msm_pm_sleep_status_data msm_pm_slp_sts_data = {
2337 .base_addr = MSM_ACC0_BASE + 0x08,
2338 .cpu_offset = MSM_ACC1_BASE - MSM_ACC0_BASE,
2339 .mask = 1UL << 13,
2340};
2341
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002342static struct ks8851_pdata spi_eth_pdata = {
2343 .irq_gpio = KS8851_IRQ_GPIO,
2344 .rst_gpio = KS8851_RST_GPIO,
2345};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06002346
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002347static struct spi_board_info spi_board_info[] __initdata = {
2348 {
2349 .modalias = "ks8851",
2350 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2351 .max_speed_hz = 19200000,
2352 .bus_num = 0,
2353 .chip_select = 0,
2354 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002355 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002356 },
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07002357 {
2358 .modalias = "dsi_novatek_3d_panel_spi",
2359 .max_speed_hz = 10800000,
2360 .bus_num = 0,
2361 .chip_select = 1,
2362 .mode = SPI_MODE_0,
2363 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002364};
2365
2366static struct platform_device msm_device_saw_core0 = {
2367 .name = "saw-regulator",
2368 .id = 0,
2369 .dev = {
2370 .platform_data = &msm_saw_regulator_pdata_s5,
2371 },
2372};
2373
2374static struct platform_device msm_device_saw_core1 = {
2375 .name = "saw-regulator",
2376 .id = 1,
2377 .dev = {
2378 .platform_data = &msm_saw_regulator_pdata_s6,
2379 },
2380};
2381
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002382static struct tsens_platform_data msm_tsens_pdata = {
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002383 .slope = {910, 910, 910, 910, 910},
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002384 .tsens_factor = 1000,
2385 .hw_type = MSM_8960,
2386 .tsens_num_sensor = 5,
2387};
2388
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002389static struct platform_device msm_tsens_device = {
2390 .name = "tsens8960-tm",
2391 .id = -1,
2392};
2393
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002394#ifdef CONFIG_MSM_FAKE_BATTERY
2395static struct platform_device fish_battery_device = {
2396 .name = "fish_battery",
2397};
2398#endif
2399
David Collins26f05562011-06-20 09:56:28 -07002400static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002401 .name = GPIO_REGULATOR_DEV_NAME,
2402 .id = PM8921_MPP_PM_TO_SYS(7),
2403 .dev = {
2404 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2405 },
2406};
2407
David Collins26f05562011-06-20 09:56:28 -07002408static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002409 .name = GPIO_REGULATOR_DEV_NAME,
2410 .id = 91,
2411 .dev = {
2412 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2413 },
2414};
2415
David Collinsb10be1d2011-09-02 10:29:31 -07002416static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
2417 .name = GPIO_REGULATOR_DEV_NAME,
2418 .id = PM8921_GPIO_PM_TO_SYS(17),
2419 .dev = {
2420 .platform_data =
2421 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2422 },
2423};
2424
David Collins35a78f52011-12-14 15:54:25 -08002425static struct platform_device msm8960_device_ext_otg_sw_vreg __devinitdata = {
2426 .name = GPIO_REGULATOR_DEV_NAME,
2427 .id = PM8921_GPIO_PM_TO_SYS(42),
2428 .dev = {
2429 .platform_data =
2430 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_OTG_SW],
2431 },
2432};
2433
David Collins26f05562011-06-20 09:56:28 -07002434static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
2435 .name = "rpm-regulator",
2436 .id = -1,
2437 .dev = {
2438 .platform_data = &msm_rpm_regulator_pdata,
2439 },
2440};
Mayank Ranae009c922012-03-22 03:02:06 +05302441#ifdef CONFIG_SERIAL_MSM_HS
2442static int configure_uart_gpios(int on)
2443{
2444 int ret = 0, i;
2445 int uart_gpios[] = {93, 94, 95, 96};
2446
2447 for (i = 0; i < ARRAY_SIZE(uart_gpios); i++) {
2448 if (on) {
2449 ret = gpio_request(uart_gpios[i], NULL);
2450 if (ret) {
2451 pr_err("%s: unable to request uart gpio[%d]\n",
2452 __func__, uart_gpios[i]);
2453 break;
2454 }
2455 } else {
2456 gpio_free(uart_gpios[i]);
2457 }
2458 }
2459
2460 if (ret && on && i)
2461 for (; i >= 0; i--)
2462 gpio_free(uart_gpios[i]);
2463 return ret;
2464}
2465
2466static struct msm_serial_hs_platform_data msm_uart_dm9_pdata = {
Mayank Ranad85a5082012-04-29 17:24:13 -07002467 .gpio_config = configure_uart_gpios,
Mayank Ranae009c922012-03-22 03:02:06 +05302468};
2469#else
2470static struct msm_serial_hs_platform_data msm_uart_dm9_pdata;
2471#endif
David Collins26f05562011-06-20 09:56:28 -07002472
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002473static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07002474 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002475 &msm_device_smd,
Mayank Rana9f51f582011-08-04 18:35:59 +05302476 &msm_device_uart_dm6,
Mayank Ranae009c922012-03-22 03:02:06 +05302477 &msm_device_uart_dm9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002478 &msm_device_saw_core0,
2479 &msm_device_saw_core1,
2480 &msm8960_device_ext_5v_vreg,
David Collins87579612012-01-30 16:00:15 -08002481 &msm8960_device_ssbi_pmic,
David Collins96aa3e12012-02-29 10:31:34 -08002482 &msm8960_device_ext_otg_sw_vreg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002483 &msm8960_device_qup_spi_gsbi1,
2484 &msm8960_device_qup_i2c_gsbi3,
2485 &msm8960_device_qup_i2c_gsbi4,
2486 &msm8960_device_qup_i2c_gsbi10,
2487#ifndef CONFIG_MSM_DSPS
2488 &msm8960_device_qup_i2c_gsbi12,
2489#endif
2490 &msm_slim_ctrl,
2491 &msm_device_wcnss_wlan,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002492#if defined(CONFIG_QSEECOM)
2493 &qseecom_device,
2494#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002495#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2496 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2497 &qcrypto_device,
2498#endif
2499
2500#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2501 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2502 &qcedev_device,
2503#endif
2504#ifdef CONFIG_MSM_ROTATOR
2505 &msm_rotator_device,
2506#endif
2507 &msm_device_sps,
2508#ifdef CONFIG_MSM_FAKE_BATTERY
2509 &fish_battery_device,
2510#endif
Laura Abbottb93525f2012-04-12 09:57:19 -07002511 &msm8960_fmem_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002512#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07002513#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002514 &msm8960_android_pmem_device,
2515 &msm8960_android_pmem_adsp_device,
2516 &msm8960_android_pmem_audio_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002517#endif
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -07002518#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002519 &msm_device_vidc,
2520 &msm_device_bam_dmux,
2521 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07002522
Joel Nidera1261942011-09-12 16:30:09 +03002523#if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE)
2524#ifdef CONFIG_MSM_USE_TSIF1
2525 &msm_device_tsif[1],
2526#else
2527 &msm_device_tsif[0],
2528#endif
2529#endif
2530
Mona Hossain9c430e32011-07-27 11:04:47 -07002531#ifdef CONFIG_HW_RANDOM_MSM
2532 &msm_device_rng,
2533#endif
Laura Abbottd6183792011-08-19 13:42:24 -07002534#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002535 &msm8960_ion_dev,
Laura Abbottd6183792011-08-19 13:42:24 -07002536#endif
Praveen Chidambaram78499012011-11-01 17:15:17 -06002537 &msm8960_rpm_device,
2538 &msm8960_rpm_log_device,
2539 &msm8960_rpm_stat_device,
Mona Hossain11c03ac2011-10-26 12:42:10 -07002540 &msm_device_tz_log,
Pratik Patel7831c082011-06-08 21:44:37 -07002541#ifdef CONFIG_MSM_QDSS
Pratik Patel1403f2a2012-03-21 10:10:00 -07002542 &msm_qdss_device,
Pratik Patel7831c082011-06-08 21:44:37 -07002543 &msm_etb_device,
2544 &msm_tpiu_device,
2545 &msm_funnel_device,
Pratik Patel492b3012012-03-06 14:22:30 -08002546 &msm_etm_device,
Pratik Patel7831c082011-06-08 21:44:37 -07002547#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07002548 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002549 &msm8960_device_watchdog,
Laura Abbottb93525f2012-04-12 09:57:19 -07002550 &msm8960_rtb_device,
Praveen Chidambaram8ea3dcd2011-12-07 14:46:31 -07002551 &msm8960_cpu_idle_device,
Praveen Chidambaram5c8adf22012-02-23 18:44:37 -07002552 &msm8960_msm_gov_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002553 &msm8960_device_cache_erp,
Laura Abbottb93525f2012-04-12 09:57:19 -07002554 &msm8960_cache_dump_device,
Laura Abbott0577d7b2012-04-17 11:14:30 -07002555 &msm8960_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002556 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002557};
2558
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002559static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07002560 &msm8960_device_uart_gsbi5,
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002561 &msm8960_device_otg,
2562 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002563 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05302564 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002565 &android_usb_device,
2566 &msm_device_vidc,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002567 &msm_bus_apps_fabric,
2568 &msm_bus_sys_fabric,
2569 &msm_bus_mm_fabric,
2570 &msm_bus_sys_fpb,
2571 &msm_bus_cpss_fpb,
2572 &msm_pcm,
Kiran Kandi5e809b02012-01-31 00:24:33 -08002573 &msm_multi_ch_pcm,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002574 &msm_pcm_routing,
2575 &msm_cpudai0,
2576 &msm_cpudai1,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002577 &msm8960_cpudai_slimbus_2_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002578 &msm_cpudai_hdmi_rx,
2579 &msm_cpudai_bt_rx,
2580 &msm_cpudai_bt_tx,
2581 &msm_cpudai_fm_rx,
2582 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002583 &msm_cpudai_auxpcm_rx,
2584 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002585 &msm_cpu_fe,
2586 &msm_stub_codec,
2587 &msm_voice,
2588 &msm_voip,
2589 &msm_lpa_pcm,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05302590 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07002591 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07002592 &msm_cpudai_incall_record_rx,
2593 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002594
2595#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2596 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2597 &qcrypto_device,
2598#endif
2599
2600#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2601 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2602 &qcedev_device,
2603#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002604};
2605
2606static struct platform_device *rumi3_devices[] __initdata = {
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07002607 &msm8960_device_uart_gsbi5,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002608 &msm_kgsl_3d0,
2609 &msm_kgsl_2d0,
2610 &msm_kgsl_2d1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002611#ifdef CONFIG_MSM_GEMINI
2612 &msm8960_gemini_device,
2613#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002614};
2615
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002616static struct platform_device *cdp_devices[] __initdata = {
Stephen Boydeb819882011-08-29 14:46:30 -07002617 &msm_8960_q6_lpass,
2618 &msm_8960_q6_mss_fw,
2619 &msm_8960_q6_mss_sw,
Stephen Boyd322a9922011-09-20 01:05:54 -07002620 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07002621 &msm_pil_tzapps,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07002622 &msm_pil_dsps,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002623 &msm_pil_vidc,
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002624 &msm8960_device_otg,
2625 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002626 &msm_device_hsusb_host,
2627 &android_usb_device,
2628 &msm_pcm,
Kiran Kandi5e809b02012-01-31 00:24:33 -08002629 &msm_multi_ch_pcm,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002630 &msm_pcm_routing,
2631 &msm_cpudai0,
2632 &msm_cpudai1,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002633 &msm8960_cpudai_slimbus_2_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002634 &msm_cpudai_hdmi_rx,
2635 &msm_cpudai_bt_rx,
2636 &msm_cpudai_bt_tx,
2637 &msm_cpudai_fm_rx,
2638 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002639 &msm_cpudai_auxpcm_rx,
2640 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002641 &msm_cpu_fe,
2642 &msm_stub_codec,
2643 &msm_kgsl_3d0,
2644#ifdef CONFIG_MSM_KGSL_2D
2645 &msm_kgsl_2d0,
2646 &msm_kgsl_2d1,
2647#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002648#ifdef CONFIG_MSM_GEMINI
2649 &msm8960_gemini_device,
2650#endif
2651 &msm_voice,
2652 &msm_voip,
2653 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05302654 &msm_cpudai_afe_01_rx,
2655 &msm_cpudai_afe_01_tx,
2656 &msm_cpudai_afe_02_rx,
2657 &msm_cpudai_afe_02_tx,
2658 &msm_pcm_afe,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05302659 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07002660 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07002661 &msm_cpudai_incall_record_rx,
2662 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002663 &msm_pcm_hostless,
2664 &msm_bus_apps_fabric,
2665 &msm_bus_sys_fabric,
2666 &msm_bus_mm_fabric,
2667 &msm_bus_sys_fpb,
2668 &msm_bus_cpss_fpb,
2669};
2670
2671static void __init msm8960_i2c_init(void)
2672{
2673 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2674 &msm8960_i2c_qup_gsbi4_pdata;
2675
2676 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2677 &msm8960_i2c_qup_gsbi3_pdata;
2678
2679 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2680 &msm8960_i2c_qup_gsbi10_pdata;
2681
2682 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2683 &msm8960_i2c_qup_gsbi12_pdata;
2684}
2685
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002686static void __init msm8960_gfx_init(void)
2687{
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06002688 uint32_t soc_platform_version = socinfo_get_version();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002689 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
2690 struct kgsl_device_platform_data *kgsl_3d0_pdata =
2691 msm_kgsl_3d0.dev.platform_data;
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -06002692 kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
2693 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002694 }
2695}
2696
Subhash Jadavani933e6a62011-12-26 18:05:04 +05302697static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002698 {
2699 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2700 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2701 true,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002702 100, 650, 801, 200,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002703 },
2704
2705 {
2706 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2707 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2708 true,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002709 2000, 200, 576000, 2000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002710 },
2711
2712 {
2713 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2714 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2715 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002716 8500, 51, 1122000, 8500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002717 },
2718
2719 {
2720 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2721 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
2722 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002723 9000, 51, 1130300, 9000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002724 },
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06002725 {
2726 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2727 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2728 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002729 10000, 51, 1130300, 10000,
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06002730 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002731
2732 {
2733 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2734 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2735 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002736 12000, 14, 2205900, 12000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002737 },
2738
2739 {
2740 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2741 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2742 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002743 18000, 12, 2364250, 18000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002744 },
2745
2746 {
2747 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2748 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2749 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002750 23500, 10, 2667000, 23500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002751 },
2752
2753 {
2754 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2755 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2756 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002757 29700, 5, 2867000, 30000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002758 },
2759};
2760
Praveen Chidambaram78499012011-11-01 17:15:17 -06002761static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2762 .levels = &msm_rpmrs_levels[0],
2763 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2764 .vdd_mem_levels = {
2765 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2766 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2767 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2768 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2769 },
2770 .vdd_dig_levels = {
2771 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
2772 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
2773 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
2774 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
2775 },
2776 .vdd_mask = 0x7FFFFF,
2777 .rpmrs_target_id = {
2778 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2779 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
2780 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
2781 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
2782 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
2783 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
2784 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2785 },
2786};
2787
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002788static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2789 .mode = MSM_PM_BOOT_CONFIG_TZ,
2790};
2791
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002792#ifdef CONFIG_I2C
2793#define I2C_SURF 1
2794#define I2C_FFA (1 << 1)
2795#define I2C_RUMI (1 << 2)
2796#define I2C_SIM (1 << 3)
2797#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03002798#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002799
2800struct i2c_registry {
2801 u8 machs;
2802 int bus;
2803 struct i2c_board_info *info;
2804 int len;
2805};
2806
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002807/* Sensors DSPS platform data */
2808#ifdef CONFIG_MSM_DSPS
2809#define DSPS_PIL_GENERIC_NAME "dsps"
2810#endif /* CONFIG_MSM_DSPS */
2811
2812static void __init msm8960_init_dsps(void)
2813{
2814#ifdef CONFIG_MSM_DSPS
2815 struct msm_dsps_platform_data *pdata =
2816 msm_dsps_device.dev.platform_data;
2817 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
2818 pdata->gpios = NULL;
2819 pdata->gpios_num = 0;
2820
2821 platform_device_register(&msm_dsps_device);
2822#endif /* CONFIG_MSM_DSPS */
2823}
2824
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -08002825static int hsic_peripheral_status = 1;
2826static DEFINE_MUTEX(hsic_status_lock);
2827
2828void peripheral_connect()
2829{
2830 mutex_lock(&hsic_status_lock);
2831 if (hsic_peripheral_status)
2832 goto out;
2833 platform_device_add(&msm_device_hsic_host);
2834 hsic_peripheral_status = 1;
2835out:
2836 mutex_unlock(&hsic_status_lock);
2837}
2838EXPORT_SYMBOL(peripheral_connect);
2839
2840void peripheral_disconnect()
2841{
2842 mutex_lock(&hsic_status_lock);
2843 if (!hsic_peripheral_status)
2844 goto out;
2845 platform_device_del(&msm_device_hsic_host);
2846 hsic_peripheral_status = 0;
2847out:
2848 mutex_unlock(&hsic_status_lock);
2849}
2850EXPORT_SYMBOL(peripheral_disconnect);
2851
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05302852static void __init msm8960_init_smsc_hub(void)
2853{
2854 uint32_t version = socinfo_get_version();
2855
2856 if (SOCINFO_VERSION_MAJOR(version) == 1)
2857 return;
2858
2859 if (machine_is_msm8960_liquid())
2860 platform_device_register(&smsc_hub_device);
2861}
2862
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002863static void __init msm8960_init_hsic(void)
2864{
2865#ifdef CONFIG_USB_EHCI_MSM_HSIC
2866 uint32_t version = socinfo_get_version();
2867
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08002868 if (SOCINFO_VERSION_MAJOR(version) == 1)
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002869 return;
2870
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002871 if (PLATFORM_IS_CHARM25() || machine_is_msm8960_liquid())
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08002872 platform_device_register(&msm_device_hsic_host);
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002873#endif
2874}
2875
Amir Samuelov5137e392011-09-21 17:31:25 +03002876#ifdef CONFIG_ISL9519_CHARGER
2877static struct isl_platform_data isl_data __initdata = {
2878 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
2879 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
2880 .max_system_voltage = 4200,
2881 .min_system_voltage = 3200,
Amir Samuelov95f49ff2012-01-29 09:14:08 +02002882 .chgcurrent = 1900,
2883 .term_current = 0,
Amir Samuelov5137e392011-09-21 17:31:25 +03002884 .input_current = 2048,
2885};
2886
2887static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
2888 {
2889 I2C_BOARD_INFO("isl9519q", 0x9),
2890 .irq = 0, /* Not required when notify-by-pmic */
2891 .platform_data = &isl_data,
2892 },
2893};
2894#endif /* CONFIG_ISL9519_CHARGER */
2895
Amir Samuelov755616d2011-12-13 16:34:46 +02002896static struct i2c_board_info liquid_io_expander_i2c_info[] __initdata = {
2897 {
2898 I2C_BOARD_INFO("sx1508q", 0x20),
2899 .platform_data = &msm8960_sx150x_data[SX150X_LIQUID]
2900 },
2901};
2902
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002903static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Amir Samuelov5137e392011-09-21 17:31:25 +03002904#ifdef CONFIG_ISL9519_CHARGER
2905 {
2906 I2C_LIQUID,
2907 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2908 isl_charger_i2c_info,
2909 ARRAY_SIZE(isl_charger_i2c_info),
2910 },
2911#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002912 {
2913 I2C_SURF | I2C_FFA | I2C_FLUID,
2914 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2915 cyttsp_info,
2916 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07002917 },
Mohan Pallaka50837382011-09-07 11:00:57 +05302918 {
2919 I2C_LIQUID,
2920 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2921 mxt_device_info,
2922 ARRAY_SIZE(mxt_device_info),
2923 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05302924 {
Manoj Rao14648742012-03-30 19:42:12 -07002925 I2C_SURF | I2C_FFA | I2C_LIQUID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302926 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Eugene Yasmand2316b82011-12-07 18:23:48 +02002927 sii_device_info,
2928 ARRAY_SIZE(sii_device_info),
2929 },
2930 {
2931 I2C_LIQUID,
2932 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302933 msm_isa1200_board_info,
2934 ARRAY_SIZE(msm_isa1200_board_info),
2935 },
Amir Samuelov755616d2011-12-13 16:34:46 +02002936 {
2937 I2C_LIQUID,
2938 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2939 liquid_io_expander_i2c_info,
2940 ARRAY_SIZE(liquid_io_expander_i2c_info),
2941 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002942};
2943#endif /* CONFIG_I2C */
2944
2945static void __init register_i2c_devices(void)
2946{
2947#ifdef CONFIG_I2C
2948 u8 mach_mask = 0;
2949 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08002950#ifdef CONFIG_MSM_CAMERA
2951 struct i2c_registry msm8960_camera_i2c_devices = {
2952 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
2953 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
2954 msm8960_camera_board_info.board_info,
2955 msm8960_camera_board_info.num_i2c_board_info,
2956 };
2957#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002958
2959 /* Build the matching 'supported_machs' bitmask */
2960 if (machine_is_msm8960_cdp())
2961 mach_mask = I2C_SURF;
2962 else if (machine_is_msm8960_rumi3())
2963 mach_mask = I2C_RUMI;
2964 else if (machine_is_msm8960_sim())
2965 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07002966 else if (machine_is_msm8960_fluid())
2967 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03002968 else if (machine_is_msm8960_liquid())
2969 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07002970 else if (machine_is_msm8960_mtp())
2971 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002972 else
2973 pr_err("unmatched machine ID in register_i2c_devices\n");
2974
Jing Lineec88ca2012-02-08 11:18:30 -08002975 if (machine_is_msm8960_liquid()) {
2976 if (SOCINFO_VERSION_MAJOR(socinfo_get_platform_version()) == 3)
2977 mxt_device_info[0].platform_data =
2978 &mxt_platform_data_3d;
2979 else
2980 mxt_device_info[0].platform_data =
2981 &mxt_platform_data_2d;
2982 }
2983
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002984 /* Run the array and install devices as appropriate */
2985 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
2986 if (msm8960_i2c_devices[i].machs & mach_mask)
2987 i2c_register_board_info(msm8960_i2c_devices[i].bus,
2988 msm8960_i2c_devices[i].info,
2989 msm8960_i2c_devices[i].len);
2990 }
Kevin Chan09f4e662011-12-16 08:17:02 -08002991#ifdef CONFIG_MSM_CAMERA
2992 if (msm8960_camera_i2c_devices.machs & mach_mask)
2993 i2c_register_board_info(msm8960_camera_i2c_devices.bus,
2994 msm8960_camera_i2c_devices.info,
2995 msm8960_camera_i2c_devices.len);
2996#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002997#endif
2998}
2999
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003000static void __init msm8960_sim_init(void)
3001{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07003002 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
3003 &msm8960_device_watchdog.dev.platform_data;
3004
3005 wdog_pdata->bark_time = 15000;
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08003006 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06003007 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
3008 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003009 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07003010 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07003011 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003012 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003013
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003014 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08003015 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003016 msm8960_i2c_init();
3017 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3018 msm_spm_l2_init(msm_spm_l2_data);
3019 msm8960_init_buses();
3020 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003021 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003022 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07003023 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003024
3025 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3026 &msm8960_qup_spi_gsbi1_pdata;
3027 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
3028
3029 msm8960_init_mmc();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08003030 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003031 slim_register_board_info(msm_slim_devices,
3032 ARRAY_SIZE(msm_slim_devices));
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06003033 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06003034 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003035}
3036
3037static void __init msm8960_rumi3_init(void)
3038{
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08003039 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06003040 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
3041 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003042 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07003043 platform_device_register(&msm8960_device_rpm_regulator);
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08003044 msm8960_init_gpiomux();
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003045 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003046 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3047 &msm8960_qup_spi_gsbi1_pdata;
3048 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
3049 msm8960_i2c_init();
3050 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3051 msm_spm_l2_init(msm_spm_l2_data);
3052 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003053 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003054 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003055 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003056 register_i2c_devices();
Mayank Ranae009c922012-03-22 03:02:06 +05303057
Mayank Ranae009c922012-03-22 03:02:06 +05303058
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08003059 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003060 slim_register_board_info(msm_slim_devices,
3061 ARRAY_SIZE(msm_slim_devices));
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06003062 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06003063 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003064}
3065
3066static void __init msm8960_cdp_init(void)
3067{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07003068 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
3069 pr_err("meminfo_init() failed!\n");
3070
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08003071 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06003072 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
3073 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07003074
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003075 regulator_suppress_info_printing();
3076 if (msm_xo_init())
3077 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07003078 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07003079 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05303080 if (machine_is_msm8960_liquid())
3081 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003082 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05303083 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
3084 machine_is_msm8960_cdp()) {
3085 msm_otg_pdata.phy_init_seq = wr_phy_init_seq;
3086 } else if (machine_is_msm8960_liquid()) {
3087 msm_otg_pdata.phy_init_seq =
3088 liquid_v1_phy_init_seq;
3089 }
Ofir Cohen94213a72012-05-03 14:26:32 +03003090 android_usb_pdata.swfi_latency =
Anji jonnalaa7c1c5c2011-12-12 12:20:36 +05303091 msm_rpmrs_levels[0].latency_us;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303092 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303093 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2 &&
3094 machine_is_msm8960_liquid())
3095 msm_device_hsic_host.dev.parent = &smsc_hub_device.dev;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08003096 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003097 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3098 &msm8960_qup_spi_gsbi1_pdata;
3099 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003100
3101 msm8960_init_pmic();
Mohan Pallakaf69f0492011-11-21 13:08:33 +05303102 if ((SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2 &&
3103 (machine_is_msm8960_mtp())) || machine_is_msm8960_liquid())
3104 msm_isa1200_board_info[0].platform_data = &isa1200_1_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003105 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003106 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003107 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3108 msm_spm_l2_init(msm_spm_l2_data);
3109 msm8960_init_buses();
Matt Wagantall1f65d9d2012-04-25 14:24:20 -07003110 platform_add_devices(msm8960_footswitch, msm8960_num_footswitch);
David Collinsb10be1d2011-09-02 10:29:31 -07003111 if (machine_is_msm8960_liquid())
3112 platform_device_register(&msm8960_device_ext_3p3v_vreg);
David Collinsd5a40732011-11-29 15:53:56 -08003113 if (machine_is_msm8960_cdp())
3114 platform_device_register(&msm8960_device_ext_l2_vreg);
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07003115
3116 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
3117 platform_device_register(&msm8960_device_uart_gsbi8);
3118 else
3119 platform_device_register(&msm8960_device_uart_gsbi5);
3120
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003121 /* For 8960 Fusion 2.2 Primary IPC */
Mayank Ranad85a5082012-04-29 17:24:13 -07003122 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE) {
3123 msm_uart_dm9_pdata.wakeup_irq = gpio_to_irq(94); /* GSBI9(2) */
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003124 msm_device_uart_dm9.dev.platform_data = &msm_uart_dm9_pdata;
Mayank Ranad85a5082012-04-29 17:24:13 -07003125 }
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003126
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003127 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003128 msm8960_pm8921_gpio_mpp_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003129 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303130 msm8960_init_smsc_hub();
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003131 msm8960_init_hsic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003132 msm8960_init_cam();
3133 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07003134 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05303135 if (machine_is_msm8960_liquid())
3136 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003137 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08003138 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003139 slim_register_board_info(msm_slim_devices,
3140 ARRAY_SIZE(msm_slim_devices));
3141 msm8960_init_dsps();
Larry Bassela7eadea2011-07-14 10:46:00 -07003142 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06003143 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06003144 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Joel Kingb8352a12011-11-15 18:46:24 -08003145 if (PLATFORM_IS_CHARM25())
3146 platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003147}
3148
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003149MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
3150 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003151 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003152 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303153 .handle_irq = gic_handle_irq,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003154 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003155 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003156 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003157 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003158MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003159
3160MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
3161 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003162 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003163 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303164 .handle_irq = gic_handle_irq,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003165 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003166 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003167 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003168 .init_very_early = msm8960_early_memory,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003169MACHINE_END
3170
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003171MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
3172 .map_io = msm8960_map_io,
3173 .reserve = msm8960_reserve,
3174 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303175 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003176 .timer = &msm_timer,
3177 .init_machine = msm8960_cdp_init,
3178 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003179 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003180MACHINE_END
3181
3182MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
3183 .map_io = msm8960_map_io,
3184 .reserve = msm8960_reserve,
3185 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303186 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003187 .timer = &msm_timer,
3188 .init_machine = msm8960_cdp_init,
3189 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003190 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003191MACHINE_END
3192
3193MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
3194 .map_io = msm8960_map_io,
3195 .reserve = msm8960_reserve,
3196 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303197 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003198 .timer = &msm_timer,
3199 .init_machine = msm8960_cdp_init,
3200 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003201 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003202MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003203
3204MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
3205 .map_io = msm8960_map_io,
3206 .reserve = msm8960_reserve,
3207 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303208 .handle_irq = gic_handle_irq,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003209 .timer = &msm_timer,
3210 .init_machine = msm8960_cdp_init,
3211 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003212 .init_very_early = msm8960_early_memory,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003213MACHINE_END