blob: 8da2c9bd85104cb012b1a3609f3245391511c041 [file] [log] [blame]
Harini Jayaramana9873ab2011-12-20 17:29:48 -07001/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080012 */
13#include <linux/kernel.h>
14#include <linux/platform_device.h>
15#include <linux/io.h>
16#include <linux/irq.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070017#include <linux/i2c.h>
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -070018#include <linux/i2c/sx150x.h>
Amir Samuelov5137e392011-09-21 17:31:25 +030019#include <linux/i2c/isl9519.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070020#include <linux/gpio.h>
21#include <linux/msm_ssbi.h>
22#include <linux/regulator/gpio-regulator.h>
23#include <linux/mfd/pm8xxx/pm8921.h>
Siddartha Mohanadossaf91d902011-10-20 10:23:34 -070024#include <linux/mfd/pm8xxx/pm8xxx-adc.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070025#include <linux/regulator/consumer.h>
26#include <linux/spi/spi.h>
27#include <linux/slimbus/slimbus.h>
28#include <linux/bootmem.h>
Lucille Sylvester34ec3692011-08-16 16:28:04 -060029#include <linux/msm_kgsl.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070030#ifdef CONFIG_ANDROID_PMEM
31#include <linux/android_pmem.h>
32#endif
33#include <linux/cyttsp.h>
34#include <linux/dma-mapping.h>
35#include <linux/platform_data/qcom_crypto_device.h>
Ankur Nandwanib0039b02011-08-09 14:00:45 -070036#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070037#include <linux/leds.h>
38#include <linux/leds-pm8xxx.h>
Mohan Pallaka50837382011-09-07 11:00:57 +053039#include <linux/i2c/atmel_mxt_ts.h>
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -070040#include <linux/msm_tsens.h>
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -070041#include <linux/ks8851.h>
Mohan Pallaka5e490392011-09-09 15:18:41 +053042#include <linux/i2c/isa1200.h>
Jack Cheung0b1987e2011-11-18 13:36:29 -080043#include <linux/memory.h>
Larry Bassel2d8b42d2012-03-12 10:41:26 -070044#include <linux/memblock.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080045
46#include <asm/mach-types.h>
47#include <asm/mach/arch.h>
Larry Basselb4126da2011-07-18 14:31:33 -070048#include <asm/setup.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080049#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070050#include <asm/mach/mmc.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080051
52#include <mach/board.h>
53#include <mach/msm_iomap.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070054#include <mach/msm_spi.h>
Mayank Ranae009c922012-03-22 03:02:06 +053055#include <mach/msm_serial_hs.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070056#ifdef CONFIG_USB_MSM_OTG_72K
57#include <mach/msm_hsusb.h>
58#else
59#include <linux/usb/msm_hsusb.h>
60#endif
61#include <linux/usb/android.h>
62#include <mach/usbdiag.h>
63#include <mach/socinfo.h>
64#include <mach/rpm.h>
65#include <mach/gpio.h>
Rohit Vaswania513aa8d2011-07-18 15:14:28 -070066#include <mach/gpiomux.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070067#include <mach/msm_bus_board.h>
68#include <mach/msm_memtypes.h>
69#include <mach/dma.h>
70#include <mach/msm_dsps.h>
71#include <mach/msm_xo.h>
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -070072#include <mach/restart.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080073
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070074#ifdef CONFIG_WCD9310_CODEC
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +053075#include <linux/mfd/wcd9xxx/core.h>
76#include <linux/mfd/wcd9xxx/pdata.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070077#endif
78
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +053079#include <linux/smsc3503.h>
Laura Abbottd6183792011-08-19 13:42:24 -070080#include <linux/ion.h>
81#include <mach/ion.h>
Joel Kingb8352a12011-11-15 18:46:24 -080082#include <mach/mdm2.h>
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -080083#include <mach/mdm-peripheral.h>
Laura Abbottf8c03b92012-02-16 14:57:58 -080084#include <mach/msm_rtb.h>
Laura Abbott306bcc22012-03-08 11:24:53 -080085#include <mach/msm_cache_dump.h>
86#include <mach/scm.h>
Laura Abbottd6183792011-08-19 13:42:24 -070087
Larry Bassel41a055b2011-12-06 16:15:14 -080088#include <linux/fmem.h>
89
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070090#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080091#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070092#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070093#include "spm.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080094#include "board-8960.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080095#include "pm.h"
Abhijeet Dharmapurikarefaca4f2011-12-27 16:24:07 -080096#include <mach/cpuidle.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070097#include "rpm_resources.h"
Subhash Jadavani909e04f2012-04-12 10:52:50 +053098#include <mach/mpm.h>
Matt Wagantall6d9ebee2011-08-26 12:15:24 -070099#include "acpuclock.h"
Naveen Ramaraj76483ad2011-09-06 14:25:44 -0700100#include "smd_private.h"
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -0600101#include "pm-boot.h"
Jeff Ohlstein7e668552011-10-06 16:17:25 -0700102#include "msm_watchdog.h"
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800103
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700104static struct platform_device msm_fm_platform_init = {
105 .name = "iris_fm",
106 .id = -1,
107};
108
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700109#define KS8851_RST_GPIO 89
110#define KS8851_IRQ_GPIO 90
Mohan Pallaka5e490392011-09-09 15:18:41 +0530111#define HAP_SHIFT_LVL_OE_GPIO 47
112
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700113#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700114
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800115struct sx150x_platform_data msm8960_sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700116 [SX150X_CAM] = {
117 .gpio_base = GPIO_CAM_EXPANDER_BASE,
118 .oscio_is_gpo = false,
119 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530120 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700121 .io_open_drain_ena = 0x0,
122 .irq_summary = -1,
123 },
Amir Samuelov755616d2011-12-13 16:34:46 +0200124 [SX150X_LIQUID] = {
125 .gpio_base = GPIO_LIQUID_EXPANDER_BASE,
126 .oscio_is_gpo = false,
127 .io_pullup_ena = 0x0c08,
128 .io_pulldn_ena = 0x4060,
129 .io_open_drain_ena = 0x000c,
130 .io_polarity = 0,
131 .irq_summary = -1,
132 },
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700133};
Nishant Pandit474f2252011-07-23 23:17:56 +0530134
135#endif
136
Olav Haugana21169d2012-01-04 09:17:06 -0800137#define MSM_PMEM_ADSP_SIZE 0x7800000
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -0700138#define MSM_PMEM_AUDIO_SIZE 0x4CF000
Mathew Karimpanal15fa5c42011-12-14 21:28:10 -0800139#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800140#define MSM_LIQUID_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800141#define MSM_HDMI_PRIM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Laura Abbott2d1760b2011-09-29 21:31:24 -0700142
143#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -0700144#define MSM_PMEM_KERNEL_EBI1_SIZE 0x65000
Olav Haugan32594552012-03-13 11:40:05 -0700145#ifdef CONFIG_MSM_IOMMU
146#define MSM_ION_MM_SIZE 0x3800000
147#define MSM_ION_SF_SIZE 0x0
Olav Hauganfbbf05b2012-04-05 14:33:41 -0700148#define MSM_ION_QSECOM_SIZE 0x780000 /* (7.5MB) */
Olav Haugan32594552012-03-13 11:40:05 -0700149#define MSM_ION_HEAP_NUM 7
150#else
151#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
152#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Hauganfbbf05b2012-04-05 14:33:41 -0700153#define MSM_ION_QSECOM_SIZE 0x600000 /* (6MB) */
Olav Haugan32594552012-03-13 11:40:05 -0700154#define MSM_ION_HEAP_NUM 8
155#endif
Olav Haugan42ebe712012-01-10 16:30:58 -0800156#define MSM_ION_MM_FW_SIZE 0x200000 /* (2MB) */
Olav Hauganb5be7992011-11-18 14:29:02 -0800157#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan7355db02012-01-13 16:59:13 -0800158#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Olav Haugan32594552012-03-13 11:40:05 -0700159
Olav Hauganb5be7992011-11-18 14:29:02 -0800160#define MSM_LIQUID_ION_MM_SIZE (MSM_ION_MM_SIZE + 0x600000)
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800161#define MSM_LIQUID_ION_SF_SIZE MSM_LIQUID_PMEM_SIZE
162#define MSM_HDMI_PRIM_ION_SF_SIZE MSM_HDMI_PRIM_PMEM_SIZE
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700163
Larry Bassel4d4f4482012-04-04 11:26:09 -0700164#define MSM8960_FIXED_AREA_START 0xa0000000
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700165#define MAX_FIXED_AREA_SIZE 0x10000000
Larry Bassel4d4f4482012-04-04 11:26:09 -0700166#define MSM_MM_FW_SIZE 0x200000
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700167#define MSM8960_FW_START (MSM8960_FIXED_AREA_START - MSM_MM_FW_SIZE)
168
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800169static unsigned msm_ion_sf_size = MSM_ION_SF_SIZE;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700170#else
Laura Abbott6db11c92011-11-04 10:31:43 -0700171#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
Olav Hauganb5be7992011-11-18 14:29:02 -0800172#define MSM_ION_HEAP_NUM 1
Laura Abbott2d1760b2011-09-29 21:31:24 -0700173#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700174
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700175#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
176static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
177static int __init pmem_kernel_ebi1_size_setup(char *p)
178{
179 pmem_kernel_ebi1_size = memparse(p, NULL);
180 return 0;
181}
182early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
183#endif
184
185#ifdef CONFIG_ANDROID_PMEM
186static unsigned pmem_size = MSM_PMEM_SIZE;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800187static unsigned pmem_param_set;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700188static int __init pmem_size_setup(char *p)
189{
190 pmem_size = memparse(p, NULL);
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800191 pmem_param_set = 1;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700192 return 0;
193}
194early_param("pmem_size", pmem_size_setup);
195
196static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
197
198static int __init pmem_adsp_size_setup(char *p)
199{
200 pmem_adsp_size = memparse(p, NULL);
201 return 0;
202}
203early_param("pmem_adsp_size", pmem_adsp_size_setup);
204
205static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
206
207static int __init pmem_audio_size_setup(char *p)
208{
209 pmem_audio_size = memparse(p, NULL);
210 return 0;
211}
212early_param("pmem_audio_size", pmem_audio_size_setup);
213#endif
214
215#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700216#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700217static struct android_pmem_platform_data android_pmem_pdata = {
218 .name = "pmem",
219 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
220 .cached = 1,
221 .memory_type = MEMTYPE_EBI1,
222};
223
224static struct platform_device android_pmem_device = {
225 .name = "android_pmem",
226 .id = 0,
227 .dev = {.platform_data = &android_pmem_pdata},
228};
229
230static struct android_pmem_platform_data android_pmem_adsp_pdata = {
231 .name = "pmem_adsp",
232 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
233 .cached = 0,
234 .memory_type = MEMTYPE_EBI1,
235};
236static struct platform_device android_pmem_adsp_device = {
237 .name = "android_pmem",
238 .id = 2,
239 .dev = { .platform_data = &android_pmem_adsp_pdata },
240};
241
242static struct android_pmem_platform_data android_pmem_audio_pdata = {
243 .name = "pmem_audio",
244 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
245 .cached = 0,
246 .memory_type = MEMTYPE_EBI1,
247};
248
249static struct platform_device android_pmem_audio_device = {
250 .name = "android_pmem",
251 .id = 4,
252 .dev = { .platform_data = &android_pmem_audio_pdata },
253};
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700254#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
255#endif /*CONFIG_ANDROID_PMEM*/
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700256
Larry Bassel41a055b2011-12-06 16:15:14 -0800257struct fmem_platform_data fmem_pdata = {
258};
259
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700260#define DSP_RAM_BASE_8960 0x8da00000
261#define DSP_RAM_SIZE_8960 0x1800000
262static int dspcrashd_pdata_8960 = 0xDEADDEAD;
263
264static struct resource resources_dspcrashd_8960[] = {
265 {
266 .name = "msm_dspcrashd",
267 .start = DSP_RAM_BASE_8960,
268 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
269 .flags = IORESOURCE_DMA,
270 },
271};
272
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800273static struct platform_device msm_device_dspcrashd_8960 = {
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700274 .name = "msm_dspcrashd",
275 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
276 .resource = resources_dspcrashd_8960,
277 .dev = { .platform_data = &dspcrashd_pdata_8960 },
278};
279
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700280static struct memtype_reserve msm8960_reserve_table[] __initdata = {
281 [MEMTYPE_SMI] = {
282 },
283 [MEMTYPE_EBI0] = {
284 .flags = MEMTYPE_FLAGS_1M_ALIGN,
285 },
286 [MEMTYPE_EBI1] = {
287 .flags = MEMTYPE_FLAGS_1M_ALIGN,
288 },
289};
290
Laura Abbottf8c03b92012-02-16 14:57:58 -0800291#if defined(CONFIG_MSM_RTB)
292static struct msm_rtb_platform_data msm_rtb_pdata = {
293 .size = SZ_1M,
294};
295
296static int __init msm_rtb_set_buffer_size(char *p)
297{
298 int s;
299
300 s = memparse(p, NULL);
301 msm_rtb_pdata.size = ALIGN(s, SZ_4K);
302 return 0;
303}
304early_param("msm_rtb_size", msm_rtb_set_buffer_size);
305
306
307static struct platform_device msm_rtb_device = {
308 .name = "msm_rtb",
309 .id = -1,
310 .dev = {
311 .platform_data = &msm_rtb_pdata,
312 },
313};
314#endif
315
316static void __init reserve_rtb_memory(void)
317{
318#if defined(CONFIG_MSM_RTB)
319 msm8960_reserve_table[MEMTYPE_EBI1].size += msm_rtb_pdata.size;
320#endif
321}
322
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700323static void __init size_pmem_devices(void)
324{
325#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700326#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700327 android_pmem_adsp_pdata.size = pmem_adsp_size;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800328
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800329 if (!pmem_param_set) {
330 if (machine_is_msm8960_liquid())
331 pmem_size = MSM_LIQUID_PMEM_SIZE;
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700332 if (msm8960_hdmi_as_primary_selected())
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800333 pmem_size = MSM_HDMI_PRIM_PMEM_SIZE;
334 }
335
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700336 android_pmem_pdata.size = pmem_size;
337 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700338#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
339#endif /*CONFIG_ANDROID_PMEM*/
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700340}
341
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700342#ifdef CONFIG_ANDROID_PMEM
343#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700344static void __init reserve_memory_for(struct android_pmem_platform_data *p)
345{
346 msm8960_reserve_table[p->memory_type].size += p->size;
347}
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700348#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
349#endif /*CONFIG_ANDROID_PMEM*/
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700350
351static void __init reserve_pmem_memory(void)
352{
353#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700354#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700355 reserve_memory_for(&android_pmem_adsp_pdata);
356 reserve_memory_for(&android_pmem_pdata);
357 reserve_memory_for(&android_pmem_audio_pdata);
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700358#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700359 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
360#endif
361}
362
Larry Basselb4126da2011-07-18 14:31:33 -0700363static int msm8960_paddr_to_memtype(unsigned int paddr)
364{
365 return MEMTYPE_EBI1;
366}
367
Olav Hauganf6dc7742012-02-15 09:11:55 -0800368#define FMEM_ENABLED 1
369
Laura Abbottd6183792011-08-19 13:42:24 -0700370#ifdef CONFIG_ION_MSM
Olav Haugan0703dbf2011-12-19 17:53:38 -0800371#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
372static struct ion_cp_heap_pdata cp_mm_ion_pdata = {
373 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugan42ebe712012-01-10 16:30:58 -0800374 .align = PAGE_SIZE,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800375 .reusable = FMEM_ENABLED,
376 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700377 .fixed_position = FIXED_MIDDLE,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800378};
379
380static struct ion_cp_heap_pdata cp_mfc_ion_pdata = {
381 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugan42ebe712012-01-10 16:30:58 -0800382 .align = PAGE_SIZE,
Olav Haugan65f4bd82011-12-13 11:50:08 -0800383 .reusable = 0,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800384 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700385 .fixed_position = FIXED_HIGH,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800386};
387
388static struct ion_co_heap_pdata co_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800389 .adjacent_mem_id = INVALID_HEAP_ID,
390 .align = PAGE_SIZE,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800391 .mem_is_fmem = 0,
Olav Haugan42ebe712012-01-10 16:30:58 -0800392};
393
394static struct ion_co_heap_pdata fw_co_ion_pdata = {
395 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
396 .align = SZ_128K,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800397 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700398 .fixed_position = FIXED_LOW,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800399};
400#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800401
402/**
403 * These heaps are listed in the order they will be allocated. Due to
404 * video hardware restrictions and content protection the FW heap has to
405 * be allocated adjacent (below) the MM heap and the MFC heap has to be
406 * allocated after the MM heap to ensure MFC heap is not more than 256MB
407 * away from the base address of the FW heap.
408 * However, the order of FW heap and MM heap doesn't matter since these
409 * two heaps are taken care of by separate code to ensure they are adjacent
410 * to each other.
411 * Don't swap the order unless you know what you are doing!
412 */
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800413static struct ion_platform_data ion_pdata = {
Laura Abbott2d1760b2011-09-29 21:31:24 -0700414 .nr = MSM_ION_HEAP_NUM,
Laura Abbottd6183792011-08-19 13:42:24 -0700415 .heaps = {
416 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800417 .id = ION_SYSTEM_HEAP_ID,
Laura Abbottd6183792011-08-19 13:42:24 -0700418 .type = ION_HEAP_TYPE_SYSTEM,
Laura Abbottd6183792011-08-19 13:42:24 -0700419 .name = ION_VMALLOC_HEAP_NAME,
420 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700421#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -0700422 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800423 .id = ION_CP_MM_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800424 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800425 .name = ION_MM_HEAP_NAME,
426 .size = MSM_ION_MM_SIZE,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700427 .memory_type = ION_EBI_TYPE,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800428 .extra_data = (void *) &cp_mm_ion_pdata,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700429 },
Laura Abbott8c017362011-09-22 20:59:12 -0700430 {
Olav Haugan42ebe712012-01-10 16:30:58 -0800431 .id = ION_MM_FIRMWARE_HEAP_ID,
432 .type = ION_HEAP_TYPE_CARVEOUT,
433 .name = ION_MM_FIRMWARE_HEAP_NAME,
434 .size = MSM_ION_MM_FW_SIZE,
435 .memory_type = ION_EBI_TYPE,
436 .extra_data = (void *) &fw_co_ion_pdata,
437 },
438 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800439 .id = ION_CP_MFC_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800440 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800441 .name = ION_MFC_HEAP_NAME,
442 .size = MSM_ION_MFC_SIZE,
443 .memory_type = ION_EBI_TYPE,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800444 .extra_data = (void *) &cp_mfc_ion_pdata,
Olav Hauganb5be7992011-11-18 14:29:02 -0800445 },
Olav Haugan32594552012-03-13 11:40:05 -0700446#ifndef CONFIG_MSM_IOMMU
Olav Hauganb5be7992011-11-18 14:29:02 -0800447 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800448 .id = ION_SF_HEAP_ID,
449 .type = ION_HEAP_TYPE_CARVEOUT,
450 .name = ION_SF_HEAP_NAME,
451 .size = MSM_ION_SF_SIZE,
452 .memory_type = ION_EBI_TYPE,
453 .extra_data = (void *) &co_ion_pdata,
454 },
Olav Haugan32594552012-03-13 11:40:05 -0700455#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800456 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800457 .id = ION_IOMMU_HEAP_ID,
Laura Abbott8c017362011-09-22 20:59:12 -0700458 .type = ION_HEAP_TYPE_IOMMU,
459 .name = ION_IOMMU_HEAP_NAME,
460 },
Olav Haugan80854eb2012-01-12 12:00:23 -0800461 {
462 .id = ION_QSECOM_HEAP_ID,
463 .type = ION_HEAP_TYPE_CARVEOUT,
464 .name = ION_QSECOM_HEAP_NAME,
465 .size = MSM_ION_QSECOM_SIZE,
466 .memory_type = ION_EBI_TYPE,
467 .extra_data = (void *) &co_ion_pdata,
468 },
Olav Haugan7355db02012-01-13 16:59:13 -0800469 {
470 .id = ION_AUDIO_HEAP_ID,
471 .type = ION_HEAP_TYPE_CARVEOUT,
472 .name = ION_AUDIO_HEAP_NAME,
473 .size = MSM_ION_AUDIO_SIZE,
474 .memory_type = ION_EBI_TYPE,
475 .extra_data = (void *) &co_ion_pdata,
476 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700477#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700478 }
479};
480
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800481static struct platform_device ion_dev = {
Laura Abbottd6183792011-08-19 13:42:24 -0700482 .name = "ion-msm",
483 .id = 1,
484 .dev = { .platform_data = &ion_pdata },
485};
486#endif
487
Larry Bassel41a055b2011-12-06 16:15:14 -0800488struct platform_device fmem_device = {
489 .name = "fmem",
490 .id = 1,
491 .dev = { .platform_data = &fmem_pdata },
492};
493
Olav Haugan65f4bd82011-12-13 11:50:08 -0800494static void __init adjust_mem_for_liquid(void)
Laura Abbottd6183792011-08-19 13:42:24 -0700495{
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800496 unsigned int i;
497
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800498 if (!pmem_param_set) {
499 if (machine_is_msm8960_liquid())
500 msm_ion_sf_size = MSM_LIQUID_ION_SF_SIZE;
501
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700502 if (msm8960_hdmi_as_primary_selected())
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800503 msm_ion_sf_size = MSM_HDMI_PRIM_ION_SF_SIZE;
504
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700505 if (machine_is_msm8960_liquid() ||
506 msm8960_hdmi_as_primary_selected()) {
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800507 for (i = 0; i < ion_pdata.nr; i++) {
508 if (ion_pdata.heaps[i].id == ION_SF_HEAP_ID) {
509 ion_pdata.heaps[i].size =
510 msm_ion_sf_size;
511 pr_debug("msm_ion_sf_size 0x%x\n",
512 msm_ion_sf_size);
513 break;
514 }
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800515 }
516 }
517 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800518}
519
520static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
521 unsigned long size)
522{
523 msm8960_reserve_table[mem_type].size += size;
524}
525
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700526static void __init msm8960_reserve_fixed_area(unsigned long fixed_area_size)
527{
528#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
529 int ret;
530
531 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
532 panic("fixed area size is larger than %dM\n",
533 MAX_FIXED_AREA_SIZE >> 20);
534
535 reserve_info->fixed_area_size = fixed_area_size;
536 reserve_info->fixed_area_start = MSM8960_FW_START;
537
538 ret = memblock_remove(reserve_info->fixed_area_start,
539 reserve_info->fixed_area_size);
540 BUG_ON(ret);
541#endif
542}
543
Olav Haugan65f4bd82011-12-13 11:50:08 -0800544/**
545 * Reserve memory for ION and calculate amount of reusable memory for fmem.
546 * We only reserve memory for heaps that are not reusable. However, we only
547 * support one reusable heap at the moment so we ignore the reusable flag for
548 * other than the first heap with reusable flag set. Also handle special case
Olav Hauganf6dc7742012-02-15 09:11:55 -0800549 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
550 * at a higher address than FW in addition to not more than 256MB away from the
551 * base address of the firmware. This means that if MM is reusable the other
552 * two heaps must be allocated in the same region as FW. This is handled by the
553 * mem_is_fmem flag in the platform data. In addition the MM heap must be
554 * adjacent to the FW heap for content protection purposes.
Olav Haugan65f4bd82011-12-13 11:50:08 -0800555 */
556static void __init reserve_ion_memory(void)
557{
558#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
559 unsigned int i;
560 unsigned int reusable_count = 0;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700561 unsigned int fixed_size = 0;
562 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
563 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800564
565 adjust_mem_for_liquid();
566 fmem_pdata.size = 0;
Olav Hauganf6dc7742012-02-15 09:11:55 -0800567 fmem_pdata.reserved_size_low = 0;
568 fmem_pdata.reserved_size_high = 0;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700569 fixed_low_size = 0;
570 fixed_middle_size = 0;
571 fixed_high_size = 0;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800572
573 /* We only support 1 reusable heap. Check if more than one heap
574 * is specified as reusable and set as non-reusable if found.
575 */
576 for (i = 0; i < ion_pdata.nr; ++i) {
577 const struct ion_platform_heap *heap = &(ion_pdata.heaps[i]);
578
579 if (heap->type == ION_HEAP_TYPE_CP && heap->extra_data) {
580 struct ion_cp_heap_pdata *data = heap->extra_data;
581
582 reusable_count += (data->reusable) ? 1 : 0;
583
584 if (data->reusable && reusable_count > 1) {
585 pr_err("%s: Too many heaps specified as "
586 "reusable. Heap %s was not configured "
587 "as reusable.\n", __func__, heap->name);
588 data->reusable = 0;
589 }
590 }
591 }
592
593 for (i = 0; i < ion_pdata.nr; ++i) {
Olav Haugan65f4bd82011-12-13 11:50:08 -0800594 const struct ion_platform_heap *heap = &(ion_pdata.heaps[i]);
595
596 if (heap->extra_data) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700597 int fixed_position = NOT_FIXED;
598 int mem_is_fmem = 0;
599
Olav Haugan65f4bd82011-12-13 11:50:08 -0800600 switch (heap->type) {
601 case ION_HEAP_TYPE_CP:
Olav Hauganf6dc7742012-02-15 09:11:55 -0800602 mem_is_fmem = ((struct ion_cp_heap_pdata *)
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700603 heap->extra_data)->mem_is_fmem;
604 fixed_position = ((struct ion_cp_heap_pdata *)
605 heap->extra_data)->fixed_position;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800606 break;
607 case ION_HEAP_TYPE_CARVEOUT:
Olav Hauganf6dc7742012-02-15 09:11:55 -0800608 mem_is_fmem = ((struct ion_co_heap_pdata *)
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700609 heap->extra_data)->mem_is_fmem;
610 fixed_position = ((struct ion_co_heap_pdata *)
611 heap->extra_data)->fixed_position;
612 break;
613 default:
614 break;
615 }
616
617 if (fixed_position != NOT_FIXED)
618 fixed_size += heap->size;
619 else
620 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
621
622 if (fixed_position == FIXED_LOW)
623 fixed_low_size += heap->size;
624 else if (fixed_position == FIXED_MIDDLE)
625 fixed_middle_size += heap->size;
626 else if (fixed_position == FIXED_HIGH)
627 fixed_high_size += heap->size;
628
629 if (mem_is_fmem)
630 fmem_pdata.size += heap->size;
631 }
632 }
633
634 if (!fixed_size)
635 return;
636
637 if (fmem_pdata.size) {
638 fmem_pdata.reserved_size_low = fixed_low_size;
639 fmem_pdata.reserved_size_high = fixed_high_size;
640 }
641
Larry Bassel4d4f4482012-04-04 11:26:09 -0700642 /* Since the fixed area may be carved out of lowmem,
643 * make sure the length is a multiple of 1M.
644 */
645 fixed_size = (fixed_size + MSM_MM_FW_SIZE + SECTION_SIZE - 1)
646 & SECTION_MASK;
647 msm8960_reserve_fixed_area(fixed_size);
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700648
649 fixed_low_start = MSM8960_FIXED_AREA_START;
650 fixed_middle_start = fixed_low_start + fixed_low_size;
651 fixed_high_start = fixed_middle_start + fixed_middle_size;
652
653 for (i = 0; i < ion_pdata.nr; ++i) {
654 struct ion_platform_heap *heap = &(ion_pdata.heaps[i]);
655
656 if (heap->extra_data) {
657 int fixed_position = NOT_FIXED;
658
659 switch (heap->type) {
660 case ION_HEAP_TYPE_CP:
661 fixed_position = ((struct ion_cp_heap_pdata *)
662 heap->extra_data)->fixed_position;
663 break;
664 case ION_HEAP_TYPE_CARVEOUT:
665 fixed_position = ((struct ion_co_heap_pdata *)
666 heap->extra_data)->fixed_position;
667 break;
668 default:
669 break;
670 }
671
672 switch (fixed_position) {
673 case FIXED_LOW:
674 heap->base = fixed_low_start;
675 break;
676 case FIXED_MIDDLE:
677 heap->base = fixed_middle_start;
678 break;
679 case FIXED_HIGH:
680 heap->base = fixed_high_start;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800681 break;
682 default:
683 break;
684 }
685 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800686 }
Laura Abbottd6183792011-08-19 13:42:24 -0700687#endif
688}
Huaibin Yanga5419422011-12-08 23:52:10 -0800689
690static void __init reserve_mdp_memory(void)
691{
692 msm8960_mdp_writeback(msm8960_reserve_table);
693}
694
Laura Abbott306bcc22012-03-08 11:24:53 -0800695#if defined(CONFIG_MSM_CACHE_DUMP)
696static struct msm_cache_dump_platform_data msm_cache_dump_pdata = {
697 .l2_size = L2_BUFFER_SIZE,
698};
699
700static struct platform_device msm_cache_dump_device = {
701 .name = "msm_cache_dump",
702 .id = -1,
703 .dev = {
704 .platform_data = &msm_cache_dump_pdata,
705 },
706};
707
708#endif
709
710static void reserve_cache_dump_memory(void)
711{
712#ifdef CONFIG_MSM_CACHE_DUMP
713 unsigned int spare;
714 unsigned int l1_size;
Laura Abbott7b637362012-03-29 16:43:49 -0700715 unsigned int l2_size;
Laura Abbott306bcc22012-03-08 11:24:53 -0800716 unsigned int total;
717 int ret;
718
719 ret = scm_call(L1C_SERVICE_ID, L1C_BUFFER_GET_SIZE_COMMAND_ID, &spare,
720 sizeof(spare), &l1_size, sizeof(l1_size));
721
722 if (ret)
723 /* Fall back to something reasonable here */
724 l1_size = L1_BUFFER_SIZE;
725
Laura Abbott7b637362012-03-29 16:43:49 -0700726 ret = scm_call(L1C_SERVICE_ID, L2C_BUFFER_GET_SIZE_COMMAND_ID, &spare,
727 sizeof(spare), &l2_size, sizeof(l2_size));
728
729 if (ret)
730 /* Fall back to something reasonable here */
731 l2_size = L2_BUFFER_SIZE;
732
733 total = l1_size + l2_size;
Laura Abbott306bcc22012-03-08 11:24:53 -0800734
735 msm8960_reserve_table[MEMTYPE_EBI1].size += total;
736 msm_cache_dump_pdata.l1_size = l1_size;
Laura Abbott7b637362012-03-29 16:43:49 -0700737 msm_cache_dump_pdata.l2_size = l2_size;
Laura Abbott306bcc22012-03-08 11:24:53 -0800738#endif
739}
740
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700741static void __init msm8960_calculate_reserve_sizes(void)
742{
743 size_pmem_devices();
744 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700745 reserve_ion_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800746 reserve_mdp_memory();
Laura Abbottf8c03b92012-02-16 14:57:58 -0800747 reserve_rtb_memory();
Laura Abbott306bcc22012-03-08 11:24:53 -0800748 reserve_cache_dump_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700749}
750
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700751static struct reserve_info msm8960_reserve_info __initdata = {
752 .memtype_reserve_table = msm8960_reserve_table,
753 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700754 .reserve_fixed_area = msm8960_reserve_fixed_area,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700755 .paddr_to_memtype = msm8960_paddr_to_memtype,
756};
757
Larry Basselb4126da2011-07-18 14:31:33 -0700758static int msm8960_memory_bank_size(void)
759{
760 return 1<<29;
761}
762
763static void __init locate_unstable_memory(void)
764{
765 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
766 unsigned long bank_size;
767 unsigned long low, high;
768
769 bank_size = msm8960_memory_bank_size();
Larry Bassel4d4f4482012-04-04 11:26:09 -0700770 msm8960_reserve_info.bank_size = bank_size;
771
Larry Basselb4126da2011-07-18 14:31:33 -0700772 low = meminfo.bank[0].start;
773 high = mb->start + mb->size;
Olav Haugan62052e42011-10-28 14:28:32 -0700774
775 /* Check if 32 bit overflow occured */
776 if (high < mb->start)
777 high = ~0UL;
778
Larry Bassel4d4f4482012-04-04 11:26:09 -0700779 if (high < MAX_FIXED_AREA_SIZE + MSM8960_FIXED_AREA_START)
780 panic("fixed area extends beyond end of memory\n");
781
Larry Basselb4126da2011-07-18 14:31:33 -0700782 low &= ~(bank_size - 1);
783
784 if (high - low <= bank_size)
Larry Bassel4d4f4482012-04-04 11:26:09 -0700785 goto no_dmm;
Larry Basselb8d61022012-02-24 10:49:45 -0800786
Larry Basselb8d61022012-02-24 10:49:45 -0800787#ifdef CONFIG_ENABLE_DMM
Jack Cheung60eaeab2012-01-09 16:40:26 -0800788 msm8960_reserve_info.low_unstable_address = mb->start -
789 MIN_MEMORY_BLOCK_SIZE + mb->size;
Jack Cheung0b1987e2011-11-18 13:36:29 -0800790 msm8960_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
Larry Basselb4126da2011-07-18 14:31:33 -0700791 pr_info("low unstable address %lx max size %lx bank size %lx\n",
792 msm8960_reserve_info.low_unstable_address,
793 msm8960_reserve_info.max_unstable_size,
794 msm8960_reserve_info.bank_size);
Larry Bassel4d4f4482012-04-04 11:26:09 -0700795 return;
Larry Basselb8d61022012-02-24 10:49:45 -0800796#endif
Larry Bassel4d4f4482012-04-04 11:26:09 -0700797no_dmm:
798 msm8960_reserve_info.low_unstable_address = high;
799 msm8960_reserve_info.max_unstable_size = 0;
Larry Basselb4126da2011-07-18 14:31:33 -0700800}
801
Larry Basselb830e182011-10-14 10:46:55 -0700802static void __init place_movable_zone(void)
803{
Larry Basselb8d61022012-02-24 10:49:45 -0800804#ifdef CONFIG_ENABLE_DMM
Larry Basselb830e182011-10-14 10:46:55 -0700805 movable_reserved_start = msm8960_reserve_info.low_unstable_address;
806 movable_reserved_size = msm8960_reserve_info.max_unstable_size;
807 pr_info("movable zone start %lx size %lx\n",
808 movable_reserved_start, movable_reserved_size);
Larry Basselb8d61022012-02-24 10:49:45 -0800809#endif
Larry Basselb830e182011-10-14 10:46:55 -0700810}
811
812static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700813{
814 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700815 locate_unstable_memory();
Larry Basselb830e182011-10-14 10:46:55 -0700816 place_movable_zone();
817}
818
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800819static char prim_panel_name[PANEL_NAME_MAX_LEN];
820static char ext_panel_name[PANEL_NAME_MAX_LEN];
821static int __init prim_display_setup(char *param)
822{
823 if (strnlen(param, PANEL_NAME_MAX_LEN))
824 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
825 return 0;
826}
827early_param("prim_display", prim_display_setup);
828
829static int __init ext_display_setup(char *param)
830{
831 if (strnlen(param, PANEL_NAME_MAX_LEN))
832 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
833 return 0;
834}
835early_param("ext_display", ext_display_setup);
836
Larry Basselb830e182011-10-14 10:46:55 -0700837static void __init msm8960_reserve(void)
838{
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800839 msm8960_set_display_params(prim_panel_name, ext_panel_name);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700840 msm_reserve();
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700841 if (fmem_pdata.size) {
842#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
843 fmem_pdata.phys = reserve_info->fixed_area_start +
844 MSM_MM_FW_SIZE;
845 pr_info("mm fw at %lx (fixed) size %x\n",
846 reserve_info->fixed_area_start, MSM_MM_FW_SIZE);
847 pr_info("fmem start %lx (fixed) size %lx\n",
848 fmem_pdata.phys, fmem_pdata.size);
849#else
850 fmem_pdata.phys = reserve_memory_for_fmem(fmem_pdata.size);
851#endif
852 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700853}
854
Larry Bassela4414b12011-08-04 11:11:02 -0700855static int msm8960_change_memory_power(u64 start, u64 size,
856 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700857{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -0700858 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -0700859}
860
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700861static void __init msm8960_allocate_memory_regions(void)
862{
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800863 msm8960_allocate_fb_region();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700864}
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800865
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700866#ifdef CONFIG_WCD9310_CODEC
867
868#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
869
Patrick Lai3043fba2011-08-01 14:15:57 -0700870/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
871 * 4 micbiases are used to power various analog and digital
872 * microphones operating at 1800 mV. Technically, all micbiases
873 * can source from single cfilter since all microphones operate
874 * at the same voltage level. The arrangement below is to make
875 * sure all cfilters are exercised. LDO_H regulator ouput level
876 * does not need to be as high as 2.85V. It is choosen for
877 * microphone sensitivity purpose.
878 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530879static struct wcd9xxx_pdata tabla_platform_data = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700880 .slimbus_slave_device = {
881 .name = "tabla-slave",
882 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
883 },
884 .irq = MSM_GPIO_TO_INT(62),
885 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530886 .num_irqs = NR_WCD9XXX_IRQS,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700887 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -0700888 .micbias = {
889 .ldoh_v = TABLA_LDOH_2P85_V,
890 .cfilt1_mv = 1800,
Joonwoo Parkcf473b42012-03-29 19:48:16 -0700891 .cfilt2_mv = 2700,
Patrick Lai3043fba2011-08-01 14:15:57 -0700892 .cfilt3_mv = 1800,
893 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
894 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
895 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
896 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530897 },
898 .regulator = {
899 {
900 .name = "CDC_VDD_CP",
901 .min_uV = 1800000,
902 .max_uV = 1800000,
903 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
904 },
905 {
906 .name = "CDC_VDDA_RX",
907 .min_uV = 1800000,
908 .max_uV = 1800000,
909 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
910 },
911 {
912 .name = "CDC_VDDA_TX",
913 .min_uV = 1800000,
914 .max_uV = 1800000,
915 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
916 },
917 {
918 .name = "VDDIO_CDC",
919 .min_uV = 1800000,
920 .max_uV = 1800000,
921 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
922 },
923 {
924 .name = "VDDD_CDC_D",
925 .min_uV = 1225000,
926 .max_uV = 1225000,
927 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
928 },
929 {
930 .name = "CDC_VDDA_A_1P2V",
931 .min_uV = 1225000,
932 .max_uV = 1225000,
933 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
934 },
935 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700936};
937
938static struct slim_device msm_slim_tabla = {
939 .name = "tabla-slim",
940 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
941 .dev = {
942 .platform_data = &tabla_platform_data,
943 },
944};
Santosh Mardi60e19d92011-10-28 01:15:14 +0530945
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530946static struct wcd9xxx_pdata tabla20_platform_data = {
Santosh Mardi60e19d92011-10-28 01:15:14 +0530947 .slimbus_slave_device = {
948 .name = "tabla-slave",
949 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
950 },
951 .irq = MSM_GPIO_TO_INT(62),
952 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530953 .num_irqs = NR_WCD9XXX_IRQS,
Santosh Mardi60e19d92011-10-28 01:15:14 +0530954 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
955 .micbias = {
956 .ldoh_v = TABLA_LDOH_2P85_V,
957 .cfilt1_mv = 1800,
Joonwoo Parkcf473b42012-03-29 19:48:16 -0700958 .cfilt2_mv = 2700,
Santosh Mardi60e19d92011-10-28 01:15:14 +0530959 .cfilt3_mv = 1800,
960 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
961 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
962 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
963 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530964 },
965 .regulator = {
966 {
967 .name = "CDC_VDD_CP",
968 .min_uV = 1800000,
969 .max_uV = 1800000,
970 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
971 },
972 {
973 .name = "CDC_VDDA_RX",
974 .min_uV = 1800000,
975 .max_uV = 1800000,
976 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
977 },
978 {
979 .name = "CDC_VDDA_TX",
980 .min_uV = 1800000,
981 .max_uV = 1800000,
982 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
983 },
984 {
985 .name = "VDDIO_CDC",
986 .min_uV = 1800000,
987 .max_uV = 1800000,
988 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
989 },
990 {
991 .name = "VDDD_CDC_D",
992 .min_uV = 1225000,
993 .max_uV = 1225000,
994 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
995 },
996 {
997 .name = "CDC_VDDA_A_1P2V",
998 .min_uV = 1225000,
999 .max_uV = 1225000,
1000 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1001 },
1002 },
Santosh Mardi60e19d92011-10-28 01:15:14 +05301003};
1004
1005static struct slim_device msm_slim_tabla20 = {
1006 .name = "tabla2x-slim",
1007 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
1008 .dev = {
1009 .platform_data = &tabla20_platform_data,
1010 },
1011};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001012#endif
1013
1014static struct slim_boardinfo msm_slim_devices[] = {
1015#ifdef CONFIG_WCD9310_CODEC
1016 {
1017 .bus_num = 1,
1018 .slim_slave = &msm_slim_tabla,
1019 },
Santosh Mardi60e19d92011-10-28 01:15:14 +05301020 {
1021 .bus_num = 1,
1022 .slim_slave = &msm_slim_tabla20,
1023 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001024#endif
1025 /* add more slimbus slaves as needed */
1026};
1027
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001028#define MSM_WCNSS_PHYS 0x03000000
1029#define MSM_WCNSS_SIZE 0x280000
1030
1031static struct resource resources_wcnss_wlan[] = {
1032 {
1033 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1034 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1035 .name = "wcnss_wlanrx_irq",
1036 .flags = IORESOURCE_IRQ,
1037 },
1038 {
1039 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1040 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1041 .name = "wcnss_wlantx_irq",
1042 .flags = IORESOURCE_IRQ,
1043 },
1044 {
1045 .start = MSM_WCNSS_PHYS,
1046 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1047 .name = "wcnss_mmio",
1048 .flags = IORESOURCE_MEM,
1049 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -07001050 {
1051 .start = 84,
1052 .end = 88,
1053 .name = "wcnss_gpios_5wire",
1054 .flags = IORESOURCE_IO,
1055 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001056};
1057
Ankur Nandwanib0039b02011-08-09 14:00:45 -07001058static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1059 .has_48mhz_xo = 1,
1060};
1061
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001062static struct platform_device msm_device_wcnss_wlan = {
1063 .name = "wcnss_wlan",
1064 .id = 0,
1065 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1066 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07001067 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001068};
1069
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001070#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1071 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1072 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1073 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1074
1075#define QCE_SIZE 0x10000
1076#define QCE_0_BASE 0x18500000
1077
1078#define QCE_HW_KEY_SUPPORT 0
1079#define QCE_SHA_HMAC_SUPPORT 1
1080#define QCE_SHARE_CE_RESOURCE 1
1081#define QCE_CE_SHARED 0
1082
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001083/* Begin Bus scaling definitions */
1084static struct msm_bus_vectors crypto_hw_init_vectors[] = {
1085 {
1086 .src = MSM_BUS_MASTER_ADM_PORT0,
1087 .dst = MSM_BUS_SLAVE_EBI_CH0,
1088 .ab = 0,
1089 .ib = 0,
1090 },
1091 {
1092 .src = MSM_BUS_MASTER_ADM_PORT1,
1093 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1094 .ab = 0,
1095 .ib = 0,
1096 },
1097};
1098
1099static struct msm_bus_vectors crypto_hw_active_vectors[] = {
1100 {
1101 .src = MSM_BUS_MASTER_ADM_PORT0,
1102 .dst = MSM_BUS_SLAVE_EBI_CH0,
1103 .ab = 70000000UL,
1104 .ib = 70000000UL,
1105 },
1106 {
1107 .src = MSM_BUS_MASTER_ADM_PORT1,
1108 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1109 .ab = 2480000000UL,
1110 .ib = 2480000000UL,
1111 },
1112};
1113
1114static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
1115 {
1116 ARRAY_SIZE(crypto_hw_init_vectors),
1117 crypto_hw_init_vectors,
1118 },
1119 {
1120 ARRAY_SIZE(crypto_hw_active_vectors),
1121 crypto_hw_active_vectors,
1122 },
1123};
1124
1125static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
1126 crypto_hw_bus_scale_usecases,
1127 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
1128 .name = "cryptohw",
1129};
1130/* End Bus Scaling Definitions*/
1131
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001132static struct resource qcrypto_resources[] = {
1133 [0] = {
1134 .start = QCE_0_BASE,
1135 .end = QCE_0_BASE + QCE_SIZE - 1,
1136 .flags = IORESOURCE_MEM,
1137 },
1138 [1] = {
1139 .name = "crypto_channels",
1140 .start = DMOV_CE_IN_CHAN,
1141 .end = DMOV_CE_OUT_CHAN,
1142 .flags = IORESOURCE_DMA,
1143 },
1144 [2] = {
1145 .name = "crypto_crci_in",
1146 .start = DMOV_CE_IN_CRCI,
1147 .end = DMOV_CE_IN_CRCI,
1148 .flags = IORESOURCE_DMA,
1149 },
1150 [3] = {
1151 .name = "crypto_crci_out",
1152 .start = DMOV_CE_OUT_CRCI,
1153 .end = DMOV_CE_OUT_CRCI,
1154 .flags = IORESOURCE_DMA,
1155 },
1156};
1157
1158static struct resource qcedev_resources[] = {
1159 [0] = {
1160 .start = QCE_0_BASE,
1161 .end = QCE_0_BASE + QCE_SIZE - 1,
1162 .flags = IORESOURCE_MEM,
1163 },
1164 [1] = {
1165 .name = "crypto_channels",
1166 .start = DMOV_CE_IN_CHAN,
1167 .end = DMOV_CE_OUT_CHAN,
1168 .flags = IORESOURCE_DMA,
1169 },
1170 [2] = {
1171 .name = "crypto_crci_in",
1172 .start = DMOV_CE_IN_CRCI,
1173 .end = DMOV_CE_IN_CRCI,
1174 .flags = IORESOURCE_DMA,
1175 },
1176 [3] = {
1177 .name = "crypto_crci_out",
1178 .start = DMOV_CE_OUT_CRCI,
1179 .end = DMOV_CE_OUT_CRCI,
1180 .flags = IORESOURCE_DMA,
1181 },
1182};
1183
1184#endif
1185
1186#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1187 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1188
1189static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1190 .ce_shared = QCE_CE_SHARED,
1191 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1192 .hw_key_support = QCE_HW_KEY_SUPPORT,
1193 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001194 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001195};
1196
1197static struct platform_device qcrypto_device = {
1198 .name = "qcrypto",
1199 .id = 0,
1200 .num_resources = ARRAY_SIZE(qcrypto_resources),
1201 .resource = qcrypto_resources,
1202 .dev = {
1203 .coherent_dma_mask = DMA_BIT_MASK(32),
1204 .platform_data = &qcrypto_ce_hw_suppport,
1205 },
1206};
1207#endif
1208
1209#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1210 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1211
1212static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1213 .ce_shared = QCE_CE_SHARED,
1214 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1215 .hw_key_support = QCE_HW_KEY_SUPPORT,
1216 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001217 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001218};
1219
1220static struct platform_device qcedev_device = {
1221 .name = "qce",
1222 .id = 0,
1223 .num_resources = ARRAY_SIZE(qcedev_resources),
1224 .resource = qcedev_resources,
1225 .dev = {
1226 .coherent_dma_mask = DMA_BIT_MASK(32),
1227 .platform_data = &qcedev_ce_hw_suppport,
1228 },
1229};
1230#endif
1231
Joel Kingb8352a12011-11-15 18:46:24 -08001232#define MDM2AP_ERRFATAL 70
1233#define AP2MDM_ERRFATAL 95
1234#define MDM2AP_STATUS 69
1235#define AP2MDM_STATUS 94
1236#define AP2MDM_PMIC_RESET_N 80
1237#define AP2MDM_KPDPWR_N 81
1238
Joel Kingb8352a12011-11-15 18:46:24 -08001239static struct resource mdm_resources[] = {
1240 {
1241 .start = MDM2AP_ERRFATAL,
1242 .end = MDM2AP_ERRFATAL,
1243 .name = "MDM2AP_ERRFATAL",
1244 .flags = IORESOURCE_IO,
1245 },
1246 {
1247 .start = AP2MDM_ERRFATAL,
1248 .end = AP2MDM_ERRFATAL,
1249 .name = "AP2MDM_ERRFATAL",
1250 .flags = IORESOURCE_IO,
1251 },
1252 {
1253 .start = MDM2AP_STATUS,
1254 .end = MDM2AP_STATUS,
1255 .name = "MDM2AP_STATUS",
1256 .flags = IORESOURCE_IO,
1257 },
1258 {
1259 .start = AP2MDM_STATUS,
1260 .end = AP2MDM_STATUS,
1261 .name = "AP2MDM_STATUS",
1262 .flags = IORESOURCE_IO,
1263 },
1264 {
1265 .start = AP2MDM_PMIC_RESET_N,
1266 .end = AP2MDM_PMIC_RESET_N,
1267 .name = "AP2MDM_PMIC_RESET_N",
1268 .flags = IORESOURCE_IO,
1269 },
1270 {
1271 .start = AP2MDM_KPDPWR_N,
1272 .end = AP2MDM_KPDPWR_N,
1273 .name = "AP2MDM_KPDPWR_N",
1274 .flags = IORESOURCE_IO,
1275 },
1276};
1277
1278static struct mdm_platform_data mdm_platform_data = {
1279 .mdm_version = "2.5",
1280};
1281
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -08001282static struct platform_device mdm_device = {
Joel Kingb8352a12011-11-15 18:46:24 -08001283 .name = "mdm2_modem",
1284 .id = -1,
1285 .num_resources = ARRAY_SIZE(mdm_resources),
1286 .resource = mdm_resources,
1287 .dev = {
1288 .platform_data = &mdm_platform_data,
1289 },
1290};
1291
1292static struct platform_device *mdm_devices[] __initdata = {
1293 &mdm_device,
1294};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001295
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001296#define MSM_SHARED_RAM_PHYS 0x80000000
1297
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001298static void __init msm8960_map_io(void)
1299{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001300 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001301 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001302
1303 if (socinfo_init() < 0)
1304 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001305}
1306
1307static void __init msm8960_init_irq(void)
1308{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001309 struct msm_mpm_device_data *data = NULL;
1310
1311#ifdef CONFIG_MSM_MPM
1312 data = &msm8960_mpm_dev_data;
1313#endif
1314
1315 msm_mpm_irq_extn_init(data);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001316 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001317 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001318}
1319
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001320static void __init msm8960_init_buses(void)
1321{
1322#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -06001323 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -06001324 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
1325 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
1326 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
1327 msm_bus_apps_fabric.dev.platform_data =
1328 &msm_bus_8960_apps_fabric_pdata;
1329 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
1330 msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
1331 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
1332 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001333#endif
1334}
1335
1336static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
1337 .max_clock_speed = 15060000,
1338};
1339
1340#ifdef CONFIG_USB_MSM_OTG_72K
1341static struct msm_otg_platform_data msm_otg_pdata;
1342#else
Anji jonnalaa8b8d732011-12-06 10:03:24 +05301343static int wr_phy_init_seq[] = {
1344 0x44, 0x80, /* set VBUS valid threshold
1345 and disconnect valid threshold */
1346 0x38, 0x81, /* update DC voltage level */
1347 0x14, 0x82, /* set preemphasis and rise/fall time */
1348 0x13, 0x83, /* set source impedance adjusment */
1349 -1};
1350
1351static int liquid_v1_phy_init_seq[] = {
1352 0x44, 0x80,/* set VBUS valid threshold
1353 and disconnect valid threshold */
1354 0x3C, 0x81,/* update DC voltage level */
1355 0x18, 0x82,/* set preemphasis and rise/fall time */
1356 0x23, 0x83,/* set source impedance sdjusment */
1357 -1};
1358
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301359#ifdef CONFIG_MSM_BUS_SCALING
1360/* Bandwidth requests (zero) if no vote placed */
1361static struct msm_bus_vectors usb_init_vectors[] = {
1362 {
1363 .src = MSM_BUS_MASTER_SPS,
1364 .dst = MSM_BUS_SLAVE_EBI_CH0,
1365 .ab = 0,
1366 .ib = 0,
1367 },
1368};
1369
1370/* Bus bandwidth requests in Bytes/sec */
1371static struct msm_bus_vectors usb_max_vectors[] = {
1372 {
1373 .src = MSM_BUS_MASTER_SPS,
1374 .dst = MSM_BUS_SLAVE_EBI_CH0,
1375 .ab = 60000000, /* At least 480Mbps on bus. */
1376 .ib = 960000000, /* MAX bursts rate */
1377 },
1378};
1379
1380static struct msm_bus_paths usb_bus_scale_usecases[] = {
1381 {
1382 ARRAY_SIZE(usb_init_vectors),
1383 usb_init_vectors,
1384 },
1385 {
1386 ARRAY_SIZE(usb_max_vectors),
1387 usb_max_vectors,
1388 },
1389};
1390
1391static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
1392 usb_bus_scale_usecases,
1393 ARRAY_SIZE(usb_bus_scale_usecases),
1394 .name = "usb",
1395};
1396#endif
1397
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001398static struct msm_otg_platform_data msm_otg_pdata = {
1399 .mode = USB_OTG,
1400 .otg_control = OTG_PMIC_CONTROL,
1401 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001402 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
Anji jonnala4e3e6772011-09-15 18:53:42 +05301403 .power_budget = 750,
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301404#ifdef CONFIG_MSM_BUS_SCALING
1405 .bus_scale_table = &usb_bus_scale_pdata,
1406#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001407};
1408#endif
1409
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301410#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05301411#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301412static struct msm_hsic_host_platform_data msm_hsic_pdata = {
1413 .strobe = 150,
1414 .data = 151,
1415};
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301416
1417static struct smsc_hub_platform_data hsic_hub_pdata = {
1418 .hub_reset = HSIC_HUB_RESET_GPIO,
1419};
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301420#else
1421static struct msm_hsic_host_platform_data msm_hsic_pdata;
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301422static struct smsc_hub_platform_data hsic_hub_pdata;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301423#endif
1424
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301425static struct platform_device smsc_hub_device = {
1426 .name = "msm_smsc_hub",
1427 .id = -1,
1428 .dev = {
1429 .platform_data = &hsic_hub_pdata,
1430 },
1431};
1432
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001433#define PID_MAGIC_ID 0x71432909
1434#define SERIAL_NUM_MAGIC_ID 0x61945374
1435#define SERIAL_NUMBER_LENGTH 127
1436#define DLOAD_USB_BASE_ADD 0x2A03F0C8
1437
1438struct magic_num_struct {
1439 uint32_t pid;
1440 uint32_t serial_num;
1441};
1442
1443struct dload_struct {
1444 uint32_t reserved1;
1445 uint32_t reserved2;
1446 uint32_t reserved3;
1447 uint16_t reserved4;
1448 uint16_t pid;
1449 char serial_number[SERIAL_NUMBER_LENGTH];
1450 uint16_t reserved5;
1451 struct magic_num_struct magic_struct;
1452};
1453
1454static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
1455{
1456 struct dload_struct __iomem *dload = 0;
1457
1458 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
1459 if (!dload) {
1460 pr_err("%s: cannot remap I/O memory region: %08x\n",
1461 __func__, DLOAD_USB_BASE_ADD);
1462 return -ENXIO;
1463 }
1464
1465 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
1466 __func__, dload, pid, snum);
1467 /* update pid */
1468 dload->magic_struct.pid = PID_MAGIC_ID;
1469 dload->pid = pid;
1470
1471 /* update serial number */
1472 dload->magic_struct.serial_num = 0;
1473 if (!snum) {
1474 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
1475 goto out;
1476 }
1477
1478 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -07001479 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001480out:
1481 iounmap(dload);
1482 return 0;
1483}
1484
1485static struct android_usb_platform_data android_usb_pdata = {
1486 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1487};
1488
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001489static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001490 .name = "android_usb",
1491 .id = -1,
1492 .dev = {
1493 .platform_data = &android_usb_pdata,
1494 },
1495};
1496
1497static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1498 0x03, 0x0f,
1499};
1500
1501static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1502 0x00, 0x24, 0x54, 0x10,
1503 0x09, 0x03, 0x01,
1504 0x10, 0x54, 0x30, 0x0C,
1505 0x24, 0x30, 0x0f,
1506};
1507
1508static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1509 0x00, 0x24, 0x54, 0x10,
1510 0x09, 0x07, 0x01, 0x0B,
1511 0x10, 0x54, 0x30, 0x0C,
1512 0x24, 0x30, 0x0f,
1513};
1514
1515static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1516 [0] = {
1517 .mode = MSM_SPM_MODE_CLOCK_GATING,
1518 .notify_rpm = false,
1519 .cmd = spm_wfi_cmd_sequence,
1520 },
1521 [1] = {
1522 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1523 .notify_rpm = false,
1524 .cmd = spm_power_collapse_without_rpm,
1525 },
1526 [2] = {
1527 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1528 .notify_rpm = true,
1529 .cmd = spm_power_collapse_with_rpm,
1530 },
1531};
1532
1533static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1534 [0] = {
1535 .reg_base_addr = MSM_SAW0_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001536 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001537#if defined(CONFIG_MSM_AVS_HW)
1538 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1539 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1540#endif
1541 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001542 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001543 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1544 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1545 .vctl_timeout_us = 50,
1546 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1547 .modes = msm_spm_seq_list,
1548 },
1549 [1] = {
1550 .reg_base_addr = MSM_SAW1_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001551 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001552#if defined(CONFIG_MSM_AVS_HW)
1553 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1554 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1555#endif
1556 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001557 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001558 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1559 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1560 .vctl_timeout_us = 50,
1561 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1562 .modes = msm_spm_seq_list,
1563 },
1564};
1565
1566static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1567 0x00, 0x20, 0x03, 0x20,
1568 0x00, 0x0f,
1569};
1570
1571static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1572 0x00, 0x20, 0x34, 0x64,
1573 0x48, 0x07, 0x48, 0x20,
1574 0x50, 0x64, 0x04, 0x34,
1575 0x50, 0x0f,
1576};
1577static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1578 0x00, 0x10, 0x34, 0x64,
1579 0x48, 0x07, 0x48, 0x10,
1580 0x50, 0x64, 0x04, 0x34,
1581 0x50, 0x0F,
1582};
1583
1584static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1585 [0] = {
1586 .mode = MSM_SPM_L2_MODE_RETENTION,
1587 .notify_rpm = false,
1588 .cmd = l2_spm_wfi_cmd_sequence,
1589 },
1590 [1] = {
1591 .mode = MSM_SPM_L2_MODE_GDHS,
1592 .notify_rpm = true,
1593 .cmd = l2_spm_gdhs_cmd_sequence,
1594 },
1595 [2] = {
1596 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1597 .notify_rpm = true,
1598 .cmd = l2_spm_power_off_cmd_sequence,
1599 },
1600};
1601
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001602static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1603 [0] = {
1604 .reg_base_addr = MSM_SAW_L2_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001605 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001606 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001607 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1608 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1609 .modes = msm_spm_l2_seq_list,
1610 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1611 },
1612};
1613
Mohan Pallaka5e490392011-09-09 15:18:41 +05301614#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1615#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
1616
1617static struct msm_xo_voter *xo_handle_d1;
1618
1619static int isa1200_power(int on)
1620{
1621 int rc = 0;
1622
1623 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !!on);
1624
1625 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
1626 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
1627 if (rc < 0) {
1628 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
1629 __func__, on ? "" : "de-", rc);
1630 goto err_xo_vote;
1631 }
1632
1633 return 0;
1634
1635err_xo_vote:
1636 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !on);
1637 return rc;
1638}
1639
1640static int isa1200_dev_setup(bool enable)
1641{
1642 int rc = 0;
1643
1644 struct pm_gpio hap_gpio_config = {
1645 .direction = PM_GPIO_DIR_OUT,
1646 .pull = PM_GPIO_PULL_NO,
1647 .out_strength = PM_GPIO_STRENGTH_HIGH,
1648 .function = PM_GPIO_FUNC_NORMAL,
1649 .inv_int_pol = 0,
1650 .vin_sel = 2,
1651 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1652 .output_value = 0,
1653 };
1654
1655 if (enable == true) {
1656 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
1657 if (rc) {
1658 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1659 __func__, PM_HAP_EN_GPIO, rc);
1660 return rc;
1661 }
1662
1663 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
1664 if (rc) {
1665 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1666 __func__, PM_HAP_LEN_GPIO, rc);
1667 return rc;
1668 }
1669
1670 rc = gpio_request(HAP_SHIFT_LVL_OE_GPIO, "hap_shft_lvl_oe");
1671 if (rc) {
1672 pr_err("%s: unable to request gpio %d (%d)\n",
1673 __func__, HAP_SHIFT_LVL_OE_GPIO, rc);
1674 return rc;
1675 }
1676
1677 rc = gpio_direction_output(HAP_SHIFT_LVL_OE_GPIO, 0);
1678 if (rc) {
1679 pr_err("%s: Unable to set direction\n", __func__);
1680 goto free_gpio;
1681 }
1682
1683 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
1684 if (IS_ERR(xo_handle_d1)) {
1685 rc = PTR_ERR(xo_handle_d1);
1686 pr_err("%s: failed to get the handle for D1(%d)\n",
1687 __func__, rc);
1688 goto gpio_set_dir;
1689 }
1690 } else {
1691 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1692
1693 msm_xo_put(xo_handle_d1);
1694 }
1695
1696 return 0;
1697
1698gpio_set_dir:
1699 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, 0);
1700free_gpio:
1701 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1702 return rc;
1703}
1704
1705static struct isa1200_regulator isa1200_reg_data[] = {
1706 {
1707 .name = "vcc_i2c",
1708 .min_uV = ISA_I2C_VTG_MIN_UV,
1709 .max_uV = ISA_I2C_VTG_MAX_UV,
1710 .load_uA = ISA_I2C_CURR_UA,
1711 },
1712};
1713
1714static struct isa1200_platform_data isa1200_1_pdata = {
1715 .name = "vibrator",
1716 .dev_setup = isa1200_dev_setup,
1717 .power_on = isa1200_power,
1718 .hap_en_gpio = PM_HAP_EN_GPIO,
1719 .hap_len_gpio = PM_HAP_LEN_GPIO,
1720 .max_timeout = 15000,
1721 .mode_ctrl = PWM_GEN_MODE,
1722 .pwm_fd = {
1723 .pwm_div = 256,
1724 },
1725 .is_erm = false,
1726 .smart_en = true,
1727 .ext_clk_en = true,
1728 .chip_en = 1,
1729 .regulator_info = isa1200_reg_data,
1730 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1731};
1732
1733static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1734 {
1735 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
Mohan Pallaka5e490392011-09-09 15:18:41 +05301736 },
1737};
1738
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001739#define CYTTSP_TS_GPIO_IRQ 11
1740#define CYTTSP_TS_SLEEP_GPIO 50
1741#define CYTTSP_TS_RESOUT_N_GPIO 52
1742
1743/*virtual key support */
1744static ssize_t tma340_vkeys_show(struct kobject *kobj,
1745 struct kobj_attribute *attr, char *buf)
1746{
1747 return snprintf(buf, 200,
1748 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1749 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1750 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1751 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1752 "\n");
1753}
1754
1755static struct kobj_attribute tma340_vkeys_attr = {
1756 .attr = {
1757 .mode = S_IRUGO,
1758 },
1759 .show = &tma340_vkeys_show,
1760};
1761
1762static struct attribute *tma340_properties_attrs[] = {
1763 &tma340_vkeys_attr.attr,
1764 NULL
1765};
1766
1767static struct attribute_group tma340_properties_attr_group = {
1768 .attrs = tma340_properties_attrs,
1769};
1770
1771
1772static int cyttsp_platform_init(struct i2c_client *client)
1773{
1774 int rc = 0;
1775 static struct kobject *tma340_properties_kobj;
1776
1777 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1778 tma340_properties_kobj = kobject_create_and_add("board_properties",
1779 NULL);
1780 if (tma340_properties_kobj)
1781 rc = sysfs_create_group(tma340_properties_kobj,
1782 &tma340_properties_attr_group);
1783 if (!tma340_properties_kobj || rc)
1784 pr_err("%s: failed to create board_properties\n",
1785 __func__);
1786
1787 return 0;
1788}
1789
1790static struct cyttsp_regulator regulator_data[] = {
1791 {
1792 .name = "vdd",
1793 .min_uV = CY_TMA300_VTG_MIN_UV,
1794 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301795 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1796 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001797 },
1798 /* TODO: Remove after runtime PM is enabled in I2C driver */
1799 {
1800 .name = "vcc_i2c",
1801 .min_uV = CY_I2C_VTG_MIN_UV,
1802 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301803 .hpm_load_uA = CY_I2C_CURR_UA,
1804 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001805 },
1806};
1807
1808static struct cyttsp_platform_data cyttsp_pdata = {
1809 .panel_maxx = 634,
1810 .panel_maxy = 1166,
1811 .disp_maxx = 616,
1812 .disp_maxy = 1023,
1813 .disp_minx = 0,
1814 .disp_miny = 16,
1815 .flags = 0x01,
1816 .gen = CY_GEN3, /* or */
1817 .use_st = CY_USE_ST,
1818 .use_mt = CY_USE_MT,
1819 .use_hndshk = CY_SEND_HNDSHK,
1820 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05301821 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001822 .use_gestures = CY_USE_GESTURES,
1823 .fw_fname = "cyttsp_8960_cdp.hex",
1824 /* activate up to 4 groups
1825 * and set active distance
1826 */
1827 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
1828 CY_GEST_GRP3 | CY_GEST_GRP4 |
1829 CY_ACT_DIST,
1830 /* change act_intrvl to customize the Active power state
1831 * scanning/processing refresh interval for Operating mode
1832 */
1833 .act_intrvl = CY_ACT_INTRVL_DFLT,
1834 /* change tch_tmout to customize the touch timeout for the
1835 * Active power state for Operating mode
1836 */
1837 .tch_tmout = CY_TCH_TMOUT_DFLT,
1838 /* change lp_intrvl to customize the Low Power power state
1839 * scanning/processing refresh interval for Operating mode
1840 */
1841 .lp_intrvl = CY_LP_INTRVL_DFLT,
1842 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
1843 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
1844 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1845 .regulator_info = regulator_data,
1846 .num_regulators = ARRAY_SIZE(regulator_data),
1847 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05301848 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001849};
1850
1851static struct i2c_board_info cyttsp_info[] __initdata = {
1852 {
1853 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1854 .platform_data = &cyttsp_pdata,
1855#ifndef CY_USE_TIMER
1856 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1857#endif /* CY_USE_TIMER */
1858 },
1859};
1860
Jing Lindc4413c2012-01-16 15:22:52 -08001861/* configuration data for mxt1386 */
1862static const u8 mxt1386_config_data[] = {
Mohan Pallaka50837382011-09-07 11:00:57 +05301863 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001864 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301865 /* T38 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001866 11, 2, 0, 11, 11, 11, 0, 0, 0, 0,
Jing Lin2f863172011-10-17 10:56:58 -07001867 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1868 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1869 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1870 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1871 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1872 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301873 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001874 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05301875 /* T8 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001876 8, 0, 0, 0, 0, 0, 8, 14, 50, 215,
Mohan Pallaka50837382011-09-07 11:00:57 +05301877 /* T9 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001878 131, 0, 0, 26, 42, 0, 32, 63, 3, 5,
1879 0, 2, 1, 113, 10, 10, 8, 10, 255, 2,
1880 85, 5, 0, 0, 20, 20, 75, 25, 202, 29,
1881 10, 10, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05301882 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001883 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1884 0,
Anirudh Ghayaldab4e0d2012-01-09 14:59:27 +05301885 /* T18 Object */
1886 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301887 /* T22 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001888 5, 0, 0, 0, 0, 0, 0, 0, 30, 0,
1889 0, 0, 5, 8, 10, 13, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301890 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001891 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1892 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301893 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001894 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
1895 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301896 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001897 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301898 /* T28 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001899 0, 0, 0, 8, 12, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05301900 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001901 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301902 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001903 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301904 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001905 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301906};
1907
Jing Lin33b007d2011-12-21 17:40:23 -08001908/* configuration data for mxt1386e using V1.0 firmware */
1909static const u8 mxt1386e_config_data_v1_0[] = {
1910 /* T6 Object */
1911 0, 0, 0, 0, 0, 0,
1912 /* T38 Object */
1913 12, 1, 0, 17, 1, 12, 0, 0, 0, 0,
1914 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1915 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1916 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1917 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1918 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1919 0, 0, 0, 0,
1920 /* T7 Object */
1921 100, 16, 50,
1922 /* T8 Object */
1923 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
1924 /* T9 Object */
1925 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
1926 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
1927 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
1928 10, 5, 0, 0, 0,
1929 /* T18 Object */
1930 0, 0,
1931 /* T24 Object */
1932 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1933 0, 0, 0, 0, 0, 0, 0, 0, 0,
1934 /* T25 Object */
1935 3, 0, 60, 115, 156, 99,
1936 /* T27 Object */
1937 0, 0, 0, 0, 0, 0, 0,
1938 /* T40 Object */
1939 0, 0, 0, 0, 0,
1940 /* T42 Object */
1941 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
1942 /* T43 Object */
1943 0, 0, 0, 0, 0, 0, 0,
1944 /* T46 Object */
1945 64, 0, 20, 20, 0, 0, 0, 0, 0,
1946 /* T47 Object */
1947 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
1948 /* T48 Object */
1949 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
1950 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
1951 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
1952 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
1953 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1954 0, 0, 0, 0,
1955 /* T56 Object */
1956 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1957 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1958 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1959 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1960 2, 99, 33,
1961};
1962
1963/* configuration data for mxt1386e using V2.1 firmware */
1964static const u8 mxt1386e_config_data_v2_1[] = {
1965 /* T6 Object */
1966 0, 0, 0, 0, 0, 0,
1967 /* T38 Object */
1968 12, 2, 0, 17, 1, 12, 0, 0, 0, 0,
1969 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1970 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1971 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1972 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1973 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1974 0, 0, 0, 0,
1975 /* T7 Object */
1976 100, 16, 50,
1977 /* T8 Object */
1978 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
1979 /* T9 Object */
1980 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
1981 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
1982 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
1983 10, 5, 0, 0, 0,
1984 /* T18 Object */
1985 0, 0,
1986 /* T24 Object */
1987 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1988 0, 0, 0, 0, 0, 0, 0, 0, 0,
1989 /* T25 Object */
1990 3, 0, 60, 115, 156, 99,
1991 /* T27 Object */
1992 0, 0, 0, 0, 0, 0, 0,
1993 /* T40 Object */
1994 0, 0, 0, 0, 0,
1995 /* T42 Object */
1996 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
1997 /* T43 Object */
1998 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
1999 16,
2000 /* T46 Object */
2001 64, 0, 20, 20, 0, 0, 0, 0, 0,
2002 /* T47 Object */
2003 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2004 /* T48 Object */
2005 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
2006 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
2007 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
2008 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
2009 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2010 0, 0, 0, 0,
2011 /* T56 Object */
2012 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2013 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2014 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2015 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2016 2, 99, 33, 0, 149, 24, 193, 255, 255, 255,
2017 255,
2018};
2019
Jing Lineec88ca2012-02-08 11:18:30 -08002020/* configuration data for mxt1386e on 3D SKU using V2.1 firmware */
2021static const u8 mxt1386e_config_data_3d[] = {
2022 /* T6 Object */
2023 0, 0, 0, 0, 0, 0,
2024 /* T38 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002025 13, 1, 0, 23, 2, 12, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002026 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, 0, 0, 0, 0, 0, 0,
2031 0, 0, 0, 0,
2032 /* T7 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002033 100, 10, 50,
Jing Lineec88ca2012-02-08 11:18:30 -08002034 /* T8 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002035 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002036 /* T9 Object */
2037 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
2038 0, 5, 5, 0, 10, 30, 10, 10, 175, 4,
Jing Lin66ba78b2012-02-24 21:25:12 -08002039 127, 7, 26, 21, 17, 19, 143, 35, 207, 40,
2040 20, 5, 54, 49, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002041 /* T18 Object */
2042 0, 0,
2043 /* T24 Object */
2044 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2045 0, 0, 0, 0, 0, 0, 0, 0, 0,
2046 /* T25 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002047 0, 0, 72, 113, 168, 97,
Jing Lineec88ca2012-02-08 11:18:30 -08002048 /* T27 Object */
2049 0, 0, 0, 0, 0, 0, 0,
2050 /* T40 Object */
2051 0, 0, 0, 0, 0,
2052 /* T42 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002053 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002054 /* T43 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002055 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2056 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002057 /* T46 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002058 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002059 /* T47 Object */
2060 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2061 /* T48 Object */
2062 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08002063 32, 50, 0, 10, 10, 0, 0, 100, 10, 90,
2064 0, 0, 0, 0, 0, 0, 0, 10, 1, 30,
2065 52, 10, 5, 0, 33, 0, 1, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002066 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2067 0, 0, 0, 0,
2068 /* T56 Object */
2069 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2070 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2071 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2072 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08002073 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2074 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002075};
2076
Amy Maloche08266db2011-11-04 11:07:16 -07002077#define MXT_TS_GPIO_IRQ 11
2078#define MXT_TS_LDO_EN_GPIO 50
2079#define MXT_TS_RESET_GPIO 52
Mohan Pallaka50837382011-09-07 11:00:57 +05302080
2081static void mxt_init_hw_liquid(void)
2082{
2083 int rc;
2084
Mohan Pallaka50837382011-09-07 11:00:57 +05302085 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
2086 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07002087 pr_err("%s: unable to request mxt_ldo_en_gpio [%d]\n",
2088 __func__, MXT_TS_LDO_EN_GPIO);
2089 return;
Mohan Pallaka50837382011-09-07 11:00:57 +05302090 }
2091
2092 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
2093 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07002094 pr_err("%s: unable to set_direction for mxt_ldo_en_gpio [%d]\n",
2095 __func__, MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05302096 goto err_ldo_gpio_req;
2097 }
2098
Mohan Pallaka50837382011-09-07 11:00:57 +05302099 return;
2100
Mohan Pallaka50837382011-09-07 11:00:57 +05302101err_ldo_gpio_req:
2102 gpio_free(MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05302103}
2104
Jing Lineec88ca2012-02-08 11:18:30 -08002105static struct mxt_config_info mxt_config_array_2d[] = {
Jing Lindc4413c2012-01-16 15:22:52 -08002106 {
2107 .config = mxt1386_config_data,
2108 .config_length = ARRAY_SIZE(mxt1386_config_data),
2109 .family_id = 0xA0,
2110 .variant_id = 0x0,
2111 .version = 0x10,
2112 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002113 .bootldr_id = MXT_BOOTLOADER_ID_1386,
Jing Lindc4413c2012-01-16 15:22:52 -08002114 },
Jing Lin33b007d2011-12-21 17:40:23 -08002115 {
2116 .config = mxt1386e_config_data_v1_0,
2117 .config_length = ARRAY_SIZE(mxt1386e_config_data_v1_0),
2118 .family_id = 0xA0,
2119 .variant_id = 0x2,
2120 .version = 0x10,
2121 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002122 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Linaeaeed52012-03-26 14:57:15 -07002123 .fw_name = "atmel_8960_liquid_v2_2_AA.hex",
Jing Lin33b007d2011-12-21 17:40:23 -08002124 },
2125 {
2126 .config = mxt1386e_config_data_v2_1,
2127 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
2128 .family_id = 0xA0,
2129 .variant_id = 0x7,
2130 .version = 0x21,
2131 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002132 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Linaeaeed52012-03-26 14:57:15 -07002133 .fw_name = "atmel_8960_liquid_v2_2_AA.hex",
2134 },
2135 {
2136 /* The config data for V2.2.AA is the same as for V2.1.AA */
2137 .config = mxt1386e_config_data_v2_1,
2138 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
2139 .family_id = 0xA0,
2140 .variant_id = 0x7,
2141 .version = 0x22,
2142 .build = 0xAA,
2143 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin33b007d2011-12-21 17:40:23 -08002144 },
Jing Lindc4413c2012-01-16 15:22:52 -08002145};
2146
Jing Lineec88ca2012-02-08 11:18:30 -08002147static struct mxt_platform_data mxt_platform_data_2d = {
2148 .config_array = mxt_config_array_2d,
2149 .config_array_size = ARRAY_SIZE(mxt_config_array_2d),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002150 .panel_minx = 0,
2151 .panel_maxx = 1365,
2152 .panel_miny = 0,
2153 .panel_maxy = 767,
2154 .disp_minx = 0,
2155 .disp_maxx = 1365,
2156 .disp_miny = 0,
2157 .disp_maxy = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05302158 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07002159 .i2c_pull_up = true,
Amy Maloche08266db2011-11-04 11:07:16 -07002160 .reset_gpio = MXT_TS_RESET_GPIO,
2161 .irq_gpio = MXT_TS_GPIO_IRQ,
Mohan Pallaka50837382011-09-07 11:00:57 +05302162};
2163
Jing Lineec88ca2012-02-08 11:18:30 -08002164static struct mxt_config_info mxt_config_array_3d[] = {
2165 {
2166 .config = mxt1386e_config_data_3d,
2167 .config_length = ARRAY_SIZE(mxt1386e_config_data_3d),
2168 .family_id = 0xA0,
2169 .variant_id = 0x7,
2170 .version = 0x21,
2171 .build = 0xAA,
2172 },
2173};
2174
2175static struct mxt_platform_data mxt_platform_data_3d = {
2176 .config_array = mxt_config_array_3d,
2177 .config_array_size = ARRAY_SIZE(mxt_config_array_3d),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002178 .panel_minx = 0,
2179 .panel_maxx = 1919,
2180 .panel_miny = 0,
2181 .panel_maxy = 1199,
2182 .disp_minx = 0,
2183 .disp_maxx = 1919,
2184 .disp_miny = 0,
2185 .disp_maxy = 1199,
Jing Lineec88ca2012-02-08 11:18:30 -08002186 .irqflags = IRQF_TRIGGER_FALLING,
2187 .i2c_pull_up = true,
2188 .reset_gpio = MXT_TS_RESET_GPIO,
2189 .irq_gpio = MXT_TS_GPIO_IRQ,
2190};
2191
Mohan Pallaka50837382011-09-07 11:00:57 +05302192static struct i2c_board_info mxt_device_info[] __initdata = {
2193 {
2194 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
Mohan Pallaka50837382011-09-07 11:00:57 +05302195 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
2196 },
2197};
2198
Eugene Yasmand2316b82011-12-07 18:23:48 +02002199static struct i2c_board_info sii_device_info[] __initdata = {
2200 {
2201 I2C_BOARD_INFO("Sil-9244", 0x39),
2202 .flags = I2C_CLIENT_WAKE,
2203 .irq = MSM_GPIO_TO_INT(15),
2204 },
2205};
2206
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002207static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
2208 .clk_freq = 100000,
2209 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002210};
2211
2212static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
2213 .clk_freq = 100000,
2214 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002215};
2216
2217static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
2218 .clk_freq = 100000,
2219 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002220};
2221
2222static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
2223 .clk_freq = 100000,
2224 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002225};
2226
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06002227static struct msm_pm_sleep_status_data msm_pm_slp_sts_data = {
2228 .base_addr = MSM_ACC0_BASE + 0x08,
2229 .cpu_offset = MSM_ACC1_BASE - MSM_ACC0_BASE,
2230 .mask = 1UL << 13,
2231};
2232
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002233static struct ks8851_pdata spi_eth_pdata = {
2234 .irq_gpio = KS8851_IRQ_GPIO,
2235 .rst_gpio = KS8851_RST_GPIO,
2236};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06002237
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002238static struct spi_board_info spi_board_info[] __initdata = {
2239 {
2240 .modalias = "ks8851",
2241 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2242 .max_speed_hz = 19200000,
2243 .bus_num = 0,
2244 .chip_select = 0,
2245 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002246 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002247 },
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07002248 {
2249 .modalias = "dsi_novatek_3d_panel_spi",
2250 .max_speed_hz = 10800000,
2251 .bus_num = 0,
2252 .chip_select = 1,
2253 .mode = SPI_MODE_0,
2254 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002255};
2256
2257static struct platform_device msm_device_saw_core0 = {
2258 .name = "saw-regulator",
2259 .id = 0,
2260 .dev = {
2261 .platform_data = &msm_saw_regulator_pdata_s5,
2262 },
2263};
2264
2265static struct platform_device msm_device_saw_core1 = {
2266 .name = "saw-regulator",
2267 .id = 1,
2268 .dev = {
2269 .platform_data = &msm_saw_regulator_pdata_s6,
2270 },
2271};
2272
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002273static struct tsens_platform_data msm_tsens_pdata = {
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002274 .slope = {910, 910, 910, 910, 910},
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002275 .tsens_factor = 1000,
2276 .hw_type = MSM_8960,
2277 .tsens_num_sensor = 5,
2278};
2279
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002280#ifdef CONFIG_MSM_FAKE_BATTERY
2281static struct platform_device fish_battery_device = {
2282 .name = "fish_battery",
2283};
2284#endif
2285
David Collins26f05562011-06-20 09:56:28 -07002286static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002287 .name = GPIO_REGULATOR_DEV_NAME,
2288 .id = PM8921_MPP_PM_TO_SYS(7),
2289 .dev = {
2290 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2291 },
2292};
2293
David Collins26f05562011-06-20 09:56:28 -07002294static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002295 .name = GPIO_REGULATOR_DEV_NAME,
2296 .id = 91,
2297 .dev = {
2298 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2299 },
2300};
2301
David Collinsb10be1d2011-09-02 10:29:31 -07002302static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
2303 .name = GPIO_REGULATOR_DEV_NAME,
2304 .id = PM8921_GPIO_PM_TO_SYS(17),
2305 .dev = {
2306 .platform_data =
2307 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2308 },
2309};
2310
David Collins35a78f52011-12-14 15:54:25 -08002311static struct platform_device msm8960_device_ext_otg_sw_vreg __devinitdata = {
2312 .name = GPIO_REGULATOR_DEV_NAME,
2313 .id = PM8921_GPIO_PM_TO_SYS(42),
2314 .dev = {
2315 .platform_data =
2316 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_OTG_SW],
2317 },
2318};
2319
David Collins26f05562011-06-20 09:56:28 -07002320static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
2321 .name = "rpm-regulator",
2322 .id = -1,
2323 .dev = {
2324 .platform_data = &msm_rpm_regulator_pdata,
2325 },
2326};
Mayank Ranae009c922012-03-22 03:02:06 +05302327#ifdef CONFIG_SERIAL_MSM_HS
2328static int configure_uart_gpios(int on)
2329{
2330 int ret = 0, i;
2331 int uart_gpios[] = {93, 94, 95, 96};
2332
2333 for (i = 0; i < ARRAY_SIZE(uart_gpios); i++) {
2334 if (on) {
2335 ret = gpio_request(uart_gpios[i], NULL);
2336 if (ret) {
2337 pr_err("%s: unable to request uart gpio[%d]\n",
2338 __func__, uart_gpios[i]);
2339 break;
2340 }
2341 } else {
2342 gpio_free(uart_gpios[i]);
2343 }
2344 }
2345
2346 if (ret && on && i)
2347 for (; i >= 0; i--)
2348 gpio_free(uart_gpios[i]);
2349 return ret;
2350}
2351
2352static struct msm_serial_hs_platform_data msm_uart_dm9_pdata = {
2353 .inject_rx_on_wakeup = 1,
2354 .rx_to_inject = 0xFD,
2355 .gpio_config = configure_uart_gpios,
2356};
2357#else
2358static struct msm_serial_hs_platform_data msm_uart_dm9_pdata;
2359#endif
David Collins26f05562011-06-20 09:56:28 -07002360
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002361static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07002362 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002363 &msm_device_smd,
Mayank Rana9f51f582011-08-04 18:35:59 +05302364 &msm_device_uart_dm6,
Mayank Ranae009c922012-03-22 03:02:06 +05302365 &msm_device_uart_dm9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002366 &msm_device_saw_core0,
2367 &msm_device_saw_core1,
2368 &msm8960_device_ext_5v_vreg,
David Collins87579612012-01-30 16:00:15 -08002369 &msm8960_device_ssbi_pmic,
David Collins96aa3e12012-02-29 10:31:34 -08002370 &msm8960_device_ext_otg_sw_vreg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002371 &msm8960_device_qup_spi_gsbi1,
2372 &msm8960_device_qup_i2c_gsbi3,
2373 &msm8960_device_qup_i2c_gsbi4,
2374 &msm8960_device_qup_i2c_gsbi10,
2375#ifndef CONFIG_MSM_DSPS
2376 &msm8960_device_qup_i2c_gsbi12,
2377#endif
2378 &msm_slim_ctrl,
2379 &msm_device_wcnss_wlan,
2380#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2381 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2382 &qcrypto_device,
2383#endif
2384
2385#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2386 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2387 &qcedev_device,
2388#endif
2389#ifdef CONFIG_MSM_ROTATOR
2390 &msm_rotator_device,
2391#endif
2392 &msm_device_sps,
2393#ifdef CONFIG_MSM_FAKE_BATTERY
2394 &fish_battery_device,
2395#endif
Larry Bassel41a055b2011-12-06 16:15:14 -08002396 &fmem_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002397#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07002398#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002399 &android_pmem_device,
2400 &android_pmem_adsp_device,
2401 &android_pmem_audio_device,
2402#endif
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -07002403#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002404 &msm_device_vidc,
2405 &msm_device_bam_dmux,
2406 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07002407
Joel Nidera1261942011-09-12 16:30:09 +03002408#if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE)
2409#ifdef CONFIG_MSM_USE_TSIF1
2410 &msm_device_tsif[1],
2411#else
2412 &msm_device_tsif[0],
2413#endif
2414#endif
2415
Mona Hossain9c430e32011-07-27 11:04:47 -07002416#ifdef CONFIG_HW_RANDOM_MSM
2417 &msm_device_rng,
2418#endif
Laura Abbottd6183792011-08-19 13:42:24 -07002419#ifdef CONFIG_ION_MSM
2420 &ion_dev,
2421#endif
Praveen Chidambaram78499012011-11-01 17:15:17 -06002422 &msm8960_rpm_device,
2423 &msm8960_rpm_log_device,
2424 &msm8960_rpm_stat_device,
Mona Hossain11c03ac2011-10-26 12:42:10 -07002425 &msm_device_tz_log,
Pratik Patel7831c082011-06-08 21:44:37 -07002426#ifdef CONFIG_MSM_QDSS
Pratik Patel1403f2a2012-03-21 10:10:00 -07002427 &msm_qdss_device,
Pratik Patel7831c082011-06-08 21:44:37 -07002428 &msm_etb_device,
2429 &msm_tpiu_device,
2430 &msm_funnel_device,
Pratik Patel492b3012012-03-06 14:22:30 -08002431 &msm_etm_device,
Pratik Patel7831c082011-06-08 21:44:37 -07002432#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07002433 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002434 &msm8960_device_watchdog,
Laura Abbottf8c03b92012-02-16 14:57:58 -08002435#ifdef CONFIG_MSM_RTB
2436 &msm_rtb_device,
2437#endif
Praveen Chidambaram8ea3dcd2011-12-07 14:46:31 -07002438 &msm8960_cpu_idle_device,
Praveen Chidambaram5c8adf22012-02-23 18:44:37 -07002439 &msm8960_msm_gov_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002440 &msm8960_device_cache_erp,
Laura Abbott306bcc22012-03-08 11:24:53 -08002441#ifdef CONFIG_MSM_CACHE_DUMP
2442 &msm_cache_dump_device,
2443#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002444};
2445
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002446static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07002447 &msm8960_device_uart_gsbi5,
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002448 &msm8960_device_otg,
2449 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002450 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05302451 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002452 &android_usb_device,
2453 &msm_device_vidc,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002454 &msm_bus_apps_fabric,
2455 &msm_bus_sys_fabric,
2456 &msm_bus_mm_fabric,
2457 &msm_bus_sys_fpb,
2458 &msm_bus_cpss_fpb,
2459 &msm_pcm,
Kiran Kandi5e809b02012-01-31 00:24:33 -08002460 &msm_multi_ch_pcm,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002461 &msm_pcm_routing,
2462 &msm_cpudai0,
2463 &msm_cpudai1,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002464 &msm8960_cpudai_slimbus_2_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002465 &msm_cpudai_hdmi_rx,
2466 &msm_cpudai_bt_rx,
2467 &msm_cpudai_bt_tx,
2468 &msm_cpudai_fm_rx,
2469 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002470 &msm_cpudai_auxpcm_rx,
2471 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002472 &msm_cpu_fe,
2473 &msm_stub_codec,
2474 &msm_voice,
2475 &msm_voip,
2476 &msm_lpa_pcm,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05302477 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07002478 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07002479 &msm_cpudai_incall_record_rx,
2480 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002481
2482#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2483 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2484 &qcrypto_device,
2485#endif
2486
2487#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2488 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2489 &qcedev_device,
2490#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002491};
2492
2493static struct platform_device *rumi3_devices[] __initdata = {
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07002494 &msm8960_device_uart_gsbi5,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002495 &msm_kgsl_3d0,
2496 &msm_kgsl_2d0,
2497 &msm_kgsl_2d1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002498#ifdef CONFIG_MSM_GEMINI
2499 &msm8960_gemini_device,
2500#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002501};
2502
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002503static struct platform_device *cdp_devices[] __initdata = {
Stephen Boydeb819882011-08-29 14:46:30 -07002504 &msm_8960_q6_lpass,
2505 &msm_8960_q6_mss_fw,
2506 &msm_8960_q6_mss_sw,
Stephen Boyd322a9922011-09-20 01:05:54 -07002507 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07002508 &msm_pil_tzapps,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07002509 &msm_pil_dsps,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002510 &msm_pil_vidc,
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002511 &msm8960_device_otg,
2512 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002513 &msm_device_hsusb_host,
2514 &android_usb_device,
2515 &msm_pcm,
Kiran Kandi5e809b02012-01-31 00:24:33 -08002516 &msm_multi_ch_pcm,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002517 &msm_pcm_routing,
2518 &msm_cpudai0,
2519 &msm_cpudai1,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002520 &msm8960_cpudai_slimbus_2_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002521 &msm_cpudai_hdmi_rx,
2522 &msm_cpudai_bt_rx,
2523 &msm_cpudai_bt_tx,
2524 &msm_cpudai_fm_rx,
2525 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002526 &msm_cpudai_auxpcm_rx,
2527 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002528 &msm_cpu_fe,
2529 &msm_stub_codec,
2530 &msm_kgsl_3d0,
2531#ifdef CONFIG_MSM_KGSL_2D
2532 &msm_kgsl_2d0,
2533 &msm_kgsl_2d1,
2534#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002535#ifdef CONFIG_MSM_GEMINI
2536 &msm8960_gemini_device,
2537#endif
2538 &msm_voice,
2539 &msm_voip,
2540 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05302541 &msm_cpudai_afe_01_rx,
2542 &msm_cpudai_afe_01_tx,
2543 &msm_cpudai_afe_02_rx,
2544 &msm_cpudai_afe_02_tx,
2545 &msm_pcm_afe,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05302546 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07002547 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07002548 &msm_cpudai_incall_record_rx,
2549 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002550 &msm_pcm_hostless,
2551 &msm_bus_apps_fabric,
2552 &msm_bus_sys_fabric,
2553 &msm_bus_mm_fabric,
2554 &msm_bus_sys_fpb,
2555 &msm_bus_cpss_fpb,
2556};
2557
2558static void __init msm8960_i2c_init(void)
2559{
2560 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2561 &msm8960_i2c_qup_gsbi4_pdata;
2562
2563 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2564 &msm8960_i2c_qup_gsbi3_pdata;
2565
2566 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2567 &msm8960_i2c_qup_gsbi10_pdata;
2568
2569 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2570 &msm8960_i2c_qup_gsbi12_pdata;
2571}
2572
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002573static void __init msm8960_gfx_init(void)
2574{
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06002575 uint32_t soc_platform_version = socinfo_get_version();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002576 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
2577 struct kgsl_device_platform_data *kgsl_3d0_pdata =
2578 msm_kgsl_3d0.dev.platform_data;
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -06002579 kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
2580 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002581 }
2582}
2583
Subhash Jadavani933e6a62011-12-26 18:05:04 +05302584static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002585 {
2586 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2587 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2588 true,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002589 100, 650, 801, 200,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002590 },
2591
2592 {
2593 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2594 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2595 true,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002596 2000, 200, 576000, 2000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002597 },
2598
2599 {
2600 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2601 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2602 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002603 8500, 51, 1122000, 8500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002604 },
2605
2606 {
2607 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2608 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
2609 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002610 9000, 51, 1130300, 9000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002611 },
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06002612 {
2613 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2614 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2615 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002616 10000, 51, 1130300, 10000,
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06002617 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002618
2619 {
2620 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2621 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2622 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002623 12000, 14, 2205900, 12000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002624 },
2625
2626 {
2627 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2628 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2629 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002630 18000, 12, 2364250, 18000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002631 },
2632
2633 {
2634 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2635 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2636 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002637 23500, 10, 2667000, 23500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002638 },
2639
2640 {
2641 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2642 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2643 false,
Praveen Chidambaram8e499d42012-02-08 10:32:27 -07002644 29700, 5, 2867000, 30000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002645 },
2646};
2647
Praveen Chidambaram78499012011-11-01 17:15:17 -06002648static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2649 .levels = &msm_rpmrs_levels[0],
2650 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2651 .vdd_mem_levels = {
2652 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2653 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2654 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2655 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2656 },
2657 .vdd_dig_levels = {
2658 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
2659 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
2660 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
2661 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
2662 },
2663 .vdd_mask = 0x7FFFFF,
2664 .rpmrs_target_id = {
2665 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2666 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
2667 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
2668 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
2669 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
2670 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
2671 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2672 },
2673};
2674
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002675static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2676 .mode = MSM_PM_BOOT_CONFIG_TZ,
2677};
2678
Subhash Jadavani933e6a62011-12-26 18:05:04 +05302679uint32_t msm_rpm_get_swfi_latency(void)
2680{
2681 int i;
2682
2683 for (i = 0; i < ARRAY_SIZE(msm_rpmrs_levels); i++) {
2684 if (msm_rpmrs_levels[i].sleep_mode ==
2685 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)
2686 return msm_rpmrs_levels[i].latency_us;
2687 }
2688
2689 return 0;
2690}
2691
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002692#ifdef CONFIG_I2C
2693#define I2C_SURF 1
2694#define I2C_FFA (1 << 1)
2695#define I2C_RUMI (1 << 2)
2696#define I2C_SIM (1 << 3)
2697#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03002698#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002699
2700struct i2c_registry {
2701 u8 machs;
2702 int bus;
2703 struct i2c_board_info *info;
2704 int len;
2705};
2706
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002707/* Sensors DSPS platform data */
2708#ifdef CONFIG_MSM_DSPS
2709#define DSPS_PIL_GENERIC_NAME "dsps"
2710#endif /* CONFIG_MSM_DSPS */
2711
2712static void __init msm8960_init_dsps(void)
2713{
2714#ifdef CONFIG_MSM_DSPS
2715 struct msm_dsps_platform_data *pdata =
2716 msm_dsps_device.dev.platform_data;
2717 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
2718 pdata->gpios = NULL;
2719 pdata->gpios_num = 0;
2720
2721 platform_device_register(&msm_dsps_device);
2722#endif /* CONFIG_MSM_DSPS */
2723}
2724
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -08002725static int hsic_peripheral_status = 1;
2726static DEFINE_MUTEX(hsic_status_lock);
2727
2728void peripheral_connect()
2729{
2730 mutex_lock(&hsic_status_lock);
2731 if (hsic_peripheral_status)
2732 goto out;
2733 platform_device_add(&msm_device_hsic_host);
2734 hsic_peripheral_status = 1;
2735out:
2736 mutex_unlock(&hsic_status_lock);
2737}
2738EXPORT_SYMBOL(peripheral_connect);
2739
2740void peripheral_disconnect()
2741{
2742 mutex_lock(&hsic_status_lock);
2743 if (!hsic_peripheral_status)
2744 goto out;
2745 platform_device_del(&msm_device_hsic_host);
2746 hsic_peripheral_status = 0;
2747out:
2748 mutex_unlock(&hsic_status_lock);
2749}
2750EXPORT_SYMBOL(peripheral_disconnect);
2751
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05302752static void __init msm8960_init_smsc_hub(void)
2753{
2754 uint32_t version = socinfo_get_version();
2755
2756 if (SOCINFO_VERSION_MAJOR(version) == 1)
2757 return;
2758
2759 if (machine_is_msm8960_liquid())
2760 platform_device_register(&smsc_hub_device);
2761}
2762
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002763static void __init msm8960_init_hsic(void)
2764{
2765#ifdef CONFIG_USB_EHCI_MSM_HSIC
2766 uint32_t version = socinfo_get_version();
2767
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08002768 if (SOCINFO_VERSION_MAJOR(version) == 1)
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002769 return;
2770
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002771 if (PLATFORM_IS_CHARM25() || machine_is_msm8960_liquid())
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08002772 platform_device_register(&msm_device_hsic_host);
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002773#endif
2774}
2775
Amir Samuelov5137e392011-09-21 17:31:25 +03002776#ifdef CONFIG_ISL9519_CHARGER
2777static struct isl_platform_data isl_data __initdata = {
2778 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
2779 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
2780 .max_system_voltage = 4200,
2781 .min_system_voltage = 3200,
Amir Samuelov95f49ff2012-01-29 09:14:08 +02002782 .chgcurrent = 1900,
2783 .term_current = 0,
Amir Samuelov5137e392011-09-21 17:31:25 +03002784 .input_current = 2048,
2785};
2786
2787static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
2788 {
2789 I2C_BOARD_INFO("isl9519q", 0x9),
2790 .irq = 0, /* Not required when notify-by-pmic */
2791 .platform_data = &isl_data,
2792 },
2793};
2794#endif /* CONFIG_ISL9519_CHARGER */
2795
Amir Samuelov755616d2011-12-13 16:34:46 +02002796static struct i2c_board_info liquid_io_expander_i2c_info[] __initdata = {
2797 {
2798 I2C_BOARD_INFO("sx1508q", 0x20),
2799 .platform_data = &msm8960_sx150x_data[SX150X_LIQUID]
2800 },
2801};
2802
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002803static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Amir Samuelov5137e392011-09-21 17:31:25 +03002804#ifdef CONFIG_ISL9519_CHARGER
2805 {
2806 I2C_LIQUID,
2807 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2808 isl_charger_i2c_info,
2809 ARRAY_SIZE(isl_charger_i2c_info),
2810 },
2811#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002812 {
2813 I2C_SURF | I2C_FFA | I2C_FLUID,
2814 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2815 cyttsp_info,
2816 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07002817 },
Mohan Pallaka50837382011-09-07 11:00:57 +05302818 {
2819 I2C_LIQUID,
2820 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2821 mxt_device_info,
2822 ARRAY_SIZE(mxt_device_info),
2823 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05302824 {
Mohan Pallakaf69f0492011-11-21 13:08:33 +05302825 I2C_FFA | I2C_LIQUID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302826 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Eugene Yasmand2316b82011-12-07 18:23:48 +02002827 sii_device_info,
2828 ARRAY_SIZE(sii_device_info),
2829 },
2830 {
2831 I2C_LIQUID,
2832 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302833 msm_isa1200_board_info,
2834 ARRAY_SIZE(msm_isa1200_board_info),
2835 },
Amir Samuelov755616d2011-12-13 16:34:46 +02002836 {
2837 I2C_LIQUID,
2838 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2839 liquid_io_expander_i2c_info,
2840 ARRAY_SIZE(liquid_io_expander_i2c_info),
2841 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002842};
2843#endif /* CONFIG_I2C */
2844
2845static void __init register_i2c_devices(void)
2846{
2847#ifdef CONFIG_I2C
2848 u8 mach_mask = 0;
2849 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08002850#ifdef CONFIG_MSM_CAMERA
2851 struct i2c_registry msm8960_camera_i2c_devices = {
2852 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
2853 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
2854 msm8960_camera_board_info.board_info,
2855 msm8960_camera_board_info.num_i2c_board_info,
2856 };
2857#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002858
2859 /* Build the matching 'supported_machs' bitmask */
2860 if (machine_is_msm8960_cdp())
2861 mach_mask = I2C_SURF;
2862 else if (machine_is_msm8960_rumi3())
2863 mach_mask = I2C_RUMI;
2864 else if (machine_is_msm8960_sim())
2865 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07002866 else if (machine_is_msm8960_fluid())
2867 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03002868 else if (machine_is_msm8960_liquid())
2869 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07002870 else if (machine_is_msm8960_mtp())
2871 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002872 else
2873 pr_err("unmatched machine ID in register_i2c_devices\n");
2874
Jing Lineec88ca2012-02-08 11:18:30 -08002875 if (machine_is_msm8960_liquid()) {
2876 if (SOCINFO_VERSION_MAJOR(socinfo_get_platform_version()) == 3)
2877 mxt_device_info[0].platform_data =
2878 &mxt_platform_data_3d;
2879 else
2880 mxt_device_info[0].platform_data =
2881 &mxt_platform_data_2d;
2882 }
2883
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002884 /* Run the array and install devices as appropriate */
2885 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
2886 if (msm8960_i2c_devices[i].machs & mach_mask)
2887 i2c_register_board_info(msm8960_i2c_devices[i].bus,
2888 msm8960_i2c_devices[i].info,
2889 msm8960_i2c_devices[i].len);
2890 }
Kevin Chan09f4e662011-12-16 08:17:02 -08002891#ifdef CONFIG_MSM_CAMERA
2892 if (msm8960_camera_i2c_devices.machs & mach_mask)
2893 i2c_register_board_info(msm8960_camera_i2c_devices.bus,
2894 msm8960_camera_i2c_devices.info,
2895 msm8960_camera_i2c_devices.len);
2896#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002897#endif
2898}
2899
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002900static void __init msm8960_sim_init(void)
2901{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002902 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
2903 &msm8960_device_watchdog.dev.platform_data;
2904
2905 wdog_pdata->bark_time = 15000;
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08002906 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002907 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
2908 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002909 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07002910 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002911 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002912 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002913
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002914 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002915 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002916 msm8960_i2c_init();
2917 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2918 msm_spm_l2_init(msm_spm_l2_data);
2919 msm8960_init_buses();
2920 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002921 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002922 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07002923 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002924
2925 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2926 &msm8960_qup_spi_gsbi1_pdata;
2927 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2928
2929 msm8960_init_mmc();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002930 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002931 slim_register_board_info(msm_slim_devices,
2932 ARRAY_SIZE(msm_slim_devices));
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002933 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06002934 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002935}
2936
2937static void __init msm8960_rumi3_init(void)
2938{
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08002939 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002940 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
2941 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002942 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07002943 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002944 msm_clock_init(&msm8960_dummy_clock_init_data);
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002945 msm8960_init_gpiomux();
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002946 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002947 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2948 &msm8960_qup_spi_gsbi1_pdata;
2949 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2950 msm8960_i2c_init();
2951 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2952 msm_spm_l2_init(msm_spm_l2_data);
2953 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002954 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002955 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002956 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002957 register_i2c_devices();
Mayank Ranae009c922012-03-22 03:02:06 +05302958
2959 /* For 8960 Fusion 2.2 Primary IPC */
2960 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
2961 msm_device_uart_dm9.dev.platform_data = &msm_uart_dm9_pdata;
2962
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002963 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002964 slim_register_board_info(msm_slim_devices,
2965 ARRAY_SIZE(msm_slim_devices));
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002966 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06002967 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002968}
2969
2970static void __init msm8960_cdp_init(void)
2971{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07002972 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2973 pr_err("meminfo_init() failed!\n");
2974
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08002975 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002976 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
2977 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07002978
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002979 regulator_suppress_info_printing();
2980 if (msm_xo_init())
2981 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07002982 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002983 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05302984 if (machine_is_msm8960_liquid())
2985 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002986 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05302987 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
2988 machine_is_msm8960_cdp()) {
2989 msm_otg_pdata.phy_init_seq = wr_phy_init_seq;
2990 } else if (machine_is_msm8960_liquid()) {
2991 msm_otg_pdata.phy_init_seq =
2992 liquid_v1_phy_init_seq;
2993 }
Anji jonnalaa7c1c5c2011-12-12 12:20:36 +05302994 msm_otg_pdata.swfi_latency =
2995 msm_rpmrs_levels[0].latency_us;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05302996 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05302997 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2 &&
2998 machine_is_msm8960_liquid())
2999 msm_device_hsic_host.dev.parent = &smsc_hub_device.dev;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08003000 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003001 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3002 &msm8960_qup_spi_gsbi1_pdata;
3003 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003004
3005 msm8960_init_pmic();
Mohan Pallakaf69f0492011-11-21 13:08:33 +05303006 if ((SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2 &&
3007 (machine_is_msm8960_mtp())) || machine_is_msm8960_liquid())
3008 msm_isa1200_board_info[0].platform_data = &isa1200_1_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003009 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003010 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003011 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3012 msm_spm_l2_init(msm_spm_l2_data);
3013 msm8960_init_buses();
3014 platform_add_devices(msm_footswitch_devices,
3015 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07003016 if (machine_is_msm8960_liquid())
3017 platform_device_register(&msm8960_device_ext_3p3v_vreg);
David Collinsd5a40732011-11-29 15:53:56 -08003018 if (machine_is_msm8960_cdp())
3019 platform_device_register(&msm8960_device_ext_l2_vreg);
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07003020
3021 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
3022 platform_device_register(&msm8960_device_uart_gsbi8);
3023 else
3024 platform_device_register(&msm8960_device_uart_gsbi5);
3025
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003026 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003027 msm8960_pm8921_gpio_mpp_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003028 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303029 msm8960_init_smsc_hub();
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003030 msm8960_init_hsic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003031 msm8960_init_cam();
3032 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07003033 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05303034 if (machine_is_msm8960_liquid())
3035 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003036 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08003037 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003038 slim_register_board_info(msm_slim_devices,
3039 ARRAY_SIZE(msm_slim_devices));
3040 msm8960_init_dsps();
Larry Bassela7eadea2011-07-14 10:46:00 -07003041 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06003042 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06003043 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Joel Kingb8352a12011-11-15 18:46:24 -08003044 if (PLATFORM_IS_CHARM25())
3045 platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003046}
3047
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003048MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
3049 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003050 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003051 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303052 .handle_irq = gic_handle_irq,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003053 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003054 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003055 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003056 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003057MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003058
3059MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
3060 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003061 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003062 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303063 .handle_irq = gic_handle_irq,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003064 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003065 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003066 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003067 .init_very_early = msm8960_early_memory,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003068MACHINE_END
3069
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003070MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
3071 .map_io = msm8960_map_io,
3072 .reserve = msm8960_reserve,
3073 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303074 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003075 .timer = &msm_timer,
3076 .init_machine = msm8960_cdp_init,
3077 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003078 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003079MACHINE_END
3080
3081MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
3082 .map_io = msm8960_map_io,
3083 .reserve = msm8960_reserve,
3084 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303085 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003086 .timer = &msm_timer,
3087 .init_machine = msm8960_cdp_init,
3088 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003089 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003090MACHINE_END
3091
3092MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
3093 .map_io = msm8960_map_io,
3094 .reserve = msm8960_reserve,
3095 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303096 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003097 .timer = &msm_timer,
3098 .init_machine = msm8960_cdp_init,
3099 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003100 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003101MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003102
3103MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
3104 .map_io = msm8960_map_io,
3105 .reserve = msm8960_reserve,
3106 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303107 .handle_irq = gic_handle_irq,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003108 .timer = &msm_timer,
3109 .init_machine = msm8960_cdp_init,
3110 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003111 .init_very_early = msm8960_early_memory,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003112MACHINE_END