blob: 6328ab315c4962247abb62f3240daf05e98cfb19 [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
227static struct platform_device android_pmem_device = {
228 .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};
239static struct platform_device android_pmem_adsp_device = {
240 .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
252static struct platform_device android_pmem_audio_device = {
253 .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
Larry Bassel41a055b2011-12-06 16:15:14 -0800260struct fmem_platform_data fmem_pdata = {
261};
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 -0800294#if defined(CONFIG_MSM_RTB)
295static struct msm_rtb_platform_data msm_rtb_pdata = {
296 .size = SZ_1M,
297};
298
299static int __init msm_rtb_set_buffer_size(char *p)
300{
301 int s;
302
303 s = memparse(p, NULL);
304 msm_rtb_pdata.size = ALIGN(s, SZ_4K);
305 return 0;
306}
307early_param("msm_rtb_size", msm_rtb_set_buffer_size);
308
309
310static struct platform_device msm_rtb_device = {
311 .name = "msm_rtb",
312 .id = -1,
313 .dev = {
314 .platform_data = &msm_rtb_pdata,
315 },
316};
317#endif
318
319static void __init reserve_rtb_memory(void)
320{
321#if defined(CONFIG_MSM_RTB)
322 msm8960_reserve_table[MEMTYPE_EBI1].size += msm_rtb_pdata.size;
323#endif
324}
325
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700326static void __init size_pmem_devices(void)
327{
328#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700329#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700330 android_pmem_adsp_pdata.size = pmem_adsp_size;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800331
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800332 if (!pmem_param_set) {
333 if (machine_is_msm8960_liquid())
334 pmem_size = MSM_LIQUID_PMEM_SIZE;
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700335 if (msm8960_hdmi_as_primary_selected())
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800336 pmem_size = MSM_HDMI_PRIM_PMEM_SIZE;
337 }
338
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700339 android_pmem_pdata.size = pmem_size;
340 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700341#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
342#endif /*CONFIG_ANDROID_PMEM*/
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700343}
344
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700345#ifdef CONFIG_ANDROID_PMEM
346#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700347static void __init reserve_memory_for(struct android_pmem_platform_data *p)
348{
349 msm8960_reserve_table[p->memory_type].size += p->size;
350}
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700351#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
352#endif /*CONFIG_ANDROID_PMEM*/
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700353
354static void __init reserve_pmem_memory(void)
355{
356#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700357#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700358 reserve_memory_for(&android_pmem_adsp_pdata);
359 reserve_memory_for(&android_pmem_pdata);
360 reserve_memory_for(&android_pmem_audio_pdata);
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700361#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700362 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
363#endif
364}
365
Larry Basselb4126da2011-07-18 14:31:33 -0700366static int msm8960_paddr_to_memtype(unsigned int paddr)
367{
368 return MEMTYPE_EBI1;
369}
370
Olav Hauganf6dc7742012-02-15 09:11:55 -0800371#define FMEM_ENABLED 1
372
Laura Abbottd6183792011-08-19 13:42:24 -0700373#ifdef CONFIG_ION_MSM
Olav Haugan0703dbf2011-12-19 17:53:38 -0800374#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
375static struct ion_cp_heap_pdata cp_mm_ion_pdata = {
376 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugan42ebe712012-01-10 16:30:58 -0800377 .align = PAGE_SIZE,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800378 .reusable = FMEM_ENABLED,
379 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700380 .fixed_position = FIXED_MIDDLE,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800381};
382
383static struct ion_cp_heap_pdata cp_mfc_ion_pdata = {
384 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugan42ebe712012-01-10 16:30:58 -0800385 .align = PAGE_SIZE,
Olav Haugan65f4bd82011-12-13 11:50:08 -0800386 .reusable = 0,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800387 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700388 .fixed_position = FIXED_HIGH,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800389};
390
391static struct ion_co_heap_pdata co_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800392 .adjacent_mem_id = INVALID_HEAP_ID,
393 .align = PAGE_SIZE,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800394 .mem_is_fmem = 0,
Olav Haugan42ebe712012-01-10 16:30:58 -0800395};
396
397static struct ion_co_heap_pdata fw_co_ion_pdata = {
398 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
399 .align = SZ_128K,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800400 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700401 .fixed_position = FIXED_LOW,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800402};
403#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800404
405/**
406 * These heaps are listed in the order they will be allocated. Due to
407 * video hardware restrictions and content protection the FW heap has to
408 * be allocated adjacent (below) the MM heap and the MFC heap has to be
409 * allocated after the MM heap to ensure MFC heap is not more than 256MB
410 * away from the base address of the FW heap.
411 * However, the order of FW heap and MM heap doesn't matter since these
412 * two heaps are taken care of by separate code to ensure they are adjacent
413 * to each other.
414 * Don't swap the order unless you know what you are doing!
415 */
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800416static struct ion_platform_data ion_pdata = {
Laura Abbott2d1760b2011-09-29 21:31:24 -0700417 .nr = MSM_ION_HEAP_NUM,
Laura Abbottd6183792011-08-19 13:42:24 -0700418 .heaps = {
419 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800420 .id = ION_SYSTEM_HEAP_ID,
Laura Abbottd6183792011-08-19 13:42:24 -0700421 .type = ION_HEAP_TYPE_SYSTEM,
Laura Abbottd6183792011-08-19 13:42:24 -0700422 .name = ION_VMALLOC_HEAP_NAME,
423 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700424#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -0700425 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800426 .id = ION_CP_MM_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800427 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800428 .name = ION_MM_HEAP_NAME,
429 .size = MSM_ION_MM_SIZE,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700430 .memory_type = ION_EBI_TYPE,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800431 .extra_data = (void *) &cp_mm_ion_pdata,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700432 },
Laura Abbott8c017362011-09-22 20:59:12 -0700433 {
Olav Haugan42ebe712012-01-10 16:30:58 -0800434 .id = ION_MM_FIRMWARE_HEAP_ID,
435 .type = ION_HEAP_TYPE_CARVEOUT,
436 .name = ION_MM_FIRMWARE_HEAP_NAME,
437 .size = MSM_ION_MM_FW_SIZE,
438 .memory_type = ION_EBI_TYPE,
439 .extra_data = (void *) &fw_co_ion_pdata,
440 },
441 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800442 .id = ION_CP_MFC_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800443 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800444 .name = ION_MFC_HEAP_NAME,
445 .size = MSM_ION_MFC_SIZE,
446 .memory_type = ION_EBI_TYPE,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800447 .extra_data = (void *) &cp_mfc_ion_pdata,
Olav Hauganb5be7992011-11-18 14:29:02 -0800448 },
Olav Haugan32594552012-03-13 11:40:05 -0700449#ifndef CONFIG_MSM_IOMMU
Olav Hauganb5be7992011-11-18 14:29:02 -0800450 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800451 .id = ION_SF_HEAP_ID,
452 .type = ION_HEAP_TYPE_CARVEOUT,
453 .name = ION_SF_HEAP_NAME,
454 .size = MSM_ION_SF_SIZE,
455 .memory_type = ION_EBI_TYPE,
456 .extra_data = (void *) &co_ion_pdata,
457 },
Olav Haugan32594552012-03-13 11:40:05 -0700458#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800459 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800460 .id = ION_IOMMU_HEAP_ID,
Laura Abbott8c017362011-09-22 20:59:12 -0700461 .type = ION_HEAP_TYPE_IOMMU,
462 .name = ION_IOMMU_HEAP_NAME,
463 },
Olav Haugan80854eb2012-01-12 12:00:23 -0800464 {
465 .id = ION_QSECOM_HEAP_ID,
466 .type = ION_HEAP_TYPE_CARVEOUT,
467 .name = ION_QSECOM_HEAP_NAME,
468 .size = MSM_ION_QSECOM_SIZE,
469 .memory_type = ION_EBI_TYPE,
470 .extra_data = (void *) &co_ion_pdata,
471 },
Olav Haugan7355db02012-01-13 16:59:13 -0800472 {
473 .id = ION_AUDIO_HEAP_ID,
474 .type = ION_HEAP_TYPE_CARVEOUT,
475 .name = ION_AUDIO_HEAP_NAME,
476 .size = MSM_ION_AUDIO_SIZE,
477 .memory_type = ION_EBI_TYPE,
478 .extra_data = (void *) &co_ion_pdata,
479 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700480#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700481 }
482};
483
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800484static struct platform_device ion_dev = {
Laura Abbottd6183792011-08-19 13:42:24 -0700485 .name = "ion-msm",
486 .id = 1,
487 .dev = { .platform_data = &ion_pdata },
488};
489#endif
490
Larry Bassel41a055b2011-12-06 16:15:14 -0800491struct platform_device fmem_device = {
492 .name = "fmem",
493 .id = 1,
494 .dev = { .platform_data = &fmem_pdata },
495};
496
Olav Haugan65f4bd82011-12-13 11:50:08 -0800497static void __init adjust_mem_for_liquid(void)
Laura Abbottd6183792011-08-19 13:42:24 -0700498{
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800499 unsigned int i;
500
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800501 if (!pmem_param_set) {
502 if (machine_is_msm8960_liquid())
503 msm_ion_sf_size = MSM_LIQUID_ION_SF_SIZE;
504
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700505 if (msm8960_hdmi_as_primary_selected())
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800506 msm_ion_sf_size = MSM_HDMI_PRIM_ION_SF_SIZE;
507
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700508 if (machine_is_msm8960_liquid() ||
509 msm8960_hdmi_as_primary_selected()) {
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800510 for (i = 0; i < ion_pdata.nr; i++) {
511 if (ion_pdata.heaps[i].id == ION_SF_HEAP_ID) {
512 ion_pdata.heaps[i].size =
513 msm_ion_sf_size;
514 pr_debug("msm_ion_sf_size 0x%x\n",
515 msm_ion_sf_size);
516 break;
517 }
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800518 }
519 }
520 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800521}
522
523static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
524 unsigned long size)
525{
526 msm8960_reserve_table[mem_type].size += size;
527}
528
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700529static void __init msm8960_reserve_fixed_area(unsigned long fixed_area_size)
530{
531#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
532 int ret;
533
534 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
535 panic("fixed area size is larger than %dM\n",
536 MAX_FIXED_AREA_SIZE >> 20);
537
538 reserve_info->fixed_area_size = fixed_area_size;
539 reserve_info->fixed_area_start = MSM8960_FW_START;
540
541 ret = memblock_remove(reserve_info->fixed_area_start,
542 reserve_info->fixed_area_size);
543 BUG_ON(ret);
544#endif
545}
546
Olav Haugan65f4bd82011-12-13 11:50:08 -0800547/**
548 * Reserve memory for ION and calculate amount of reusable memory for fmem.
549 * We only reserve memory for heaps that are not reusable. However, we only
550 * support one reusable heap at the moment so we ignore the reusable flag for
551 * other than the first heap with reusable flag set. Also handle special case
Olav Hauganf6dc7742012-02-15 09:11:55 -0800552 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
553 * at a higher address than FW in addition to not more than 256MB away from the
554 * base address of the firmware. This means that if MM is reusable the other
555 * two heaps must be allocated in the same region as FW. This is handled by the
556 * mem_is_fmem flag in the platform data. In addition the MM heap must be
557 * adjacent to the FW heap for content protection purposes.
Olav Haugan65f4bd82011-12-13 11:50:08 -0800558 */
559static void __init reserve_ion_memory(void)
560{
561#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
562 unsigned int i;
563 unsigned int reusable_count = 0;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700564 unsigned int fixed_size = 0;
565 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
566 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800567
568 adjust_mem_for_liquid();
569 fmem_pdata.size = 0;
Olav Hauganf6dc7742012-02-15 09:11:55 -0800570 fmem_pdata.reserved_size_low = 0;
571 fmem_pdata.reserved_size_high = 0;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700572 fixed_low_size = 0;
573 fixed_middle_size = 0;
574 fixed_high_size = 0;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800575
576 /* We only support 1 reusable heap. Check if more than one heap
577 * is specified as reusable and set as non-reusable if found.
578 */
579 for (i = 0; i < ion_pdata.nr; ++i) {
580 const struct ion_platform_heap *heap = &(ion_pdata.heaps[i]);
581
582 if (heap->type == ION_HEAP_TYPE_CP && heap->extra_data) {
583 struct ion_cp_heap_pdata *data = heap->extra_data;
584
585 reusable_count += (data->reusable) ? 1 : 0;
586
587 if (data->reusable && reusable_count > 1) {
588 pr_err("%s: Too many heaps specified as "
589 "reusable. Heap %s was not configured "
590 "as reusable.\n", __func__, heap->name);
591 data->reusable = 0;
592 }
593 }
594 }
595
596 for (i = 0; i < ion_pdata.nr; ++i) {
Olav Haugan65f4bd82011-12-13 11:50:08 -0800597 const struct ion_platform_heap *heap = &(ion_pdata.heaps[i]);
598
599 if (heap->extra_data) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700600 int fixed_position = NOT_FIXED;
601 int mem_is_fmem = 0;
602
Olav Haugan65f4bd82011-12-13 11:50:08 -0800603 switch (heap->type) {
604 case ION_HEAP_TYPE_CP:
Olav Hauganf6dc7742012-02-15 09:11:55 -0800605 mem_is_fmem = ((struct ion_cp_heap_pdata *)
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700606 heap->extra_data)->mem_is_fmem;
607 fixed_position = ((struct ion_cp_heap_pdata *)
608 heap->extra_data)->fixed_position;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800609 break;
610 case ION_HEAP_TYPE_CARVEOUT:
Olav Hauganf6dc7742012-02-15 09:11:55 -0800611 mem_is_fmem = ((struct ion_co_heap_pdata *)
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700612 heap->extra_data)->mem_is_fmem;
613 fixed_position = ((struct ion_co_heap_pdata *)
614 heap->extra_data)->fixed_position;
615 break;
616 default:
617 break;
618 }
619
620 if (fixed_position != NOT_FIXED)
621 fixed_size += heap->size;
622 else
623 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
624
625 if (fixed_position == FIXED_LOW)
626 fixed_low_size += heap->size;
627 else if (fixed_position == FIXED_MIDDLE)
628 fixed_middle_size += heap->size;
629 else if (fixed_position == FIXED_HIGH)
630 fixed_high_size += heap->size;
631
632 if (mem_is_fmem)
633 fmem_pdata.size += heap->size;
634 }
635 }
636
637 if (!fixed_size)
638 return;
639
640 if (fmem_pdata.size) {
641 fmem_pdata.reserved_size_low = fixed_low_size;
642 fmem_pdata.reserved_size_high = fixed_high_size;
643 }
644
Larry Bassel4d4f4482012-04-04 11:26:09 -0700645 /* Since the fixed area may be carved out of lowmem,
646 * make sure the length is a multiple of 1M.
647 */
648 fixed_size = (fixed_size + MSM_MM_FW_SIZE + SECTION_SIZE - 1)
649 & SECTION_MASK;
650 msm8960_reserve_fixed_area(fixed_size);
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700651
652 fixed_low_start = MSM8960_FIXED_AREA_START;
653 fixed_middle_start = fixed_low_start + fixed_low_size;
654 fixed_high_start = fixed_middle_start + fixed_middle_size;
655
656 for (i = 0; i < ion_pdata.nr; ++i) {
657 struct ion_platform_heap *heap = &(ion_pdata.heaps[i]);
658
659 if (heap->extra_data) {
660 int fixed_position = NOT_FIXED;
661
662 switch (heap->type) {
663 case ION_HEAP_TYPE_CP:
664 fixed_position = ((struct ion_cp_heap_pdata *)
665 heap->extra_data)->fixed_position;
666 break;
667 case ION_HEAP_TYPE_CARVEOUT:
668 fixed_position = ((struct ion_co_heap_pdata *)
669 heap->extra_data)->fixed_position;
670 break;
671 default:
672 break;
673 }
674
675 switch (fixed_position) {
676 case FIXED_LOW:
677 heap->base = fixed_low_start;
678 break;
679 case FIXED_MIDDLE:
680 heap->base = fixed_middle_start;
681 break;
682 case FIXED_HIGH:
683 heap->base = fixed_high_start;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800684 break;
685 default:
686 break;
687 }
688 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800689 }
Laura Abbottd6183792011-08-19 13:42:24 -0700690#endif
691}
Huaibin Yanga5419422011-12-08 23:52:10 -0800692
693static void __init reserve_mdp_memory(void)
694{
695 msm8960_mdp_writeback(msm8960_reserve_table);
696}
697
Laura Abbott306bcc22012-03-08 11:24:53 -0800698#if defined(CONFIG_MSM_CACHE_DUMP)
699static struct msm_cache_dump_platform_data msm_cache_dump_pdata = {
700 .l2_size = L2_BUFFER_SIZE,
701};
702
703static struct platform_device msm_cache_dump_device = {
704 .name = "msm_cache_dump",
705 .id = -1,
706 .dev = {
707 .platform_data = &msm_cache_dump_pdata,
708 },
709};
710
711#endif
712
Stephen Boyd668d7652012-04-25 11:31:01 -0700713static void __init reserve_cache_dump_memory(void)
Laura Abbott306bcc22012-03-08 11:24:53 -0800714{
715#ifdef CONFIG_MSM_CACHE_DUMP
716 unsigned int spare;
717 unsigned int l1_size;
Laura Abbott7b637362012-03-29 16:43:49 -0700718 unsigned int l2_size;
Laura Abbott306bcc22012-03-08 11:24:53 -0800719 unsigned int total;
720 int ret;
721
722 ret = scm_call(L1C_SERVICE_ID, L1C_BUFFER_GET_SIZE_COMMAND_ID, &spare,
723 sizeof(spare), &l1_size, sizeof(l1_size));
724
725 if (ret)
726 /* Fall back to something reasonable here */
727 l1_size = L1_BUFFER_SIZE;
728
Laura Abbott7b637362012-03-29 16:43:49 -0700729 ret = scm_call(L1C_SERVICE_ID, L2C_BUFFER_GET_SIZE_COMMAND_ID, &spare,
730 sizeof(spare), &l2_size, sizeof(l2_size));
731
732 if (ret)
733 /* Fall back to something reasonable here */
734 l2_size = L2_BUFFER_SIZE;
735
736 total = l1_size + l2_size;
Laura Abbott306bcc22012-03-08 11:24:53 -0800737
738 msm8960_reserve_table[MEMTYPE_EBI1].size += total;
739 msm_cache_dump_pdata.l1_size = l1_size;
Laura Abbott7b637362012-03-29 16:43:49 -0700740 msm_cache_dump_pdata.l2_size = l2_size;
Laura Abbott306bcc22012-03-08 11:24:53 -0800741#endif
742}
743
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700744static void __init msm8960_calculate_reserve_sizes(void)
745{
746 size_pmem_devices();
747 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700748 reserve_ion_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800749 reserve_mdp_memory();
Laura Abbottf8c03b92012-02-16 14:57:58 -0800750 reserve_rtb_memory();
Laura Abbott306bcc22012-03-08 11:24:53 -0800751 reserve_cache_dump_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700752}
753
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700754static struct reserve_info msm8960_reserve_info __initdata = {
755 .memtype_reserve_table = msm8960_reserve_table,
756 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700757 .reserve_fixed_area = msm8960_reserve_fixed_area,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700758 .paddr_to_memtype = msm8960_paddr_to_memtype,
759};
760
Larry Basselb4126da2011-07-18 14:31:33 -0700761static int msm8960_memory_bank_size(void)
762{
763 return 1<<29;
764}
765
766static void __init locate_unstable_memory(void)
767{
768 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
769 unsigned long bank_size;
770 unsigned long low, high;
771
772 bank_size = msm8960_memory_bank_size();
Larry Bassel4d4f4482012-04-04 11:26:09 -0700773 msm8960_reserve_info.bank_size = bank_size;
774
Larry Basselb4126da2011-07-18 14:31:33 -0700775 low = meminfo.bank[0].start;
776 high = mb->start + mb->size;
Olav Haugan62052e42011-10-28 14:28:32 -0700777
778 /* Check if 32 bit overflow occured */
779 if (high < mb->start)
780 high = ~0UL;
781
Larry Bassel4d4f4482012-04-04 11:26:09 -0700782 if (high < MAX_FIXED_AREA_SIZE + MSM8960_FIXED_AREA_START)
783 panic("fixed area extends beyond end of memory\n");
784
Larry Basselb4126da2011-07-18 14:31:33 -0700785 low &= ~(bank_size - 1);
786
787 if (high - low <= bank_size)
Larry Bassel4d4f4482012-04-04 11:26:09 -0700788 goto no_dmm;
Larry Basselb8d61022012-02-24 10:49:45 -0800789
Larry Basselb8d61022012-02-24 10:49:45 -0800790#ifdef CONFIG_ENABLE_DMM
Jack Cheung60eaeab2012-01-09 16:40:26 -0800791 msm8960_reserve_info.low_unstable_address = mb->start -
792 MIN_MEMORY_BLOCK_SIZE + mb->size;
Jack Cheung0b1987e2011-11-18 13:36:29 -0800793 msm8960_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
Larry Basselb4126da2011-07-18 14:31:33 -0700794 pr_info("low unstable address %lx max size %lx bank size %lx\n",
795 msm8960_reserve_info.low_unstable_address,
796 msm8960_reserve_info.max_unstable_size,
797 msm8960_reserve_info.bank_size);
Larry Bassel4d4f4482012-04-04 11:26:09 -0700798 return;
Larry Basselb8d61022012-02-24 10:49:45 -0800799#endif
Larry Bassel4d4f4482012-04-04 11:26:09 -0700800no_dmm:
801 msm8960_reserve_info.low_unstable_address = high;
802 msm8960_reserve_info.max_unstable_size = 0;
Larry Basselb4126da2011-07-18 14:31:33 -0700803}
804
Larry Basselb830e182011-10-14 10:46:55 -0700805static void __init place_movable_zone(void)
806{
Larry Basselb8d61022012-02-24 10:49:45 -0800807#ifdef CONFIG_ENABLE_DMM
Larry Basselb830e182011-10-14 10:46:55 -0700808 movable_reserved_start = msm8960_reserve_info.low_unstable_address;
809 movable_reserved_size = msm8960_reserve_info.max_unstable_size;
810 pr_info("movable zone start %lx size %lx\n",
811 movable_reserved_start, movable_reserved_size);
Larry Basselb8d61022012-02-24 10:49:45 -0800812#endif
Larry Basselb830e182011-10-14 10:46:55 -0700813}
814
815static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700816{
817 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700818 locate_unstable_memory();
Larry Basselb830e182011-10-14 10:46:55 -0700819 place_movable_zone();
820}
821
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800822static char prim_panel_name[PANEL_NAME_MAX_LEN];
823static char ext_panel_name[PANEL_NAME_MAX_LEN];
824static int __init prim_display_setup(char *param)
825{
826 if (strnlen(param, PANEL_NAME_MAX_LEN))
827 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
828 return 0;
829}
830early_param("prim_display", prim_display_setup);
831
832static int __init ext_display_setup(char *param)
833{
834 if (strnlen(param, PANEL_NAME_MAX_LEN))
835 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
836 return 0;
837}
838early_param("ext_display", ext_display_setup);
839
Larry Basselb830e182011-10-14 10:46:55 -0700840static void __init msm8960_reserve(void)
841{
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800842 msm8960_set_display_params(prim_panel_name, ext_panel_name);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700843 msm_reserve();
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700844 if (fmem_pdata.size) {
845#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
846 fmem_pdata.phys = reserve_info->fixed_area_start +
847 MSM_MM_FW_SIZE;
848 pr_info("mm fw at %lx (fixed) size %x\n",
849 reserve_info->fixed_area_start, MSM_MM_FW_SIZE);
850 pr_info("fmem start %lx (fixed) size %lx\n",
851 fmem_pdata.phys, fmem_pdata.size);
852#else
853 fmem_pdata.phys = reserve_memory_for_fmem(fmem_pdata.size);
854#endif
855 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700856}
857
Larry Bassela4414b12011-08-04 11:11:02 -0700858static int msm8960_change_memory_power(u64 start, u64 size,
859 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700860{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -0700861 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -0700862}
863
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700864static void __init msm8960_allocate_memory_regions(void)
865{
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800866 msm8960_allocate_fb_region();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700867}
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800868
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700869#ifdef CONFIG_WCD9310_CODEC
870
871#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
872
Patrick Lai3043fba2011-08-01 14:15:57 -0700873/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
874 * 4 micbiases are used to power various analog and digital
875 * microphones operating at 1800 mV. Technically, all micbiases
876 * can source from single cfilter since all microphones operate
877 * at the same voltage level. The arrangement below is to make
878 * sure all cfilters are exercised. LDO_H regulator ouput level
879 * does not need to be as high as 2.85V. It is choosen for
880 * microphone sensitivity purpose.
881 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530882static struct wcd9xxx_pdata tabla_platform_data = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700883 .slimbus_slave_device = {
884 .name = "tabla-slave",
885 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
886 },
887 .irq = MSM_GPIO_TO_INT(62),
888 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530889 .num_irqs = NR_WCD9XXX_IRQS,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700890 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -0700891 .micbias = {
892 .ldoh_v = TABLA_LDOH_2P85_V,
893 .cfilt1_mv = 1800,
Joonwoo Parkcf473b42012-03-29 19:48:16 -0700894 .cfilt2_mv = 2700,
Patrick Lai3043fba2011-08-01 14:15:57 -0700895 .cfilt3_mv = 1800,
896 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
897 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
898 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
899 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530900 },
901 .regulator = {
902 {
903 .name = "CDC_VDD_CP",
904 .min_uV = 1800000,
905 .max_uV = 1800000,
906 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
907 },
908 {
909 .name = "CDC_VDDA_RX",
910 .min_uV = 1800000,
911 .max_uV = 1800000,
912 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
913 },
914 {
915 .name = "CDC_VDDA_TX",
916 .min_uV = 1800000,
917 .max_uV = 1800000,
918 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
919 },
920 {
921 .name = "VDDIO_CDC",
922 .min_uV = 1800000,
923 .max_uV = 1800000,
924 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
925 },
926 {
927 .name = "VDDD_CDC_D",
928 .min_uV = 1225000,
929 .max_uV = 1225000,
930 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
931 },
932 {
933 .name = "CDC_VDDA_A_1P2V",
934 .min_uV = 1225000,
935 .max_uV = 1225000,
936 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
937 },
938 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700939};
940
941static struct slim_device msm_slim_tabla = {
942 .name = "tabla-slim",
943 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
944 .dev = {
945 .platform_data = &tabla_platform_data,
946 },
947};
Santosh Mardi60e19d92011-10-28 01:15:14 +0530948
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530949static struct wcd9xxx_pdata tabla20_platform_data = {
Santosh Mardi60e19d92011-10-28 01:15:14 +0530950 .slimbus_slave_device = {
951 .name = "tabla-slave",
952 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
953 },
954 .irq = MSM_GPIO_TO_INT(62),
955 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530956 .num_irqs = NR_WCD9XXX_IRQS,
Santosh Mardi60e19d92011-10-28 01:15:14 +0530957 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
958 .micbias = {
959 .ldoh_v = TABLA_LDOH_2P85_V,
960 .cfilt1_mv = 1800,
Joonwoo Parkcf473b42012-03-29 19:48:16 -0700961 .cfilt2_mv = 2700,
Santosh Mardi60e19d92011-10-28 01:15:14 +0530962 .cfilt3_mv = 1800,
963 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
964 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
965 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
966 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530967 },
968 .regulator = {
969 {
970 .name = "CDC_VDD_CP",
971 .min_uV = 1800000,
972 .max_uV = 1800000,
973 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
974 },
975 {
976 .name = "CDC_VDDA_RX",
977 .min_uV = 1800000,
978 .max_uV = 1800000,
979 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
980 },
981 {
982 .name = "CDC_VDDA_TX",
983 .min_uV = 1800000,
984 .max_uV = 1800000,
985 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
986 },
987 {
988 .name = "VDDIO_CDC",
989 .min_uV = 1800000,
990 .max_uV = 1800000,
991 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
992 },
993 {
994 .name = "VDDD_CDC_D",
995 .min_uV = 1225000,
996 .max_uV = 1225000,
997 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
998 },
999 {
1000 .name = "CDC_VDDA_A_1P2V",
1001 .min_uV = 1225000,
1002 .max_uV = 1225000,
1003 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1004 },
1005 },
Santosh Mardi60e19d92011-10-28 01:15:14 +05301006};
1007
1008static struct slim_device msm_slim_tabla20 = {
1009 .name = "tabla2x-slim",
1010 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
1011 .dev = {
1012 .platform_data = &tabla20_platform_data,
1013 },
1014};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001015#endif
1016
1017static struct slim_boardinfo msm_slim_devices[] = {
1018#ifdef CONFIG_WCD9310_CODEC
1019 {
1020 .bus_num = 1,
1021 .slim_slave = &msm_slim_tabla,
1022 },
Santosh Mardi60e19d92011-10-28 01:15:14 +05301023 {
1024 .bus_num = 1,
1025 .slim_slave = &msm_slim_tabla20,
1026 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001027#endif
1028 /* add more slimbus slaves as needed */
1029};
1030
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001031#define MSM_WCNSS_PHYS 0x03000000
1032#define MSM_WCNSS_SIZE 0x280000
1033
1034static struct resource resources_wcnss_wlan[] = {
1035 {
1036 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1037 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1038 .name = "wcnss_wlanrx_irq",
1039 .flags = IORESOURCE_IRQ,
1040 },
1041 {
1042 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1043 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1044 .name = "wcnss_wlantx_irq",
1045 .flags = IORESOURCE_IRQ,
1046 },
1047 {
1048 .start = MSM_WCNSS_PHYS,
1049 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1050 .name = "wcnss_mmio",
1051 .flags = IORESOURCE_MEM,
1052 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -07001053 {
1054 .start = 84,
1055 .end = 88,
1056 .name = "wcnss_gpios_5wire",
1057 .flags = IORESOURCE_IO,
1058 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001059};
1060
Ankur Nandwanib0039b02011-08-09 14:00:45 -07001061static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1062 .has_48mhz_xo = 1,
1063};
1064
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001065static struct platform_device msm_device_wcnss_wlan = {
1066 .name = "wcnss_wlan",
1067 .id = 0,
1068 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1069 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07001070 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001071};
1072
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001073#ifdef CONFIG_QSEECOM
1074/* qseecom bus scaling */
1075static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
1076 {
1077 .src = MSM_BUS_MASTER_SPS,
1078 .dst = MSM_BUS_SLAVE_EBI_CH0,
1079 .ib = 0,
1080 .ab = 0,
1081 },
1082 {
1083 .src = MSM_BUS_MASTER_SPDM,
1084 .dst = MSM_BUS_SLAVE_SPDM,
1085 .ib = 0,
1086 .ab = 0,
1087 },
1088};
1089
1090static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
1091 {
1092 .src = MSM_BUS_MASTER_SPS,
1093 .dst = MSM_BUS_SLAVE_EBI_CH0,
1094 .ib = (492 * 8) * 1000000UL,
1095 .ab = (492 * 8) * 100000UL,
1096 },
1097 {
1098 .src = MSM_BUS_MASTER_SPDM,
1099 .dst = MSM_BUS_SLAVE_SPDM,
1100 .ib = 0,
1101 .ab = 0,
1102 },
1103};
1104
1105static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1106 {
1107 .src = MSM_BUS_MASTER_SPS,
1108 .dst = MSM_BUS_SLAVE_EBI_CH0,
1109 .ib = 0,
1110 .ab = 0,
1111 },
1112 {
1113 .src = MSM_BUS_MASTER_SPDM,
1114 .dst = MSM_BUS_SLAVE_SPDM,
1115 .ib = (64 * 8) * 1000000UL,
1116 .ab = (64 * 8) * 100000UL,
1117 },
1118};
1119
1120static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1121 {
1122 ARRAY_SIZE(qseecom_clks_init_vectors),
1123 qseecom_clks_init_vectors,
1124 },
1125 {
1126 ARRAY_SIZE(qseecom_enable_dfab_vectors),
1127 qseecom_enable_sfpb_vectors,
1128 },
1129 {
1130 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1131 qseecom_enable_sfpb_vectors,
1132 },
1133};
1134
1135static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1136 qseecom_hw_bus_scale_usecases,
1137 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1138 .name = "qsee",
1139};
1140
1141static struct platform_device qseecom_device = {
1142 .name = "qseecom",
1143 .id = 0,
1144 .dev = {
1145 .platform_data = &qseecom_bus_pdata,
1146 },
1147};
1148#endif
1149
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001150#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1151 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1152 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1153 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1154
1155#define QCE_SIZE 0x10000
1156#define QCE_0_BASE 0x18500000
1157
1158#define QCE_HW_KEY_SUPPORT 0
1159#define QCE_SHA_HMAC_SUPPORT 1
1160#define QCE_SHARE_CE_RESOURCE 1
1161#define QCE_CE_SHARED 0
1162
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001163/* Begin Bus scaling definitions */
1164static struct msm_bus_vectors crypto_hw_init_vectors[] = {
1165 {
1166 .src = MSM_BUS_MASTER_ADM_PORT0,
1167 .dst = MSM_BUS_SLAVE_EBI_CH0,
1168 .ab = 0,
1169 .ib = 0,
1170 },
1171 {
1172 .src = MSM_BUS_MASTER_ADM_PORT1,
1173 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1174 .ab = 0,
1175 .ib = 0,
1176 },
1177};
1178
1179static struct msm_bus_vectors crypto_hw_active_vectors[] = {
1180 {
1181 .src = MSM_BUS_MASTER_ADM_PORT0,
1182 .dst = MSM_BUS_SLAVE_EBI_CH0,
1183 .ab = 70000000UL,
1184 .ib = 70000000UL,
1185 },
1186 {
1187 .src = MSM_BUS_MASTER_ADM_PORT1,
1188 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1189 .ab = 2480000000UL,
1190 .ib = 2480000000UL,
1191 },
1192};
1193
1194static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
1195 {
1196 ARRAY_SIZE(crypto_hw_init_vectors),
1197 crypto_hw_init_vectors,
1198 },
1199 {
1200 ARRAY_SIZE(crypto_hw_active_vectors),
1201 crypto_hw_active_vectors,
1202 },
1203};
1204
1205static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
1206 crypto_hw_bus_scale_usecases,
1207 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
1208 .name = "cryptohw",
1209};
1210/* End Bus Scaling Definitions*/
1211
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001212static struct resource qcrypto_resources[] = {
1213 [0] = {
1214 .start = QCE_0_BASE,
1215 .end = QCE_0_BASE + QCE_SIZE - 1,
1216 .flags = IORESOURCE_MEM,
1217 },
1218 [1] = {
1219 .name = "crypto_channels",
1220 .start = DMOV_CE_IN_CHAN,
1221 .end = DMOV_CE_OUT_CHAN,
1222 .flags = IORESOURCE_DMA,
1223 },
1224 [2] = {
1225 .name = "crypto_crci_in",
1226 .start = DMOV_CE_IN_CRCI,
1227 .end = DMOV_CE_IN_CRCI,
1228 .flags = IORESOURCE_DMA,
1229 },
1230 [3] = {
1231 .name = "crypto_crci_out",
1232 .start = DMOV_CE_OUT_CRCI,
1233 .end = DMOV_CE_OUT_CRCI,
1234 .flags = IORESOURCE_DMA,
1235 },
1236};
1237
1238static struct resource qcedev_resources[] = {
1239 [0] = {
1240 .start = QCE_0_BASE,
1241 .end = QCE_0_BASE + QCE_SIZE - 1,
1242 .flags = IORESOURCE_MEM,
1243 },
1244 [1] = {
1245 .name = "crypto_channels",
1246 .start = DMOV_CE_IN_CHAN,
1247 .end = DMOV_CE_OUT_CHAN,
1248 .flags = IORESOURCE_DMA,
1249 },
1250 [2] = {
1251 .name = "crypto_crci_in",
1252 .start = DMOV_CE_IN_CRCI,
1253 .end = DMOV_CE_IN_CRCI,
1254 .flags = IORESOURCE_DMA,
1255 },
1256 [3] = {
1257 .name = "crypto_crci_out",
1258 .start = DMOV_CE_OUT_CRCI,
1259 .end = DMOV_CE_OUT_CRCI,
1260 .flags = IORESOURCE_DMA,
1261 },
1262};
1263
1264#endif
1265
1266#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1267 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1268
1269static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1270 .ce_shared = QCE_CE_SHARED,
1271 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1272 .hw_key_support = QCE_HW_KEY_SUPPORT,
1273 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001274 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001275};
1276
1277static struct platform_device qcrypto_device = {
1278 .name = "qcrypto",
1279 .id = 0,
1280 .num_resources = ARRAY_SIZE(qcrypto_resources),
1281 .resource = qcrypto_resources,
1282 .dev = {
1283 .coherent_dma_mask = DMA_BIT_MASK(32),
1284 .platform_data = &qcrypto_ce_hw_suppport,
1285 },
1286};
1287#endif
1288
1289#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1290 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1291
1292static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1293 .ce_shared = QCE_CE_SHARED,
1294 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1295 .hw_key_support = QCE_HW_KEY_SUPPORT,
1296 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001297 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001298};
1299
1300static struct platform_device qcedev_device = {
1301 .name = "qce",
1302 .id = 0,
1303 .num_resources = ARRAY_SIZE(qcedev_resources),
1304 .resource = qcedev_resources,
1305 .dev = {
1306 .coherent_dma_mask = DMA_BIT_MASK(32),
1307 .platform_data = &qcedev_ce_hw_suppport,
1308 },
1309};
1310#endif
1311
Joel Kingb8352a12011-11-15 18:46:24 -08001312#define MDM2AP_ERRFATAL 70
1313#define AP2MDM_ERRFATAL 95
1314#define MDM2AP_STATUS 69
1315#define AP2MDM_STATUS 94
1316#define AP2MDM_PMIC_RESET_N 80
1317#define AP2MDM_KPDPWR_N 81
1318
Joel Kingb8352a12011-11-15 18:46:24 -08001319static struct resource mdm_resources[] = {
1320 {
1321 .start = MDM2AP_ERRFATAL,
1322 .end = MDM2AP_ERRFATAL,
1323 .name = "MDM2AP_ERRFATAL",
1324 .flags = IORESOURCE_IO,
1325 },
1326 {
1327 .start = AP2MDM_ERRFATAL,
1328 .end = AP2MDM_ERRFATAL,
1329 .name = "AP2MDM_ERRFATAL",
1330 .flags = IORESOURCE_IO,
1331 },
1332 {
1333 .start = MDM2AP_STATUS,
1334 .end = MDM2AP_STATUS,
1335 .name = "MDM2AP_STATUS",
1336 .flags = IORESOURCE_IO,
1337 },
1338 {
1339 .start = AP2MDM_STATUS,
1340 .end = AP2MDM_STATUS,
1341 .name = "AP2MDM_STATUS",
1342 .flags = IORESOURCE_IO,
1343 },
1344 {
1345 .start = AP2MDM_PMIC_RESET_N,
1346 .end = AP2MDM_PMIC_RESET_N,
1347 .name = "AP2MDM_PMIC_RESET_N",
1348 .flags = IORESOURCE_IO,
1349 },
1350 {
1351 .start = AP2MDM_KPDPWR_N,
1352 .end = AP2MDM_KPDPWR_N,
1353 .name = "AP2MDM_KPDPWR_N",
1354 .flags = IORESOURCE_IO,
1355 },
1356};
1357
1358static struct mdm_platform_data mdm_platform_data = {
1359 .mdm_version = "2.5",
1360};
1361
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -08001362static struct platform_device mdm_device = {
Joel Kingb8352a12011-11-15 18:46:24 -08001363 .name = "mdm2_modem",
1364 .id = -1,
1365 .num_resources = ARRAY_SIZE(mdm_resources),
1366 .resource = mdm_resources,
1367 .dev = {
1368 .platform_data = &mdm_platform_data,
1369 },
1370};
1371
1372static struct platform_device *mdm_devices[] __initdata = {
1373 &mdm_device,
1374};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001375
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001376#define MSM_SHARED_RAM_PHYS 0x80000000
1377
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001378static void __init msm8960_map_io(void)
1379{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001380 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001381 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001382
1383 if (socinfo_init() < 0)
1384 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001385}
1386
1387static void __init msm8960_init_irq(void)
1388{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001389 struct msm_mpm_device_data *data = NULL;
1390
1391#ifdef CONFIG_MSM_MPM
1392 data = &msm8960_mpm_dev_data;
1393#endif
1394
1395 msm_mpm_irq_extn_init(data);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001396 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001397 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001398}
1399
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001400static void __init msm8960_init_buses(void)
1401{
1402#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -06001403 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -06001404 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
1405 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
1406 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
1407 msm_bus_apps_fabric.dev.platform_data =
1408 &msm_bus_8960_apps_fabric_pdata;
1409 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
1410 msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
1411 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
1412 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001413#endif
1414}
1415
1416static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
1417 .max_clock_speed = 15060000,
1418};
1419
1420#ifdef CONFIG_USB_MSM_OTG_72K
1421static struct msm_otg_platform_data msm_otg_pdata;
1422#else
Anji jonnalaa8b8d732011-12-06 10:03:24 +05301423static int wr_phy_init_seq[] = {
1424 0x44, 0x80, /* set VBUS valid threshold
1425 and disconnect valid threshold */
1426 0x38, 0x81, /* update DC voltage level */
1427 0x14, 0x82, /* set preemphasis and rise/fall time */
1428 0x13, 0x83, /* set source impedance adjusment */
1429 -1};
1430
1431static int liquid_v1_phy_init_seq[] = {
1432 0x44, 0x80,/* set VBUS valid threshold
1433 and disconnect valid threshold */
1434 0x3C, 0x81,/* update DC voltage level */
1435 0x18, 0x82,/* set preemphasis and rise/fall time */
1436 0x23, 0x83,/* set source impedance sdjusment */
1437 -1};
1438
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301439#ifdef CONFIG_MSM_BUS_SCALING
1440/* Bandwidth requests (zero) if no vote placed */
1441static struct msm_bus_vectors usb_init_vectors[] = {
1442 {
1443 .src = MSM_BUS_MASTER_SPS,
1444 .dst = MSM_BUS_SLAVE_EBI_CH0,
1445 .ab = 0,
1446 .ib = 0,
1447 },
1448};
1449
1450/* Bus bandwidth requests in Bytes/sec */
1451static struct msm_bus_vectors usb_max_vectors[] = {
1452 {
1453 .src = MSM_BUS_MASTER_SPS,
1454 .dst = MSM_BUS_SLAVE_EBI_CH0,
1455 .ab = 60000000, /* At least 480Mbps on bus. */
1456 .ib = 960000000, /* MAX bursts rate */
1457 },
1458};
1459
1460static struct msm_bus_paths usb_bus_scale_usecases[] = {
1461 {
1462 ARRAY_SIZE(usb_init_vectors),
1463 usb_init_vectors,
1464 },
1465 {
1466 ARRAY_SIZE(usb_max_vectors),
1467 usb_max_vectors,
1468 },
1469};
1470
1471static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
1472 usb_bus_scale_usecases,
1473 ARRAY_SIZE(usb_bus_scale_usecases),
1474 .name = "usb",
1475};
1476#endif
1477
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001478static struct msm_otg_platform_data msm_otg_pdata = {
1479 .mode = USB_OTG,
1480 .otg_control = OTG_PMIC_CONTROL,
1481 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001482 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
Anji jonnala4e3e6772011-09-15 18:53:42 +05301483 .power_budget = 750,
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301484#ifdef CONFIG_MSM_BUS_SCALING
1485 .bus_scale_table = &usb_bus_scale_pdata,
1486#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001487};
1488#endif
1489
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301490#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05301491#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301492static struct msm_hsic_host_platform_data msm_hsic_pdata = {
1493 .strobe = 150,
1494 .data = 151,
1495};
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301496
1497static struct smsc_hub_platform_data hsic_hub_pdata = {
1498 .hub_reset = HSIC_HUB_RESET_GPIO,
1499};
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301500#else
1501static struct msm_hsic_host_platform_data msm_hsic_pdata;
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301502static struct smsc_hub_platform_data hsic_hub_pdata;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301503#endif
1504
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301505static struct platform_device smsc_hub_device = {
1506 .name = "msm_smsc_hub",
1507 .id = -1,
1508 .dev = {
1509 .platform_data = &hsic_hub_pdata,
1510 },
1511};
1512
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001513#define PID_MAGIC_ID 0x71432909
1514#define SERIAL_NUM_MAGIC_ID 0x61945374
1515#define SERIAL_NUMBER_LENGTH 127
1516#define DLOAD_USB_BASE_ADD 0x2A03F0C8
1517
1518struct magic_num_struct {
1519 uint32_t pid;
1520 uint32_t serial_num;
1521};
1522
1523struct dload_struct {
1524 uint32_t reserved1;
1525 uint32_t reserved2;
1526 uint32_t reserved3;
1527 uint16_t reserved4;
1528 uint16_t pid;
1529 char serial_number[SERIAL_NUMBER_LENGTH];
1530 uint16_t reserved5;
1531 struct magic_num_struct magic_struct;
1532};
1533
1534static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
1535{
1536 struct dload_struct __iomem *dload = 0;
1537
1538 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
1539 if (!dload) {
1540 pr_err("%s: cannot remap I/O memory region: %08x\n",
1541 __func__, DLOAD_USB_BASE_ADD);
1542 return -ENXIO;
1543 }
1544
1545 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
1546 __func__, dload, pid, snum);
1547 /* update pid */
1548 dload->magic_struct.pid = PID_MAGIC_ID;
1549 dload->pid = pid;
1550
1551 /* update serial number */
1552 dload->magic_struct.serial_num = 0;
1553 if (!snum) {
1554 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
1555 goto out;
1556 }
1557
1558 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -07001559 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001560out:
1561 iounmap(dload);
1562 return 0;
1563}
1564
1565static struct android_usb_platform_data android_usb_pdata = {
1566 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1567};
1568
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001569static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001570 .name = "android_usb",
1571 .id = -1,
1572 .dev = {
1573 .platform_data = &android_usb_pdata,
1574 },
1575};
1576
1577static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1578 0x03, 0x0f,
1579};
1580
1581static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1582 0x00, 0x24, 0x54, 0x10,
1583 0x09, 0x03, 0x01,
1584 0x10, 0x54, 0x30, 0x0C,
1585 0x24, 0x30, 0x0f,
1586};
1587
1588static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1589 0x00, 0x24, 0x54, 0x10,
1590 0x09, 0x07, 0x01, 0x0B,
1591 0x10, 0x54, 0x30, 0x0C,
1592 0x24, 0x30, 0x0f,
1593};
1594
1595static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1596 [0] = {
1597 .mode = MSM_SPM_MODE_CLOCK_GATING,
1598 .notify_rpm = false,
1599 .cmd = spm_wfi_cmd_sequence,
1600 },
1601 [1] = {
1602 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1603 .notify_rpm = false,
1604 .cmd = spm_power_collapse_without_rpm,
1605 },
1606 [2] = {
1607 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1608 .notify_rpm = true,
1609 .cmd = spm_power_collapse_with_rpm,
1610 },
1611};
1612
1613static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1614 [0] = {
1615 .reg_base_addr = MSM_SAW0_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001616 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001617#if defined(CONFIG_MSM_AVS_HW)
1618 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1619 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1620#endif
1621 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001622 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001623 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1624 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1625 .vctl_timeout_us = 50,
1626 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1627 .modes = msm_spm_seq_list,
1628 },
1629 [1] = {
1630 .reg_base_addr = MSM_SAW1_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001631 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001632#if defined(CONFIG_MSM_AVS_HW)
1633 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1634 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1635#endif
1636 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001637 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001638 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1639 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1640 .vctl_timeout_us = 50,
1641 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1642 .modes = msm_spm_seq_list,
1643 },
1644};
1645
1646static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1647 0x00, 0x20, 0x03, 0x20,
1648 0x00, 0x0f,
1649};
1650
1651static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1652 0x00, 0x20, 0x34, 0x64,
1653 0x48, 0x07, 0x48, 0x20,
1654 0x50, 0x64, 0x04, 0x34,
1655 0x50, 0x0f,
1656};
1657static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1658 0x00, 0x10, 0x34, 0x64,
1659 0x48, 0x07, 0x48, 0x10,
1660 0x50, 0x64, 0x04, 0x34,
1661 0x50, 0x0F,
1662};
1663
1664static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1665 [0] = {
1666 .mode = MSM_SPM_L2_MODE_RETENTION,
1667 .notify_rpm = false,
1668 .cmd = l2_spm_wfi_cmd_sequence,
1669 },
1670 [1] = {
1671 .mode = MSM_SPM_L2_MODE_GDHS,
1672 .notify_rpm = true,
1673 .cmd = l2_spm_gdhs_cmd_sequence,
1674 },
1675 [2] = {
1676 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1677 .notify_rpm = true,
1678 .cmd = l2_spm_power_off_cmd_sequence,
1679 },
1680};
1681
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001682static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1683 [0] = {
1684 .reg_base_addr = MSM_SAW_L2_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001685 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001686 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001687 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1688 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1689 .modes = msm_spm_l2_seq_list,
1690 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1691 },
1692};
1693
Mohan Pallaka5e490392011-09-09 15:18:41 +05301694#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1695#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
1696
1697static struct msm_xo_voter *xo_handle_d1;
1698
1699static int isa1200_power(int on)
1700{
1701 int rc = 0;
1702
1703 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !!on);
1704
1705 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
1706 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
1707 if (rc < 0) {
1708 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
1709 __func__, on ? "" : "de-", rc);
1710 goto err_xo_vote;
1711 }
1712
1713 return 0;
1714
1715err_xo_vote:
1716 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !on);
1717 return rc;
1718}
1719
1720static int isa1200_dev_setup(bool enable)
1721{
1722 int rc = 0;
1723
1724 struct pm_gpio hap_gpio_config = {
1725 .direction = PM_GPIO_DIR_OUT,
1726 .pull = PM_GPIO_PULL_NO,
1727 .out_strength = PM_GPIO_STRENGTH_HIGH,
1728 .function = PM_GPIO_FUNC_NORMAL,
1729 .inv_int_pol = 0,
1730 .vin_sel = 2,
1731 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1732 .output_value = 0,
1733 };
1734
1735 if (enable == true) {
1736 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
1737 if (rc) {
1738 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1739 __func__, PM_HAP_EN_GPIO, rc);
1740 return rc;
1741 }
1742
1743 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
1744 if (rc) {
1745 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1746 __func__, PM_HAP_LEN_GPIO, rc);
1747 return rc;
1748 }
1749
1750 rc = gpio_request(HAP_SHIFT_LVL_OE_GPIO, "hap_shft_lvl_oe");
1751 if (rc) {
1752 pr_err("%s: unable to request gpio %d (%d)\n",
1753 __func__, HAP_SHIFT_LVL_OE_GPIO, rc);
1754 return rc;
1755 }
1756
1757 rc = gpio_direction_output(HAP_SHIFT_LVL_OE_GPIO, 0);
1758 if (rc) {
1759 pr_err("%s: Unable to set direction\n", __func__);
1760 goto free_gpio;
1761 }
1762
1763 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
1764 if (IS_ERR(xo_handle_d1)) {
1765 rc = PTR_ERR(xo_handle_d1);
1766 pr_err("%s: failed to get the handle for D1(%d)\n",
1767 __func__, rc);
1768 goto gpio_set_dir;
1769 }
1770 } else {
1771 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1772
1773 msm_xo_put(xo_handle_d1);
1774 }
1775
1776 return 0;
1777
1778gpio_set_dir:
1779 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, 0);
1780free_gpio:
1781 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1782 return rc;
1783}
1784
1785static struct isa1200_regulator isa1200_reg_data[] = {
1786 {
1787 .name = "vcc_i2c",
1788 .min_uV = ISA_I2C_VTG_MIN_UV,
1789 .max_uV = ISA_I2C_VTG_MAX_UV,
1790 .load_uA = ISA_I2C_CURR_UA,
1791 },
1792};
1793
1794static struct isa1200_platform_data isa1200_1_pdata = {
1795 .name = "vibrator",
1796 .dev_setup = isa1200_dev_setup,
1797 .power_on = isa1200_power,
1798 .hap_en_gpio = PM_HAP_EN_GPIO,
1799 .hap_len_gpio = PM_HAP_LEN_GPIO,
1800 .max_timeout = 15000,
1801 .mode_ctrl = PWM_GEN_MODE,
1802 .pwm_fd = {
1803 .pwm_div = 256,
1804 },
1805 .is_erm = false,
1806 .smart_en = true,
1807 .ext_clk_en = true,
1808 .chip_en = 1,
1809 .regulator_info = isa1200_reg_data,
1810 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1811};
1812
1813static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1814 {
1815 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
Mohan Pallaka5e490392011-09-09 15:18:41 +05301816 },
1817};
1818
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001819#define CYTTSP_TS_GPIO_IRQ 11
1820#define CYTTSP_TS_SLEEP_GPIO 50
1821#define CYTTSP_TS_RESOUT_N_GPIO 52
1822
1823/*virtual key support */
1824static ssize_t tma340_vkeys_show(struct kobject *kobj,
1825 struct kobj_attribute *attr, char *buf)
1826{
1827 return snprintf(buf, 200,
1828 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1829 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1830 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1831 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1832 "\n");
1833}
1834
1835static struct kobj_attribute tma340_vkeys_attr = {
1836 .attr = {
1837 .mode = S_IRUGO,
1838 },
1839 .show = &tma340_vkeys_show,
1840};
1841
1842static struct attribute *tma340_properties_attrs[] = {
1843 &tma340_vkeys_attr.attr,
1844 NULL
1845};
1846
1847static struct attribute_group tma340_properties_attr_group = {
1848 .attrs = tma340_properties_attrs,
1849};
1850
1851
1852static int cyttsp_platform_init(struct i2c_client *client)
1853{
1854 int rc = 0;
1855 static struct kobject *tma340_properties_kobj;
1856
1857 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1858 tma340_properties_kobj = kobject_create_and_add("board_properties",
1859 NULL);
1860 if (tma340_properties_kobj)
1861 rc = sysfs_create_group(tma340_properties_kobj,
1862 &tma340_properties_attr_group);
1863 if (!tma340_properties_kobj || rc)
1864 pr_err("%s: failed to create board_properties\n",
1865 __func__);
1866
1867 return 0;
1868}
1869
1870static struct cyttsp_regulator regulator_data[] = {
1871 {
1872 .name = "vdd",
1873 .min_uV = CY_TMA300_VTG_MIN_UV,
1874 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301875 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1876 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001877 },
1878 /* TODO: Remove after runtime PM is enabled in I2C driver */
1879 {
1880 .name = "vcc_i2c",
1881 .min_uV = CY_I2C_VTG_MIN_UV,
1882 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301883 .hpm_load_uA = CY_I2C_CURR_UA,
1884 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001885 },
1886};
1887
1888static struct cyttsp_platform_data cyttsp_pdata = {
1889 .panel_maxx = 634,
1890 .panel_maxy = 1166,
1891 .disp_maxx = 616,
1892 .disp_maxy = 1023,
1893 .disp_minx = 0,
1894 .disp_miny = 16,
1895 .flags = 0x01,
1896 .gen = CY_GEN3, /* or */
1897 .use_st = CY_USE_ST,
1898 .use_mt = CY_USE_MT,
1899 .use_hndshk = CY_SEND_HNDSHK,
1900 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05301901 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001902 .use_gestures = CY_USE_GESTURES,
1903 .fw_fname = "cyttsp_8960_cdp.hex",
1904 /* activate up to 4 groups
1905 * and set active distance
1906 */
1907 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
1908 CY_GEST_GRP3 | CY_GEST_GRP4 |
1909 CY_ACT_DIST,
1910 /* change act_intrvl to customize the Active power state
1911 * scanning/processing refresh interval for Operating mode
1912 */
1913 .act_intrvl = CY_ACT_INTRVL_DFLT,
1914 /* change tch_tmout to customize the touch timeout for the
1915 * Active power state for Operating mode
1916 */
1917 .tch_tmout = CY_TCH_TMOUT_DFLT,
1918 /* change lp_intrvl to customize the Low Power power state
1919 * scanning/processing refresh interval for Operating mode
1920 */
1921 .lp_intrvl = CY_LP_INTRVL_DFLT,
1922 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
1923 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
1924 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1925 .regulator_info = regulator_data,
1926 .num_regulators = ARRAY_SIZE(regulator_data),
1927 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05301928 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001929};
1930
1931static struct i2c_board_info cyttsp_info[] __initdata = {
1932 {
1933 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1934 .platform_data = &cyttsp_pdata,
1935#ifndef CY_USE_TIMER
1936 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1937#endif /* CY_USE_TIMER */
1938 },
1939};
1940
Jing Lindc4413c2012-01-16 15:22:52 -08001941/* configuration data for mxt1386 */
1942static const u8 mxt1386_config_data[] = {
Mohan Pallaka50837382011-09-07 11:00:57 +05301943 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001944 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301945 /* T38 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001946 11, 2, 0, 11, 11, 11, 0, 0, 0, 0,
Jing Lin2f863172011-10-17 10:56:58 -07001947 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1948 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1949 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1950 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1951 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1952 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301953 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001954 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05301955 /* T8 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001956 8, 0, 0, 0, 0, 0, 8, 14, 50, 215,
Mohan Pallaka50837382011-09-07 11:00:57 +05301957 /* T9 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001958 131, 0, 0, 26, 42, 0, 32, 63, 3, 5,
1959 0, 2, 1, 113, 10, 10, 8, 10, 255, 2,
1960 85, 5, 0, 0, 20, 20, 75, 25, 202, 29,
1961 10, 10, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05301962 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001963 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1964 0,
Anirudh Ghayaldab4e0d2012-01-09 14:59:27 +05301965 /* T18 Object */
1966 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301967 /* T22 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001968 5, 0, 0, 0, 0, 0, 0, 0, 30, 0,
1969 0, 0, 5, 8, 10, 13, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301970 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001971 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1972 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301973 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001974 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
1975 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301976 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001977 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301978 /* T28 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001979 0, 0, 0, 8, 12, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05301980 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001981 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301982 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001983 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301984 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001985 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301986};
1987
Jing Lin33b007d2011-12-21 17:40:23 -08001988/* configuration data for mxt1386e using V1.0 firmware */
1989static const u8 mxt1386e_config_data_v1_0[] = {
1990 /* T6 Object */
1991 0, 0, 0, 0, 0, 0,
1992 /* T38 Object */
1993 12, 1, 0, 17, 1, 12, 0, 0, 0, 0,
1994 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1995 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1996 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1997 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1998 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1999 0, 0, 0, 0,
2000 /* T7 Object */
2001 100, 16, 50,
2002 /* T8 Object */
2003 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
2004 /* T9 Object */
2005 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
2006 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
2007 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
2008 10, 5, 0, 0, 0,
2009 /* T18 Object */
2010 0, 0,
2011 /* T24 Object */
2012 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2013 0, 0, 0, 0, 0, 0, 0, 0, 0,
2014 /* T25 Object */
2015 3, 0, 60, 115, 156, 99,
2016 /* T27 Object */
2017 0, 0, 0, 0, 0, 0, 0,
2018 /* T40 Object */
2019 0, 0, 0, 0, 0,
2020 /* T42 Object */
2021 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
2022 /* T43 Object */
2023 0, 0, 0, 0, 0, 0, 0,
2024 /* T46 Object */
2025 64, 0, 20, 20, 0, 0, 0, 0, 0,
2026 /* T47 Object */
2027 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2028 /* T48 Object */
2029 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
2030 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
2031 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
2032 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
2033 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2034 0, 0, 0, 0,
2035 /* T56 Object */
2036 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2037 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2038 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2039 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2040 2, 99, 33,
2041};
2042
2043/* configuration data for mxt1386e using V2.1 firmware */
2044static const u8 mxt1386e_config_data_v2_1[] = {
2045 /* T6 Object */
2046 0, 0, 0, 0, 0, 0,
2047 /* T38 Object */
2048 12, 2, 0, 17, 1, 12, 0, 0, 0, 0,
2049 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2050 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2051 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2052 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2053 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2054 0, 0, 0, 0,
2055 /* T7 Object */
2056 100, 16, 50,
2057 /* T8 Object */
2058 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
2059 /* T9 Object */
2060 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
2061 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
2062 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
2063 10, 5, 0, 0, 0,
2064 /* T18 Object */
2065 0, 0,
2066 /* T24 Object */
2067 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2068 0, 0, 0, 0, 0, 0, 0, 0, 0,
2069 /* T25 Object */
2070 3, 0, 60, 115, 156, 99,
2071 /* T27 Object */
2072 0, 0, 0, 0, 0, 0, 0,
2073 /* T40 Object */
2074 0, 0, 0, 0, 0,
2075 /* T42 Object */
2076 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
2077 /* T43 Object */
2078 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
2079 16,
2080 /* T46 Object */
2081 64, 0, 20, 20, 0, 0, 0, 0, 0,
2082 /* T47 Object */
2083 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2084 /* T48 Object */
2085 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
2086 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
2087 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
2088 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
2089 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2090 0, 0, 0, 0,
2091 /* T56 Object */
2092 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2093 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2094 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2095 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2096 2, 99, 33, 0, 149, 24, 193, 255, 255, 255,
2097 255,
2098};
2099
Jing Lineec88ca2012-02-08 11:18:30 -08002100/* configuration data for mxt1386e on 3D SKU using V2.1 firmware */
2101static const u8 mxt1386e_config_data_3d[] = {
2102 /* T6 Object */
2103 0, 0, 0, 0, 0, 0,
2104 /* T38 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002105 13, 1, 0, 23, 2, 12, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002106 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2107 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2108 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2109 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2110 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2111 0, 0, 0, 0,
2112 /* T7 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002113 100, 10, 50,
Jing Lineec88ca2012-02-08 11:18:30 -08002114 /* T8 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002115 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002116 /* T9 Object */
2117 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
2118 0, 5, 5, 0, 10, 30, 10, 10, 175, 4,
Jing Lin66ba78b2012-02-24 21:25:12 -08002119 127, 7, 26, 21, 17, 19, 143, 35, 207, 40,
2120 20, 5, 54, 49, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002121 /* T18 Object */
2122 0, 0,
2123 /* T24 Object */
2124 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2125 0, 0, 0, 0, 0, 0, 0, 0, 0,
2126 /* T25 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002127 0, 0, 72, 113, 168, 97,
Jing Lineec88ca2012-02-08 11:18:30 -08002128 /* T27 Object */
2129 0, 0, 0, 0, 0, 0, 0,
2130 /* T40 Object */
2131 0, 0, 0, 0, 0,
2132 /* T42 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002133 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002134 /* T43 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002135 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2136 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002137 /* T46 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002138 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002139 /* T47 Object */
2140 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2141 /* T48 Object */
2142 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08002143 32, 50, 0, 10, 10, 0, 0, 100, 10, 90,
2144 0, 0, 0, 0, 0, 0, 0, 10, 1, 30,
2145 52, 10, 5, 0, 33, 0, 1, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002146 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2147 0, 0, 0, 0,
2148 /* T56 Object */
2149 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2150 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2151 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2152 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08002153 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2154 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002155};
2156
Amy Maloche08266db2011-11-04 11:07:16 -07002157#define MXT_TS_GPIO_IRQ 11
2158#define MXT_TS_LDO_EN_GPIO 50
2159#define MXT_TS_RESET_GPIO 52
Mohan Pallaka50837382011-09-07 11:00:57 +05302160
2161static void mxt_init_hw_liquid(void)
2162{
2163 int rc;
2164
Mohan Pallaka50837382011-09-07 11:00:57 +05302165 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
2166 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07002167 pr_err("%s: unable to request mxt_ldo_en_gpio [%d]\n",
2168 __func__, MXT_TS_LDO_EN_GPIO);
2169 return;
Mohan Pallaka50837382011-09-07 11:00:57 +05302170 }
2171
2172 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
2173 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07002174 pr_err("%s: unable to set_direction for mxt_ldo_en_gpio [%d]\n",
2175 __func__, MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05302176 goto err_ldo_gpio_req;
2177 }
2178
Mohan Pallaka50837382011-09-07 11:00:57 +05302179 return;
2180
Mohan Pallaka50837382011-09-07 11:00:57 +05302181err_ldo_gpio_req:
2182 gpio_free(MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05302183}
2184
Jing Lineec88ca2012-02-08 11:18:30 -08002185static struct mxt_config_info mxt_config_array_2d[] = {
Jing Lindc4413c2012-01-16 15:22:52 -08002186 {
2187 .config = mxt1386_config_data,
2188 .config_length = ARRAY_SIZE(mxt1386_config_data),
2189 .family_id = 0xA0,
2190 .variant_id = 0x0,
2191 .version = 0x10,
2192 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002193 .bootldr_id = MXT_BOOTLOADER_ID_1386,
Jing Lindc4413c2012-01-16 15:22:52 -08002194 },
Jing Lin33b007d2011-12-21 17:40:23 -08002195 {
2196 .config = mxt1386e_config_data_v1_0,
2197 .config_length = ARRAY_SIZE(mxt1386e_config_data_v1_0),
2198 .family_id = 0xA0,
2199 .variant_id = 0x2,
2200 .version = 0x10,
2201 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002202 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Linaeaeed52012-03-26 14:57:15 -07002203 .fw_name = "atmel_8960_liquid_v2_2_AA.hex",
Jing Lin33b007d2011-12-21 17:40:23 -08002204 },
2205 {
2206 .config = mxt1386e_config_data_v2_1,
2207 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
2208 .family_id = 0xA0,
2209 .variant_id = 0x7,
2210 .version = 0x21,
2211 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002212 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Linaeaeed52012-03-26 14:57:15 -07002213 .fw_name = "atmel_8960_liquid_v2_2_AA.hex",
2214 },
2215 {
2216 /* The config data for V2.2.AA is the same as for V2.1.AA */
2217 .config = mxt1386e_config_data_v2_1,
2218 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
2219 .family_id = 0xA0,
2220 .variant_id = 0x7,
2221 .version = 0x22,
2222 .build = 0xAA,
2223 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin33b007d2011-12-21 17:40:23 -08002224 },
Jing Lindc4413c2012-01-16 15:22:52 -08002225};
2226
Jing Lineec88ca2012-02-08 11:18:30 -08002227static struct mxt_platform_data mxt_platform_data_2d = {
2228 .config_array = mxt_config_array_2d,
2229 .config_array_size = ARRAY_SIZE(mxt_config_array_2d),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002230 .panel_minx = 0,
2231 .panel_maxx = 1365,
2232 .panel_miny = 0,
2233 .panel_maxy = 767,
2234 .disp_minx = 0,
2235 .disp_maxx = 1365,
2236 .disp_miny = 0,
2237 .disp_maxy = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05302238 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07002239 .i2c_pull_up = true,
Amy Maloche08266db2011-11-04 11:07:16 -07002240 .reset_gpio = MXT_TS_RESET_GPIO,
2241 .irq_gpio = MXT_TS_GPIO_IRQ,
Mohan Pallaka50837382011-09-07 11:00:57 +05302242};
2243
Jing Lineec88ca2012-02-08 11:18:30 -08002244static struct mxt_config_info mxt_config_array_3d[] = {
2245 {
2246 .config = mxt1386e_config_data_3d,
2247 .config_length = ARRAY_SIZE(mxt1386e_config_data_3d),
2248 .family_id = 0xA0,
2249 .variant_id = 0x7,
2250 .version = 0x21,
2251 .build = 0xAA,
2252 },
2253};
2254
2255static struct mxt_platform_data mxt_platform_data_3d = {
2256 .config_array = mxt_config_array_3d,
2257 .config_array_size = ARRAY_SIZE(mxt_config_array_3d),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002258 .panel_minx = 0,
2259 .panel_maxx = 1919,
2260 .panel_miny = 0,
2261 .panel_maxy = 1199,
2262 .disp_minx = 0,
2263 .disp_maxx = 1919,
2264 .disp_miny = 0,
2265 .disp_maxy = 1199,
Jing Lineec88ca2012-02-08 11:18:30 -08002266 .irqflags = IRQF_TRIGGER_FALLING,
2267 .i2c_pull_up = true,
2268 .reset_gpio = MXT_TS_RESET_GPIO,
2269 .irq_gpio = MXT_TS_GPIO_IRQ,
2270};
2271
Mohan Pallaka50837382011-09-07 11:00:57 +05302272static struct i2c_board_info mxt_device_info[] __initdata = {
2273 {
2274 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
Mohan Pallaka50837382011-09-07 11:00:57 +05302275 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
2276 },
2277};
2278
Manoj Rao14648742012-03-30 19:42:12 -07002279#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
2280static void mhl_sii_reset_gpio(int on)
2281{
2282 gpio_set_value(MHL_GPIO_RESET, on);
2283 return;
2284}
2285
2286/*
2287 * Request for GPIO allocations
2288 * Set appropriate GPIO directions
2289 */
2290static int mhl_sii_gpio_setup(int on)
2291{
2292 int ret;
2293
2294 if (on) {
2295 ret = gpio_request(MHL_GPIO_RESET, "W_RST#");
2296 if (ret < 0) {
2297 pr_err("GPIO RESET request failed: %d\n", ret);
2298 return -EBUSY;
2299 }
2300 ret = gpio_direction_output(MHL_GPIO_RESET, 1);
2301 if (ret < 0) {
2302 pr_err("SET GPIO RESET direction failed: %d\n", ret);
2303 gpio_free(MHL_GPIO_RESET);
2304 return -EBUSY;
2305 }
2306 ret = gpio_request(MHL_GPIO_INT, "W_INT");
2307 if (ret < 0) {
2308 pr_err("GPIO INT request failed: %d\n", ret);
2309 gpio_free(MHL_GPIO_RESET);
2310 return -EBUSY;
2311 }
2312 ret = gpio_direction_input(MHL_GPIO_INT);
2313 if (ret < 0) {
2314 pr_err("SET GPIO INTR direction failed: %d\n", ret);
2315 gpio_free(MHL_GPIO_RESET);
2316 gpio_free(MHL_GPIO_INT);
2317 return -EBUSY;
2318 }
2319 } else {
2320 gpio_free(MHL_GPIO_RESET);
2321 gpio_free(MHL_GPIO_INT);
2322 }
2323
2324 return 0;
2325}
2326
2327static struct msm_mhl_platform_data mhl_platform_data = {
2328 .irq = MSM_GPIO_TO_INT(4),
2329 .gpio_setup = mhl_sii_gpio_setup,
2330 .reset_pin = mhl_sii_reset_gpio,
2331};
2332#endif
2333
Eugene Yasmand2316b82011-12-07 18:23:48 +02002334static struct i2c_board_info sii_device_info[] __initdata = {
2335 {
Manoj Rao14648742012-03-30 19:42:12 -07002336#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
2337 /*
2338 * keeps SI 8334 as the default
2339 * MHL TX
2340 */
2341 I2C_BOARD_INFO("sii8334", 0x39),
2342 .platform_data = &mhl_platform_data,
2343#endif
2344#ifdef CONFIG_FB_MSM_HDMI_MHL_9244
Eugene Yasmand2316b82011-12-07 18:23:48 +02002345 I2C_BOARD_INFO("Sil-9244", 0x39),
Eugene Yasmand2316b82011-12-07 18:23:48 +02002346 .irq = MSM_GPIO_TO_INT(15),
Manoj Rao14648742012-03-30 19:42:12 -07002347#endif /* CONFIG_MSM_HDMI_MHL */
2348 .flags = I2C_CLIENT_WAKE,
Eugene Yasmand2316b82011-12-07 18:23:48 +02002349 },
2350};
2351
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002352static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
2353 .clk_freq = 100000,
2354 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002355};
2356
2357static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
2358 .clk_freq = 100000,
2359 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002360};
2361
2362static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
2363 .clk_freq = 100000,
2364 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002365};
2366
2367static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
2368 .clk_freq = 100000,
2369 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002370};
2371
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06002372static struct msm_pm_sleep_status_data msm_pm_slp_sts_data = {
2373 .base_addr = MSM_ACC0_BASE + 0x08,
2374 .cpu_offset = MSM_ACC1_BASE - MSM_ACC0_BASE,
2375 .mask = 1UL << 13,
2376};
2377
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002378static struct ks8851_pdata spi_eth_pdata = {
2379 .irq_gpio = KS8851_IRQ_GPIO,
2380 .rst_gpio = KS8851_RST_GPIO,
2381};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06002382
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002383static struct spi_board_info spi_board_info[] __initdata = {
2384 {
2385 .modalias = "ks8851",
2386 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2387 .max_speed_hz = 19200000,
2388 .bus_num = 0,
2389 .chip_select = 0,
2390 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002391 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002392 },
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07002393 {
2394 .modalias = "dsi_novatek_3d_panel_spi",
2395 .max_speed_hz = 10800000,
2396 .bus_num = 0,
2397 .chip_select = 1,
2398 .mode = SPI_MODE_0,
2399 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002400};
2401
2402static struct platform_device msm_device_saw_core0 = {
2403 .name = "saw-regulator",
2404 .id = 0,
2405 .dev = {
2406 .platform_data = &msm_saw_regulator_pdata_s5,
2407 },
2408};
2409
2410static struct platform_device msm_device_saw_core1 = {
2411 .name = "saw-regulator",
2412 .id = 1,
2413 .dev = {
2414 .platform_data = &msm_saw_regulator_pdata_s6,
2415 },
2416};
2417
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002418static struct tsens_platform_data msm_tsens_pdata = {
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002419 .slope = {910, 910, 910, 910, 910},
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002420 .tsens_factor = 1000,
2421 .hw_type = MSM_8960,
2422 .tsens_num_sensor = 5,
2423};
2424
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002425#ifdef CONFIG_MSM_FAKE_BATTERY
2426static struct platform_device fish_battery_device = {
2427 .name = "fish_battery",
2428};
2429#endif
2430
David Collins26f05562011-06-20 09:56:28 -07002431static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002432 .name = GPIO_REGULATOR_DEV_NAME,
2433 .id = PM8921_MPP_PM_TO_SYS(7),
2434 .dev = {
2435 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2436 },
2437};
2438
David Collins26f05562011-06-20 09:56:28 -07002439static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002440 .name = GPIO_REGULATOR_DEV_NAME,
2441 .id = 91,
2442 .dev = {
2443 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2444 },
2445};
2446
David Collinsb10be1d2011-09-02 10:29:31 -07002447static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
2448 .name = GPIO_REGULATOR_DEV_NAME,
2449 .id = PM8921_GPIO_PM_TO_SYS(17),
2450 .dev = {
2451 .platform_data =
2452 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2453 },
2454};
2455
David Collins35a78f52011-12-14 15:54:25 -08002456static struct platform_device msm8960_device_ext_otg_sw_vreg __devinitdata = {
2457 .name = GPIO_REGULATOR_DEV_NAME,
2458 .id = PM8921_GPIO_PM_TO_SYS(42),
2459 .dev = {
2460 .platform_data =
2461 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_OTG_SW],
2462 },
2463};
2464
David Collins26f05562011-06-20 09:56:28 -07002465static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
2466 .name = "rpm-regulator",
2467 .id = -1,
2468 .dev = {
2469 .platform_data = &msm_rpm_regulator_pdata,
2470 },
2471};
Mayank Ranae009c922012-03-22 03:02:06 +05302472#ifdef CONFIG_SERIAL_MSM_HS
2473static int configure_uart_gpios(int on)
2474{
2475 int ret = 0, i;
2476 int uart_gpios[] = {93, 94, 95, 96};
2477
2478 for (i = 0; i < ARRAY_SIZE(uart_gpios); i++) {
2479 if (on) {
2480 ret = gpio_request(uart_gpios[i], NULL);
2481 if (ret) {
2482 pr_err("%s: unable to request uart gpio[%d]\n",
2483 __func__, uart_gpios[i]);
2484 break;
2485 }
2486 } else {
2487 gpio_free(uart_gpios[i]);
2488 }
2489 }
2490
2491 if (ret && on && i)
2492 for (; i >= 0; i--)
2493 gpio_free(uart_gpios[i]);
2494 return ret;
2495}
2496
2497static struct msm_serial_hs_platform_data msm_uart_dm9_pdata = {
Mayank Ranad85a5082012-04-29 17:24:13 -07002498 .gpio_config = configure_uart_gpios,
Mayank Ranae009c922012-03-22 03:02:06 +05302499};
2500#else
2501static struct msm_serial_hs_platform_data msm_uart_dm9_pdata;
2502#endif
David Collins26f05562011-06-20 09:56:28 -07002503
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002504static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07002505 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002506 &msm_device_smd,
Mayank Rana9f51f582011-08-04 18:35:59 +05302507 &msm_device_uart_dm6,
Mayank Ranae009c922012-03-22 03:02:06 +05302508 &msm_device_uart_dm9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002509 &msm_device_saw_core0,
2510 &msm_device_saw_core1,
2511 &msm8960_device_ext_5v_vreg,
David Collins87579612012-01-30 16:00:15 -08002512 &msm8960_device_ssbi_pmic,
David Collins96aa3e12012-02-29 10:31:34 -08002513 &msm8960_device_ext_otg_sw_vreg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002514 &msm8960_device_qup_spi_gsbi1,
2515 &msm8960_device_qup_i2c_gsbi3,
2516 &msm8960_device_qup_i2c_gsbi4,
2517 &msm8960_device_qup_i2c_gsbi10,
2518#ifndef CONFIG_MSM_DSPS
2519 &msm8960_device_qup_i2c_gsbi12,
2520#endif
2521 &msm_slim_ctrl,
2522 &msm_device_wcnss_wlan,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002523#if defined(CONFIG_QSEECOM)
2524 &qseecom_device,
2525#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002526#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2527 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2528 &qcrypto_device,
2529#endif
2530
2531#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2532 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2533 &qcedev_device,
2534#endif
2535#ifdef CONFIG_MSM_ROTATOR
2536 &msm_rotator_device,
2537#endif
2538 &msm_device_sps,
2539#ifdef CONFIG_MSM_FAKE_BATTERY
2540 &fish_battery_device,
2541#endif
Larry Bassel41a055b2011-12-06 16:15:14 -08002542 &fmem_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002543#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07002544#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002545 &android_pmem_device,
2546 &android_pmem_adsp_device,
2547 &android_pmem_audio_device,
2548#endif
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -07002549#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002550 &msm_device_vidc,
2551 &msm_device_bam_dmux,
2552 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07002553
Joel Nidera1261942011-09-12 16:30:09 +03002554#if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE)
2555#ifdef CONFIG_MSM_USE_TSIF1
2556 &msm_device_tsif[1],
2557#else
2558 &msm_device_tsif[0],
2559#endif
2560#endif
2561
Mona Hossain9c430e32011-07-27 11:04:47 -07002562#ifdef CONFIG_HW_RANDOM_MSM
2563 &msm_device_rng,
2564#endif
Laura Abbottd6183792011-08-19 13:42:24 -07002565#ifdef CONFIG_ION_MSM
2566 &ion_dev,
2567#endif
Praveen Chidambaram78499012011-11-01 17:15:17 -06002568 &msm8960_rpm_device,
2569 &msm8960_rpm_log_device,
2570 &msm8960_rpm_stat_device,
Mona Hossain11c03ac2011-10-26 12:42:10 -07002571 &msm_device_tz_log,
Pratik Patel7831c082011-06-08 21:44:37 -07002572#ifdef CONFIG_MSM_QDSS
Pratik Patel1403f2a2012-03-21 10:10:00 -07002573 &msm_qdss_device,
Pratik Patel7831c082011-06-08 21:44:37 -07002574 &msm_etb_device,
2575 &msm_tpiu_device,
2576 &msm_funnel_device,
Pratik Patel492b3012012-03-06 14:22:30 -08002577 &msm_etm_device,
Pratik Patel7831c082011-06-08 21:44:37 -07002578#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07002579 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002580 &msm8960_device_watchdog,
Laura Abbottf8c03b92012-02-16 14:57:58 -08002581#ifdef CONFIG_MSM_RTB
2582 &msm_rtb_device,
2583#endif
Praveen Chidambaram8ea3dcd2011-12-07 14:46:31 -07002584 &msm8960_cpu_idle_device,
Praveen Chidambaram5c8adf22012-02-23 18:44:37 -07002585 &msm8960_msm_gov_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002586 &msm8960_device_cache_erp,
Laura Abbott306bcc22012-03-08 11:24:53 -08002587#ifdef CONFIG_MSM_CACHE_DUMP
2588 &msm_cache_dump_device,
2589#endif
Laura Abbott0577d7b2012-04-17 11:14:30 -07002590 &msm8960_iommu_domain_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002591};
2592
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002593static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07002594 &msm8960_device_uart_gsbi5,
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002595 &msm8960_device_otg,
2596 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002597 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05302598 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002599 &android_usb_device,
2600 &msm_device_vidc,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002601 &msm_bus_apps_fabric,
2602 &msm_bus_sys_fabric,
2603 &msm_bus_mm_fabric,
2604 &msm_bus_sys_fpb,
2605 &msm_bus_cpss_fpb,
2606 &msm_pcm,
Kiran Kandi5e809b02012-01-31 00:24:33 -08002607 &msm_multi_ch_pcm,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002608 &msm_pcm_routing,
2609 &msm_cpudai0,
2610 &msm_cpudai1,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002611 &msm8960_cpudai_slimbus_2_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002612 &msm_cpudai_hdmi_rx,
2613 &msm_cpudai_bt_rx,
2614 &msm_cpudai_bt_tx,
2615 &msm_cpudai_fm_rx,
2616 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002617 &msm_cpudai_auxpcm_rx,
2618 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002619 &msm_cpu_fe,
2620 &msm_stub_codec,
2621 &msm_voice,
2622 &msm_voip,
2623 &msm_lpa_pcm,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05302624 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07002625 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07002626 &msm_cpudai_incall_record_rx,
2627 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002628
2629#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2630 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2631 &qcrypto_device,
2632#endif
2633
2634#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2635 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2636 &qcedev_device,
2637#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002638};
2639
2640static struct platform_device *rumi3_devices[] __initdata = {
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07002641 &msm8960_device_uart_gsbi5,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002642 &msm_kgsl_3d0,
2643 &msm_kgsl_2d0,
2644 &msm_kgsl_2d1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002645#ifdef CONFIG_MSM_GEMINI
2646 &msm8960_gemini_device,
2647#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002648};
2649
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002650static struct platform_device *cdp_devices[] __initdata = {
Stephen Boydeb819882011-08-29 14:46:30 -07002651 &msm_8960_q6_lpass,
2652 &msm_8960_q6_mss_fw,
2653 &msm_8960_q6_mss_sw,
Stephen Boyd322a9922011-09-20 01:05:54 -07002654 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07002655 &msm_pil_tzapps,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07002656 &msm_pil_dsps,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002657 &msm_pil_vidc,
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002658 &msm8960_device_otg,
2659 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002660 &msm_device_hsusb_host,
2661 &android_usb_device,
2662 &msm_pcm,
Kiran Kandi5e809b02012-01-31 00:24:33 -08002663 &msm_multi_ch_pcm,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002664 &msm_pcm_routing,
2665 &msm_cpudai0,
2666 &msm_cpudai1,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002667 &msm8960_cpudai_slimbus_2_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002668 &msm_cpudai_hdmi_rx,
2669 &msm_cpudai_bt_rx,
2670 &msm_cpudai_bt_tx,
2671 &msm_cpudai_fm_rx,
2672 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002673 &msm_cpudai_auxpcm_rx,
2674 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002675 &msm_cpu_fe,
2676 &msm_stub_codec,
2677 &msm_kgsl_3d0,
2678#ifdef CONFIG_MSM_KGSL_2D
2679 &msm_kgsl_2d0,
2680 &msm_kgsl_2d1,
2681#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002682#ifdef CONFIG_MSM_GEMINI
2683 &msm8960_gemini_device,
2684#endif
2685 &msm_voice,
2686 &msm_voip,
2687 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05302688 &msm_cpudai_afe_01_rx,
2689 &msm_cpudai_afe_01_tx,
2690 &msm_cpudai_afe_02_rx,
2691 &msm_cpudai_afe_02_tx,
2692 &msm_pcm_afe,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05302693 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07002694 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07002695 &msm_cpudai_incall_record_rx,
2696 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002697 &msm_pcm_hostless,
2698 &msm_bus_apps_fabric,
2699 &msm_bus_sys_fabric,
2700 &msm_bus_mm_fabric,
2701 &msm_bus_sys_fpb,
2702 &msm_bus_cpss_fpb,
2703};
2704
2705static void __init msm8960_i2c_init(void)
2706{
2707 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2708 &msm8960_i2c_qup_gsbi4_pdata;
2709
2710 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2711 &msm8960_i2c_qup_gsbi3_pdata;
2712
2713 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2714 &msm8960_i2c_qup_gsbi10_pdata;
2715
2716 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2717 &msm8960_i2c_qup_gsbi12_pdata;
2718}
2719
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002720static void __init msm8960_gfx_init(void)
2721{
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06002722 uint32_t soc_platform_version = socinfo_get_version();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002723 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
2724 struct kgsl_device_platform_data *kgsl_3d0_pdata =
2725 msm_kgsl_3d0.dev.platform_data;
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -06002726 kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
2727 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002728 }
2729}
2730
Subhash Jadavani933e6a62011-12-26 18:05:04 +05302731static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002732 {
2733 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2734 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2735 true,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002736 100, 650, 801, 200,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002737 },
2738
2739 {
2740 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2741 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2742 true,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002743 2000, 200, 576000, 2000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002744 },
2745
2746 {
2747 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2748 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2749 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002750 8500, 51, 1122000, 8500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002751 },
2752
2753 {
2754 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2755 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
2756 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002757 9000, 51, 1130300, 9000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002758 },
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06002759 {
2760 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2761 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2762 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002763 10000, 51, 1130300, 10000,
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06002764 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002765
2766 {
2767 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2768 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2769 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002770 12000, 14, 2205900, 12000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002771 },
2772
2773 {
2774 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2775 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2776 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002777 18000, 12, 2364250, 18000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002778 },
2779
2780 {
2781 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2782 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2783 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002784 23500, 10, 2667000, 23500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002785 },
2786
2787 {
2788 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2789 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2790 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002791 29700, 5, 2867000, 30000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002792 },
2793};
2794
Praveen Chidambaram78499012011-11-01 17:15:17 -06002795static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2796 .levels = &msm_rpmrs_levels[0],
2797 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2798 .vdd_mem_levels = {
2799 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2800 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2801 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2802 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2803 },
2804 .vdd_dig_levels = {
2805 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
2806 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
2807 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
2808 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
2809 },
2810 .vdd_mask = 0x7FFFFF,
2811 .rpmrs_target_id = {
2812 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2813 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
2814 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
2815 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
2816 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
2817 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
2818 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2819 },
2820};
2821
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002822static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2823 .mode = MSM_PM_BOOT_CONFIG_TZ,
2824};
2825
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002826#ifdef CONFIG_I2C
2827#define I2C_SURF 1
2828#define I2C_FFA (1 << 1)
2829#define I2C_RUMI (1 << 2)
2830#define I2C_SIM (1 << 3)
2831#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03002832#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002833
2834struct i2c_registry {
2835 u8 machs;
2836 int bus;
2837 struct i2c_board_info *info;
2838 int len;
2839};
2840
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002841/* Sensors DSPS platform data */
2842#ifdef CONFIG_MSM_DSPS
2843#define DSPS_PIL_GENERIC_NAME "dsps"
2844#endif /* CONFIG_MSM_DSPS */
2845
2846static void __init msm8960_init_dsps(void)
2847{
2848#ifdef CONFIG_MSM_DSPS
2849 struct msm_dsps_platform_data *pdata =
2850 msm_dsps_device.dev.platform_data;
2851 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
2852 pdata->gpios = NULL;
2853 pdata->gpios_num = 0;
2854
2855 platform_device_register(&msm_dsps_device);
2856#endif /* CONFIG_MSM_DSPS */
2857}
2858
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -08002859static int hsic_peripheral_status = 1;
2860static DEFINE_MUTEX(hsic_status_lock);
2861
2862void peripheral_connect()
2863{
2864 mutex_lock(&hsic_status_lock);
2865 if (hsic_peripheral_status)
2866 goto out;
2867 platform_device_add(&msm_device_hsic_host);
2868 hsic_peripheral_status = 1;
2869out:
2870 mutex_unlock(&hsic_status_lock);
2871}
2872EXPORT_SYMBOL(peripheral_connect);
2873
2874void peripheral_disconnect()
2875{
2876 mutex_lock(&hsic_status_lock);
2877 if (!hsic_peripheral_status)
2878 goto out;
2879 platform_device_del(&msm_device_hsic_host);
2880 hsic_peripheral_status = 0;
2881out:
2882 mutex_unlock(&hsic_status_lock);
2883}
2884EXPORT_SYMBOL(peripheral_disconnect);
2885
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05302886static void __init msm8960_init_smsc_hub(void)
2887{
2888 uint32_t version = socinfo_get_version();
2889
2890 if (SOCINFO_VERSION_MAJOR(version) == 1)
2891 return;
2892
2893 if (machine_is_msm8960_liquid())
2894 platform_device_register(&smsc_hub_device);
2895}
2896
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002897static void __init msm8960_init_hsic(void)
2898{
2899#ifdef CONFIG_USB_EHCI_MSM_HSIC
2900 uint32_t version = socinfo_get_version();
2901
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08002902 if (SOCINFO_VERSION_MAJOR(version) == 1)
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002903 return;
2904
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002905 if (PLATFORM_IS_CHARM25() || machine_is_msm8960_liquid())
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08002906 platform_device_register(&msm_device_hsic_host);
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002907#endif
2908}
2909
Amir Samuelov5137e392011-09-21 17:31:25 +03002910#ifdef CONFIG_ISL9519_CHARGER
2911static struct isl_platform_data isl_data __initdata = {
2912 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
2913 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
2914 .max_system_voltage = 4200,
2915 .min_system_voltage = 3200,
Amir Samuelov95f49ff2012-01-29 09:14:08 +02002916 .chgcurrent = 1900,
2917 .term_current = 0,
Amir Samuelov5137e392011-09-21 17:31:25 +03002918 .input_current = 2048,
2919};
2920
2921static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
2922 {
2923 I2C_BOARD_INFO("isl9519q", 0x9),
2924 .irq = 0, /* Not required when notify-by-pmic */
2925 .platform_data = &isl_data,
2926 },
2927};
2928#endif /* CONFIG_ISL9519_CHARGER */
2929
Amir Samuelov755616d2011-12-13 16:34:46 +02002930static struct i2c_board_info liquid_io_expander_i2c_info[] __initdata = {
2931 {
2932 I2C_BOARD_INFO("sx1508q", 0x20),
2933 .platform_data = &msm8960_sx150x_data[SX150X_LIQUID]
2934 },
2935};
2936
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002937static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Amir Samuelov5137e392011-09-21 17:31:25 +03002938#ifdef CONFIG_ISL9519_CHARGER
2939 {
2940 I2C_LIQUID,
2941 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2942 isl_charger_i2c_info,
2943 ARRAY_SIZE(isl_charger_i2c_info),
2944 },
2945#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002946 {
2947 I2C_SURF | I2C_FFA | I2C_FLUID,
2948 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2949 cyttsp_info,
2950 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07002951 },
Mohan Pallaka50837382011-09-07 11:00:57 +05302952 {
2953 I2C_LIQUID,
2954 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2955 mxt_device_info,
2956 ARRAY_SIZE(mxt_device_info),
2957 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05302958 {
Manoj Rao14648742012-03-30 19:42:12 -07002959 I2C_SURF | I2C_FFA | I2C_LIQUID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302960 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Eugene Yasmand2316b82011-12-07 18:23:48 +02002961 sii_device_info,
2962 ARRAY_SIZE(sii_device_info),
2963 },
2964 {
2965 I2C_LIQUID,
2966 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302967 msm_isa1200_board_info,
2968 ARRAY_SIZE(msm_isa1200_board_info),
2969 },
Amir Samuelov755616d2011-12-13 16:34:46 +02002970 {
2971 I2C_LIQUID,
2972 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2973 liquid_io_expander_i2c_info,
2974 ARRAY_SIZE(liquid_io_expander_i2c_info),
2975 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002976};
2977#endif /* CONFIG_I2C */
2978
2979static void __init register_i2c_devices(void)
2980{
2981#ifdef CONFIG_I2C
2982 u8 mach_mask = 0;
2983 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08002984#ifdef CONFIG_MSM_CAMERA
2985 struct i2c_registry msm8960_camera_i2c_devices = {
2986 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
2987 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
2988 msm8960_camera_board_info.board_info,
2989 msm8960_camera_board_info.num_i2c_board_info,
2990 };
2991#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002992
2993 /* Build the matching 'supported_machs' bitmask */
2994 if (machine_is_msm8960_cdp())
2995 mach_mask = I2C_SURF;
2996 else if (machine_is_msm8960_rumi3())
2997 mach_mask = I2C_RUMI;
2998 else if (machine_is_msm8960_sim())
2999 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07003000 else if (machine_is_msm8960_fluid())
3001 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03003002 else if (machine_is_msm8960_liquid())
3003 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07003004 else if (machine_is_msm8960_mtp())
3005 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003006 else
3007 pr_err("unmatched machine ID in register_i2c_devices\n");
3008
Jing Lineec88ca2012-02-08 11:18:30 -08003009 if (machine_is_msm8960_liquid()) {
3010 if (SOCINFO_VERSION_MAJOR(socinfo_get_platform_version()) == 3)
3011 mxt_device_info[0].platform_data =
3012 &mxt_platform_data_3d;
3013 else
3014 mxt_device_info[0].platform_data =
3015 &mxt_platform_data_2d;
3016 }
3017
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003018 /* Run the array and install devices as appropriate */
3019 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
3020 if (msm8960_i2c_devices[i].machs & mach_mask)
3021 i2c_register_board_info(msm8960_i2c_devices[i].bus,
3022 msm8960_i2c_devices[i].info,
3023 msm8960_i2c_devices[i].len);
3024 }
Kevin Chan09f4e662011-12-16 08:17:02 -08003025#ifdef CONFIG_MSM_CAMERA
3026 if (msm8960_camera_i2c_devices.machs & mach_mask)
3027 i2c_register_board_info(msm8960_camera_i2c_devices.bus,
3028 msm8960_camera_i2c_devices.info,
3029 msm8960_camera_i2c_devices.len);
3030#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003031#endif
3032}
3033
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003034static void __init msm8960_sim_init(void)
3035{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07003036 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
3037 &msm8960_device_watchdog.dev.platform_data;
3038
3039 wdog_pdata->bark_time = 15000;
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08003040 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06003041 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
3042 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003043 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07003044 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07003045 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003046 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003047
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003048 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08003049 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003050 msm8960_i2c_init();
3051 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3052 msm_spm_l2_init(msm_spm_l2_data);
3053 msm8960_init_buses();
3054 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003055 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003056 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07003057 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003058
3059 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3060 &msm8960_qup_spi_gsbi1_pdata;
3061 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
3062
3063 msm8960_init_mmc();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08003064 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003065 slim_register_board_info(msm_slim_devices,
3066 ARRAY_SIZE(msm_slim_devices));
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06003067 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06003068 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003069}
3070
3071static void __init msm8960_rumi3_init(void)
3072{
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08003073 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06003074 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
3075 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003076 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07003077 platform_device_register(&msm8960_device_rpm_regulator);
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08003078 msm8960_init_gpiomux();
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003079 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003080 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3081 &msm8960_qup_spi_gsbi1_pdata;
3082 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
3083 msm8960_i2c_init();
3084 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3085 msm_spm_l2_init(msm_spm_l2_data);
3086 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003087 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003088 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003089 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003090 register_i2c_devices();
Mayank Ranae009c922012-03-22 03:02:06 +05303091
Mayank Ranae009c922012-03-22 03:02:06 +05303092
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08003093 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003094 slim_register_board_info(msm_slim_devices,
3095 ARRAY_SIZE(msm_slim_devices));
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06003096 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06003097 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003098}
3099
3100static void __init msm8960_cdp_init(void)
3101{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07003102 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
3103 pr_err("meminfo_init() failed!\n");
3104
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08003105 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06003106 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
3107 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07003108
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003109 regulator_suppress_info_printing();
3110 if (msm_xo_init())
3111 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07003112 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07003113 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05303114 if (machine_is_msm8960_liquid())
3115 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003116 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05303117 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
3118 machine_is_msm8960_cdp()) {
3119 msm_otg_pdata.phy_init_seq = wr_phy_init_seq;
3120 } else if (machine_is_msm8960_liquid()) {
3121 msm_otg_pdata.phy_init_seq =
3122 liquid_v1_phy_init_seq;
3123 }
Anji jonnalaa7c1c5c2011-12-12 12:20:36 +05303124 msm_otg_pdata.swfi_latency =
3125 msm_rpmrs_levels[0].latency_us;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303126 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303127 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2 &&
3128 machine_is_msm8960_liquid())
3129 msm_device_hsic_host.dev.parent = &smsc_hub_device.dev;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08003130 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003131 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3132 &msm8960_qup_spi_gsbi1_pdata;
3133 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003134
3135 msm8960_init_pmic();
Mohan Pallakaf69f0492011-11-21 13:08:33 +05303136 if ((SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2 &&
3137 (machine_is_msm8960_mtp())) || machine_is_msm8960_liquid())
3138 msm_isa1200_board_info[0].platform_data = &isa1200_1_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003139 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003140 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003141 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3142 msm_spm_l2_init(msm_spm_l2_data);
3143 msm8960_init_buses();
3144 platform_add_devices(msm_footswitch_devices,
3145 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07003146 if (machine_is_msm8960_liquid())
3147 platform_device_register(&msm8960_device_ext_3p3v_vreg);
David Collinsd5a40732011-11-29 15:53:56 -08003148 if (machine_is_msm8960_cdp())
3149 platform_device_register(&msm8960_device_ext_l2_vreg);
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07003150
3151 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
3152 platform_device_register(&msm8960_device_uart_gsbi8);
3153 else
3154 platform_device_register(&msm8960_device_uart_gsbi5);
3155
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003156 /* For 8960 Fusion 2.2 Primary IPC */
Mayank Ranad85a5082012-04-29 17:24:13 -07003157 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE) {
3158 msm_uart_dm9_pdata.wakeup_irq = gpio_to_irq(94); /* GSBI9(2) */
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003159 msm_device_uart_dm9.dev.platform_data = &msm_uart_dm9_pdata;
Mayank Ranad85a5082012-04-29 17:24:13 -07003160 }
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003161
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003162 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003163 msm8960_pm8921_gpio_mpp_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003164 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303165 msm8960_init_smsc_hub();
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003166 msm8960_init_hsic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003167 msm8960_init_cam();
3168 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07003169 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05303170 if (machine_is_msm8960_liquid())
3171 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003172 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08003173 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003174 slim_register_board_info(msm_slim_devices,
3175 ARRAY_SIZE(msm_slim_devices));
3176 msm8960_init_dsps();
Larry Bassela7eadea2011-07-14 10:46:00 -07003177 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06003178 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06003179 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Joel Kingb8352a12011-11-15 18:46:24 -08003180 if (PLATFORM_IS_CHARM25())
3181 platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003182}
3183
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003184MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
3185 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003186 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003187 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303188 .handle_irq = gic_handle_irq,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003189 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003190 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003191 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003192 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003193MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003194
3195MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
3196 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003197 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003198 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303199 .handle_irq = gic_handle_irq,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003200 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003201 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003202 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003203 .init_very_early = msm8960_early_memory,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003204MACHINE_END
3205
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003206MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
3207 .map_io = msm8960_map_io,
3208 .reserve = msm8960_reserve,
3209 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303210 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003211 .timer = &msm_timer,
3212 .init_machine = msm8960_cdp_init,
3213 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003214 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003215MACHINE_END
3216
3217MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
3218 .map_io = msm8960_map_io,
3219 .reserve = msm8960_reserve,
3220 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303221 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003222 .timer = &msm_timer,
3223 .init_machine = msm8960_cdp_init,
3224 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003225 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003226MACHINE_END
3227
3228MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
3229 .map_io = msm8960_map_io,
3230 .reserve = msm8960_reserve,
3231 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303232 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003233 .timer = &msm_timer,
3234 .init_machine = msm8960_cdp_init,
3235 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003236 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003237MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003238
3239MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
3240 .map_io = msm8960_map_io,
3241 .reserve = msm8960_reserve,
3242 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303243 .handle_irq = gic_handle_irq,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003244 .timer = &msm_timer,
3245 .init_machine = msm8960_cdp_init,
3246 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003247 .init_very_early = msm8960_early_memory,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003248MACHINE_END