blob: d7ad09f1a3a415e7e5fc4aea3dac4b068fbccc36 [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>
Joel Nider266a2642011-10-16 10:58:05 +020053#include <mach/msm_tspp.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080054#include <mach/msm_iomap.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070055#include <mach/msm_spi.h>
Mayank Ranae009c922012-03-22 03:02:06 +053056#include <mach/msm_serial_hs.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070057#ifdef CONFIG_USB_MSM_OTG_72K
58#include <mach/msm_hsusb.h>
59#else
60#include <linux/usb/msm_hsusb.h>
61#endif
62#include <linux/usb/android.h>
63#include <mach/usbdiag.h>
64#include <mach/socinfo.h>
65#include <mach/rpm.h>
66#include <mach/gpio.h>
Rohit Vaswania513aa8d2011-07-18 15:14:28 -070067#include <mach/gpiomux.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070068#include <mach/msm_bus_board.h>
69#include <mach/msm_memtypes.h>
70#include <mach/dma.h>
71#include <mach/msm_dsps.h>
72#include <mach/msm_xo.h>
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -070073#include <mach/restart.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080074
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070075#ifdef CONFIG_WCD9310_CODEC
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +053076#include <linux/mfd/wcd9xxx/core.h>
77#include <linux/mfd/wcd9xxx/pdata.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070078#endif
79
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +053080#include <linux/smsc3503.h>
Laura Abbottd6183792011-08-19 13:42:24 -070081#include <linux/ion.h>
82#include <mach/ion.h>
Joel Kingb8352a12011-11-15 18:46:24 -080083#include <mach/mdm2.h>
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -080084#include <mach/mdm-peripheral.h>
Laura Abbottf8c03b92012-02-16 14:57:58 -080085#include <mach/msm_rtb.h>
Laura Abbott306bcc22012-03-08 11:24:53 -080086#include <mach/msm_cache_dump.h>
87#include <mach/scm.h>
Olav Haugan8726caf2012-05-10 15:11:35 -070088#include <mach/iommu_domains.h>
Laura Abbottd6183792011-08-19 13:42:24 -070089
Larry Bassel41a055b2011-12-06 16:15:14 -080090#include <linux/fmem.h>
91
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070092#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080093#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070094#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070095#include "spm.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080096#include "board-8960.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080097#include "pm.h"
Abhijeet Dharmapurikarefaca4f2011-12-27 16:24:07 -080098#include <mach/cpuidle.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070099#include "rpm_resources.h"
Subhash Jadavani909e04f2012-04-12 10:52:50 +0530100#include <mach/mpm.h>
Matt Wagantall6d9ebee2011-08-26 12:15:24 -0700101#include "acpuclock.h"
Naveen Ramaraj76483ad2011-09-06 14:25:44 -0700102#include "smd_private.h"
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -0600103#include "pm-boot.h"
Jeff Ohlstein7e668552011-10-06 16:17:25 -0700104#include "msm_watchdog.h"
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800105
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700106static struct platform_device msm_fm_platform_init = {
107 .name = "iris_fm",
108 .id = -1,
109};
110
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700111#define KS8851_RST_GPIO 89
112#define KS8851_IRQ_GPIO 90
Mohan Pallaka5e490392011-09-09 15:18:41 +0530113#define HAP_SHIFT_LVL_OE_GPIO 47
114
Manoj Rao14648742012-03-30 19:42:12 -0700115#define MHL_GPIO_INT 4
116#define MHL_GPIO_RESET 15
117
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700118#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700119
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800120struct sx150x_platform_data msm8960_sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700121 [SX150X_CAM] = {
122 .gpio_base = GPIO_CAM_EXPANDER_BASE,
123 .oscio_is_gpo = false,
124 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530125 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700126 .io_open_drain_ena = 0x0,
127 .irq_summary = -1,
128 },
Amir Samuelov755616d2011-12-13 16:34:46 +0200129 [SX150X_LIQUID] = {
130 .gpio_base = GPIO_LIQUID_EXPANDER_BASE,
131 .oscio_is_gpo = false,
132 .io_pullup_ena = 0x0c08,
133 .io_pulldn_ena = 0x4060,
134 .io_open_drain_ena = 0x000c,
135 .io_polarity = 0,
136 .irq_summary = -1,
137 },
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700138};
Nishant Pandit474f2252011-07-23 23:17:56 +0530139
140#endif
141
Olav Haugana21169d2012-01-04 09:17:06 -0800142#define MSM_PMEM_ADSP_SIZE 0x7800000
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -0700143#define MSM_PMEM_AUDIO_SIZE 0x4CF000
Mathew Karimpanal15fa5c42011-12-14 21:28:10 -0800144#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800145#define MSM_LIQUID_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800146#define MSM_HDMI_PRIM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Laura Abbott2d1760b2011-09-29 21:31:24 -0700147
148#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Deepak Kotur35825522012-06-06 15:49:14 -0700149#define HOLE_SIZE 0x20000
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -0700150#define MSM_PMEM_KERNEL_EBI1_SIZE 0x65000
Olav Haugan32594552012-03-13 11:40:05 -0700151#ifdef CONFIG_MSM_IOMMU
Olav Haugan8726caf2012-05-10 15:11:35 -0700152#define MSM_ION_MM_SIZE 0x3800000 /* Need to be multiple of 64K */
Olav Haugan32594552012-03-13 11:40:05 -0700153#define MSM_ION_SF_SIZE 0x0
Olav Hauganfbbf05b2012-04-05 14:33:41 -0700154#define MSM_ION_QSECOM_SIZE 0x780000 /* (7.5MB) */
Olav Haugan32594552012-03-13 11:40:05 -0700155#define MSM_ION_HEAP_NUM 7
156#else
157#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
158#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Hauganfbbf05b2012-04-05 14:33:41 -0700159#define MSM_ION_QSECOM_SIZE 0x600000 /* (6MB) */
Olav Haugan32594552012-03-13 11:40:05 -0700160#define MSM_ION_HEAP_NUM 8
161#endif
Deepak Kotur35825522012-06-06 15:49:14 -0700162#define MSM_ION_MM_FW_SIZE (0x200000 - HOLE_SIZE) /* 128kb */
Olav Hauganb5be7992011-11-18 14:29:02 -0800163#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan7355db02012-01-13 16:59:13 -0800164#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Olav Haugan32594552012-03-13 11:40:05 -0700165
Olav Hauganb5be7992011-11-18 14:29:02 -0800166#define MSM_LIQUID_ION_MM_SIZE (MSM_ION_MM_SIZE + 0x600000)
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800167#define MSM_LIQUID_ION_SF_SIZE MSM_LIQUID_PMEM_SIZE
168#define MSM_HDMI_PRIM_ION_SF_SIZE MSM_HDMI_PRIM_PMEM_SIZE
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700169
Deepak Kotur35825522012-06-06 15:49:14 -0700170#define MSM_MM_FW_SIZE (0x200000 - HOLE_SIZE) /* 2mb -128kb*/
171#define MSM8960_FIXED_AREA_START (0xa0000000 - (MSM_ION_MM_FW_SIZE + \
172 HOLE_SIZE))
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700173#define MAX_FIXED_AREA_SIZE 0x10000000
Deepak Kotur35825522012-06-06 15:49:14 -0700174#define MSM8960_FW_START MSM8960_FIXED_AREA_START
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700175
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800176static unsigned msm_ion_sf_size = MSM_ION_SF_SIZE;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700177#else
Laura Abbott6db11c92011-11-04 10:31:43 -0700178#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
Olav Hauganb5be7992011-11-18 14:29:02 -0800179#define MSM_ION_HEAP_NUM 1
Laura Abbott2d1760b2011-09-29 21:31:24 -0700180#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700181
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700182#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
183static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
184static int __init pmem_kernel_ebi1_size_setup(char *p)
185{
186 pmem_kernel_ebi1_size = memparse(p, NULL);
187 return 0;
188}
189early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
190#endif
191
192#ifdef CONFIG_ANDROID_PMEM
193static unsigned pmem_size = MSM_PMEM_SIZE;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800194static unsigned pmem_param_set;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700195static int __init pmem_size_setup(char *p)
196{
197 pmem_size = memparse(p, NULL);
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800198 pmem_param_set = 1;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700199 return 0;
200}
201early_param("pmem_size", pmem_size_setup);
202
203static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
204
205static int __init pmem_adsp_size_setup(char *p)
206{
207 pmem_adsp_size = memparse(p, NULL);
208 return 0;
209}
210early_param("pmem_adsp_size", pmem_adsp_size_setup);
211
212static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
213
214static int __init pmem_audio_size_setup(char *p)
215{
216 pmem_audio_size = memparse(p, NULL);
217 return 0;
218}
219early_param("pmem_audio_size", pmem_audio_size_setup);
220#endif
221
222#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700223#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700224static struct android_pmem_platform_data android_pmem_pdata = {
225 .name = "pmem",
226 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
227 .cached = 1,
228 .memory_type = MEMTYPE_EBI1,
229};
230
Laura Abbottb93525f2012-04-12 09:57:19 -0700231static struct platform_device msm8960_android_pmem_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700232 .name = "android_pmem",
233 .id = 0,
234 .dev = {.platform_data = &android_pmem_pdata},
235};
236
237static struct android_pmem_platform_data android_pmem_adsp_pdata = {
238 .name = "pmem_adsp",
239 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
240 .cached = 0,
241 .memory_type = MEMTYPE_EBI1,
242};
Laura Abbottb93525f2012-04-12 09:57:19 -0700243static struct platform_device msm8960_android_pmem_adsp_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700244 .name = "android_pmem",
245 .id = 2,
246 .dev = { .platform_data = &android_pmem_adsp_pdata },
247};
248
249static struct android_pmem_platform_data android_pmem_audio_pdata = {
250 .name = "pmem_audio",
251 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
252 .cached = 0,
253 .memory_type = MEMTYPE_EBI1,
254};
255
Laura Abbottb93525f2012-04-12 09:57:19 -0700256static struct platform_device msm8960_android_pmem_audio_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700257 .name = "android_pmem",
258 .id = 4,
259 .dev = { .platform_data = &android_pmem_audio_pdata },
260};
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700261#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
262#endif /*CONFIG_ANDROID_PMEM*/
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700263
Laura Abbottb93525f2012-04-12 09:57:19 -0700264struct fmem_platform_data msm8960_fmem_pdata = {
Larry Bassel41a055b2011-12-06 16:15:14 -0800265};
266
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700267#define DSP_RAM_BASE_8960 0x8da00000
268#define DSP_RAM_SIZE_8960 0x1800000
269static int dspcrashd_pdata_8960 = 0xDEADDEAD;
270
271static struct resource resources_dspcrashd_8960[] = {
272 {
273 .name = "msm_dspcrashd",
274 .start = DSP_RAM_BASE_8960,
275 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
276 .flags = IORESOURCE_DMA,
277 },
278};
279
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800280static struct platform_device msm_device_dspcrashd_8960 = {
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700281 .name = "msm_dspcrashd",
282 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
283 .resource = resources_dspcrashd_8960,
284 .dev = { .platform_data = &dspcrashd_pdata_8960 },
285};
286
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700287static struct memtype_reserve msm8960_reserve_table[] __initdata = {
288 [MEMTYPE_SMI] = {
289 },
290 [MEMTYPE_EBI0] = {
291 .flags = MEMTYPE_FLAGS_1M_ALIGN,
292 },
293 [MEMTYPE_EBI1] = {
294 .flags = MEMTYPE_FLAGS_1M_ALIGN,
295 },
296};
297
Laura Abbottf8c03b92012-02-16 14:57:58 -0800298static void __init reserve_rtb_memory(void)
299{
300#if defined(CONFIG_MSM_RTB)
Laura Abbottb93525f2012-04-12 09:57:19 -0700301 msm8960_reserve_table[MEMTYPE_EBI1].size += msm8960_rtb_pdata.size;
Laura Abbottf8c03b92012-02-16 14:57:58 -0800302#endif
303}
304
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700305static void __init size_pmem_devices(void)
306{
307#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700308#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700309 android_pmem_adsp_pdata.size = pmem_adsp_size;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800310
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800311 if (!pmem_param_set) {
312 if (machine_is_msm8960_liquid())
313 pmem_size = MSM_LIQUID_PMEM_SIZE;
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700314 if (msm8960_hdmi_as_primary_selected())
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800315 pmem_size = MSM_HDMI_PRIM_PMEM_SIZE;
316 }
317
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700318 android_pmem_pdata.size = pmem_size;
319 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700320#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
321#endif /*CONFIG_ANDROID_PMEM*/
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700322}
323
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700324#ifdef CONFIG_ANDROID_PMEM
325#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700326static void __init reserve_memory_for(struct android_pmem_platform_data *p)
327{
328 msm8960_reserve_table[p->memory_type].size += p->size;
329}
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700330#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
331#endif /*CONFIG_ANDROID_PMEM*/
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700332
333static void __init reserve_pmem_memory(void)
334{
335#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700336#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700337 reserve_memory_for(&android_pmem_adsp_pdata);
338 reserve_memory_for(&android_pmem_pdata);
339 reserve_memory_for(&android_pmem_audio_pdata);
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700340#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700341 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
342#endif
343}
344
Larry Basselb4126da2011-07-18 14:31:33 -0700345static int msm8960_paddr_to_memtype(unsigned int paddr)
346{
347 return MEMTYPE_EBI1;
348}
349
Olav Hauganf6dc7742012-02-15 09:11:55 -0800350#define FMEM_ENABLED 1
351
Laura Abbottd6183792011-08-19 13:42:24 -0700352#ifdef CONFIG_ION_MSM
Olav Haugan0703dbf2011-12-19 17:53:38 -0800353#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -0700354static struct ion_cp_heap_pdata cp_mm_msm8960_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800355 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugan8726caf2012-05-10 15:11:35 -0700356 .align = SZ_64K,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800357 .reusable = FMEM_ENABLED,
358 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700359 .fixed_position = FIXED_MIDDLE,
Olav Haugan8726caf2012-05-10 15:11:35 -0700360 .iommu_map_all = 1,
361 .iommu_2x_map_domain = VIDEO_DOMAIN,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800362};
363
Laura Abbottb93525f2012-04-12 09:57:19 -0700364static struct ion_cp_heap_pdata cp_mfc_msm8960_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800365 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugan42ebe712012-01-10 16:30:58 -0800366 .align = PAGE_SIZE,
Olav Haugan65f4bd82011-12-13 11:50:08 -0800367 .reusable = 0,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800368 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700369 .fixed_position = FIXED_HIGH,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800370};
371
Laura Abbottb93525f2012-04-12 09:57:19 -0700372static struct ion_co_heap_pdata co_msm8960_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800373 .adjacent_mem_id = INVALID_HEAP_ID,
374 .align = PAGE_SIZE,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800375 .mem_is_fmem = 0,
Olav Haugan42ebe712012-01-10 16:30:58 -0800376};
377
Laura Abbottb93525f2012-04-12 09:57:19 -0700378static struct ion_co_heap_pdata fw_co_msm8960_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800379 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
380 .align = SZ_128K,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800381 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700382 .fixed_position = FIXED_LOW,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800383};
384#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800385
386/**
387 * These heaps are listed in the order they will be allocated. Due to
388 * video hardware restrictions and content protection the FW heap has to
389 * be allocated adjacent (below) the MM heap and the MFC heap has to be
390 * allocated after the MM heap to ensure MFC heap is not more than 256MB
391 * away from the base address of the FW heap.
392 * However, the order of FW heap and MM heap doesn't matter since these
393 * two heaps are taken care of by separate code to ensure they are adjacent
394 * to each other.
395 * Don't swap the order unless you know what you are doing!
396 */
Laura Abbottb93525f2012-04-12 09:57:19 -0700397static struct ion_platform_data msm8960_ion_pdata = {
Laura Abbott2d1760b2011-09-29 21:31:24 -0700398 .nr = MSM_ION_HEAP_NUM,
Laura Abbottd6183792011-08-19 13:42:24 -0700399 .heaps = {
400 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800401 .id = ION_SYSTEM_HEAP_ID,
Laura Abbottd6183792011-08-19 13:42:24 -0700402 .type = ION_HEAP_TYPE_SYSTEM,
Laura Abbottd6183792011-08-19 13:42:24 -0700403 .name = ION_VMALLOC_HEAP_NAME,
404 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700405#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -0700406 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800407 .id = ION_CP_MM_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800408 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800409 .name = ION_MM_HEAP_NAME,
410 .size = MSM_ION_MM_SIZE,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700411 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700412 .extra_data = (void *) &cp_mm_msm8960_ion_pdata,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700413 },
Laura Abbott8c017362011-09-22 20:59:12 -0700414 {
Olav Haugan42ebe712012-01-10 16:30:58 -0800415 .id = ION_MM_FIRMWARE_HEAP_ID,
416 .type = ION_HEAP_TYPE_CARVEOUT,
417 .name = ION_MM_FIRMWARE_HEAP_NAME,
418 .size = MSM_ION_MM_FW_SIZE,
419 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700420 .extra_data = (void *) &fw_co_msm8960_ion_pdata,
Olav Haugan42ebe712012-01-10 16:30:58 -0800421 },
422 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800423 .id = ION_CP_MFC_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800424 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800425 .name = ION_MFC_HEAP_NAME,
426 .size = MSM_ION_MFC_SIZE,
427 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700428 .extra_data = (void *) &cp_mfc_msm8960_ion_pdata,
Olav Hauganb5be7992011-11-18 14:29:02 -0800429 },
Olav Haugan32594552012-03-13 11:40:05 -0700430#ifndef CONFIG_MSM_IOMMU
Olav Hauganb5be7992011-11-18 14:29:02 -0800431 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800432 .id = ION_SF_HEAP_ID,
433 .type = ION_HEAP_TYPE_CARVEOUT,
434 .name = ION_SF_HEAP_NAME,
435 .size = MSM_ION_SF_SIZE,
436 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700437 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800438 },
Olav Haugan32594552012-03-13 11:40:05 -0700439#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800440 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800441 .id = ION_IOMMU_HEAP_ID,
Laura Abbott8c017362011-09-22 20:59:12 -0700442 .type = ION_HEAP_TYPE_IOMMU,
443 .name = ION_IOMMU_HEAP_NAME,
444 },
Olav Haugan80854eb2012-01-12 12:00:23 -0800445 {
446 .id = ION_QSECOM_HEAP_ID,
447 .type = ION_HEAP_TYPE_CARVEOUT,
448 .name = ION_QSECOM_HEAP_NAME,
449 .size = MSM_ION_QSECOM_SIZE,
450 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700451 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan80854eb2012-01-12 12:00:23 -0800452 },
Olav Haugan7355db02012-01-13 16:59:13 -0800453 {
454 .id = ION_AUDIO_HEAP_ID,
455 .type = ION_HEAP_TYPE_CARVEOUT,
456 .name = ION_AUDIO_HEAP_NAME,
457 .size = MSM_ION_AUDIO_SIZE,
458 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700459 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan7355db02012-01-13 16:59:13 -0800460 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700461#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700462 }
463};
464
Laura Abbottb93525f2012-04-12 09:57:19 -0700465static struct platform_device msm8960_ion_dev = {
Laura Abbottd6183792011-08-19 13:42:24 -0700466 .name = "ion-msm",
467 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700468 .dev = { .platform_data = &msm8960_ion_pdata },
Laura Abbottd6183792011-08-19 13:42:24 -0700469};
470#endif
471
Laura Abbottb93525f2012-04-12 09:57:19 -0700472struct platform_device msm8960_fmem_device = {
Larry Bassel41a055b2011-12-06 16:15:14 -0800473 .name = "fmem",
474 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700475 .dev = { .platform_data = &msm8960_fmem_pdata },
Larry Bassel41a055b2011-12-06 16:15:14 -0800476};
477
Olav Haugan65f4bd82011-12-13 11:50:08 -0800478static void __init adjust_mem_for_liquid(void)
Laura Abbottd6183792011-08-19 13:42:24 -0700479{
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800480 unsigned int i;
481
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800482 if (!pmem_param_set) {
483 if (machine_is_msm8960_liquid())
484 msm_ion_sf_size = MSM_LIQUID_ION_SF_SIZE;
485
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700486 if (msm8960_hdmi_as_primary_selected())
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800487 msm_ion_sf_size = MSM_HDMI_PRIM_ION_SF_SIZE;
488
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700489 if (machine_is_msm8960_liquid() ||
490 msm8960_hdmi_as_primary_selected()) {
Laura Abbottb93525f2012-04-12 09:57:19 -0700491 for (i = 0; i < msm8960_ion_pdata.nr; i++) {
492 if (msm8960_ion_pdata.heaps[i].id ==
493 ION_SF_HEAP_ID) {
494 msm8960_ion_pdata.heaps[i].size =
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800495 msm_ion_sf_size;
496 pr_debug("msm_ion_sf_size 0x%x\n",
497 msm_ion_sf_size);
498 break;
499 }
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800500 }
501 }
502 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800503}
504
505static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
506 unsigned long size)
507{
508 msm8960_reserve_table[mem_type].size += size;
509}
510
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700511static void __init msm8960_reserve_fixed_area(unsigned long fixed_area_size)
512{
513#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
514 int ret;
515
516 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
517 panic("fixed area size is larger than %dM\n",
518 MAX_FIXED_AREA_SIZE >> 20);
519
520 reserve_info->fixed_area_size = fixed_area_size;
521 reserve_info->fixed_area_start = MSM8960_FW_START;
522
523 ret = memblock_remove(reserve_info->fixed_area_start,
524 reserve_info->fixed_area_size);
525 BUG_ON(ret);
526#endif
527}
528
Olav Haugan65f4bd82011-12-13 11:50:08 -0800529/**
530 * Reserve memory for ION and calculate amount of reusable memory for fmem.
531 * We only reserve memory for heaps that are not reusable. However, we only
532 * support one reusable heap at the moment so we ignore the reusable flag for
533 * other than the first heap with reusable flag set. Also handle special case
Olav Hauganf6dc7742012-02-15 09:11:55 -0800534 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
535 * at a higher address than FW in addition to not more than 256MB away from the
536 * base address of the firmware. This means that if MM is reusable the other
537 * two heaps must be allocated in the same region as FW. This is handled by the
538 * mem_is_fmem flag in the platform data. In addition the MM heap must be
539 * adjacent to the FW heap for content protection purposes.
Olav Haugan65f4bd82011-12-13 11:50:08 -0800540 */
541static void __init reserve_ion_memory(void)
542{
543#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
544 unsigned int i;
545 unsigned int reusable_count = 0;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700546 unsigned int fixed_size = 0;
547 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
548 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800549
550 adjust_mem_for_liquid();
Laura Abbottb93525f2012-04-12 09:57:19 -0700551 msm8960_fmem_pdata.size = 0;
552 msm8960_fmem_pdata.reserved_size_low = 0;
553 msm8960_fmem_pdata.reserved_size_high = 0;
Olav Haugan8726caf2012-05-10 15:11:35 -0700554 msm8960_fmem_pdata.align = PAGE_SIZE;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700555 fixed_low_size = 0;
556 fixed_middle_size = 0;
557 fixed_high_size = 0;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800558
559 /* We only support 1 reusable heap. Check if more than one heap
560 * is specified as reusable and set as non-reusable if found.
561 */
Laura Abbottb93525f2012-04-12 09:57:19 -0700562 for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
563 const struct ion_platform_heap *heap =
564 &(msm8960_ion_pdata.heaps[i]);
Olav Haugan65f4bd82011-12-13 11:50:08 -0800565
566 if (heap->type == ION_HEAP_TYPE_CP && heap->extra_data) {
567 struct ion_cp_heap_pdata *data = heap->extra_data;
568
569 reusable_count += (data->reusable) ? 1 : 0;
570
571 if (data->reusable && reusable_count > 1) {
572 pr_err("%s: Too many heaps specified as "
573 "reusable. Heap %s was not configured "
574 "as reusable.\n", __func__, heap->name);
575 data->reusable = 0;
576 }
577 }
578 }
579
Laura Abbottb93525f2012-04-12 09:57:19 -0700580 for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
Olav Haugan8726caf2012-05-10 15:11:35 -0700581 struct ion_platform_heap *heap =
Laura Abbottb93525f2012-04-12 09:57:19 -0700582 &(msm8960_ion_pdata.heaps[i]);
Olav Haugan8726caf2012-05-10 15:11:35 -0700583 int align = SZ_4K;
584 int iommu_map_all = 0;
585 int adjacent_mem_id = INVALID_HEAP_ID;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800586
587 if (heap->extra_data) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700588 int fixed_position = NOT_FIXED;
589 int mem_is_fmem = 0;
590
Olav Haugan65f4bd82011-12-13 11:50:08 -0800591 switch (heap->type) {
592 case ION_HEAP_TYPE_CP:
Olav Hauganf6dc7742012-02-15 09:11:55 -0800593 mem_is_fmem = ((struct ion_cp_heap_pdata *)
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700594 heap->extra_data)->mem_is_fmem;
595 fixed_position = ((struct ion_cp_heap_pdata *)
596 heap->extra_data)->fixed_position;
Olav Haugan8726caf2012-05-10 15:11:35 -0700597 align = ((struct ion_cp_heap_pdata *)
598 heap->extra_data)->align;
599 iommu_map_all =
600 ((struct ion_cp_heap_pdata *)
601 heap->extra_data)->iommu_map_all;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800602 break;
603 case ION_HEAP_TYPE_CARVEOUT:
Olav Hauganf6dc7742012-02-15 09:11:55 -0800604 mem_is_fmem = ((struct ion_co_heap_pdata *)
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700605 heap->extra_data)->mem_is_fmem;
606 fixed_position = ((struct ion_co_heap_pdata *)
607 heap->extra_data)->fixed_position;
Olav Haugan8726caf2012-05-10 15:11:35 -0700608 adjacent_mem_id = ((struct ion_co_heap_pdata *)
609 heap->extra_data)->adjacent_mem_id;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700610 break;
611 default:
612 break;
613 }
614
Olav Haugan8726caf2012-05-10 15:11:35 -0700615 if (iommu_map_all) {
616 if (heap->size & (SZ_64K-1)) {
617 heap->size = ALIGN(heap->size, SZ_64K);
618 pr_info("Heap %s not aligned to 64K. Adjusting size to %x\n",
619 heap->name, heap->size);
620 }
621 }
622
623 if (mem_is_fmem && adjacent_mem_id != INVALID_HEAP_ID)
624 msm8960_fmem_pdata.align = align;
625
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700626 if (fixed_position != NOT_FIXED)
627 fixed_size += heap->size;
628 else
629 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
630
631 if (fixed_position == FIXED_LOW)
632 fixed_low_size += heap->size;
633 else if (fixed_position == FIXED_MIDDLE)
634 fixed_middle_size += heap->size;
635 else if (fixed_position == FIXED_HIGH)
636 fixed_high_size += heap->size;
637
638 if (mem_is_fmem)
Laura Abbottb93525f2012-04-12 09:57:19 -0700639 msm8960_fmem_pdata.size += heap->size;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700640 }
641 }
642
643 if (!fixed_size)
644 return;
645
Laura Abbottb93525f2012-04-12 09:57:19 -0700646 if (msm8960_fmem_pdata.size) {
Deepak Kotur35825522012-06-06 15:49:14 -0700647 msm8960_fmem_pdata.reserved_size_low = fixed_low_size +
648 HOLE_SIZE;
Laura Abbottb93525f2012-04-12 09:57:19 -0700649 msm8960_fmem_pdata.reserved_size_high = fixed_high_size;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700650 }
651
Larry Bassel4d4f4482012-04-04 11:26:09 -0700652 /* Since the fixed area may be carved out of lowmem,
653 * make sure the length is a multiple of 1M.
654 */
655 fixed_size = (fixed_size + MSM_MM_FW_SIZE + SECTION_SIZE - 1)
656 & SECTION_MASK;
657 msm8960_reserve_fixed_area(fixed_size);
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700658
659 fixed_low_start = MSM8960_FIXED_AREA_START;
Deepak Kotur35825522012-06-06 15:49:14 -0700660 fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700661 fixed_high_start = fixed_middle_start + fixed_middle_size;
662
Laura Abbottb93525f2012-04-12 09:57:19 -0700663 for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
664 struct ion_platform_heap *heap = &(msm8960_ion_pdata.heaps[i]);
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700665
666 if (heap->extra_data) {
667 int fixed_position = NOT_FIXED;
Deepak Kotur35825522012-06-06 15:49:14 -0700668 struct ion_cp_heap_pdata *pdata;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700669
670 switch (heap->type) {
671 case ION_HEAP_TYPE_CP:
Deepak Kotur35825522012-06-06 15:49:14 -0700672 pdata =
673 (struct ion_cp_heap_pdata *)heap->extra_data;
674 fixed_position = pdata->fixed_position;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700675 break;
676 case ION_HEAP_TYPE_CARVEOUT:
677 fixed_position = ((struct ion_co_heap_pdata *)
678 heap->extra_data)->fixed_position;
679 break;
680 default:
681 break;
682 }
683
684 switch (fixed_position) {
685 case FIXED_LOW:
686 heap->base = fixed_low_start;
687 break;
688 case FIXED_MIDDLE:
689 heap->base = fixed_middle_start;
Deepak Kotur35825522012-06-06 15:49:14 -0700690 pdata->secure_base = fixed_middle_start
691 - HOLE_SIZE;
692 pdata->secure_size = HOLE_SIZE + heap->size;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700693 break;
694 case FIXED_HIGH:
695 heap->base = fixed_high_start;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800696 break;
697 default:
698 break;
699 }
700 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800701 }
Laura Abbottd6183792011-08-19 13:42:24 -0700702#endif
703}
Huaibin Yanga5419422011-12-08 23:52:10 -0800704
705static void __init reserve_mdp_memory(void)
706{
707 msm8960_mdp_writeback(msm8960_reserve_table);
708}
709
Stephen Boyd668d7652012-04-25 11:31:01 -0700710static void __init reserve_cache_dump_memory(void)
Laura Abbott306bcc22012-03-08 11:24:53 -0800711{
712#ifdef CONFIG_MSM_CACHE_DUMP
Laura Abbott306bcc22012-03-08 11:24:53 -0800713 unsigned int total;
Laura Abbott306bcc22012-03-08 11:24:53 -0800714
Laura Abbott155ab6f2012-05-25 08:52:18 -0700715 total = msm8960_cache_dump_pdata.l1_size +
716 msm8960_cache_dump_pdata.l2_size;
Laura Abbott306bcc22012-03-08 11:24:53 -0800717 msm8960_reserve_table[MEMTYPE_EBI1].size += total;
Laura Abbott306bcc22012-03-08 11:24:53 -0800718#endif
719}
720
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700721static void __init msm8960_calculate_reserve_sizes(void)
722{
723 size_pmem_devices();
724 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700725 reserve_ion_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800726 reserve_mdp_memory();
Laura Abbottf8c03b92012-02-16 14:57:58 -0800727 reserve_rtb_memory();
Laura Abbott306bcc22012-03-08 11:24:53 -0800728 reserve_cache_dump_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700729}
730
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700731static struct reserve_info msm8960_reserve_info __initdata = {
732 .memtype_reserve_table = msm8960_reserve_table,
733 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700734 .reserve_fixed_area = msm8960_reserve_fixed_area,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700735 .paddr_to_memtype = msm8960_paddr_to_memtype,
736};
737
Larry Basselb4126da2011-07-18 14:31:33 -0700738static int msm8960_memory_bank_size(void)
739{
740 return 1<<29;
741}
742
743static void __init locate_unstable_memory(void)
744{
745 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
746 unsigned long bank_size;
747 unsigned long low, high;
748
749 bank_size = msm8960_memory_bank_size();
Larry Bassel4d4f4482012-04-04 11:26:09 -0700750 msm8960_reserve_info.bank_size = bank_size;
751
Larry Basselb4126da2011-07-18 14:31:33 -0700752 low = meminfo.bank[0].start;
753 high = mb->start + mb->size;
Olav Haugan62052e42011-10-28 14:28:32 -0700754
755 /* Check if 32 bit overflow occured */
756 if (high < mb->start)
757 high = ~0UL;
758
Larry Bassel4d4f4482012-04-04 11:26:09 -0700759 if (high < MAX_FIXED_AREA_SIZE + MSM8960_FIXED_AREA_START)
760 panic("fixed area extends beyond end of memory\n");
761
Larry Basselb4126da2011-07-18 14:31:33 -0700762 low &= ~(bank_size - 1);
763
764 if (high - low <= bank_size)
Larry Bassel4d4f4482012-04-04 11:26:09 -0700765 goto no_dmm;
Larry Basselb8d61022012-02-24 10:49:45 -0800766
Larry Basselb8d61022012-02-24 10:49:45 -0800767#ifdef CONFIG_ENABLE_DMM
Jack Cheung60eaeab2012-01-09 16:40:26 -0800768 msm8960_reserve_info.low_unstable_address = mb->start -
769 MIN_MEMORY_BLOCK_SIZE + mb->size;
Jack Cheung0b1987e2011-11-18 13:36:29 -0800770 msm8960_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
Larry Basselb4126da2011-07-18 14:31:33 -0700771 pr_info("low unstable address %lx max size %lx bank size %lx\n",
772 msm8960_reserve_info.low_unstable_address,
773 msm8960_reserve_info.max_unstable_size,
774 msm8960_reserve_info.bank_size);
Larry Bassel4d4f4482012-04-04 11:26:09 -0700775 return;
Larry Basselb8d61022012-02-24 10:49:45 -0800776#endif
Larry Bassel4d4f4482012-04-04 11:26:09 -0700777no_dmm:
778 msm8960_reserve_info.low_unstable_address = high;
779 msm8960_reserve_info.max_unstable_size = 0;
Larry Basselb4126da2011-07-18 14:31:33 -0700780}
781
Larry Basselb830e182011-10-14 10:46:55 -0700782static void __init place_movable_zone(void)
783{
Larry Basselb8d61022012-02-24 10:49:45 -0800784#ifdef CONFIG_ENABLE_DMM
Larry Basselb830e182011-10-14 10:46:55 -0700785 movable_reserved_start = msm8960_reserve_info.low_unstable_address;
786 movable_reserved_size = msm8960_reserve_info.max_unstable_size;
787 pr_info("movable zone start %lx size %lx\n",
788 movable_reserved_start, movable_reserved_size);
Larry Basselb8d61022012-02-24 10:49:45 -0800789#endif
Larry Basselb830e182011-10-14 10:46:55 -0700790}
791
792static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700793{
794 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700795 locate_unstable_memory();
Larry Basselb830e182011-10-14 10:46:55 -0700796 place_movable_zone();
797}
798
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800799static char prim_panel_name[PANEL_NAME_MAX_LEN];
800static char ext_panel_name[PANEL_NAME_MAX_LEN];
801static int __init prim_display_setup(char *param)
802{
803 if (strnlen(param, PANEL_NAME_MAX_LEN))
804 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
805 return 0;
806}
807early_param("prim_display", prim_display_setup);
808
809static int __init ext_display_setup(char *param)
810{
811 if (strnlen(param, PANEL_NAME_MAX_LEN))
812 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
813 return 0;
814}
815early_param("ext_display", ext_display_setup);
816
Larry Basselb830e182011-10-14 10:46:55 -0700817static void __init msm8960_reserve(void)
818{
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800819 msm8960_set_display_params(prim_panel_name, ext_panel_name);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700820 msm_reserve();
Laura Abbottb93525f2012-04-12 09:57:19 -0700821 if (msm8960_fmem_pdata.size) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700822#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Larry Bassel861985f2012-05-02 15:54:52 -0700823 if (reserve_info->fixed_area_size) {
824 msm8960_fmem_pdata.phys =
825 reserve_info->fixed_area_start + MSM_MM_FW_SIZE;
826 pr_info("mm fw at %lx (fixed) size %x\n",
827 reserve_info->fixed_area_start, MSM_MM_FW_SIZE);
828 pr_info("fmem start %lx (fixed) size %lx\n",
829 msm8960_fmem_pdata.phys,
830 msm8960_fmem_pdata.size);
831 }
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700832#endif
833 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700834}
835
Larry Bassela4414b12011-08-04 11:11:02 -0700836static int msm8960_change_memory_power(u64 start, u64 size,
837 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700838{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -0700839 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -0700840}
841
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700842static void __init msm8960_allocate_memory_regions(void)
843{
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800844 msm8960_allocate_fb_region();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700845}
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800846
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700847#ifdef CONFIG_WCD9310_CODEC
848
849#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
850
Patrick Lai3043fba2011-08-01 14:15:57 -0700851/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
852 * 4 micbiases are used to power various analog and digital
853 * microphones operating at 1800 mV. Technically, all micbiases
854 * can source from single cfilter since all microphones operate
855 * at the same voltage level. The arrangement below is to make
856 * sure all cfilters are exercised. LDO_H regulator ouput level
857 * does not need to be as high as 2.85V. It is choosen for
858 * microphone sensitivity purpose.
859 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530860static struct wcd9xxx_pdata tabla_platform_data = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700861 .slimbus_slave_device = {
862 .name = "tabla-slave",
863 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
864 },
865 .irq = MSM_GPIO_TO_INT(62),
866 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530867 .num_irqs = NR_WCD9XXX_IRQS,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700868 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -0700869 .micbias = {
870 .ldoh_v = TABLA_LDOH_2P85_V,
871 .cfilt1_mv = 1800,
Joonwoo Parkcf473b42012-03-29 19:48:16 -0700872 .cfilt2_mv = 2700,
Patrick Lai3043fba2011-08-01 14:15:57 -0700873 .cfilt3_mv = 1800,
874 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
875 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
876 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
877 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530878 },
879 .regulator = {
880 {
881 .name = "CDC_VDD_CP",
882 .min_uV = 1800000,
883 .max_uV = 1800000,
884 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
885 },
886 {
887 .name = "CDC_VDDA_RX",
888 .min_uV = 1800000,
889 .max_uV = 1800000,
890 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
891 },
892 {
893 .name = "CDC_VDDA_TX",
894 .min_uV = 1800000,
895 .max_uV = 1800000,
896 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
897 },
898 {
899 .name = "VDDIO_CDC",
900 .min_uV = 1800000,
901 .max_uV = 1800000,
902 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
903 },
904 {
905 .name = "VDDD_CDC_D",
906 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700907 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530908 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
909 },
910 {
911 .name = "CDC_VDDA_A_1P2V",
912 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700913 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530914 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
915 },
916 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700917};
918
919static struct slim_device msm_slim_tabla = {
920 .name = "tabla-slim",
921 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
922 .dev = {
923 .platform_data = &tabla_platform_data,
924 },
925};
Santosh Mardi60e19d92011-10-28 01:15:14 +0530926
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530927static struct wcd9xxx_pdata tabla20_platform_data = {
Santosh Mardi60e19d92011-10-28 01:15:14 +0530928 .slimbus_slave_device = {
929 .name = "tabla-slave",
930 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
931 },
932 .irq = MSM_GPIO_TO_INT(62),
933 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530934 .num_irqs = NR_WCD9XXX_IRQS,
Santosh Mardi60e19d92011-10-28 01:15:14 +0530935 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
936 .micbias = {
937 .ldoh_v = TABLA_LDOH_2P85_V,
938 .cfilt1_mv = 1800,
Joonwoo Parkcf473b42012-03-29 19:48:16 -0700939 .cfilt2_mv = 2700,
Santosh Mardi60e19d92011-10-28 01:15:14 +0530940 .cfilt3_mv = 1800,
941 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
942 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
943 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
944 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530945 },
946 .regulator = {
947 {
948 .name = "CDC_VDD_CP",
949 .min_uV = 1800000,
950 .max_uV = 1800000,
951 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
952 },
953 {
954 .name = "CDC_VDDA_RX",
955 .min_uV = 1800000,
956 .max_uV = 1800000,
957 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
958 },
959 {
960 .name = "CDC_VDDA_TX",
961 .min_uV = 1800000,
962 .max_uV = 1800000,
963 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
964 },
965 {
966 .name = "VDDIO_CDC",
967 .min_uV = 1800000,
968 .max_uV = 1800000,
969 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
970 },
971 {
972 .name = "VDDD_CDC_D",
973 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700974 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530975 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
976 },
977 {
978 .name = "CDC_VDDA_A_1P2V",
979 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700980 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530981 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
982 },
983 },
Santosh Mardi60e19d92011-10-28 01:15:14 +0530984};
985
986static struct slim_device msm_slim_tabla20 = {
987 .name = "tabla2x-slim",
988 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
989 .dev = {
990 .platform_data = &tabla20_platform_data,
991 },
992};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700993#endif
994
995static struct slim_boardinfo msm_slim_devices[] = {
996#ifdef CONFIG_WCD9310_CODEC
997 {
998 .bus_num = 1,
999 .slim_slave = &msm_slim_tabla,
1000 },
Santosh Mardi60e19d92011-10-28 01:15:14 +05301001 {
1002 .bus_num = 1,
1003 .slim_slave = &msm_slim_tabla20,
1004 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001005#endif
1006 /* add more slimbus slaves as needed */
1007};
1008
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001009#define MSM_WCNSS_PHYS 0x03000000
1010#define MSM_WCNSS_SIZE 0x280000
1011
1012static struct resource resources_wcnss_wlan[] = {
1013 {
1014 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1015 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1016 .name = "wcnss_wlanrx_irq",
1017 .flags = IORESOURCE_IRQ,
1018 },
1019 {
1020 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1021 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1022 .name = "wcnss_wlantx_irq",
1023 .flags = IORESOURCE_IRQ,
1024 },
1025 {
1026 .start = MSM_WCNSS_PHYS,
1027 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1028 .name = "wcnss_mmio",
1029 .flags = IORESOURCE_MEM,
1030 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -07001031 {
1032 .start = 84,
1033 .end = 88,
1034 .name = "wcnss_gpios_5wire",
1035 .flags = IORESOURCE_IO,
1036 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001037};
1038
Ankur Nandwanib0039b02011-08-09 14:00:45 -07001039static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1040 .has_48mhz_xo = 1,
1041};
1042
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001043static struct platform_device msm_device_wcnss_wlan = {
1044 .name = "wcnss_wlan",
1045 .id = 0,
1046 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1047 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07001048 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001049};
1050
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001051#ifdef CONFIG_QSEECOM
1052/* qseecom bus scaling */
1053static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
1054 {
1055 .src = MSM_BUS_MASTER_SPS,
1056 .dst = MSM_BUS_SLAVE_EBI_CH0,
1057 .ib = 0,
1058 .ab = 0,
1059 },
1060 {
1061 .src = MSM_BUS_MASTER_SPDM,
1062 .dst = MSM_BUS_SLAVE_SPDM,
1063 .ib = 0,
1064 .ab = 0,
1065 },
1066};
1067
1068static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
1069 {
1070 .src = MSM_BUS_MASTER_SPS,
1071 .dst = MSM_BUS_SLAVE_EBI_CH0,
1072 .ib = (492 * 8) * 1000000UL,
1073 .ab = (492 * 8) * 100000UL,
1074 },
1075 {
1076 .src = MSM_BUS_MASTER_SPDM,
1077 .dst = MSM_BUS_SLAVE_SPDM,
1078 .ib = 0,
1079 .ab = 0,
1080 },
1081};
1082
1083static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1084 {
1085 .src = MSM_BUS_MASTER_SPS,
1086 .dst = MSM_BUS_SLAVE_EBI_CH0,
1087 .ib = 0,
1088 .ab = 0,
1089 },
1090 {
1091 .src = MSM_BUS_MASTER_SPDM,
1092 .dst = MSM_BUS_SLAVE_SPDM,
1093 .ib = (64 * 8) * 1000000UL,
1094 .ab = (64 * 8) * 100000UL,
1095 },
1096};
1097
1098static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1099 {
1100 ARRAY_SIZE(qseecom_clks_init_vectors),
1101 qseecom_clks_init_vectors,
1102 },
1103 {
1104 ARRAY_SIZE(qseecom_enable_dfab_vectors),
1105 qseecom_enable_sfpb_vectors,
1106 },
1107 {
1108 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1109 qseecom_enable_sfpb_vectors,
1110 },
1111};
1112
1113static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1114 qseecom_hw_bus_scale_usecases,
1115 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1116 .name = "qsee",
1117};
1118
1119static struct platform_device qseecom_device = {
1120 .name = "qseecom",
1121 .id = 0,
1122 .dev = {
1123 .platform_data = &qseecom_bus_pdata,
1124 },
1125};
1126#endif
1127
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001128#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1129 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1130 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1131 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1132
1133#define QCE_SIZE 0x10000
1134#define QCE_0_BASE 0x18500000
1135
1136#define QCE_HW_KEY_SUPPORT 0
1137#define QCE_SHA_HMAC_SUPPORT 1
1138#define QCE_SHARE_CE_RESOURCE 1
1139#define QCE_CE_SHARED 0
1140
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001141/* Begin Bus scaling definitions */
1142static struct msm_bus_vectors crypto_hw_init_vectors[] = {
1143 {
1144 .src = MSM_BUS_MASTER_ADM_PORT0,
1145 .dst = MSM_BUS_SLAVE_EBI_CH0,
1146 .ab = 0,
1147 .ib = 0,
1148 },
1149 {
1150 .src = MSM_BUS_MASTER_ADM_PORT1,
1151 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1152 .ab = 0,
1153 .ib = 0,
1154 },
1155};
1156
1157static struct msm_bus_vectors crypto_hw_active_vectors[] = {
1158 {
1159 .src = MSM_BUS_MASTER_ADM_PORT0,
1160 .dst = MSM_BUS_SLAVE_EBI_CH0,
1161 .ab = 70000000UL,
1162 .ib = 70000000UL,
1163 },
1164 {
1165 .src = MSM_BUS_MASTER_ADM_PORT1,
1166 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1167 .ab = 2480000000UL,
1168 .ib = 2480000000UL,
1169 },
1170};
1171
1172static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
1173 {
1174 ARRAY_SIZE(crypto_hw_init_vectors),
1175 crypto_hw_init_vectors,
1176 },
1177 {
1178 ARRAY_SIZE(crypto_hw_active_vectors),
1179 crypto_hw_active_vectors,
1180 },
1181};
1182
1183static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
1184 crypto_hw_bus_scale_usecases,
1185 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
1186 .name = "cryptohw",
1187};
1188/* End Bus Scaling Definitions*/
1189
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001190static struct resource qcrypto_resources[] = {
1191 [0] = {
1192 .start = QCE_0_BASE,
1193 .end = QCE_0_BASE + QCE_SIZE - 1,
1194 .flags = IORESOURCE_MEM,
1195 },
1196 [1] = {
1197 .name = "crypto_channels",
1198 .start = DMOV_CE_IN_CHAN,
1199 .end = DMOV_CE_OUT_CHAN,
1200 .flags = IORESOURCE_DMA,
1201 },
1202 [2] = {
1203 .name = "crypto_crci_in",
1204 .start = DMOV_CE_IN_CRCI,
1205 .end = DMOV_CE_IN_CRCI,
1206 .flags = IORESOURCE_DMA,
1207 },
1208 [3] = {
1209 .name = "crypto_crci_out",
1210 .start = DMOV_CE_OUT_CRCI,
1211 .end = DMOV_CE_OUT_CRCI,
1212 .flags = IORESOURCE_DMA,
1213 },
1214};
1215
1216static struct resource qcedev_resources[] = {
1217 [0] = {
1218 .start = QCE_0_BASE,
1219 .end = QCE_0_BASE + QCE_SIZE - 1,
1220 .flags = IORESOURCE_MEM,
1221 },
1222 [1] = {
1223 .name = "crypto_channels",
1224 .start = DMOV_CE_IN_CHAN,
1225 .end = DMOV_CE_OUT_CHAN,
1226 .flags = IORESOURCE_DMA,
1227 },
1228 [2] = {
1229 .name = "crypto_crci_in",
1230 .start = DMOV_CE_IN_CRCI,
1231 .end = DMOV_CE_IN_CRCI,
1232 .flags = IORESOURCE_DMA,
1233 },
1234 [3] = {
1235 .name = "crypto_crci_out",
1236 .start = DMOV_CE_OUT_CRCI,
1237 .end = DMOV_CE_OUT_CRCI,
1238 .flags = IORESOURCE_DMA,
1239 },
1240};
1241
1242#endif
1243
1244#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1245 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1246
1247static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1248 .ce_shared = QCE_CE_SHARED,
1249 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1250 .hw_key_support = QCE_HW_KEY_SUPPORT,
1251 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001252 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001253};
1254
1255static struct platform_device qcrypto_device = {
1256 .name = "qcrypto",
1257 .id = 0,
1258 .num_resources = ARRAY_SIZE(qcrypto_resources),
1259 .resource = qcrypto_resources,
1260 .dev = {
1261 .coherent_dma_mask = DMA_BIT_MASK(32),
1262 .platform_data = &qcrypto_ce_hw_suppport,
1263 },
1264};
1265#endif
1266
1267#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1268 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1269
1270static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1271 .ce_shared = QCE_CE_SHARED,
1272 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1273 .hw_key_support = QCE_HW_KEY_SUPPORT,
1274 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001275 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001276};
1277
1278static struct platform_device qcedev_device = {
1279 .name = "qce",
1280 .id = 0,
1281 .num_resources = ARRAY_SIZE(qcedev_resources),
1282 .resource = qcedev_resources,
1283 .dev = {
1284 .coherent_dma_mask = DMA_BIT_MASK(32),
1285 .platform_data = &qcedev_ce_hw_suppport,
1286 },
1287};
1288#endif
1289
Joel King0cbf5d82012-05-24 15:21:38 -07001290static struct mdm_platform_data sglte_platform_data = {
1291 .mdm_version = "4.0",
1292 .ramdump_delay_ms = 1000,
Joel King63ce8332012-06-01 09:59:26 -07001293 .soft_reset_inverted = 1,
Joel King0cbf5d82012-05-24 15:21:38 -07001294 .peripheral_platform_device = NULL,
Joel Kingb8352a12011-11-15 18:46:24 -08001295};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001296
Joel Nider266a2642011-10-16 10:58:05 +02001297#define MSM_TSIF0_PHYS (0x18200000)
1298#define MSM_TSIF1_PHYS (0x18201000)
1299#define MSM_TSIF_SIZE (0x200)
1300#define MSM_TSPP_PHYS (0x18202000)
1301#define MSM_TSPP_SIZE (0x1000)
1302#define MSM_TSPP_BAM_PHYS (0x18204000)
1303#define MSM_TSPP_BAM_SIZE (0x2000)
1304
1305#define TSIF_0_CLK GPIO_CFG(75, 1, GPIO_CFG_INPUT, \
1306 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1307#define TSIF_0_EN GPIO_CFG(76, 1, GPIO_CFG_INPUT, \
1308 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1309#define TSIF_0_DATA GPIO_CFG(77, 1, GPIO_CFG_INPUT, \
1310 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1311#define TSIF_0_SYNC GPIO_CFG(82, 1, GPIO_CFG_INPUT, \
1312 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1313#define TSIF_1_CLK GPIO_CFG(79, 1, GPIO_CFG_INPUT, \
1314 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1315#define TSIF_1_EN GPIO_CFG(80, 1, GPIO_CFG_INPUT, \
1316 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1317#define TSIF_1_DATA GPIO_CFG(81, 1, GPIO_CFG_INPUT, \
1318 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1319#define TSIF_1_SYNC GPIO_CFG(78, 1, GPIO_CFG_INPUT, \
1320 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1321
1322static const struct msm_gpio tsif_gpios[] = {
1323 { .gpio_cfg = TSIF_0_CLK, .label = "tsif0_clk", },
1324 { .gpio_cfg = TSIF_0_EN, .label = "tsif0_en", },
1325 { .gpio_cfg = TSIF_0_DATA, .label = "tsif0_data", },
1326 { .gpio_cfg = TSIF_0_SYNC, .label = "tsif0_sync", },
1327 { .gpio_cfg = TSIF_1_CLK, .label = "tsif1_clk", },
1328 { .gpio_cfg = TSIF_1_EN, .label = "tsif1_en", },
1329 { .gpio_cfg = TSIF_1_DATA, .label = "tsif1_data", },
1330 { .gpio_cfg = TSIF_1_SYNC, .label = "tsif1_sync", },
1331};
1332
1333static struct resource tspp_resources[] = {
1334 [0] = {
1335 .flags = IORESOURCE_IRQ,
1336 .start = TSIF_TSPP_IRQ,
1337 .end = TSIF1_IRQ,
1338 },
1339 [1] = {
1340 .flags = IORESOURCE_MEM,
1341 .start = MSM_TSIF0_PHYS,
1342 .end = MSM_TSIF0_PHYS + MSM_TSIF_SIZE - 1,
1343 },
1344 [2] = {
1345 .flags = IORESOURCE_MEM,
1346 .start = MSM_TSIF1_PHYS,
1347 .end = MSM_TSIF1_PHYS + MSM_TSIF_SIZE - 1,
1348 },
1349 [3] = {
1350 .flags = IORESOURCE_MEM,
1351 .start = MSM_TSPP_PHYS,
1352 .end = MSM_TSPP_PHYS + MSM_TSPP_SIZE - 1,
1353 },
1354 [4] = {
1355 .flags = IORESOURCE_MEM,
1356 .start = MSM_TSPP_BAM_PHYS,
1357 .end = MSM_TSPP_BAM_PHYS + MSM_TSPP_BAM_SIZE - 1,
1358 },
1359};
1360
1361static struct msm_tspp_platform_data tspp_platform_data = {
1362 .num_gpios = ARRAY_SIZE(tsif_gpios),
1363 .gpios = tsif_gpios,
1364 .tsif_pclk = "tsif_pclk",
1365 .tsif_ref_clk = "tsif_ref_clk",
1366};
1367
1368static struct platform_device msm_device_tspp = {
1369 .name = "msm_tspp",
1370 .id = 0,
1371 .num_resources = ARRAY_SIZE(tspp_resources),
1372 .resource = tspp_resources,
1373 .dev = {
1374 .platform_data = &tspp_platform_data
1375 },
1376};
1377
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001378#define MSM_SHARED_RAM_PHYS 0x80000000
1379
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001380static void __init msm8960_map_io(void)
1381{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001382 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001383 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001384
1385 if (socinfo_init() < 0)
1386 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001387}
1388
1389static void __init msm8960_init_irq(void)
1390{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001391 struct msm_mpm_device_data *data = NULL;
1392
1393#ifdef CONFIG_MSM_MPM
1394 data = &msm8960_mpm_dev_data;
1395#endif
1396
1397 msm_mpm_irq_extn_init(data);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001398 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001399 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001400}
1401
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001402static void __init msm8960_init_buses(void)
1403{
1404#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -06001405 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -06001406 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
1407 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
1408 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
1409 msm_bus_apps_fabric.dev.platform_data =
1410 &msm_bus_8960_apps_fabric_pdata;
1411 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
1412 msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
1413 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
1414 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001415#endif
1416}
1417
1418static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
1419 .max_clock_speed = 15060000,
1420};
1421
1422#ifdef CONFIG_USB_MSM_OTG_72K
1423static struct msm_otg_platform_data msm_otg_pdata;
1424#else
Anji jonnalaa8b8d732011-12-06 10:03:24 +05301425static int wr_phy_init_seq[] = {
1426 0x44, 0x80, /* set VBUS valid threshold
1427 and disconnect valid threshold */
1428 0x38, 0x81, /* update DC voltage level */
1429 0x14, 0x82, /* set preemphasis and rise/fall time */
1430 0x13, 0x83, /* set source impedance adjusment */
1431 -1};
1432
1433static int liquid_v1_phy_init_seq[] = {
1434 0x44, 0x80,/* set VBUS valid threshold
1435 and disconnect valid threshold */
1436 0x3C, 0x81,/* update DC voltage level */
1437 0x18, 0x82,/* set preemphasis and rise/fall time */
1438 0x23, 0x83,/* set source impedance sdjusment */
1439 -1};
1440
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301441#ifdef CONFIG_MSM_BUS_SCALING
1442/* Bandwidth requests (zero) if no vote placed */
1443static struct msm_bus_vectors usb_init_vectors[] = {
1444 {
1445 .src = MSM_BUS_MASTER_SPS,
1446 .dst = MSM_BUS_SLAVE_EBI_CH0,
1447 .ab = 0,
1448 .ib = 0,
1449 },
1450};
1451
1452/* Bus bandwidth requests in Bytes/sec */
1453static struct msm_bus_vectors usb_max_vectors[] = {
1454 {
1455 .src = MSM_BUS_MASTER_SPS,
1456 .dst = MSM_BUS_SLAVE_EBI_CH0,
1457 .ab = 60000000, /* At least 480Mbps on bus. */
1458 .ib = 960000000, /* MAX bursts rate */
1459 },
1460};
1461
1462static struct msm_bus_paths usb_bus_scale_usecases[] = {
1463 {
1464 ARRAY_SIZE(usb_init_vectors),
1465 usb_init_vectors,
1466 },
1467 {
1468 ARRAY_SIZE(usb_max_vectors),
1469 usb_max_vectors,
1470 },
1471};
1472
1473static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
1474 usb_bus_scale_usecases,
1475 ARRAY_SIZE(usb_bus_scale_usecases),
1476 .name = "usb",
1477};
1478#endif
1479
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001480static struct msm_otg_platform_data msm_otg_pdata = {
1481 .mode = USB_OTG,
1482 .otg_control = OTG_PMIC_CONTROL,
1483 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001484 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
Anji jonnala4e3e6772011-09-15 18:53:42 +05301485 .power_budget = 750,
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301486#ifdef CONFIG_MSM_BUS_SCALING
1487 .bus_scale_table = &usb_bus_scale_pdata,
1488#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001489};
1490#endif
1491
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301492#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05301493#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301494static struct msm_hsic_host_platform_data msm_hsic_pdata = {
1495 .strobe = 150,
1496 .data = 151,
1497};
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301498
1499static struct smsc_hub_platform_data hsic_hub_pdata = {
1500 .hub_reset = HSIC_HUB_RESET_GPIO,
1501};
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301502#else
1503static struct msm_hsic_host_platform_data msm_hsic_pdata;
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301504static struct smsc_hub_platform_data hsic_hub_pdata;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301505#endif
1506
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301507static struct platform_device smsc_hub_device = {
1508 .name = "msm_smsc_hub",
1509 .id = -1,
1510 .dev = {
1511 .platform_data = &hsic_hub_pdata,
1512 },
1513};
1514
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001515#define PID_MAGIC_ID 0x71432909
1516#define SERIAL_NUM_MAGIC_ID 0x61945374
1517#define SERIAL_NUMBER_LENGTH 127
1518#define DLOAD_USB_BASE_ADD 0x2A03F0C8
1519
1520struct magic_num_struct {
1521 uint32_t pid;
1522 uint32_t serial_num;
1523};
1524
1525struct dload_struct {
1526 uint32_t reserved1;
1527 uint32_t reserved2;
1528 uint32_t reserved3;
1529 uint16_t reserved4;
1530 uint16_t pid;
1531 char serial_number[SERIAL_NUMBER_LENGTH];
1532 uint16_t reserved5;
1533 struct magic_num_struct magic_struct;
1534};
1535
1536static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
1537{
1538 struct dload_struct __iomem *dload = 0;
1539
1540 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
1541 if (!dload) {
1542 pr_err("%s: cannot remap I/O memory region: %08x\n",
1543 __func__, DLOAD_USB_BASE_ADD);
1544 return -ENXIO;
1545 }
1546
1547 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
1548 __func__, dload, pid, snum);
1549 /* update pid */
1550 dload->magic_struct.pid = PID_MAGIC_ID;
1551 dload->pid = pid;
1552
1553 /* update serial number */
1554 dload->magic_struct.serial_num = 0;
1555 if (!snum) {
1556 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
1557 goto out;
1558 }
1559
1560 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -07001561 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001562out:
1563 iounmap(dload);
1564 return 0;
1565}
1566
1567static struct android_usb_platform_data android_usb_pdata = {
1568 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1569};
1570
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001571static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001572 .name = "android_usb",
1573 .id = -1,
1574 .dev = {
1575 .platform_data = &android_usb_pdata,
1576 },
1577};
1578
1579static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1580 0x03, 0x0f,
1581};
1582
1583static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1584 0x00, 0x24, 0x54, 0x10,
1585 0x09, 0x03, 0x01,
1586 0x10, 0x54, 0x30, 0x0C,
1587 0x24, 0x30, 0x0f,
1588};
1589
1590static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1591 0x00, 0x24, 0x54, 0x10,
1592 0x09, 0x07, 0x01, 0x0B,
1593 0x10, 0x54, 0x30, 0x0C,
1594 0x24, 0x30, 0x0f,
1595};
1596
1597static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1598 [0] = {
1599 .mode = MSM_SPM_MODE_CLOCK_GATING,
1600 .notify_rpm = false,
1601 .cmd = spm_wfi_cmd_sequence,
1602 },
1603 [1] = {
1604 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1605 .notify_rpm = false,
1606 .cmd = spm_power_collapse_without_rpm,
1607 },
1608 [2] = {
1609 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1610 .notify_rpm = true,
1611 .cmd = spm_power_collapse_with_rpm,
1612 },
1613};
1614
1615static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1616 [0] = {
1617 .reg_base_addr = MSM_SAW0_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001618 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001619#if defined(CONFIG_MSM_AVS_HW)
1620 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1621 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1622#endif
1623 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001624 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001625 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1626 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1627 .vctl_timeout_us = 50,
1628 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1629 .modes = msm_spm_seq_list,
1630 },
1631 [1] = {
1632 .reg_base_addr = MSM_SAW1_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001633 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001634#if defined(CONFIG_MSM_AVS_HW)
1635 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1636 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1637#endif
1638 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001639 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001640 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1641 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1642 .vctl_timeout_us = 50,
1643 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1644 .modes = msm_spm_seq_list,
1645 },
1646};
1647
1648static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1649 0x00, 0x20, 0x03, 0x20,
1650 0x00, 0x0f,
1651};
1652
1653static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1654 0x00, 0x20, 0x34, 0x64,
1655 0x48, 0x07, 0x48, 0x20,
1656 0x50, 0x64, 0x04, 0x34,
1657 0x50, 0x0f,
1658};
1659static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1660 0x00, 0x10, 0x34, 0x64,
1661 0x48, 0x07, 0x48, 0x10,
1662 0x50, 0x64, 0x04, 0x34,
1663 0x50, 0x0F,
1664};
1665
1666static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1667 [0] = {
1668 .mode = MSM_SPM_L2_MODE_RETENTION,
1669 .notify_rpm = false,
1670 .cmd = l2_spm_wfi_cmd_sequence,
1671 },
1672 [1] = {
1673 .mode = MSM_SPM_L2_MODE_GDHS,
1674 .notify_rpm = true,
1675 .cmd = l2_spm_gdhs_cmd_sequence,
1676 },
1677 [2] = {
1678 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1679 .notify_rpm = true,
1680 .cmd = l2_spm_power_off_cmd_sequence,
1681 },
1682};
1683
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001684static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1685 [0] = {
1686 .reg_base_addr = MSM_SAW_L2_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001687 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001688 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001689 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1690 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1691 .modes = msm_spm_l2_seq_list,
1692 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1693 },
1694};
1695
Mohan Pallaka5e490392011-09-09 15:18:41 +05301696#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1697#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
1698
1699static struct msm_xo_voter *xo_handle_d1;
1700
1701static int isa1200_power(int on)
1702{
1703 int rc = 0;
1704
1705 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !!on);
1706
1707 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
1708 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
1709 if (rc < 0) {
1710 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
1711 __func__, on ? "" : "de-", rc);
1712 goto err_xo_vote;
1713 }
1714
1715 return 0;
1716
1717err_xo_vote:
1718 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !on);
1719 return rc;
1720}
1721
1722static int isa1200_dev_setup(bool enable)
1723{
1724 int rc = 0;
1725
1726 struct pm_gpio hap_gpio_config = {
1727 .direction = PM_GPIO_DIR_OUT,
1728 .pull = PM_GPIO_PULL_NO,
1729 .out_strength = PM_GPIO_STRENGTH_HIGH,
1730 .function = PM_GPIO_FUNC_NORMAL,
1731 .inv_int_pol = 0,
1732 .vin_sel = 2,
1733 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1734 .output_value = 0,
1735 };
1736
1737 if (enable == true) {
1738 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
1739 if (rc) {
1740 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1741 __func__, PM_HAP_EN_GPIO, rc);
1742 return rc;
1743 }
1744
1745 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
1746 if (rc) {
1747 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1748 __func__, PM_HAP_LEN_GPIO, rc);
1749 return rc;
1750 }
1751
1752 rc = gpio_request(HAP_SHIFT_LVL_OE_GPIO, "hap_shft_lvl_oe");
1753 if (rc) {
1754 pr_err("%s: unable to request gpio %d (%d)\n",
1755 __func__, HAP_SHIFT_LVL_OE_GPIO, rc);
1756 return rc;
1757 }
1758
1759 rc = gpio_direction_output(HAP_SHIFT_LVL_OE_GPIO, 0);
1760 if (rc) {
1761 pr_err("%s: Unable to set direction\n", __func__);
1762 goto free_gpio;
1763 }
1764
1765 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
1766 if (IS_ERR(xo_handle_d1)) {
1767 rc = PTR_ERR(xo_handle_d1);
1768 pr_err("%s: failed to get the handle for D1(%d)\n",
1769 __func__, rc);
1770 goto gpio_set_dir;
1771 }
1772 } else {
1773 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1774
1775 msm_xo_put(xo_handle_d1);
1776 }
1777
1778 return 0;
1779
1780gpio_set_dir:
1781 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, 0);
1782free_gpio:
1783 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1784 return rc;
1785}
1786
1787static struct isa1200_regulator isa1200_reg_data[] = {
1788 {
1789 .name = "vcc_i2c",
1790 .min_uV = ISA_I2C_VTG_MIN_UV,
1791 .max_uV = ISA_I2C_VTG_MAX_UV,
1792 .load_uA = ISA_I2C_CURR_UA,
1793 },
1794};
1795
1796static struct isa1200_platform_data isa1200_1_pdata = {
1797 .name = "vibrator",
1798 .dev_setup = isa1200_dev_setup,
1799 .power_on = isa1200_power,
1800 .hap_en_gpio = PM_HAP_EN_GPIO,
1801 .hap_len_gpio = PM_HAP_LEN_GPIO,
1802 .max_timeout = 15000,
1803 .mode_ctrl = PWM_GEN_MODE,
1804 .pwm_fd = {
1805 .pwm_div = 256,
1806 },
1807 .is_erm = false,
1808 .smart_en = true,
1809 .ext_clk_en = true,
1810 .chip_en = 1,
1811 .regulator_info = isa1200_reg_data,
1812 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1813};
1814
1815static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1816 {
1817 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
Mohan Pallaka5e490392011-09-09 15:18:41 +05301818 },
1819};
1820
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001821#define CYTTSP_TS_GPIO_IRQ 11
1822#define CYTTSP_TS_SLEEP_GPIO 50
1823#define CYTTSP_TS_RESOUT_N_GPIO 52
1824
1825/*virtual key support */
1826static ssize_t tma340_vkeys_show(struct kobject *kobj,
1827 struct kobj_attribute *attr, char *buf)
1828{
1829 return snprintf(buf, 200,
1830 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1831 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1832 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1833 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1834 "\n");
1835}
1836
1837static struct kobj_attribute tma340_vkeys_attr = {
1838 .attr = {
1839 .mode = S_IRUGO,
1840 },
1841 .show = &tma340_vkeys_show,
1842};
1843
1844static struct attribute *tma340_properties_attrs[] = {
1845 &tma340_vkeys_attr.attr,
1846 NULL
1847};
1848
1849static struct attribute_group tma340_properties_attr_group = {
1850 .attrs = tma340_properties_attrs,
1851};
1852
1853
1854static int cyttsp_platform_init(struct i2c_client *client)
1855{
1856 int rc = 0;
1857 static struct kobject *tma340_properties_kobj;
1858
1859 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1860 tma340_properties_kobj = kobject_create_and_add("board_properties",
1861 NULL);
1862 if (tma340_properties_kobj)
1863 rc = sysfs_create_group(tma340_properties_kobj,
1864 &tma340_properties_attr_group);
1865 if (!tma340_properties_kobj || rc)
1866 pr_err("%s: failed to create board_properties\n",
1867 __func__);
1868
1869 return 0;
1870}
1871
1872static struct cyttsp_regulator regulator_data[] = {
1873 {
1874 .name = "vdd",
1875 .min_uV = CY_TMA300_VTG_MIN_UV,
1876 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301877 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1878 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001879 },
1880 /* TODO: Remove after runtime PM is enabled in I2C driver */
1881 {
1882 .name = "vcc_i2c",
1883 .min_uV = CY_I2C_VTG_MIN_UV,
1884 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301885 .hpm_load_uA = CY_I2C_CURR_UA,
1886 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001887 },
1888};
1889
1890static struct cyttsp_platform_data cyttsp_pdata = {
1891 .panel_maxx = 634,
1892 .panel_maxy = 1166,
1893 .disp_maxx = 616,
1894 .disp_maxy = 1023,
1895 .disp_minx = 0,
1896 .disp_miny = 16,
1897 .flags = 0x01,
1898 .gen = CY_GEN3, /* or */
1899 .use_st = CY_USE_ST,
1900 .use_mt = CY_USE_MT,
1901 .use_hndshk = CY_SEND_HNDSHK,
1902 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05301903 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001904 .use_gestures = CY_USE_GESTURES,
1905 .fw_fname = "cyttsp_8960_cdp.hex",
1906 /* activate up to 4 groups
1907 * and set active distance
1908 */
1909 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
1910 CY_GEST_GRP3 | CY_GEST_GRP4 |
1911 CY_ACT_DIST,
1912 /* change act_intrvl to customize the Active power state
1913 * scanning/processing refresh interval for Operating mode
1914 */
1915 .act_intrvl = CY_ACT_INTRVL_DFLT,
1916 /* change tch_tmout to customize the touch timeout for the
1917 * Active power state for Operating mode
1918 */
1919 .tch_tmout = CY_TCH_TMOUT_DFLT,
1920 /* change lp_intrvl to customize the Low Power power state
1921 * scanning/processing refresh interval for Operating mode
1922 */
1923 .lp_intrvl = CY_LP_INTRVL_DFLT,
1924 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
1925 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
1926 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1927 .regulator_info = regulator_data,
1928 .num_regulators = ARRAY_SIZE(regulator_data),
1929 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05301930 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001931};
1932
1933static struct i2c_board_info cyttsp_info[] __initdata = {
1934 {
1935 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1936 .platform_data = &cyttsp_pdata,
1937#ifndef CY_USE_TIMER
1938 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1939#endif /* CY_USE_TIMER */
1940 },
1941};
1942
Jing Lindc4413c2012-01-16 15:22:52 -08001943/* configuration data for mxt1386 */
1944static const u8 mxt1386_config_data[] = {
Mohan Pallaka50837382011-09-07 11:00:57 +05301945 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001946 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301947 /* T38 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001948 11, 2, 0, 11, 11, 11, 0, 0, 0, 0,
Jing Lin2f863172011-10-17 10:56:58 -07001949 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1950 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1951 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1952 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1953 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1954 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301955 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001956 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05301957 /* T8 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001958 8, 0, 0, 0, 0, 0, 8, 14, 50, 215,
Mohan Pallaka50837382011-09-07 11:00:57 +05301959 /* T9 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001960 131, 0, 0, 26, 42, 0, 32, 63, 3, 5,
1961 0, 2, 1, 113, 10, 10, 8, 10, 255, 2,
1962 85, 5, 0, 0, 20, 20, 75, 25, 202, 29,
1963 10, 10, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05301964 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001965 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1966 0,
Anirudh Ghayaldab4e0d2012-01-09 14:59:27 +05301967 /* T18 Object */
1968 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301969 /* T22 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001970 5, 0, 0, 0, 0, 0, 0, 0, 30, 0,
1971 0, 0, 5, 8, 10, 13, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301972 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001973 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1974 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301975 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001976 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
1977 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301978 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001979 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301980 /* T28 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001981 0, 0, 0, 8, 12, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05301982 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001983 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301984 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001985 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301986 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001987 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301988};
1989
Jing Lin33b007d2011-12-21 17:40:23 -08001990/* configuration data for mxt1386e using V1.0 firmware */
1991static const u8 mxt1386e_config_data_v1_0[] = {
1992 /* T6 Object */
1993 0, 0, 0, 0, 0, 0,
1994 /* T38 Object */
1995 12, 1, 0, 17, 1, 12, 0, 0, 0, 0,
1996 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1997 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1998 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1999 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2000 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2001 0, 0, 0, 0,
2002 /* T7 Object */
2003 100, 16, 50,
2004 /* T8 Object */
2005 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
2006 /* T9 Object */
2007 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
2008 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
2009 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
2010 10, 5, 0, 0, 0,
2011 /* T18 Object */
2012 0, 0,
2013 /* T24 Object */
2014 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2015 0, 0, 0, 0, 0, 0, 0, 0, 0,
2016 /* T25 Object */
2017 3, 0, 60, 115, 156, 99,
2018 /* T27 Object */
2019 0, 0, 0, 0, 0, 0, 0,
2020 /* T40 Object */
2021 0, 0, 0, 0, 0,
2022 /* T42 Object */
2023 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
2024 /* T43 Object */
2025 0, 0, 0, 0, 0, 0, 0,
2026 /* T46 Object */
2027 64, 0, 20, 20, 0, 0, 0, 0, 0,
2028 /* T47 Object */
2029 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2030 /* T48 Object */
2031 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
2032 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
2033 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
2034 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
2035 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2036 0, 0, 0, 0,
2037 /* T56 Object */
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 2, 99, 33,
2043};
2044
2045/* configuration data for mxt1386e using V2.1 firmware */
2046static const u8 mxt1386e_config_data_v2_1[] = {
2047 /* T6 Object */
2048 0, 0, 0, 0, 0, 0,
2049 /* T38 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002050 12, 3, 0, 24, 5, 12, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002051 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2052 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2053 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2054 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2055 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2056 0, 0, 0, 0,
2057 /* T7 Object */
2058 100, 16, 50,
2059 /* T8 Object */
2060 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
2061 /* T9 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002062 139, 0, 0, 26, 42, 0, 32, 80, 2, 5,
Jing Lin33b007d2011-12-21 17:40:23 -08002063 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
2064 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
2065 10, 5, 0, 0, 0,
2066 /* T18 Object */
2067 0, 0,
2068 /* T24 Object */
2069 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2070 0, 0, 0, 0, 0, 0, 0, 0, 0,
2071 /* T25 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002072 1, 0, 60, 115, 156, 99,
Jing Lin33b007d2011-12-21 17:40:23 -08002073 /* T27 Object */
2074 0, 0, 0, 0, 0, 0, 0,
2075 /* T40 Object */
2076 0, 0, 0, 0, 0,
2077 /* T42 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002078 0, 0, 255, 0, 255, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002079 /* T43 Object */
2080 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
2081 16,
2082 /* T46 Object */
2083 64, 0, 20, 20, 0, 0, 0, 0, 0,
2084 /* T47 Object */
2085 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2086 /* T48 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002087 1, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002088 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
2089 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
2090 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
2091 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2092 0, 0, 0, 0,
2093 /* T56 Object */
2094 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2095 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2096 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2097 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2098 2, 99, 33, 0, 149, 24, 193, 255, 255, 255,
2099 255,
2100};
2101
Jing Lineec88ca2012-02-08 11:18:30 -08002102/* configuration data for mxt1386e on 3D SKU using V2.1 firmware */
2103static const u8 mxt1386e_config_data_3d[] = {
2104 /* T6 Object */
2105 0, 0, 0, 0, 0, 0,
2106 /* T38 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002107 13, 1, 0, 23, 2, 12, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002108 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2109 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2110 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2111 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2112 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2113 0, 0, 0, 0,
2114 /* T7 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002115 100, 10, 50,
Jing Lineec88ca2012-02-08 11:18:30 -08002116 /* T8 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002117 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002118 /* T9 Object */
2119 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
2120 0, 5, 5, 0, 10, 30, 10, 10, 175, 4,
Jing Lin66ba78b2012-02-24 21:25:12 -08002121 127, 7, 26, 21, 17, 19, 143, 35, 207, 40,
2122 20, 5, 54, 49, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002123 /* T18 Object */
2124 0, 0,
2125 /* T24 Object */
2126 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2127 0, 0, 0, 0, 0, 0, 0, 0, 0,
2128 /* T25 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002129 0, 0, 72, 113, 168, 97,
Jing Lineec88ca2012-02-08 11:18:30 -08002130 /* T27 Object */
2131 0, 0, 0, 0, 0, 0, 0,
2132 /* T40 Object */
2133 0, 0, 0, 0, 0,
2134 /* T42 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002135 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002136 /* T43 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002137 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2138 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002139 /* T46 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002140 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002141 /* T47 Object */
2142 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2143 /* T48 Object */
2144 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08002145 32, 50, 0, 10, 10, 0, 0, 100, 10, 90,
2146 0, 0, 0, 0, 0, 0, 0, 10, 1, 30,
2147 52, 10, 5, 0, 33, 0, 1, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002148 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2149 0, 0, 0, 0,
2150 /* T56 Object */
2151 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2152 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2153 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2154 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08002155 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2156 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002157};
2158
Amy Maloche08266db2011-11-04 11:07:16 -07002159#define MXT_TS_GPIO_IRQ 11
2160#define MXT_TS_LDO_EN_GPIO 50
2161#define MXT_TS_RESET_GPIO 52
Mohan Pallaka50837382011-09-07 11:00:57 +05302162
2163static void mxt_init_hw_liquid(void)
2164{
2165 int rc;
2166
Mohan Pallaka50837382011-09-07 11:00:57 +05302167 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
2168 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07002169 pr_err("%s: unable to request mxt_ldo_en_gpio [%d]\n",
2170 __func__, MXT_TS_LDO_EN_GPIO);
2171 return;
Mohan Pallaka50837382011-09-07 11:00:57 +05302172 }
2173
2174 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
2175 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07002176 pr_err("%s: unable to set_direction for mxt_ldo_en_gpio [%d]\n",
2177 __func__, MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05302178 goto err_ldo_gpio_req;
2179 }
2180
Mohan Pallaka50837382011-09-07 11:00:57 +05302181 return;
2182
Mohan Pallaka50837382011-09-07 11:00:57 +05302183err_ldo_gpio_req:
2184 gpio_free(MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05302185}
2186
Jing Lineec88ca2012-02-08 11:18:30 -08002187static struct mxt_config_info mxt_config_array_2d[] = {
Jing Lindc4413c2012-01-16 15:22:52 -08002188 {
2189 .config = mxt1386_config_data,
2190 .config_length = ARRAY_SIZE(mxt1386_config_data),
2191 .family_id = 0xA0,
2192 .variant_id = 0x0,
2193 .version = 0x10,
2194 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002195 .bootldr_id = MXT_BOOTLOADER_ID_1386,
Jing Lindc4413c2012-01-16 15:22:52 -08002196 },
Jing Lin33b007d2011-12-21 17:40:23 -08002197 {
2198 .config = mxt1386e_config_data_v1_0,
2199 .config_length = ARRAY_SIZE(mxt1386e_config_data_v1_0),
2200 .family_id = 0xA0,
2201 .variant_id = 0x2,
2202 .version = 0x10,
2203 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002204 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Linaeaeed52012-03-26 14:57:15 -07002205 .fw_name = "atmel_8960_liquid_v2_2_AA.hex",
Jing Lin33b007d2011-12-21 17:40:23 -08002206 },
2207 {
2208 .config = mxt1386e_config_data_v2_1,
2209 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
2210 .family_id = 0xA0,
2211 .variant_id = 0x7,
2212 .version = 0x21,
2213 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002214 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Linaeaeed52012-03-26 14:57:15 -07002215 .fw_name = "atmel_8960_liquid_v2_2_AA.hex",
2216 },
2217 {
2218 /* The config data for V2.2.AA is the same as for V2.1.AA */
2219 .config = mxt1386e_config_data_v2_1,
2220 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
2221 .family_id = 0xA0,
2222 .variant_id = 0x7,
2223 .version = 0x22,
2224 .build = 0xAA,
2225 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin33b007d2011-12-21 17:40:23 -08002226 },
Jing Lindc4413c2012-01-16 15:22:52 -08002227};
2228
Jing Lineec88ca2012-02-08 11:18:30 -08002229static struct mxt_platform_data mxt_platform_data_2d = {
2230 .config_array = mxt_config_array_2d,
2231 .config_array_size = ARRAY_SIZE(mxt_config_array_2d),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002232 .panel_minx = 0,
2233 .panel_maxx = 1365,
2234 .panel_miny = 0,
2235 .panel_maxy = 767,
2236 .disp_minx = 0,
2237 .disp_maxx = 1365,
2238 .disp_miny = 0,
2239 .disp_maxy = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05302240 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07002241 .i2c_pull_up = true,
Amy Maloche08266db2011-11-04 11:07:16 -07002242 .reset_gpio = MXT_TS_RESET_GPIO,
2243 .irq_gpio = MXT_TS_GPIO_IRQ,
Mohan Pallaka50837382011-09-07 11:00:57 +05302244};
2245
Jing Lineec88ca2012-02-08 11:18:30 -08002246static struct mxt_config_info mxt_config_array_3d[] = {
2247 {
2248 .config = mxt1386e_config_data_3d,
2249 .config_length = ARRAY_SIZE(mxt1386e_config_data_3d),
2250 .family_id = 0xA0,
2251 .variant_id = 0x7,
2252 .version = 0x21,
2253 .build = 0xAA,
2254 },
2255};
2256
2257static struct mxt_platform_data mxt_platform_data_3d = {
2258 .config_array = mxt_config_array_3d,
2259 .config_array_size = ARRAY_SIZE(mxt_config_array_3d),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002260 .panel_minx = 0,
2261 .panel_maxx = 1919,
2262 .panel_miny = 0,
2263 .panel_maxy = 1199,
2264 .disp_minx = 0,
2265 .disp_maxx = 1919,
2266 .disp_miny = 0,
2267 .disp_maxy = 1199,
Jing Lineec88ca2012-02-08 11:18:30 -08002268 .irqflags = IRQF_TRIGGER_FALLING,
2269 .i2c_pull_up = true,
2270 .reset_gpio = MXT_TS_RESET_GPIO,
2271 .irq_gpio = MXT_TS_GPIO_IRQ,
2272};
2273
Mohan Pallaka50837382011-09-07 11:00:57 +05302274static struct i2c_board_info mxt_device_info[] __initdata = {
2275 {
2276 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
Mohan Pallaka50837382011-09-07 11:00:57 +05302277 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
2278 },
2279};
2280
Manoj Rao14648742012-03-30 19:42:12 -07002281#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
2282static void mhl_sii_reset_gpio(int on)
2283{
2284 gpio_set_value(MHL_GPIO_RESET, on);
2285 return;
2286}
2287
2288/*
2289 * Request for GPIO allocations
2290 * Set appropriate GPIO directions
2291 */
2292static int mhl_sii_gpio_setup(int on)
2293{
2294 int ret;
2295
2296 if (on) {
2297 ret = gpio_request(MHL_GPIO_RESET, "W_RST#");
2298 if (ret < 0) {
2299 pr_err("GPIO RESET request failed: %d\n", ret);
2300 return -EBUSY;
2301 }
2302 ret = gpio_direction_output(MHL_GPIO_RESET, 1);
2303 if (ret < 0) {
2304 pr_err("SET GPIO RESET direction failed: %d\n", ret);
2305 gpio_free(MHL_GPIO_RESET);
2306 return -EBUSY;
2307 }
2308 ret = gpio_request(MHL_GPIO_INT, "W_INT");
2309 if (ret < 0) {
2310 pr_err("GPIO INT request failed: %d\n", ret);
2311 gpio_free(MHL_GPIO_RESET);
2312 return -EBUSY;
2313 }
2314 ret = gpio_direction_input(MHL_GPIO_INT);
2315 if (ret < 0) {
2316 pr_err("SET GPIO INTR direction failed: %d\n", ret);
2317 gpio_free(MHL_GPIO_RESET);
2318 gpio_free(MHL_GPIO_INT);
2319 return -EBUSY;
2320 }
2321 } else {
2322 gpio_free(MHL_GPIO_RESET);
2323 gpio_free(MHL_GPIO_INT);
2324 }
2325
2326 return 0;
2327}
2328
2329static struct msm_mhl_platform_data mhl_platform_data = {
2330 .irq = MSM_GPIO_TO_INT(4),
2331 .gpio_setup = mhl_sii_gpio_setup,
2332 .reset_pin = mhl_sii_reset_gpio,
2333};
2334#endif
2335
Eugene Yasmand2316b82011-12-07 18:23:48 +02002336static struct i2c_board_info sii_device_info[] __initdata = {
2337 {
Manoj Rao14648742012-03-30 19:42:12 -07002338#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
2339 /*
2340 * keeps SI 8334 as the default
2341 * MHL TX
2342 */
2343 I2C_BOARD_INFO("sii8334", 0x39),
2344 .platform_data = &mhl_platform_data,
2345#endif
2346#ifdef CONFIG_FB_MSM_HDMI_MHL_9244
Eugene Yasmand2316b82011-12-07 18:23:48 +02002347 I2C_BOARD_INFO("Sil-9244", 0x39),
Eugene Yasmand2316b82011-12-07 18:23:48 +02002348 .irq = MSM_GPIO_TO_INT(15),
Manoj Rao14648742012-03-30 19:42:12 -07002349#endif /* CONFIG_MSM_HDMI_MHL */
2350 .flags = I2C_CLIENT_WAKE,
Eugene Yasmand2316b82011-12-07 18:23:48 +02002351 },
2352};
2353
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002354static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
2355 .clk_freq = 100000,
2356 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002357};
2358
2359static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
2360 .clk_freq = 100000,
2361 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002362};
2363
2364static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
2365 .clk_freq = 100000,
2366 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002367};
2368
2369static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
2370 .clk_freq = 100000,
2371 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002372};
2373
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06002374static struct msm_pm_sleep_status_data msm_pm_slp_sts_data = {
2375 .base_addr = MSM_ACC0_BASE + 0x08,
2376 .cpu_offset = MSM_ACC1_BASE - MSM_ACC0_BASE,
2377 .mask = 1UL << 13,
2378};
2379
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002380static struct ks8851_pdata spi_eth_pdata = {
2381 .irq_gpio = KS8851_IRQ_GPIO,
2382 .rst_gpio = KS8851_RST_GPIO,
2383};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06002384
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002385static struct spi_board_info spi_board_info[] __initdata = {
2386 {
2387 .modalias = "ks8851",
2388 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2389 .max_speed_hz = 19200000,
2390 .bus_num = 0,
2391 .chip_select = 0,
2392 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002393 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002394 },
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07002395 {
2396 .modalias = "dsi_novatek_3d_panel_spi",
2397 .max_speed_hz = 10800000,
2398 .bus_num = 0,
2399 .chip_select = 1,
2400 .mode = SPI_MODE_0,
2401 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002402};
2403
2404static struct platform_device msm_device_saw_core0 = {
2405 .name = "saw-regulator",
2406 .id = 0,
2407 .dev = {
2408 .platform_data = &msm_saw_regulator_pdata_s5,
2409 },
2410};
2411
2412static struct platform_device msm_device_saw_core1 = {
2413 .name = "saw-regulator",
2414 .id = 1,
2415 .dev = {
2416 .platform_data = &msm_saw_regulator_pdata_s6,
2417 },
2418};
2419
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002420static struct tsens_platform_data msm_tsens_pdata = {
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002421 .slope = {910, 910, 910, 910, 910},
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002422 .tsens_factor = 1000,
2423 .hw_type = MSM_8960,
2424 .tsens_num_sensor = 5,
2425};
2426
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002427static struct platform_device msm_tsens_device = {
2428 .name = "tsens8960-tm",
2429 .id = -1,
2430};
2431
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002432#ifdef CONFIG_MSM_FAKE_BATTERY
2433static struct platform_device fish_battery_device = {
2434 .name = "fish_battery",
2435};
2436#endif
2437
David Collins26f05562011-06-20 09:56:28 -07002438static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002439 .name = GPIO_REGULATOR_DEV_NAME,
2440 .id = PM8921_MPP_PM_TO_SYS(7),
2441 .dev = {
2442 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2443 },
2444};
2445
David Collins26f05562011-06-20 09:56:28 -07002446static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002447 .name = GPIO_REGULATOR_DEV_NAME,
2448 .id = 91,
2449 .dev = {
2450 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2451 },
2452};
2453
David Collinsb10be1d2011-09-02 10:29:31 -07002454static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
2455 .name = GPIO_REGULATOR_DEV_NAME,
2456 .id = PM8921_GPIO_PM_TO_SYS(17),
2457 .dev = {
2458 .platform_data =
2459 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2460 },
2461};
2462
David Collins35a78f52011-12-14 15:54:25 -08002463static struct platform_device msm8960_device_ext_otg_sw_vreg __devinitdata = {
2464 .name = GPIO_REGULATOR_DEV_NAME,
2465 .id = PM8921_GPIO_PM_TO_SYS(42),
2466 .dev = {
2467 .platform_data =
2468 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_OTG_SW],
2469 },
2470};
2471
David Collins26f05562011-06-20 09:56:28 -07002472static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
2473 .name = "rpm-regulator",
2474 .id = -1,
2475 .dev = {
2476 .platform_data = &msm_rpm_regulator_pdata,
2477 },
2478};
Mayank Ranae009c922012-03-22 03:02:06 +05302479#ifdef CONFIG_SERIAL_MSM_HS
2480static int configure_uart_gpios(int on)
2481{
2482 int ret = 0, i;
2483 int uart_gpios[] = {93, 94, 95, 96};
2484
2485 for (i = 0; i < ARRAY_SIZE(uart_gpios); i++) {
2486 if (on) {
2487 ret = gpio_request(uart_gpios[i], NULL);
2488 if (ret) {
2489 pr_err("%s: unable to request uart gpio[%d]\n",
2490 __func__, uart_gpios[i]);
2491 break;
2492 }
2493 } else {
2494 gpio_free(uart_gpios[i]);
2495 }
2496 }
2497
2498 if (ret && on && i)
2499 for (; i >= 0; i--)
2500 gpio_free(uart_gpios[i]);
2501 return ret;
2502}
2503
2504static struct msm_serial_hs_platform_data msm_uart_dm9_pdata = {
Mayank Ranad85a5082012-04-29 17:24:13 -07002505 .gpio_config = configure_uart_gpios,
Mayank Ranae009c922012-03-22 03:02:06 +05302506};
2507#else
2508static struct msm_serial_hs_platform_data msm_uart_dm9_pdata;
2509#endif
David Collins26f05562011-06-20 09:56:28 -07002510
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002511static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07002512 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002513 &msm_device_smd,
Mayank Rana9f51f582011-08-04 18:35:59 +05302514 &msm_device_uart_dm6,
Mayank Ranae009c922012-03-22 03:02:06 +05302515 &msm_device_uart_dm9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002516 &msm_device_saw_core0,
2517 &msm_device_saw_core1,
2518 &msm8960_device_ext_5v_vreg,
David Collins87579612012-01-30 16:00:15 -08002519 &msm8960_device_ssbi_pmic,
David Collins96aa3e12012-02-29 10:31:34 -08002520 &msm8960_device_ext_otg_sw_vreg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002521 &msm8960_device_qup_spi_gsbi1,
2522 &msm8960_device_qup_i2c_gsbi3,
2523 &msm8960_device_qup_i2c_gsbi4,
2524 &msm8960_device_qup_i2c_gsbi10,
2525#ifndef CONFIG_MSM_DSPS
2526 &msm8960_device_qup_i2c_gsbi12,
2527#endif
2528 &msm_slim_ctrl,
2529 &msm_device_wcnss_wlan,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002530#if defined(CONFIG_QSEECOM)
2531 &qseecom_device,
2532#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002533#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2534 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2535 &qcrypto_device,
2536#endif
2537
2538#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2539 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2540 &qcedev_device,
2541#endif
2542#ifdef CONFIG_MSM_ROTATOR
2543 &msm_rotator_device,
2544#endif
2545 &msm_device_sps,
2546#ifdef CONFIG_MSM_FAKE_BATTERY
2547 &fish_battery_device,
2548#endif
Laura Abbottb93525f2012-04-12 09:57:19 -07002549 &msm8960_fmem_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002550#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07002551#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002552 &msm8960_android_pmem_device,
2553 &msm8960_android_pmem_adsp_device,
2554 &msm8960_android_pmem_audio_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002555#endif
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -07002556#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002557 &msm_device_vidc,
2558 &msm_device_bam_dmux,
2559 &msm_fm_platform_init,
Joel Nidera1261942011-09-12 16:30:09 +03002560#if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE)
2561#ifdef CONFIG_MSM_USE_TSIF1
2562 &msm_device_tsif[1],
2563#else
2564 &msm_device_tsif[0],
2565#endif
2566#endif
Joel Nider266a2642011-10-16 10:58:05 +02002567 &msm_device_tspp,
Mona Hossain9c430e32011-07-27 11:04:47 -07002568#ifdef CONFIG_HW_RANDOM_MSM
2569 &msm_device_rng,
2570#endif
Laura Abbottd6183792011-08-19 13:42:24 -07002571#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002572 &msm8960_ion_dev,
Laura Abbottd6183792011-08-19 13:42:24 -07002573#endif
Praveen Chidambaram78499012011-11-01 17:15:17 -06002574 &msm8960_rpm_device,
2575 &msm8960_rpm_log_device,
2576 &msm8960_rpm_stat_device,
Mona Hossain11c03ac2011-10-26 12:42:10 -07002577 &msm_device_tz_log,
Pratik Patel7831c082011-06-08 21:44:37 -07002578#ifdef CONFIG_MSM_QDSS
Pratik Patel1403f2a2012-03-21 10:10:00 -07002579 &msm_qdss_device,
Pratik Patel7831c082011-06-08 21:44:37 -07002580 &msm_etb_device,
2581 &msm_tpiu_device,
2582 &msm_funnel_device,
Pratik Patel492b3012012-03-06 14:22:30 -08002583 &msm_etm_device,
Pratik Patel7831c082011-06-08 21:44:37 -07002584#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07002585 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002586 &msm8960_device_watchdog,
Laura Abbottb93525f2012-04-12 09:57:19 -07002587 &msm8960_rtb_device,
Praveen Chidambaram8ea3dcd2011-12-07 14:46:31 -07002588 &msm8960_cpu_idle_device,
Praveen Chidambaram5c8adf22012-02-23 18:44:37 -07002589 &msm8960_msm_gov_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002590 &msm8960_device_cache_erp,
Laura Abbottb93525f2012-04-12 09:57:19 -07002591 &msm8960_cache_dump_device,
Laura Abbott0577d7b2012-04-17 11:14:30 -07002592 &msm8960_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002593 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002594};
2595
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002596static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07002597 &msm8960_device_uart_gsbi5,
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002598 &msm8960_device_otg,
2599 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002600 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05302601 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002602 &android_usb_device,
2603 &msm_device_vidc,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002604 &msm_bus_apps_fabric,
2605 &msm_bus_sys_fabric,
2606 &msm_bus_mm_fabric,
2607 &msm_bus_sys_fpb,
2608 &msm_bus_cpss_fpb,
2609 &msm_pcm,
Kiran Kandi5e809b02012-01-31 00:24:33 -08002610 &msm_multi_ch_pcm,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002611 &msm_pcm_routing,
2612 &msm_cpudai0,
2613 &msm_cpudai1,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002614 &msm8960_cpudai_slimbus_2_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002615 &msm_cpudai_hdmi_rx,
2616 &msm_cpudai_bt_rx,
2617 &msm_cpudai_bt_tx,
2618 &msm_cpudai_fm_rx,
2619 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002620 &msm_cpudai_auxpcm_rx,
2621 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002622 &msm_cpu_fe,
2623 &msm_stub_codec,
2624 &msm_voice,
2625 &msm_voip,
2626 &msm_lpa_pcm,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05302627 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07002628 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07002629 &msm_cpudai_incall_record_rx,
2630 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002631
2632#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2633 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2634 &qcrypto_device,
2635#endif
2636
2637#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2638 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2639 &qcedev_device,
2640#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002641};
2642
2643static struct platform_device *rumi3_devices[] __initdata = {
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07002644 &msm8960_device_uart_gsbi5,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002645 &msm_kgsl_3d0,
2646 &msm_kgsl_2d0,
2647 &msm_kgsl_2d1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002648#ifdef CONFIG_MSM_GEMINI
2649 &msm8960_gemini_device,
2650#endif
Kalyani Oruganti465d1e12012-05-15 10:23:05 -07002651#ifdef CONFIG_MSM_MERCURY
2652 &msm8960_mercury_device,
2653#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002654};
2655
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002656static struct platform_device *cdp_devices[] __initdata = {
Stephen Boydeb819882011-08-29 14:46:30 -07002657 &msm_8960_q6_lpass,
2658 &msm_8960_q6_mss_fw,
2659 &msm_8960_q6_mss_sw,
Stephen Boyd322a9922011-09-20 01:05:54 -07002660 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07002661 &msm_pil_tzapps,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07002662 &msm_pil_dsps,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002663 &msm_pil_vidc,
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002664 &msm8960_device_otg,
2665 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002666 &msm_device_hsusb_host,
2667 &android_usb_device,
2668 &msm_pcm,
Kiran Kandi5e809b02012-01-31 00:24:33 -08002669 &msm_multi_ch_pcm,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002670 &msm_pcm_routing,
2671 &msm_cpudai0,
2672 &msm_cpudai1,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002673 &msm8960_cpudai_slimbus_2_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002674 &msm_cpudai_hdmi_rx,
2675 &msm_cpudai_bt_rx,
2676 &msm_cpudai_bt_tx,
2677 &msm_cpudai_fm_rx,
2678 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002679 &msm_cpudai_auxpcm_rx,
2680 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002681 &msm_cpu_fe,
2682 &msm_stub_codec,
2683 &msm_kgsl_3d0,
2684#ifdef CONFIG_MSM_KGSL_2D
2685 &msm_kgsl_2d0,
2686 &msm_kgsl_2d1,
2687#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002688#ifdef CONFIG_MSM_GEMINI
2689 &msm8960_gemini_device,
2690#endif
Kalyani Oruganti465d1e12012-05-15 10:23:05 -07002691#ifdef CONFIG_MSM_MERCURY
2692 &msm8960_mercury_device,
2693#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002694 &msm_voice,
2695 &msm_voip,
2696 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05302697 &msm_cpudai_afe_01_rx,
2698 &msm_cpudai_afe_01_tx,
2699 &msm_cpudai_afe_02_rx,
2700 &msm_cpudai_afe_02_tx,
2701 &msm_pcm_afe,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05302702 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07002703 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07002704 &msm_cpudai_incall_record_rx,
2705 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002706 &msm_pcm_hostless,
2707 &msm_bus_apps_fabric,
2708 &msm_bus_sys_fabric,
2709 &msm_bus_mm_fabric,
2710 &msm_bus_sys_fpb,
2711 &msm_bus_cpss_fpb,
2712};
2713
2714static void __init msm8960_i2c_init(void)
2715{
2716 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2717 &msm8960_i2c_qup_gsbi4_pdata;
2718
2719 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2720 &msm8960_i2c_qup_gsbi3_pdata;
2721
2722 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2723 &msm8960_i2c_qup_gsbi10_pdata;
2724
2725 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2726 &msm8960_i2c_qup_gsbi12_pdata;
2727}
2728
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002729static void __init msm8960_gfx_init(void)
2730{
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06002731 uint32_t soc_platform_version = socinfo_get_version();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002732 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
2733 struct kgsl_device_platform_data *kgsl_3d0_pdata =
2734 msm_kgsl_3d0.dev.platform_data;
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -06002735 kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
2736 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002737 }
2738}
2739
Subhash Jadavani933e6a62011-12-26 18:05:04 +05302740static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002741 {
2742 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2743 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2744 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002745 1, 784, 180000, 100,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002746 },
2747
2748 {
2749 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2750 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2751 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002752 1300, 228, 1200000, 2000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002753 },
2754
2755 {
2756 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2757 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2758 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002759 2000, 138, 1208400, 3200,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002760 },
2761
2762 {
2763 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06002764 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2765 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002766 6000, 119, 1850300, 9000,
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06002767 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002768
2769 {
2770 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2771 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2772 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002773 9200, 68, 2839200, 16400,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002774 },
2775
2776 {
2777 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2778 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2779 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002780 10300, 63, 3128000, 18200,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002781 },
2782
2783 {
2784 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2785 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2786 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002787 18000, 10, 4602600, 27000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002788 },
2789
2790 {
2791 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2792 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2793 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002794 20000, 2, 5752000, 32000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002795 },
2796};
2797
Praveen Chidambaram78499012011-11-01 17:15:17 -06002798static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2799 .levels = &msm_rpmrs_levels[0],
2800 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2801 .vdd_mem_levels = {
2802 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2803 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2804 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2805 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2806 },
2807 .vdd_dig_levels = {
2808 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
2809 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
2810 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
2811 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
2812 },
2813 .vdd_mask = 0x7FFFFF,
2814 .rpmrs_target_id = {
2815 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2816 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
2817 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
2818 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
2819 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
2820 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
2821 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2822 },
2823};
2824
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002825static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2826 .mode = MSM_PM_BOOT_CONFIG_TZ,
2827};
2828
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002829#ifdef CONFIG_I2C
2830#define I2C_SURF 1
2831#define I2C_FFA (1 << 1)
2832#define I2C_RUMI (1 << 2)
2833#define I2C_SIM (1 << 3)
2834#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03002835#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002836
2837struct i2c_registry {
2838 u8 machs;
2839 int bus;
2840 struct i2c_board_info *info;
2841 int len;
2842};
2843
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002844/* Sensors DSPS platform data */
2845#ifdef CONFIG_MSM_DSPS
2846#define DSPS_PIL_GENERIC_NAME "dsps"
2847#endif /* CONFIG_MSM_DSPS */
2848
2849static void __init msm8960_init_dsps(void)
2850{
2851#ifdef CONFIG_MSM_DSPS
2852 struct msm_dsps_platform_data *pdata =
2853 msm_dsps_device.dev.platform_data;
2854 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
2855 pdata->gpios = NULL;
2856 pdata->gpios_num = 0;
2857
2858 platform_device_register(&msm_dsps_device);
2859#endif /* CONFIG_MSM_DSPS */
2860}
2861
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -08002862static int hsic_peripheral_status = 1;
2863static DEFINE_MUTEX(hsic_status_lock);
2864
2865void peripheral_connect()
2866{
2867 mutex_lock(&hsic_status_lock);
2868 if (hsic_peripheral_status)
2869 goto out;
2870 platform_device_add(&msm_device_hsic_host);
2871 hsic_peripheral_status = 1;
2872out:
2873 mutex_unlock(&hsic_status_lock);
2874}
2875EXPORT_SYMBOL(peripheral_connect);
2876
2877void peripheral_disconnect()
2878{
2879 mutex_lock(&hsic_status_lock);
2880 if (!hsic_peripheral_status)
2881 goto out;
2882 platform_device_del(&msm_device_hsic_host);
2883 hsic_peripheral_status = 0;
2884out:
2885 mutex_unlock(&hsic_status_lock);
2886}
2887EXPORT_SYMBOL(peripheral_disconnect);
2888
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05302889static void __init msm8960_init_smsc_hub(void)
2890{
2891 uint32_t version = socinfo_get_version();
2892
2893 if (SOCINFO_VERSION_MAJOR(version) == 1)
2894 return;
2895
2896 if (machine_is_msm8960_liquid())
2897 platform_device_register(&smsc_hub_device);
2898}
2899
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002900static void __init msm8960_init_hsic(void)
2901{
2902#ifdef CONFIG_USB_EHCI_MSM_HSIC
2903 uint32_t version = socinfo_get_version();
2904
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08002905 if (SOCINFO_VERSION_MAJOR(version) == 1)
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002906 return;
2907
Joel King0cbf5d82012-05-24 15:21:38 -07002908 if (machine_is_msm8960_liquid())
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08002909 platform_device_register(&msm_device_hsic_host);
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002910#endif
2911}
2912
Amir Samuelov5137e392011-09-21 17:31:25 +03002913#ifdef CONFIG_ISL9519_CHARGER
2914static struct isl_platform_data isl_data __initdata = {
2915 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
2916 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
2917 .max_system_voltage = 4200,
2918 .min_system_voltage = 3200,
Amir Samuelov95f49ff2012-01-29 09:14:08 +02002919 .chgcurrent = 1900,
2920 .term_current = 0,
Amir Samuelov5137e392011-09-21 17:31:25 +03002921 .input_current = 2048,
2922};
2923
2924static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
2925 {
2926 I2C_BOARD_INFO("isl9519q", 0x9),
2927 .irq = 0, /* Not required when notify-by-pmic */
2928 .platform_data = &isl_data,
2929 },
2930};
2931#endif /* CONFIG_ISL9519_CHARGER */
2932
Amir Samuelov755616d2011-12-13 16:34:46 +02002933static struct i2c_board_info liquid_io_expander_i2c_info[] __initdata = {
2934 {
2935 I2C_BOARD_INFO("sx1508q", 0x20),
2936 .platform_data = &msm8960_sx150x_data[SX150X_LIQUID]
2937 },
2938};
2939
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002940static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Amir Samuelov5137e392011-09-21 17:31:25 +03002941#ifdef CONFIG_ISL9519_CHARGER
2942 {
2943 I2C_LIQUID,
2944 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2945 isl_charger_i2c_info,
2946 ARRAY_SIZE(isl_charger_i2c_info),
2947 },
2948#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002949 {
2950 I2C_SURF | I2C_FFA | I2C_FLUID,
2951 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2952 cyttsp_info,
2953 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07002954 },
Mohan Pallaka50837382011-09-07 11:00:57 +05302955 {
2956 I2C_LIQUID,
2957 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2958 mxt_device_info,
2959 ARRAY_SIZE(mxt_device_info),
2960 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05302961 {
Manoj Rao14648742012-03-30 19:42:12 -07002962 I2C_SURF | I2C_FFA | I2C_LIQUID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302963 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Eugene Yasmand2316b82011-12-07 18:23:48 +02002964 sii_device_info,
2965 ARRAY_SIZE(sii_device_info),
2966 },
2967 {
2968 I2C_LIQUID,
2969 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302970 msm_isa1200_board_info,
2971 ARRAY_SIZE(msm_isa1200_board_info),
2972 },
Amir Samuelov755616d2011-12-13 16:34:46 +02002973 {
2974 I2C_LIQUID,
2975 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2976 liquid_io_expander_i2c_info,
2977 ARRAY_SIZE(liquid_io_expander_i2c_info),
2978 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002979};
2980#endif /* CONFIG_I2C */
2981
2982static void __init register_i2c_devices(void)
2983{
2984#ifdef CONFIG_I2C
2985 u8 mach_mask = 0;
2986 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08002987#ifdef CONFIG_MSM_CAMERA
2988 struct i2c_registry msm8960_camera_i2c_devices = {
2989 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
2990 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
2991 msm8960_camera_board_info.board_info,
2992 msm8960_camera_board_info.num_i2c_board_info,
2993 };
2994#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002995
2996 /* Build the matching 'supported_machs' bitmask */
2997 if (machine_is_msm8960_cdp())
2998 mach_mask = I2C_SURF;
2999 else if (machine_is_msm8960_rumi3())
3000 mach_mask = I2C_RUMI;
3001 else if (machine_is_msm8960_sim())
3002 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07003003 else if (machine_is_msm8960_fluid())
3004 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03003005 else if (machine_is_msm8960_liquid())
3006 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07003007 else if (machine_is_msm8960_mtp())
3008 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003009 else
3010 pr_err("unmatched machine ID in register_i2c_devices\n");
3011
Jing Lineec88ca2012-02-08 11:18:30 -08003012 if (machine_is_msm8960_liquid()) {
3013 if (SOCINFO_VERSION_MAJOR(socinfo_get_platform_version()) == 3)
3014 mxt_device_info[0].platform_data =
3015 &mxt_platform_data_3d;
3016 else
3017 mxt_device_info[0].platform_data =
3018 &mxt_platform_data_2d;
3019 }
3020
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003021 /* Run the array and install devices as appropriate */
3022 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
3023 if (msm8960_i2c_devices[i].machs & mach_mask)
3024 i2c_register_board_info(msm8960_i2c_devices[i].bus,
3025 msm8960_i2c_devices[i].info,
3026 msm8960_i2c_devices[i].len);
3027 }
Kevin Chan09f4e662011-12-16 08:17:02 -08003028#ifdef CONFIG_MSM_CAMERA
3029 if (msm8960_camera_i2c_devices.machs & mach_mask)
3030 i2c_register_board_info(msm8960_camera_i2c_devices.bus,
3031 msm8960_camera_i2c_devices.info,
3032 msm8960_camera_i2c_devices.len);
3033#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003034#endif
3035}
3036
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003037static void __init msm8960_sim_init(void)
3038{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07003039 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
3040 &msm8960_device_watchdog.dev.platform_data;
3041
3042 wdog_pdata->bark_time = 15000;
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08003043 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06003044 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
3045 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003046 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07003047 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07003048 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003049 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003050
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003051 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08003052 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003053 msm8960_i2c_init();
3054 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3055 msm_spm_l2_init(msm_spm_l2_data);
3056 msm8960_init_buses();
3057 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003058 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003059 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07003060 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003061
3062 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3063 &msm8960_qup_spi_gsbi1_pdata;
3064 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
3065
3066 msm8960_init_mmc();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08003067 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003068 slim_register_board_info(msm_slim_devices,
3069 ARRAY_SIZE(msm_slim_devices));
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06003070 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06003071 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003072}
3073
3074static void __init msm8960_rumi3_init(void)
3075{
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08003076 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06003077 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
3078 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003079 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07003080 platform_device_register(&msm8960_device_rpm_regulator);
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08003081 msm8960_init_gpiomux();
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003082 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003083 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3084 &msm8960_qup_spi_gsbi1_pdata;
3085 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
3086 msm8960_i2c_init();
3087 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3088 msm_spm_l2_init(msm_spm_l2_data);
3089 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003090 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003091 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003092 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003093 register_i2c_devices();
Mayank Ranae009c922012-03-22 03:02:06 +05303094
Mayank Ranae009c922012-03-22 03:02:06 +05303095
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08003096 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003097 slim_register_board_info(msm_slim_devices,
3098 ARRAY_SIZE(msm_slim_devices));
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06003099 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06003100 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003101}
3102
3103static void __init msm8960_cdp_init(void)
3104{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07003105 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
3106 pr_err("meminfo_init() failed!\n");
3107
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08003108 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06003109 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
3110 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07003111
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003112 regulator_suppress_info_printing();
3113 if (msm_xo_init())
3114 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07003115 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07003116 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05303117 if (machine_is_msm8960_liquid())
3118 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003119 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05303120 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
3121 machine_is_msm8960_cdp()) {
3122 msm_otg_pdata.phy_init_seq = wr_phy_init_seq;
3123 } else if (machine_is_msm8960_liquid()) {
3124 msm_otg_pdata.phy_init_seq =
3125 liquid_v1_phy_init_seq;
3126 }
Ofir Cohen94213a72012-05-03 14:26:32 +03003127 android_usb_pdata.swfi_latency =
Anji jonnalaa7c1c5c2011-12-12 12:20:36 +05303128 msm_rpmrs_levels[0].latency_us;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303129 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303130 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2 &&
3131 machine_is_msm8960_liquid())
3132 msm_device_hsic_host.dev.parent = &smsc_hub_device.dev;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08003133 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003134 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3135 &msm8960_qup_spi_gsbi1_pdata;
3136 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003137
3138 msm8960_init_pmic();
Mohan Pallakaf69f0492011-11-21 13:08:33 +05303139 if ((SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2 &&
3140 (machine_is_msm8960_mtp())) || machine_is_msm8960_liquid())
3141 msm_isa1200_board_info[0].platform_data = &isa1200_1_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003142 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003143 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003144 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3145 msm_spm_l2_init(msm_spm_l2_data);
3146 msm8960_init_buses();
Matt Wagantall1f65d9d2012-04-25 14:24:20 -07003147 platform_add_devices(msm8960_footswitch, msm8960_num_footswitch);
David Collinsb10be1d2011-09-02 10:29:31 -07003148 if (machine_is_msm8960_liquid())
3149 platform_device_register(&msm8960_device_ext_3p3v_vreg);
David Collinsd5a40732011-11-29 15:53:56 -08003150 if (machine_is_msm8960_cdp())
3151 platform_device_register(&msm8960_device_ext_l2_vreg);
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07003152
3153 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
3154 platform_device_register(&msm8960_device_uart_gsbi8);
3155 else
3156 platform_device_register(&msm8960_device_uart_gsbi5);
3157
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003158 /* For 8960 Fusion 2.2 Primary IPC */
Mayank Ranad85a5082012-04-29 17:24:13 -07003159 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE) {
3160 msm_uart_dm9_pdata.wakeup_irq = gpio_to_irq(94); /* GSBI9(2) */
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003161 msm_device_uart_dm9.dev.platform_data = &msm_uart_dm9_pdata;
Mayank Ranad85a5082012-04-29 17:24:13 -07003162 }
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003163
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003164 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003165 msm8960_pm8921_gpio_mpp_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003166 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303167 msm8960_init_smsc_hub();
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003168 msm8960_init_hsic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003169 msm8960_init_cam();
3170 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07003171 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05303172 if (machine_is_msm8960_liquid())
3173 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003174 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08003175 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003176 slim_register_board_info(msm_slim_devices,
3177 ARRAY_SIZE(msm_slim_devices));
3178 msm8960_init_dsps();
Larry Bassela7eadea2011-07-14 10:46:00 -07003179 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06003180 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06003181 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Joel King0cbf5d82012-05-24 15:21:38 -07003182 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE) {
3183 mdm_sglte_device.dev.platform_data = &sglte_platform_data;
3184 platform_device_register(&mdm_sglte_device);
3185 }
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003186}
3187
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003188MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
3189 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003190 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003191 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303192 .handle_irq = gic_handle_irq,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003193 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003194 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003195 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003196 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003197MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003198
3199MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
3200 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003201 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003202 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303203 .handle_irq = gic_handle_irq,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003204 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003205 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003206 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003207 .init_very_early = msm8960_early_memory,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003208MACHINE_END
3209
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003210MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
3211 .map_io = msm8960_map_io,
3212 .reserve = msm8960_reserve,
3213 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303214 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003215 .timer = &msm_timer,
3216 .init_machine = msm8960_cdp_init,
3217 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003218 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003219MACHINE_END
3220
3221MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
3222 .map_io = msm8960_map_io,
3223 .reserve = msm8960_reserve,
3224 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303225 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003226 .timer = &msm_timer,
3227 .init_machine = msm8960_cdp_init,
3228 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003229 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003230MACHINE_END
3231
3232MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
3233 .map_io = msm8960_map_io,
3234 .reserve = msm8960_reserve,
3235 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303236 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003237 .timer = &msm_timer,
3238 .init_machine = msm8960_cdp_init,
3239 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003240 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003241MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003242
3243MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
3244 .map_io = msm8960_map_io,
3245 .reserve = msm8960_reserve,
3246 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303247 .handle_irq = gic_handle_irq,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003248 .timer = &msm_timer,
3249 .init_machine = msm8960_cdp_init,
3250 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003251 .init_very_early = msm8960_early_memory,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003252MACHINE_END