blob: 0a5e37005d0f412d0fdb7b45b429cce1177e775f [file] [log] [blame]
Abhijeet Dharmapurikar7e37e6e2012-08-23 18:58:44 -07001/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080012 */
13#include <linux/kernel.h>
14#include <linux/platform_device.h>
15#include <linux/io.h>
16#include <linux/irq.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070017#include <linux/i2c.h>
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -070018#include <linux/i2c/sx150x.h>
Amir Samuelov5137e392011-09-21 17:31:25 +030019#include <linux/i2c/isl9519.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070020#include <linux/gpio.h>
21#include <linux/msm_ssbi.h>
Steve Mucklef132c6c2012-06-06 18:30:57 -070022#include <linux/regulator/msm-gpio-regulator.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070023#include <linux/mfd/pm8xxx/pm8921.h>
Siddartha Mohanadossaf91d902011-10-20 10:23:34 -070024#include <linux/mfd/pm8xxx/pm8xxx-adc.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070025#include <linux/regulator/consumer.h>
26#include <linux/spi/spi.h>
27#include <linux/slimbus/slimbus.h>
28#include <linux/bootmem.h>
29#ifdef CONFIG_ANDROID_PMEM
30#include <linux/android_pmem.h>
31#endif
Steve Mucklef132c6c2012-06-06 18:30:57 -070032#include <linux/cyttsp-qc.h>
Laura Abbott354d40f2012-08-03 17:32:09 -070033#include <linux/dma-contiguous.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070034#include <linux/dma-mapping.h>
35#include <linux/platform_data/qcom_crypto_device.h>
Ankur Nandwanib0039b02011-08-09 14:00:45 -070036#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070037#include <linux/leds.h>
38#include <linux/leds-pm8xxx.h>
Mohan Pallaka50837382011-09-07 11:00:57 +053039#include <linux/i2c/atmel_mxt_ts.h>
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -070040#include <linux/msm_tsens.h>
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -070041#include <linux/ks8851.h>
Mohan Pallaka5e490392011-09-09 15:18:41 +053042#include <linux/i2c/isa1200.h>
Jack Cheung0b1987e2011-11-18 13:36:29 -080043#include <linux/memory.h>
Larry Bassel2d8b42d2012-03-12 10:41:26 -070044#include <linux/memblock.h>
Praveen Chidambaram877d7a42012-06-05 14:33:20 -060045#include <linux/msm_thermal.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080046
47#include <asm/mach-types.h>
48#include <asm/mach/arch.h>
Larry Basselb4126da2011-07-18 14:31:33 -070049#include <asm/setup.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080050#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070051#include <asm/mach/mmc.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080052
53#include <mach/board.h>
Joel Nider266a2642011-10-16 10:58:05 +020054#include <mach/msm_tspp.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080055#include <mach/msm_iomap.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070056#include <mach/msm_spi.h>
Mayank Ranae009c922012-03-22 03:02:06 +053057#include <mach/msm_serial_hs.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070058#ifdef CONFIG_USB_MSM_OTG_72K
59#include <mach/msm_hsusb.h>
60#else
61#include <linux/usb/msm_hsusb.h>
62#endif
63#include <linux/usb/android.h>
64#include <mach/usbdiag.h>
65#include <mach/socinfo.h>
66#include <mach/rpm.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>
Mitchel Humpherys9dc32cf2012-09-06 11:34:03 -070081#include <linux/msm_ion.h>
Laura Abbottd6183792011-08-19 13:42:24 -070082#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
Jordan Crouse914de9b2012-07-09 13:49:46 -060090#include <mach/kgsl.h>
Larry Bassel41a055b2011-12-06 16:15:14 -080091#include <linux/fmem.h>
92
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070093#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080094#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070095#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070096#include "spm.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080097#include "board-8960.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080098#include "pm.h"
Abhijeet Dharmapurikarefaca4f2011-12-27 16:24:07 -080099#include <mach/cpuidle.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700100#include "rpm_resources.h"
Subhash Jadavani909e04f2012-04-12 10:52:50 +0530101#include <mach/mpm.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
Ming-yi Lin2d43cd52012-10-17 11:50:15 +0800106#if defined(CONFIG_BT) && defined(CONFIG_BT_HCIUART_ATH3K)
107#include <linux/wlan_plat.h>
108#include <linux/mutex.h>
109#endif
110
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700111static struct platform_device msm_fm_platform_init = {
112 .name = "iris_fm",
113 .id = -1,
114};
115
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700116#define KS8851_RST_GPIO 89
117#define KS8851_IRQ_GPIO 90
Mohan Pallaka5e490392011-09-09 15:18:41 +0530118
Manoj Rao14648742012-03-30 19:42:12 -0700119#define MHL_GPIO_INT 4
120#define MHL_GPIO_RESET 15
121
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700122#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700123
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800124struct sx150x_platform_data msm8960_sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700125 [SX150X_CAM] = {
126 .gpio_base = GPIO_CAM_EXPANDER_BASE,
127 .oscio_is_gpo = false,
128 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530129 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700130 .io_open_drain_ena = 0x0,
131 .irq_summary = -1,
132 },
Amir Samuelov755616d2011-12-13 16:34:46 +0200133 [SX150X_LIQUID] = {
134 .gpio_base = GPIO_LIQUID_EXPANDER_BASE,
135 .oscio_is_gpo = false,
136 .io_pullup_ena = 0x0c08,
137 .io_pulldn_ena = 0x4060,
138 .io_open_drain_ena = 0x000c,
139 .io_polarity = 0,
140 .irq_summary = -1,
141 },
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700142};
Nishant Pandit474f2252011-07-23 23:17:56 +0530143
144#endif
145
Olav Haugana21169d2012-01-04 09:17:06 -0800146#define MSM_PMEM_ADSP_SIZE 0x7800000
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -0700147#define MSM_PMEM_AUDIO_SIZE 0x4CF000
Mathew Karimpanal15fa5c42011-12-14 21:28:10 -0800148#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800149#define MSM_LIQUID_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800150#define MSM_HDMI_PRIM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Laura Abbott2d1760b2011-09-29 21:31:24 -0700151
152#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Deepak Kotur35825522012-06-06 15:49:14 -0700153#define HOLE_SIZE 0x20000
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700154#define MSM_CONTIG_MEM_SIZE 0x65000
Olav Haugan32594552012-03-13 11:40:05 -0700155#ifdef CONFIG_MSM_IOMMU
Olav Haugan8726caf2012-05-10 15:11:35 -0700156#define MSM_ION_MM_SIZE 0x3800000 /* Need to be multiple of 64K */
Olav Haugan32594552012-03-13 11:40:05 -0700157#define MSM_ION_SF_SIZE 0x0
Olav Hauganfbbf05b2012-04-05 14:33:41 -0700158#define MSM_ION_QSECOM_SIZE 0x780000 /* (7.5MB) */
Olav Haugan32594552012-03-13 11:40:05 -0700159#define MSM_ION_HEAP_NUM 7
160#else
161#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
162#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Hauganfbbf05b2012-04-05 14:33:41 -0700163#define MSM_ION_QSECOM_SIZE 0x600000 /* (6MB) */
Olav Haugan32594552012-03-13 11:40:05 -0700164#define MSM_ION_HEAP_NUM 8
165#endif
Deepak Kotur35825522012-06-06 15:49:14 -0700166#define MSM_ION_MM_FW_SIZE (0x200000 - HOLE_SIZE) /* 128kb */
Olav Hauganb5be7992011-11-18 14:29:02 -0800167#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan7355db02012-01-13 16:59:13 -0800168#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Olav Haugan32594552012-03-13 11:40:05 -0700169
Olav Hauganb5be7992011-11-18 14:29:02 -0800170#define MSM_LIQUID_ION_MM_SIZE (MSM_ION_MM_SIZE + 0x600000)
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800171#define MSM_LIQUID_ION_SF_SIZE MSM_LIQUID_PMEM_SIZE
172#define MSM_HDMI_PRIM_ION_SF_SIZE MSM_HDMI_PRIM_PMEM_SIZE
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700173
Deepak Kotur35825522012-06-06 15:49:14 -0700174#define MSM_MM_FW_SIZE (0x200000 - HOLE_SIZE) /* 2mb -128kb*/
175#define MSM8960_FIXED_AREA_START (0xa0000000 - (MSM_ION_MM_FW_SIZE + \
176 HOLE_SIZE))
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700177#define MAX_FIXED_AREA_SIZE 0x10000000
Deepak Kotur35825522012-06-06 15:49:14 -0700178#define MSM8960_FW_START MSM8960_FIXED_AREA_START
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700179
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800180static unsigned msm_ion_sf_size = MSM_ION_SF_SIZE;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700181#else
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700182#define MSM_CONTIG_MEM_SIZE 0x110C000
Olav Hauganb5be7992011-11-18 14:29:02 -0800183#define MSM_ION_HEAP_NUM 1
Laura Abbott2d1760b2011-09-29 21:31:24 -0700184#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700185
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700186#ifdef CONFIG_KERNEL_MSM_CONTIG_MEM_REGION
187static unsigned msm_contig_mem_size = MSM_CONTIG_MEM_SIZE;
188static int __init msm_contig_mem_size_setup(char *p)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700189{
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700190 msm_contig_mem_size = memparse(p, NULL);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700191 return 0;
192}
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700193early_param("msm_contig_mem_size", msm_contig_mem_size_setup);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700194#endif
195
196#ifdef CONFIG_ANDROID_PMEM
197static unsigned pmem_size = MSM_PMEM_SIZE;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800198static unsigned pmem_param_set;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700199static int __init pmem_size_setup(char *p)
200{
201 pmem_size = memparse(p, NULL);
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800202 pmem_param_set = 1;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700203 return 0;
204}
205early_param("pmem_size", pmem_size_setup);
206
207static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
208
209static int __init pmem_adsp_size_setup(char *p)
210{
211 pmem_adsp_size = memparse(p, NULL);
212 return 0;
213}
214early_param("pmem_adsp_size", pmem_adsp_size_setup);
215
216static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
217
218static int __init pmem_audio_size_setup(char *p)
219{
220 pmem_audio_size = memparse(p, NULL);
221 return 0;
222}
223early_param("pmem_audio_size", pmem_audio_size_setup);
224#endif
225
226#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700227#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700228static struct android_pmem_platform_data android_pmem_pdata = {
229 .name = "pmem",
230 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
231 .cached = 1,
232 .memory_type = MEMTYPE_EBI1,
233};
234
Laura Abbottb93525f2012-04-12 09:57:19 -0700235static struct platform_device msm8960_android_pmem_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700236 .name = "android_pmem",
237 .id = 0,
238 .dev = {.platform_data = &android_pmem_pdata},
239};
240
241static struct android_pmem_platform_data android_pmem_adsp_pdata = {
242 .name = "pmem_adsp",
243 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
244 .cached = 0,
245 .memory_type = MEMTYPE_EBI1,
246};
Laura Abbottb93525f2012-04-12 09:57:19 -0700247static struct platform_device msm8960_android_pmem_adsp_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700248 .name = "android_pmem",
249 .id = 2,
250 .dev = { .platform_data = &android_pmem_adsp_pdata },
251};
252
253static struct android_pmem_platform_data android_pmem_audio_pdata = {
254 .name = "pmem_audio",
255 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
256 .cached = 0,
257 .memory_type = MEMTYPE_EBI1,
258};
259
Laura Abbottb93525f2012-04-12 09:57:19 -0700260static struct platform_device msm8960_android_pmem_audio_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700261 .name = "android_pmem",
262 .id = 4,
263 .dev = { .platform_data = &android_pmem_audio_pdata },
264};
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700265#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
266#endif /*CONFIG_ANDROID_PMEM*/
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700267
Laura Abbottb93525f2012-04-12 09:57:19 -0700268struct fmem_platform_data msm8960_fmem_pdata = {
Larry Bassel41a055b2011-12-06 16:15:14 -0800269};
270
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700271#define DSP_RAM_BASE_8960 0x8da00000
272#define DSP_RAM_SIZE_8960 0x1800000
273static int dspcrashd_pdata_8960 = 0xDEADDEAD;
274
275static struct resource resources_dspcrashd_8960[] = {
276 {
277 .name = "msm_dspcrashd",
278 .start = DSP_RAM_BASE_8960,
279 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
280 .flags = IORESOURCE_DMA,
281 },
282};
283
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800284static struct platform_device msm_device_dspcrashd_8960 = {
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700285 .name = "msm_dspcrashd",
286 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
287 .resource = resources_dspcrashd_8960,
288 .dev = { .platform_data = &dspcrashd_pdata_8960 },
289};
290
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700291static struct memtype_reserve msm8960_reserve_table[] __initdata = {
292 [MEMTYPE_SMI] = {
293 },
294 [MEMTYPE_EBI0] = {
295 .flags = MEMTYPE_FLAGS_1M_ALIGN,
296 },
297 [MEMTYPE_EBI1] = {
298 .flags = MEMTYPE_FLAGS_1M_ALIGN,
299 },
300};
301
Laura Abbottf8c03b92012-02-16 14:57:58 -0800302static void __init reserve_rtb_memory(void)
303{
304#if defined(CONFIG_MSM_RTB)
Laura Abbottb93525f2012-04-12 09:57:19 -0700305 msm8960_reserve_table[MEMTYPE_EBI1].size += msm8960_rtb_pdata.size;
Laura Abbottf8c03b92012-02-16 14:57:58 -0800306#endif
307}
308
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700309static void __init size_pmem_devices(void)
310{
311#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700312#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700313 android_pmem_adsp_pdata.size = pmem_adsp_size;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800314
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800315 if (!pmem_param_set) {
316 if (machine_is_msm8960_liquid())
317 pmem_size = MSM_LIQUID_PMEM_SIZE;
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700318 if (msm8960_hdmi_as_primary_selected())
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800319 pmem_size = MSM_HDMI_PRIM_PMEM_SIZE;
320 }
321
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700322 android_pmem_pdata.size = pmem_size;
323 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700324#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
325#endif /*CONFIG_ANDROID_PMEM*/
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700326}
327
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700328#ifdef CONFIG_ANDROID_PMEM
329#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700330static void __init reserve_memory_for(struct android_pmem_platform_data *p)
331{
332 msm8960_reserve_table[p->memory_type].size += p->size;
333}
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700334#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
335#endif /*CONFIG_ANDROID_PMEM*/
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700336
337static void __init reserve_pmem_memory(void)
338{
339#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700340#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700341 reserve_memory_for(&android_pmem_adsp_pdata);
342 reserve_memory_for(&android_pmem_pdata);
343 reserve_memory_for(&android_pmem_audio_pdata);
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700344#endif
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700345 msm8960_reserve_table[MEMTYPE_EBI1].size += msm_contig_mem_size;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700346#endif
347}
348
Larry Basselb4126da2011-07-18 14:31:33 -0700349static int msm8960_paddr_to_memtype(unsigned int paddr)
350{
351 return MEMTYPE_EBI1;
352}
353
Steve Mucklef132c6c2012-06-06 18:30:57 -0700354#define FMEM_ENABLED 0
Olav Hauganf6dc7742012-02-15 09:11:55 -0800355
Laura Abbottd6183792011-08-19 13:42:24 -0700356#ifdef CONFIG_ION_MSM
Olav Haugan0703dbf2011-12-19 17:53:38 -0800357#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -0700358static struct ion_cp_heap_pdata cp_mm_msm8960_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800359 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugan8726caf2012-05-10 15:11:35 -0700360 .align = SZ_64K,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800361 .reusable = FMEM_ENABLED,
362 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700363 .fixed_position = FIXED_MIDDLE,
Olav Haugan8726caf2012-05-10 15:11:35 -0700364 .iommu_map_all = 1,
365 .iommu_2x_map_domain = VIDEO_DOMAIN,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800366};
367
Laura Abbottb93525f2012-04-12 09:57:19 -0700368static struct ion_cp_heap_pdata cp_mfc_msm8960_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800369 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugan42ebe712012-01-10 16:30:58 -0800370 .align = PAGE_SIZE,
Olav Haugan65f4bd82011-12-13 11:50:08 -0800371 .reusable = 0,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800372 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700373 .fixed_position = FIXED_HIGH,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800374};
375
Laura Abbottb93525f2012-04-12 09:57:19 -0700376static struct ion_co_heap_pdata co_msm8960_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800377 .adjacent_mem_id = INVALID_HEAP_ID,
378 .align = PAGE_SIZE,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800379 .mem_is_fmem = 0,
Olav Haugan42ebe712012-01-10 16:30:58 -0800380};
381
Laura Abbottb93525f2012-04-12 09:57:19 -0700382static struct ion_co_heap_pdata fw_co_msm8960_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800383 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
384 .align = SZ_128K,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800385 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700386 .fixed_position = FIXED_LOW,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800387};
388#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800389
Laura Abbott354d40f2012-08-03 17:32:09 -0700390static u64 msm_dmamask = DMA_BIT_MASK(32);
391
392static struct platform_device ion_mm_heap_device = {
393 .name = "ion-mm-heap-device",
394 .id = -1,
395 .dev = {
396 .dma_mask = &msm_dmamask,
397 .coherent_dma_mask = DMA_BIT_MASK(32),
398 }
399};
400
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800401/**
402 * These heaps are listed in the order they will be allocated. Due to
403 * video hardware restrictions and content protection the FW heap has to
404 * be allocated adjacent (below) the MM heap and the MFC heap has to be
405 * allocated after the MM heap to ensure MFC heap is not more than 256MB
406 * away from the base address of the FW heap.
407 * However, the order of FW heap and MM heap doesn't matter since these
408 * two heaps are taken care of by separate code to ensure they are adjacent
409 * to each other.
410 * Don't swap the order unless you know what you are doing!
411 */
Benjamin Gaignardb2d367c2012-06-25 15:27:30 -0700412struct ion_platform_heap msm8960_heaps[] = {
Laura Abbottd6183792011-08-19 13:42:24 -0700413 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800414 .id = ION_SYSTEM_HEAP_ID,
Laura Abbottd6183792011-08-19 13:42:24 -0700415 .type = ION_HEAP_TYPE_SYSTEM,
Laura Abbottd6183792011-08-19 13:42:24 -0700416 .name = ION_VMALLOC_HEAP_NAME,
417 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700418#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -0700419 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800420 .id = ION_CP_MM_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800421 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800422 .name = ION_MM_HEAP_NAME,
423 .size = MSM_ION_MM_SIZE,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700424 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700425 .extra_data = (void *) &cp_mm_msm8960_ion_pdata,
Laura Abbott354d40f2012-08-03 17:32:09 -0700426 .priv = &ion_mm_heap_device.dev,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700427 },
Laura Abbott8c017362011-09-22 20:59:12 -0700428 {
Olav Haugan42ebe712012-01-10 16:30:58 -0800429 .id = ION_MM_FIRMWARE_HEAP_ID,
430 .type = ION_HEAP_TYPE_CARVEOUT,
431 .name = ION_MM_FIRMWARE_HEAP_NAME,
432 .size = MSM_ION_MM_FW_SIZE,
433 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700434 .extra_data = (void *) &fw_co_msm8960_ion_pdata,
Olav Haugan42ebe712012-01-10 16:30:58 -0800435 },
436 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800437 .id = ION_CP_MFC_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800438 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800439 .name = ION_MFC_HEAP_NAME,
440 .size = MSM_ION_MFC_SIZE,
441 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700442 .extra_data = (void *) &cp_mfc_msm8960_ion_pdata,
Olav Hauganb5be7992011-11-18 14:29:02 -0800443 },
Olav Haugan32594552012-03-13 11:40:05 -0700444#ifndef CONFIG_MSM_IOMMU
Olav Hauganb5be7992011-11-18 14:29:02 -0800445 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800446 .id = ION_SF_HEAP_ID,
447 .type = ION_HEAP_TYPE_CARVEOUT,
448 .name = ION_SF_HEAP_NAME,
449 .size = MSM_ION_SF_SIZE,
450 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700451 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800452 },
Olav Haugan32594552012-03-13 11:40:05 -0700453#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800454 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800455 .id = ION_IOMMU_HEAP_ID,
Laura Abbott8c017362011-09-22 20:59:12 -0700456 .type = ION_HEAP_TYPE_IOMMU,
457 .name = ION_IOMMU_HEAP_NAME,
458 },
Olav Haugan80854eb2012-01-12 12:00:23 -0800459 {
460 .id = ION_QSECOM_HEAP_ID,
461 .type = ION_HEAP_TYPE_CARVEOUT,
462 .name = ION_QSECOM_HEAP_NAME,
463 .size = MSM_ION_QSECOM_SIZE,
464 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700465 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan80854eb2012-01-12 12:00:23 -0800466 },
Olav Haugan7355db02012-01-13 16:59:13 -0800467 {
468 .id = ION_AUDIO_HEAP_ID,
469 .type = ION_HEAP_TYPE_CARVEOUT,
470 .name = ION_AUDIO_HEAP_NAME,
471 .size = MSM_ION_AUDIO_SIZE,
472 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700473 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan7355db02012-01-13 16:59:13 -0800474 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700475#endif
Benjamin Gaignardb2d367c2012-06-25 15:27:30 -0700476};
477
478static struct ion_platform_data msm8960_ion_pdata = {
479 .nr = MSM_ION_HEAP_NUM,
480 .heaps = msm8960_heaps,
Laura Abbottd6183792011-08-19 13:42:24 -0700481};
482
Laura Abbottb93525f2012-04-12 09:57:19 -0700483static struct platform_device msm8960_ion_dev = {
Laura Abbottd6183792011-08-19 13:42:24 -0700484 .name = "ion-msm",
485 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700486 .dev = { .platform_data = &msm8960_ion_pdata },
Laura Abbottd6183792011-08-19 13:42:24 -0700487};
488#endif
489
Laura Abbottb93525f2012-04-12 09:57:19 -0700490struct platform_device msm8960_fmem_device = {
Larry Bassel41a055b2011-12-06 16:15:14 -0800491 .name = "fmem",
492 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700493 .dev = { .platform_data = &msm8960_fmem_pdata },
Larry Bassel41a055b2011-12-06 16:15:14 -0800494};
495
Olav Haugan65f4bd82011-12-13 11:50:08 -0800496static void __init adjust_mem_for_liquid(void)
Laura Abbottd6183792011-08-19 13:42:24 -0700497{
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800498 unsigned int i;
499
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800500 if (!pmem_param_set) {
501 if (machine_is_msm8960_liquid())
502 msm_ion_sf_size = MSM_LIQUID_ION_SF_SIZE;
503
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700504 if (msm8960_hdmi_as_primary_selected())
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800505 msm_ion_sf_size = MSM_HDMI_PRIM_ION_SF_SIZE;
506
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700507 if (machine_is_msm8960_liquid() ||
508 msm8960_hdmi_as_primary_selected()) {
Laura Abbottb93525f2012-04-12 09:57:19 -0700509 for (i = 0; i < msm8960_ion_pdata.nr; i++) {
510 if (msm8960_ion_pdata.heaps[i].id ==
511 ION_SF_HEAP_ID) {
512 msm8960_ion_pdata.heaps[i].size =
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800513 msm_ion_sf_size;
514 pr_debug("msm_ion_sf_size 0x%x\n",
515 msm_ion_sf_size);
516 break;
517 }
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800518 }
519 }
520 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800521}
522
523static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
524 unsigned long size)
525{
526 msm8960_reserve_table[mem_type].size += size;
527}
528
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700529static void __init msm8960_reserve_fixed_area(unsigned long fixed_area_size)
530{
531#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
532 int ret;
533
534 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
535 panic("fixed area size is larger than %dM\n",
536 MAX_FIXED_AREA_SIZE >> 20);
537
538 reserve_info->fixed_area_size = fixed_area_size;
539 reserve_info->fixed_area_start = MSM8960_FW_START;
540
541 ret = memblock_remove(reserve_info->fixed_area_start,
542 reserve_info->fixed_area_size);
543 BUG_ON(ret);
544#endif
545}
546
Olav Haugan65f4bd82011-12-13 11:50:08 -0800547/**
548 * Reserve memory for ION and calculate amount of reusable memory for fmem.
549 * We only reserve memory for heaps that are not reusable. However, we only
550 * support one reusable heap at the moment so we ignore the reusable flag for
551 * other than the first heap with reusable flag set. Also handle special case
Olav Hauganf6dc7742012-02-15 09:11:55 -0800552 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
553 * at a higher address than FW in addition to not more than 256MB away from the
554 * base address of the firmware. This means that if MM is reusable the other
555 * two heaps must be allocated in the same region as FW. This is handled by the
556 * mem_is_fmem flag in the platform data. In addition the MM heap must be
557 * adjacent to the FW heap for content protection purposes.
Olav Haugan65f4bd82011-12-13 11:50:08 -0800558 */
559static void __init reserve_ion_memory(void)
560{
561#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
562 unsigned int i;
Laura Abbott354d40f2012-08-03 17:32:09 -0700563 int ret;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700564 unsigned int fixed_size = 0;
565 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
566 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
Laura Abbott354d40f2012-08-03 17:32:09 -0700567 unsigned long cma_alignment;
568 unsigned int low_use_cma = 0;
569 unsigned int middle_use_cma = 0;
570 unsigned int high_use_cma = 0;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800571
572 adjust_mem_for_liquid();
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700573 fixed_low_size = 0;
574 fixed_middle_size = 0;
575 fixed_high_size = 0;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800576
Laura Abbott354d40f2012-08-03 17:32:09 -0700577 cma_alignment = PAGE_SIZE << max(MAX_ORDER, pageblock_order);
578
Laura Abbottb93525f2012-04-12 09:57:19 -0700579 for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
Olav Haugan8726caf2012-05-10 15:11:35 -0700580 struct ion_platform_heap *heap =
Laura Abbottb93525f2012-04-12 09:57:19 -0700581 &(msm8960_ion_pdata.heaps[i]);
Olav Haugan8726caf2012-05-10 15:11:35 -0700582 int align = SZ_4K;
583 int iommu_map_all = 0;
584 int adjacent_mem_id = INVALID_HEAP_ID;
Laura Abbott354d40f2012-08-03 17:32:09 -0700585 int use_cma = 0;
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;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700589
Mitchel Humpherysdc4d01d2012-09-13 10:53:22 -0700590 switch ((int) heap->type) {
Olav Haugan65f4bd82011-12-13 11:50:08 -0800591 case ION_HEAP_TYPE_CP:
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700592 fixed_position = ((struct ion_cp_heap_pdata *)
593 heap->extra_data)->fixed_position;
Olav Haugan8726caf2012-05-10 15:11:35 -0700594 align = ((struct ion_cp_heap_pdata *)
595 heap->extra_data)->align;
596 iommu_map_all =
597 ((struct ion_cp_heap_pdata *)
598 heap->extra_data)->iommu_map_all;
Laura Abbott354d40f2012-08-03 17:32:09 -0700599 if (((struct ion_cp_heap_pdata *)
600 heap->extra_data)->is_cma) {
601 heap->size = ALIGN(heap->size,
602 cma_alignment);
603 use_cma = 1;
604 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800605 break;
Laura Abbott354d40f2012-08-03 17:32:09 -0700606 case ION_HEAP_TYPE_DMA:
607 use_cma = 1;
608 /* Purposely fall through here */
Olav Haugan65f4bd82011-12-13 11:50:08 -0800609 case ION_HEAP_TYPE_CARVEOUT:
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700610 fixed_position = ((struct ion_co_heap_pdata *)
611 heap->extra_data)->fixed_position;
Olav Haugan8726caf2012-05-10 15:11:35 -0700612 adjacent_mem_id = ((struct ion_co_heap_pdata *)
613 heap->extra_data)->adjacent_mem_id;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700614 break;
615 default:
616 break;
617 }
618
Olav Haugan8726caf2012-05-10 15:11:35 -0700619 if (iommu_map_all) {
620 if (heap->size & (SZ_64K-1)) {
621 heap->size = ALIGN(heap->size, SZ_64K);
622 pr_info("Heap %s not aligned to 64K. Adjusting size to %x\n",
623 heap->name, heap->size);
624 }
625 }
626
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700627 if (fixed_position != NOT_FIXED)
628 fixed_size += heap->size;
629 else
630 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
631
Laura Abbott354d40f2012-08-03 17:32:09 -0700632 if (fixed_position == FIXED_LOW) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700633 fixed_low_size += heap->size;
Laura Abbott354d40f2012-08-03 17:32:09 -0700634 low_use_cma = use_cma;
635 } else if (fixed_position == FIXED_MIDDLE) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700636 fixed_middle_size += heap->size;
Laura Abbott354d40f2012-08-03 17:32:09 -0700637 middle_use_cma = use_cma;
638 } else if (fixed_position == FIXED_HIGH) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700639 fixed_high_size += heap->size;
Laura Abbott354d40f2012-08-03 17:32:09 -0700640 high_use_cma = use_cma;
641 } else if (use_cma) {
642 /*
643 * Heaps that use CMA but are not part of the
644 * fixed set. Create wherever.
645 */
646 dma_declare_contiguous(
647 heap->priv,
648 heap->size,
649 0,
650 0xb0000000);
651 }
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700652 }
653 }
654
655 if (!fixed_size)
656 return;
657
Laura Abbott354d40f2012-08-03 17:32:09 -0700658 /*
659 * Given the setup for the fixed area, we can't round up all sizes.
660 * Some sizes must be set up exactly and aligned correctly. Incorrect
661 * alignments are considered a configuration issue
Larry Bassel4d4f4482012-04-04 11:26:09 -0700662 */
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700663
664 fixed_low_start = MSM8960_FIXED_AREA_START;
Laura Abbott354d40f2012-08-03 17:32:09 -0700665 if (low_use_cma) {
666 BUG_ON(!IS_ALIGNED(fixed_low_start, cma_alignment));
667 BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, cma_alignment));
668 } else {
669 BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, SECTION_SIZE));
670 ret = memblock_remove(fixed_low_start,
671 fixed_low_size + HOLE_SIZE);
672 BUG_ON(ret);
673 }
674
Deepak Kotur35825522012-06-06 15:49:14 -0700675 fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE;
Laura Abbott354d40f2012-08-03 17:32:09 -0700676 if (middle_use_cma) {
677 BUG_ON(!IS_ALIGNED(fixed_middle_start, cma_alignment));
678 BUG_ON(!IS_ALIGNED(fixed_middle_size, cma_alignment));
679 } else {
680 BUG_ON(!IS_ALIGNED(fixed_middle_size, SECTION_SIZE));
681 ret = memblock_remove(fixed_middle_start, fixed_middle_size);
682 BUG_ON(ret);
683 }
684
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700685 fixed_high_start = fixed_middle_start + fixed_middle_size;
Laura Abbott354d40f2012-08-03 17:32:09 -0700686 if (high_use_cma) {
687 fixed_high_size = ALIGN(fixed_high_size, cma_alignment);
688 BUG_ON(!IS_ALIGNED(fixed_high_start, cma_alignment));
689 } else {
690 /* This is the end of the fixed area so it's okay to round up */
691 fixed_high_size = ALIGN(fixed_high_size, SECTION_SIZE);
692 ret = memblock_remove(fixed_high_start, fixed_high_size);
693 BUG_ON(ret);
694 }
695
696
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700697
Laura Abbottb93525f2012-04-12 09:57:19 -0700698 for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
699 struct ion_platform_heap *heap = &(msm8960_ion_pdata.heaps[i]);
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700700
701 if (heap->extra_data) {
702 int fixed_position = NOT_FIXED;
Steve Muckle75c34ca2012-06-12 14:27:40 -0700703 struct ion_cp_heap_pdata *pdata = NULL;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700704
Mitchel Humpherysdc4d01d2012-09-13 10:53:22 -0700705 switch ((int) heap->type) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700706 case ION_HEAP_TYPE_CP:
Deepak Kotur35825522012-06-06 15:49:14 -0700707 pdata =
708 (struct ion_cp_heap_pdata *)heap->extra_data;
709 fixed_position = pdata->fixed_position;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700710 break;
711 case ION_HEAP_TYPE_CARVEOUT:
Laura Abbott354d40f2012-08-03 17:32:09 -0700712 case ION_HEAP_TYPE_DMA:
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700713 fixed_position = ((struct ion_co_heap_pdata *)
714 heap->extra_data)->fixed_position;
715 break;
716 default:
717 break;
718 }
719
720 switch (fixed_position) {
721 case FIXED_LOW:
722 heap->base = fixed_low_start;
723 break;
724 case FIXED_MIDDLE:
725 heap->base = fixed_middle_start;
Laura Abbott354d40f2012-08-03 17:32:09 -0700726 if (middle_use_cma) {
727 ret = dma_declare_contiguous(
728 &ion_mm_heap_device.dev,
729 heap->size,
730 fixed_middle_start,
731 0xa0000000);
732 WARN_ON(ret);
733 }
Deepak Kotur35825522012-06-06 15:49:14 -0700734 pdata->secure_base = fixed_middle_start
735 - HOLE_SIZE;
736 pdata->secure_size = HOLE_SIZE + heap->size;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700737 break;
738 case FIXED_HIGH:
739 heap->base = fixed_high_start;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800740 break;
741 default:
742 break;
743 }
744 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800745 }
Laura Abbottd6183792011-08-19 13:42:24 -0700746#endif
747}
Huaibin Yanga5419422011-12-08 23:52:10 -0800748
749static void __init reserve_mdp_memory(void)
750{
751 msm8960_mdp_writeback(msm8960_reserve_table);
752}
753
Stephen Boyd668d7652012-04-25 11:31:01 -0700754static void __init reserve_cache_dump_memory(void)
Laura Abbott306bcc22012-03-08 11:24:53 -0800755{
756#ifdef CONFIG_MSM_CACHE_DUMP
Laura Abbott306bcc22012-03-08 11:24:53 -0800757 unsigned int total;
Laura Abbott306bcc22012-03-08 11:24:53 -0800758
Laura Abbott155ab6f2012-05-25 08:52:18 -0700759 total = msm8960_cache_dump_pdata.l1_size +
760 msm8960_cache_dump_pdata.l2_size;
Laura Abbott306bcc22012-03-08 11:24:53 -0800761 msm8960_reserve_table[MEMTYPE_EBI1].size += total;
Laura Abbott306bcc22012-03-08 11:24:53 -0800762#endif
763}
764
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700765static void __init msm8960_calculate_reserve_sizes(void)
766{
767 size_pmem_devices();
768 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700769 reserve_ion_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800770 reserve_mdp_memory();
Laura Abbottf8c03b92012-02-16 14:57:58 -0800771 reserve_rtb_memory();
Laura Abbott306bcc22012-03-08 11:24:53 -0800772 reserve_cache_dump_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700773}
774
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700775static struct reserve_info msm8960_reserve_info __initdata = {
776 .memtype_reserve_table = msm8960_reserve_table,
777 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700778 .reserve_fixed_area = msm8960_reserve_fixed_area,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700779 .paddr_to_memtype = msm8960_paddr_to_memtype,
780};
781
Larry Basselb4126da2011-07-18 14:31:33 -0700782static int msm8960_memory_bank_size(void)
783{
784 return 1<<29;
785}
786
787static void __init locate_unstable_memory(void)
788{
789 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
790 unsigned long bank_size;
791 unsigned long low, high;
792
793 bank_size = msm8960_memory_bank_size();
Larry Bassel4d4f4482012-04-04 11:26:09 -0700794 msm8960_reserve_info.bank_size = bank_size;
795
Larry Basselb4126da2011-07-18 14:31:33 -0700796 low = meminfo.bank[0].start;
797 high = mb->start + mb->size;
Olav Haugan62052e42011-10-28 14:28:32 -0700798
799 /* Check if 32 bit overflow occured */
800 if (high < mb->start)
801 high = ~0UL;
802
Larry Bassel4d4f4482012-04-04 11:26:09 -0700803 if (high < MAX_FIXED_AREA_SIZE + MSM8960_FIXED_AREA_START)
804 panic("fixed area extends beyond end of memory\n");
805
Larry Basselb4126da2011-07-18 14:31:33 -0700806 low &= ~(bank_size - 1);
807
808 if (high - low <= bank_size)
Larry Bassel4d4f4482012-04-04 11:26:09 -0700809 goto no_dmm;
Larry Basselb8d61022012-02-24 10:49:45 -0800810
Larry Basselb8d61022012-02-24 10:49:45 -0800811#ifdef CONFIG_ENABLE_DMM
Jack Cheung60eaeab2012-01-09 16:40:26 -0800812 msm8960_reserve_info.low_unstable_address = mb->start -
813 MIN_MEMORY_BLOCK_SIZE + mb->size;
Jack Cheung0b1987e2011-11-18 13:36:29 -0800814 msm8960_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
Larry Basselb4126da2011-07-18 14:31:33 -0700815 pr_info("low unstable address %lx max size %lx bank size %lx\n",
816 msm8960_reserve_info.low_unstable_address,
817 msm8960_reserve_info.max_unstable_size,
818 msm8960_reserve_info.bank_size);
Larry Bassel4d4f4482012-04-04 11:26:09 -0700819 return;
Larry Basselb8d61022012-02-24 10:49:45 -0800820#endif
Larry Bassel4d4f4482012-04-04 11:26:09 -0700821no_dmm:
822 msm8960_reserve_info.low_unstable_address = high;
823 msm8960_reserve_info.max_unstable_size = 0;
Larry Basselb4126da2011-07-18 14:31:33 -0700824}
825
Larry Basselb830e182011-10-14 10:46:55 -0700826static void __init place_movable_zone(void)
827{
Larry Basselb8d61022012-02-24 10:49:45 -0800828#ifdef CONFIG_ENABLE_DMM
Larry Basselb830e182011-10-14 10:46:55 -0700829 movable_reserved_start = msm8960_reserve_info.low_unstable_address;
830 movable_reserved_size = msm8960_reserve_info.max_unstable_size;
831 pr_info("movable zone start %lx size %lx\n",
832 movable_reserved_start, movable_reserved_size);
Larry Basselb8d61022012-02-24 10:49:45 -0800833#endif
Larry Basselb830e182011-10-14 10:46:55 -0700834}
835
836static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700837{
838 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700839 locate_unstable_memory();
Larry Basselb830e182011-10-14 10:46:55 -0700840 place_movable_zone();
841}
842
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800843static char prim_panel_name[PANEL_NAME_MAX_LEN];
844static char ext_panel_name[PANEL_NAME_MAX_LEN];
845static int __init prim_display_setup(char *param)
846{
847 if (strnlen(param, PANEL_NAME_MAX_LEN))
848 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
849 return 0;
850}
851early_param("prim_display", prim_display_setup);
852
853static int __init ext_display_setup(char *param)
854{
855 if (strnlen(param, PANEL_NAME_MAX_LEN))
856 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
857 return 0;
858}
859early_param("ext_display", ext_display_setup);
860
Larry Basselb830e182011-10-14 10:46:55 -0700861static void __init msm8960_reserve(void)
862{
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800863 msm8960_set_display_params(prim_panel_name, ext_panel_name);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700864 msm_reserve();
865}
866
Larry Bassela4414b12011-08-04 11:11:02 -0700867static int msm8960_change_memory_power(u64 start, u64 size,
868 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700869{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -0700870 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -0700871}
872
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700873static void __init msm8960_allocate_memory_regions(void)
874{
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800875 msm8960_allocate_fb_region();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700876}
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800877
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700878#ifdef CONFIG_WCD9310_CODEC
879
880#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
881
Patrick Lai3043fba2011-08-01 14:15:57 -0700882/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
883 * 4 micbiases are used to power various analog and digital
884 * microphones operating at 1800 mV. Technically, all micbiases
885 * can source from single cfilter since all microphones operate
886 * at the same voltage level. The arrangement below is to make
887 * sure all cfilters are exercised. LDO_H regulator ouput level
888 * does not need to be as high as 2.85V. It is choosen for
889 * microphone sensitivity purpose.
890 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530891static struct wcd9xxx_pdata tabla_platform_data = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700892 .slimbus_slave_device = {
893 .name = "tabla-slave",
894 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
895 },
896 .irq = MSM_GPIO_TO_INT(62),
897 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530898 .num_irqs = NR_WCD9XXX_IRQS,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700899 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -0700900 .micbias = {
901 .ldoh_v = TABLA_LDOH_2P85_V,
902 .cfilt1_mv = 1800,
Joonwoo Parkcf473b42012-03-29 19:48:16 -0700903 .cfilt2_mv = 2700,
Patrick Lai3043fba2011-08-01 14:15:57 -0700904 .cfilt3_mv = 1800,
905 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
906 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
907 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
908 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530909 },
910 .regulator = {
911 {
912 .name = "CDC_VDD_CP",
913 .min_uV = 1800000,
914 .max_uV = 1800000,
915 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
916 },
917 {
918 .name = "CDC_VDDA_RX",
919 .min_uV = 1800000,
920 .max_uV = 1800000,
921 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
922 },
923 {
924 .name = "CDC_VDDA_TX",
925 .min_uV = 1800000,
926 .max_uV = 1800000,
927 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
928 },
929 {
930 .name = "VDDIO_CDC",
931 .min_uV = 1800000,
932 .max_uV = 1800000,
933 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
934 },
935 {
936 .name = "VDDD_CDC_D",
937 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700938 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530939 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
940 },
941 {
942 .name = "CDC_VDDA_A_1P2V",
943 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700944 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530945 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
946 },
947 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700948};
949
950static struct slim_device msm_slim_tabla = {
951 .name = "tabla-slim",
952 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
953 .dev = {
954 .platform_data = &tabla_platform_data,
955 },
956};
Santosh Mardi60e19d92011-10-28 01:15:14 +0530957
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530958static struct wcd9xxx_pdata tabla20_platform_data = {
Santosh Mardi60e19d92011-10-28 01:15:14 +0530959 .slimbus_slave_device = {
960 .name = "tabla-slave",
961 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
962 },
963 .irq = MSM_GPIO_TO_INT(62),
964 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530965 .num_irqs = NR_WCD9XXX_IRQS,
Santosh Mardi60e19d92011-10-28 01:15:14 +0530966 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
967 .micbias = {
968 .ldoh_v = TABLA_LDOH_2P85_V,
969 .cfilt1_mv = 1800,
Joonwoo Parkcf473b42012-03-29 19:48:16 -0700970 .cfilt2_mv = 2700,
Santosh Mardi60e19d92011-10-28 01:15:14 +0530971 .cfilt3_mv = 1800,
972 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
973 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
974 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
975 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530976 },
977 .regulator = {
978 {
979 .name = "CDC_VDD_CP",
980 .min_uV = 1800000,
981 .max_uV = 1800000,
982 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
983 },
984 {
985 .name = "CDC_VDDA_RX",
986 .min_uV = 1800000,
987 .max_uV = 1800000,
988 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
989 },
990 {
991 .name = "CDC_VDDA_TX",
992 .min_uV = 1800000,
993 .max_uV = 1800000,
994 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
995 },
996 {
997 .name = "VDDIO_CDC",
998 .min_uV = 1800000,
999 .max_uV = 1800000,
1000 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1001 },
1002 {
1003 .name = "VDDD_CDC_D",
1004 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -07001005 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301006 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1007 },
1008 {
1009 .name = "CDC_VDDA_A_1P2V",
1010 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -07001011 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301012 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1013 },
1014 },
Santosh Mardi60e19d92011-10-28 01:15:14 +05301015};
1016
1017static struct slim_device msm_slim_tabla20 = {
1018 .name = "tabla2x-slim",
1019 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
1020 .dev = {
1021 .platform_data = &tabla20_platform_data,
1022 },
1023};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001024#endif
1025
1026static struct slim_boardinfo msm_slim_devices[] = {
1027#ifdef CONFIG_WCD9310_CODEC
1028 {
1029 .bus_num = 1,
1030 .slim_slave = &msm_slim_tabla,
1031 },
Santosh Mardi60e19d92011-10-28 01:15:14 +05301032 {
1033 .bus_num = 1,
1034 .slim_slave = &msm_slim_tabla20,
1035 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001036#endif
1037 /* add more slimbus slaves as needed */
1038};
1039
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001040#define MSM_WCNSS_PHYS 0x03000000
1041#define MSM_WCNSS_SIZE 0x280000
1042
1043static struct resource resources_wcnss_wlan[] = {
1044 {
1045 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1046 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1047 .name = "wcnss_wlanrx_irq",
1048 .flags = IORESOURCE_IRQ,
1049 },
1050 {
1051 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1052 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1053 .name = "wcnss_wlantx_irq",
1054 .flags = IORESOURCE_IRQ,
1055 },
1056 {
1057 .start = MSM_WCNSS_PHYS,
1058 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1059 .name = "wcnss_mmio",
1060 .flags = IORESOURCE_MEM,
1061 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -07001062 {
1063 .start = 84,
1064 .end = 88,
1065 .name = "wcnss_gpios_5wire",
1066 .flags = IORESOURCE_IO,
1067 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001068};
1069
Ankur Nandwanib0039b02011-08-09 14:00:45 -07001070static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1071 .has_48mhz_xo = 1,
1072};
1073
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001074static struct platform_device msm_device_wcnss_wlan = {
1075 .name = "wcnss_wlan",
1076 .id = 0,
1077 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1078 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07001079 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001080};
1081
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001082#ifdef CONFIG_QSEECOM
1083/* qseecom bus scaling */
1084static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
1085 {
1086 .src = MSM_BUS_MASTER_SPS,
1087 .dst = MSM_BUS_SLAVE_EBI_CH0,
1088 .ib = 0,
1089 .ab = 0,
1090 },
1091 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001092 .src = MSM_BUS_MASTER_SPS,
1093 .dst = MSM_BUS_SLAVE_SPS,
1094 .ib = 0,
1095 .ab = 0,
1096 },
1097 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001098 .src = MSM_BUS_MASTER_SPDM,
1099 .dst = MSM_BUS_SLAVE_SPDM,
1100 .ib = 0,
1101 .ab = 0,
1102 },
1103};
1104
1105static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
1106 {
1107 .src = MSM_BUS_MASTER_SPS,
1108 .dst = MSM_BUS_SLAVE_EBI_CH0,
1109 .ib = (492 * 8) * 1000000UL,
1110 .ab = (492 * 8) * 100000UL,
1111 },
1112 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001113 .src = MSM_BUS_MASTER_SPS,
1114 .dst = MSM_BUS_SLAVE_SPS,
1115 .ib = (492 * 8) * 1000000UL,
1116 .ab = (492 * 8) * 100000UL,
1117 },
1118 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001119 .src = MSM_BUS_MASTER_SPDM,
1120 .dst = MSM_BUS_SLAVE_SPDM,
1121 .ib = 0,
1122 .ab = 0,
1123 },
1124};
1125
1126static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1127 {
1128 .src = MSM_BUS_MASTER_SPS,
1129 .dst = MSM_BUS_SLAVE_EBI_CH0,
1130 .ib = 0,
1131 .ab = 0,
1132 },
1133 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001134 .src = MSM_BUS_MASTER_SPS,
1135 .dst = MSM_BUS_SLAVE_SPS,
1136 .ib = 0,
1137 .ab = 0,
1138 },
1139 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001140 .src = MSM_BUS_MASTER_SPDM,
1141 .dst = MSM_BUS_SLAVE_SPDM,
1142 .ib = (64 * 8) * 1000000UL,
1143 .ab = (64 * 8) * 100000UL,
1144 },
1145};
1146
1147static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1148 {
1149 ARRAY_SIZE(qseecom_clks_init_vectors),
1150 qseecom_clks_init_vectors,
1151 },
1152 {
1153 ARRAY_SIZE(qseecom_enable_dfab_vectors),
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001154 qseecom_enable_dfab_vectors,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001155 },
1156 {
1157 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1158 qseecom_enable_sfpb_vectors,
1159 },
1160};
1161
1162static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1163 qseecom_hw_bus_scale_usecases,
1164 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1165 .name = "qsee",
1166};
1167
1168static struct platform_device qseecom_device = {
1169 .name = "qseecom",
1170 .id = 0,
1171 .dev = {
1172 .platform_data = &qseecom_bus_pdata,
1173 },
1174};
1175#endif
1176
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001177#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1178 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1179 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1180 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1181
1182#define QCE_SIZE 0x10000
1183#define QCE_0_BASE 0x18500000
1184
1185#define QCE_HW_KEY_SUPPORT 0
1186#define QCE_SHA_HMAC_SUPPORT 1
1187#define QCE_SHARE_CE_RESOURCE 1
1188#define QCE_CE_SHARED 0
1189
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001190/* Begin Bus scaling definitions */
1191static struct msm_bus_vectors crypto_hw_init_vectors[] = {
1192 {
1193 .src = MSM_BUS_MASTER_ADM_PORT0,
1194 .dst = MSM_BUS_SLAVE_EBI_CH0,
1195 .ab = 0,
1196 .ib = 0,
1197 },
1198 {
1199 .src = MSM_BUS_MASTER_ADM_PORT1,
1200 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1201 .ab = 0,
1202 .ib = 0,
1203 },
1204};
1205
1206static struct msm_bus_vectors crypto_hw_active_vectors[] = {
1207 {
1208 .src = MSM_BUS_MASTER_ADM_PORT0,
1209 .dst = MSM_BUS_SLAVE_EBI_CH0,
1210 .ab = 70000000UL,
1211 .ib = 70000000UL,
1212 },
1213 {
1214 .src = MSM_BUS_MASTER_ADM_PORT1,
1215 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1216 .ab = 2480000000UL,
1217 .ib = 2480000000UL,
1218 },
1219};
1220
1221static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
1222 {
1223 ARRAY_SIZE(crypto_hw_init_vectors),
1224 crypto_hw_init_vectors,
1225 },
1226 {
1227 ARRAY_SIZE(crypto_hw_active_vectors),
1228 crypto_hw_active_vectors,
1229 },
1230};
1231
1232static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
1233 crypto_hw_bus_scale_usecases,
1234 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
1235 .name = "cryptohw",
1236};
1237/* End Bus Scaling Definitions*/
1238
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001239static struct resource qcrypto_resources[] = {
1240 [0] = {
1241 .start = QCE_0_BASE,
1242 .end = QCE_0_BASE + QCE_SIZE - 1,
1243 .flags = IORESOURCE_MEM,
1244 },
1245 [1] = {
1246 .name = "crypto_channels",
1247 .start = DMOV_CE_IN_CHAN,
1248 .end = DMOV_CE_OUT_CHAN,
1249 .flags = IORESOURCE_DMA,
1250 },
1251 [2] = {
1252 .name = "crypto_crci_in",
1253 .start = DMOV_CE_IN_CRCI,
1254 .end = DMOV_CE_IN_CRCI,
1255 .flags = IORESOURCE_DMA,
1256 },
1257 [3] = {
1258 .name = "crypto_crci_out",
1259 .start = DMOV_CE_OUT_CRCI,
1260 .end = DMOV_CE_OUT_CRCI,
1261 .flags = IORESOURCE_DMA,
1262 },
1263};
1264
1265static struct resource qcedev_resources[] = {
1266 [0] = {
1267 .start = QCE_0_BASE,
1268 .end = QCE_0_BASE + QCE_SIZE - 1,
1269 .flags = IORESOURCE_MEM,
1270 },
1271 [1] = {
1272 .name = "crypto_channels",
1273 .start = DMOV_CE_IN_CHAN,
1274 .end = DMOV_CE_OUT_CHAN,
1275 .flags = IORESOURCE_DMA,
1276 },
1277 [2] = {
1278 .name = "crypto_crci_in",
1279 .start = DMOV_CE_IN_CRCI,
1280 .end = DMOV_CE_IN_CRCI,
1281 .flags = IORESOURCE_DMA,
1282 },
1283 [3] = {
1284 .name = "crypto_crci_out",
1285 .start = DMOV_CE_OUT_CRCI,
1286 .end = DMOV_CE_OUT_CRCI,
1287 .flags = IORESOURCE_DMA,
1288 },
1289};
1290
1291#endif
1292
1293#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1294 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1295
1296static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1297 .ce_shared = QCE_CE_SHARED,
1298 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1299 .hw_key_support = QCE_HW_KEY_SUPPORT,
1300 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001301 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001302};
1303
1304static struct platform_device qcrypto_device = {
1305 .name = "qcrypto",
1306 .id = 0,
1307 .num_resources = ARRAY_SIZE(qcrypto_resources),
1308 .resource = qcrypto_resources,
1309 .dev = {
1310 .coherent_dma_mask = DMA_BIT_MASK(32),
1311 .platform_data = &qcrypto_ce_hw_suppport,
1312 },
1313};
1314#endif
1315
1316#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1317 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1318
1319static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1320 .ce_shared = QCE_CE_SHARED,
1321 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1322 .hw_key_support = QCE_HW_KEY_SUPPORT,
1323 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001324 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001325};
1326
1327static struct platform_device qcedev_device = {
1328 .name = "qce",
1329 .id = 0,
1330 .num_resources = ARRAY_SIZE(qcedev_resources),
1331 .resource = qcedev_resources,
1332 .dev = {
1333 .coherent_dma_mask = DMA_BIT_MASK(32),
1334 .platform_data = &qcedev_ce_hw_suppport,
1335 },
1336};
1337#endif
1338
Joel King0cbf5d82012-05-24 15:21:38 -07001339static struct mdm_platform_data sglte_platform_data = {
1340 .mdm_version = "4.0",
1341 .ramdump_delay_ms = 1000,
Joel King63ce8332012-06-01 09:59:26 -07001342 .soft_reset_inverted = 1,
Joel King0cbf5d82012-05-24 15:21:38 -07001343 .peripheral_platform_device = NULL,
Ameya Thakurc9a7a842012-06-24 22:47:52 -07001344 .ramdump_timeout_ms = 600000,
Ameya Thakura98bde52012-06-28 18:55:19 -07001345 .no_powerdown_after_ramdumps = 1,
Ameya Thakur43248fd2012-07-10 18:50:52 -07001346 .image_upgrade_supported = 1,
Joel Kingb8352a12011-11-15 18:46:24 -08001347};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001348
Joel Nider266a2642011-10-16 10:58:05 +02001349#define MSM_TSIF0_PHYS (0x18200000)
1350#define MSM_TSIF1_PHYS (0x18201000)
1351#define MSM_TSIF_SIZE (0x200)
1352#define MSM_TSPP_PHYS (0x18202000)
1353#define MSM_TSPP_SIZE (0x1000)
1354#define MSM_TSPP_BAM_PHYS (0x18204000)
1355#define MSM_TSPP_BAM_SIZE (0x2000)
1356
1357#define TSIF_0_CLK GPIO_CFG(75, 1, GPIO_CFG_INPUT, \
1358 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1359#define TSIF_0_EN GPIO_CFG(76, 1, GPIO_CFG_INPUT, \
1360 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1361#define TSIF_0_DATA GPIO_CFG(77, 1, GPIO_CFG_INPUT, \
1362 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1363#define TSIF_0_SYNC GPIO_CFG(82, 1, GPIO_CFG_INPUT, \
1364 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1365#define TSIF_1_CLK GPIO_CFG(79, 1, GPIO_CFG_INPUT, \
1366 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1367#define TSIF_1_EN GPIO_CFG(80, 1, GPIO_CFG_INPUT, \
1368 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1369#define TSIF_1_DATA GPIO_CFG(81, 1, GPIO_CFG_INPUT, \
1370 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1371#define TSIF_1_SYNC GPIO_CFG(78, 1, GPIO_CFG_INPUT, \
1372 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1373
1374static const struct msm_gpio tsif_gpios[] = {
1375 { .gpio_cfg = TSIF_0_CLK, .label = "tsif0_clk", },
1376 { .gpio_cfg = TSIF_0_EN, .label = "tsif0_en", },
1377 { .gpio_cfg = TSIF_0_DATA, .label = "tsif0_data", },
1378 { .gpio_cfg = TSIF_0_SYNC, .label = "tsif0_sync", },
1379 { .gpio_cfg = TSIF_1_CLK, .label = "tsif1_clk", },
1380 { .gpio_cfg = TSIF_1_EN, .label = "tsif1_en", },
1381 { .gpio_cfg = TSIF_1_DATA, .label = "tsif1_data", },
1382 { .gpio_cfg = TSIF_1_SYNC, .label = "tsif1_sync", },
1383};
1384
1385static struct resource tspp_resources[] = {
1386 [0] = {
1387 .flags = IORESOURCE_IRQ,
1388 .start = TSIF_TSPP_IRQ,
1389 .end = TSIF1_IRQ,
1390 },
1391 [1] = {
1392 .flags = IORESOURCE_MEM,
1393 .start = MSM_TSIF0_PHYS,
1394 .end = MSM_TSIF0_PHYS + MSM_TSIF_SIZE - 1,
1395 },
1396 [2] = {
1397 .flags = IORESOURCE_MEM,
1398 .start = MSM_TSIF1_PHYS,
1399 .end = MSM_TSIF1_PHYS + MSM_TSIF_SIZE - 1,
1400 },
1401 [3] = {
1402 .flags = IORESOURCE_MEM,
1403 .start = MSM_TSPP_PHYS,
1404 .end = MSM_TSPP_PHYS + MSM_TSPP_SIZE - 1,
1405 },
1406 [4] = {
1407 .flags = IORESOURCE_MEM,
1408 .start = MSM_TSPP_BAM_PHYS,
1409 .end = MSM_TSPP_BAM_PHYS + MSM_TSPP_BAM_SIZE - 1,
1410 },
1411};
1412
1413static struct msm_tspp_platform_data tspp_platform_data = {
1414 .num_gpios = ARRAY_SIZE(tsif_gpios),
1415 .gpios = tsif_gpios,
1416 .tsif_pclk = "tsif_pclk",
1417 .tsif_ref_clk = "tsif_ref_clk",
1418};
1419
1420static struct platform_device msm_device_tspp = {
1421 .name = "msm_tspp",
1422 .id = 0,
1423 .num_resources = ARRAY_SIZE(tspp_resources),
1424 .resource = tspp_resources,
1425 .dev = {
1426 .platform_data = &tspp_platform_data
1427 },
1428};
1429
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001430#define MSM_SHARED_RAM_PHYS 0x80000000
1431
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001432static void __init msm8960_map_io(void)
1433{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001434 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001435 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001436
1437 if (socinfo_init() < 0)
1438 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001439}
1440
1441static void __init msm8960_init_irq(void)
1442{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001443 struct msm_mpm_device_data *data = NULL;
1444
1445#ifdef CONFIG_MSM_MPM
1446 data = &msm8960_mpm_dev_data;
1447#endif
1448
1449 msm_mpm_irq_extn_init(data);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001450 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001451 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001452}
1453
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001454static void __init msm8960_init_buses(void)
1455{
1456#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -06001457 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -06001458 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
1459 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
Gagan Macae154c4b2011-10-05 19:24:43 -06001460 msm_bus_apps_fabric.dev.platform_data =
1461 &msm_bus_8960_apps_fabric_pdata;
1462 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
Gagan Mac680bfc02012-07-19 19:11:00 -06001463 if (cpu_is_msm8960ab()) {
1464 msm_bus_8960_sg_mm_fabric_pdata.rpm_enabled = 1;
1465 msm_bus_mm_fabric.dev.platform_data =
1466 &msm_bus_8960_sg_mm_fabric_pdata;
1467 } else {
1468 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
1469 msm_bus_mm_fabric.dev.platform_data =
1470 &msm_bus_8960_mm_fabric_pdata;
1471 }
Gagan Macae154c4b2011-10-05 19:24:43 -06001472 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
1473 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001474#endif
1475}
1476
1477static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
1478 .max_clock_speed = 15060000,
Kiran Gunda2b285652012-07-30 13:22:39 +05301479 .infinite_mode = 0xFFC0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001480};
1481
1482#ifdef CONFIG_USB_MSM_OTG_72K
1483static struct msm_otg_platform_data msm_otg_pdata;
1484#else
Anji jonnalaa8b8d732011-12-06 10:03:24 +05301485static int wr_phy_init_seq[] = {
1486 0x44, 0x80, /* set VBUS valid threshold
1487 and disconnect valid threshold */
1488 0x38, 0x81, /* update DC voltage level */
1489 0x14, 0x82, /* set preemphasis and rise/fall time */
1490 0x13, 0x83, /* set source impedance adjusment */
1491 -1};
1492
1493static int liquid_v1_phy_init_seq[] = {
1494 0x44, 0x80,/* set VBUS valid threshold
1495 and disconnect valid threshold */
1496 0x3C, 0x81,/* update DC voltage level */
1497 0x18, 0x82,/* set preemphasis and rise/fall time */
1498 0x23, 0x83,/* set source impedance sdjusment */
1499 -1};
1500
Mayank Ranaa1f507b2012-08-14 10:57:00 +05301501static int sglte_phy_init_seq[] = {
1502 0x44, 0x80, /* set VBUS valid threshold
1503 and disconnect valid threshold */
1504 0x3A, 0x81, /* update DC voltage level */
1505 0x24, 0x82, /* set preemphasis and rise/fall time */
1506 0x13, 0x83, /* set source impedance adjusment */
1507 -1};
1508
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301509#ifdef CONFIG_MSM_BUS_SCALING
1510/* Bandwidth requests (zero) if no vote placed */
1511static struct msm_bus_vectors usb_init_vectors[] = {
1512 {
1513 .src = MSM_BUS_MASTER_SPS,
1514 .dst = MSM_BUS_SLAVE_EBI_CH0,
1515 .ab = 0,
1516 .ib = 0,
1517 },
1518};
1519
1520/* Bus bandwidth requests in Bytes/sec */
1521static struct msm_bus_vectors usb_max_vectors[] = {
1522 {
1523 .src = MSM_BUS_MASTER_SPS,
1524 .dst = MSM_BUS_SLAVE_EBI_CH0,
1525 .ab = 60000000, /* At least 480Mbps on bus. */
1526 .ib = 960000000, /* MAX bursts rate */
1527 },
1528};
1529
1530static struct msm_bus_paths usb_bus_scale_usecases[] = {
1531 {
1532 ARRAY_SIZE(usb_init_vectors),
1533 usb_init_vectors,
1534 },
1535 {
1536 ARRAY_SIZE(usb_max_vectors),
1537 usb_max_vectors,
1538 },
1539};
1540
1541static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
1542 usb_bus_scale_usecases,
1543 ARRAY_SIZE(usb_bus_scale_usecases),
1544 .name = "usb",
1545};
1546#endif
1547
Jack Pham87f202f2012-08-06 00:24:22 -07001548#define MSM_MPM_PIN_USB1_OTGSESSVLD 40
1549
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001550static struct msm_otg_platform_data msm_otg_pdata = {
1551 .mode = USB_OTG,
1552 .otg_control = OTG_PMIC_CONTROL,
1553 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001554 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
Anji jonnala4e3e6772011-09-15 18:53:42 +05301555 .power_budget = 750,
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301556#ifdef CONFIG_MSM_BUS_SCALING
1557 .bus_scale_table = &usb_bus_scale_pdata,
Jack Pham87f202f2012-08-06 00:24:22 -07001558 .mpm_otgsessvld_int = MSM_MPM_PIN_USB1_OTGSESSVLD,
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301559#endif
Pavankumar Kondeti2aec9f32012-06-13 09:06:03 +05301560#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
1561 .mhl_dev_name = "sii8334",
1562#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001563};
1564#endif
1565
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301566#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05301567#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301568static struct msm_hsic_host_platform_data msm_hsic_pdata = {
1569 .strobe = 150,
1570 .data = 151,
1571};
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301572
1573static struct smsc_hub_platform_data hsic_hub_pdata = {
1574 .hub_reset = HSIC_HUB_RESET_GPIO,
1575};
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301576#else
1577static struct msm_hsic_host_platform_data msm_hsic_pdata;
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301578static struct smsc_hub_platform_data hsic_hub_pdata;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301579#endif
1580
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301581static struct platform_device smsc_hub_device = {
1582 .name = "msm_smsc_hub",
1583 .id = -1,
1584 .dev = {
1585 .platform_data = &hsic_hub_pdata,
1586 },
1587};
1588
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001589#define PID_MAGIC_ID 0x71432909
1590#define SERIAL_NUM_MAGIC_ID 0x61945374
1591#define SERIAL_NUMBER_LENGTH 127
1592#define DLOAD_USB_BASE_ADD 0x2A03F0C8
1593
1594struct magic_num_struct {
1595 uint32_t pid;
1596 uint32_t serial_num;
1597};
1598
1599struct dload_struct {
1600 uint32_t reserved1;
1601 uint32_t reserved2;
1602 uint32_t reserved3;
1603 uint16_t reserved4;
1604 uint16_t pid;
1605 char serial_number[SERIAL_NUMBER_LENGTH];
1606 uint16_t reserved5;
1607 struct magic_num_struct magic_struct;
1608};
1609
1610static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
1611{
1612 struct dload_struct __iomem *dload = 0;
1613
1614 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
1615 if (!dload) {
1616 pr_err("%s: cannot remap I/O memory region: %08x\n",
1617 __func__, DLOAD_USB_BASE_ADD);
1618 return -ENXIO;
1619 }
1620
1621 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
1622 __func__, dload, pid, snum);
1623 /* update pid */
1624 dload->magic_struct.pid = PID_MAGIC_ID;
1625 dload->pid = pid;
1626
1627 /* update serial number */
1628 dload->magic_struct.serial_num = 0;
1629 if (!snum) {
1630 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
1631 goto out;
1632 }
1633
1634 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -07001635 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001636out:
1637 iounmap(dload);
1638 return 0;
1639}
1640
1641static struct android_usb_platform_data android_usb_pdata = {
1642 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1643};
1644
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001645static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001646 .name = "android_usb",
1647 .id = -1,
1648 .dev = {
1649 .platform_data = &android_usb_pdata,
1650 },
1651};
1652
1653static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1654 0x03, 0x0f,
1655};
1656
1657static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1658 0x00, 0x24, 0x54, 0x10,
1659 0x09, 0x03, 0x01,
1660 0x10, 0x54, 0x30, 0x0C,
1661 0x24, 0x30, 0x0f,
1662};
1663
1664static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1665 0x00, 0x24, 0x54, 0x10,
1666 0x09, 0x07, 0x01, 0x0B,
1667 0x10, 0x54, 0x30, 0x0C,
1668 0x24, 0x30, 0x0f,
1669};
1670
1671static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1672 [0] = {
1673 .mode = MSM_SPM_MODE_CLOCK_GATING,
1674 .notify_rpm = false,
1675 .cmd = spm_wfi_cmd_sequence,
1676 },
1677 [1] = {
1678 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1679 .notify_rpm = false,
1680 .cmd = spm_power_collapse_without_rpm,
1681 },
1682 [2] = {
1683 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1684 .notify_rpm = true,
1685 .cmd = spm_power_collapse_with_rpm,
1686 },
1687};
1688
1689static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1690 [0] = {
1691 .reg_base_addr = MSM_SAW0_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001692 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001693#if defined(CONFIG_MSM_AVS_HW)
1694 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1695 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1696#endif
1697 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001698 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001699 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1700 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1701 .vctl_timeout_us = 50,
1702 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1703 .modes = msm_spm_seq_list,
1704 },
1705 [1] = {
1706 .reg_base_addr = MSM_SAW1_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001707 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001708#if defined(CONFIG_MSM_AVS_HW)
1709 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1710 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1711#endif
1712 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001713 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001714 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1715 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1716 .vctl_timeout_us = 50,
1717 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1718 .modes = msm_spm_seq_list,
1719 },
1720};
1721
1722static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1723 0x00, 0x20, 0x03, 0x20,
1724 0x00, 0x0f,
1725};
1726
1727static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1728 0x00, 0x20, 0x34, 0x64,
1729 0x48, 0x07, 0x48, 0x20,
1730 0x50, 0x64, 0x04, 0x34,
1731 0x50, 0x0f,
1732};
1733static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1734 0x00, 0x10, 0x34, 0x64,
1735 0x48, 0x07, 0x48, 0x10,
1736 0x50, 0x64, 0x04, 0x34,
1737 0x50, 0x0F,
1738};
1739
1740static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1741 [0] = {
1742 .mode = MSM_SPM_L2_MODE_RETENTION,
1743 .notify_rpm = false,
1744 .cmd = l2_spm_wfi_cmd_sequence,
1745 },
1746 [1] = {
1747 .mode = MSM_SPM_L2_MODE_GDHS,
1748 .notify_rpm = true,
1749 .cmd = l2_spm_gdhs_cmd_sequence,
1750 },
1751 [2] = {
1752 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1753 .notify_rpm = true,
1754 .cmd = l2_spm_power_off_cmd_sequence,
1755 },
1756};
1757
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001758static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1759 [0] = {
1760 .reg_base_addr = MSM_SAW_L2_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001761 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001762 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001763 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1764 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1765 .modes = msm_spm_l2_seq_list,
1766 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1767 },
1768};
1769
Anirudh Ghayal15698162012-07-31 11:51:32 +05301770#define HAP_SHIFT_LVL_OE_GPIO 47
1771#define HAP_SHIFT_LVL_OE_GPIO_SGLTE 89
Mohan Pallaka5e490392011-09-09 15:18:41 +05301772#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1773#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
1774
1775static struct msm_xo_voter *xo_handle_d1;
1776
1777static int isa1200_power(int on)
1778{
1779 int rc = 0;
Anirudh Ghayal15698162012-07-31 11:51:32 +05301780 int hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO;
Mohan Pallaka5e490392011-09-09 15:18:41 +05301781
Anirudh Ghayal15698162012-07-31 11:51:32 +05301782 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
1783 hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO_SGLTE;
1784
1785
1786 gpio_set_value(hap_oe_gpio, !!on);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301787
1788 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
1789 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
1790 if (rc < 0) {
1791 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
1792 __func__, on ? "" : "de-", rc);
1793 goto err_xo_vote;
1794 }
1795
1796 return 0;
1797
1798err_xo_vote:
Anirudh Ghayal15698162012-07-31 11:51:32 +05301799 gpio_set_value(hap_oe_gpio, !on);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301800 return rc;
1801}
1802
1803static int isa1200_dev_setup(bool enable)
1804{
1805 int rc = 0;
Anirudh Ghayal15698162012-07-31 11:51:32 +05301806 int hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO;
Mohan Pallaka5e490392011-09-09 15:18:41 +05301807
1808 struct pm_gpio hap_gpio_config = {
1809 .direction = PM_GPIO_DIR_OUT,
1810 .pull = PM_GPIO_PULL_NO,
1811 .out_strength = PM_GPIO_STRENGTH_HIGH,
1812 .function = PM_GPIO_FUNC_NORMAL,
1813 .inv_int_pol = 0,
1814 .vin_sel = 2,
1815 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1816 .output_value = 0,
1817 };
1818
Anirudh Ghayal15698162012-07-31 11:51:32 +05301819 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
1820 hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO_SGLTE;
1821
Mohan Pallaka5e490392011-09-09 15:18:41 +05301822 if (enable == true) {
1823 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
1824 if (rc) {
1825 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1826 __func__, PM_HAP_EN_GPIO, rc);
1827 return rc;
1828 }
1829
1830 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
1831 if (rc) {
1832 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1833 __func__, PM_HAP_LEN_GPIO, rc);
1834 return rc;
1835 }
1836
Anirudh Ghayal15698162012-07-31 11:51:32 +05301837 rc = gpio_request(hap_oe_gpio, "hap_shft_lvl_oe");
Mohan Pallaka5e490392011-09-09 15:18:41 +05301838 if (rc) {
1839 pr_err("%s: unable to request gpio %d (%d)\n",
Anirudh Ghayal15698162012-07-31 11:51:32 +05301840 __func__, hap_oe_gpio, rc);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301841 return rc;
1842 }
1843
Anirudh Ghayal15698162012-07-31 11:51:32 +05301844 rc = gpio_direction_output(hap_oe_gpio, 0);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301845 if (rc) {
1846 pr_err("%s: Unable to set direction\n", __func__);
1847 goto free_gpio;
1848 }
1849
1850 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
1851 if (IS_ERR(xo_handle_d1)) {
1852 rc = PTR_ERR(xo_handle_d1);
1853 pr_err("%s: failed to get the handle for D1(%d)\n",
1854 __func__, rc);
1855 goto gpio_set_dir;
1856 }
1857 } else {
Anirudh Ghayal15698162012-07-31 11:51:32 +05301858 gpio_free(hap_oe_gpio);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301859
1860 msm_xo_put(xo_handle_d1);
1861 }
1862
1863 return 0;
1864
1865gpio_set_dir:
Anirudh Ghayal15698162012-07-31 11:51:32 +05301866 gpio_set_value(hap_oe_gpio, 0);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301867free_gpio:
Anirudh Ghayal15698162012-07-31 11:51:32 +05301868 gpio_free(hap_oe_gpio);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301869 return rc;
1870}
1871
1872static struct isa1200_regulator isa1200_reg_data[] = {
1873 {
1874 .name = "vcc_i2c",
1875 .min_uV = ISA_I2C_VTG_MIN_UV,
1876 .max_uV = ISA_I2C_VTG_MAX_UV,
1877 .load_uA = ISA_I2C_CURR_UA,
1878 },
1879};
1880
1881static struct isa1200_platform_data isa1200_1_pdata = {
1882 .name = "vibrator",
1883 .dev_setup = isa1200_dev_setup,
1884 .power_on = isa1200_power,
1885 .hap_en_gpio = PM_HAP_EN_GPIO,
1886 .hap_len_gpio = PM_HAP_LEN_GPIO,
1887 .max_timeout = 15000,
1888 .mode_ctrl = PWM_GEN_MODE,
1889 .pwm_fd = {
1890 .pwm_div = 256,
1891 },
1892 .is_erm = false,
1893 .smart_en = true,
1894 .ext_clk_en = true,
1895 .chip_en = 1,
1896 .regulator_info = isa1200_reg_data,
1897 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1898};
1899
1900static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1901 {
1902 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
Mohan Pallaka5e490392011-09-09 15:18:41 +05301903 },
1904};
1905
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001906#define CYTTSP_TS_GPIO_IRQ 11
1907#define CYTTSP_TS_SLEEP_GPIO 50
1908#define CYTTSP_TS_RESOUT_N_GPIO 52
1909
1910/*virtual key support */
1911static ssize_t tma340_vkeys_show(struct kobject *kobj,
1912 struct kobj_attribute *attr, char *buf)
1913{
1914 return snprintf(buf, 200,
1915 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1916 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1917 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1918 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1919 "\n");
1920}
1921
1922static struct kobj_attribute tma340_vkeys_attr = {
1923 .attr = {
1924 .mode = S_IRUGO,
1925 },
1926 .show = &tma340_vkeys_show,
1927};
1928
1929static struct attribute *tma340_properties_attrs[] = {
1930 &tma340_vkeys_attr.attr,
1931 NULL
1932};
1933
1934static struct attribute_group tma340_properties_attr_group = {
1935 .attrs = tma340_properties_attrs,
1936};
1937
1938
1939static int cyttsp_platform_init(struct i2c_client *client)
1940{
1941 int rc = 0;
1942 static struct kobject *tma340_properties_kobj;
1943
1944 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1945 tma340_properties_kobj = kobject_create_and_add("board_properties",
1946 NULL);
1947 if (tma340_properties_kobj)
1948 rc = sysfs_create_group(tma340_properties_kobj,
1949 &tma340_properties_attr_group);
1950 if (!tma340_properties_kobj || rc)
1951 pr_err("%s: failed to create board_properties\n",
1952 __func__);
1953
1954 return 0;
1955}
1956
1957static struct cyttsp_regulator regulator_data[] = {
1958 {
1959 .name = "vdd",
1960 .min_uV = CY_TMA300_VTG_MIN_UV,
1961 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301962 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1963 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001964 },
1965 /* TODO: Remove after runtime PM is enabled in I2C driver */
1966 {
1967 .name = "vcc_i2c",
1968 .min_uV = CY_I2C_VTG_MIN_UV,
1969 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301970 .hpm_load_uA = CY_I2C_CURR_UA,
1971 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001972 },
1973};
1974
1975static struct cyttsp_platform_data cyttsp_pdata = {
1976 .panel_maxx = 634,
1977 .panel_maxy = 1166,
1978 .disp_maxx = 616,
1979 .disp_maxy = 1023,
1980 .disp_minx = 0,
1981 .disp_miny = 16,
1982 .flags = 0x01,
1983 .gen = CY_GEN3, /* or */
1984 .use_st = CY_USE_ST,
1985 .use_mt = CY_USE_MT,
1986 .use_hndshk = CY_SEND_HNDSHK,
1987 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05301988 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001989 .use_gestures = CY_USE_GESTURES,
1990 .fw_fname = "cyttsp_8960_cdp.hex",
1991 /* activate up to 4 groups
1992 * and set active distance
1993 */
1994 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
1995 CY_GEST_GRP3 | CY_GEST_GRP4 |
1996 CY_ACT_DIST,
Amy Maloche7b741b22012-06-14 14:37:22 -07001997 .act_intrvl = 10,
1998 .tch_tmout = 200,
1999 .lp_intrvl = 30,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002000 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
2001 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
2002 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
2003 .regulator_info = regulator_data,
2004 .num_regulators = ARRAY_SIZE(regulator_data),
2005 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05302006 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002007};
2008
2009static struct i2c_board_info cyttsp_info[] __initdata = {
2010 {
2011 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
2012 .platform_data = &cyttsp_pdata,
2013#ifndef CY_USE_TIMER
2014 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
2015#endif /* CY_USE_TIMER */
2016 },
2017};
2018
Jing Lindc4413c2012-01-16 15:22:52 -08002019/* configuration data for mxt1386 */
2020static const u8 mxt1386_config_data[] = {
Mohan Pallaka50837382011-09-07 11:00:57 +05302021 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002022 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302023 /* T38 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002024 11, 2, 0, 11, 11, 11, 0, 0, 0, 0,
Jing Lin2f863172011-10-17 10:56:58 -07002025 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2026 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2027 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2028 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2029 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2030 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302031 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002032 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05302033 /* T8 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002034 8, 0, 0, 0, 0, 0, 8, 14, 50, 215,
Mohan Pallaka50837382011-09-07 11:00:57 +05302035 /* T9 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002036 131, 0, 0, 26, 42, 0, 32, 63, 3, 5,
2037 0, 2, 1, 113, 10, 10, 8, 10, 255, 2,
2038 85, 5, 0, 0, 20, 20, 75, 25, 202, 29,
2039 10, 10, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05302040 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002041 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2042 0,
Anirudh Ghayaldab4e0d2012-01-09 14:59:27 +05302043 /* T18 Object */
2044 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302045 /* T22 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002046 5, 0, 0, 0, 0, 0, 0, 0, 30, 0,
2047 0, 0, 5, 8, 10, 13, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302048 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002049 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2050 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302051 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002052 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
2053 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302054 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002055 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302056 /* T28 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002057 0, 0, 0, 8, 12, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05302058 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002059 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302060 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002061 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302062 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002063 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302064};
2065
Jing Lin33b007d2011-12-21 17:40:23 -08002066/* configuration data for mxt1386e using V1.0 firmware */
2067static const u8 mxt1386e_config_data_v1_0[] = {
2068 /* T6 Object */
2069 0, 0, 0, 0, 0, 0,
2070 /* T38 Object */
2071 12, 1, 0, 17, 1, 12, 0, 0, 0, 0,
2072 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2073 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2074 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2075 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2076 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2077 0, 0, 0, 0,
2078 /* T7 Object */
2079 100, 16, 50,
2080 /* T8 Object */
2081 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
2082 /* T9 Object */
2083 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
2084 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
2085 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
2086 10, 5, 0, 0, 0,
2087 /* T18 Object */
2088 0, 0,
2089 /* T24 Object */
2090 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2091 0, 0, 0, 0, 0, 0, 0, 0, 0,
2092 /* T25 Object */
2093 3, 0, 60, 115, 156, 99,
2094 /* T27 Object */
2095 0, 0, 0, 0, 0, 0, 0,
2096 /* T40 Object */
2097 0, 0, 0, 0, 0,
2098 /* T42 Object */
2099 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
2100 /* T43 Object */
2101 0, 0, 0, 0, 0, 0, 0,
2102 /* T46 Object */
2103 64, 0, 20, 20, 0, 0, 0, 0, 0,
2104 /* T47 Object */
2105 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2106 /* T48 Object */
2107 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
2108 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
2109 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
2110 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
2111 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2112 0, 0, 0, 0,
2113 /* T56 Object */
2114 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2115 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2116 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2117 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2118 2, 99, 33,
2119};
2120
2121/* configuration data for mxt1386e using V2.1 firmware */
2122static const u8 mxt1386e_config_data_v2_1[] = {
2123 /* T6 Object */
2124 0, 0, 0, 0, 0, 0,
2125 /* T38 Object */
Jing Lina0bc4102012-07-06 17:03:45 -07002126 12, 4, 0, 5, 7, 12, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002127 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2128 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2129 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2130 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2131 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2132 0, 0, 0, 0,
2133 /* T7 Object */
2134 100, 16, 50,
2135 /* T8 Object */
2136 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
2137 /* T9 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002138 139, 0, 0, 26, 42, 0, 32, 80, 2, 5,
Jing Lina0bc4102012-07-06 17:03:45 -07002139 0, 5, 5, 79, 10, 30, 10, 10, 255, 2,
Jing Lin33b007d2011-12-21 17:40:23 -08002140 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
2141 10, 5, 0, 0, 0,
2142 /* T18 Object */
2143 0, 0,
2144 /* T24 Object */
2145 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2146 0, 0, 0, 0, 0, 0, 0, 0, 0,
2147 /* T25 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002148 1, 0, 60, 115, 156, 99,
Jing Lin33b007d2011-12-21 17:40:23 -08002149 /* T27 Object */
2150 0, 0, 0, 0, 0, 0, 0,
2151 /* T40 Object */
2152 0, 0, 0, 0, 0,
2153 /* T42 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002154 0, 0, 255, 0, 255, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002155 /* T43 Object */
2156 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
2157 16,
2158 /* T46 Object */
Jing Lina0bc4102012-07-06 17:03:45 -07002159 64, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002160 /* T47 Object */
2161 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2162 /* T48 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002163 1, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002164 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
2165 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
2166 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
2167 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2168 0, 0, 0, 0,
2169 /* T56 Object */
2170 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2171 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2172 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2173 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2174 2, 99, 33, 0, 149, 24, 193, 255, 255, 255,
2175 255,
2176};
2177
Jing Lineec88ca2012-02-08 11:18:30 -08002178/* configuration data for mxt1386e on 3D SKU using V2.1 firmware */
2179static const u8 mxt1386e_config_data_3d[] = {
2180 /* T6 Object */
2181 0, 0, 0, 0, 0, 0,
2182 /* T38 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002183 13, 1, 0, 23, 2, 12, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002184 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2185 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2186 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2187 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2188 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2189 0, 0, 0, 0,
2190 /* T7 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002191 100, 10, 50,
Jing Lineec88ca2012-02-08 11:18:30 -08002192 /* T8 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002193 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002194 /* T9 Object */
2195 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
2196 0, 5, 5, 0, 10, 30, 10, 10, 175, 4,
Jing Lin66ba78b2012-02-24 21:25:12 -08002197 127, 7, 26, 21, 17, 19, 143, 35, 207, 40,
2198 20, 5, 54, 49, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002199 /* T18 Object */
2200 0, 0,
2201 /* T24 Object */
2202 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2203 0, 0, 0, 0, 0, 0, 0, 0, 0,
2204 /* T25 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002205 0, 0, 72, 113, 168, 97,
Jing Lineec88ca2012-02-08 11:18:30 -08002206 /* T27 Object */
2207 0, 0, 0, 0, 0, 0, 0,
2208 /* T40 Object */
2209 0, 0, 0, 0, 0,
2210 /* T42 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002211 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002212 /* T43 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002213 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2214 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002215 /* T46 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002216 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002217 /* T47 Object */
2218 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2219 /* T48 Object */
2220 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08002221 32, 50, 0, 10, 10, 0, 0, 100, 10, 90,
2222 0, 0, 0, 0, 0, 0, 0, 10, 1, 30,
2223 52, 10, 5, 0, 33, 0, 1, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002224 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2225 0, 0, 0, 0,
2226 /* T56 Object */
2227 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2228 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2229 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2230 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08002231 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2232 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002233};
2234
Amy Maloche08266db2011-11-04 11:07:16 -07002235#define MXT_TS_GPIO_IRQ 11
2236#define MXT_TS_LDO_EN_GPIO 50
2237#define MXT_TS_RESET_GPIO 52
Mohan Pallaka50837382011-09-07 11:00:57 +05302238
2239static void mxt_init_hw_liquid(void)
2240{
2241 int rc;
2242
Mohan Pallaka50837382011-09-07 11:00:57 +05302243 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
2244 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07002245 pr_err("%s: unable to request mxt_ldo_en_gpio [%d]\n",
2246 __func__, MXT_TS_LDO_EN_GPIO);
2247 return;
Mohan Pallaka50837382011-09-07 11:00:57 +05302248 }
2249
2250 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
2251 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07002252 pr_err("%s: unable to set_direction for mxt_ldo_en_gpio [%d]\n",
2253 __func__, MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05302254 goto err_ldo_gpio_req;
2255 }
2256
Mohan Pallaka50837382011-09-07 11:00:57 +05302257 return;
2258
Mohan Pallaka50837382011-09-07 11:00:57 +05302259err_ldo_gpio_req:
2260 gpio_free(MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05302261}
2262
Jing Lineec88ca2012-02-08 11:18:30 -08002263static struct mxt_config_info mxt_config_array_2d[] = {
Jing Lindc4413c2012-01-16 15:22:52 -08002264 {
2265 .config = mxt1386_config_data,
2266 .config_length = ARRAY_SIZE(mxt1386_config_data),
2267 .family_id = 0xA0,
2268 .variant_id = 0x0,
2269 .version = 0x10,
2270 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002271 .bootldr_id = MXT_BOOTLOADER_ID_1386,
Jing Lindc4413c2012-01-16 15:22:52 -08002272 },
Jing Lin33b007d2011-12-21 17:40:23 -08002273 {
2274 .config = mxt1386e_config_data_v1_0,
2275 .config_length = ARRAY_SIZE(mxt1386e_config_data_v1_0),
2276 .family_id = 0xA0,
2277 .variant_id = 0x2,
2278 .version = 0x10,
2279 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002280 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Linaeaeed52012-03-26 14:57:15 -07002281 .fw_name = "atmel_8960_liquid_v2_2_AA.hex",
Jing Lin33b007d2011-12-21 17:40:23 -08002282 },
2283 {
2284 .config = mxt1386e_config_data_v2_1,
2285 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
2286 .family_id = 0xA0,
2287 .variant_id = 0x7,
2288 .version = 0x21,
2289 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002290 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Linaeaeed52012-03-26 14:57:15 -07002291 .fw_name = "atmel_8960_liquid_v2_2_AA.hex",
2292 },
2293 {
2294 /* The config data for V2.2.AA is the same as for V2.1.AA */
2295 .config = mxt1386e_config_data_v2_1,
2296 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
2297 .family_id = 0xA0,
2298 .variant_id = 0x7,
2299 .version = 0x22,
2300 .build = 0xAA,
2301 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin33b007d2011-12-21 17:40:23 -08002302 },
Jing Lindc4413c2012-01-16 15:22:52 -08002303};
2304
Jing Lineec88ca2012-02-08 11:18:30 -08002305static struct mxt_platform_data mxt_platform_data_2d = {
2306 .config_array = mxt_config_array_2d,
2307 .config_array_size = ARRAY_SIZE(mxt_config_array_2d),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002308 .panel_minx = 0,
2309 .panel_maxx = 1365,
2310 .panel_miny = 0,
2311 .panel_maxy = 767,
2312 .disp_minx = 0,
2313 .disp_maxx = 1365,
2314 .disp_miny = 0,
2315 .disp_maxy = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05302316 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07002317 .i2c_pull_up = true,
Amy Maloche08266db2011-11-04 11:07:16 -07002318 .reset_gpio = MXT_TS_RESET_GPIO,
2319 .irq_gpio = MXT_TS_GPIO_IRQ,
Mohan Pallaka50837382011-09-07 11:00:57 +05302320};
2321
Jing Lineec88ca2012-02-08 11:18:30 -08002322static struct mxt_config_info mxt_config_array_3d[] = {
2323 {
2324 .config = mxt1386e_config_data_3d,
2325 .config_length = ARRAY_SIZE(mxt1386e_config_data_3d),
2326 .family_id = 0xA0,
2327 .variant_id = 0x7,
2328 .version = 0x21,
2329 .build = 0xAA,
2330 },
2331};
2332
2333static struct mxt_platform_data mxt_platform_data_3d = {
2334 .config_array = mxt_config_array_3d,
2335 .config_array_size = ARRAY_SIZE(mxt_config_array_3d),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002336 .panel_minx = 0,
2337 .panel_maxx = 1919,
2338 .panel_miny = 0,
2339 .panel_maxy = 1199,
2340 .disp_minx = 0,
2341 .disp_maxx = 1919,
2342 .disp_miny = 0,
2343 .disp_maxy = 1199,
Jing Lineec88ca2012-02-08 11:18:30 -08002344 .irqflags = IRQF_TRIGGER_FALLING,
2345 .i2c_pull_up = true,
2346 .reset_gpio = MXT_TS_RESET_GPIO,
2347 .irq_gpio = MXT_TS_GPIO_IRQ,
2348};
2349
Mohan Pallaka50837382011-09-07 11:00:57 +05302350static struct i2c_board_info mxt_device_info[] __initdata = {
2351 {
2352 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
Mohan Pallaka50837382011-09-07 11:00:57 +05302353 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
2354 },
2355};
2356
Manoj Rao14648742012-03-30 19:42:12 -07002357static struct msm_mhl_platform_data mhl_platform_data = {
2358 .irq = MSM_GPIO_TO_INT(4),
Manoj Raoc6d904c2012-06-22 00:32:14 -07002359 .gpio_mhl_int = MHL_GPIO_INT,
2360 .gpio_mhl_reset = MHL_GPIO_RESET,
2361 .gpio_mhl_power = 0,
2362 .gpio_hdmi_mhl_mux = 0,
Manoj Rao14648742012-03-30 19:42:12 -07002363};
Manoj Rao14648742012-03-30 19:42:12 -07002364
Eugene Yasmand2316b82011-12-07 18:23:48 +02002365static struct i2c_board_info sii_device_info[] __initdata = {
2366 {
Manoj Rao14648742012-03-30 19:42:12 -07002367#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
2368 /*
2369 * keeps SI 8334 as the default
2370 * MHL TX
2371 */
2372 I2C_BOARD_INFO("sii8334", 0x39),
2373 .platform_data = &mhl_platform_data,
2374#endif
2375#ifdef CONFIG_FB_MSM_HDMI_MHL_9244
Eugene Yasmand2316b82011-12-07 18:23:48 +02002376 I2C_BOARD_INFO("Sil-9244", 0x39),
Eugene Yasmand2316b82011-12-07 18:23:48 +02002377 .irq = MSM_GPIO_TO_INT(15),
Manoj Rao14648742012-03-30 19:42:12 -07002378#endif /* CONFIG_MSM_HDMI_MHL */
2379 .flags = I2C_CLIENT_WAKE,
Eugene Yasmand2316b82011-12-07 18:23:48 +02002380 },
2381};
2382
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002383static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
2384 .clk_freq = 100000,
2385 .src_clk_rate = 24000000,
Kiran Gundab4696c72012-08-16 18:37:46 +05302386 .keep_ahb_clk_on = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002387};
2388
2389static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
2390 .clk_freq = 100000,
2391 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002392};
2393
2394static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
2395 .clk_freq = 100000,
2396 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002397};
2398
2399static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
2400 .clk_freq = 100000,
2401 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002402};
2403
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002404static struct ks8851_pdata spi_eth_pdata = {
2405 .irq_gpio = KS8851_IRQ_GPIO,
2406 .rst_gpio = KS8851_RST_GPIO,
2407};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06002408
Anirudh Ghayal50137fb2012-07-31 16:58:53 +05302409static struct spi_board_info spi_eth_info[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002410 {
2411 .modalias = "ks8851",
2412 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2413 .max_speed_hz = 19200000,
2414 .bus_num = 0,
2415 .chip_select = 0,
2416 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002417 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002418 },
Anirudh Ghayal50137fb2012-07-31 16:58:53 +05302419};
2420static struct spi_board_info spi_board_info[] __initdata = {
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07002421 {
2422 .modalias = "dsi_novatek_3d_panel_spi",
2423 .max_speed_hz = 10800000,
2424 .bus_num = 0,
2425 .chip_select = 1,
2426 .mode = SPI_MODE_0,
2427 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002428};
2429
2430static struct platform_device msm_device_saw_core0 = {
2431 .name = "saw-regulator",
2432 .id = 0,
2433 .dev = {
2434 .platform_data = &msm_saw_regulator_pdata_s5,
2435 },
2436};
2437
2438static struct platform_device msm_device_saw_core1 = {
2439 .name = "saw-regulator",
2440 .id = 1,
2441 .dev = {
2442 .platform_data = &msm_saw_regulator_pdata_s6,
2443 },
2444};
2445
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002446static struct tsens_platform_data msm_tsens_pdata = {
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002447 .slope = {910, 910, 910, 910, 910},
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002448 .tsens_factor = 1000,
2449 .hw_type = MSM_8960,
2450 .tsens_num_sensor = 5,
2451};
2452
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002453static struct platform_device msm_tsens_device = {
2454 .name = "tsens8960-tm",
2455 .id = -1,
2456};
2457
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002458static struct msm_thermal_data msm_thermal_pdata = {
2459 .sensor_id = 0,
Eugene Seah2ee4a5d2012-06-25 18:16:41 -06002460 .poll_ms = 250,
2461 .limit_temp_degC = 60,
2462 .temp_hysteresis_degC = 10,
2463 .freq_step = 2,
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002464};
2465
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002466#ifdef CONFIG_MSM_FAKE_BATTERY
2467static struct platform_device fish_battery_device = {
2468 .name = "fish_battery",
2469};
2470#endif
2471
David Collins26f05562011-06-20 09:56:28 -07002472static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002473 .name = GPIO_REGULATOR_DEV_NAME,
2474 .id = PM8921_MPP_PM_TO_SYS(7),
2475 .dev = {
2476 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2477 },
2478};
2479
David Collins26f05562011-06-20 09:56:28 -07002480static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002481 .name = GPIO_REGULATOR_DEV_NAME,
2482 .id = 91,
2483 .dev = {
2484 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2485 },
2486};
2487
David Collinsb10be1d2011-09-02 10:29:31 -07002488static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
2489 .name = GPIO_REGULATOR_DEV_NAME,
2490 .id = PM8921_GPIO_PM_TO_SYS(17),
2491 .dev = {
2492 .platform_data =
2493 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2494 },
2495};
2496
David Collins35a78f52011-12-14 15:54:25 -08002497static struct platform_device msm8960_device_ext_otg_sw_vreg __devinitdata = {
2498 .name = GPIO_REGULATOR_DEV_NAME,
2499 .id = PM8921_GPIO_PM_TO_SYS(42),
2500 .dev = {
2501 .platform_data =
2502 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_OTG_SW],
2503 },
2504};
2505
David Collins26f05562011-06-20 09:56:28 -07002506static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
2507 .name = "rpm-regulator",
2508 .id = -1,
2509 .dev = {
2510 .platform_data = &msm_rpm_regulator_pdata,
2511 },
2512};
Mayank Ranae009c922012-03-22 03:02:06 +05302513#ifdef CONFIG_SERIAL_MSM_HS
2514static int configure_uart_gpios(int on)
2515{
2516 int ret = 0, i;
2517 int uart_gpios[] = {93, 94, 95, 96};
2518
2519 for (i = 0; i < ARRAY_SIZE(uart_gpios); i++) {
2520 if (on) {
2521 ret = gpio_request(uart_gpios[i], NULL);
2522 if (ret) {
2523 pr_err("%s: unable to request uart gpio[%d]\n",
2524 __func__, uart_gpios[i]);
2525 break;
2526 }
2527 } else {
2528 gpio_free(uart_gpios[i]);
2529 }
2530 }
2531
2532 if (ret && on && i)
2533 for (; i >= 0; i--)
2534 gpio_free(uart_gpios[i]);
2535 return ret;
2536}
2537
2538static struct msm_serial_hs_platform_data msm_uart_dm9_pdata = {
Mayank Ranad85a5082012-04-29 17:24:13 -07002539 .gpio_config = configure_uart_gpios,
Mayank Ranae009c922012-03-22 03:02:06 +05302540};
Mayank Rana1f02d952012-07-04 19:11:20 +05302541
2542static int configure_gsbi8_uart_gpios(int on)
2543{
2544 int ret = 0, i;
2545 int uart_gpios[] = {34, 35, 36, 37};
2546
2547 for (i = 0; i < ARRAY_SIZE(uart_gpios); i++) {
2548 if (on) {
2549 ret = gpio_request(uart_gpios[i], NULL);
2550 if (ret) {
2551 pr_err("%s: unable to request uart gpio[%d]\n",
2552 __func__, uart_gpios[i]);
2553 break;
2554 }
2555 } else {
2556 gpio_free(uart_gpios[i]);
2557 }
2558 }
2559
2560 if (ret && on && i)
2561 for (; i >= 0; i--)
2562 gpio_free(uart_gpios[i]);
2563 return ret;
2564}
2565
2566static struct msm_serial_hs_platform_data msm_uart_dm8_pdata = {
2567 .gpio_config = configure_gsbi8_uart_gpios,
2568};
Mayank Ranae009c922012-03-22 03:02:06 +05302569#else
Mayank Rana1f02d952012-07-04 19:11:20 +05302570static struct msm_serial_hs_platform_data msm_uart_dm8_pdata;
Mayank Ranae009c922012-03-22 03:02:06 +05302571static struct msm_serial_hs_platform_data msm_uart_dm9_pdata;
2572#endif
David Collins26f05562011-06-20 09:56:28 -07002573
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302574#if defined(CONFIG_BT) && defined(CONFIG_BT_HCIUART_ATH3K)
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002575enum WLANBT_STATUS {
2576 WLANOFF_BTOFF = 1,
2577 WLANOFF_BTON,
2578 WLANON_BTOFF,
2579 WLANON_BTON
2580};
2581
2582static DEFINE_MUTEX(ath_wlanbt_mutex);
2583static int gpio_wlan_sys_rest_en = 26;
2584static int ath_wlanbt_status = WLANOFF_BTOFF;
2585
2586static int ath6kl_power_control(int on)
2587{
2588 int rc;
2589
2590 if (on) {
2591 rc = gpio_request(gpio_wlan_sys_rest_en, "wlan sys_rst_n");
2592 if (rc) {
2593 pr_err("%s: unable to request gpio %d (%d)\n",
2594 __func__, gpio_wlan_sys_rest_en, rc);
2595 return rc;
2596 }
2597 rc = gpio_direction_output(gpio_wlan_sys_rest_en, 0);
2598 msleep(200);
2599 rc = gpio_direction_output(gpio_wlan_sys_rest_en, 1);
2600 msleep(100);
2601 } else {
2602 gpio_set_value(gpio_wlan_sys_rest_en, 0);
2603 rc = gpio_direction_input(gpio_wlan_sys_rest_en);
2604 msleep(100);
2605 gpio_free(gpio_wlan_sys_rest_en);
2606 }
2607 return 0;
2608};
2609
2610static int ath6kl_wlan_power(int on)
2611{
2612 int ret = 0;
2613
2614 mutex_lock(&ath_wlanbt_mutex);
2615 if (on) {
2616 if (ath_wlanbt_status == WLANOFF_BTOFF) {
2617 ret = ath6kl_power_control(1);
2618 ath_wlanbt_status = WLANON_BTOFF;
2619 } else if (ath_wlanbt_status == WLANOFF_BTON)
2620 ath_wlanbt_status = WLANON_BTON;
2621 } else {
2622 if (ath_wlanbt_status == WLANON_BTOFF) {
2623 ret = ath6kl_power_control(0);
2624 ath_wlanbt_status = WLANOFF_BTOFF;
2625 } else if (ath_wlanbt_status == WLANON_BTON)
2626 ath_wlanbt_status = WLANOFF_BTON;
2627 }
2628 mutex_unlock(&ath_wlanbt_mutex);
2629 pr_debug("%s on= %d, wlan_status= %d\n",
2630 __func__, on, ath_wlanbt_status);
2631 return ret;
2632};
2633
2634static struct wifi_platform_data ath6kl_wifi_control = {
2635 .set_power = ath6kl_wlan_power,
2636};
2637
2638static struct platform_device msm_wlan_power_device = {
2639 .name = "ath6kl_power",
2640 .dev = {
2641 .platform_data = &ath6kl_wifi_control,
2642 },
2643};
2644
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302645static struct resource bluesleep_resources[] = {
2646 {
2647 .name = "gpio_host_wake",
2648 .start = 27,
2649 .end = 27,
2650 .flags = IORESOURCE_IO,
2651 },
2652 {
2653 .name = "gpio_ext_wake",
2654 .start = 29,
2655 .end = 29,
2656 .flags = IORESOURCE_IO,
2657 },
2658 {
2659 .name = "host_wake",
2660 .start = MSM_GPIO_TO_INT(27),
2661 .end = MSM_GPIO_TO_INT(27),
2662 .flags = IORESOURCE_IRQ,
2663 },
2664};
2665
2666static struct platform_device msm_bluesleep_device = {
2667 .name = "bluesleep",
2668 .id = -1,
2669 .num_resources = ARRAY_SIZE(bluesleep_resources),
2670 .resource = bluesleep_resources,
2671};
2672
2673static struct platform_device msm_bt_power_device = {
2674 .name = "bt_power",
2675};
2676
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002677static int gpio_bt_sys_rest_en = 28;
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302678
2679static int bluetooth_power(int on)
2680{
2681 int rc;
2682
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002683 mutex_lock(&ath_wlanbt_mutex);
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302684 if (on) {
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002685 if (ath_wlanbt_status == WLANOFF_BTOFF) {
2686 ath6kl_power_control(1);
2687 ath_wlanbt_status = WLANOFF_BTON;
2688 } else if (ath_wlanbt_status == WLANON_BTOFF)
2689 ath_wlanbt_status = WLANON_BTON;
2690
Ram Mohan Korukondab07c2632012-08-18 22:24:03 +05302691 rc = gpio_request(gpio_bt_sys_rest_en, "bt sys_rst_n");
2692 if (rc) {
2693 pr_err("%s: unable to request gpio %d (%d)\n",
2694 __func__, gpio_bt_sys_rest_en, rc);
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002695 mutex_unlock(&ath_wlanbt_mutex);
2696 return rc;
Ram Mohan Korukondab07c2632012-08-18 22:24:03 +05302697 }
2698 rc = gpio_direction_output(gpio_bt_sys_rest_en, 0);
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002699 msleep(20);
2700 rc = gpio_direction_output(gpio_bt_sys_rest_en, 1);
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302701 msleep(100);
2702 } else {
2703 gpio_set_value(gpio_bt_sys_rest_en, 0);
2704 rc = gpio_direction_input(gpio_bt_sys_rest_en);
2705 msleep(100);
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002706 gpio_free(gpio_bt_sys_rest_en);
Ram Mohan Korukondab07c2632012-08-18 22:24:03 +05302707
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002708 if (ath_wlanbt_status == WLANOFF_BTON) {
2709 ath6kl_power_control(0);
2710 ath_wlanbt_status = WLANOFF_BTOFF;
2711 } else if (ath_wlanbt_status == WLANON_BTON)
2712 ath_wlanbt_status = WLANON_BTOFF;
2713 }
2714 mutex_unlock(&ath_wlanbt_mutex);
2715 pr_debug("%s on= %d, wlan_status= %d\n",
2716 __func__, on, ath_wlanbt_status);
2717 return 0;
2718};
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302719
2720static void __init bt_power_init(void)
2721{
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302722 msm_bt_power_device.dev.platform_data = &bluetooth_power;
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302723 return;
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002724};
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302725#else
2726#define bt_power_init(x) do {} while (0)
2727#endif
2728
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002729static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07002730 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002731 &msm_device_smd,
Mayank Rana9f51f582011-08-04 18:35:59 +05302732 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002733 &msm_device_saw_core0,
2734 &msm_device_saw_core1,
2735 &msm8960_device_ext_5v_vreg,
David Collins87579612012-01-30 16:00:15 -08002736 &msm8960_device_ssbi_pmic,
David Collins96aa3e12012-02-29 10:31:34 -08002737 &msm8960_device_ext_otg_sw_vreg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002738 &msm8960_device_qup_spi_gsbi1,
2739 &msm8960_device_qup_i2c_gsbi3,
2740 &msm8960_device_qup_i2c_gsbi4,
2741 &msm8960_device_qup_i2c_gsbi10,
2742#ifndef CONFIG_MSM_DSPS
2743 &msm8960_device_qup_i2c_gsbi12,
2744#endif
2745 &msm_slim_ctrl,
2746 &msm_device_wcnss_wlan,
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302747#if defined(CONFIG_BT) && defined(CONFIG_BT_HCIUART_ATH3K)
2748 &msm_bluesleep_device,
2749 &msm_bt_power_device,
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002750 &msm_wlan_power_device,
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302751#endif
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002752#if defined(CONFIG_QSEECOM)
2753 &qseecom_device,
2754#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002755#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2756 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2757 &qcrypto_device,
2758#endif
2759
2760#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2761 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2762 &qcedev_device,
2763#endif
2764#ifdef CONFIG_MSM_ROTATOR
2765 &msm_rotator_device,
2766#endif
2767 &msm_device_sps,
2768#ifdef CONFIG_MSM_FAKE_BATTERY
2769 &fish_battery_device,
2770#endif
Laura Abbottb93525f2012-04-12 09:57:19 -07002771 &msm8960_fmem_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002772#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07002773#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002774 &msm8960_android_pmem_device,
2775 &msm8960_android_pmem_adsp_device,
2776 &msm8960_android_pmem_audio_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002777#endif
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -07002778#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002779 &msm_device_bam_dmux,
2780 &msm_fm_platform_init,
Joel Nidera1261942011-09-12 16:30:09 +03002781#if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE)
2782#ifdef CONFIG_MSM_USE_TSIF1
2783 &msm_device_tsif[1],
2784#else
2785 &msm_device_tsif[0],
2786#endif
2787#endif
Joel Nider266a2642011-10-16 10:58:05 +02002788 &msm_device_tspp,
Mona Hossain9c430e32011-07-27 11:04:47 -07002789#ifdef CONFIG_HW_RANDOM_MSM
2790 &msm_device_rng,
2791#endif
Laura Abbottd6183792011-08-19 13:42:24 -07002792#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002793 &msm8960_ion_dev,
Laura Abbottd6183792011-08-19 13:42:24 -07002794#endif
Praveen Chidambaram78499012011-11-01 17:15:17 -06002795 &msm8960_rpm_device,
2796 &msm8960_rpm_log_device,
2797 &msm8960_rpm_stat_device,
Anji Jonnala2a8bd312012-11-01 13:11:42 +05302798 &msm8960_rpm_master_stat_device,
Mona Hossain11c03ac2011-10-26 12:42:10 -07002799 &msm_device_tz_log,
Pratik Patel3b0ca882012-06-01 16:54:14 -07002800 &coresight_tpiu_device,
2801 &coresight_etb_device,
2802 &coresight_funnel_device,
2803 &coresight_etm0_device,
2804 &coresight_etm1_device,
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07002805 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002806 &msm8960_device_watchdog,
Laura Abbottb93525f2012-04-12 09:57:19 -07002807 &msm8960_rtb_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002808 &msm8960_device_cache_erp,
Stepan Moskovchenkoc0557252012-06-07 17:39:14 -07002809 &msm8960_device_ebi1_ch0_erp,
2810 &msm8960_device_ebi1_ch1_erp,
Laura Abbottb93525f2012-04-12 09:57:19 -07002811 &msm8960_cache_dump_device,
Laura Abbott0577d7b2012-04-17 11:14:30 -07002812 &msm8960_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002813 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002814};
2815
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002816static struct platform_device *cdp_devices[] __initdata = {
Stephen Boydeb819882011-08-29 14:46:30 -07002817 &msm_8960_q6_lpass,
Stephen Boyd322a9922011-09-20 01:05:54 -07002818 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07002819 &msm_pil_tzapps,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07002820 &msm_pil_dsps,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002821 &msm_pil_vidc,
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002822 &msm8960_device_otg,
2823 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002824 &msm_device_hsusb_host,
2825 &android_usb_device,
2826 &msm_pcm,
Kiran Kandi5e809b02012-01-31 00:24:33 -08002827 &msm_multi_ch_pcm,
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -07002828 &msm_lowlatency_pcm,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002829 &msm_pcm_routing,
2830 &msm_cpudai0,
2831 &msm_cpudai1,
Kiran Kandi97fe19d2012-05-20 22:34:04 -07002832 &msm8960_cpudai_slimbus_2_rx,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002833 &msm8960_cpudai_slimbus_2_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002834 &msm_cpudai_hdmi_rx,
2835 &msm_cpudai_bt_rx,
2836 &msm_cpudai_bt_tx,
2837 &msm_cpudai_fm_rx,
2838 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002839 &msm_cpudai_auxpcm_rx,
2840 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002841 &msm_cpu_fe,
2842 &msm_stub_codec,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002843#ifdef CONFIG_MSM_GEMINI
2844 &msm8960_gemini_device,
2845#endif
Kalyani Oruganti465d1e12012-05-15 10:23:05 -07002846#ifdef CONFIG_MSM_MERCURY
2847 &msm8960_mercury_device,
2848#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002849 &msm_voice,
2850 &msm_voip,
2851 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05302852 &msm_cpudai_afe_01_rx,
2853 &msm_cpudai_afe_01_tx,
2854 &msm_cpudai_afe_02_rx,
2855 &msm_cpudai_afe_02_tx,
2856 &msm_pcm_afe,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05302857 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07002858 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07002859 &msm_cpudai_incall_record_rx,
2860 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002861 &msm_pcm_hostless,
2862 &msm_bus_apps_fabric,
2863 &msm_bus_sys_fabric,
2864 &msm_bus_mm_fabric,
2865 &msm_bus_sys_fpb,
2866 &msm_bus_cpss_fpb,
2867};
2868
2869static void __init msm8960_i2c_init(void)
2870{
2871 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2872 &msm8960_i2c_qup_gsbi4_pdata;
2873
2874 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2875 &msm8960_i2c_qup_gsbi3_pdata;
2876
2877 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2878 &msm8960_i2c_qup_gsbi10_pdata;
2879
2880 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2881 &msm8960_i2c_qup_gsbi12_pdata;
2882}
2883
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002884static void __init msm8960_gfx_init(void)
2885{
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002886 struct kgsl_device_platform_data *kgsl_3d0_pdata =
2887 msm_kgsl_3d0.dev.platform_data;
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06002888 uint32_t soc_platform_version = socinfo_get_version();
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002889
Carter Cooper3852cbb2012-08-20 22:11:42 -06002890 /* Fixup data that needs to change based on GPU ID */
Carter Cooperffe7ea12012-08-22 13:27:58 -06002891 if (cpu_is_msm8960ab()) {
2892 kgsl_3d0_pdata->chipid = ADRENO_CHIPID(3, 2, 1, 0);
Carter Cooper3852cbb2012-08-20 22:11:42 -06002893 /* 8960PRO nominal clock rate is 325Mhz instead of 320Mhz */
2894 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 325000000;
2895 } else {
2896 kgsl_3d0_pdata->iommu_count = 1;
2897 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
2898 kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
2899 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
2900 }
2901 if (SOCINFO_VERSION_MAJOR(soc_platform_version) >= 3) {
2902 /* 8960v3 GPU registers returns 5 for patch release
2903 * but it should be 6, so dummy up the chipid here
2904 * based the platform type
2905 */
2906 kgsl_3d0_pdata->chipid = ADRENO_CHIPID(2, 2, 0, 6);
2907 }
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002908 }
Carter Cooper6307eb992012-08-20 15:17:23 -06002909
2910 /* Register the 3D core */
2911 platform_device_register(&msm_kgsl_3d0);
2912
2913 /* Register the 2D cores if we are not 8960PRO */
2914 if (!cpu_is_msm8960ab()) {
2915 platform_device_register(&msm_kgsl_2d0);
2916 platform_device_register(&msm_kgsl_2d1);
2917 }
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002918}
2919
Subhash Jadavani933e6a62011-12-26 18:05:04 +05302920static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002921 {
2922 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2923 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2924 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002925 1, 784, 180000, 100,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002926 },
2927
2928 {
2929 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2930 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2931 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002932 1300, 228, 1200000, 2000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002933 },
2934
2935 {
2936 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2937 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2938 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002939 2000, 138, 1208400, 3200,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002940 },
2941
2942 {
2943 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06002944 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2945 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002946 6000, 119, 1850300, 9000,
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06002947 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002948
2949 {
2950 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2951 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2952 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002953 9200, 68, 2839200, 16400,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002954 },
2955
2956 {
2957 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2958 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2959 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002960 10300, 63, 3128000, 18200,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002961 },
2962
2963 {
2964 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2965 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2966 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002967 18000, 10, 4602600, 27000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002968 },
2969
2970 {
2971 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2972 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2973 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002974 20000, 2, 5752000, 32000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002975 },
2976};
2977
Praveen Chidambaram78499012011-11-01 17:15:17 -06002978static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2979 .levels = &msm_rpmrs_levels[0],
2980 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2981 .vdd_mem_levels = {
2982 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2983 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2984 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2985 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2986 },
2987 .vdd_dig_levels = {
2988 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
2989 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
2990 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
2991 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
2992 },
2993 .vdd_mask = 0x7FFFFF,
2994 .rpmrs_target_id = {
2995 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2996 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
2997 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
2998 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
2999 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
3000 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
3001 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
3002 },
3003};
3004
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06003005static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
3006 .mode = MSM_PM_BOOT_CONFIG_TZ,
3007};
3008
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003009#ifdef CONFIG_I2C
3010#define I2C_SURF 1
3011#define I2C_FFA (1 << 1)
3012#define I2C_RUMI (1 << 2)
3013#define I2C_SIM (1 << 3)
3014#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03003015#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003016
3017struct i2c_registry {
3018 u8 machs;
3019 int bus;
3020 struct i2c_board_info *info;
3021 int len;
3022};
3023
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003024/* Sensors DSPS platform data */
3025#ifdef CONFIG_MSM_DSPS
3026#define DSPS_PIL_GENERIC_NAME "dsps"
3027#endif /* CONFIG_MSM_DSPS */
3028
3029static void __init msm8960_init_dsps(void)
3030{
3031#ifdef CONFIG_MSM_DSPS
3032 struct msm_dsps_platform_data *pdata =
3033 msm_dsps_device.dev.platform_data;
3034 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
3035 pdata->gpios = NULL;
3036 pdata->gpios_num = 0;
3037
3038 platform_device_register(&msm_dsps_device);
3039#endif /* CONFIG_MSM_DSPS */
3040}
3041
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -08003042static int hsic_peripheral_status = 1;
3043static DEFINE_MUTEX(hsic_status_lock);
3044
3045void peripheral_connect()
3046{
3047 mutex_lock(&hsic_status_lock);
3048 if (hsic_peripheral_status)
3049 goto out;
3050 platform_device_add(&msm_device_hsic_host);
3051 hsic_peripheral_status = 1;
3052out:
3053 mutex_unlock(&hsic_status_lock);
3054}
3055EXPORT_SYMBOL(peripheral_connect);
3056
3057void peripheral_disconnect()
3058{
3059 mutex_lock(&hsic_status_lock);
3060 if (!hsic_peripheral_status)
3061 goto out;
3062 platform_device_del(&msm_device_hsic_host);
3063 hsic_peripheral_status = 0;
3064out:
3065 mutex_unlock(&hsic_status_lock);
3066}
3067EXPORT_SYMBOL(peripheral_disconnect);
3068
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303069static void __init msm8960_init_smsc_hub(void)
3070{
3071 uint32_t version = socinfo_get_version();
3072
3073 if (SOCINFO_VERSION_MAJOR(version) == 1)
3074 return;
3075
3076 if (machine_is_msm8960_liquid())
3077 platform_device_register(&smsc_hub_device);
3078}
3079
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003080static void __init msm8960_init_hsic(void)
3081{
3082#ifdef CONFIG_USB_EHCI_MSM_HSIC
3083 uint32_t version = socinfo_get_version();
3084
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08003085 if (SOCINFO_VERSION_MAJOR(version) == 1)
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003086 return;
3087
Joel King0cbf5d82012-05-24 15:21:38 -07003088 if (machine_is_msm8960_liquid())
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08003089 platform_device_register(&msm_device_hsic_host);
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003090#endif
3091}
3092
Amir Samuelov5137e392011-09-21 17:31:25 +03003093#ifdef CONFIG_ISL9519_CHARGER
3094static struct isl_platform_data isl_data __initdata = {
3095 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
3096 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
3097 .max_system_voltage = 4200,
3098 .min_system_voltage = 3200,
Amir Samuelov95f49ff2012-01-29 09:14:08 +02003099 .chgcurrent = 1900,
3100 .term_current = 0,
Amir Samuelov5137e392011-09-21 17:31:25 +03003101 .input_current = 2048,
3102};
3103
3104static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
3105 {
3106 I2C_BOARD_INFO("isl9519q", 0x9),
3107 .irq = 0, /* Not required when notify-by-pmic */
3108 .platform_data = &isl_data,
3109 },
3110};
3111#endif /* CONFIG_ISL9519_CHARGER */
3112
Amir Samuelov755616d2011-12-13 16:34:46 +02003113static struct i2c_board_info liquid_io_expander_i2c_info[] __initdata = {
3114 {
3115 I2C_BOARD_INFO("sx1508q", 0x20),
3116 .platform_data = &msm8960_sx150x_data[SX150X_LIQUID]
3117 },
3118};
3119
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003120static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Amir Samuelov5137e392011-09-21 17:31:25 +03003121#ifdef CONFIG_ISL9519_CHARGER
3122 {
3123 I2C_LIQUID,
3124 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
3125 isl_charger_i2c_info,
3126 ARRAY_SIZE(isl_charger_i2c_info),
3127 },
3128#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003129 {
3130 I2C_SURF | I2C_FFA | I2C_FLUID,
3131 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3132 cyttsp_info,
3133 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07003134 },
Mohan Pallaka50837382011-09-07 11:00:57 +05303135 {
3136 I2C_LIQUID,
3137 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3138 mxt_device_info,
3139 ARRAY_SIZE(mxt_device_info),
3140 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05303141 {
Manoj Rao14648742012-03-30 19:42:12 -07003142 I2C_SURF | I2C_FFA | I2C_LIQUID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05303143 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Eugene Yasmand2316b82011-12-07 18:23:48 +02003144 sii_device_info,
3145 ARRAY_SIZE(sii_device_info),
3146 },
3147 {
Anirudh Ghayal15698162012-07-31 11:51:32 +05303148 I2C_LIQUID | I2C_FFA,
Eugene Yasmand2316b82011-12-07 18:23:48 +02003149 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05303150 msm_isa1200_board_info,
3151 ARRAY_SIZE(msm_isa1200_board_info),
3152 },
Amir Samuelov755616d2011-12-13 16:34:46 +02003153 {
3154 I2C_LIQUID,
3155 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
3156 liquid_io_expander_i2c_info,
3157 ARRAY_SIZE(liquid_io_expander_i2c_info),
3158 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003159};
3160#endif /* CONFIG_I2C */
3161
3162static void __init register_i2c_devices(void)
3163{
3164#ifdef CONFIG_I2C
3165 u8 mach_mask = 0;
3166 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08003167#ifdef CONFIG_MSM_CAMERA
3168 struct i2c_registry msm8960_camera_i2c_devices = {
3169 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
3170 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
3171 msm8960_camera_board_info.board_info,
3172 msm8960_camera_board_info.num_i2c_board_info,
3173 };
3174#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003175
3176 /* Build the matching 'supported_machs' bitmask */
3177 if (machine_is_msm8960_cdp())
3178 mach_mask = I2C_SURF;
Amy Maloche2d028032011-07-20 14:08:06 -07003179 else if (machine_is_msm8960_fluid())
3180 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03003181 else if (machine_is_msm8960_liquid())
3182 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07003183 else if (machine_is_msm8960_mtp())
3184 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003185 else
3186 pr_err("unmatched machine ID in register_i2c_devices\n");
3187
Jing Lineec88ca2012-02-08 11:18:30 -08003188 if (machine_is_msm8960_liquid()) {
3189 if (SOCINFO_VERSION_MAJOR(socinfo_get_platform_version()) == 3)
3190 mxt_device_info[0].platform_data =
3191 &mxt_platform_data_3d;
3192 else
3193 mxt_device_info[0].platform_data =
3194 &mxt_platform_data_2d;
3195 }
3196
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003197 /* Run the array and install devices as appropriate */
3198 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
3199 if (msm8960_i2c_devices[i].machs & mach_mask)
3200 i2c_register_board_info(msm8960_i2c_devices[i].bus,
3201 msm8960_i2c_devices[i].info,
3202 msm8960_i2c_devices[i].len);
3203 }
Manoj Raoc6d904c2012-06-22 00:32:14 -07003204
3205 if (!mhl_platform_data.gpio_mhl_power)
3206 pr_debug("mhl device configured for ext debug board\n");
3207
Kevin Chan09f4e662011-12-16 08:17:02 -08003208#ifdef CONFIG_MSM_CAMERA
3209 if (msm8960_camera_i2c_devices.machs & mach_mask)
3210 i2c_register_board_info(msm8960_camera_i2c_devices.bus,
3211 msm8960_camera_i2c_devices.info,
3212 msm8960_camera_i2c_devices.len);
3213#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003214#endif
3215}
3216
Siddartha Mohanadoss9e1417c2012-09-26 09:42:32 -07003217static void __init msm8960_tsens_init(void)
3218{
3219 if (cpu_is_msm8960())
3220 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) == 1)
3221 return;
3222
3223 msm_tsens_early_init(&msm_tsens_pdata);
3224}
3225
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003226static void __init msm8960_cdp_init(void)
3227{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07003228 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
3229 pr_err("meminfo_init() failed!\n");
3230
Rohit Vaswanib1cc4932012-07-23 21:30:11 -07003231 platform_device_register(&msm_gpio_device);
Siddartha Mohanadoss9e1417c2012-09-26 09:42:32 -07003232 msm8960_tsens_init();
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06003233 msm_thermal_init(&msm_thermal_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06003234 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
3235 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07003236
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003237 regulator_suppress_info_printing();
3238 if (msm_xo_init())
3239 pr_err("Failed to initialize XO votes\n");
David Collins4c93ce92012-09-04 15:44:19 -07003240 configure_msm8960_power_grid();
David Collins26f05562011-06-20 09:56:28 -07003241 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07003242 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05303243 if (machine_is_msm8960_liquid())
3244 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003245 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05303246 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
3247 machine_is_msm8960_cdp()) {
Mayank Ranaa1f507b2012-08-14 10:57:00 +05303248 /* Due to availability of USB Switch in SGLTE Platform
3249 * it requires different HSUSB PHY settings compare to
3250 * 8960 MTP/CDP platform.
3251 */
3252 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
3253 msm_otg_pdata.phy_init_seq = sglte_phy_init_seq;
3254 else
3255 msm_otg_pdata.phy_init_seq = wr_phy_init_seq;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05303256 } else if (machine_is_msm8960_liquid()) {
3257 msm_otg_pdata.phy_init_seq =
3258 liquid_v1_phy_init_seq;
3259 }
Ofir Cohen94213a72012-05-03 14:26:32 +03003260 android_usb_pdata.swfi_latency =
Anji jonnalaa7c1c5c2011-12-12 12:20:36 +05303261 msm_rpmrs_levels[0].latency_us;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303262 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303263 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2 &&
3264 machine_is_msm8960_liquid())
3265 msm_device_hsic_host.dev.parent = &smsc_hub_device.dev;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08003266 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003267 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3268 &msm8960_qup_spi_gsbi1_pdata;
3269 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Anirudh Ghayal50137fb2012-07-31 16:58:53 +05303270 if (socinfo_get_platform_subtype() != PLATFORM_SUBTYPE_SGLTE)
3271 spi_register_board_info(spi_eth_info, ARRAY_SIZE(spi_eth_info));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003272
3273 msm8960_init_pmic();
Anirudh Ghayal15698162012-07-31 11:51:32 +05303274 if (machine_is_msm8960_liquid() || (machine_is_msm8960_mtp() &&
3275 (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)))
Mohan Pallakaf69f0492011-11-21 13:08:33 +05303276 msm_isa1200_board_info[0].platform_data = &isa1200_1_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003277 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003278 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003279 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3280 msm_spm_l2_init(msm_spm_l2_data);
3281 msm8960_init_buses();
Matt Wagantall1f65d9d2012-04-25 14:24:20 -07003282 platform_add_devices(msm8960_footswitch, msm8960_num_footswitch);
David Collinsb10be1d2011-09-02 10:29:31 -07003283 if (machine_is_msm8960_liquid())
3284 platform_device_register(&msm8960_device_ext_3p3v_vreg);
David Collinsd5a40732011-11-29 15:53:56 -08003285 if (machine_is_msm8960_cdp())
3286 platform_device_register(&msm8960_device_ext_l2_vreg);
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07003287
3288 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
3289 platform_device_register(&msm8960_device_uart_gsbi8);
3290 else
3291 platform_device_register(&msm8960_device_uart_gsbi5);
3292
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003293 /* For 8960 Fusion 2.2 Primary IPC */
Mayank Ranad85a5082012-04-29 17:24:13 -07003294 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE) {
3295 msm_uart_dm9_pdata.wakeup_irq = gpio_to_irq(94); /* GSBI9(2) */
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003296 msm_device_uart_dm9.dev.platform_data = &msm_uart_dm9_pdata;
Mayank Rana77f83c22012-07-10 09:31:02 +05303297 platform_device_register(&msm_device_uart_dm9);
Mayank Ranad85a5082012-04-29 17:24:13 -07003298 }
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003299
Mayank Rana1f02d952012-07-04 19:11:20 +05303300 /* For 8960 Standalone External Bluetooth Interface */
3301 if (socinfo_get_platform_subtype() != PLATFORM_SUBTYPE_SGLTE) {
3302 msm_device_uart_dm8.dev.platform_data = &msm_uart_dm8_pdata;
3303 platform_device_register(&msm_device_uart_dm8);
3304 }
Patrick Daly6578e0c2012-07-19 18:50:02 -07003305 if (cpu_is_msm8960ab())
3306 platform_device_register(&msm8960ab_device_acpuclk);
3307 else
3308 platform_device_register(&msm8960_device_acpuclk);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003309 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Arun Menond4837f62012-08-20 15:25:50 -07003310 msm8960_add_vidc_device();
Patrick Daly6578e0c2012-07-19 18:50:02 -07003311
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003312 msm8960_pm8921_gpio_mpp_init();
Stephen Boyd0ea1b762012-09-13 12:41:31 -07003313 /* Don't add modem devices on APQ targets */
3314 if (socinfo_get_id() != 124) {
3315 platform_device_register(&msm_8960_q6_mss_fw);
3316 platform_device_register(&msm_8960_q6_mss_sw);
3317 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003318 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303319 msm8960_init_smsc_hub();
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003320 msm8960_init_hsic();
Steve Mucklef132c6c2012-06-06 18:30:57 -07003321#ifdef CONFIG_MSM_CAMERA
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003322 msm8960_init_cam();
Steve Mucklef132c6c2012-06-06 18:30:57 -07003323#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003324 msm8960_init_mmc();
Mohan Pallaka50837382011-09-07 11:00:57 +05303325 if (machine_is_msm8960_liquid())
3326 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003327 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08003328 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003329 slim_register_board_info(msm_slim_devices,
3330 ARRAY_SIZE(msm_slim_devices));
3331 msm8960_init_dsps();
Larry Bassela7eadea2011-07-14 10:46:00 -07003332 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06003333 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05303334 bt_power_init();
Joel King0cbf5d82012-05-24 15:21:38 -07003335 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE) {
3336 mdm_sglte_device.dev.platform_data = &sglte_platform_data;
3337 platform_device_register(&mdm_sglte_device);
3338 }
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003339}
3340
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003341MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
3342 .map_io = msm8960_map_io,
3343 .reserve = msm8960_reserve,
3344 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303345 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003346 .timer = &msm_timer,
3347 .init_machine = msm8960_cdp_init,
3348 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003349 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003350 .restart = msm_restart,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003351MACHINE_END
3352
3353MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
3354 .map_io = msm8960_map_io,
3355 .reserve = msm8960_reserve,
3356 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303357 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003358 .timer = &msm_timer,
3359 .init_machine = msm8960_cdp_init,
3360 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003361 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003362 .restart = msm_restart,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003363MACHINE_END
3364
3365MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
3366 .map_io = msm8960_map_io,
3367 .reserve = msm8960_reserve,
3368 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303369 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003370 .timer = &msm_timer,
3371 .init_machine = msm8960_cdp_init,
3372 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003373 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003374 .restart = msm_restart,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003375MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003376
3377MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
3378 .map_io = msm8960_map_io,
3379 .reserve = msm8960_reserve,
3380 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303381 .handle_irq = gic_handle_irq,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003382 .timer = &msm_timer,
3383 .init_machine = msm8960_cdp_init,
3384 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003385 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003386 .restart = msm_restart,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003387MACHINE_END