blob: 5d96389e86617d127d7b1714cb6201d6077f973b [file] [log] [blame]
Abhimanyu Kapur440cdde2012-12-04 00:05:40 -08001/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080012 */
Abhimanyu Kapur440cdde2012-12-04 00:05:40 -080013#include <linux/err.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080014#include <linux/kernel.h>
15#include <linux/platform_device.h>
16#include <linux/io.h>
17#include <linux/irq.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070018#include <linux/i2c.h>
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -070019#include <linux/i2c/sx150x.h>
Amir Samuelov5137e392011-09-21 17:31:25 +030020#include <linux/i2c/isl9519.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070021#include <linux/gpio.h>
22#include <linux/msm_ssbi.h>
Steve Mucklef132c6c2012-06-06 18:30:57 -070023#include <linux/regulator/msm-gpio-regulator.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070024#include <linux/mfd/pm8xxx/pm8921.h>
Siddartha Mohanadossaf91d902011-10-20 10:23:34 -070025#include <linux/mfd/pm8xxx/pm8xxx-adc.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070026#include <linux/regulator/consumer.h>
27#include <linux/spi/spi.h>
28#include <linux/slimbus/slimbus.h>
29#include <linux/bootmem.h>
Steve Mucklef132c6c2012-06-06 18:30:57 -070030#include <linux/cyttsp-qc.h>
Laura Abbottc0e64032012-08-03 17:32:09 -070031#include <linux/dma-contiguous.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070032#include <linux/dma-mapping.h>
33#include <linux/platform_data/qcom_crypto_device.h>
Ankur Nandwanib0039b02011-08-09 14:00:45 -070034#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070035#include <linux/leds.h>
36#include <linux/leds-pm8xxx.h>
Mohan Pallaka50837382011-09-07 11:00:57 +053037#include <linux/i2c/atmel_mxt_ts.h>
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -070038#include <linux/msm_tsens.h>
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -070039#include <linux/ks8851.h>
Mohan Pallaka5e490392011-09-09 15:18:41 +053040#include <linux/i2c/isa1200.h>
Jack Cheung0b1987e2011-11-18 13:36:29 -080041#include <linux/memory.h>
Larry Bassel2d8b42d2012-03-12 10:41:26 -070042#include <linux/memblock.h>
Praveen Chidambaram877d7a42012-06-05 14:33:20 -060043#include <linux/msm_thermal.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080044
45#include <asm/mach-types.h>
46#include <asm/mach/arch.h>
Larry Basselb4126da2011-07-18 14:31:33 -070047#include <asm/setup.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080048#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070049#include <asm/mach/mmc.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080050
51#include <mach/board.h>
Joel Nider266a2642011-10-16 10:58:05 +020052#include <mach/msm_tspp.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080053#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>
Rohit Vaswania513aa8d2011-07-18 15:14:28 -070065#include <mach/gpiomux.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070066#include <mach/msm_bus_board.h>
67#include <mach/msm_memtypes.h>
68#include <mach/dma.h>
69#include <mach/msm_dsps.h>
70#include <mach/msm_xo.h>
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -070071#include <mach/restart.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080072
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070073#ifdef CONFIG_WCD9310_CODEC
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +053074#include <linux/mfd/wcd9xxx/core.h>
75#include <linux/mfd/wcd9xxx/pdata.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070076#endif
77
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +053078#include <linux/smsc3503.h>
Mitchel Humpheryscfa31af2012-09-06 11:34:03 -070079#include <linux/msm_ion.h>
Laura Abbottd6183792011-08-19 13:42:24 -070080#include <mach/ion.h>
Joel Kingb8352a12011-11-15 18:46:24 -080081#include <mach/mdm2.h>
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -080082#include <mach/mdm-peripheral.h>
Laura Abbottf8c03b92012-02-16 14:57:58 -080083#include <mach/msm_rtb.h>
Laura Abbott306bcc22012-03-08 11:24:53 -080084#include <mach/msm_cache_dump.h>
85#include <mach/scm.h>
Olav Haugan8726caf2012-05-10 15:11:35 -070086#include <mach/iommu_domains.h>
Laura Abbottd6183792011-08-19 13:42:24 -070087
Jordan Crouse914de9b2012-07-09 13:49:46 -060088#include <mach/kgsl.h>
Larry Bassel41a055b2011-12-06 16:15:14 -080089#include <linux/fmem.h>
90
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070091#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080092#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070093#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070094#include "spm.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080095#include "board-8960.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080096#include "pm.h"
Abhijeet Dharmapurikarefaca4f2011-12-27 16:24:07 -080097#include <mach/cpuidle.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070098#include "rpm_resources.h"
Subhash Jadavani909e04f2012-04-12 10:52:50 +053099#include <mach/mpm.h>
Matt Wagantall33d01f52012-02-23 23:27:44 -0800100#include "clock.h"
Naveen Ramaraj76483ad2011-09-06 14:25:44 -0700101#include "smd_private.h"
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -0600102#include "pm-boot.h"
Jeff Ohlstein7e668552011-10-06 16:17:25 -0700103#include "msm_watchdog.h"
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -0800104#include "platsmp.h"
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800105
Ming-yi Lin9baad172012-10-17 11:50:15 +0800106#if defined(CONFIG_BT) && defined(CONFIG_BT_HCIUART_ATH3K)
107#include <linux/wlan_plat.h>
108#include <linux/mutex.h>
109#endif
110
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700111static struct platform_device msm_fm_platform_init = {
112 .name = "iris_fm",
113 .id = -1,
114};
115
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700116#define KS8851_RST_GPIO 89
117#define KS8851_IRQ_GPIO 90
Mohan Pallaka5e490392011-09-09 15:18:41 +0530118
Manoj Rao14648742012-03-30 19:42:12 -0700119#define MHL_GPIO_INT 4
120#define MHL_GPIO_RESET 15
121
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700122#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700123
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800124struct sx150x_platform_data msm8960_sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700125 [SX150X_CAM] = {
126 .gpio_base = GPIO_CAM_EXPANDER_BASE,
127 .oscio_is_gpo = false,
128 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530129 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700130 .io_open_drain_ena = 0x0,
131 .irq_summary = -1,
132 },
Amir Samuelov755616d2011-12-13 16:34:46 +0200133 [SX150X_LIQUID] = {
134 .gpio_base = GPIO_LIQUID_EXPANDER_BASE,
135 .oscio_is_gpo = false,
136 .io_pullup_ena = 0x0c08,
137 .io_pulldn_ena = 0x4060,
138 .io_open_drain_ena = 0x000c,
139 .io_polarity = 0,
140 .irq_summary = -1,
141 },
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700142};
Nishant Pandit474f2252011-07-23 23:17:56 +0530143
144#endif
145
Olav Haugana21169d2012-01-04 09:17:06 -0800146#define MSM_PMEM_ADSP_SIZE 0x7800000
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -0700147#define MSM_PMEM_AUDIO_SIZE 0x4CF000
Mathew Karimpanal15fa5c42011-12-14 21:28:10 -0800148#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800149#define MSM_LIQUID_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800150#define MSM_HDMI_PRIM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Laura Abbott2d1760b2011-09-29 21:31:24 -0700151
152#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Deepak Kotur35825522012-06-06 15:49:14 -0700153#define HOLE_SIZE 0x20000
Rajeshwar Kurapatyc3e190a2012-12-04 19:28:05 +0530154#define MSM_ION_MFC_META_SIZE 0x40000 /* 256 Kbytes */
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700155#define MSM_CONTIG_MEM_SIZE 0x65000
Olav Haugan32594552012-03-13 11:40:05 -0700156#ifdef CONFIG_MSM_IOMMU
Olav Haugan8726caf2012-05-10 15:11:35 -0700157#define MSM_ION_MM_SIZE 0x3800000 /* Need to be multiple of 64K */
Olav Haugan32594552012-03-13 11:40:05 -0700158#define MSM_ION_SF_SIZE 0x0
Olav Hauganfbbf05b2012-04-05 14:33:41 -0700159#define MSM_ION_QSECOM_SIZE 0x780000 /* (7.5MB) */
Laura Abbott98e8ddc2013-02-09 09:35:30 -0800160#define MSM_ION_HEAP_NUM 8
Olav Haugan32594552012-03-13 11:40:05 -0700161#else
162#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
163#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Hauganfbbf05b2012-04-05 14:33:41 -0700164#define MSM_ION_QSECOM_SIZE 0x600000 /* (6MB) */
Olav Haugan32594552012-03-13 11:40:05 -0700165#define MSM_ION_HEAP_NUM 8
166#endif
Deepak Kotur35825522012-06-06 15:49:14 -0700167#define MSM_ION_MM_FW_SIZE (0x200000 - HOLE_SIZE) /* 128kb */
Rajeshwar Kurapatyc3e190a2012-12-04 19:28:05 +0530168#define MSM_ION_MFC_SIZE (SZ_8K + MSM_ION_MFC_META_SIZE)
Olav Haugan7355db02012-01-13 16:59:13 -0800169#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Olav Haugan32594552012-03-13 11:40:05 -0700170
Olav Hauganb5be7992011-11-18 14:29:02 -0800171#define MSM_LIQUID_ION_MM_SIZE (MSM_ION_MM_SIZE + 0x600000)
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800172#define MSM_LIQUID_ION_SF_SIZE MSM_LIQUID_PMEM_SIZE
173#define MSM_HDMI_PRIM_ION_SF_SIZE MSM_HDMI_PRIM_PMEM_SIZE
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700174
Deepak Kotur35825522012-06-06 15:49:14 -0700175#define MSM_MM_FW_SIZE (0x200000 - HOLE_SIZE) /* 2mb -128kb*/
176#define MSM8960_FIXED_AREA_START (0xa0000000 - (MSM_ION_MM_FW_SIZE + \
177 HOLE_SIZE))
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700178#define MAX_FIXED_AREA_SIZE 0x10000000
Deepak Kotur35825522012-06-06 15:49:14 -0700179#define MSM8960_FW_START MSM8960_FIXED_AREA_START
Laura Abbott98e8ddc2013-02-09 09:35:30 -0800180#define MSM_ION_ADSP_SIZE SZ_8M
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700181
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800182static unsigned msm_ion_sf_size = MSM_ION_SF_SIZE;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700183#else
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700184#define MSM_CONTIG_MEM_SIZE 0x110C000
Olav Hauganb5be7992011-11-18 14:29:02 -0800185#define MSM_ION_HEAP_NUM 1
Laura Abbott2d1760b2011-09-29 21:31:24 -0700186#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700187
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700188#ifdef CONFIG_KERNEL_MSM_CONTIG_MEM_REGION
189static unsigned msm_contig_mem_size = MSM_CONTIG_MEM_SIZE;
190static int __init msm_contig_mem_size_setup(char *p)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700191{
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700192 msm_contig_mem_size = memparse(p, NULL);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700193 return 0;
194}
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700195early_param("msm_contig_mem_size", msm_contig_mem_size_setup);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700196#endif
197
Laura Abbottb93525f2012-04-12 09:57:19 -0700198struct fmem_platform_data msm8960_fmem_pdata = {
Larry Bassel41a055b2011-12-06 16:15:14 -0800199};
200
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700201#define DSP_RAM_BASE_8960 0x8da00000
202#define DSP_RAM_SIZE_8960 0x1800000
203static int dspcrashd_pdata_8960 = 0xDEADDEAD;
204
205static struct resource resources_dspcrashd_8960[] = {
206 {
207 .name = "msm_dspcrashd",
208 .start = DSP_RAM_BASE_8960,
209 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
210 .flags = IORESOURCE_DMA,
211 },
212};
213
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800214static struct platform_device msm_device_dspcrashd_8960 = {
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700215 .name = "msm_dspcrashd",
216 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
217 .resource = resources_dspcrashd_8960,
218 .dev = { .platform_data = &dspcrashd_pdata_8960 },
219};
220
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700221static struct memtype_reserve msm8960_reserve_table[] __initdata = {
222 [MEMTYPE_SMI] = {
223 },
224 [MEMTYPE_EBI0] = {
225 .flags = MEMTYPE_FLAGS_1M_ALIGN,
226 },
227 [MEMTYPE_EBI1] = {
228 .flags = MEMTYPE_FLAGS_1M_ALIGN,
229 },
230};
231
Laura Abbottf8c03b92012-02-16 14:57:58 -0800232static void __init reserve_rtb_memory(void)
233{
234#if defined(CONFIG_MSM_RTB)
Laura Abbottb93525f2012-04-12 09:57:19 -0700235 msm8960_reserve_table[MEMTYPE_EBI1].size += msm8960_rtb_pdata.size;
Laura Abbottf8c03b92012-02-16 14:57:58 -0800236#endif
237}
238
Laura Abbott938d7502013-04-09 10:44:16 -0700239static int msm8960_paddr_to_memtype(phys_addr_t paddr)
Larry Basselb4126da2011-07-18 14:31:33 -0700240{
241 return MEMTYPE_EBI1;
242}
243
Steve Mucklef132c6c2012-06-06 18:30:57 -0700244#define FMEM_ENABLED 0
Olav Hauganf6dc7742012-02-15 09:11:55 -0800245
Laura Abbottd6183792011-08-19 13:42:24 -0700246#ifdef CONFIG_ION_MSM
Olav Haugan0703dbf2011-12-19 17:53:38 -0800247#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -0700248static struct ion_cp_heap_pdata cp_mm_msm8960_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800249 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugan8726caf2012-05-10 15:11:35 -0700250 .align = SZ_64K,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800251 .reusable = FMEM_ENABLED,
252 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700253 .fixed_position = FIXED_MIDDLE,
Olav Haugan8726caf2012-05-10 15:11:35 -0700254 .iommu_map_all = 1,
255 .iommu_2x_map_domain = VIDEO_DOMAIN,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800256};
257
Laura Abbottb93525f2012-04-12 09:57:19 -0700258static struct ion_cp_heap_pdata cp_mfc_msm8960_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800259 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugan42ebe712012-01-10 16:30:58 -0800260 .align = PAGE_SIZE,
Olav Haugan65f4bd82011-12-13 11:50:08 -0800261 .reusable = 0,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800262 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700263 .fixed_position = FIXED_HIGH,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800264};
265
Laura Abbottb93525f2012-04-12 09:57:19 -0700266static struct ion_co_heap_pdata co_msm8960_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800267 .adjacent_mem_id = INVALID_HEAP_ID,
268 .align = PAGE_SIZE,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800269 .mem_is_fmem = 0,
Olav Haugan42ebe712012-01-10 16:30:58 -0800270};
271
Laura Abbottb93525f2012-04-12 09:57:19 -0700272static struct ion_co_heap_pdata fw_co_msm8960_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800273 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
274 .align = SZ_128K,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800275 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700276 .fixed_position = FIXED_LOW,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800277};
278#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800279
Laura Abbottc0e64032012-08-03 17:32:09 -0700280static u64 msm_dmamask = DMA_BIT_MASK(32);
281
282static struct platform_device ion_mm_heap_device = {
283 .name = "ion-mm-heap-device",
284 .id = -1,
285 .dev = {
286 .dma_mask = &msm_dmamask,
287 .coherent_dma_mask = DMA_BIT_MASK(32),
288 }
289};
290
Laura Abbott98e8ddc2013-02-09 09:35:30 -0800291static struct platform_device ion_adsp_heap_device = {
292 .name = "ion-adsp-heap-device",
293 .id = -1,
294 .dev = {
295 .dma_mask = &msm_dmamask,
296 .coherent_dma_mask = DMA_BIT_MASK(32),
297 }
298};
299
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800300/**
301 * These heaps are listed in the order they will be allocated. Due to
302 * video hardware restrictions and content protection the FW heap has to
303 * be allocated adjacent (below) the MM heap and the MFC heap has to be
304 * allocated after the MM heap to ensure MFC heap is not more than 256MB
305 * away from the base address of the FW heap.
306 * However, the order of FW heap and MM heap doesn't matter since these
307 * two heaps are taken care of by separate code to ensure they are adjacent
308 * to each other.
309 * Don't swap the order unless you know what you are doing!
310 */
Benjamin Gaignard63d81032012-06-25 15:27:30 -0700311struct ion_platform_heap msm8960_heaps[] = {
Laura Abbottd6183792011-08-19 13:42:24 -0700312 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800313 .id = ION_SYSTEM_HEAP_ID,
Laura Abbottd6183792011-08-19 13:42:24 -0700314 .type = ION_HEAP_TYPE_SYSTEM,
Laura Abbottd6183792011-08-19 13:42:24 -0700315 .name = ION_VMALLOC_HEAP_NAME,
316 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700317#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -0700318 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800319 .id = ION_CP_MM_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800320 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800321 .name = ION_MM_HEAP_NAME,
322 .size = MSM_ION_MM_SIZE,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700323 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700324 .extra_data = (void *) &cp_mm_msm8960_ion_pdata,
Laura Abbottc0e64032012-08-03 17:32:09 -0700325 .priv = &ion_mm_heap_device.dev,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700326 },
Laura Abbott8c017362011-09-22 20:59:12 -0700327 {
Olav Haugan42ebe712012-01-10 16:30:58 -0800328 .id = ION_MM_FIRMWARE_HEAP_ID,
329 .type = ION_HEAP_TYPE_CARVEOUT,
330 .name = ION_MM_FIRMWARE_HEAP_NAME,
331 .size = MSM_ION_MM_FW_SIZE,
332 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700333 .extra_data = (void *) &fw_co_msm8960_ion_pdata,
Olav Haugan42ebe712012-01-10 16:30:58 -0800334 },
335 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800336 .id = ION_CP_MFC_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800337 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800338 .name = ION_MFC_HEAP_NAME,
339 .size = MSM_ION_MFC_SIZE,
340 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700341 .extra_data = (void *) &cp_mfc_msm8960_ion_pdata,
Olav Hauganb5be7992011-11-18 14:29:02 -0800342 },
Olav Haugan32594552012-03-13 11:40:05 -0700343#ifndef CONFIG_MSM_IOMMU
Olav Hauganb5be7992011-11-18 14:29:02 -0800344 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800345 .id = ION_SF_HEAP_ID,
346 .type = ION_HEAP_TYPE_CARVEOUT,
347 .name = ION_SF_HEAP_NAME,
348 .size = MSM_ION_SF_SIZE,
349 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700350 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800351 },
Olav Haugan32594552012-03-13 11:40:05 -0700352#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800353 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800354 .id = ION_IOMMU_HEAP_ID,
Laura Abbott8c017362011-09-22 20:59:12 -0700355 .type = ION_HEAP_TYPE_IOMMU,
356 .name = ION_IOMMU_HEAP_NAME,
357 },
Olav Haugan80854eb2012-01-12 12:00:23 -0800358 {
359 .id = ION_QSECOM_HEAP_ID,
360 .type = ION_HEAP_TYPE_CARVEOUT,
361 .name = ION_QSECOM_HEAP_NAME,
362 .size = MSM_ION_QSECOM_SIZE,
363 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700364 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan80854eb2012-01-12 12:00:23 -0800365 },
Olav Haugan7355db02012-01-13 16:59:13 -0800366 {
367 .id = ION_AUDIO_HEAP_ID,
368 .type = ION_HEAP_TYPE_CARVEOUT,
369 .name = ION_AUDIO_HEAP_NAME,
370 .size = MSM_ION_AUDIO_SIZE,
371 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700372 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan7355db02012-01-13 16:59:13 -0800373 },
Laura Abbott98e8ddc2013-02-09 09:35:30 -0800374 {
375 .id = ION_ADSP_HEAP_ID,
376 .type = ION_HEAP_TYPE_DMA,
377 .name = ION_ADSP_HEAP_NAME,
378 .size = MSM_ION_ADSP_SIZE,
379 .memory_type = ION_EBI_TYPE,
380 .extra_data = (void *) &co_msm8960_ion_pdata,
381 .priv = &ion_adsp_heap_device.dev,
382 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700383#endif
Benjamin Gaignard63d81032012-06-25 15:27:30 -0700384};
385
386static struct ion_platform_data msm8960_ion_pdata = {
387 .nr = MSM_ION_HEAP_NUM,
388 .heaps = msm8960_heaps,
Laura Abbottd6183792011-08-19 13:42:24 -0700389};
390
Laura Abbottb93525f2012-04-12 09:57:19 -0700391static struct platform_device msm8960_ion_dev = {
Laura Abbottd6183792011-08-19 13:42:24 -0700392 .name = "ion-msm",
393 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700394 .dev = { .platform_data = &msm8960_ion_pdata },
Laura Abbottd6183792011-08-19 13:42:24 -0700395};
396#endif
397
Laura Abbottb93525f2012-04-12 09:57:19 -0700398struct platform_device msm8960_fmem_device = {
Larry Bassel41a055b2011-12-06 16:15:14 -0800399 .name = "fmem",
400 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700401 .dev = { .platform_data = &msm8960_fmem_pdata },
Larry Bassel41a055b2011-12-06 16:15:14 -0800402};
403
Olav Haugan65f4bd82011-12-13 11:50:08 -0800404static void __init adjust_mem_for_liquid(void)
Laura Abbottd6183792011-08-19 13:42:24 -0700405{
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800406 unsigned int i;
407
Laura Abbottf3aada42013-03-08 14:44:52 -0800408 if (machine_is_msm8960_liquid())
409 msm_ion_sf_size = MSM_LIQUID_ION_SF_SIZE;
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800410
Laura Abbottf3aada42013-03-08 14:44:52 -0800411 if (msm8960_hdmi_as_primary_selected())
412 msm_ion_sf_size = MSM_HDMI_PRIM_ION_SF_SIZE;
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800413
Laura Abbottf3aada42013-03-08 14:44:52 -0800414 if (machine_is_msm8960_liquid() ||
415 msm8960_hdmi_as_primary_selected()) {
416 for (i = 0; i < msm8960_ion_pdata.nr; i++) {
417 if (msm8960_ion_pdata.heaps[i].id ==
418 ION_SF_HEAP_ID) {
419 msm8960_ion_pdata.heaps[i].size =
420 msm_ion_sf_size;
421 pr_debug("msm_ion_sf_size 0x%x\n",
422 msm_ion_sf_size);
423 break;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800424 }
425 }
426 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800427}
428
429static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
430 unsigned long size)
431{
432 msm8960_reserve_table[mem_type].size += size;
433}
434
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700435static void __init msm8960_reserve_fixed_area(unsigned long fixed_area_size)
436{
437#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
438 int ret;
439
440 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
441 panic("fixed area size is larger than %dM\n",
442 MAX_FIXED_AREA_SIZE >> 20);
443
444 reserve_info->fixed_area_size = fixed_area_size;
445 reserve_info->fixed_area_start = MSM8960_FW_START;
446
447 ret = memblock_remove(reserve_info->fixed_area_start,
448 reserve_info->fixed_area_size);
449 BUG_ON(ret);
450#endif
451}
452
Olav Haugan65f4bd82011-12-13 11:50:08 -0800453/**
454 * Reserve memory for ION and calculate amount of reusable memory for fmem.
455 * We only reserve memory for heaps that are not reusable. However, we only
456 * support one reusable heap at the moment so we ignore the reusable flag for
457 * other than the first heap with reusable flag set. Also handle special case
Olav Hauganf6dc7742012-02-15 09:11:55 -0800458 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
459 * at a higher address than FW in addition to not more than 256MB away from the
460 * base address of the firmware. This means that if MM is reusable the other
461 * two heaps must be allocated in the same region as FW. This is handled by the
462 * mem_is_fmem flag in the platform data. In addition the MM heap must be
463 * adjacent to the FW heap for content protection purposes.
Olav Haugan65f4bd82011-12-13 11:50:08 -0800464 */
465static void __init reserve_ion_memory(void)
466{
467#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
468 unsigned int i;
Laura Abbottc0e64032012-08-03 17:32:09 -0700469 int ret;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700470 unsigned int fixed_size = 0;
471 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
472 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
Laura Abbottc0e64032012-08-03 17:32:09 -0700473 unsigned long cma_alignment;
474 unsigned int low_use_cma = 0;
475 unsigned int middle_use_cma = 0;
476 unsigned int high_use_cma = 0;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800477
478 adjust_mem_for_liquid();
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700479 fixed_low_size = 0;
480 fixed_middle_size = 0;
481 fixed_high_size = 0;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800482
Laura Abbottc0e64032012-08-03 17:32:09 -0700483 cma_alignment = PAGE_SIZE << max(MAX_ORDER, pageblock_order);
484
Laura Abbottb93525f2012-04-12 09:57:19 -0700485 for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
Olav Haugan8726caf2012-05-10 15:11:35 -0700486 struct ion_platform_heap *heap =
Laura Abbottb93525f2012-04-12 09:57:19 -0700487 &(msm8960_ion_pdata.heaps[i]);
Olav Haugan8726caf2012-05-10 15:11:35 -0700488 int align = SZ_4K;
489 int iommu_map_all = 0;
490 int adjacent_mem_id = INVALID_HEAP_ID;
Laura Abbottc0e64032012-08-03 17:32:09 -0700491 int use_cma = 0;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800492
493 if (heap->extra_data) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700494 int fixed_position = NOT_FIXED;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700495
Mitchel Humpherys362b52b2012-09-13 10:53:22 -0700496 switch ((int) heap->type) {
Olav Haugan65f4bd82011-12-13 11:50:08 -0800497 case ION_HEAP_TYPE_CP:
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700498 fixed_position = ((struct ion_cp_heap_pdata *)
499 heap->extra_data)->fixed_position;
Olav Haugan8726caf2012-05-10 15:11:35 -0700500 align = ((struct ion_cp_heap_pdata *)
501 heap->extra_data)->align;
502 iommu_map_all =
503 ((struct ion_cp_heap_pdata *)
504 heap->extra_data)->iommu_map_all;
Laura Abbottc0e64032012-08-03 17:32:09 -0700505 if (((struct ion_cp_heap_pdata *)
506 heap->extra_data)->is_cma) {
507 heap->size = ALIGN(heap->size,
508 cma_alignment);
509 use_cma = 1;
510 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800511 break;
Laura Abbottc0e64032012-08-03 17:32:09 -0700512 case ION_HEAP_TYPE_DMA:
513 use_cma = 1;
514 /* Purposely fall through here */
Olav Haugan65f4bd82011-12-13 11:50:08 -0800515 case ION_HEAP_TYPE_CARVEOUT:
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700516 fixed_position = ((struct ion_co_heap_pdata *)
517 heap->extra_data)->fixed_position;
Olav Haugan8726caf2012-05-10 15:11:35 -0700518 adjacent_mem_id = ((struct ion_co_heap_pdata *)
519 heap->extra_data)->adjacent_mem_id;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700520 break;
521 default:
522 break;
523 }
524
Olav Haugan8726caf2012-05-10 15:11:35 -0700525 if (iommu_map_all) {
526 if (heap->size & (SZ_64K-1)) {
527 heap->size = ALIGN(heap->size, SZ_64K);
528 pr_info("Heap %s not aligned to 64K. Adjusting size to %x\n",
529 heap->name, heap->size);
530 }
531 }
532
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700533 if (fixed_position != NOT_FIXED)
534 fixed_size += heap->size;
Chintan Pandya07f05cd2013-04-12 14:50:29 +0530535 else if (!use_cma)
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700536 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
537
Laura Abbottc0e64032012-08-03 17:32:09 -0700538 if (fixed_position == FIXED_LOW) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700539 fixed_low_size += heap->size;
Laura Abbottc0e64032012-08-03 17:32:09 -0700540 low_use_cma = use_cma;
541 } else if (fixed_position == FIXED_MIDDLE) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700542 fixed_middle_size += heap->size;
Laura Abbottc0e64032012-08-03 17:32:09 -0700543 middle_use_cma = use_cma;
544 } else if (fixed_position == FIXED_HIGH) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700545 fixed_high_size += heap->size;
Laura Abbottc0e64032012-08-03 17:32:09 -0700546 high_use_cma = use_cma;
547 } else if (use_cma) {
548 /*
549 * Heaps that use CMA but are not part of the
550 * fixed set. Create wherever.
551 */
552 dma_declare_contiguous(
553 heap->priv,
554 heap->size,
555 0,
556 0xb0000000);
557 }
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700558 }
559 }
560
561 if (!fixed_size)
562 return;
563
Laura Abbottc0e64032012-08-03 17:32:09 -0700564 /*
565 * Given the setup for the fixed area, we can't round up all sizes.
566 * Some sizes must be set up exactly and aligned correctly. Incorrect
567 * alignments are considered a configuration issue
Larry Bassel4d4f4482012-04-04 11:26:09 -0700568 */
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700569
570 fixed_low_start = MSM8960_FIXED_AREA_START;
Laura Abbottc0e64032012-08-03 17:32:09 -0700571 if (low_use_cma) {
572 BUG_ON(!IS_ALIGNED(fixed_low_start, cma_alignment));
573 BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, cma_alignment));
574 } else {
575 BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, SECTION_SIZE));
576 ret = memblock_remove(fixed_low_start,
577 fixed_low_size + HOLE_SIZE);
578 BUG_ON(ret);
579 }
580
Deepak Kotur35825522012-06-06 15:49:14 -0700581 fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE;
Laura Abbottc0e64032012-08-03 17:32:09 -0700582 if (middle_use_cma) {
583 BUG_ON(!IS_ALIGNED(fixed_middle_start, cma_alignment));
584 BUG_ON(!IS_ALIGNED(fixed_middle_size, cma_alignment));
585 } else {
586 BUG_ON(!IS_ALIGNED(fixed_middle_size, SECTION_SIZE));
587 ret = memblock_remove(fixed_middle_start, fixed_middle_size);
588 BUG_ON(ret);
589 }
590
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700591 fixed_high_start = fixed_middle_start + fixed_middle_size;
Laura Abbottc0e64032012-08-03 17:32:09 -0700592 if (high_use_cma) {
593 fixed_high_size = ALIGN(fixed_high_size, cma_alignment);
594 BUG_ON(!IS_ALIGNED(fixed_high_start, cma_alignment));
595 } else {
596 /* This is the end of the fixed area so it's okay to round up */
597 fixed_high_size = ALIGN(fixed_high_size, SECTION_SIZE);
598 ret = memblock_remove(fixed_high_start, fixed_high_size);
599 BUG_ON(ret);
600 }
601
602
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700603
Laura Abbottb93525f2012-04-12 09:57:19 -0700604 for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
605 struct ion_platform_heap *heap = &(msm8960_ion_pdata.heaps[i]);
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700606
607 if (heap->extra_data) {
608 int fixed_position = NOT_FIXED;
Steve Muckle75c34ca2012-06-12 14:27:40 -0700609 struct ion_cp_heap_pdata *pdata = NULL;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700610
Mitchel Humpherys362b52b2012-09-13 10:53:22 -0700611 switch ((int) heap->type) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700612 case ION_HEAP_TYPE_CP:
Deepak Kotur35825522012-06-06 15:49:14 -0700613 pdata =
614 (struct ion_cp_heap_pdata *)heap->extra_data;
615 fixed_position = pdata->fixed_position;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700616 break;
617 case ION_HEAP_TYPE_CARVEOUT:
Laura Abbottc0e64032012-08-03 17:32:09 -0700618 case ION_HEAP_TYPE_DMA:
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700619 fixed_position = ((struct ion_co_heap_pdata *)
620 heap->extra_data)->fixed_position;
621 break;
622 default:
623 break;
624 }
625
626 switch (fixed_position) {
627 case FIXED_LOW:
628 heap->base = fixed_low_start;
629 break;
630 case FIXED_MIDDLE:
631 heap->base = fixed_middle_start;
Laura Abbottc0e64032012-08-03 17:32:09 -0700632 if (middle_use_cma) {
633 ret = dma_declare_contiguous(
634 &ion_mm_heap_device.dev,
635 heap->size,
636 fixed_middle_start,
637 0xa0000000);
638 WARN_ON(ret);
639 }
Deepak Kotur35825522012-06-06 15:49:14 -0700640 pdata->secure_base = fixed_middle_start
641 - HOLE_SIZE;
642 pdata->secure_size = HOLE_SIZE + heap->size;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700643 break;
644 case FIXED_HIGH:
645 heap->base = fixed_high_start;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800646 break;
647 default:
648 break;
649 }
650 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800651 }
Laura Abbottd6183792011-08-19 13:42:24 -0700652#endif
653}
Huaibin Yanga5419422011-12-08 23:52:10 -0800654
655static void __init reserve_mdp_memory(void)
656{
657 msm8960_mdp_writeback(msm8960_reserve_table);
658}
659
Stephen Boyd668d7652012-04-25 11:31:01 -0700660static void __init reserve_cache_dump_memory(void)
Laura Abbott306bcc22012-03-08 11:24:53 -0800661{
662#ifdef CONFIG_MSM_CACHE_DUMP
Laura Abbott306bcc22012-03-08 11:24:53 -0800663 unsigned int total;
Laura Abbott306bcc22012-03-08 11:24:53 -0800664
Laura Abbott155ab6f2012-05-25 08:52:18 -0700665 total = msm8960_cache_dump_pdata.l1_size +
666 msm8960_cache_dump_pdata.l2_size;
Laura Abbott306bcc22012-03-08 11:24:53 -0800667 msm8960_reserve_table[MEMTYPE_EBI1].size += total;
Laura Abbott306bcc22012-03-08 11:24:53 -0800668#endif
669}
670
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700671static void __init msm8960_calculate_reserve_sizes(void)
672{
Laura Abbottd6183792011-08-19 13:42:24 -0700673 reserve_ion_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800674 reserve_mdp_memory();
Laura Abbottf8c03b92012-02-16 14:57:58 -0800675 reserve_rtb_memory();
Laura Abbott306bcc22012-03-08 11:24:53 -0800676 reserve_cache_dump_memory();
Laura Abbottf3aada42013-03-08 14:44:52 -0800677 msm8960_reserve_table[MEMTYPE_EBI1].size += msm_contig_mem_size;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700678}
679
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700680static struct reserve_info msm8960_reserve_info __initdata = {
681 .memtype_reserve_table = msm8960_reserve_table,
682 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700683 .reserve_fixed_area = msm8960_reserve_fixed_area,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700684 .paddr_to_memtype = msm8960_paddr_to_memtype,
685};
686
Larry Basselb830e182011-10-14 10:46:55 -0700687static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700688{
689 reserve_info = &msm8960_reserve_info;
Larry Basselb830e182011-10-14 10:46:55 -0700690}
691
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800692static char prim_panel_name[PANEL_NAME_MAX_LEN];
693static char ext_panel_name[PANEL_NAME_MAX_LEN];
694static int __init prim_display_setup(char *param)
695{
696 if (strnlen(param, PANEL_NAME_MAX_LEN))
697 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
698 return 0;
699}
700early_param("prim_display", prim_display_setup);
701
702static int __init ext_display_setup(char *param)
703{
704 if (strnlen(param, PANEL_NAME_MAX_LEN))
705 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
706 return 0;
707}
708early_param("ext_display", ext_display_setup);
709
Larry Basselb830e182011-10-14 10:46:55 -0700710static void __init msm8960_reserve(void)
711{
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800712 msm8960_set_display_params(prim_panel_name, ext_panel_name);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700713 msm_reserve();
714}
715
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700716static void __init msm8960_allocate_memory_regions(void)
717{
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800718 msm8960_allocate_fb_region();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700719}
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800720
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700721#ifdef CONFIG_WCD9310_CODEC
722
723#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
724
Patrick Lai3043fba2011-08-01 14:15:57 -0700725/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
726 * 4 micbiases are used to power various analog and digital
727 * microphones operating at 1800 mV. Technically, all micbiases
728 * can source from single cfilter since all microphones operate
729 * at the same voltage level. The arrangement below is to make
730 * sure all cfilters are exercised. LDO_H regulator ouput level
731 * does not need to be as high as 2.85V. It is choosen for
732 * microphone sensitivity purpose.
733 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530734static struct wcd9xxx_pdata tabla_platform_data = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700735 .slimbus_slave_device = {
736 .name = "tabla-slave",
737 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
738 },
739 .irq = MSM_GPIO_TO_INT(62),
740 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530741 .num_irqs = NR_WCD9XXX_IRQS,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700742 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -0700743 .micbias = {
744 .ldoh_v = TABLA_LDOH_2P85_V,
745 .cfilt1_mv = 1800,
Joonwoo Parkcf473b42012-03-29 19:48:16 -0700746 .cfilt2_mv = 2700,
Patrick Lai3043fba2011-08-01 14:15:57 -0700747 .cfilt3_mv = 1800,
748 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
749 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
750 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
751 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530752 },
753 .regulator = {
754 {
755 .name = "CDC_VDD_CP",
756 .min_uV = 1800000,
757 .max_uV = 1800000,
758 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
759 },
760 {
761 .name = "CDC_VDDA_RX",
762 .min_uV = 1800000,
763 .max_uV = 1800000,
764 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
765 },
766 {
767 .name = "CDC_VDDA_TX",
768 .min_uV = 1800000,
769 .max_uV = 1800000,
770 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
771 },
772 {
773 .name = "VDDIO_CDC",
774 .min_uV = 1800000,
775 .max_uV = 1800000,
776 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
777 },
778 {
779 .name = "VDDD_CDC_D",
780 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700781 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530782 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
783 },
784 {
785 .name = "CDC_VDDA_A_1P2V",
786 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700787 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530788 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
789 },
790 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700791};
792
793static struct slim_device msm_slim_tabla = {
794 .name = "tabla-slim",
795 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
796 .dev = {
797 .platform_data = &tabla_platform_data,
798 },
799};
Santosh Mardi60e19d92011-10-28 01:15:14 +0530800
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530801static struct wcd9xxx_pdata tabla20_platform_data = {
Santosh Mardi60e19d92011-10-28 01:15:14 +0530802 .slimbus_slave_device = {
803 .name = "tabla-slave",
804 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
805 },
806 .irq = MSM_GPIO_TO_INT(62),
807 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530808 .num_irqs = NR_WCD9XXX_IRQS,
Santosh Mardi60e19d92011-10-28 01:15:14 +0530809 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
810 .micbias = {
811 .ldoh_v = TABLA_LDOH_2P85_V,
812 .cfilt1_mv = 1800,
Joonwoo Parkcf473b42012-03-29 19:48:16 -0700813 .cfilt2_mv = 2700,
Santosh Mardi60e19d92011-10-28 01:15:14 +0530814 .cfilt3_mv = 1800,
815 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
816 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
817 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
818 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530819 },
820 .regulator = {
821 {
822 .name = "CDC_VDD_CP",
823 .min_uV = 1800000,
824 .max_uV = 1800000,
825 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
826 },
827 {
828 .name = "CDC_VDDA_RX",
829 .min_uV = 1800000,
830 .max_uV = 1800000,
831 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
832 },
833 {
834 .name = "CDC_VDDA_TX",
835 .min_uV = 1800000,
836 .max_uV = 1800000,
837 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
838 },
839 {
840 .name = "VDDIO_CDC",
841 .min_uV = 1800000,
842 .max_uV = 1800000,
843 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
844 },
845 {
846 .name = "VDDD_CDC_D",
847 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700848 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530849 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
850 },
851 {
852 .name = "CDC_VDDA_A_1P2V",
853 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700854 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530855 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
856 },
857 },
Santosh Mardi60e19d92011-10-28 01:15:14 +0530858};
859
860static struct slim_device msm_slim_tabla20 = {
861 .name = "tabla2x-slim",
862 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
863 .dev = {
864 .platform_data = &tabla20_platform_data,
865 },
866};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700867#endif
868
869static struct slim_boardinfo msm_slim_devices[] = {
870#ifdef CONFIG_WCD9310_CODEC
871 {
872 .bus_num = 1,
873 .slim_slave = &msm_slim_tabla,
874 },
Santosh Mardi60e19d92011-10-28 01:15:14 +0530875 {
876 .bus_num = 1,
877 .slim_slave = &msm_slim_tabla20,
878 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700879#endif
880 /* add more slimbus slaves as needed */
881};
882
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700883#define MSM_WCNSS_PHYS 0x03000000
884#define MSM_WCNSS_SIZE 0x280000
885
886static struct resource resources_wcnss_wlan[] = {
887 {
888 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
889 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
890 .name = "wcnss_wlanrx_irq",
891 .flags = IORESOURCE_IRQ,
892 },
893 {
894 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
895 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
896 .name = "wcnss_wlantx_irq",
897 .flags = IORESOURCE_IRQ,
898 },
899 {
900 .start = MSM_WCNSS_PHYS,
901 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
902 .name = "wcnss_mmio",
903 .flags = IORESOURCE_MEM,
904 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -0700905 {
906 .start = 84,
907 .end = 88,
908 .name = "wcnss_gpios_5wire",
909 .flags = IORESOURCE_IO,
910 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700911};
912
Ankur Nandwanib0039b02011-08-09 14:00:45 -0700913static struct qcom_wcnss_opts qcom_wcnss_pdata = {
914 .has_48mhz_xo = 1,
915};
916
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700917static struct platform_device msm_device_wcnss_wlan = {
918 .name = "wcnss_wlan",
919 .id = 0,
920 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
921 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -0700922 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700923};
924
Ramesh Masavarapua26cce72012-04-09 12:32:25 -0700925#ifdef CONFIG_QSEECOM
926/* qseecom bus scaling */
927static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
928 {
929 .src = MSM_BUS_MASTER_SPS,
930 .dst = MSM_BUS_SLAVE_EBI_CH0,
931 .ib = 0,
932 .ab = 0,
933 },
934 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -0700935 .src = MSM_BUS_MASTER_SPS,
936 .dst = MSM_BUS_SLAVE_SPS,
937 .ib = 0,
938 .ab = 0,
939 },
940 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -0700941 .src = MSM_BUS_MASTER_SPDM,
942 .dst = MSM_BUS_SLAVE_SPDM,
943 .ib = 0,
944 .ab = 0,
945 },
946};
947
948static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
949 {
950 .src = MSM_BUS_MASTER_SPS,
951 .dst = MSM_BUS_SLAVE_EBI_CH0,
952 .ib = (492 * 8) * 1000000UL,
953 .ab = (492 * 8) * 100000UL,
954 },
955 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -0700956 .src = MSM_BUS_MASTER_SPS,
957 .dst = MSM_BUS_SLAVE_SPS,
958 .ib = (492 * 8) * 1000000UL,
959 .ab = (492 * 8) * 100000UL,
960 },
961 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -0700962 .src = MSM_BUS_MASTER_SPDM,
963 .dst = MSM_BUS_SLAVE_SPDM,
964 .ib = 0,
965 .ab = 0,
966 },
967};
968
969static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
970 {
971 .src = MSM_BUS_MASTER_SPS,
972 .dst = MSM_BUS_SLAVE_EBI_CH0,
973 .ib = 0,
974 .ab = 0,
975 },
976 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -0700977 .src = MSM_BUS_MASTER_SPS,
978 .dst = MSM_BUS_SLAVE_SPS,
979 .ib = 0,
980 .ab = 0,
981 },
982 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -0700983 .src = MSM_BUS_MASTER_SPDM,
984 .dst = MSM_BUS_SLAVE_SPDM,
985 .ib = (64 * 8) * 1000000UL,
986 .ab = (64 * 8) * 100000UL,
987 },
988};
989
Ramesh Masavarapu8d756582012-10-03 10:18:06 -0700990static struct msm_bus_vectors qseecom_enable_dfab_sfpb_vectors[] = {
991 {
992 .src = MSM_BUS_MASTER_SPS,
993 .dst = MSM_BUS_SLAVE_EBI_CH0,
994 .ib = (492 * 8) * 1000000UL,
995 .ab = (492 * 8) * 100000UL,
996 },
997 {
998 .src = MSM_BUS_MASTER_SPS,
999 .dst = MSM_BUS_SLAVE_SPS,
1000 .ib = (492 * 8) * 1000000UL,
1001 .ab = (492 * 8) * 100000UL,
1002 },
1003 {
1004 .src = MSM_BUS_MASTER_SPDM,
1005 .dst = MSM_BUS_SLAVE_SPDM,
1006 .ib = (64 * 8) * 1000000UL,
1007 .ab = (64 * 8) * 100000UL,
1008 },
1009};
1010
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001011static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1012 {
1013 ARRAY_SIZE(qseecom_clks_init_vectors),
1014 qseecom_clks_init_vectors,
1015 },
1016 {
1017 ARRAY_SIZE(qseecom_enable_dfab_vectors),
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001018 qseecom_enable_dfab_vectors,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001019 },
1020 {
1021 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1022 qseecom_enable_sfpb_vectors,
1023 },
Ramesh Masavarapu8d756582012-10-03 10:18:06 -07001024 {
1025 ARRAY_SIZE(qseecom_enable_dfab_sfpb_vectors),
1026 qseecom_enable_dfab_sfpb_vectors,
1027 },
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001028};
1029
1030static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1031 qseecom_hw_bus_scale_usecases,
1032 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1033 .name = "qsee",
1034};
1035
1036static struct platform_device qseecom_device = {
1037 .name = "qseecom",
1038 .id = 0,
1039 .dev = {
1040 .platform_data = &qseecom_bus_pdata,
1041 },
1042};
1043#endif
1044
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001045#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1046 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1047 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1048 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1049
1050#define QCE_SIZE 0x10000
1051#define QCE_0_BASE 0x18500000
1052
1053#define QCE_HW_KEY_SUPPORT 0
1054#define QCE_SHA_HMAC_SUPPORT 1
1055#define QCE_SHARE_CE_RESOURCE 1
1056#define QCE_CE_SHARED 0
1057
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001058/* Begin Bus scaling definitions */
1059static struct msm_bus_vectors crypto_hw_init_vectors[] = {
1060 {
1061 .src = MSM_BUS_MASTER_ADM_PORT0,
1062 .dst = MSM_BUS_SLAVE_EBI_CH0,
1063 .ab = 0,
1064 .ib = 0,
1065 },
1066 {
1067 .src = MSM_BUS_MASTER_ADM_PORT1,
1068 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1069 .ab = 0,
1070 .ib = 0,
1071 },
1072};
1073
1074static struct msm_bus_vectors crypto_hw_active_vectors[] = {
1075 {
1076 .src = MSM_BUS_MASTER_ADM_PORT0,
1077 .dst = MSM_BUS_SLAVE_EBI_CH0,
1078 .ab = 70000000UL,
1079 .ib = 70000000UL,
1080 },
1081 {
1082 .src = MSM_BUS_MASTER_ADM_PORT1,
1083 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1084 .ab = 2480000000UL,
1085 .ib = 2480000000UL,
1086 },
1087};
1088
1089static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
1090 {
1091 ARRAY_SIZE(crypto_hw_init_vectors),
1092 crypto_hw_init_vectors,
1093 },
1094 {
1095 ARRAY_SIZE(crypto_hw_active_vectors),
1096 crypto_hw_active_vectors,
1097 },
1098};
1099
1100static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
1101 crypto_hw_bus_scale_usecases,
1102 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
1103 .name = "cryptohw",
1104};
1105/* End Bus Scaling Definitions*/
1106
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001107static struct resource qcrypto_resources[] = {
1108 [0] = {
1109 .start = QCE_0_BASE,
1110 .end = QCE_0_BASE + QCE_SIZE - 1,
1111 .flags = IORESOURCE_MEM,
1112 },
1113 [1] = {
1114 .name = "crypto_channels",
1115 .start = DMOV_CE_IN_CHAN,
1116 .end = DMOV_CE_OUT_CHAN,
1117 .flags = IORESOURCE_DMA,
1118 },
1119 [2] = {
1120 .name = "crypto_crci_in",
1121 .start = DMOV_CE_IN_CRCI,
1122 .end = DMOV_CE_IN_CRCI,
1123 .flags = IORESOURCE_DMA,
1124 },
1125 [3] = {
1126 .name = "crypto_crci_out",
1127 .start = DMOV_CE_OUT_CRCI,
1128 .end = DMOV_CE_OUT_CRCI,
1129 .flags = IORESOURCE_DMA,
1130 },
1131};
1132
1133static struct resource qcedev_resources[] = {
1134 [0] = {
1135 .start = QCE_0_BASE,
1136 .end = QCE_0_BASE + QCE_SIZE - 1,
1137 .flags = IORESOURCE_MEM,
1138 },
1139 [1] = {
1140 .name = "crypto_channels",
1141 .start = DMOV_CE_IN_CHAN,
1142 .end = DMOV_CE_OUT_CHAN,
1143 .flags = IORESOURCE_DMA,
1144 },
1145 [2] = {
1146 .name = "crypto_crci_in",
1147 .start = DMOV_CE_IN_CRCI,
1148 .end = DMOV_CE_IN_CRCI,
1149 .flags = IORESOURCE_DMA,
1150 },
1151 [3] = {
1152 .name = "crypto_crci_out",
1153 .start = DMOV_CE_OUT_CRCI,
1154 .end = DMOV_CE_OUT_CRCI,
1155 .flags = IORESOURCE_DMA,
1156 },
1157};
1158
1159#endif
1160
1161#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1162 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1163
1164static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1165 .ce_shared = QCE_CE_SHARED,
1166 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1167 .hw_key_support = QCE_HW_KEY_SUPPORT,
1168 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001169 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001170};
1171
1172static struct platform_device qcrypto_device = {
1173 .name = "qcrypto",
1174 .id = 0,
1175 .num_resources = ARRAY_SIZE(qcrypto_resources),
1176 .resource = qcrypto_resources,
1177 .dev = {
1178 .coherent_dma_mask = DMA_BIT_MASK(32),
1179 .platform_data = &qcrypto_ce_hw_suppport,
1180 },
1181};
1182#endif
1183
1184#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1185 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1186
1187static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1188 .ce_shared = QCE_CE_SHARED,
1189 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1190 .hw_key_support = QCE_HW_KEY_SUPPORT,
1191 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001192 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001193};
1194
1195static struct platform_device qcedev_device = {
1196 .name = "qce",
1197 .id = 0,
1198 .num_resources = ARRAY_SIZE(qcedev_resources),
1199 .resource = qcedev_resources,
1200 .dev = {
1201 .coherent_dma_mask = DMA_BIT_MASK(32),
1202 .platform_data = &qcedev_ce_hw_suppport,
1203 },
1204};
1205#endif
1206
Joel King0cbf5d82012-05-24 15:21:38 -07001207static struct mdm_platform_data sglte_platform_data = {
1208 .mdm_version = "4.0",
1209 .ramdump_delay_ms = 1000,
Taniya Das2b7646b2013-01-15 11:28:14 +05301210 /* delay between two PS_HOLDs */
1211 .ps_hold_delay_ms = 500,
Joel King63ce8332012-06-01 09:59:26 -07001212 .soft_reset_inverted = 1,
Joel King0cbf5d82012-05-24 15:21:38 -07001213 .peripheral_platform_device = NULL,
Ameya Thakurc9a7a842012-06-24 22:47:52 -07001214 .ramdump_timeout_ms = 600000,
Ameya Thakura98bde52012-06-28 18:55:19 -07001215 .no_powerdown_after_ramdumps = 1,
Ameya Thakur43248fd2012-07-10 18:50:52 -07001216 .image_upgrade_supported = 1,
Joel Kingb8352a12011-11-15 18:46:24 -08001217};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001218
Joel Nider266a2642011-10-16 10:58:05 +02001219#define MSM_TSIF0_PHYS (0x18200000)
1220#define MSM_TSIF1_PHYS (0x18201000)
1221#define MSM_TSIF_SIZE (0x200)
1222#define MSM_TSPP_PHYS (0x18202000)
1223#define MSM_TSPP_SIZE (0x1000)
1224#define MSM_TSPP_BAM_PHYS (0x18204000)
1225#define MSM_TSPP_BAM_SIZE (0x2000)
1226
1227#define TSIF_0_CLK GPIO_CFG(75, 1, GPIO_CFG_INPUT, \
1228 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1229#define TSIF_0_EN GPIO_CFG(76, 1, GPIO_CFG_INPUT, \
1230 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1231#define TSIF_0_DATA GPIO_CFG(77, 1, GPIO_CFG_INPUT, \
1232 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1233#define TSIF_0_SYNC GPIO_CFG(82, 1, GPIO_CFG_INPUT, \
1234 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1235#define TSIF_1_CLK GPIO_CFG(79, 1, GPIO_CFG_INPUT, \
1236 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1237#define TSIF_1_EN GPIO_CFG(80, 1, GPIO_CFG_INPUT, \
1238 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1239#define TSIF_1_DATA GPIO_CFG(81, 1, GPIO_CFG_INPUT, \
1240 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1241#define TSIF_1_SYNC GPIO_CFG(78, 1, GPIO_CFG_INPUT, \
1242 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1243
1244static const struct msm_gpio tsif_gpios[] = {
1245 { .gpio_cfg = TSIF_0_CLK, .label = "tsif0_clk", },
1246 { .gpio_cfg = TSIF_0_EN, .label = "tsif0_en", },
1247 { .gpio_cfg = TSIF_0_DATA, .label = "tsif0_data", },
1248 { .gpio_cfg = TSIF_0_SYNC, .label = "tsif0_sync", },
1249 { .gpio_cfg = TSIF_1_CLK, .label = "tsif1_clk", },
1250 { .gpio_cfg = TSIF_1_EN, .label = "tsif1_en", },
1251 { .gpio_cfg = TSIF_1_DATA, .label = "tsif1_data", },
1252 { .gpio_cfg = TSIF_1_SYNC, .label = "tsif1_sync", },
1253};
1254
1255static struct resource tspp_resources[] = {
1256 [0] = {
Liron Kuch59339922013-01-01 18:29:47 +02001257 .name = "TSIF_TSPP_IRQ",
Joel Nider266a2642011-10-16 10:58:05 +02001258 .flags = IORESOURCE_IRQ,
1259 .start = TSIF_TSPP_IRQ,
Liron Kuch59339922013-01-01 18:29:47 +02001260 .end = TSIF_TSPP_IRQ,
Joel Nider266a2642011-10-16 10:58:05 +02001261 },
1262 [1] = {
Liron Kuch59339922013-01-01 18:29:47 +02001263 .name = "TSIF0_IRQ",
1264 .flags = IORESOURCE_IRQ,
1265 .start = TSIF1_IRQ,
1266 .end = TSIF1_IRQ,
1267 },
1268 [2] = {
1269 .name = "TSIF1_IRQ",
1270 .flags = IORESOURCE_IRQ,
1271 .start = TSIF2_IRQ,
1272 .end = TSIF2_IRQ,
1273 },
1274 [3] = {
1275 .name = "TSIF_BAM_IRQ",
1276 .flags = IORESOURCE_IRQ,
1277 .start = TSIF_BAM_IRQ,
1278 .end = TSIF_BAM_IRQ,
1279 },
1280 [4] = {
1281 .name = "MSM_TSIF0_PHYS",
Joel Nider266a2642011-10-16 10:58:05 +02001282 .flags = IORESOURCE_MEM,
1283 .start = MSM_TSIF0_PHYS,
1284 .end = MSM_TSIF0_PHYS + MSM_TSIF_SIZE - 1,
1285 },
Liron Kuch59339922013-01-01 18:29:47 +02001286 [5] = {
1287 .name = "MSM_TSIF1_PHYS",
Joel Nider266a2642011-10-16 10:58:05 +02001288 .flags = IORESOURCE_MEM,
1289 .start = MSM_TSIF1_PHYS,
1290 .end = MSM_TSIF1_PHYS + MSM_TSIF_SIZE - 1,
1291 },
Liron Kuch59339922013-01-01 18:29:47 +02001292 [6] = {
1293 .name = "MSM_TSPP_PHYS",
Joel Nider266a2642011-10-16 10:58:05 +02001294 .flags = IORESOURCE_MEM,
1295 .start = MSM_TSPP_PHYS,
1296 .end = MSM_TSPP_PHYS + MSM_TSPP_SIZE - 1,
1297 },
Liron Kuch59339922013-01-01 18:29:47 +02001298 [7] = {
1299 .name = "MSM_TSPP_BAM_PHYS",
Joel Nider266a2642011-10-16 10:58:05 +02001300 .flags = IORESOURCE_MEM,
1301 .start = MSM_TSPP_BAM_PHYS,
1302 .end = MSM_TSPP_BAM_PHYS + MSM_TSPP_BAM_SIZE - 1,
1303 },
1304};
1305
1306static struct msm_tspp_platform_data tspp_platform_data = {
1307 .num_gpios = ARRAY_SIZE(tsif_gpios),
1308 .gpios = tsif_gpios,
1309 .tsif_pclk = "tsif_pclk",
1310 .tsif_ref_clk = "tsif_ref_clk",
1311};
1312
1313static struct platform_device msm_device_tspp = {
1314 .name = "msm_tspp",
1315 .id = 0,
1316 .num_resources = ARRAY_SIZE(tspp_resources),
1317 .resource = tspp_resources,
1318 .dev = {
1319 .platform_data = &tspp_platform_data
1320 },
1321};
1322
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001323#define MSM_SHARED_RAM_PHYS 0x80000000
1324
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001325static void __init msm8960_map_io(void)
1326{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001327 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001328 msm_map_msm8960_io();
Abhimanyu Kapur91a0a502013-01-11 19:24:59 -08001329 if (socinfo_init() < 0)
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001330 pr_err("socinfo_init() failed!\n");
Abhimanyu Kapur440cdde2012-12-04 00:05:40 -08001331
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001332}
1333
1334static void __init msm8960_init_irq(void)
1335{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001336 struct msm_mpm_device_data *data = NULL;
1337
1338#ifdef CONFIG_MSM_MPM
1339 data = &msm8960_mpm_dev_data;
1340#endif
1341
1342 msm_mpm_irq_extn_init(data);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001343 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001344 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001345}
1346
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001347static void __init msm8960_init_buses(void)
1348{
1349#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -06001350 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -06001351 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
1352 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
Gagan Macae154c4b2011-10-05 19:24:43 -06001353 msm_bus_apps_fabric.dev.platform_data =
1354 &msm_bus_8960_apps_fabric_pdata;
1355 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
Gagan Mac680bfc02012-07-19 19:11:00 -06001356 if (cpu_is_msm8960ab()) {
1357 msm_bus_8960_sg_mm_fabric_pdata.rpm_enabled = 1;
1358 msm_bus_mm_fabric.dev.platform_data =
1359 &msm_bus_8960_sg_mm_fabric_pdata;
1360 } else {
1361 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
1362 msm_bus_mm_fabric.dev.platform_data =
1363 &msm_bus_8960_mm_fabric_pdata;
1364 }
Gagan Macae154c4b2011-10-05 19:24:43 -06001365 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
1366 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001367#endif
1368}
1369
1370static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
1371 .max_clock_speed = 15060000,
Kiran Gundac5fbd7f2012-07-30 13:22:39 +05301372 .infinite_mode = 0xFFC0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001373};
1374
1375#ifdef CONFIG_USB_MSM_OTG_72K
1376static struct msm_otg_platform_data msm_otg_pdata;
1377#else
Anji jonnalaa8b8d732011-12-06 10:03:24 +05301378static int wr_phy_init_seq[] = {
1379 0x44, 0x80, /* set VBUS valid threshold
1380 and disconnect valid threshold */
Chiranjeevi Velempatif983aeb2012-08-23 08:16:50 +05301381 0x68, 0x81, /* update DC voltage level */
Anji jonnalaa8b8d732011-12-06 10:03:24 +05301382 0x14, 0x82, /* set preemphasis and rise/fall time */
1383 0x13, 0x83, /* set source impedance adjusment */
1384 -1};
1385
1386static int liquid_v1_phy_init_seq[] = {
1387 0x44, 0x80,/* set VBUS valid threshold
1388 and disconnect valid threshold */
Chiranjeevi Velempatif983aeb2012-08-23 08:16:50 +05301389 0x6C, 0x81,/* update DC voltage level */
Anji jonnalaa8b8d732011-12-06 10:03:24 +05301390 0x18, 0x82,/* set preemphasis and rise/fall time */
1391 0x23, 0x83,/* set source impedance sdjusment */
1392 -1};
1393
Mayank Ranaa61da7a2012-08-14 10:57:00 +05301394static int sglte_phy_init_seq[] = {
1395 0x44, 0x80, /* set VBUS valid threshold
1396 and disconnect valid threshold */
Chiranjeevi Velempatif983aeb2012-08-23 08:16:50 +05301397 0x6A, 0x81, /* update DC voltage level */
Mayank Ranaa61da7a2012-08-14 10:57:00 +05301398 0x24, 0x82, /* set preemphasis and rise/fall time */
1399 0x13, 0x83, /* set source impedance adjusment */
1400 -1};
1401
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301402#ifdef CONFIG_MSM_BUS_SCALING
1403/* Bandwidth requests (zero) if no vote placed */
1404static struct msm_bus_vectors usb_init_vectors[] = {
1405 {
1406 .src = MSM_BUS_MASTER_SPS,
1407 .dst = MSM_BUS_SLAVE_EBI_CH0,
1408 .ab = 0,
1409 .ib = 0,
1410 },
1411};
1412
1413/* Bus bandwidth requests in Bytes/sec */
1414static struct msm_bus_vectors usb_max_vectors[] = {
1415 {
1416 .src = MSM_BUS_MASTER_SPS,
1417 .dst = MSM_BUS_SLAVE_EBI_CH0,
1418 .ab = 60000000, /* At least 480Mbps on bus. */
1419 .ib = 960000000, /* MAX bursts rate */
1420 },
1421};
1422
1423static struct msm_bus_paths usb_bus_scale_usecases[] = {
1424 {
1425 ARRAY_SIZE(usb_init_vectors),
1426 usb_init_vectors,
1427 },
1428 {
1429 ARRAY_SIZE(usb_max_vectors),
1430 usb_max_vectors,
1431 },
1432};
1433
1434static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
1435 usb_bus_scale_usecases,
1436 ARRAY_SIZE(usb_bus_scale_usecases),
1437 .name = "usb",
1438};
1439#endif
1440
Jack Pham87f202f2012-08-06 00:24:22 -07001441#define MSM_MPM_PIN_USB1_OTGSESSVLD 40
1442
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001443static struct msm_otg_platform_data msm_otg_pdata = {
1444 .mode = USB_OTG,
1445 .otg_control = OTG_PMIC_CONTROL,
1446 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001447 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
Anji jonnala4e3e6772011-09-15 18:53:42 +05301448 .power_budget = 750,
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301449#ifdef CONFIG_MSM_BUS_SCALING
1450 .bus_scale_table = &usb_bus_scale_pdata,
Jack Pham87f202f2012-08-06 00:24:22 -07001451 .mpm_otgsessvld_int = MSM_MPM_PIN_USB1_OTGSESSVLD,
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301452#endif
Pavankumar Kondeti2aec9f32012-06-13 09:06:03 +05301453#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
1454 .mhl_dev_name = "sii8334",
1455#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001456};
1457#endif
1458
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301459#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05301460#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301461static struct msm_hsic_host_platform_data msm_hsic_pdata = {
Manu Gautam3c598392013-03-22 16:59:10 +05301462 .strobe = 150,
1463 .data = 151,
1464 .phy_sof_workaround = true,
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301465};
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301466
1467static struct smsc_hub_platform_data hsic_hub_pdata = {
1468 .hub_reset = HSIC_HUB_RESET_GPIO,
1469};
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301470#else
1471static struct msm_hsic_host_platform_data msm_hsic_pdata;
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301472static struct smsc_hub_platform_data hsic_hub_pdata;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301473#endif
1474
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301475static struct platform_device smsc_hub_device = {
1476 .name = "msm_smsc_hub",
1477 .id = -1,
1478 .dev = {
1479 .platform_data = &hsic_hub_pdata,
1480 },
1481};
1482
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001483#define PID_MAGIC_ID 0x71432909
1484#define SERIAL_NUM_MAGIC_ID 0x61945374
1485#define SERIAL_NUMBER_LENGTH 127
1486#define DLOAD_USB_BASE_ADD 0x2A03F0C8
1487
1488struct magic_num_struct {
1489 uint32_t pid;
1490 uint32_t serial_num;
1491};
1492
1493struct dload_struct {
1494 uint32_t reserved1;
1495 uint32_t reserved2;
1496 uint32_t reserved3;
1497 uint16_t reserved4;
1498 uint16_t pid;
1499 char serial_number[SERIAL_NUMBER_LENGTH];
1500 uint16_t reserved5;
1501 struct magic_num_struct magic_struct;
1502};
1503
1504static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
1505{
1506 struct dload_struct __iomem *dload = 0;
1507
1508 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
1509 if (!dload) {
1510 pr_err("%s: cannot remap I/O memory region: %08x\n",
1511 __func__, DLOAD_USB_BASE_ADD);
1512 return -ENXIO;
1513 }
1514
1515 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
1516 __func__, dload, pid, snum);
1517 /* update pid */
1518 dload->magic_struct.pid = PID_MAGIC_ID;
1519 dload->pid = pid;
1520
1521 /* update serial number */
1522 dload->magic_struct.serial_num = 0;
1523 if (!snum) {
1524 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
1525 goto out;
1526 }
1527
1528 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -07001529 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001530out:
1531 iounmap(dload);
1532 return 0;
1533}
1534
1535static struct android_usb_platform_data android_usb_pdata = {
1536 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1537};
1538
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001539static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001540 .name = "android_usb",
1541 .id = -1,
1542 .dev = {
1543 .platform_data = &android_usb_pdata,
1544 },
1545};
1546
1547static uint8_t spm_wfi_cmd_sequence[] __initdata = {
Praveen Chidambaramc3c90822012-11-07 15:43:49 -07001548 0x03, 0x0f,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001549};
1550
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001551static uint8_t spm_retention_cmd_sequence[] __initdata = {
Praveen Chidambaramc3c90822012-11-07 15:43:49 -07001552 0x00, 0x05, 0x03, 0x0D,
1553 0x0B, 0x00, 0x0f,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001554};
1555
Anji Jonnala1a1711a2013-01-29 13:34:10 +05301556static uint8_t spm_retention_with_krait_v3_cmd_sequence[] __initdata = {
1557 0x42, 0x1B, 0x00,
1558 0x05, 0x03, 0x01, 0x0B,
1559 0x00, 0x42, 0x1B,
1560 0x0f,
1561};
1562
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001563static uint8_t spm_power_collapse_without_rpm[] __initdata = {
Praveen Chidambaramc3c90822012-11-07 15:43:49 -07001564 0x00, 0x24, 0x54, 0x10,
1565 0x09, 0x03, 0x01,
1566 0x10, 0x54, 0x30, 0x0C,
1567 0x24, 0x30, 0x0f,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001568};
1569
1570static uint8_t spm_power_collapse_with_rpm[] __initdata = {
Praveen Chidambaramc3c90822012-11-07 15:43:49 -07001571 0x00, 0x24, 0x54, 0x10,
1572 0x09, 0x07, 0x01, 0x0B,
1573 0x10, 0x54, 0x30, 0x0C,
1574 0x24, 0x30, 0x0f,
1575};
1576
1577/* 8960AB has a different command to assert apc_pdn */
1578static uint8_t spm_power_collapse_without_rpm_krait_v3[] __initdata = {
1579 0x00, 0x24, 0x84, 0x10,
1580 0x09, 0x03, 0x01,
1581 0x10, 0x84, 0x30, 0x0C,
1582 0x24, 0x30, 0x0f,
1583};
1584
1585static uint8_t spm_power_collapse_with_rpm_krait_v3[] __initdata = {
1586 0x00, 0x24, 0x84, 0x10,
1587 0x09, 0x07, 0x01, 0x0B,
1588 0x10, 0x84, 0x30, 0x0C,
1589 0x24, 0x30, 0x0f,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001590};
1591
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001592static struct msm_spm_seq_entry msm_spm_boot_cpu_seq_list[] __initdata = {
1593 [0] = {
1594 .mode = MSM_SPM_MODE_CLOCK_GATING,
1595 .notify_rpm = false,
1596 .cmd = spm_wfi_cmd_sequence,
1597 },
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001598 [1] = {
1599 .mode = MSM_SPM_MODE_POWER_RETENTION,
1600 .notify_rpm = false,
1601 .cmd = spm_retention_cmd_sequence,
1602 },
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001603 [2] = {
1604 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1605 .notify_rpm = false,
1606 .cmd = spm_power_collapse_without_rpm,
1607 },
1608 [3] = {
1609 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1610 .notify_rpm = true,
1611 .cmd = spm_power_collapse_with_rpm,
1612 },
1613};
1614
1615static struct msm_spm_seq_entry msm_spm_nonboot_cpu_seq_list[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001616 [0] = {
1617 .mode = MSM_SPM_MODE_CLOCK_GATING,
1618 .notify_rpm = false,
1619 .cmd = spm_wfi_cmd_sequence,
1620 },
Anji Jonnala1a1711a2013-01-29 13:34:10 +05301621
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001622 [1] = {
Anji Jonnala1a1711a2013-01-29 13:34:10 +05301623 .mode = MSM_SPM_MODE_POWER_RETENTION,
1624 .notify_rpm = false,
1625 .cmd = spm_retention_cmd_sequence,
1626 },
1627
1628 [2] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001629 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1630 .notify_rpm = false,
1631 .cmd = spm_power_collapse_without_rpm,
1632 },
Anji Jonnala1a1711a2013-01-29 13:34:10 +05301633
1634 [3] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001635 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1636 .notify_rpm = true,
1637 .cmd = spm_power_collapse_with_rpm,
1638 },
1639};
1640
1641static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1642 [0] = {
1643 .reg_base_addr = MSM_SAW0_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001644 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001645#if defined(CONFIG_MSM_AVS_HW)
Anji Jonnala39dd7252012-11-26 15:56:26 +05301646 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x58589464,
Praveen Chidambaram631f2822012-03-16 12:08:42 -06001647 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00020000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001648#endif
1649 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001650 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004,
1651 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C,
1652 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001653 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001654 .num_modes = ARRAY_SIZE(msm_spm_boot_cpu_seq_list),
1655 .modes = msm_spm_boot_cpu_seq_list,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001656 },
1657 [1] = {
1658 .reg_base_addr = MSM_SAW1_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001659 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001660#if defined(CONFIG_MSM_AVS_HW)
Anji Jonnala39dd7252012-11-26 15:56:26 +05301661 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x58589464,
Praveen Chidambaram631f2822012-03-16 12:08:42 -06001662 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00020000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001663#endif
1664 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001665 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001666 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1667 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1668 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001669 .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
1670 .modes = msm_spm_nonboot_cpu_seq_list,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001671 },
1672};
1673
1674static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1675 0x00, 0x20, 0x03, 0x20,
1676 0x00, 0x0f,
1677};
1678
1679static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1680 0x00, 0x20, 0x34, 0x64,
1681 0x48, 0x07, 0x48, 0x20,
1682 0x50, 0x64, 0x04, 0x34,
1683 0x50, 0x0f,
1684};
1685static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1686 0x00, 0x10, 0x34, 0x64,
1687 0x48, 0x07, 0x48, 0x10,
1688 0x50, 0x64, 0x04, 0x34,
1689 0x50, 0x0F,
1690};
1691
1692static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1693 [0] = {
1694 .mode = MSM_SPM_L2_MODE_RETENTION,
1695 .notify_rpm = false,
1696 .cmd = l2_spm_wfi_cmd_sequence,
1697 },
1698 [1] = {
1699 .mode = MSM_SPM_L2_MODE_GDHS,
1700 .notify_rpm = true,
1701 .cmd = l2_spm_gdhs_cmd_sequence,
1702 },
1703 [2] = {
1704 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1705 .notify_rpm = true,
1706 .cmd = l2_spm_power_off_cmd_sequence,
1707 },
1708};
1709
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001710static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1711 [0] = {
1712 .reg_base_addr = MSM_SAW_L2_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001713 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001714 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001715 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1716 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1717 .modes = msm_spm_l2_seq_list,
1718 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1719 },
1720};
1721
Anirudh Ghayal15698162012-07-31 11:51:32 +05301722#define HAP_SHIFT_LVL_OE_GPIO 47
1723#define HAP_SHIFT_LVL_OE_GPIO_SGLTE 89
Mohan Pallaka5e490392011-09-09 15:18:41 +05301724#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1725#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
1726
1727static struct msm_xo_voter *xo_handle_d1;
1728
1729static int isa1200_power(int on)
1730{
1731 int rc = 0;
Anirudh Ghayal15698162012-07-31 11:51:32 +05301732 int hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO;
Mohan Pallaka5e490392011-09-09 15:18:41 +05301733
Anirudh Ghayal15698162012-07-31 11:51:32 +05301734 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
1735 hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO_SGLTE;
1736
1737
1738 gpio_set_value(hap_oe_gpio, !!on);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301739
1740 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
1741 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
1742 if (rc < 0) {
1743 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
1744 __func__, on ? "" : "de-", rc);
1745 goto err_xo_vote;
1746 }
1747
1748 return 0;
1749
1750err_xo_vote:
Anirudh Ghayal15698162012-07-31 11:51:32 +05301751 gpio_set_value(hap_oe_gpio, !on);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301752 return rc;
1753}
1754
1755static int isa1200_dev_setup(bool enable)
1756{
1757 int rc = 0;
Anirudh Ghayal15698162012-07-31 11:51:32 +05301758 int hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO;
Mohan Pallaka5e490392011-09-09 15:18:41 +05301759
1760 struct pm_gpio hap_gpio_config = {
1761 .direction = PM_GPIO_DIR_OUT,
1762 .pull = PM_GPIO_PULL_NO,
1763 .out_strength = PM_GPIO_STRENGTH_HIGH,
1764 .function = PM_GPIO_FUNC_NORMAL,
1765 .inv_int_pol = 0,
1766 .vin_sel = 2,
1767 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1768 .output_value = 0,
1769 };
1770
Anirudh Ghayal15698162012-07-31 11:51:32 +05301771 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
1772 hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO_SGLTE;
1773
Mohan Pallaka5e490392011-09-09 15:18:41 +05301774 if (enable == true) {
1775 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
1776 if (rc) {
1777 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1778 __func__, PM_HAP_EN_GPIO, rc);
1779 return rc;
1780 }
1781
1782 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
1783 if (rc) {
1784 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1785 __func__, PM_HAP_LEN_GPIO, rc);
1786 return rc;
1787 }
1788
Anirudh Ghayal15698162012-07-31 11:51:32 +05301789 rc = gpio_request(hap_oe_gpio, "hap_shft_lvl_oe");
Mohan Pallaka5e490392011-09-09 15:18:41 +05301790 if (rc) {
1791 pr_err("%s: unable to request gpio %d (%d)\n",
Anirudh Ghayal15698162012-07-31 11:51:32 +05301792 __func__, hap_oe_gpio, rc);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301793 return rc;
1794 }
1795
Anirudh Ghayal15698162012-07-31 11:51:32 +05301796 rc = gpio_direction_output(hap_oe_gpio, 0);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301797 if (rc) {
1798 pr_err("%s: Unable to set direction\n", __func__);
1799 goto free_gpio;
1800 }
1801
1802 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
1803 if (IS_ERR(xo_handle_d1)) {
1804 rc = PTR_ERR(xo_handle_d1);
1805 pr_err("%s: failed to get the handle for D1(%d)\n",
1806 __func__, rc);
1807 goto gpio_set_dir;
1808 }
1809 } else {
Anirudh Ghayal15698162012-07-31 11:51:32 +05301810 gpio_free(hap_oe_gpio);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301811
1812 msm_xo_put(xo_handle_d1);
1813 }
1814
1815 return 0;
1816
1817gpio_set_dir:
Anirudh Ghayal15698162012-07-31 11:51:32 +05301818 gpio_set_value(hap_oe_gpio, 0);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301819free_gpio:
Anirudh Ghayal15698162012-07-31 11:51:32 +05301820 gpio_free(hap_oe_gpio);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301821 return rc;
1822}
1823
1824static struct isa1200_regulator isa1200_reg_data[] = {
1825 {
1826 .name = "vcc_i2c",
1827 .min_uV = ISA_I2C_VTG_MIN_UV,
1828 .max_uV = ISA_I2C_VTG_MAX_UV,
1829 .load_uA = ISA_I2C_CURR_UA,
1830 },
1831};
1832
1833static struct isa1200_platform_data isa1200_1_pdata = {
1834 .name = "vibrator",
1835 .dev_setup = isa1200_dev_setup,
1836 .power_on = isa1200_power,
1837 .hap_en_gpio = PM_HAP_EN_GPIO,
1838 .hap_len_gpio = PM_HAP_LEN_GPIO,
1839 .max_timeout = 15000,
1840 .mode_ctrl = PWM_GEN_MODE,
1841 .pwm_fd = {
1842 .pwm_div = 256,
1843 },
1844 .is_erm = false,
1845 .smart_en = true,
1846 .ext_clk_en = true,
1847 .chip_en = 1,
1848 .regulator_info = isa1200_reg_data,
1849 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1850};
1851
1852static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1853 {
1854 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
Mohan Pallaka5e490392011-09-09 15:18:41 +05301855 },
1856};
1857
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001858#define CYTTSP_TS_GPIO_IRQ 11
1859#define CYTTSP_TS_SLEEP_GPIO 50
1860#define CYTTSP_TS_RESOUT_N_GPIO 52
1861
1862/*virtual key support */
1863static ssize_t tma340_vkeys_show(struct kobject *kobj,
1864 struct kobj_attribute *attr, char *buf)
1865{
1866 return snprintf(buf, 200,
1867 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1868 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1869 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1870 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1871 "\n");
1872}
1873
1874static struct kobj_attribute tma340_vkeys_attr = {
1875 .attr = {
1876 .mode = S_IRUGO,
1877 },
1878 .show = &tma340_vkeys_show,
1879};
1880
1881static struct attribute *tma340_properties_attrs[] = {
1882 &tma340_vkeys_attr.attr,
1883 NULL
1884};
1885
1886static struct attribute_group tma340_properties_attr_group = {
1887 .attrs = tma340_properties_attrs,
1888};
1889
1890
1891static int cyttsp_platform_init(struct i2c_client *client)
1892{
1893 int rc = 0;
1894 static struct kobject *tma340_properties_kobj;
1895
1896 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1897 tma340_properties_kobj = kobject_create_and_add("board_properties",
1898 NULL);
1899 if (tma340_properties_kobj)
1900 rc = sysfs_create_group(tma340_properties_kobj,
1901 &tma340_properties_attr_group);
1902 if (!tma340_properties_kobj || rc)
1903 pr_err("%s: failed to create board_properties\n",
1904 __func__);
1905
1906 return 0;
1907}
1908
1909static struct cyttsp_regulator regulator_data[] = {
1910 {
1911 .name = "vdd",
1912 .min_uV = CY_TMA300_VTG_MIN_UV,
1913 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301914 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1915 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001916 },
1917 /* TODO: Remove after runtime PM is enabled in I2C driver */
1918 {
1919 .name = "vcc_i2c",
1920 .min_uV = CY_I2C_VTG_MIN_UV,
1921 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301922 .hpm_load_uA = CY_I2C_CURR_UA,
1923 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001924 },
1925};
1926
1927static struct cyttsp_platform_data cyttsp_pdata = {
1928 .panel_maxx = 634,
1929 .panel_maxy = 1166,
1930 .disp_maxx = 616,
1931 .disp_maxy = 1023,
1932 .disp_minx = 0,
1933 .disp_miny = 16,
1934 .flags = 0x01,
1935 .gen = CY_GEN3, /* or */
1936 .use_st = CY_USE_ST,
1937 .use_mt = CY_USE_MT,
1938 .use_hndshk = CY_SEND_HNDSHK,
1939 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05301940 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001941 .use_gestures = CY_USE_GESTURES,
1942 .fw_fname = "cyttsp_8960_cdp.hex",
1943 /* activate up to 4 groups
1944 * and set active distance
1945 */
1946 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
1947 CY_GEST_GRP3 | CY_GEST_GRP4 |
1948 CY_ACT_DIST,
Amy Maloche7b741b22012-06-14 14:37:22 -07001949 .act_intrvl = 10,
1950 .tch_tmout = 200,
1951 .lp_intrvl = 30,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001952 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
1953 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
1954 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1955 .regulator_info = regulator_data,
1956 .num_regulators = ARRAY_SIZE(regulator_data),
1957 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05301958 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001959};
1960
1961static struct i2c_board_info cyttsp_info[] __initdata = {
1962 {
1963 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1964 .platform_data = &cyttsp_pdata,
1965#ifndef CY_USE_TIMER
1966 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1967#endif /* CY_USE_TIMER */
1968 },
1969};
1970
Jing Lindc4413c2012-01-16 15:22:52 -08001971/* configuration data for mxt1386 */
1972static const u8 mxt1386_config_data[] = {
Mohan Pallaka50837382011-09-07 11:00:57 +05301973 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001974 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301975 /* T38 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001976 11, 2, 0, 11, 11, 11, 0, 0, 0, 0,
Jing Lin2f863172011-10-17 10:56:58 -07001977 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1978 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1979 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1980 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1981 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1982 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301983 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001984 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05301985 /* T8 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001986 8, 0, 0, 0, 0, 0, 8, 14, 50, 215,
Mohan Pallaka50837382011-09-07 11:00:57 +05301987 /* T9 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001988 131, 0, 0, 26, 42, 0, 32, 63, 3, 5,
1989 0, 2, 1, 113, 10, 10, 8, 10, 255, 2,
1990 85, 5, 0, 0, 20, 20, 75, 25, 202, 29,
1991 10, 10, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05301992 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001993 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1994 0,
Anirudh Ghayaldab4e0d2012-01-09 14:59:27 +05301995 /* T18 Object */
1996 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301997 /* T22 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001998 5, 0, 0, 0, 0, 0, 0, 0, 30, 0,
1999 0, 0, 5, 8, 10, 13, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302000 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002001 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2002 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302003 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002004 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
2005 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302006 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002007 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302008 /* T28 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002009 0, 0, 0, 8, 12, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05302010 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002011 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302012 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002013 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302014 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002015 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302016};
2017
Jing Lin33b007d2011-12-21 17:40:23 -08002018/* configuration data for mxt1386e using V1.0 firmware */
2019static const u8 mxt1386e_config_data_v1_0[] = {
2020 /* T6 Object */
2021 0, 0, 0, 0, 0, 0,
2022 /* T38 Object */
2023 12, 1, 0, 17, 1, 12, 0, 0, 0, 0,
2024 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2025 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2026 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2027 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,
2030 /* T7 Object */
2031 100, 16, 50,
2032 /* T8 Object */
2033 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
2034 /* T9 Object */
2035 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
2036 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
2037 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
2038 10, 5, 0, 0, 0,
2039 /* T18 Object */
2040 0, 0,
2041 /* T24 Object */
2042 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2043 0, 0, 0, 0, 0, 0, 0, 0, 0,
2044 /* T25 Object */
2045 3, 0, 60, 115, 156, 99,
2046 /* T27 Object */
2047 0, 0, 0, 0, 0, 0, 0,
2048 /* T40 Object */
2049 0, 0, 0, 0, 0,
2050 /* T42 Object */
2051 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
2052 /* T43 Object */
2053 0, 0, 0, 0, 0, 0, 0,
2054 /* T46 Object */
2055 64, 0, 20, 20, 0, 0, 0, 0, 0,
2056 /* T47 Object */
2057 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2058 /* T48 Object */
2059 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
2060 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
2061 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
2062 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
2063 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2064 0, 0, 0, 0,
2065 /* T56 Object */
2066 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2067 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2068 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2069 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2070 2, 99, 33,
2071};
2072
2073/* configuration data for mxt1386e using V2.1 firmware */
2074static const u8 mxt1386e_config_data_v2_1[] = {
2075 /* T6 Object */
2076 0, 0, 0, 0, 0, 0,
2077 /* T38 Object */
Jing Lin4a8a3e42012-09-12 10:08:22 -07002078 12, 5, 0, 28, 8, 12, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002079 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2080 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2081 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2082 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2083 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2084 0, 0, 0, 0,
2085 /* T7 Object */
Jing Lin4a8a3e42012-09-12 10:08:22 -07002086 32, 16, 50,
Jing Lin33b007d2011-12-21 17:40:23 -08002087 /* T8 Object */
2088 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
2089 /* T9 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002090 139, 0, 0, 26, 42, 0, 32, 80, 2, 5,
Jing Lina0bc4102012-07-06 17:03:45 -07002091 0, 5, 5, 79, 10, 30, 10, 10, 255, 2,
Jing Lin33b007d2011-12-21 17:40:23 -08002092 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
2093 10, 5, 0, 0, 0,
2094 /* T18 Object */
2095 0, 0,
2096 /* T24 Object */
2097 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2098 0, 0, 0, 0, 0, 0, 0, 0, 0,
2099 /* T25 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002100 1, 0, 60, 115, 156, 99,
Jing Lin33b007d2011-12-21 17:40:23 -08002101 /* T27 Object */
2102 0, 0, 0, 0, 0, 0, 0,
2103 /* T40 Object */
2104 0, 0, 0, 0, 0,
2105 /* T42 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002106 0, 0, 255, 0, 255, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002107 /* T43 Object */
2108 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
2109 16,
2110 /* T46 Object */
Jing Lina0bc4102012-07-06 17:03:45 -07002111 64, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002112 /* T47 Object */
2113 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2114 /* T48 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002115 1, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002116 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
2117 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
2118 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
2119 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2120 0, 0, 0, 0,
2121 /* T56 Object */
2122 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2123 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2124 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2125 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2126 2, 99, 33, 0, 149, 24, 193, 255, 255, 255,
2127 255,
2128};
2129
Jing Lineec88ca2012-02-08 11:18:30 -08002130/* configuration data for mxt1386e on 3D SKU using V2.1 firmware */
2131static const u8 mxt1386e_config_data_3d[] = {
2132 /* T6 Object */
2133 0, 0, 0, 0, 0, 0,
2134 /* T38 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002135 13, 1, 0, 23, 2, 12, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002136 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2137 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2138 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2139 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2140 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2141 0, 0, 0, 0,
2142 /* T7 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002143 100, 10, 50,
Jing Lineec88ca2012-02-08 11:18:30 -08002144 /* T8 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002145 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002146 /* T9 Object */
2147 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
2148 0, 5, 5, 0, 10, 30, 10, 10, 175, 4,
Jing Lin66ba78b2012-02-24 21:25:12 -08002149 127, 7, 26, 21, 17, 19, 143, 35, 207, 40,
2150 20, 5, 54, 49, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002151 /* T18 Object */
2152 0, 0,
2153 /* T24 Object */
2154 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2155 0, 0, 0, 0, 0, 0, 0, 0, 0,
2156 /* T25 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002157 0, 0, 72, 113, 168, 97,
Jing Lineec88ca2012-02-08 11:18:30 -08002158 /* T27 Object */
2159 0, 0, 0, 0, 0, 0, 0,
2160 /* T40 Object */
2161 0, 0, 0, 0, 0,
2162 /* T42 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002163 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002164 /* T43 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002165 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2166 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002167 /* T46 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002168 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002169 /* T47 Object */
2170 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2171 /* T48 Object */
2172 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08002173 32, 50, 0, 10, 10, 0, 0, 100, 10, 90,
2174 0, 0, 0, 0, 0, 0, 0, 10, 1, 30,
2175 52, 10, 5, 0, 33, 0, 1, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002176 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2177 0, 0, 0, 0,
2178 /* T56 Object */
2179 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2180 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2181 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2182 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08002183 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2184 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002185};
2186
Amy Maloche08266db2011-11-04 11:07:16 -07002187#define MXT_TS_GPIO_IRQ 11
2188#define MXT_TS_LDO_EN_GPIO 50
2189#define MXT_TS_RESET_GPIO 52
Mohan Pallaka50837382011-09-07 11:00:57 +05302190
2191static void mxt_init_hw_liquid(void)
2192{
2193 int rc;
2194
Mohan Pallaka50837382011-09-07 11:00:57 +05302195 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
2196 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07002197 pr_err("%s: unable to request mxt_ldo_en_gpio [%d]\n",
2198 __func__, MXT_TS_LDO_EN_GPIO);
2199 return;
Mohan Pallaka50837382011-09-07 11:00:57 +05302200 }
2201
2202 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
2203 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07002204 pr_err("%s: unable to set_direction for mxt_ldo_en_gpio [%d]\n",
2205 __func__, MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05302206 goto err_ldo_gpio_req;
2207 }
2208
Mohan Pallaka50837382011-09-07 11:00:57 +05302209 return;
2210
Mohan Pallaka50837382011-09-07 11:00:57 +05302211err_ldo_gpio_req:
2212 gpio_free(MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05302213}
2214
Jing Lineec88ca2012-02-08 11:18:30 -08002215static struct mxt_config_info mxt_config_array_2d[] = {
Jing Lindc4413c2012-01-16 15:22:52 -08002216 {
2217 .config = mxt1386_config_data,
2218 .config_length = ARRAY_SIZE(mxt1386_config_data),
2219 .family_id = 0xA0,
2220 .variant_id = 0x0,
2221 .version = 0x10,
2222 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002223 .bootldr_id = MXT_BOOTLOADER_ID_1386,
Jing Lindc4413c2012-01-16 15:22:52 -08002224 },
Jing Lin33b007d2011-12-21 17:40:23 -08002225 {
2226 .config = mxt1386e_config_data_v1_0,
2227 .config_length = ARRAY_SIZE(mxt1386e_config_data_v1_0),
2228 .family_id = 0xA0,
2229 .variant_id = 0x2,
2230 .version = 0x10,
2231 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002232 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Linaeaeed52012-03-26 14:57:15 -07002233 .fw_name = "atmel_8960_liquid_v2_2_AA.hex",
Jing Lin33b007d2011-12-21 17:40:23 -08002234 },
2235 {
2236 .config = mxt1386e_config_data_v2_1,
2237 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
2238 .family_id = 0xA0,
2239 .variant_id = 0x7,
2240 .version = 0x21,
2241 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002242 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Linaeaeed52012-03-26 14:57:15 -07002243 .fw_name = "atmel_8960_liquid_v2_2_AA.hex",
2244 },
2245 {
2246 /* The config data for V2.2.AA is the same as for V2.1.AA */
2247 .config = mxt1386e_config_data_v2_1,
2248 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
2249 .family_id = 0xA0,
2250 .variant_id = 0x7,
2251 .version = 0x22,
2252 .build = 0xAA,
2253 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin33b007d2011-12-21 17:40:23 -08002254 },
Jing Lindc4413c2012-01-16 15:22:52 -08002255};
2256
Jing Lineec88ca2012-02-08 11:18:30 -08002257static struct mxt_platform_data mxt_platform_data_2d = {
2258 .config_array = mxt_config_array_2d,
2259 .config_array_size = ARRAY_SIZE(mxt_config_array_2d),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002260 .panel_minx = 0,
2261 .panel_maxx = 1365,
2262 .panel_miny = 0,
2263 .panel_maxy = 767,
2264 .disp_minx = 0,
2265 .disp_maxx = 1365,
2266 .disp_miny = 0,
2267 .disp_maxy = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05302268 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07002269 .i2c_pull_up = true,
Amy Maloche08266db2011-11-04 11:07:16 -07002270 .reset_gpio = MXT_TS_RESET_GPIO,
2271 .irq_gpio = MXT_TS_GPIO_IRQ,
Mohan Pallaka50837382011-09-07 11:00:57 +05302272};
2273
Jing Lineec88ca2012-02-08 11:18:30 -08002274static struct mxt_config_info mxt_config_array_3d[] = {
2275 {
2276 .config = mxt1386e_config_data_3d,
2277 .config_length = ARRAY_SIZE(mxt1386e_config_data_3d),
2278 .family_id = 0xA0,
2279 .variant_id = 0x7,
2280 .version = 0x21,
2281 .build = 0xAA,
2282 },
2283};
2284
2285static struct mxt_platform_data mxt_platform_data_3d = {
2286 .config_array = mxt_config_array_3d,
2287 .config_array_size = ARRAY_SIZE(mxt_config_array_3d),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002288 .panel_minx = 0,
2289 .panel_maxx = 1919,
2290 .panel_miny = 0,
2291 .panel_maxy = 1199,
2292 .disp_minx = 0,
2293 .disp_maxx = 1919,
2294 .disp_miny = 0,
2295 .disp_maxy = 1199,
Jing Lineec88ca2012-02-08 11:18:30 -08002296 .irqflags = IRQF_TRIGGER_FALLING,
2297 .i2c_pull_up = true,
2298 .reset_gpio = MXT_TS_RESET_GPIO,
2299 .irq_gpio = MXT_TS_GPIO_IRQ,
2300};
2301
Mohan Pallaka50837382011-09-07 11:00:57 +05302302static struct i2c_board_info mxt_device_info[] __initdata = {
2303 {
2304 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
Mohan Pallaka50837382011-09-07 11:00:57 +05302305 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
2306 },
2307};
2308
Manoj Rao14648742012-03-30 19:42:12 -07002309static struct msm_mhl_platform_data mhl_platform_data = {
2310 .irq = MSM_GPIO_TO_INT(4),
Manoj Raoc6d904c2012-06-22 00:32:14 -07002311 .gpio_mhl_int = MHL_GPIO_INT,
2312 .gpio_mhl_reset = MHL_GPIO_RESET,
2313 .gpio_mhl_power = 0,
2314 .gpio_hdmi_mhl_mux = 0,
Manoj Rao14648742012-03-30 19:42:12 -07002315};
Manoj Rao14648742012-03-30 19:42:12 -07002316
Eugene Yasmand2316b82011-12-07 18:23:48 +02002317static struct i2c_board_info sii_device_info[] __initdata = {
2318 {
Manoj Rao14648742012-03-30 19:42:12 -07002319#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
2320 /*
2321 * keeps SI 8334 as the default
2322 * MHL TX
2323 */
2324 I2C_BOARD_INFO("sii8334", 0x39),
2325 .platform_data = &mhl_platform_data,
2326#endif
2327#ifdef CONFIG_FB_MSM_HDMI_MHL_9244
Eugene Yasmand2316b82011-12-07 18:23:48 +02002328 I2C_BOARD_INFO("Sil-9244", 0x39),
Eugene Yasmand2316b82011-12-07 18:23:48 +02002329 .irq = MSM_GPIO_TO_INT(15),
Manoj Rao14648742012-03-30 19:42:12 -07002330#endif /* CONFIG_MSM_HDMI_MHL */
2331 .flags = I2C_CLIENT_WAKE,
Eugene Yasmand2316b82011-12-07 18:23:48 +02002332 },
2333};
2334
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002335static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
2336 .clk_freq = 100000,
2337 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002338};
2339
2340static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
2341 .clk_freq = 100000,
2342 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002343};
2344
2345static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
2346 .clk_freq = 100000,
2347 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002348};
2349
2350static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
2351 .clk_freq = 100000,
2352 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002353};
2354
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002355static struct ks8851_pdata spi_eth_pdata = {
2356 .irq_gpio = KS8851_IRQ_GPIO,
2357 .rst_gpio = KS8851_RST_GPIO,
2358};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06002359
Anirudh Ghayal50137fb2012-07-31 16:58:53 +05302360static struct spi_board_info spi_eth_info[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002361 {
2362 .modalias = "ks8851",
2363 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2364 .max_speed_hz = 19200000,
2365 .bus_num = 0,
2366 .chip_select = 0,
2367 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002368 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002369 },
Anirudh Ghayal50137fb2012-07-31 16:58:53 +05302370};
2371static struct spi_board_info spi_board_info[] __initdata = {
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07002372 {
2373 .modalias = "dsi_novatek_3d_panel_spi",
2374 .max_speed_hz = 10800000,
2375 .bus_num = 0,
2376 .chip_select = 1,
2377 .mode = SPI_MODE_0,
2378 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002379};
2380
2381static struct platform_device msm_device_saw_core0 = {
2382 .name = "saw-regulator",
2383 .id = 0,
2384 .dev = {
2385 .platform_data = &msm_saw_regulator_pdata_s5,
2386 },
2387};
2388
2389static struct platform_device msm_device_saw_core1 = {
2390 .name = "saw-regulator",
2391 .id = 1,
2392 .dev = {
2393 .platform_data = &msm_saw_regulator_pdata_s6,
2394 },
2395};
2396
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002397static struct tsens_platform_data msm_tsens_pdata = {
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002398 .slope = {910, 910, 910, 910, 910},
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002399 .tsens_factor = 1000,
2400 .hw_type = MSM_8960,
2401 .tsens_num_sensor = 5,
2402};
2403
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002404static struct platform_device msm_tsens_device = {
2405 .name = "tsens8960-tm",
2406 .id = -1,
2407};
2408
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002409static struct msm_thermal_data msm_thermal_pdata = {
2410 .sensor_id = 0,
Eugene Seah2ee4a5d2012-06-25 18:16:41 -06002411 .poll_ms = 250,
2412 .limit_temp_degC = 60,
2413 .temp_hysteresis_degC = 10,
2414 .freq_step = 2,
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002415};
2416
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002417#ifdef CONFIG_MSM_FAKE_BATTERY
2418static struct platform_device fish_battery_device = {
2419 .name = "fish_battery",
2420};
2421#endif
2422
Binqiang Qiuf165c922012-08-15 18:00:18 -07002423#ifdef CONFIG_BATTERY_BCL
2424static struct platform_device battery_bcl_device = {
2425 .name = "battery_current_limit",
2426 .id = -1,
2427};
2428#endif
2429
David Collins26f05562011-06-20 09:56:28 -07002430static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002431 .name = GPIO_REGULATOR_DEV_NAME,
2432 .id = PM8921_MPP_PM_TO_SYS(7),
2433 .dev = {
2434 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2435 },
2436};
2437
David Collins26f05562011-06-20 09:56:28 -07002438static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002439 .name = GPIO_REGULATOR_DEV_NAME,
2440 .id = 91,
2441 .dev = {
2442 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2443 },
2444};
2445
David Collinsb10be1d2011-09-02 10:29:31 -07002446static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
2447 .name = GPIO_REGULATOR_DEV_NAME,
2448 .id = PM8921_GPIO_PM_TO_SYS(17),
2449 .dev = {
2450 .platform_data =
2451 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2452 },
2453};
2454
David Collins35a78f52011-12-14 15:54:25 -08002455static struct platform_device msm8960_device_ext_otg_sw_vreg __devinitdata = {
2456 .name = GPIO_REGULATOR_DEV_NAME,
2457 .id = PM8921_GPIO_PM_TO_SYS(42),
2458 .dev = {
2459 .platform_data =
2460 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_OTG_SW],
2461 },
2462};
2463
David Collins26f05562011-06-20 09:56:28 -07002464static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
2465 .name = "rpm-regulator",
2466 .id = -1,
2467 .dev = {
2468 .platform_data = &msm_rpm_regulator_pdata,
2469 },
2470};
Mayank Ranae009c922012-03-22 03:02:06 +05302471#ifdef CONFIG_SERIAL_MSM_HS
2472static int configure_uart_gpios(int on)
2473{
2474 int ret = 0, i;
2475 int uart_gpios[] = {93, 94, 95, 96};
2476
2477 for (i = 0; i < ARRAY_SIZE(uart_gpios); i++) {
2478 if (on) {
2479 ret = gpio_request(uart_gpios[i], NULL);
2480 if (ret) {
2481 pr_err("%s: unable to request uart gpio[%d]\n",
2482 __func__, uart_gpios[i]);
2483 break;
2484 }
2485 } else {
2486 gpio_free(uart_gpios[i]);
2487 }
2488 }
2489
2490 if (ret && on && i)
2491 for (; i >= 0; i--)
2492 gpio_free(uart_gpios[i]);
2493 return ret;
2494}
2495
2496static struct msm_serial_hs_platform_data msm_uart_dm9_pdata = {
Mayank Ranad85a5082012-04-29 17:24:13 -07002497 .gpio_config = configure_uart_gpios,
Mayank Ranae009c922012-03-22 03:02:06 +05302498};
Mayank Rana1f02d952012-07-04 19:11:20 +05302499
2500static int configure_gsbi8_uart_gpios(int on)
2501{
2502 int ret = 0, i;
2503 int uart_gpios[] = {34, 35, 36, 37};
2504
2505 for (i = 0; i < ARRAY_SIZE(uart_gpios); i++) {
2506 if (on) {
2507 ret = gpio_request(uart_gpios[i], NULL);
2508 if (ret) {
2509 pr_err("%s: unable to request uart gpio[%d]\n",
2510 __func__, uart_gpios[i]);
2511 break;
2512 }
2513 } else {
2514 gpio_free(uart_gpios[i]);
2515 }
2516 }
2517
2518 if (ret && on && i)
2519 for (; i >= 0; i--)
2520 gpio_free(uart_gpios[i]);
2521 return ret;
2522}
2523
2524static struct msm_serial_hs_platform_data msm_uart_dm8_pdata = {
2525 .gpio_config = configure_gsbi8_uart_gpios,
2526};
Mayank Ranae009c922012-03-22 03:02:06 +05302527#else
Mayank Rana1f02d952012-07-04 19:11:20 +05302528static struct msm_serial_hs_platform_data msm_uart_dm8_pdata;
Mayank Ranae009c922012-03-22 03:02:06 +05302529static struct msm_serial_hs_platform_data msm_uart_dm9_pdata;
2530#endif
David Collins26f05562011-06-20 09:56:28 -07002531
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302532#if defined(CONFIG_BT) && defined(CONFIG_BT_HCIUART_ATH3K)
Ming-yi Lin9baad172012-10-17 11:50:15 +08002533enum WLANBT_STATUS {
2534 WLANOFF_BTOFF = 1,
2535 WLANOFF_BTON,
2536 WLANON_BTOFF,
2537 WLANON_BTON
2538};
2539
2540static DEFINE_MUTEX(ath_wlanbt_mutex);
2541static int gpio_wlan_sys_rest_en = 26;
2542static int ath_wlanbt_status = WLANOFF_BTOFF;
2543
2544static int ath6kl_power_control(int on)
2545{
2546 int rc;
2547
2548 if (on) {
2549 rc = gpio_request(gpio_wlan_sys_rest_en, "wlan sys_rst_n");
2550 if (rc) {
2551 pr_err("%s: unable to request gpio %d (%d)\n",
2552 __func__, gpio_wlan_sys_rest_en, rc);
2553 return rc;
2554 }
2555 rc = gpio_direction_output(gpio_wlan_sys_rest_en, 0);
2556 msleep(200);
2557 rc = gpio_direction_output(gpio_wlan_sys_rest_en, 1);
2558 msleep(100);
2559 } else {
2560 gpio_set_value(gpio_wlan_sys_rest_en, 0);
2561 rc = gpio_direction_input(gpio_wlan_sys_rest_en);
2562 msleep(100);
2563 gpio_free(gpio_wlan_sys_rest_en);
2564 }
2565 return 0;
2566};
2567
2568static int ath6kl_wlan_power(int on)
2569{
2570 int ret = 0;
2571
2572 mutex_lock(&ath_wlanbt_mutex);
2573 if (on) {
2574 if (ath_wlanbt_status == WLANOFF_BTOFF) {
2575 ret = ath6kl_power_control(1);
2576 ath_wlanbt_status = WLANON_BTOFF;
2577 } else if (ath_wlanbt_status == WLANOFF_BTON)
2578 ath_wlanbt_status = WLANON_BTON;
2579 } else {
2580 if (ath_wlanbt_status == WLANON_BTOFF) {
2581 ret = ath6kl_power_control(0);
2582 ath_wlanbt_status = WLANOFF_BTOFF;
2583 } else if (ath_wlanbt_status == WLANON_BTON)
2584 ath_wlanbt_status = WLANOFF_BTON;
2585 }
2586 mutex_unlock(&ath_wlanbt_mutex);
2587 pr_debug("%s on= %d, wlan_status= %d\n",
2588 __func__, on, ath_wlanbt_status);
2589 return ret;
2590};
2591
2592static struct wifi_platform_data ath6kl_wifi_control = {
2593 .set_power = ath6kl_wlan_power,
2594};
2595
2596static struct platform_device msm_wlan_power_device = {
2597 .name = "ath6kl_power",
2598 .dev = {
2599 .platform_data = &ath6kl_wifi_control,
2600 },
2601};
2602
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302603static struct resource bluesleep_resources[] = {
2604 {
2605 .name = "gpio_host_wake",
2606 .start = 27,
2607 .end = 27,
2608 .flags = IORESOURCE_IO,
2609 },
2610 {
2611 .name = "gpio_ext_wake",
2612 .start = 29,
2613 .end = 29,
2614 .flags = IORESOURCE_IO,
2615 },
2616 {
2617 .name = "host_wake",
2618 .start = MSM_GPIO_TO_INT(27),
2619 .end = MSM_GPIO_TO_INT(27),
2620 .flags = IORESOURCE_IRQ,
2621 },
2622};
2623
2624static struct platform_device msm_bluesleep_device = {
2625 .name = "bluesleep",
2626 .id = -1,
2627 .num_resources = ARRAY_SIZE(bluesleep_resources),
2628 .resource = bluesleep_resources,
2629};
2630
2631static struct platform_device msm_bt_power_device = {
2632 .name = "bt_power",
2633};
2634
Ming-yi Lin9baad172012-10-17 11:50:15 +08002635static int gpio_bt_sys_rest_en = 28;
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302636
2637static int bluetooth_power(int on)
2638{
2639 int rc;
2640
Ming-yi Lin9baad172012-10-17 11:50:15 +08002641 mutex_lock(&ath_wlanbt_mutex);
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302642 if (on) {
Ming-yi Lin9baad172012-10-17 11:50:15 +08002643 if (ath_wlanbt_status == WLANOFF_BTOFF) {
2644 ath6kl_power_control(1);
2645 ath_wlanbt_status = WLANOFF_BTON;
2646 } else if (ath_wlanbt_status == WLANON_BTOFF)
2647 ath_wlanbt_status = WLANON_BTON;
2648
Ram Mohan Korukondac4cfb692012-08-18 22:24:03 +05302649 rc = gpio_request(gpio_bt_sys_rest_en, "bt sys_rst_n");
2650 if (rc) {
2651 pr_err("%s: unable to request gpio %d (%d)\n",
2652 __func__, gpio_bt_sys_rest_en, rc);
Ming-yi Lin9baad172012-10-17 11:50:15 +08002653 mutex_unlock(&ath_wlanbt_mutex);
2654 return rc;
Ram Mohan Korukondac4cfb692012-08-18 22:24:03 +05302655 }
2656 rc = gpio_direction_output(gpio_bt_sys_rest_en, 0);
Ming-yi Lin9baad172012-10-17 11:50:15 +08002657 msleep(20);
2658 rc = gpio_direction_output(gpio_bt_sys_rest_en, 1);
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302659 msleep(100);
2660 } else {
2661 gpio_set_value(gpio_bt_sys_rest_en, 0);
2662 rc = gpio_direction_input(gpio_bt_sys_rest_en);
2663 msleep(100);
Ming-yi Lin9baad172012-10-17 11:50:15 +08002664 gpio_free(gpio_bt_sys_rest_en);
Ram Mohan Korukondac4cfb692012-08-18 22:24:03 +05302665
Ming-yi Lin9baad172012-10-17 11:50:15 +08002666 if (ath_wlanbt_status == WLANOFF_BTON) {
2667 ath6kl_power_control(0);
2668 ath_wlanbt_status = WLANOFF_BTOFF;
2669 } else if (ath_wlanbt_status == WLANON_BTON)
2670 ath_wlanbt_status = WLANON_BTOFF;
2671 }
2672 mutex_unlock(&ath_wlanbt_mutex);
2673 pr_debug("%s on= %d, wlan_status= %d\n",
2674 __func__, on, ath_wlanbt_status);
2675 return 0;
2676};
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302677
2678static void __init bt_power_init(void)
2679{
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302680 msm_bt_power_device.dev.platform_data = &bluetooth_power;
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302681 return;
Ming-yi Lin9baad172012-10-17 11:50:15 +08002682};
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302683#else
2684#define bt_power_init(x) do {} while (0)
2685#endif
2686
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002687static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07002688 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002689 &msm_device_smd,
Mayank Rana9f51f582011-08-04 18:35:59 +05302690 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002691 &msm_device_saw_core0,
2692 &msm_device_saw_core1,
2693 &msm8960_device_ext_5v_vreg,
David Collins87579612012-01-30 16:00:15 -08002694 &msm8960_device_ssbi_pmic,
David Collins96aa3e12012-02-29 10:31:34 -08002695 &msm8960_device_ext_otg_sw_vreg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002696 &msm8960_device_qup_spi_gsbi1,
2697 &msm8960_device_qup_i2c_gsbi3,
2698 &msm8960_device_qup_i2c_gsbi4,
2699 &msm8960_device_qup_i2c_gsbi10,
2700#ifndef CONFIG_MSM_DSPS
2701 &msm8960_device_qup_i2c_gsbi12,
2702#endif
2703 &msm_slim_ctrl,
2704 &msm_device_wcnss_wlan,
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302705#if defined(CONFIG_BT) && defined(CONFIG_BT_HCIUART_ATH3K)
2706 &msm_bluesleep_device,
2707 &msm_bt_power_device,
Ming-yi Lin9baad172012-10-17 11:50:15 +08002708 &msm_wlan_power_device,
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302709#endif
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002710#if defined(CONFIG_QSEECOM)
2711 &qseecom_device,
2712#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002713#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2714 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2715 &qcrypto_device,
2716#endif
2717
2718#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2719 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2720 &qcedev_device,
2721#endif
2722#ifdef CONFIG_MSM_ROTATOR
2723 &msm_rotator_device,
2724#endif
2725 &msm_device_sps,
2726#ifdef CONFIG_MSM_FAKE_BATTERY
2727 &fish_battery_device,
2728#endif
Binqiang Qiuf165c922012-08-15 18:00:18 -07002729#ifdef CONFIG_BATTERY_BCL
2730 &battery_bcl_device,
2731#endif
Laura Abbottb93525f2012-04-12 09:57:19 -07002732 &msm8960_fmem_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002733 &msm_device_bam_dmux,
2734 &msm_fm_platform_init,
Joel Nidera1261942011-09-12 16:30:09 +03002735#if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE)
2736#ifdef CONFIG_MSM_USE_TSIF1
2737 &msm_device_tsif[1],
2738#else
2739 &msm_device_tsif[0],
2740#endif
2741#endif
Joel Nider266a2642011-10-16 10:58:05 +02002742 &msm_device_tspp,
Mona Hossain9c430e32011-07-27 11:04:47 -07002743#ifdef CONFIG_HW_RANDOM_MSM
2744 &msm_device_rng,
2745#endif
Laura Abbottd6183792011-08-19 13:42:24 -07002746#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002747 &msm8960_ion_dev,
Laura Abbottd6183792011-08-19 13:42:24 -07002748#endif
Praveen Chidambaram78499012011-11-01 17:15:17 -06002749 &msm8960_rpm_device,
2750 &msm8960_rpm_log_device,
2751 &msm8960_rpm_stat_device,
Anji Jonnala93129922012-10-09 20:57:53 +05302752 &msm8960_rpm_master_stat_device,
Mona Hossain11c03ac2011-10-26 12:42:10 -07002753 &msm_device_tz_log,
Pratik Patel3b0ca882012-06-01 16:54:14 -07002754 &coresight_tpiu_device,
2755 &coresight_etb_device,
2756 &coresight_funnel_device,
2757 &coresight_etm0_device,
2758 &coresight_etm1_device,
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07002759 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002760 &msm8960_device_watchdog,
Laura Abbottb93525f2012-04-12 09:57:19 -07002761 &msm8960_rtb_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002762 &msm8960_device_cache_erp,
Stepan Moskovchenkoc0557252012-06-07 17:39:14 -07002763 &msm8960_device_ebi1_ch0_erp,
2764 &msm8960_device_ebi1_ch1_erp,
Laura Abbottb93525f2012-04-12 09:57:19 -07002765 &msm8960_cache_dump_device,
Laura Abbott0577d7b2012-04-17 11:14:30 -07002766 &msm8960_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002767 &msm_tsens_device,
Anji Jonnalaf91d8972013-02-26 17:55:50 +05302768 &msm8960_cpu_slp_status,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002769};
2770
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002771static struct platform_device *cdp_devices[] __initdata = {
Stephen Boydeb819882011-08-29 14:46:30 -07002772 &msm_8960_q6_lpass,
Stephen Boyd322a9922011-09-20 01:05:54 -07002773 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07002774 &msm_pil_tzapps,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07002775 &msm_pil_dsps,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002776 &msm_pil_vidc,
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002777 &msm8960_device_otg,
2778 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002779 &msm_device_hsusb_host,
2780 &android_usb_device,
2781 &msm_pcm,
Kiran Kandi5e809b02012-01-31 00:24:33 -08002782 &msm_multi_ch_pcm,
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -07002783 &msm_lowlatency_pcm,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002784 &msm_pcm_routing,
2785 &msm_cpudai0,
2786 &msm_cpudai1,
Kiran Kandi97fe19d2012-05-20 22:34:04 -07002787 &msm8960_cpudai_slimbus_2_rx,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002788 &msm8960_cpudai_slimbus_2_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002789 &msm_cpudai_hdmi_rx,
2790 &msm_cpudai_bt_rx,
2791 &msm_cpudai_bt_tx,
2792 &msm_cpudai_fm_rx,
2793 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002794 &msm_cpudai_auxpcm_rx,
2795 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002796 &msm_cpu_fe,
2797 &msm_stub_codec,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002798#ifdef CONFIG_MSM_GEMINI
2799 &msm8960_gemini_device,
2800#endif
Kalyani Oruganti465d1e12012-05-15 10:23:05 -07002801#ifdef CONFIG_MSM_MERCURY
2802 &msm8960_mercury_device,
2803#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002804 &msm_voice,
2805 &msm_voip,
2806 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05302807 &msm_cpudai_afe_01_rx,
2808 &msm_cpudai_afe_01_tx,
2809 &msm_cpudai_afe_02_rx,
2810 &msm_cpudai_afe_02_tx,
2811 &msm_pcm_afe,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05302812 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07002813 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07002814 &msm_cpudai_incall_record_rx,
2815 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002816 &msm_pcm_hostless,
2817 &msm_bus_apps_fabric,
2818 &msm_bus_sys_fabric,
2819 &msm_bus_mm_fabric,
2820 &msm_bus_sys_fpb,
2821 &msm_bus_cpss_fpb,
2822};
2823
2824static void __init msm8960_i2c_init(void)
2825{
Kiran Gundaaf3b3562012-08-31 14:00:05 +05302826 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
2827 msm8960_i2c_qup_gsbi4_pdata.keep_ahb_clk_on = 1;
2828
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002829 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2830 &msm8960_i2c_qup_gsbi4_pdata;
2831
2832 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2833 &msm8960_i2c_qup_gsbi3_pdata;
2834
2835 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2836 &msm8960_i2c_qup_gsbi10_pdata;
2837
2838 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2839 &msm8960_i2c_qup_gsbi12_pdata;
2840}
2841
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002842static void __init msm8960_gfx_init(void)
2843{
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002844 struct kgsl_device_platform_data *kgsl_3d0_pdata =
2845 msm_kgsl_3d0.dev.platform_data;
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06002846 uint32_t soc_platform_version = socinfo_get_version();
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002847
Carter Coopera4a7ed22012-08-20 22:11:42 -06002848 /* Fixup data that needs to change based on GPU ID */
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002849 if (cpu_is_msm8960ab()) {
Hareesh Gunduec2f1d82013-02-20 20:16:11 +05302850 if (SOCINFO_VERSION_MINOR(soc_platform_version) == 0)
2851 kgsl_3d0_pdata->chipid = ADRENO_CHIPID(3, 2, 1, 0);
2852 else
2853 kgsl_3d0_pdata->chipid = ADRENO_CHIPID(3, 2, 1, 1);
Suman Tatiraju03a95db2012-10-29 18:24:53 -07002854 /* 8960PRO nominal clock rate is 320Mhz */
2855 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 320000000;
Lucille Sylvester0a82ff22012-12-06 14:10:19 -07002856#ifdef CONFIG_MSM_BUS_SCALING
2857 kgsl_3d0_pdata->bus_scale_table = &grp3d_bus_scale_pdata_ab;
2858#endif
Harsh Vardhan Dwivedi623b9a22012-10-28 20:54:17 -06002859
2860 /*
2861 * If this an A320 GPU device (MSM8960AB), then
2862 * switch the resource table to 8960AB, to reflect the
2863 * separate register and shader memory mapping used in A320.
2864 */
2865
2866 msm_kgsl_3d0.num_resources = kgsl_num_resources_8960ab;
2867 msm_kgsl_3d0.resource = kgsl_3d0_resources_8960ab;
Carter Coopera4a7ed22012-08-20 22:11:42 -06002868 } else {
2869 kgsl_3d0_pdata->iommu_count = 1;
Harsh Vardhan Dwivedi623b9a22012-10-28 20:54:17 -06002870
Carter Coopera4a7ed22012-08-20 22:11:42 -06002871 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
2872 kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
2873 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
2874 }
2875 if (SOCINFO_VERSION_MAJOR(soc_platform_version) >= 3) {
2876 /* 8960v3 GPU registers returns 5 for patch release
2877 * but it should be 6, so dummy up the chipid here
2878 * based the platform type
2879 */
2880 kgsl_3d0_pdata->chipid = ADRENO_CHIPID(2, 2, 0, 6);
2881 }
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002882 }
Carter Cooper83e9dab2012-08-20 15:17:23 -06002883
2884 /* Register the 3D core */
2885 platform_device_register(&msm_kgsl_3d0);
2886
2887 /* Register the 2D cores if we are not 8960PRO */
2888 if (!cpu_is_msm8960ab()) {
2889 platform_device_register(&msm_kgsl_2d0);
2890 platform_device_register(&msm_kgsl_2d1);
2891 }
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002892}
2893
Subhash Jadavani933e6a62011-12-26 18:05:04 +05302894static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002895 {
2896 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2897 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2898 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002899 1, 784, 180000, 100,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002900 },
2901
2902 {
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002903 MSM_PM_SLEEP_MODE_RETENTION,
2904 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2905 true,
2906 415, 715, 340827, 475,
2907 },
2908
2909 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002910 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2911 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2912 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002913 1300, 228, 1200000, 2000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002914 },
2915
2916 {
2917 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2918 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2919 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002920 2000, 138, 1208400, 3200,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002921 },
2922
2923 {
2924 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06002925 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2926 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002927 6000, 119, 1850300, 9000,
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06002928 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002929
2930 {
2931 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2932 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2933 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002934 9200, 68, 2839200, 16400,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002935 },
2936
2937 {
2938 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2939 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2940 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002941 10300, 63, 3128000, 18200,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002942 },
2943
2944 {
2945 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2946 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2947 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002948 18000, 10, 4602600, 27000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002949 },
2950
2951 {
2952 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2953 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2954 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002955 20000, 2, 5752000, 32000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002956 },
2957};
2958
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002959
Praveen Chidambaram78499012011-11-01 17:15:17 -06002960static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2961 .levels = &msm_rpmrs_levels[0],
2962 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2963 .vdd_mem_levels = {
2964 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2965 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2966 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2967 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2968 },
2969 .vdd_dig_levels = {
2970 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
2971 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
2972 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
2973 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
2974 },
2975 .vdd_mask = 0x7FFFFF,
2976 .rpmrs_target_id = {
2977 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2978 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
2979 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
2980 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
2981 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
2982 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
2983 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2984 },
2985};
2986
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002987static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2988 .mode = MSM_PM_BOOT_CONFIG_TZ,
2989};
2990
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002991#ifdef CONFIG_I2C
2992#define I2C_SURF 1
2993#define I2C_FFA (1 << 1)
2994#define I2C_RUMI (1 << 2)
2995#define I2C_SIM (1 << 3)
2996#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03002997#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002998
2999struct i2c_registry {
3000 u8 machs;
3001 int bus;
3002 struct i2c_board_info *info;
3003 int len;
3004};
3005
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003006/* Sensors DSPS platform data */
3007#ifdef CONFIG_MSM_DSPS
3008#define DSPS_PIL_GENERIC_NAME "dsps"
3009#endif /* CONFIG_MSM_DSPS */
3010
3011static void __init msm8960_init_dsps(void)
3012{
3013#ifdef CONFIG_MSM_DSPS
3014 struct msm_dsps_platform_data *pdata =
3015 msm_dsps_device.dev.platform_data;
3016 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
3017 pdata->gpios = NULL;
3018 pdata->gpios_num = 0;
3019
3020 platform_device_register(&msm_dsps_device);
3021#endif /* CONFIG_MSM_DSPS */
3022}
3023
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -08003024static int hsic_peripheral_status = 1;
3025static DEFINE_MUTEX(hsic_status_lock);
3026
3027void peripheral_connect()
3028{
3029 mutex_lock(&hsic_status_lock);
3030 if (hsic_peripheral_status)
3031 goto out;
3032 platform_device_add(&msm_device_hsic_host);
3033 hsic_peripheral_status = 1;
3034out:
3035 mutex_unlock(&hsic_status_lock);
3036}
3037EXPORT_SYMBOL(peripheral_connect);
3038
3039void peripheral_disconnect()
3040{
3041 mutex_lock(&hsic_status_lock);
3042 if (!hsic_peripheral_status)
3043 goto out;
3044 platform_device_del(&msm_device_hsic_host);
3045 hsic_peripheral_status = 0;
3046out:
3047 mutex_unlock(&hsic_status_lock);
3048}
3049EXPORT_SYMBOL(peripheral_disconnect);
3050
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303051static void __init msm8960_init_smsc_hub(void)
3052{
3053 uint32_t version = socinfo_get_version();
3054
3055 if (SOCINFO_VERSION_MAJOR(version) == 1)
3056 return;
3057
3058 if (machine_is_msm8960_liquid())
3059 platform_device_register(&smsc_hub_device);
3060}
3061
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003062static void __init msm8960_init_hsic(void)
3063{
3064#ifdef CONFIG_USB_EHCI_MSM_HSIC
3065 uint32_t version = socinfo_get_version();
3066
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08003067 if (SOCINFO_VERSION_MAJOR(version) == 1)
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003068 return;
3069
Joel King0cbf5d82012-05-24 15:21:38 -07003070 if (machine_is_msm8960_liquid())
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08003071 platform_device_register(&msm_device_hsic_host);
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003072#endif
3073}
3074
Amir Samuelov5137e392011-09-21 17:31:25 +03003075#ifdef CONFIG_ISL9519_CHARGER
3076static struct isl_platform_data isl_data __initdata = {
3077 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
3078 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
3079 .max_system_voltage = 4200,
3080 .min_system_voltage = 3200,
Amir Samuelov95f49ff2012-01-29 09:14:08 +02003081 .chgcurrent = 1900,
3082 .term_current = 0,
Amir Samuelov5137e392011-09-21 17:31:25 +03003083 .input_current = 2048,
3084};
3085
3086static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
3087 {
3088 I2C_BOARD_INFO("isl9519q", 0x9),
3089 .irq = 0, /* Not required when notify-by-pmic */
3090 .platform_data = &isl_data,
3091 },
3092};
3093#endif /* CONFIG_ISL9519_CHARGER */
3094
Amir Samuelov755616d2011-12-13 16:34:46 +02003095static struct i2c_board_info liquid_io_expander_i2c_info[] __initdata = {
3096 {
3097 I2C_BOARD_INFO("sx1508q", 0x20),
3098 .platform_data = &msm8960_sx150x_data[SX150X_LIQUID]
3099 },
3100};
3101
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003102static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Amir Samuelov5137e392011-09-21 17:31:25 +03003103#ifdef CONFIG_ISL9519_CHARGER
3104 {
3105 I2C_LIQUID,
3106 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
3107 isl_charger_i2c_info,
3108 ARRAY_SIZE(isl_charger_i2c_info),
3109 },
3110#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003111 {
3112 I2C_SURF | I2C_FFA | I2C_FLUID,
3113 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3114 cyttsp_info,
3115 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07003116 },
Mohan Pallaka50837382011-09-07 11:00:57 +05303117 {
3118 I2C_LIQUID,
3119 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3120 mxt_device_info,
3121 ARRAY_SIZE(mxt_device_info),
3122 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05303123 {
Manoj Rao14648742012-03-30 19:42:12 -07003124 I2C_SURF | I2C_FFA | I2C_LIQUID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05303125 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Eugene Yasmand2316b82011-12-07 18:23:48 +02003126 sii_device_info,
3127 ARRAY_SIZE(sii_device_info),
3128 },
3129 {
Anirudh Ghayal15698162012-07-31 11:51:32 +05303130 I2C_LIQUID | I2C_FFA,
Eugene Yasmand2316b82011-12-07 18:23:48 +02003131 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05303132 msm_isa1200_board_info,
3133 ARRAY_SIZE(msm_isa1200_board_info),
3134 },
Amir Samuelov755616d2011-12-13 16:34:46 +02003135 {
3136 I2C_LIQUID,
3137 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
3138 liquid_io_expander_i2c_info,
3139 ARRAY_SIZE(liquid_io_expander_i2c_info),
3140 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003141};
3142#endif /* CONFIG_I2C */
3143
3144static void __init register_i2c_devices(void)
3145{
3146#ifdef CONFIG_I2C
3147 u8 mach_mask = 0;
3148 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08003149#ifdef CONFIG_MSM_CAMERA
3150 struct i2c_registry msm8960_camera_i2c_devices = {
3151 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
3152 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
3153 msm8960_camera_board_info.board_info,
3154 msm8960_camera_board_info.num_i2c_board_info,
3155 };
3156#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003157
3158 /* Build the matching 'supported_machs' bitmask */
3159 if (machine_is_msm8960_cdp())
3160 mach_mask = I2C_SURF;
Amy Maloche2d028032011-07-20 14:08:06 -07003161 else if (machine_is_msm8960_fluid())
3162 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03003163 else if (machine_is_msm8960_liquid())
3164 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07003165 else if (machine_is_msm8960_mtp())
3166 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003167 else
3168 pr_err("unmatched machine ID in register_i2c_devices\n");
3169
Jing Lineec88ca2012-02-08 11:18:30 -08003170 if (machine_is_msm8960_liquid()) {
3171 if (SOCINFO_VERSION_MAJOR(socinfo_get_platform_version()) == 3)
3172 mxt_device_info[0].platform_data =
3173 &mxt_platform_data_3d;
3174 else
3175 mxt_device_info[0].platform_data =
3176 &mxt_platform_data_2d;
3177 }
3178
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003179 /* Run the array and install devices as appropriate */
3180 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
3181 if (msm8960_i2c_devices[i].machs & mach_mask)
3182 i2c_register_board_info(msm8960_i2c_devices[i].bus,
3183 msm8960_i2c_devices[i].info,
3184 msm8960_i2c_devices[i].len);
3185 }
Manoj Raoc6d904c2012-06-22 00:32:14 -07003186
3187 if (!mhl_platform_data.gpio_mhl_power)
3188 pr_debug("mhl device configured for ext debug board\n");
3189
Kevin Chan09f4e662011-12-16 08:17:02 -08003190#ifdef CONFIG_MSM_CAMERA
3191 if (msm8960_camera_i2c_devices.machs & mach_mask)
3192 i2c_register_board_info(msm8960_camera_i2c_devices.bus,
3193 msm8960_camera_i2c_devices.info,
3194 msm8960_camera_i2c_devices.len);
3195#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003196#endif
3197}
3198
Siddartha Mohanadoss30447fe2012-09-26 09:42:32 -07003199static void __init msm8960_tsens_init(void)
3200{
3201 if (cpu_is_msm8960())
3202 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) == 1)
3203 return;
3204
3205 msm_tsens_early_init(&msm_tsens_pdata);
3206}
3207
Praveen Chidambaramc3c90822012-11-07 15:43:49 -07003208static void __init msm8960ab_update_krait_spm(void)
Mahesh Sivasubramanianc5c82f42012-10-22 13:33:59 -06003209{
3210 int i;
3211
Praveen Chidambaramc3c90822012-11-07 15:43:49 -07003212 /* Update the SPM sequences for SPC and PC */
3213 for (i = 0; i < ARRAY_SIZE(msm_spm_data); i++) {
3214 int j;
3215 struct msm_spm_platform_data *pdata = &msm_spm_data[i];
3216 for (j = 0; j < pdata->num_modes; j++) {
3217 if (pdata->modes[j].cmd ==
3218 spm_power_collapse_without_rpm)
3219 pdata->modes[j].cmd =
3220 spm_power_collapse_without_rpm_krait_v3;
3221 else if (pdata->modes[j].cmd ==
3222 spm_power_collapse_with_rpm)
3223 pdata->modes[j].cmd =
3224 spm_power_collapse_with_rpm_krait_v3;
3225 }
3226 }
Mahesh Sivasubramanianc5c82f42012-10-22 13:33:59 -06003227}
3228
Anji Jonnala1a1711a2013-01-29 13:34:10 +05303229static void __init msm8960ab_update_retention_spm(void)
3230{
3231 int i;
3232
3233 /* Update the SPM sequences for krait retention on all cores */
3234 for (i = 0; i < ARRAY_SIZE(msm_spm_data); i++) {
3235 int j;
3236 struct msm_spm_platform_data *pdata = &msm_spm_data[i];
3237 for (j = 0; j < pdata->num_modes; j++) {
3238 if (pdata->modes[j].cmd ==
3239 spm_retention_cmd_sequence)
3240 pdata->modes[j].cmd =
3241 spm_retention_with_krait_v3_cmd_sequence;
3242 }
3243 }
3244}
3245
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003246static void __init msm8960_cdp_init(void)
3247{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07003248 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
3249 pr_err("meminfo_init() failed!\n");
3250
Rohit Vaswanib1cc4932012-07-23 21:30:11 -07003251 platform_device_register(&msm_gpio_device);
Siddartha Mohanadoss30447fe2012-09-26 09:42:32 -07003252 msm8960_tsens_init();
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06003253 msm_thermal_init(&msm_thermal_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06003254 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
3255 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07003256
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003257 regulator_suppress_info_printing();
3258 if (msm_xo_init())
3259 pr_err("Failed to initialize XO votes\n");
David Collinse68647e2012-09-04 15:44:19 -07003260 configure_msm8960_power_grid();
David Collins26f05562011-06-20 09:56:28 -07003261 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07003262 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05303263 if (machine_is_msm8960_liquid())
3264 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003265 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05303266 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
3267 machine_is_msm8960_cdp()) {
Mayank Ranaa61da7a2012-08-14 10:57:00 +05303268 /* Due to availability of USB Switch in SGLTE Platform
3269 * it requires different HSUSB PHY settings compare to
3270 * 8960 MTP/CDP platform.
3271 */
3272 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
3273 msm_otg_pdata.phy_init_seq = sglte_phy_init_seq;
3274 else
3275 msm_otg_pdata.phy_init_seq = wr_phy_init_seq;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05303276 } else if (machine_is_msm8960_liquid()) {
3277 msm_otg_pdata.phy_init_seq =
3278 liquid_v1_phy_init_seq;
3279 }
Ofir Cohen94213a72012-05-03 14:26:32 +03003280 android_usb_pdata.swfi_latency =
Anji jonnalaa7c1c5c2011-12-12 12:20:36 +05303281 msm_rpmrs_levels[0].latency_us;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303282 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303283 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2 &&
3284 machine_is_msm8960_liquid())
3285 msm_device_hsic_host.dev.parent = &smsc_hub_device.dev;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08003286 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003287 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3288 &msm8960_qup_spi_gsbi1_pdata;
3289 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Anirudh Ghayal50137fb2012-07-31 16:58:53 +05303290 if (socinfo_get_platform_subtype() != PLATFORM_SUBTYPE_SGLTE)
3291 spi_register_board_info(spi_eth_info, ARRAY_SIZE(spi_eth_info));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003292
3293 msm8960_init_pmic();
Anirudh Ghayal15698162012-07-31 11:51:32 +05303294 if (machine_is_msm8960_liquid() || (machine_is_msm8960_mtp() &&
Shantanu Jainae54a622012-12-03 15:09:39 +05303295 (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE ||
3296 cpu_is_msm8960ab())))
Mohan Pallakaf69f0492011-11-21 13:08:33 +05303297 msm_isa1200_board_info[0].platform_data = &isa1200_1_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003298 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003299 msm8960_gfx_init();
Mahesh Sivasubramanianc5c82f42012-10-22 13:33:59 -06003300
3301 if (cpu_is_msm8960ab())
Praveen Chidambaramc3c90822012-11-07 15:43:49 -07003302 msm8960ab_update_krait_spm();
Anji Jonnala1a1711a2013-01-29 13:34:10 +05303303 if (cpu_is_krait_v3()) {
Praveen Chidambaramf27a5152013-02-01 11:44:53 -07003304 struct msm_pm_init_data_type *pdata =
3305 msm8960_pm_8x60.dev.platform_data;
3306 pdata->retention_calls_tz = false;
Anji Jonnala1a1711a2013-01-29 13:34:10 +05303307 msm8960ab_update_retention_spm();
Anji Jonnala1a1711a2013-01-29 13:34:10 +05303308 }
Praveen Chidambaramf27a5152013-02-01 11:44:53 -07003309 platform_device_register(&msm8960_pm_8x60);
3310
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003311 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3312 msm_spm_l2_init(msm_spm_l2_data);
Mahesh Sivasubramanianc5c82f42012-10-22 13:33:59 -06003313
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003314 msm8960_init_buses();
Stephen Boyd913c29d2012-10-25 11:46:04 -07003315 if (cpu_is_msm8960ab()) {
3316 platform_add_devices(msm8960ab_footswitch,
3317 msm8960ab_num_footswitch);
3318 } else {
3319 platform_add_devices(msm8960_footswitch,
3320 msm8960_num_footswitch);
3321 }
David Collinsb10be1d2011-09-02 10:29:31 -07003322 if (machine_is_msm8960_liquid())
3323 platform_device_register(&msm8960_device_ext_3p3v_vreg);
David Collinsd5a40732011-11-29 15:53:56 -08003324 if (machine_is_msm8960_cdp())
3325 platform_device_register(&msm8960_device_ext_l2_vreg);
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07003326
3327 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
3328 platform_device_register(&msm8960_device_uart_gsbi8);
3329 else
3330 platform_device_register(&msm8960_device_uart_gsbi5);
3331
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003332 /* For 8960 Fusion 2.2 Primary IPC */
Mayank Ranad85a5082012-04-29 17:24:13 -07003333 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE) {
3334 msm_uart_dm9_pdata.wakeup_irq = gpio_to_irq(94); /* GSBI9(2) */
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003335 msm_device_uart_dm9.dev.platform_data = &msm_uart_dm9_pdata;
Mayank Rana77f83c22012-07-10 09:31:02 +05303336 platform_device_register(&msm_device_uart_dm9);
Mayank Ranad85a5082012-04-29 17:24:13 -07003337 }
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003338
Mayank Rana1f02d952012-07-04 19:11:20 +05303339 /* For 8960 Standalone External Bluetooth Interface */
3340 if (socinfo_get_platform_subtype() != PLATFORM_SUBTYPE_SGLTE) {
3341 msm_device_uart_dm8.dev.platform_data = &msm_uart_dm8_pdata;
3342 platform_device_register(&msm_device_uart_dm8);
3343 }
Patrick Daly6578e0c2012-07-19 18:50:02 -07003344 if (cpu_is_msm8960ab())
3345 platform_device_register(&msm8960ab_device_acpuclk);
3346 else
3347 platform_device_register(&msm8960_device_acpuclk);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003348 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Arun Menon697e91b2012-08-20 15:25:50 -07003349 msm8960_add_vidc_device();
Patrick Daly6578e0c2012-07-19 18:50:02 -07003350
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003351 msm8960_pm8921_gpio_mpp_init();
Stephen Boyded035682012-09-13 12:41:31 -07003352 /* Don't add modem devices on APQ targets */
Stephen Boydbdb53f32012-06-05 18:39:47 -07003353 if (socinfo_get_id() != 124)
3354 platform_device_register(&msm_8960_q6_mss);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003355 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303356 msm8960_init_smsc_hub();
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003357 msm8960_init_hsic();
Steve Mucklef132c6c2012-06-06 18:30:57 -07003358#ifdef CONFIG_MSM_CAMERA
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003359 msm8960_init_cam();
Steve Mucklef132c6c2012-06-06 18:30:57 -07003360#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003361 msm8960_init_mmc();
Mohan Pallaka50837382011-09-07 11:00:57 +05303362 if (machine_is_msm8960_liquid())
3363 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003364 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08003365 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003366 slim_register_board_info(msm_slim_devices,
3367 ARRAY_SIZE(msm_slim_devices));
3368 msm8960_init_dsps();
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06003369 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05303370 bt_power_init();
Joel King0cbf5d82012-05-24 15:21:38 -07003371 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE) {
3372 mdm_sglte_device.dev.platform_data = &sglte_platform_data;
3373 platform_device_register(&mdm_sglte_device);
3374 }
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003375}
3376
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003377MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
3378 .map_io = msm8960_map_io,
3379 .reserve = msm8960_reserve,
3380 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303381 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003382 .timer = &msm_timer,
3383 .init_machine = msm8960_cdp_init,
3384 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003385 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003386 .restart = msm_restart,
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -08003387 .smp = &msm8960_smp_ops,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003388MACHINE_END
3389
3390MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
3391 .map_io = msm8960_map_io,
3392 .reserve = msm8960_reserve,
3393 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303394 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003395 .timer = &msm_timer,
3396 .init_machine = msm8960_cdp_init,
3397 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003398 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003399 .restart = msm_restart,
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -08003400 .smp = &msm8960_smp_ops,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003401MACHINE_END
3402
3403MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
3404 .map_io = msm8960_map_io,
3405 .reserve = msm8960_reserve,
3406 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303407 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003408 .timer = &msm_timer,
3409 .init_machine = msm8960_cdp_init,
3410 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003411 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003412 .restart = msm_restart,
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -08003413 .smp = &msm8960_smp_ops,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003414MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003415
3416MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
3417 .map_io = msm8960_map_io,
3418 .reserve = msm8960_reserve,
3419 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303420 .handle_irq = gic_handle_irq,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003421 .timer = &msm_timer,
3422 .init_machine = msm8960_cdp_init,
3423 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003424 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003425 .restart = msm_restart,
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -08003426 .smp = &msm8960_smp_ops,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003427MACHINE_END