blob: 9860f7c234d3ec32aaa10ebb73f6d22f58dd8a7a [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>
Olav Haugan8726caf2012-05-10 15:11:35 -070087#include <mach/iommu_domains.h>
Laura Abbottd6183792011-08-19 13:42:24 -070088
Larry Bassel41a055b2011-12-06 16:15:14 -080089#include <linux/fmem.h>
90
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070091#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080092#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070093#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070094#include "spm.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080095#include "board-8960.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080096#include "pm.h"
Abhijeet Dharmapurikarefaca4f2011-12-27 16:24:07 -080097#include <mach/cpuidle.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070098#include "rpm_resources.h"
Subhash Jadavani909e04f2012-04-12 10:52:50 +053099#include <mach/mpm.h>
Matt Wagantall6d9ebee2011-08-26 12:15:24 -0700100#include "acpuclock.h"
Naveen Ramaraj76483ad2011-09-06 14:25:44 -0700101#include "smd_private.h"
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -0600102#include "pm-boot.h"
Jeff Ohlstein7e668552011-10-06 16:17:25 -0700103#include "msm_watchdog.h"
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800104
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700105static struct platform_device msm_fm_platform_init = {
106 .name = "iris_fm",
107 .id = -1,
108};
109
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700110#define KS8851_RST_GPIO 89
111#define KS8851_IRQ_GPIO 90
Mohan Pallaka5e490392011-09-09 15:18:41 +0530112#define HAP_SHIFT_LVL_OE_GPIO 47
113
Manoj Rao14648742012-03-30 19:42:12 -0700114#define MHL_GPIO_INT 4
115#define MHL_GPIO_RESET 15
116
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700117#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700118
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800119struct sx150x_platform_data msm8960_sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700120 [SX150X_CAM] = {
121 .gpio_base = GPIO_CAM_EXPANDER_BASE,
122 .oscio_is_gpo = false,
123 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530124 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700125 .io_open_drain_ena = 0x0,
126 .irq_summary = -1,
127 },
Amir Samuelov755616d2011-12-13 16:34:46 +0200128 [SX150X_LIQUID] = {
129 .gpio_base = GPIO_LIQUID_EXPANDER_BASE,
130 .oscio_is_gpo = false,
131 .io_pullup_ena = 0x0c08,
132 .io_pulldn_ena = 0x4060,
133 .io_open_drain_ena = 0x000c,
134 .io_polarity = 0,
135 .irq_summary = -1,
136 },
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700137};
Nishant Pandit474f2252011-07-23 23:17:56 +0530138
139#endif
140
Olav Haugana21169d2012-01-04 09:17:06 -0800141#define MSM_PMEM_ADSP_SIZE 0x7800000
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -0700142#define MSM_PMEM_AUDIO_SIZE 0x4CF000
Mathew Karimpanal15fa5c42011-12-14 21:28:10 -0800143#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800144#define MSM_LIQUID_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800145#define MSM_HDMI_PRIM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Laura Abbott2d1760b2011-09-29 21:31:24 -0700146
147#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -0700148#define MSM_PMEM_KERNEL_EBI1_SIZE 0x65000
Olav Haugan32594552012-03-13 11:40:05 -0700149#ifdef CONFIG_MSM_IOMMU
Olav Haugan8726caf2012-05-10 15:11:35 -0700150#define MSM_ION_MM_SIZE 0x3800000 /* Need to be multiple of 64K */
Olav Haugan32594552012-03-13 11:40:05 -0700151#define MSM_ION_SF_SIZE 0x0
Olav Hauganfbbf05b2012-04-05 14:33:41 -0700152#define MSM_ION_QSECOM_SIZE 0x780000 /* (7.5MB) */
Olav Haugan32594552012-03-13 11:40:05 -0700153#define MSM_ION_HEAP_NUM 7
154#else
155#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
156#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Hauganfbbf05b2012-04-05 14:33:41 -0700157#define MSM_ION_QSECOM_SIZE 0x600000 /* (6MB) */
Olav Haugan32594552012-03-13 11:40:05 -0700158#define MSM_ION_HEAP_NUM 8
159#endif
Olav Haugan42ebe712012-01-10 16:30:58 -0800160#define MSM_ION_MM_FW_SIZE 0x200000 /* (2MB) */
Olav Hauganb5be7992011-11-18 14:29:02 -0800161#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan7355db02012-01-13 16:59:13 -0800162#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Olav Haugan32594552012-03-13 11:40:05 -0700163
Olav Hauganb5be7992011-11-18 14:29:02 -0800164#define MSM_LIQUID_ION_MM_SIZE (MSM_ION_MM_SIZE + 0x600000)
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800165#define MSM_LIQUID_ION_SF_SIZE MSM_LIQUID_PMEM_SIZE
166#define MSM_HDMI_PRIM_ION_SF_SIZE MSM_HDMI_PRIM_PMEM_SIZE
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700167
Larry Bassel4d4f4482012-04-04 11:26:09 -0700168#define MSM8960_FIXED_AREA_START 0xa0000000
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700169#define MAX_FIXED_AREA_SIZE 0x10000000
Larry Bassel4d4f4482012-04-04 11:26:09 -0700170#define MSM_MM_FW_SIZE 0x200000
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700171#define MSM8960_FW_START (MSM8960_FIXED_AREA_START - MSM_MM_FW_SIZE)
172
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800173static unsigned msm_ion_sf_size = MSM_ION_SF_SIZE;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700174#else
Laura Abbott6db11c92011-11-04 10:31:43 -0700175#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
Olav Hauganb5be7992011-11-18 14:29:02 -0800176#define MSM_ION_HEAP_NUM 1
Laura Abbott2d1760b2011-09-29 21:31:24 -0700177#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700178
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700179#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
180static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
181static int __init pmem_kernel_ebi1_size_setup(char *p)
182{
183 pmem_kernel_ebi1_size = memparse(p, NULL);
184 return 0;
185}
186early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
187#endif
188
189#ifdef CONFIG_ANDROID_PMEM
190static unsigned pmem_size = MSM_PMEM_SIZE;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800191static unsigned pmem_param_set;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700192static int __init pmem_size_setup(char *p)
193{
194 pmem_size = memparse(p, NULL);
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800195 pmem_param_set = 1;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700196 return 0;
197}
198early_param("pmem_size", pmem_size_setup);
199
200static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
201
202static int __init pmem_adsp_size_setup(char *p)
203{
204 pmem_adsp_size = memparse(p, NULL);
205 return 0;
206}
207early_param("pmem_adsp_size", pmem_adsp_size_setup);
208
209static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
210
211static int __init pmem_audio_size_setup(char *p)
212{
213 pmem_audio_size = memparse(p, NULL);
214 return 0;
215}
216early_param("pmem_audio_size", pmem_audio_size_setup);
217#endif
218
219#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700220#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700221static struct android_pmem_platform_data android_pmem_pdata = {
222 .name = "pmem",
223 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
224 .cached = 1,
225 .memory_type = MEMTYPE_EBI1,
226};
227
Laura Abbottb93525f2012-04-12 09:57:19 -0700228static struct platform_device msm8960_android_pmem_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700229 .name = "android_pmem",
230 .id = 0,
231 .dev = {.platform_data = &android_pmem_pdata},
232};
233
234static struct android_pmem_platform_data android_pmem_adsp_pdata = {
235 .name = "pmem_adsp",
236 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
237 .cached = 0,
238 .memory_type = MEMTYPE_EBI1,
239};
Laura Abbottb93525f2012-04-12 09:57:19 -0700240static struct platform_device msm8960_android_pmem_adsp_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700241 .name = "android_pmem",
242 .id = 2,
243 .dev = { .platform_data = &android_pmem_adsp_pdata },
244};
245
246static struct android_pmem_platform_data android_pmem_audio_pdata = {
247 .name = "pmem_audio",
248 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
249 .cached = 0,
250 .memory_type = MEMTYPE_EBI1,
251};
252
Laura Abbottb93525f2012-04-12 09:57:19 -0700253static struct platform_device msm8960_android_pmem_audio_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700254 .name = "android_pmem",
255 .id = 4,
256 .dev = { .platform_data = &android_pmem_audio_pdata },
257};
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700258#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
259#endif /*CONFIG_ANDROID_PMEM*/
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700260
Laura Abbottb93525f2012-04-12 09:57:19 -0700261struct fmem_platform_data msm8960_fmem_pdata = {
Larry Bassel41a055b2011-12-06 16:15:14 -0800262};
263
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700264#define DSP_RAM_BASE_8960 0x8da00000
265#define DSP_RAM_SIZE_8960 0x1800000
266static int dspcrashd_pdata_8960 = 0xDEADDEAD;
267
268static struct resource resources_dspcrashd_8960[] = {
269 {
270 .name = "msm_dspcrashd",
271 .start = DSP_RAM_BASE_8960,
272 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
273 .flags = IORESOURCE_DMA,
274 },
275};
276
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800277static struct platform_device msm_device_dspcrashd_8960 = {
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700278 .name = "msm_dspcrashd",
279 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
280 .resource = resources_dspcrashd_8960,
281 .dev = { .platform_data = &dspcrashd_pdata_8960 },
282};
283
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700284static struct memtype_reserve msm8960_reserve_table[] __initdata = {
285 [MEMTYPE_SMI] = {
286 },
287 [MEMTYPE_EBI0] = {
288 .flags = MEMTYPE_FLAGS_1M_ALIGN,
289 },
290 [MEMTYPE_EBI1] = {
291 .flags = MEMTYPE_FLAGS_1M_ALIGN,
292 },
293};
294
Laura Abbottf8c03b92012-02-16 14:57:58 -0800295static void __init reserve_rtb_memory(void)
296{
297#if defined(CONFIG_MSM_RTB)
Laura Abbottb93525f2012-04-12 09:57:19 -0700298 msm8960_reserve_table[MEMTYPE_EBI1].size += msm8960_rtb_pdata.size;
Laura Abbottf8c03b92012-02-16 14:57:58 -0800299#endif
300}
301
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700302static void __init size_pmem_devices(void)
303{
304#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700305#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700306 android_pmem_adsp_pdata.size = pmem_adsp_size;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800307
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800308 if (!pmem_param_set) {
309 if (machine_is_msm8960_liquid())
310 pmem_size = MSM_LIQUID_PMEM_SIZE;
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700311 if (msm8960_hdmi_as_primary_selected())
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800312 pmem_size = MSM_HDMI_PRIM_PMEM_SIZE;
313 }
314
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700315 android_pmem_pdata.size = pmem_size;
316 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700317#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
318#endif /*CONFIG_ANDROID_PMEM*/
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700319}
320
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700321#ifdef CONFIG_ANDROID_PMEM
322#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700323static void __init reserve_memory_for(struct android_pmem_platform_data *p)
324{
325 msm8960_reserve_table[p->memory_type].size += p->size;
326}
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700327#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
328#endif /*CONFIG_ANDROID_PMEM*/
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700329
330static void __init reserve_pmem_memory(void)
331{
332#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700333#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700334 reserve_memory_for(&android_pmem_adsp_pdata);
335 reserve_memory_for(&android_pmem_pdata);
336 reserve_memory_for(&android_pmem_audio_pdata);
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700337#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700338 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
339#endif
340}
341
Larry Basselb4126da2011-07-18 14:31:33 -0700342static int msm8960_paddr_to_memtype(unsigned int paddr)
343{
344 return MEMTYPE_EBI1;
345}
346
Olav Hauganf6dc7742012-02-15 09:11:55 -0800347#define FMEM_ENABLED 1
348
Laura Abbottd6183792011-08-19 13:42:24 -0700349#ifdef CONFIG_ION_MSM
Olav Haugan0703dbf2011-12-19 17:53:38 -0800350#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -0700351static struct ion_cp_heap_pdata cp_mm_msm8960_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800352 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugan8726caf2012-05-10 15:11:35 -0700353 .align = SZ_64K,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800354 .reusable = FMEM_ENABLED,
355 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700356 .fixed_position = FIXED_MIDDLE,
Olav Haugan8726caf2012-05-10 15:11:35 -0700357 .iommu_map_all = 1,
358 .iommu_2x_map_domain = VIDEO_DOMAIN,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800359};
360
Laura Abbottb93525f2012-04-12 09:57:19 -0700361static struct ion_cp_heap_pdata cp_mfc_msm8960_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800362 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugan42ebe712012-01-10 16:30:58 -0800363 .align = PAGE_SIZE,
Olav Haugan65f4bd82011-12-13 11:50:08 -0800364 .reusable = 0,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800365 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700366 .fixed_position = FIXED_HIGH,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800367};
368
Laura Abbottb93525f2012-04-12 09:57:19 -0700369static struct ion_co_heap_pdata co_msm8960_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800370 .adjacent_mem_id = INVALID_HEAP_ID,
371 .align = PAGE_SIZE,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800372 .mem_is_fmem = 0,
Olav Haugan42ebe712012-01-10 16:30:58 -0800373};
374
Laura Abbottb93525f2012-04-12 09:57:19 -0700375static struct ion_co_heap_pdata fw_co_msm8960_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800376 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
377 .align = SZ_128K,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800378 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700379 .fixed_position = FIXED_LOW,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800380};
381#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800382
383/**
384 * These heaps are listed in the order they will be allocated. Due to
385 * video hardware restrictions and content protection the FW heap has to
386 * be allocated adjacent (below) the MM heap and the MFC heap has to be
387 * allocated after the MM heap to ensure MFC heap is not more than 256MB
388 * away from the base address of the FW heap.
389 * However, the order of FW heap and MM heap doesn't matter since these
390 * two heaps are taken care of by separate code to ensure they are adjacent
391 * to each other.
392 * Don't swap the order unless you know what you are doing!
393 */
Laura Abbottb93525f2012-04-12 09:57:19 -0700394static struct ion_platform_data msm8960_ion_pdata = {
Laura Abbott2d1760b2011-09-29 21:31:24 -0700395 .nr = MSM_ION_HEAP_NUM,
Laura Abbottd6183792011-08-19 13:42:24 -0700396 .heaps = {
397 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800398 .id = ION_SYSTEM_HEAP_ID,
Laura Abbottd6183792011-08-19 13:42:24 -0700399 .type = ION_HEAP_TYPE_SYSTEM,
Laura Abbottd6183792011-08-19 13:42:24 -0700400 .name = ION_VMALLOC_HEAP_NAME,
401 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700402#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -0700403 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800404 .id = ION_CP_MM_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800405 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800406 .name = ION_MM_HEAP_NAME,
407 .size = MSM_ION_MM_SIZE,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700408 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700409 .extra_data = (void *) &cp_mm_msm8960_ion_pdata,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700410 },
Laura Abbott8c017362011-09-22 20:59:12 -0700411 {
Olav Haugan42ebe712012-01-10 16:30:58 -0800412 .id = ION_MM_FIRMWARE_HEAP_ID,
413 .type = ION_HEAP_TYPE_CARVEOUT,
414 .name = ION_MM_FIRMWARE_HEAP_NAME,
415 .size = MSM_ION_MM_FW_SIZE,
416 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700417 .extra_data = (void *) &fw_co_msm8960_ion_pdata,
Olav Haugan42ebe712012-01-10 16:30:58 -0800418 },
419 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800420 .id = ION_CP_MFC_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800421 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800422 .name = ION_MFC_HEAP_NAME,
423 .size = MSM_ION_MFC_SIZE,
424 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700425 .extra_data = (void *) &cp_mfc_msm8960_ion_pdata,
Olav Hauganb5be7992011-11-18 14:29:02 -0800426 },
Olav Haugan32594552012-03-13 11:40:05 -0700427#ifndef CONFIG_MSM_IOMMU
Olav Hauganb5be7992011-11-18 14:29:02 -0800428 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800429 .id = ION_SF_HEAP_ID,
430 .type = ION_HEAP_TYPE_CARVEOUT,
431 .name = ION_SF_HEAP_NAME,
432 .size = MSM_ION_SF_SIZE,
433 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700434 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800435 },
Olav Haugan32594552012-03-13 11:40:05 -0700436#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800437 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800438 .id = ION_IOMMU_HEAP_ID,
Laura Abbott8c017362011-09-22 20:59:12 -0700439 .type = ION_HEAP_TYPE_IOMMU,
440 .name = ION_IOMMU_HEAP_NAME,
441 },
Olav Haugan80854eb2012-01-12 12:00:23 -0800442 {
443 .id = ION_QSECOM_HEAP_ID,
444 .type = ION_HEAP_TYPE_CARVEOUT,
445 .name = ION_QSECOM_HEAP_NAME,
446 .size = MSM_ION_QSECOM_SIZE,
447 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700448 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan80854eb2012-01-12 12:00:23 -0800449 },
Olav Haugan7355db02012-01-13 16:59:13 -0800450 {
451 .id = ION_AUDIO_HEAP_ID,
452 .type = ION_HEAP_TYPE_CARVEOUT,
453 .name = ION_AUDIO_HEAP_NAME,
454 .size = MSM_ION_AUDIO_SIZE,
455 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700456 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan7355db02012-01-13 16:59:13 -0800457 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700458#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700459 }
460};
461
Laura Abbottb93525f2012-04-12 09:57:19 -0700462static struct platform_device msm8960_ion_dev = {
Laura Abbottd6183792011-08-19 13:42:24 -0700463 .name = "ion-msm",
464 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700465 .dev = { .platform_data = &msm8960_ion_pdata },
Laura Abbottd6183792011-08-19 13:42:24 -0700466};
467#endif
468
Laura Abbottb93525f2012-04-12 09:57:19 -0700469struct platform_device msm8960_fmem_device = {
Larry Bassel41a055b2011-12-06 16:15:14 -0800470 .name = "fmem",
471 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700472 .dev = { .platform_data = &msm8960_fmem_pdata },
Larry Bassel41a055b2011-12-06 16:15:14 -0800473};
474
Olav Haugan65f4bd82011-12-13 11:50:08 -0800475static void __init adjust_mem_for_liquid(void)
Laura Abbottd6183792011-08-19 13:42:24 -0700476{
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800477 unsigned int i;
478
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800479 if (!pmem_param_set) {
480 if (machine_is_msm8960_liquid())
481 msm_ion_sf_size = MSM_LIQUID_ION_SF_SIZE;
482
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700483 if (msm8960_hdmi_as_primary_selected())
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800484 msm_ion_sf_size = MSM_HDMI_PRIM_ION_SF_SIZE;
485
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700486 if (machine_is_msm8960_liquid() ||
487 msm8960_hdmi_as_primary_selected()) {
Laura Abbottb93525f2012-04-12 09:57:19 -0700488 for (i = 0; i < msm8960_ion_pdata.nr; i++) {
489 if (msm8960_ion_pdata.heaps[i].id ==
490 ION_SF_HEAP_ID) {
491 msm8960_ion_pdata.heaps[i].size =
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800492 msm_ion_sf_size;
493 pr_debug("msm_ion_sf_size 0x%x\n",
494 msm_ion_sf_size);
495 break;
496 }
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800497 }
498 }
499 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800500}
501
502static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
503 unsigned long size)
504{
505 msm8960_reserve_table[mem_type].size += size;
506}
507
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700508static void __init msm8960_reserve_fixed_area(unsigned long fixed_area_size)
509{
510#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
511 int ret;
512
513 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
514 panic("fixed area size is larger than %dM\n",
515 MAX_FIXED_AREA_SIZE >> 20);
516
517 reserve_info->fixed_area_size = fixed_area_size;
518 reserve_info->fixed_area_start = MSM8960_FW_START;
519
520 ret = memblock_remove(reserve_info->fixed_area_start,
521 reserve_info->fixed_area_size);
522 BUG_ON(ret);
523#endif
524}
525
Olav Haugan65f4bd82011-12-13 11:50:08 -0800526/**
527 * Reserve memory for ION and calculate amount of reusable memory for fmem.
528 * We only reserve memory for heaps that are not reusable. However, we only
529 * support one reusable heap at the moment so we ignore the reusable flag for
530 * other than the first heap with reusable flag set. Also handle special case
Olav Hauganf6dc7742012-02-15 09:11:55 -0800531 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
532 * at a higher address than FW in addition to not more than 256MB away from the
533 * base address of the firmware. This means that if MM is reusable the other
534 * two heaps must be allocated in the same region as FW. This is handled by the
535 * mem_is_fmem flag in the platform data. In addition the MM heap must be
536 * adjacent to the FW heap for content protection purposes.
Olav Haugan65f4bd82011-12-13 11:50:08 -0800537 */
538static void __init reserve_ion_memory(void)
539{
540#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
541 unsigned int i;
542 unsigned int reusable_count = 0;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700543 unsigned int fixed_size = 0;
544 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
545 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800546
547 adjust_mem_for_liquid();
Laura Abbottb93525f2012-04-12 09:57:19 -0700548 msm8960_fmem_pdata.size = 0;
549 msm8960_fmem_pdata.reserved_size_low = 0;
550 msm8960_fmem_pdata.reserved_size_high = 0;
Olav Haugan8726caf2012-05-10 15:11:35 -0700551 msm8960_fmem_pdata.align = PAGE_SIZE;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700552 fixed_low_size = 0;
553 fixed_middle_size = 0;
554 fixed_high_size = 0;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800555
556 /* We only support 1 reusable heap. Check if more than one heap
557 * is specified as reusable and set as non-reusable if found.
558 */
Laura Abbottb93525f2012-04-12 09:57:19 -0700559 for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
560 const struct ion_platform_heap *heap =
561 &(msm8960_ion_pdata.heaps[i]);
Olav Haugan65f4bd82011-12-13 11:50:08 -0800562
563 if (heap->type == ION_HEAP_TYPE_CP && heap->extra_data) {
564 struct ion_cp_heap_pdata *data = heap->extra_data;
565
566 reusable_count += (data->reusable) ? 1 : 0;
567
568 if (data->reusable && reusable_count > 1) {
569 pr_err("%s: Too many heaps specified as "
570 "reusable. Heap %s was not configured "
571 "as reusable.\n", __func__, heap->name);
572 data->reusable = 0;
573 }
574 }
575 }
576
Laura Abbottb93525f2012-04-12 09:57:19 -0700577 for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
Olav Haugan8726caf2012-05-10 15:11:35 -0700578 struct ion_platform_heap *heap =
Laura Abbottb93525f2012-04-12 09:57:19 -0700579 &(msm8960_ion_pdata.heaps[i]);
Olav Haugan8726caf2012-05-10 15:11:35 -0700580 int align = SZ_4K;
581 int iommu_map_all = 0;
582 int adjacent_mem_id = INVALID_HEAP_ID;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800583
584 if (heap->extra_data) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700585 int fixed_position = NOT_FIXED;
586 int mem_is_fmem = 0;
587
Olav Haugan65f4bd82011-12-13 11:50:08 -0800588 switch (heap->type) {
589 case ION_HEAP_TYPE_CP:
Olav Hauganf6dc7742012-02-15 09:11:55 -0800590 mem_is_fmem = ((struct ion_cp_heap_pdata *)
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700591 heap->extra_data)->mem_is_fmem;
592 fixed_position = ((struct ion_cp_heap_pdata *)
593 heap->extra_data)->fixed_position;
Olav Haugan8726caf2012-05-10 15:11:35 -0700594 align = ((struct ion_cp_heap_pdata *)
595 heap->extra_data)->align;
596 iommu_map_all =
597 ((struct ion_cp_heap_pdata *)
598 heap->extra_data)->iommu_map_all;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800599 break;
600 case ION_HEAP_TYPE_CARVEOUT:
Olav Hauganf6dc7742012-02-15 09:11:55 -0800601 mem_is_fmem = ((struct ion_co_heap_pdata *)
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700602 heap->extra_data)->mem_is_fmem;
603 fixed_position = ((struct ion_co_heap_pdata *)
604 heap->extra_data)->fixed_position;
Olav Haugan8726caf2012-05-10 15:11:35 -0700605 adjacent_mem_id = ((struct ion_co_heap_pdata *)
606 heap->extra_data)->adjacent_mem_id;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700607 break;
608 default:
609 break;
610 }
611
Olav Haugan8726caf2012-05-10 15:11:35 -0700612 if (iommu_map_all) {
613 if (heap->size & (SZ_64K-1)) {
614 heap->size = ALIGN(heap->size, SZ_64K);
615 pr_info("Heap %s not aligned to 64K. Adjusting size to %x\n",
616 heap->name, heap->size);
617 }
618 }
619
620 if (mem_is_fmem && adjacent_mem_id != INVALID_HEAP_ID)
621 msm8960_fmem_pdata.align = align;
622
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700623 if (fixed_position != NOT_FIXED)
624 fixed_size += heap->size;
625 else
626 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
627
628 if (fixed_position == FIXED_LOW)
629 fixed_low_size += heap->size;
630 else if (fixed_position == FIXED_MIDDLE)
631 fixed_middle_size += heap->size;
632 else if (fixed_position == FIXED_HIGH)
633 fixed_high_size += heap->size;
634
635 if (mem_is_fmem)
Laura Abbottb93525f2012-04-12 09:57:19 -0700636 msm8960_fmem_pdata.size += heap->size;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700637 }
638 }
639
640 if (!fixed_size)
641 return;
642
Laura Abbottb93525f2012-04-12 09:57:19 -0700643 if (msm8960_fmem_pdata.size) {
644 msm8960_fmem_pdata.reserved_size_low = fixed_low_size;
645 msm8960_fmem_pdata.reserved_size_high = fixed_high_size;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700646 }
647
Larry Bassel4d4f4482012-04-04 11:26:09 -0700648 /* Since the fixed area may be carved out of lowmem,
649 * make sure the length is a multiple of 1M.
650 */
651 fixed_size = (fixed_size + MSM_MM_FW_SIZE + SECTION_SIZE - 1)
652 & SECTION_MASK;
653 msm8960_reserve_fixed_area(fixed_size);
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700654
655 fixed_low_start = MSM8960_FIXED_AREA_START;
656 fixed_middle_start = fixed_low_start + fixed_low_size;
657 fixed_high_start = fixed_middle_start + fixed_middle_size;
658
Laura Abbottb93525f2012-04-12 09:57:19 -0700659 for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
660 struct ion_platform_heap *heap = &(msm8960_ion_pdata.heaps[i]);
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700661
662 if (heap->extra_data) {
663 int fixed_position = NOT_FIXED;
664
665 switch (heap->type) {
666 case ION_HEAP_TYPE_CP:
667 fixed_position = ((struct ion_cp_heap_pdata *)
668 heap->extra_data)->fixed_position;
669 break;
670 case ION_HEAP_TYPE_CARVEOUT:
671 fixed_position = ((struct ion_co_heap_pdata *)
672 heap->extra_data)->fixed_position;
673 break;
674 default:
675 break;
676 }
677
678 switch (fixed_position) {
679 case FIXED_LOW:
680 heap->base = fixed_low_start;
681 break;
682 case FIXED_MIDDLE:
683 heap->base = fixed_middle_start;
684 break;
685 case FIXED_HIGH:
686 heap->base = fixed_high_start;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800687 break;
688 default:
689 break;
690 }
691 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800692 }
Laura Abbottd6183792011-08-19 13:42:24 -0700693#endif
694}
Huaibin Yanga5419422011-12-08 23:52:10 -0800695
696static void __init reserve_mdp_memory(void)
697{
698 msm8960_mdp_writeback(msm8960_reserve_table);
699}
700
Stephen Boyd668d7652012-04-25 11:31:01 -0700701static void __init reserve_cache_dump_memory(void)
Laura Abbott306bcc22012-03-08 11:24:53 -0800702{
703#ifdef CONFIG_MSM_CACHE_DUMP
704 unsigned int spare;
705 unsigned int l1_size;
Laura Abbott7b637362012-03-29 16:43:49 -0700706 unsigned int l2_size;
Laura Abbott306bcc22012-03-08 11:24:53 -0800707 unsigned int total;
708 int ret;
709
710 ret = scm_call(L1C_SERVICE_ID, L1C_BUFFER_GET_SIZE_COMMAND_ID, &spare,
711 sizeof(spare), &l1_size, sizeof(l1_size));
712
713 if (ret)
714 /* Fall back to something reasonable here */
715 l1_size = L1_BUFFER_SIZE;
716
Laura Abbott7b637362012-03-29 16:43:49 -0700717 ret = scm_call(L1C_SERVICE_ID, L2C_BUFFER_GET_SIZE_COMMAND_ID, &spare,
718 sizeof(spare), &l2_size, sizeof(l2_size));
719
720 if (ret)
721 /* Fall back to something reasonable here */
722 l2_size = L2_BUFFER_SIZE;
723
724 total = l1_size + l2_size;
Laura Abbott306bcc22012-03-08 11:24:53 -0800725
726 msm8960_reserve_table[MEMTYPE_EBI1].size += total;
Laura Abbottb93525f2012-04-12 09:57:19 -0700727 msm8960_cache_dump_pdata.l1_size = l1_size;
728 msm8960_cache_dump_pdata.l2_size = l2_size;
Laura Abbott306bcc22012-03-08 11:24:53 -0800729#endif
730}
731
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700732static void __init msm8960_calculate_reserve_sizes(void)
733{
734 size_pmem_devices();
735 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700736 reserve_ion_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800737 reserve_mdp_memory();
Laura Abbottf8c03b92012-02-16 14:57:58 -0800738 reserve_rtb_memory();
Laura Abbott306bcc22012-03-08 11:24:53 -0800739 reserve_cache_dump_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700740}
741
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700742static struct reserve_info msm8960_reserve_info __initdata = {
743 .memtype_reserve_table = msm8960_reserve_table,
744 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700745 .reserve_fixed_area = msm8960_reserve_fixed_area,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700746 .paddr_to_memtype = msm8960_paddr_to_memtype,
747};
748
Larry Basselb4126da2011-07-18 14:31:33 -0700749static int msm8960_memory_bank_size(void)
750{
751 return 1<<29;
752}
753
754static void __init locate_unstable_memory(void)
755{
756 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
757 unsigned long bank_size;
758 unsigned long low, high;
759
760 bank_size = msm8960_memory_bank_size();
Larry Bassel4d4f4482012-04-04 11:26:09 -0700761 msm8960_reserve_info.bank_size = bank_size;
762
Larry Basselb4126da2011-07-18 14:31:33 -0700763 low = meminfo.bank[0].start;
764 high = mb->start + mb->size;
Olav Haugan62052e42011-10-28 14:28:32 -0700765
766 /* Check if 32 bit overflow occured */
767 if (high < mb->start)
768 high = ~0UL;
769
Larry Bassel4d4f4482012-04-04 11:26:09 -0700770 if (high < MAX_FIXED_AREA_SIZE + MSM8960_FIXED_AREA_START)
771 panic("fixed area extends beyond end of memory\n");
772
Larry Basselb4126da2011-07-18 14:31:33 -0700773 low &= ~(bank_size - 1);
774
775 if (high - low <= bank_size)
Larry Bassel4d4f4482012-04-04 11:26:09 -0700776 goto no_dmm;
Larry Basselb8d61022012-02-24 10:49:45 -0800777
Larry Basselb8d61022012-02-24 10:49:45 -0800778#ifdef CONFIG_ENABLE_DMM
Jack Cheung60eaeab2012-01-09 16:40:26 -0800779 msm8960_reserve_info.low_unstable_address = mb->start -
780 MIN_MEMORY_BLOCK_SIZE + mb->size;
Jack Cheung0b1987e2011-11-18 13:36:29 -0800781 msm8960_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
Larry Basselb4126da2011-07-18 14:31:33 -0700782 pr_info("low unstable address %lx max size %lx bank size %lx\n",
783 msm8960_reserve_info.low_unstable_address,
784 msm8960_reserve_info.max_unstable_size,
785 msm8960_reserve_info.bank_size);
Larry Bassel4d4f4482012-04-04 11:26:09 -0700786 return;
Larry Basselb8d61022012-02-24 10:49:45 -0800787#endif
Larry Bassel4d4f4482012-04-04 11:26:09 -0700788no_dmm:
789 msm8960_reserve_info.low_unstable_address = high;
790 msm8960_reserve_info.max_unstable_size = 0;
Larry Basselb4126da2011-07-18 14:31:33 -0700791}
792
Larry Basselb830e182011-10-14 10:46:55 -0700793static void __init place_movable_zone(void)
794{
Larry Basselb8d61022012-02-24 10:49:45 -0800795#ifdef CONFIG_ENABLE_DMM
Larry Basselb830e182011-10-14 10:46:55 -0700796 movable_reserved_start = msm8960_reserve_info.low_unstable_address;
797 movable_reserved_size = msm8960_reserve_info.max_unstable_size;
798 pr_info("movable zone start %lx size %lx\n",
799 movable_reserved_start, movable_reserved_size);
Larry Basselb8d61022012-02-24 10:49:45 -0800800#endif
Larry Basselb830e182011-10-14 10:46:55 -0700801}
802
803static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700804{
805 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700806 locate_unstable_memory();
Larry Basselb830e182011-10-14 10:46:55 -0700807 place_movable_zone();
808}
809
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800810static char prim_panel_name[PANEL_NAME_MAX_LEN];
811static char ext_panel_name[PANEL_NAME_MAX_LEN];
812static int __init prim_display_setup(char *param)
813{
814 if (strnlen(param, PANEL_NAME_MAX_LEN))
815 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
816 return 0;
817}
818early_param("prim_display", prim_display_setup);
819
820static int __init ext_display_setup(char *param)
821{
822 if (strnlen(param, PANEL_NAME_MAX_LEN))
823 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
824 return 0;
825}
826early_param("ext_display", ext_display_setup);
827
Larry Basselb830e182011-10-14 10:46:55 -0700828static void __init msm8960_reserve(void)
829{
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800830 msm8960_set_display_params(prim_panel_name, ext_panel_name);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700831 msm_reserve();
Laura Abbottb93525f2012-04-12 09:57:19 -0700832 if (msm8960_fmem_pdata.size) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700833#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Larry Bassel861985f2012-05-02 15:54:52 -0700834 if (reserve_info->fixed_area_size) {
835 msm8960_fmem_pdata.phys =
836 reserve_info->fixed_area_start + MSM_MM_FW_SIZE;
837 pr_info("mm fw at %lx (fixed) size %x\n",
838 reserve_info->fixed_area_start, MSM_MM_FW_SIZE);
839 pr_info("fmem start %lx (fixed) size %lx\n",
840 msm8960_fmem_pdata.phys,
841 msm8960_fmem_pdata.size);
842 }
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700843#endif
844 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700845}
846
Larry Bassela4414b12011-08-04 11:11:02 -0700847static int msm8960_change_memory_power(u64 start, u64 size,
848 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700849{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -0700850 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -0700851}
852
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700853static void __init msm8960_allocate_memory_regions(void)
854{
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800855 msm8960_allocate_fb_region();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700856}
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800857
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700858#ifdef CONFIG_WCD9310_CODEC
859
860#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
861
Patrick Lai3043fba2011-08-01 14:15:57 -0700862/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
863 * 4 micbiases are used to power various analog and digital
864 * microphones operating at 1800 mV. Technically, all micbiases
865 * can source from single cfilter since all microphones operate
866 * at the same voltage level. The arrangement below is to make
867 * sure all cfilters are exercised. LDO_H regulator ouput level
868 * does not need to be as high as 2.85V. It is choosen for
869 * microphone sensitivity purpose.
870 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530871static struct wcd9xxx_pdata tabla_platform_data = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700872 .slimbus_slave_device = {
873 .name = "tabla-slave",
874 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
875 },
876 .irq = MSM_GPIO_TO_INT(62),
877 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530878 .num_irqs = NR_WCD9XXX_IRQS,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700879 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -0700880 .micbias = {
881 .ldoh_v = TABLA_LDOH_2P85_V,
882 .cfilt1_mv = 1800,
Joonwoo Parkcf473b42012-03-29 19:48:16 -0700883 .cfilt2_mv = 2700,
Patrick Lai3043fba2011-08-01 14:15:57 -0700884 .cfilt3_mv = 1800,
885 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
886 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
887 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
888 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530889 },
890 .regulator = {
891 {
892 .name = "CDC_VDD_CP",
893 .min_uV = 1800000,
894 .max_uV = 1800000,
895 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
896 },
897 {
898 .name = "CDC_VDDA_RX",
899 .min_uV = 1800000,
900 .max_uV = 1800000,
901 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
902 },
903 {
904 .name = "CDC_VDDA_TX",
905 .min_uV = 1800000,
906 .max_uV = 1800000,
907 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
908 },
909 {
910 .name = "VDDIO_CDC",
911 .min_uV = 1800000,
912 .max_uV = 1800000,
913 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
914 },
915 {
916 .name = "VDDD_CDC_D",
917 .min_uV = 1225000,
918 .max_uV = 1225000,
919 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
920 },
921 {
922 .name = "CDC_VDDA_A_1P2V",
923 .min_uV = 1225000,
924 .max_uV = 1225000,
925 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
926 },
927 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700928};
929
930static struct slim_device msm_slim_tabla = {
931 .name = "tabla-slim",
932 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
933 .dev = {
934 .platform_data = &tabla_platform_data,
935 },
936};
Santosh Mardi60e19d92011-10-28 01:15:14 +0530937
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530938static struct wcd9xxx_pdata tabla20_platform_data = {
Santosh Mardi60e19d92011-10-28 01:15:14 +0530939 .slimbus_slave_device = {
940 .name = "tabla-slave",
941 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
942 },
943 .irq = MSM_GPIO_TO_INT(62),
944 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530945 .num_irqs = NR_WCD9XXX_IRQS,
Santosh Mardi60e19d92011-10-28 01:15:14 +0530946 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
947 .micbias = {
948 .ldoh_v = TABLA_LDOH_2P85_V,
949 .cfilt1_mv = 1800,
Joonwoo Parkcf473b42012-03-29 19:48:16 -0700950 .cfilt2_mv = 2700,
Santosh Mardi60e19d92011-10-28 01:15:14 +0530951 .cfilt3_mv = 1800,
952 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
953 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
954 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
955 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530956 },
957 .regulator = {
958 {
959 .name = "CDC_VDD_CP",
960 .min_uV = 1800000,
961 .max_uV = 1800000,
962 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
963 },
964 {
965 .name = "CDC_VDDA_RX",
966 .min_uV = 1800000,
967 .max_uV = 1800000,
968 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
969 },
970 {
971 .name = "CDC_VDDA_TX",
972 .min_uV = 1800000,
973 .max_uV = 1800000,
974 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
975 },
976 {
977 .name = "VDDIO_CDC",
978 .min_uV = 1800000,
979 .max_uV = 1800000,
980 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
981 },
982 {
983 .name = "VDDD_CDC_D",
984 .min_uV = 1225000,
985 .max_uV = 1225000,
986 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
987 },
988 {
989 .name = "CDC_VDDA_A_1P2V",
990 .min_uV = 1225000,
991 .max_uV = 1225000,
992 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
993 },
994 },
Santosh Mardi60e19d92011-10-28 01:15:14 +0530995};
996
997static struct slim_device msm_slim_tabla20 = {
998 .name = "tabla2x-slim",
999 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
1000 .dev = {
1001 .platform_data = &tabla20_platform_data,
1002 },
1003};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001004#endif
1005
1006static struct slim_boardinfo msm_slim_devices[] = {
1007#ifdef CONFIG_WCD9310_CODEC
1008 {
1009 .bus_num = 1,
1010 .slim_slave = &msm_slim_tabla,
1011 },
Santosh Mardi60e19d92011-10-28 01:15:14 +05301012 {
1013 .bus_num = 1,
1014 .slim_slave = &msm_slim_tabla20,
1015 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001016#endif
1017 /* add more slimbus slaves as needed */
1018};
1019
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001020#define MSM_WCNSS_PHYS 0x03000000
1021#define MSM_WCNSS_SIZE 0x280000
1022
1023static struct resource resources_wcnss_wlan[] = {
1024 {
1025 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1026 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1027 .name = "wcnss_wlanrx_irq",
1028 .flags = IORESOURCE_IRQ,
1029 },
1030 {
1031 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1032 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1033 .name = "wcnss_wlantx_irq",
1034 .flags = IORESOURCE_IRQ,
1035 },
1036 {
1037 .start = MSM_WCNSS_PHYS,
1038 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1039 .name = "wcnss_mmio",
1040 .flags = IORESOURCE_MEM,
1041 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -07001042 {
1043 .start = 84,
1044 .end = 88,
1045 .name = "wcnss_gpios_5wire",
1046 .flags = IORESOURCE_IO,
1047 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001048};
1049
Ankur Nandwanib0039b02011-08-09 14:00:45 -07001050static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1051 .has_48mhz_xo = 1,
1052};
1053
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001054static struct platform_device msm_device_wcnss_wlan = {
1055 .name = "wcnss_wlan",
1056 .id = 0,
1057 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1058 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07001059 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001060};
1061
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001062#ifdef CONFIG_QSEECOM
1063/* qseecom bus scaling */
1064static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
1065 {
1066 .src = MSM_BUS_MASTER_SPS,
1067 .dst = MSM_BUS_SLAVE_EBI_CH0,
1068 .ib = 0,
1069 .ab = 0,
1070 },
1071 {
1072 .src = MSM_BUS_MASTER_SPDM,
1073 .dst = MSM_BUS_SLAVE_SPDM,
1074 .ib = 0,
1075 .ab = 0,
1076 },
1077};
1078
1079static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
1080 {
1081 .src = MSM_BUS_MASTER_SPS,
1082 .dst = MSM_BUS_SLAVE_EBI_CH0,
1083 .ib = (492 * 8) * 1000000UL,
1084 .ab = (492 * 8) * 100000UL,
1085 },
1086 {
1087 .src = MSM_BUS_MASTER_SPDM,
1088 .dst = MSM_BUS_SLAVE_SPDM,
1089 .ib = 0,
1090 .ab = 0,
1091 },
1092};
1093
1094static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1095 {
1096 .src = MSM_BUS_MASTER_SPS,
1097 .dst = MSM_BUS_SLAVE_EBI_CH0,
1098 .ib = 0,
1099 .ab = 0,
1100 },
1101 {
1102 .src = MSM_BUS_MASTER_SPDM,
1103 .dst = MSM_BUS_SLAVE_SPDM,
1104 .ib = (64 * 8) * 1000000UL,
1105 .ab = (64 * 8) * 100000UL,
1106 },
1107};
1108
1109static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1110 {
1111 ARRAY_SIZE(qseecom_clks_init_vectors),
1112 qseecom_clks_init_vectors,
1113 },
1114 {
1115 ARRAY_SIZE(qseecom_enable_dfab_vectors),
1116 qseecom_enable_sfpb_vectors,
1117 },
1118 {
1119 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1120 qseecom_enable_sfpb_vectors,
1121 },
1122};
1123
1124static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1125 qseecom_hw_bus_scale_usecases,
1126 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1127 .name = "qsee",
1128};
1129
1130static struct platform_device qseecom_device = {
1131 .name = "qseecom",
1132 .id = 0,
1133 .dev = {
1134 .platform_data = &qseecom_bus_pdata,
1135 },
1136};
1137#endif
1138
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001139#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1140 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1141 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1142 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1143
1144#define QCE_SIZE 0x10000
1145#define QCE_0_BASE 0x18500000
1146
1147#define QCE_HW_KEY_SUPPORT 0
1148#define QCE_SHA_HMAC_SUPPORT 1
1149#define QCE_SHARE_CE_RESOURCE 1
1150#define QCE_CE_SHARED 0
1151
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001152/* Begin Bus scaling definitions */
1153static struct msm_bus_vectors crypto_hw_init_vectors[] = {
1154 {
1155 .src = MSM_BUS_MASTER_ADM_PORT0,
1156 .dst = MSM_BUS_SLAVE_EBI_CH0,
1157 .ab = 0,
1158 .ib = 0,
1159 },
1160 {
1161 .src = MSM_BUS_MASTER_ADM_PORT1,
1162 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1163 .ab = 0,
1164 .ib = 0,
1165 },
1166};
1167
1168static struct msm_bus_vectors crypto_hw_active_vectors[] = {
1169 {
1170 .src = MSM_BUS_MASTER_ADM_PORT0,
1171 .dst = MSM_BUS_SLAVE_EBI_CH0,
1172 .ab = 70000000UL,
1173 .ib = 70000000UL,
1174 },
1175 {
1176 .src = MSM_BUS_MASTER_ADM_PORT1,
1177 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1178 .ab = 2480000000UL,
1179 .ib = 2480000000UL,
1180 },
1181};
1182
1183static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
1184 {
1185 ARRAY_SIZE(crypto_hw_init_vectors),
1186 crypto_hw_init_vectors,
1187 },
1188 {
1189 ARRAY_SIZE(crypto_hw_active_vectors),
1190 crypto_hw_active_vectors,
1191 },
1192};
1193
1194static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
1195 crypto_hw_bus_scale_usecases,
1196 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
1197 .name = "cryptohw",
1198};
1199/* End Bus Scaling Definitions*/
1200
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001201static struct resource qcrypto_resources[] = {
1202 [0] = {
1203 .start = QCE_0_BASE,
1204 .end = QCE_0_BASE + QCE_SIZE - 1,
1205 .flags = IORESOURCE_MEM,
1206 },
1207 [1] = {
1208 .name = "crypto_channels",
1209 .start = DMOV_CE_IN_CHAN,
1210 .end = DMOV_CE_OUT_CHAN,
1211 .flags = IORESOURCE_DMA,
1212 },
1213 [2] = {
1214 .name = "crypto_crci_in",
1215 .start = DMOV_CE_IN_CRCI,
1216 .end = DMOV_CE_IN_CRCI,
1217 .flags = IORESOURCE_DMA,
1218 },
1219 [3] = {
1220 .name = "crypto_crci_out",
1221 .start = DMOV_CE_OUT_CRCI,
1222 .end = DMOV_CE_OUT_CRCI,
1223 .flags = IORESOURCE_DMA,
1224 },
1225};
1226
1227static struct resource qcedev_resources[] = {
1228 [0] = {
1229 .start = QCE_0_BASE,
1230 .end = QCE_0_BASE + QCE_SIZE - 1,
1231 .flags = IORESOURCE_MEM,
1232 },
1233 [1] = {
1234 .name = "crypto_channels",
1235 .start = DMOV_CE_IN_CHAN,
1236 .end = DMOV_CE_OUT_CHAN,
1237 .flags = IORESOURCE_DMA,
1238 },
1239 [2] = {
1240 .name = "crypto_crci_in",
1241 .start = DMOV_CE_IN_CRCI,
1242 .end = DMOV_CE_IN_CRCI,
1243 .flags = IORESOURCE_DMA,
1244 },
1245 [3] = {
1246 .name = "crypto_crci_out",
1247 .start = DMOV_CE_OUT_CRCI,
1248 .end = DMOV_CE_OUT_CRCI,
1249 .flags = IORESOURCE_DMA,
1250 },
1251};
1252
1253#endif
1254
1255#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1256 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1257
1258static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1259 .ce_shared = QCE_CE_SHARED,
1260 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1261 .hw_key_support = QCE_HW_KEY_SUPPORT,
1262 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001263 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001264};
1265
1266static struct platform_device qcrypto_device = {
1267 .name = "qcrypto",
1268 .id = 0,
1269 .num_resources = ARRAY_SIZE(qcrypto_resources),
1270 .resource = qcrypto_resources,
1271 .dev = {
1272 .coherent_dma_mask = DMA_BIT_MASK(32),
1273 .platform_data = &qcrypto_ce_hw_suppport,
1274 },
1275};
1276#endif
1277
1278#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1279 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1280
1281static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1282 .ce_shared = QCE_CE_SHARED,
1283 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1284 .hw_key_support = QCE_HW_KEY_SUPPORT,
1285 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001286 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001287};
1288
1289static struct platform_device qcedev_device = {
1290 .name = "qce",
1291 .id = 0,
1292 .num_resources = ARRAY_SIZE(qcedev_resources),
1293 .resource = qcedev_resources,
1294 .dev = {
1295 .coherent_dma_mask = DMA_BIT_MASK(32),
1296 .platform_data = &qcedev_ce_hw_suppport,
1297 },
1298};
1299#endif
1300
Joel King0cbf5d82012-05-24 15:21:38 -07001301static struct mdm_platform_data sglte_platform_data = {
1302 .mdm_version = "4.0",
1303 .ramdump_delay_ms = 1000,
1304 .peripheral_platform_device = NULL,
Joel Kingb8352a12011-11-15 18:46:24 -08001305};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001306
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001307#define MSM_SHARED_RAM_PHYS 0x80000000
1308
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001309static void __init msm8960_map_io(void)
1310{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001311 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001312 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001313
1314 if (socinfo_init() < 0)
1315 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001316}
1317
1318static void __init msm8960_init_irq(void)
1319{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001320 struct msm_mpm_device_data *data = NULL;
1321
1322#ifdef CONFIG_MSM_MPM
1323 data = &msm8960_mpm_dev_data;
1324#endif
1325
1326 msm_mpm_irq_extn_init(data);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001327 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001328 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001329}
1330
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001331static void __init msm8960_init_buses(void)
1332{
1333#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -06001334 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -06001335 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
1336 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
1337 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
1338 msm_bus_apps_fabric.dev.platform_data =
1339 &msm_bus_8960_apps_fabric_pdata;
1340 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
1341 msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
1342 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
1343 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001344#endif
1345}
1346
1347static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
1348 .max_clock_speed = 15060000,
1349};
1350
1351#ifdef CONFIG_USB_MSM_OTG_72K
1352static struct msm_otg_platform_data msm_otg_pdata;
1353#else
Anji jonnalaa8b8d732011-12-06 10:03:24 +05301354static int wr_phy_init_seq[] = {
1355 0x44, 0x80, /* set VBUS valid threshold
1356 and disconnect valid threshold */
1357 0x38, 0x81, /* update DC voltage level */
1358 0x14, 0x82, /* set preemphasis and rise/fall time */
1359 0x13, 0x83, /* set source impedance adjusment */
1360 -1};
1361
1362static int liquid_v1_phy_init_seq[] = {
1363 0x44, 0x80,/* set VBUS valid threshold
1364 and disconnect valid threshold */
1365 0x3C, 0x81,/* update DC voltage level */
1366 0x18, 0x82,/* set preemphasis and rise/fall time */
1367 0x23, 0x83,/* set source impedance sdjusment */
1368 -1};
1369
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301370#ifdef CONFIG_MSM_BUS_SCALING
1371/* Bandwidth requests (zero) if no vote placed */
1372static struct msm_bus_vectors usb_init_vectors[] = {
1373 {
1374 .src = MSM_BUS_MASTER_SPS,
1375 .dst = MSM_BUS_SLAVE_EBI_CH0,
1376 .ab = 0,
1377 .ib = 0,
1378 },
1379};
1380
1381/* Bus bandwidth requests in Bytes/sec */
1382static struct msm_bus_vectors usb_max_vectors[] = {
1383 {
1384 .src = MSM_BUS_MASTER_SPS,
1385 .dst = MSM_BUS_SLAVE_EBI_CH0,
1386 .ab = 60000000, /* At least 480Mbps on bus. */
1387 .ib = 960000000, /* MAX bursts rate */
1388 },
1389};
1390
1391static struct msm_bus_paths usb_bus_scale_usecases[] = {
1392 {
1393 ARRAY_SIZE(usb_init_vectors),
1394 usb_init_vectors,
1395 },
1396 {
1397 ARRAY_SIZE(usb_max_vectors),
1398 usb_max_vectors,
1399 },
1400};
1401
1402static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
1403 usb_bus_scale_usecases,
1404 ARRAY_SIZE(usb_bus_scale_usecases),
1405 .name = "usb",
1406};
1407#endif
1408
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001409static struct msm_otg_platform_data msm_otg_pdata = {
1410 .mode = USB_OTG,
1411 .otg_control = OTG_PMIC_CONTROL,
1412 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001413 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
Anji jonnala4e3e6772011-09-15 18:53:42 +05301414 .power_budget = 750,
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301415#ifdef CONFIG_MSM_BUS_SCALING
1416 .bus_scale_table = &usb_bus_scale_pdata,
1417#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001418};
1419#endif
1420
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301421#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05301422#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301423static struct msm_hsic_host_platform_data msm_hsic_pdata = {
1424 .strobe = 150,
1425 .data = 151,
1426};
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301427
1428static struct smsc_hub_platform_data hsic_hub_pdata = {
1429 .hub_reset = HSIC_HUB_RESET_GPIO,
1430};
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301431#else
1432static struct msm_hsic_host_platform_data msm_hsic_pdata;
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301433static struct smsc_hub_platform_data hsic_hub_pdata;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301434#endif
1435
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301436static struct platform_device smsc_hub_device = {
1437 .name = "msm_smsc_hub",
1438 .id = -1,
1439 .dev = {
1440 .platform_data = &hsic_hub_pdata,
1441 },
1442};
1443
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001444#define PID_MAGIC_ID 0x71432909
1445#define SERIAL_NUM_MAGIC_ID 0x61945374
1446#define SERIAL_NUMBER_LENGTH 127
1447#define DLOAD_USB_BASE_ADD 0x2A03F0C8
1448
1449struct magic_num_struct {
1450 uint32_t pid;
1451 uint32_t serial_num;
1452};
1453
1454struct dload_struct {
1455 uint32_t reserved1;
1456 uint32_t reserved2;
1457 uint32_t reserved3;
1458 uint16_t reserved4;
1459 uint16_t pid;
1460 char serial_number[SERIAL_NUMBER_LENGTH];
1461 uint16_t reserved5;
1462 struct magic_num_struct magic_struct;
1463};
1464
1465static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
1466{
1467 struct dload_struct __iomem *dload = 0;
1468
1469 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
1470 if (!dload) {
1471 pr_err("%s: cannot remap I/O memory region: %08x\n",
1472 __func__, DLOAD_USB_BASE_ADD);
1473 return -ENXIO;
1474 }
1475
1476 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
1477 __func__, dload, pid, snum);
1478 /* update pid */
1479 dload->magic_struct.pid = PID_MAGIC_ID;
1480 dload->pid = pid;
1481
1482 /* update serial number */
1483 dload->magic_struct.serial_num = 0;
1484 if (!snum) {
1485 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
1486 goto out;
1487 }
1488
1489 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -07001490 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001491out:
1492 iounmap(dload);
1493 return 0;
1494}
1495
1496static struct android_usb_platform_data android_usb_pdata = {
1497 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1498};
1499
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001500static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001501 .name = "android_usb",
1502 .id = -1,
1503 .dev = {
1504 .platform_data = &android_usb_pdata,
1505 },
1506};
1507
1508static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1509 0x03, 0x0f,
1510};
1511
1512static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1513 0x00, 0x24, 0x54, 0x10,
1514 0x09, 0x03, 0x01,
1515 0x10, 0x54, 0x30, 0x0C,
1516 0x24, 0x30, 0x0f,
1517};
1518
1519static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1520 0x00, 0x24, 0x54, 0x10,
1521 0x09, 0x07, 0x01, 0x0B,
1522 0x10, 0x54, 0x30, 0x0C,
1523 0x24, 0x30, 0x0f,
1524};
1525
1526static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1527 [0] = {
1528 .mode = MSM_SPM_MODE_CLOCK_GATING,
1529 .notify_rpm = false,
1530 .cmd = spm_wfi_cmd_sequence,
1531 },
1532 [1] = {
1533 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1534 .notify_rpm = false,
1535 .cmd = spm_power_collapse_without_rpm,
1536 },
1537 [2] = {
1538 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1539 .notify_rpm = true,
1540 .cmd = spm_power_collapse_with_rpm,
1541 },
1542};
1543
1544static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1545 [0] = {
1546 .reg_base_addr = MSM_SAW0_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001547 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001548#if defined(CONFIG_MSM_AVS_HW)
1549 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1550 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1551#endif
1552 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001553 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001554 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1555 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1556 .vctl_timeout_us = 50,
1557 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1558 .modes = msm_spm_seq_list,
1559 },
1560 [1] = {
1561 .reg_base_addr = MSM_SAW1_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001562 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001563#if defined(CONFIG_MSM_AVS_HW)
1564 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1565 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1566#endif
1567 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001568 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001569 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1570 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1571 .vctl_timeout_us = 50,
1572 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1573 .modes = msm_spm_seq_list,
1574 },
1575};
1576
1577static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1578 0x00, 0x20, 0x03, 0x20,
1579 0x00, 0x0f,
1580};
1581
1582static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1583 0x00, 0x20, 0x34, 0x64,
1584 0x48, 0x07, 0x48, 0x20,
1585 0x50, 0x64, 0x04, 0x34,
1586 0x50, 0x0f,
1587};
1588static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1589 0x00, 0x10, 0x34, 0x64,
1590 0x48, 0x07, 0x48, 0x10,
1591 0x50, 0x64, 0x04, 0x34,
1592 0x50, 0x0F,
1593};
1594
1595static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1596 [0] = {
1597 .mode = MSM_SPM_L2_MODE_RETENTION,
1598 .notify_rpm = false,
1599 .cmd = l2_spm_wfi_cmd_sequence,
1600 },
1601 [1] = {
1602 .mode = MSM_SPM_L2_MODE_GDHS,
1603 .notify_rpm = true,
1604 .cmd = l2_spm_gdhs_cmd_sequence,
1605 },
1606 [2] = {
1607 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1608 .notify_rpm = true,
1609 .cmd = l2_spm_power_off_cmd_sequence,
1610 },
1611};
1612
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001613static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1614 [0] = {
1615 .reg_base_addr = MSM_SAW_L2_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001616 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001617 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001618 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1619 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1620 .modes = msm_spm_l2_seq_list,
1621 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1622 },
1623};
1624
Mohan Pallaka5e490392011-09-09 15:18:41 +05301625#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1626#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
1627
1628static struct msm_xo_voter *xo_handle_d1;
1629
1630static int isa1200_power(int on)
1631{
1632 int rc = 0;
1633
1634 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !!on);
1635
1636 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
1637 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
1638 if (rc < 0) {
1639 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
1640 __func__, on ? "" : "de-", rc);
1641 goto err_xo_vote;
1642 }
1643
1644 return 0;
1645
1646err_xo_vote:
1647 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !on);
1648 return rc;
1649}
1650
1651static int isa1200_dev_setup(bool enable)
1652{
1653 int rc = 0;
1654
1655 struct pm_gpio hap_gpio_config = {
1656 .direction = PM_GPIO_DIR_OUT,
1657 .pull = PM_GPIO_PULL_NO,
1658 .out_strength = PM_GPIO_STRENGTH_HIGH,
1659 .function = PM_GPIO_FUNC_NORMAL,
1660 .inv_int_pol = 0,
1661 .vin_sel = 2,
1662 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1663 .output_value = 0,
1664 };
1665
1666 if (enable == true) {
1667 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
1668 if (rc) {
1669 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1670 __func__, PM_HAP_EN_GPIO, rc);
1671 return rc;
1672 }
1673
1674 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
1675 if (rc) {
1676 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1677 __func__, PM_HAP_LEN_GPIO, rc);
1678 return rc;
1679 }
1680
1681 rc = gpio_request(HAP_SHIFT_LVL_OE_GPIO, "hap_shft_lvl_oe");
1682 if (rc) {
1683 pr_err("%s: unable to request gpio %d (%d)\n",
1684 __func__, HAP_SHIFT_LVL_OE_GPIO, rc);
1685 return rc;
1686 }
1687
1688 rc = gpio_direction_output(HAP_SHIFT_LVL_OE_GPIO, 0);
1689 if (rc) {
1690 pr_err("%s: Unable to set direction\n", __func__);
1691 goto free_gpio;
1692 }
1693
1694 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
1695 if (IS_ERR(xo_handle_d1)) {
1696 rc = PTR_ERR(xo_handle_d1);
1697 pr_err("%s: failed to get the handle for D1(%d)\n",
1698 __func__, rc);
1699 goto gpio_set_dir;
1700 }
1701 } else {
1702 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1703
1704 msm_xo_put(xo_handle_d1);
1705 }
1706
1707 return 0;
1708
1709gpio_set_dir:
1710 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, 0);
1711free_gpio:
1712 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1713 return rc;
1714}
1715
1716static struct isa1200_regulator isa1200_reg_data[] = {
1717 {
1718 .name = "vcc_i2c",
1719 .min_uV = ISA_I2C_VTG_MIN_UV,
1720 .max_uV = ISA_I2C_VTG_MAX_UV,
1721 .load_uA = ISA_I2C_CURR_UA,
1722 },
1723};
1724
1725static struct isa1200_platform_data isa1200_1_pdata = {
1726 .name = "vibrator",
1727 .dev_setup = isa1200_dev_setup,
1728 .power_on = isa1200_power,
1729 .hap_en_gpio = PM_HAP_EN_GPIO,
1730 .hap_len_gpio = PM_HAP_LEN_GPIO,
1731 .max_timeout = 15000,
1732 .mode_ctrl = PWM_GEN_MODE,
1733 .pwm_fd = {
1734 .pwm_div = 256,
1735 },
1736 .is_erm = false,
1737 .smart_en = true,
1738 .ext_clk_en = true,
1739 .chip_en = 1,
1740 .regulator_info = isa1200_reg_data,
1741 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1742};
1743
1744static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1745 {
1746 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
Mohan Pallaka5e490392011-09-09 15:18:41 +05301747 },
1748};
1749
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001750#define CYTTSP_TS_GPIO_IRQ 11
1751#define CYTTSP_TS_SLEEP_GPIO 50
1752#define CYTTSP_TS_RESOUT_N_GPIO 52
1753
1754/*virtual key support */
1755static ssize_t tma340_vkeys_show(struct kobject *kobj,
1756 struct kobj_attribute *attr, char *buf)
1757{
1758 return snprintf(buf, 200,
1759 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1760 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1761 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1762 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1763 "\n");
1764}
1765
1766static struct kobj_attribute tma340_vkeys_attr = {
1767 .attr = {
1768 .mode = S_IRUGO,
1769 },
1770 .show = &tma340_vkeys_show,
1771};
1772
1773static struct attribute *tma340_properties_attrs[] = {
1774 &tma340_vkeys_attr.attr,
1775 NULL
1776};
1777
1778static struct attribute_group tma340_properties_attr_group = {
1779 .attrs = tma340_properties_attrs,
1780};
1781
1782
1783static int cyttsp_platform_init(struct i2c_client *client)
1784{
1785 int rc = 0;
1786 static struct kobject *tma340_properties_kobj;
1787
1788 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1789 tma340_properties_kobj = kobject_create_and_add("board_properties",
1790 NULL);
1791 if (tma340_properties_kobj)
1792 rc = sysfs_create_group(tma340_properties_kobj,
1793 &tma340_properties_attr_group);
1794 if (!tma340_properties_kobj || rc)
1795 pr_err("%s: failed to create board_properties\n",
1796 __func__);
1797
1798 return 0;
1799}
1800
1801static struct cyttsp_regulator regulator_data[] = {
1802 {
1803 .name = "vdd",
1804 .min_uV = CY_TMA300_VTG_MIN_UV,
1805 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301806 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1807 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001808 },
1809 /* TODO: Remove after runtime PM is enabled in I2C driver */
1810 {
1811 .name = "vcc_i2c",
1812 .min_uV = CY_I2C_VTG_MIN_UV,
1813 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301814 .hpm_load_uA = CY_I2C_CURR_UA,
1815 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001816 },
1817};
1818
1819static struct cyttsp_platform_data cyttsp_pdata = {
1820 .panel_maxx = 634,
1821 .panel_maxy = 1166,
1822 .disp_maxx = 616,
1823 .disp_maxy = 1023,
1824 .disp_minx = 0,
1825 .disp_miny = 16,
1826 .flags = 0x01,
1827 .gen = CY_GEN3, /* or */
1828 .use_st = CY_USE_ST,
1829 .use_mt = CY_USE_MT,
1830 .use_hndshk = CY_SEND_HNDSHK,
1831 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05301832 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001833 .use_gestures = CY_USE_GESTURES,
1834 .fw_fname = "cyttsp_8960_cdp.hex",
1835 /* activate up to 4 groups
1836 * and set active distance
1837 */
1838 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
1839 CY_GEST_GRP3 | CY_GEST_GRP4 |
1840 CY_ACT_DIST,
1841 /* change act_intrvl to customize the Active power state
1842 * scanning/processing refresh interval for Operating mode
1843 */
1844 .act_intrvl = CY_ACT_INTRVL_DFLT,
1845 /* change tch_tmout to customize the touch timeout for the
1846 * Active power state for Operating mode
1847 */
1848 .tch_tmout = CY_TCH_TMOUT_DFLT,
1849 /* change lp_intrvl to customize the Low Power power state
1850 * scanning/processing refresh interval for Operating mode
1851 */
1852 .lp_intrvl = CY_LP_INTRVL_DFLT,
1853 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
1854 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
1855 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1856 .regulator_info = regulator_data,
1857 .num_regulators = ARRAY_SIZE(regulator_data),
1858 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05301859 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001860};
1861
1862static struct i2c_board_info cyttsp_info[] __initdata = {
1863 {
1864 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1865 .platform_data = &cyttsp_pdata,
1866#ifndef CY_USE_TIMER
1867 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1868#endif /* CY_USE_TIMER */
1869 },
1870};
1871
Jing Lindc4413c2012-01-16 15:22:52 -08001872/* configuration data for mxt1386 */
1873static const u8 mxt1386_config_data[] = {
Mohan Pallaka50837382011-09-07 11:00:57 +05301874 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001875 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301876 /* T38 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001877 11, 2, 0, 11, 11, 11, 0, 0, 0, 0,
Jing Lin2f863172011-10-17 10:56:58 -07001878 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1879 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1880 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1881 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1882 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1883 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301884 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001885 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05301886 /* T8 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001887 8, 0, 0, 0, 0, 0, 8, 14, 50, 215,
Mohan Pallaka50837382011-09-07 11:00:57 +05301888 /* T9 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001889 131, 0, 0, 26, 42, 0, 32, 63, 3, 5,
1890 0, 2, 1, 113, 10, 10, 8, 10, 255, 2,
1891 85, 5, 0, 0, 20, 20, 75, 25, 202, 29,
1892 10, 10, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05301893 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001894 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1895 0,
Anirudh Ghayaldab4e0d2012-01-09 14:59:27 +05301896 /* T18 Object */
1897 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301898 /* T22 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001899 5, 0, 0, 0, 0, 0, 0, 0, 30, 0,
1900 0, 0, 5, 8, 10, 13, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301901 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001902 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1903 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301904 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001905 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
1906 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301907 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001908 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301909 /* T28 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001910 0, 0, 0, 8, 12, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05301911 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001912 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301913 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001914 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301915 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001916 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301917};
1918
Jing Lin33b007d2011-12-21 17:40:23 -08001919/* configuration data for mxt1386e using V1.0 firmware */
1920static const u8 mxt1386e_config_data_v1_0[] = {
1921 /* T6 Object */
1922 0, 0, 0, 0, 0, 0,
1923 /* T38 Object */
1924 12, 1, 0, 17, 1, 12, 0, 0, 0, 0,
1925 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1926 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1927 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1928 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1929 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1930 0, 0, 0, 0,
1931 /* T7 Object */
1932 100, 16, 50,
1933 /* T8 Object */
1934 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
1935 /* T9 Object */
1936 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
1937 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
1938 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
1939 10, 5, 0, 0, 0,
1940 /* T18 Object */
1941 0, 0,
1942 /* T24 Object */
1943 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1944 0, 0, 0, 0, 0, 0, 0, 0, 0,
1945 /* T25 Object */
1946 3, 0, 60, 115, 156, 99,
1947 /* T27 Object */
1948 0, 0, 0, 0, 0, 0, 0,
1949 /* T40 Object */
1950 0, 0, 0, 0, 0,
1951 /* T42 Object */
1952 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
1953 /* T43 Object */
1954 0, 0, 0, 0, 0, 0, 0,
1955 /* T46 Object */
1956 64, 0, 20, 20, 0, 0, 0, 0, 0,
1957 /* T47 Object */
1958 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
1959 /* T48 Object */
1960 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
1961 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
1962 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
1963 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
1964 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1965 0, 0, 0, 0,
1966 /* T56 Object */
1967 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1968 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1969 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1970 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1971 2, 99, 33,
1972};
1973
1974/* configuration data for mxt1386e using V2.1 firmware */
1975static const u8 mxt1386e_config_data_v2_1[] = {
1976 /* T6 Object */
1977 0, 0, 0, 0, 0, 0,
1978 /* T38 Object */
1979 12, 2, 0, 17, 1, 12, 0, 0, 0, 0,
1980 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1981 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1982 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1983 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1984 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1985 0, 0, 0, 0,
1986 /* T7 Object */
1987 100, 16, 50,
1988 /* T8 Object */
1989 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
1990 /* T9 Object */
1991 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
1992 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
1993 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
1994 10, 5, 0, 0, 0,
1995 /* T18 Object */
1996 0, 0,
1997 /* T24 Object */
1998 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1999 0, 0, 0, 0, 0, 0, 0, 0, 0,
2000 /* T25 Object */
2001 3, 0, 60, 115, 156, 99,
2002 /* T27 Object */
2003 0, 0, 0, 0, 0, 0, 0,
2004 /* T40 Object */
2005 0, 0, 0, 0, 0,
2006 /* T42 Object */
2007 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
2008 /* T43 Object */
2009 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
2010 16,
2011 /* T46 Object */
2012 64, 0, 20, 20, 0, 0, 0, 0, 0,
2013 /* T47 Object */
2014 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2015 /* T48 Object */
2016 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
2017 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
2018 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
2019 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
2020 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2021 0, 0, 0, 0,
2022 /* T56 Object */
2023 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2024 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2025 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2026 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2027 2, 99, 33, 0, 149, 24, 193, 255, 255, 255,
2028 255,
2029};
2030
Jing Lineec88ca2012-02-08 11:18:30 -08002031/* configuration data for mxt1386e on 3D SKU using V2.1 firmware */
2032static const u8 mxt1386e_config_data_3d[] = {
2033 /* T6 Object */
2034 0, 0, 0, 0, 0, 0,
2035 /* T38 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002036 13, 1, 0, 23, 2, 12, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002037 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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2041 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2042 0, 0, 0, 0,
2043 /* T7 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002044 100, 10, 50,
Jing Lineec88ca2012-02-08 11:18:30 -08002045 /* T8 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002046 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002047 /* T9 Object */
2048 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
2049 0, 5, 5, 0, 10, 30, 10, 10, 175, 4,
Jing Lin66ba78b2012-02-24 21:25:12 -08002050 127, 7, 26, 21, 17, 19, 143, 35, 207, 40,
2051 20, 5, 54, 49, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002052 /* T18 Object */
2053 0, 0,
2054 /* T24 Object */
2055 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2056 0, 0, 0, 0, 0, 0, 0, 0, 0,
2057 /* T25 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002058 0, 0, 72, 113, 168, 97,
Jing Lineec88ca2012-02-08 11:18:30 -08002059 /* T27 Object */
2060 0, 0, 0, 0, 0, 0, 0,
2061 /* T40 Object */
2062 0, 0, 0, 0, 0,
2063 /* T42 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002064 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002065 /* T43 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002066 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2067 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002068 /* T46 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002069 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002070 /* T47 Object */
2071 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2072 /* T48 Object */
2073 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08002074 32, 50, 0, 10, 10, 0, 0, 100, 10, 90,
2075 0, 0, 0, 0, 0, 0, 0, 10, 1, 30,
2076 52, 10, 5, 0, 33, 0, 1, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002077 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2078 0, 0, 0, 0,
2079 /* T56 Object */
2080 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2081 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2082 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2083 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08002084 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2085 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002086};
2087
Amy Maloche08266db2011-11-04 11:07:16 -07002088#define MXT_TS_GPIO_IRQ 11
2089#define MXT_TS_LDO_EN_GPIO 50
2090#define MXT_TS_RESET_GPIO 52
Mohan Pallaka50837382011-09-07 11:00:57 +05302091
2092static void mxt_init_hw_liquid(void)
2093{
2094 int rc;
2095
Mohan Pallaka50837382011-09-07 11:00:57 +05302096 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
2097 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07002098 pr_err("%s: unable to request mxt_ldo_en_gpio [%d]\n",
2099 __func__, MXT_TS_LDO_EN_GPIO);
2100 return;
Mohan Pallaka50837382011-09-07 11:00:57 +05302101 }
2102
2103 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
2104 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07002105 pr_err("%s: unable to set_direction for mxt_ldo_en_gpio [%d]\n",
2106 __func__, MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05302107 goto err_ldo_gpio_req;
2108 }
2109
Mohan Pallaka50837382011-09-07 11:00:57 +05302110 return;
2111
Mohan Pallaka50837382011-09-07 11:00:57 +05302112err_ldo_gpio_req:
2113 gpio_free(MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05302114}
2115
Jing Lineec88ca2012-02-08 11:18:30 -08002116static struct mxt_config_info mxt_config_array_2d[] = {
Jing Lindc4413c2012-01-16 15:22:52 -08002117 {
2118 .config = mxt1386_config_data,
2119 .config_length = ARRAY_SIZE(mxt1386_config_data),
2120 .family_id = 0xA0,
2121 .variant_id = 0x0,
2122 .version = 0x10,
2123 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002124 .bootldr_id = MXT_BOOTLOADER_ID_1386,
Jing Lindc4413c2012-01-16 15:22:52 -08002125 },
Jing Lin33b007d2011-12-21 17:40:23 -08002126 {
2127 .config = mxt1386e_config_data_v1_0,
2128 .config_length = ARRAY_SIZE(mxt1386e_config_data_v1_0),
2129 .family_id = 0xA0,
2130 .variant_id = 0x2,
2131 .version = 0x10,
2132 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002133 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Linaeaeed52012-03-26 14:57:15 -07002134 .fw_name = "atmel_8960_liquid_v2_2_AA.hex",
Jing Lin33b007d2011-12-21 17:40:23 -08002135 },
2136 {
2137 .config = mxt1386e_config_data_v2_1,
2138 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
2139 .family_id = 0xA0,
2140 .variant_id = 0x7,
2141 .version = 0x21,
2142 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002143 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Linaeaeed52012-03-26 14:57:15 -07002144 .fw_name = "atmel_8960_liquid_v2_2_AA.hex",
2145 },
2146 {
2147 /* The config data for V2.2.AA is the same as for V2.1.AA */
2148 .config = mxt1386e_config_data_v2_1,
2149 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
2150 .family_id = 0xA0,
2151 .variant_id = 0x7,
2152 .version = 0x22,
2153 .build = 0xAA,
2154 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin33b007d2011-12-21 17:40:23 -08002155 },
Jing Lindc4413c2012-01-16 15:22:52 -08002156};
2157
Jing Lineec88ca2012-02-08 11:18:30 -08002158static struct mxt_platform_data mxt_platform_data_2d = {
2159 .config_array = mxt_config_array_2d,
2160 .config_array_size = ARRAY_SIZE(mxt_config_array_2d),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002161 .panel_minx = 0,
2162 .panel_maxx = 1365,
2163 .panel_miny = 0,
2164 .panel_maxy = 767,
2165 .disp_minx = 0,
2166 .disp_maxx = 1365,
2167 .disp_miny = 0,
2168 .disp_maxy = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05302169 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07002170 .i2c_pull_up = true,
Amy Maloche08266db2011-11-04 11:07:16 -07002171 .reset_gpio = MXT_TS_RESET_GPIO,
2172 .irq_gpio = MXT_TS_GPIO_IRQ,
Mohan Pallaka50837382011-09-07 11:00:57 +05302173};
2174
Jing Lineec88ca2012-02-08 11:18:30 -08002175static struct mxt_config_info mxt_config_array_3d[] = {
2176 {
2177 .config = mxt1386e_config_data_3d,
2178 .config_length = ARRAY_SIZE(mxt1386e_config_data_3d),
2179 .family_id = 0xA0,
2180 .variant_id = 0x7,
2181 .version = 0x21,
2182 .build = 0xAA,
2183 },
2184};
2185
2186static struct mxt_platform_data mxt_platform_data_3d = {
2187 .config_array = mxt_config_array_3d,
2188 .config_array_size = ARRAY_SIZE(mxt_config_array_3d),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002189 .panel_minx = 0,
2190 .panel_maxx = 1919,
2191 .panel_miny = 0,
2192 .panel_maxy = 1199,
2193 .disp_minx = 0,
2194 .disp_maxx = 1919,
2195 .disp_miny = 0,
2196 .disp_maxy = 1199,
Jing Lineec88ca2012-02-08 11:18:30 -08002197 .irqflags = IRQF_TRIGGER_FALLING,
2198 .i2c_pull_up = true,
2199 .reset_gpio = MXT_TS_RESET_GPIO,
2200 .irq_gpio = MXT_TS_GPIO_IRQ,
2201};
2202
Mohan Pallaka50837382011-09-07 11:00:57 +05302203static struct i2c_board_info mxt_device_info[] __initdata = {
2204 {
2205 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
Mohan Pallaka50837382011-09-07 11:00:57 +05302206 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
2207 },
2208};
2209
Manoj Rao14648742012-03-30 19:42:12 -07002210#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
2211static void mhl_sii_reset_gpio(int on)
2212{
2213 gpio_set_value(MHL_GPIO_RESET, on);
2214 return;
2215}
2216
2217/*
2218 * Request for GPIO allocations
2219 * Set appropriate GPIO directions
2220 */
2221static int mhl_sii_gpio_setup(int on)
2222{
2223 int ret;
2224
2225 if (on) {
2226 ret = gpio_request(MHL_GPIO_RESET, "W_RST#");
2227 if (ret < 0) {
2228 pr_err("GPIO RESET request failed: %d\n", ret);
2229 return -EBUSY;
2230 }
2231 ret = gpio_direction_output(MHL_GPIO_RESET, 1);
2232 if (ret < 0) {
2233 pr_err("SET GPIO RESET direction failed: %d\n", ret);
2234 gpio_free(MHL_GPIO_RESET);
2235 return -EBUSY;
2236 }
2237 ret = gpio_request(MHL_GPIO_INT, "W_INT");
2238 if (ret < 0) {
2239 pr_err("GPIO INT request failed: %d\n", ret);
2240 gpio_free(MHL_GPIO_RESET);
2241 return -EBUSY;
2242 }
2243 ret = gpio_direction_input(MHL_GPIO_INT);
2244 if (ret < 0) {
2245 pr_err("SET GPIO INTR direction failed: %d\n", ret);
2246 gpio_free(MHL_GPIO_RESET);
2247 gpio_free(MHL_GPIO_INT);
2248 return -EBUSY;
2249 }
2250 } else {
2251 gpio_free(MHL_GPIO_RESET);
2252 gpio_free(MHL_GPIO_INT);
2253 }
2254
2255 return 0;
2256}
2257
2258static struct msm_mhl_platform_data mhl_platform_data = {
2259 .irq = MSM_GPIO_TO_INT(4),
2260 .gpio_setup = mhl_sii_gpio_setup,
2261 .reset_pin = mhl_sii_reset_gpio,
2262};
2263#endif
2264
Eugene Yasmand2316b82011-12-07 18:23:48 +02002265static struct i2c_board_info sii_device_info[] __initdata = {
2266 {
Manoj Rao14648742012-03-30 19:42:12 -07002267#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
2268 /*
2269 * keeps SI 8334 as the default
2270 * MHL TX
2271 */
2272 I2C_BOARD_INFO("sii8334", 0x39),
2273 .platform_data = &mhl_platform_data,
2274#endif
2275#ifdef CONFIG_FB_MSM_HDMI_MHL_9244
Eugene Yasmand2316b82011-12-07 18:23:48 +02002276 I2C_BOARD_INFO("Sil-9244", 0x39),
Eugene Yasmand2316b82011-12-07 18:23:48 +02002277 .irq = MSM_GPIO_TO_INT(15),
Manoj Rao14648742012-03-30 19:42:12 -07002278#endif /* CONFIG_MSM_HDMI_MHL */
2279 .flags = I2C_CLIENT_WAKE,
Eugene Yasmand2316b82011-12-07 18:23:48 +02002280 },
2281};
2282
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002283static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
2284 .clk_freq = 100000,
2285 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002286};
2287
2288static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
2289 .clk_freq = 100000,
2290 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002291};
2292
2293static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
2294 .clk_freq = 100000,
2295 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002296};
2297
2298static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
2299 .clk_freq = 100000,
2300 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002301};
2302
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06002303static struct msm_pm_sleep_status_data msm_pm_slp_sts_data = {
2304 .base_addr = MSM_ACC0_BASE + 0x08,
2305 .cpu_offset = MSM_ACC1_BASE - MSM_ACC0_BASE,
2306 .mask = 1UL << 13,
2307};
2308
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002309static struct ks8851_pdata spi_eth_pdata = {
2310 .irq_gpio = KS8851_IRQ_GPIO,
2311 .rst_gpio = KS8851_RST_GPIO,
2312};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06002313
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002314static struct spi_board_info spi_board_info[] __initdata = {
2315 {
2316 .modalias = "ks8851",
2317 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2318 .max_speed_hz = 19200000,
2319 .bus_num = 0,
2320 .chip_select = 0,
2321 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002322 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002323 },
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07002324 {
2325 .modalias = "dsi_novatek_3d_panel_spi",
2326 .max_speed_hz = 10800000,
2327 .bus_num = 0,
2328 .chip_select = 1,
2329 .mode = SPI_MODE_0,
2330 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002331};
2332
2333static struct platform_device msm_device_saw_core0 = {
2334 .name = "saw-regulator",
2335 .id = 0,
2336 .dev = {
2337 .platform_data = &msm_saw_regulator_pdata_s5,
2338 },
2339};
2340
2341static struct platform_device msm_device_saw_core1 = {
2342 .name = "saw-regulator",
2343 .id = 1,
2344 .dev = {
2345 .platform_data = &msm_saw_regulator_pdata_s6,
2346 },
2347};
2348
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002349static struct tsens_platform_data msm_tsens_pdata = {
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002350 .slope = {910, 910, 910, 910, 910},
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002351 .tsens_factor = 1000,
2352 .hw_type = MSM_8960,
2353 .tsens_num_sensor = 5,
2354};
2355
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002356static struct platform_device msm_tsens_device = {
2357 .name = "tsens8960-tm",
2358 .id = -1,
2359};
2360
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002361#ifdef CONFIG_MSM_FAKE_BATTERY
2362static struct platform_device fish_battery_device = {
2363 .name = "fish_battery",
2364};
2365#endif
2366
David Collins26f05562011-06-20 09:56:28 -07002367static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002368 .name = GPIO_REGULATOR_DEV_NAME,
2369 .id = PM8921_MPP_PM_TO_SYS(7),
2370 .dev = {
2371 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2372 },
2373};
2374
David Collins26f05562011-06-20 09:56:28 -07002375static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002376 .name = GPIO_REGULATOR_DEV_NAME,
2377 .id = 91,
2378 .dev = {
2379 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2380 },
2381};
2382
David Collinsb10be1d2011-09-02 10:29:31 -07002383static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
2384 .name = GPIO_REGULATOR_DEV_NAME,
2385 .id = PM8921_GPIO_PM_TO_SYS(17),
2386 .dev = {
2387 .platform_data =
2388 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2389 },
2390};
2391
David Collins35a78f52011-12-14 15:54:25 -08002392static struct platform_device msm8960_device_ext_otg_sw_vreg __devinitdata = {
2393 .name = GPIO_REGULATOR_DEV_NAME,
2394 .id = PM8921_GPIO_PM_TO_SYS(42),
2395 .dev = {
2396 .platform_data =
2397 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_OTG_SW],
2398 },
2399};
2400
David Collins26f05562011-06-20 09:56:28 -07002401static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
2402 .name = "rpm-regulator",
2403 .id = -1,
2404 .dev = {
2405 .platform_data = &msm_rpm_regulator_pdata,
2406 },
2407};
Mayank Ranae009c922012-03-22 03:02:06 +05302408#ifdef CONFIG_SERIAL_MSM_HS
2409static int configure_uart_gpios(int on)
2410{
2411 int ret = 0, i;
2412 int uart_gpios[] = {93, 94, 95, 96};
2413
2414 for (i = 0; i < ARRAY_SIZE(uart_gpios); i++) {
2415 if (on) {
2416 ret = gpio_request(uart_gpios[i], NULL);
2417 if (ret) {
2418 pr_err("%s: unable to request uart gpio[%d]\n",
2419 __func__, uart_gpios[i]);
2420 break;
2421 }
2422 } else {
2423 gpio_free(uart_gpios[i]);
2424 }
2425 }
2426
2427 if (ret && on && i)
2428 for (; i >= 0; i--)
2429 gpio_free(uart_gpios[i]);
2430 return ret;
2431}
2432
2433static struct msm_serial_hs_platform_data msm_uart_dm9_pdata = {
Mayank Ranad85a5082012-04-29 17:24:13 -07002434 .gpio_config = configure_uart_gpios,
Mayank Ranae009c922012-03-22 03:02:06 +05302435};
2436#else
2437static struct msm_serial_hs_platform_data msm_uart_dm9_pdata;
2438#endif
David Collins26f05562011-06-20 09:56:28 -07002439
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002440static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07002441 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002442 &msm_device_smd,
Mayank Rana9f51f582011-08-04 18:35:59 +05302443 &msm_device_uart_dm6,
Mayank Ranae009c922012-03-22 03:02:06 +05302444 &msm_device_uart_dm9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002445 &msm_device_saw_core0,
2446 &msm_device_saw_core1,
2447 &msm8960_device_ext_5v_vreg,
David Collins87579612012-01-30 16:00:15 -08002448 &msm8960_device_ssbi_pmic,
David Collins96aa3e12012-02-29 10:31:34 -08002449 &msm8960_device_ext_otg_sw_vreg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002450 &msm8960_device_qup_spi_gsbi1,
2451 &msm8960_device_qup_i2c_gsbi3,
2452 &msm8960_device_qup_i2c_gsbi4,
2453 &msm8960_device_qup_i2c_gsbi10,
2454#ifndef CONFIG_MSM_DSPS
2455 &msm8960_device_qup_i2c_gsbi12,
2456#endif
2457 &msm_slim_ctrl,
2458 &msm_device_wcnss_wlan,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002459#if defined(CONFIG_QSEECOM)
2460 &qseecom_device,
2461#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002462#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2463 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2464 &qcrypto_device,
2465#endif
2466
2467#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2468 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2469 &qcedev_device,
2470#endif
2471#ifdef CONFIG_MSM_ROTATOR
2472 &msm_rotator_device,
2473#endif
2474 &msm_device_sps,
2475#ifdef CONFIG_MSM_FAKE_BATTERY
2476 &fish_battery_device,
2477#endif
Laura Abbottb93525f2012-04-12 09:57:19 -07002478 &msm8960_fmem_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002479#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07002480#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002481 &msm8960_android_pmem_device,
2482 &msm8960_android_pmem_adsp_device,
2483 &msm8960_android_pmem_audio_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002484#endif
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -07002485#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002486 &msm_device_vidc,
2487 &msm_device_bam_dmux,
2488 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07002489
Joel Nidera1261942011-09-12 16:30:09 +03002490#if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE)
2491#ifdef CONFIG_MSM_USE_TSIF1
2492 &msm_device_tsif[1],
2493#else
2494 &msm_device_tsif[0],
2495#endif
2496#endif
2497
Mona Hossain9c430e32011-07-27 11:04:47 -07002498#ifdef CONFIG_HW_RANDOM_MSM
2499 &msm_device_rng,
2500#endif
Laura Abbottd6183792011-08-19 13:42:24 -07002501#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002502 &msm8960_ion_dev,
Laura Abbottd6183792011-08-19 13:42:24 -07002503#endif
Praveen Chidambaram78499012011-11-01 17:15:17 -06002504 &msm8960_rpm_device,
2505 &msm8960_rpm_log_device,
2506 &msm8960_rpm_stat_device,
Mona Hossain11c03ac2011-10-26 12:42:10 -07002507 &msm_device_tz_log,
Pratik Patel7831c082011-06-08 21:44:37 -07002508#ifdef CONFIG_MSM_QDSS
Pratik Patel1403f2a2012-03-21 10:10:00 -07002509 &msm_qdss_device,
Pratik Patel7831c082011-06-08 21:44:37 -07002510 &msm_etb_device,
2511 &msm_tpiu_device,
2512 &msm_funnel_device,
Pratik Patel492b3012012-03-06 14:22:30 -08002513 &msm_etm_device,
Pratik Patel7831c082011-06-08 21:44:37 -07002514#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07002515 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002516 &msm8960_device_watchdog,
Laura Abbottb93525f2012-04-12 09:57:19 -07002517 &msm8960_rtb_device,
Praveen Chidambaram8ea3dcd2011-12-07 14:46:31 -07002518 &msm8960_cpu_idle_device,
Praveen Chidambaram5c8adf22012-02-23 18:44:37 -07002519 &msm8960_msm_gov_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002520 &msm8960_device_cache_erp,
Laura Abbottb93525f2012-04-12 09:57:19 -07002521 &msm8960_cache_dump_device,
Laura Abbott0577d7b2012-04-17 11:14:30 -07002522 &msm8960_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002523 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002524};
2525
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002526static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07002527 &msm8960_device_uart_gsbi5,
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002528 &msm8960_device_otg,
2529 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002530 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05302531 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002532 &android_usb_device,
2533 &msm_device_vidc,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002534 &msm_bus_apps_fabric,
2535 &msm_bus_sys_fabric,
2536 &msm_bus_mm_fabric,
2537 &msm_bus_sys_fpb,
2538 &msm_bus_cpss_fpb,
2539 &msm_pcm,
Kiran Kandi5e809b02012-01-31 00:24:33 -08002540 &msm_multi_ch_pcm,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002541 &msm_pcm_routing,
2542 &msm_cpudai0,
2543 &msm_cpudai1,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002544 &msm8960_cpudai_slimbus_2_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002545 &msm_cpudai_hdmi_rx,
2546 &msm_cpudai_bt_rx,
2547 &msm_cpudai_bt_tx,
2548 &msm_cpudai_fm_rx,
2549 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002550 &msm_cpudai_auxpcm_rx,
2551 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002552 &msm_cpu_fe,
2553 &msm_stub_codec,
2554 &msm_voice,
2555 &msm_voip,
2556 &msm_lpa_pcm,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05302557 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07002558 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07002559 &msm_cpudai_incall_record_rx,
2560 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002561
2562#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2563 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2564 &qcrypto_device,
2565#endif
2566
2567#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2568 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2569 &qcedev_device,
2570#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002571};
2572
2573static struct platform_device *rumi3_devices[] __initdata = {
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07002574 &msm8960_device_uart_gsbi5,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002575 &msm_kgsl_3d0,
2576 &msm_kgsl_2d0,
2577 &msm_kgsl_2d1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002578#ifdef CONFIG_MSM_GEMINI
2579 &msm8960_gemini_device,
2580#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002581};
2582
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002583static struct platform_device *cdp_devices[] __initdata = {
Stephen Boydeb819882011-08-29 14:46:30 -07002584 &msm_8960_q6_lpass,
2585 &msm_8960_q6_mss_fw,
2586 &msm_8960_q6_mss_sw,
Stephen Boyd322a9922011-09-20 01:05:54 -07002587 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07002588 &msm_pil_tzapps,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07002589 &msm_pil_dsps,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002590 &msm_pil_vidc,
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002591 &msm8960_device_otg,
2592 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002593 &msm_device_hsusb_host,
2594 &android_usb_device,
2595 &msm_pcm,
Kiran Kandi5e809b02012-01-31 00:24:33 -08002596 &msm_multi_ch_pcm,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002597 &msm_pcm_routing,
2598 &msm_cpudai0,
2599 &msm_cpudai1,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002600 &msm8960_cpudai_slimbus_2_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002601 &msm_cpudai_hdmi_rx,
2602 &msm_cpudai_bt_rx,
2603 &msm_cpudai_bt_tx,
2604 &msm_cpudai_fm_rx,
2605 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002606 &msm_cpudai_auxpcm_rx,
2607 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002608 &msm_cpu_fe,
2609 &msm_stub_codec,
2610 &msm_kgsl_3d0,
2611#ifdef CONFIG_MSM_KGSL_2D
2612 &msm_kgsl_2d0,
2613 &msm_kgsl_2d1,
2614#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002615#ifdef CONFIG_MSM_GEMINI
2616 &msm8960_gemini_device,
2617#endif
2618 &msm_voice,
2619 &msm_voip,
2620 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05302621 &msm_cpudai_afe_01_rx,
2622 &msm_cpudai_afe_01_tx,
2623 &msm_cpudai_afe_02_rx,
2624 &msm_cpudai_afe_02_tx,
2625 &msm_pcm_afe,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05302626 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07002627 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07002628 &msm_cpudai_incall_record_rx,
2629 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002630 &msm_pcm_hostless,
2631 &msm_bus_apps_fabric,
2632 &msm_bus_sys_fabric,
2633 &msm_bus_mm_fabric,
2634 &msm_bus_sys_fpb,
2635 &msm_bus_cpss_fpb,
2636};
2637
2638static void __init msm8960_i2c_init(void)
2639{
2640 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2641 &msm8960_i2c_qup_gsbi4_pdata;
2642
2643 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2644 &msm8960_i2c_qup_gsbi3_pdata;
2645
2646 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2647 &msm8960_i2c_qup_gsbi10_pdata;
2648
2649 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2650 &msm8960_i2c_qup_gsbi12_pdata;
2651}
2652
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002653static void __init msm8960_gfx_init(void)
2654{
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06002655 uint32_t soc_platform_version = socinfo_get_version();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002656 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
2657 struct kgsl_device_platform_data *kgsl_3d0_pdata =
2658 msm_kgsl_3d0.dev.platform_data;
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -06002659 kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
2660 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002661 }
2662}
2663
Subhash Jadavani933e6a62011-12-26 18:05:04 +05302664static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002665 {
2666 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2667 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2668 true,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002669 100, 650, 801, 200,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002670 },
2671
2672 {
2673 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2674 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2675 true,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002676 2000, 200, 576000, 2000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002677 },
2678
2679 {
2680 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2681 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2682 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002683 8500, 51, 1122000, 8500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002684 },
2685
2686 {
2687 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2688 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
2689 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002690 9000, 51, 1130300, 9000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002691 },
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06002692 {
2693 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2694 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2695 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002696 10000, 51, 1130300, 10000,
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06002697 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002698
2699 {
2700 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2701 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2702 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002703 12000, 14, 2205900, 12000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002704 },
2705
2706 {
2707 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2708 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2709 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002710 18000, 12, 2364250, 18000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002711 },
2712
2713 {
2714 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2715 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2716 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002717 23500, 10, 2667000, 23500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002718 },
2719
2720 {
2721 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2722 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2723 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002724 29700, 5, 2867000, 30000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002725 },
2726};
2727
Praveen Chidambaram78499012011-11-01 17:15:17 -06002728static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2729 .levels = &msm_rpmrs_levels[0],
2730 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2731 .vdd_mem_levels = {
2732 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2733 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2734 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2735 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2736 },
2737 .vdd_dig_levels = {
2738 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
2739 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
2740 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
2741 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
2742 },
2743 .vdd_mask = 0x7FFFFF,
2744 .rpmrs_target_id = {
2745 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2746 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
2747 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
2748 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
2749 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
2750 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
2751 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2752 },
2753};
2754
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002755static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2756 .mode = MSM_PM_BOOT_CONFIG_TZ,
2757};
2758
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002759#ifdef CONFIG_I2C
2760#define I2C_SURF 1
2761#define I2C_FFA (1 << 1)
2762#define I2C_RUMI (1 << 2)
2763#define I2C_SIM (1 << 3)
2764#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03002765#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002766
2767struct i2c_registry {
2768 u8 machs;
2769 int bus;
2770 struct i2c_board_info *info;
2771 int len;
2772};
2773
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002774/* Sensors DSPS platform data */
2775#ifdef CONFIG_MSM_DSPS
2776#define DSPS_PIL_GENERIC_NAME "dsps"
2777#endif /* CONFIG_MSM_DSPS */
2778
2779static void __init msm8960_init_dsps(void)
2780{
2781#ifdef CONFIG_MSM_DSPS
2782 struct msm_dsps_platform_data *pdata =
2783 msm_dsps_device.dev.platform_data;
2784 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
2785 pdata->gpios = NULL;
2786 pdata->gpios_num = 0;
2787
2788 platform_device_register(&msm_dsps_device);
2789#endif /* CONFIG_MSM_DSPS */
2790}
2791
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -08002792static int hsic_peripheral_status = 1;
2793static DEFINE_MUTEX(hsic_status_lock);
2794
2795void peripheral_connect()
2796{
2797 mutex_lock(&hsic_status_lock);
2798 if (hsic_peripheral_status)
2799 goto out;
2800 platform_device_add(&msm_device_hsic_host);
2801 hsic_peripheral_status = 1;
2802out:
2803 mutex_unlock(&hsic_status_lock);
2804}
2805EXPORT_SYMBOL(peripheral_connect);
2806
2807void peripheral_disconnect()
2808{
2809 mutex_lock(&hsic_status_lock);
2810 if (!hsic_peripheral_status)
2811 goto out;
2812 platform_device_del(&msm_device_hsic_host);
2813 hsic_peripheral_status = 0;
2814out:
2815 mutex_unlock(&hsic_status_lock);
2816}
2817EXPORT_SYMBOL(peripheral_disconnect);
2818
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05302819static void __init msm8960_init_smsc_hub(void)
2820{
2821 uint32_t version = socinfo_get_version();
2822
2823 if (SOCINFO_VERSION_MAJOR(version) == 1)
2824 return;
2825
2826 if (machine_is_msm8960_liquid())
2827 platform_device_register(&smsc_hub_device);
2828}
2829
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002830static void __init msm8960_init_hsic(void)
2831{
2832#ifdef CONFIG_USB_EHCI_MSM_HSIC
2833 uint32_t version = socinfo_get_version();
2834
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08002835 if (SOCINFO_VERSION_MAJOR(version) == 1)
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002836 return;
2837
Joel King0cbf5d82012-05-24 15:21:38 -07002838 if (machine_is_msm8960_liquid())
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08002839 platform_device_register(&msm_device_hsic_host);
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002840#endif
2841}
2842
Amir Samuelov5137e392011-09-21 17:31:25 +03002843#ifdef CONFIG_ISL9519_CHARGER
2844static struct isl_platform_data isl_data __initdata = {
2845 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
2846 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
2847 .max_system_voltage = 4200,
2848 .min_system_voltage = 3200,
Amir Samuelov95f49ff2012-01-29 09:14:08 +02002849 .chgcurrent = 1900,
2850 .term_current = 0,
Amir Samuelov5137e392011-09-21 17:31:25 +03002851 .input_current = 2048,
2852};
2853
2854static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
2855 {
2856 I2C_BOARD_INFO("isl9519q", 0x9),
2857 .irq = 0, /* Not required when notify-by-pmic */
2858 .platform_data = &isl_data,
2859 },
2860};
2861#endif /* CONFIG_ISL9519_CHARGER */
2862
Amir Samuelov755616d2011-12-13 16:34:46 +02002863static struct i2c_board_info liquid_io_expander_i2c_info[] __initdata = {
2864 {
2865 I2C_BOARD_INFO("sx1508q", 0x20),
2866 .platform_data = &msm8960_sx150x_data[SX150X_LIQUID]
2867 },
2868};
2869
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002870static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Amir Samuelov5137e392011-09-21 17:31:25 +03002871#ifdef CONFIG_ISL9519_CHARGER
2872 {
2873 I2C_LIQUID,
2874 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2875 isl_charger_i2c_info,
2876 ARRAY_SIZE(isl_charger_i2c_info),
2877 },
2878#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002879 {
2880 I2C_SURF | I2C_FFA | I2C_FLUID,
2881 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2882 cyttsp_info,
2883 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07002884 },
Mohan Pallaka50837382011-09-07 11:00:57 +05302885 {
2886 I2C_LIQUID,
2887 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2888 mxt_device_info,
2889 ARRAY_SIZE(mxt_device_info),
2890 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05302891 {
Manoj Rao14648742012-03-30 19:42:12 -07002892 I2C_SURF | I2C_FFA | I2C_LIQUID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302893 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Eugene Yasmand2316b82011-12-07 18:23:48 +02002894 sii_device_info,
2895 ARRAY_SIZE(sii_device_info),
2896 },
2897 {
2898 I2C_LIQUID,
2899 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302900 msm_isa1200_board_info,
2901 ARRAY_SIZE(msm_isa1200_board_info),
2902 },
Amir Samuelov755616d2011-12-13 16:34:46 +02002903 {
2904 I2C_LIQUID,
2905 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2906 liquid_io_expander_i2c_info,
2907 ARRAY_SIZE(liquid_io_expander_i2c_info),
2908 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002909};
2910#endif /* CONFIG_I2C */
2911
2912static void __init register_i2c_devices(void)
2913{
2914#ifdef CONFIG_I2C
2915 u8 mach_mask = 0;
2916 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08002917#ifdef CONFIG_MSM_CAMERA
2918 struct i2c_registry msm8960_camera_i2c_devices = {
2919 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
2920 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
2921 msm8960_camera_board_info.board_info,
2922 msm8960_camera_board_info.num_i2c_board_info,
2923 };
2924#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002925
2926 /* Build the matching 'supported_machs' bitmask */
2927 if (machine_is_msm8960_cdp())
2928 mach_mask = I2C_SURF;
2929 else if (machine_is_msm8960_rumi3())
2930 mach_mask = I2C_RUMI;
2931 else if (machine_is_msm8960_sim())
2932 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07002933 else if (machine_is_msm8960_fluid())
2934 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03002935 else if (machine_is_msm8960_liquid())
2936 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07002937 else if (machine_is_msm8960_mtp())
2938 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002939 else
2940 pr_err("unmatched machine ID in register_i2c_devices\n");
2941
Jing Lineec88ca2012-02-08 11:18:30 -08002942 if (machine_is_msm8960_liquid()) {
2943 if (SOCINFO_VERSION_MAJOR(socinfo_get_platform_version()) == 3)
2944 mxt_device_info[0].platform_data =
2945 &mxt_platform_data_3d;
2946 else
2947 mxt_device_info[0].platform_data =
2948 &mxt_platform_data_2d;
2949 }
2950
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002951 /* Run the array and install devices as appropriate */
2952 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
2953 if (msm8960_i2c_devices[i].machs & mach_mask)
2954 i2c_register_board_info(msm8960_i2c_devices[i].bus,
2955 msm8960_i2c_devices[i].info,
2956 msm8960_i2c_devices[i].len);
2957 }
Kevin Chan09f4e662011-12-16 08:17:02 -08002958#ifdef CONFIG_MSM_CAMERA
2959 if (msm8960_camera_i2c_devices.machs & mach_mask)
2960 i2c_register_board_info(msm8960_camera_i2c_devices.bus,
2961 msm8960_camera_i2c_devices.info,
2962 msm8960_camera_i2c_devices.len);
2963#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002964#endif
2965}
2966
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002967static void __init msm8960_sim_init(void)
2968{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002969 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
2970 &msm8960_device_watchdog.dev.platform_data;
2971
2972 wdog_pdata->bark_time = 15000;
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08002973 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002974 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
2975 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002976 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07002977 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002978 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002979 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002980
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002981 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002982 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002983 msm8960_i2c_init();
2984 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2985 msm_spm_l2_init(msm_spm_l2_data);
2986 msm8960_init_buses();
2987 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002988 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002989 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07002990 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002991
2992 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2993 &msm8960_qup_spi_gsbi1_pdata;
2994 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2995
2996 msm8960_init_mmc();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002997 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002998 slim_register_board_info(msm_slim_devices,
2999 ARRAY_SIZE(msm_slim_devices));
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06003000 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06003001 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003002}
3003
3004static void __init msm8960_rumi3_init(void)
3005{
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08003006 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06003007 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
3008 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003009 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07003010 platform_device_register(&msm8960_device_rpm_regulator);
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08003011 msm8960_init_gpiomux();
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003012 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003013 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3014 &msm8960_qup_spi_gsbi1_pdata;
3015 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
3016 msm8960_i2c_init();
3017 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3018 msm_spm_l2_init(msm_spm_l2_data);
3019 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003020 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003021 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003022 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003023 register_i2c_devices();
Mayank Ranae009c922012-03-22 03:02:06 +05303024
Mayank Ranae009c922012-03-22 03:02:06 +05303025
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08003026 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003027 slim_register_board_info(msm_slim_devices,
3028 ARRAY_SIZE(msm_slim_devices));
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06003029 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06003030 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003031}
3032
3033static void __init msm8960_cdp_init(void)
3034{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07003035 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
3036 pr_err("meminfo_init() failed!\n");
3037
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08003038 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06003039 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
3040 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07003041
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003042 regulator_suppress_info_printing();
3043 if (msm_xo_init())
3044 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07003045 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07003046 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05303047 if (machine_is_msm8960_liquid())
3048 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003049 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05303050 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
3051 machine_is_msm8960_cdp()) {
3052 msm_otg_pdata.phy_init_seq = wr_phy_init_seq;
3053 } else if (machine_is_msm8960_liquid()) {
3054 msm_otg_pdata.phy_init_seq =
3055 liquid_v1_phy_init_seq;
3056 }
Ofir Cohen94213a72012-05-03 14:26:32 +03003057 android_usb_pdata.swfi_latency =
Anji jonnalaa7c1c5c2011-12-12 12:20:36 +05303058 msm_rpmrs_levels[0].latency_us;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303059 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303060 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2 &&
3061 machine_is_msm8960_liquid())
3062 msm_device_hsic_host.dev.parent = &smsc_hub_device.dev;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08003063 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003064 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3065 &msm8960_qup_spi_gsbi1_pdata;
3066 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003067
3068 msm8960_init_pmic();
Mohan Pallakaf69f0492011-11-21 13:08:33 +05303069 if ((SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2 &&
3070 (machine_is_msm8960_mtp())) || machine_is_msm8960_liquid())
3071 msm_isa1200_board_info[0].platform_data = &isa1200_1_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003072 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003073 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003074 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3075 msm_spm_l2_init(msm_spm_l2_data);
3076 msm8960_init_buses();
Matt Wagantall1f65d9d2012-04-25 14:24:20 -07003077 platform_add_devices(msm8960_footswitch, msm8960_num_footswitch);
David Collinsb10be1d2011-09-02 10:29:31 -07003078 if (machine_is_msm8960_liquid())
3079 platform_device_register(&msm8960_device_ext_3p3v_vreg);
David Collinsd5a40732011-11-29 15:53:56 -08003080 if (machine_is_msm8960_cdp())
3081 platform_device_register(&msm8960_device_ext_l2_vreg);
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07003082
3083 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
3084 platform_device_register(&msm8960_device_uart_gsbi8);
3085 else
3086 platform_device_register(&msm8960_device_uart_gsbi5);
3087
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003088 /* For 8960 Fusion 2.2 Primary IPC */
Mayank Ranad85a5082012-04-29 17:24:13 -07003089 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE) {
3090 msm_uart_dm9_pdata.wakeup_irq = gpio_to_irq(94); /* GSBI9(2) */
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003091 msm_device_uart_dm9.dev.platform_data = &msm_uart_dm9_pdata;
Mayank Ranad85a5082012-04-29 17:24:13 -07003092 }
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003093
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003094 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003095 msm8960_pm8921_gpio_mpp_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003096 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303097 msm8960_init_smsc_hub();
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003098 msm8960_init_hsic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003099 msm8960_init_cam();
3100 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07003101 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05303102 if (machine_is_msm8960_liquid())
3103 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003104 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08003105 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003106 slim_register_board_info(msm_slim_devices,
3107 ARRAY_SIZE(msm_slim_devices));
3108 msm8960_init_dsps();
Larry Bassela7eadea2011-07-14 10:46:00 -07003109 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06003110 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06003111 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Joel King0cbf5d82012-05-24 15:21:38 -07003112 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE) {
3113 mdm_sglte_device.dev.platform_data = &sglte_platform_data;
3114 platform_device_register(&mdm_sglte_device);
3115 }
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003116}
3117
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003118MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
3119 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003120 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003121 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303122 .handle_irq = gic_handle_irq,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003123 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003124 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003125 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003126 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003127MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003128
3129MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
3130 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003131 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003132 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303133 .handle_irq = gic_handle_irq,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003134 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003135 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003136 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003137 .init_very_early = msm8960_early_memory,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003138MACHINE_END
3139
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003140MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
3141 .map_io = msm8960_map_io,
3142 .reserve = msm8960_reserve,
3143 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303144 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003145 .timer = &msm_timer,
3146 .init_machine = msm8960_cdp_init,
3147 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003148 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003149MACHINE_END
3150
3151MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
3152 .map_io = msm8960_map_io,
3153 .reserve = msm8960_reserve,
3154 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303155 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003156 .timer = &msm_timer,
3157 .init_machine = msm8960_cdp_init,
3158 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003159 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003160MACHINE_END
3161
3162MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
3163 .map_io = msm8960_map_io,
3164 .reserve = msm8960_reserve,
3165 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303166 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003167 .timer = &msm_timer,
3168 .init_machine = msm8960_cdp_init,
3169 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003170 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003171MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003172
3173MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
3174 .map_io = msm8960_map_io,
3175 .reserve = msm8960_reserve,
3176 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303177 .handle_irq = gic_handle_irq,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003178 .timer = &msm_timer,
3179 .init_machine = msm8960_cdp_init,
3180 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003181 .init_very_early = msm8960_early_memory,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003182MACHINE_END