blob: f2347127f66c4dc51a1aaee8c855241cb8d61d79 [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
Eugene Yasman4b1935f2013-08-13 04:08:21 +030078#include <linux/smsc_hub.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
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070090#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080091#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070092#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070093#include "spm.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080094#include "board-8960.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080095#include "pm.h"
Abhijeet Dharmapurikarefaca4f2011-12-27 16:24:07 -080096#include <mach/cpuidle.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070097#include "rpm_resources.h"
Subhash Jadavani909e04f2012-04-12 10:52:50 +053098#include <mach/mpm.h>
Matt Wagantall33d01f52012-02-23 23:27:44 -080099#include "clock.h"
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -0600100#include "pm-boot.h"
Jeff Ohlstein7e668552011-10-06 16:17:25 -0700101#include "msm_watchdog.h"
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -0800102#include "platsmp.h"
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800103
Ming-yi Lin9baad172012-10-17 11:50:15 +0800104#if defined(CONFIG_BT) && defined(CONFIG_BT_HCIUART_ATH3K)
105#include <linux/wlan_plat.h>
106#include <linux/mutex.h>
107#endif
108
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700109static struct platform_device msm_fm_platform_init = {
110 .name = "iris_fm",
111 .id = -1,
112};
113
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700114#define KS8851_RST_GPIO 89
115#define KS8851_IRQ_GPIO 90
Mohan Pallaka5e490392011-09-09 15:18:41 +0530116
Manoj Rao14648742012-03-30 19:42:12 -0700117#define MHL_GPIO_INT 4
118#define MHL_GPIO_RESET 15
119
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700120#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700121
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800122struct sx150x_platform_data msm8960_sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700123 [SX150X_CAM] = {
124 .gpio_base = GPIO_CAM_EXPANDER_BASE,
125 .oscio_is_gpo = false,
126 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530127 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700128 .io_open_drain_ena = 0x0,
129 .irq_summary = -1,
130 },
Amir Samuelov755616d2011-12-13 16:34:46 +0200131 [SX150X_LIQUID] = {
132 .gpio_base = GPIO_LIQUID_EXPANDER_BASE,
133 .oscio_is_gpo = false,
134 .io_pullup_ena = 0x0c08,
135 .io_pulldn_ena = 0x4060,
136 .io_open_drain_ena = 0x000c,
137 .io_polarity = 0,
138 .irq_summary = -1,
139 },
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700140};
Nishant Pandit474f2252011-07-23 23:17:56 +0530141
142#endif
143
Olav Haugana21169d2012-01-04 09:17:06 -0800144#define MSM_PMEM_ADSP_SIZE 0x7800000
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -0700145#define MSM_PMEM_AUDIO_SIZE 0x4CF000
Mathew Karimpanal15fa5c42011-12-14 21:28:10 -0800146#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800147#define MSM_LIQUID_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800148#define MSM_HDMI_PRIM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Laura Abbott2d1760b2011-09-29 21:31:24 -0700149
150#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Deepak Kotur35825522012-06-06 15:49:14 -0700151#define HOLE_SIZE 0x20000
Rajeshwar Kurapatyc3e190a2012-12-04 19:28:05 +0530152#define MSM_ION_MFC_META_SIZE 0x40000 /* 256 Kbytes */
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700153#define MSM_CONTIG_MEM_SIZE 0x65000
Olav Haugan32594552012-03-13 11:40:05 -0700154#ifdef CONFIG_MSM_IOMMU
Olav Haugan8726caf2012-05-10 15:11:35 -0700155#define MSM_ION_MM_SIZE 0x3800000 /* Need to be multiple of 64K */
Olav Haugan32594552012-03-13 11:40:05 -0700156#define MSM_ION_SF_SIZE 0x0
Olav Hauganfbbf05b2012-04-05 14:33:41 -0700157#define MSM_ION_QSECOM_SIZE 0x780000 /* (7.5MB) */
Laura Abbott98e8ddc2013-02-09 09:35:30 -0800158#define MSM_ION_HEAP_NUM 8
Olav Haugan32594552012-03-13 11:40:05 -0700159#else
160#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
161#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Hauganfbbf05b2012-04-05 14:33:41 -0700162#define MSM_ION_QSECOM_SIZE 0x600000 /* (6MB) */
Olav Haugan32594552012-03-13 11:40:05 -0700163#define MSM_ION_HEAP_NUM 8
164#endif
Deepak Kotur35825522012-06-06 15:49:14 -0700165#define MSM_ION_MM_FW_SIZE (0x200000 - HOLE_SIZE) /* 128kb */
Rajeshwar Kurapatyc3e190a2012-12-04 19:28:05 +0530166#define MSM_ION_MFC_SIZE (SZ_8K + MSM_ION_MFC_META_SIZE)
Olav Haugan7355db02012-01-13 16:59:13 -0800167#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Olav Haugan32594552012-03-13 11:40:05 -0700168
Olav Hauganb5be7992011-11-18 14:29:02 -0800169#define MSM_LIQUID_ION_MM_SIZE (MSM_ION_MM_SIZE + 0x600000)
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800170#define MSM_LIQUID_ION_SF_SIZE MSM_LIQUID_PMEM_SIZE
171#define MSM_HDMI_PRIM_ION_SF_SIZE MSM_HDMI_PRIM_PMEM_SIZE
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700172
Deepak Kotur35825522012-06-06 15:49:14 -0700173#define MSM_MM_FW_SIZE (0x200000 - HOLE_SIZE) /* 2mb -128kb*/
174#define MSM8960_FIXED_AREA_START (0xa0000000 - (MSM_ION_MM_FW_SIZE + \
175 HOLE_SIZE))
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700176#define MAX_FIXED_AREA_SIZE 0x10000000
Deepak Kotur35825522012-06-06 15:49:14 -0700177#define MSM8960_FW_START MSM8960_FIXED_AREA_START
Laura Abbott98e8ddc2013-02-09 09:35:30 -0800178#define MSM_ION_ADSP_SIZE SZ_8M
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700179
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800180static unsigned msm_ion_sf_size = MSM_ION_SF_SIZE;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700181#else
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700182#define MSM_CONTIG_MEM_SIZE 0x110C000
Olav Hauganb5be7992011-11-18 14:29:02 -0800183#define MSM_ION_HEAP_NUM 1
Laura Abbott2d1760b2011-09-29 21:31:24 -0700184#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700185
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700186#ifdef CONFIG_KERNEL_MSM_CONTIG_MEM_REGION
187static unsigned msm_contig_mem_size = MSM_CONTIG_MEM_SIZE;
188static int __init msm_contig_mem_size_setup(char *p)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700189{
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700190 msm_contig_mem_size = memparse(p, NULL);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700191 return 0;
192}
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700193early_param("msm_contig_mem_size", msm_contig_mem_size_setup);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700194#endif
195
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700196#define DSP_RAM_BASE_8960 0x8da00000
197#define DSP_RAM_SIZE_8960 0x1800000
198static int dspcrashd_pdata_8960 = 0xDEADDEAD;
199
200static struct resource resources_dspcrashd_8960[] = {
201 {
202 .name = "msm_dspcrashd",
203 .start = DSP_RAM_BASE_8960,
204 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
205 .flags = IORESOURCE_DMA,
206 },
207};
208
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800209static struct platform_device msm_device_dspcrashd_8960 = {
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700210 .name = "msm_dspcrashd",
211 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
212 .resource = resources_dspcrashd_8960,
213 .dev = { .platform_data = &dspcrashd_pdata_8960 },
214};
215
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700216static struct memtype_reserve msm8960_reserve_table[] __initdata = {
217 [MEMTYPE_SMI] = {
218 },
219 [MEMTYPE_EBI0] = {
220 .flags = MEMTYPE_FLAGS_1M_ALIGN,
221 },
222 [MEMTYPE_EBI1] = {
223 .flags = MEMTYPE_FLAGS_1M_ALIGN,
224 },
225};
226
Laura Abbottf8c03b92012-02-16 14:57:58 -0800227static void __init reserve_rtb_memory(void)
228{
229#if defined(CONFIG_MSM_RTB)
Laura Abbottb93525f2012-04-12 09:57:19 -0700230 msm8960_reserve_table[MEMTYPE_EBI1].size += msm8960_rtb_pdata.size;
Laura Abbottf8c03b92012-02-16 14:57:58 -0800231#endif
232}
233
Laura Abbott938d7502013-04-09 10:44:16 -0700234static int msm8960_paddr_to_memtype(phys_addr_t paddr)
Larry Basselb4126da2011-07-18 14:31:33 -0700235{
236 return MEMTYPE_EBI1;
237}
238
Steve Mucklef132c6c2012-06-06 18:30:57 -0700239#define FMEM_ENABLED 0
Olav Hauganf6dc7742012-02-15 09:11:55 -0800240
Laura Abbottd6183792011-08-19 13:42:24 -0700241#ifdef CONFIG_ION_MSM
Olav Haugan0703dbf2011-12-19 17:53:38 -0800242#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -0700243static struct ion_cp_heap_pdata cp_mm_msm8960_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800244 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugan8726caf2012-05-10 15:11:35 -0700245 .align = SZ_64K,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700246 .fixed_position = FIXED_MIDDLE,
Olav Haugan8726caf2012-05-10 15:11:35 -0700247 .iommu_map_all = 1,
248 .iommu_2x_map_domain = VIDEO_DOMAIN,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800249};
250
Laura Abbottb93525f2012-04-12 09:57:19 -0700251static struct ion_cp_heap_pdata cp_mfc_msm8960_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800252 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugan42ebe712012-01-10 16:30:58 -0800253 .align = PAGE_SIZE,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700254 .fixed_position = FIXED_HIGH,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800255};
256
Laura Abbottb93525f2012-04-12 09:57:19 -0700257static struct ion_co_heap_pdata co_msm8960_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800258 .adjacent_mem_id = INVALID_HEAP_ID,
259 .align = PAGE_SIZE,
260};
261
Laura Abbottb93525f2012-04-12 09:57:19 -0700262static struct ion_co_heap_pdata fw_co_msm8960_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800263 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
264 .align = SZ_128K,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700265 .fixed_position = FIXED_LOW,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800266};
267#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800268
Laura Abbottc0e64032012-08-03 17:32:09 -0700269static u64 msm_dmamask = DMA_BIT_MASK(32);
270
271static struct platform_device ion_mm_heap_device = {
272 .name = "ion-mm-heap-device",
273 .id = -1,
274 .dev = {
275 .dma_mask = &msm_dmamask,
276 .coherent_dma_mask = DMA_BIT_MASK(32),
277 }
278};
279
Laura Abbott98e8ddc2013-02-09 09:35:30 -0800280static struct platform_device ion_adsp_heap_device = {
281 .name = "ion-adsp-heap-device",
282 .id = -1,
283 .dev = {
284 .dma_mask = &msm_dmamask,
285 .coherent_dma_mask = DMA_BIT_MASK(32),
286 }
287};
288
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800289/**
290 * These heaps are listed in the order they will be allocated. Due to
291 * video hardware restrictions and content protection the FW heap has to
292 * be allocated adjacent (below) the MM heap and the MFC heap has to be
293 * allocated after the MM heap to ensure MFC heap is not more than 256MB
294 * away from the base address of the FW heap.
295 * However, the order of FW heap and MM heap doesn't matter since these
296 * two heaps are taken care of by separate code to ensure they are adjacent
297 * to each other.
298 * Don't swap the order unless you know what you are doing!
299 */
Benjamin Gaignard63d81032012-06-25 15:27:30 -0700300struct ion_platform_heap msm8960_heaps[] = {
Laura Abbottd6183792011-08-19 13:42:24 -0700301 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800302 .id = ION_SYSTEM_HEAP_ID,
Laura Abbottd6183792011-08-19 13:42:24 -0700303 .type = ION_HEAP_TYPE_SYSTEM,
Laura Abbottd6183792011-08-19 13:42:24 -0700304 .name = ION_VMALLOC_HEAP_NAME,
305 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700306#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -0700307 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800308 .id = ION_CP_MM_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800309 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800310 .name = ION_MM_HEAP_NAME,
311 .size = MSM_ION_MM_SIZE,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700312 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700313 .extra_data = (void *) &cp_mm_msm8960_ion_pdata,
Laura Abbottc0e64032012-08-03 17:32:09 -0700314 .priv = &ion_mm_heap_device.dev,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700315 },
Laura Abbott8c017362011-09-22 20:59:12 -0700316 {
Olav Haugan42ebe712012-01-10 16:30:58 -0800317 .id = ION_MM_FIRMWARE_HEAP_ID,
318 .type = ION_HEAP_TYPE_CARVEOUT,
319 .name = ION_MM_FIRMWARE_HEAP_NAME,
320 .size = MSM_ION_MM_FW_SIZE,
321 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700322 .extra_data = (void *) &fw_co_msm8960_ion_pdata,
Olav Haugan42ebe712012-01-10 16:30:58 -0800323 },
324 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800325 .id = ION_CP_MFC_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800326 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800327 .name = ION_MFC_HEAP_NAME,
328 .size = MSM_ION_MFC_SIZE,
329 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700330 .extra_data = (void *) &cp_mfc_msm8960_ion_pdata,
Olav Hauganb5be7992011-11-18 14:29:02 -0800331 },
Olav Haugan32594552012-03-13 11:40:05 -0700332#ifndef CONFIG_MSM_IOMMU
Olav Hauganb5be7992011-11-18 14:29:02 -0800333 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800334 .id = ION_SF_HEAP_ID,
335 .type = ION_HEAP_TYPE_CARVEOUT,
336 .name = ION_SF_HEAP_NAME,
337 .size = MSM_ION_SF_SIZE,
338 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700339 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800340 },
Olav Haugan32594552012-03-13 11:40:05 -0700341#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800342 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800343 .id = ION_IOMMU_HEAP_ID,
Laura Abbott8c017362011-09-22 20:59:12 -0700344 .type = ION_HEAP_TYPE_IOMMU,
345 .name = ION_IOMMU_HEAP_NAME,
346 },
Olav Haugan80854eb2012-01-12 12:00:23 -0800347 {
348 .id = ION_QSECOM_HEAP_ID,
349 .type = ION_HEAP_TYPE_CARVEOUT,
350 .name = ION_QSECOM_HEAP_NAME,
351 .size = MSM_ION_QSECOM_SIZE,
352 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700353 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan80854eb2012-01-12 12:00:23 -0800354 },
Olav Haugan7355db02012-01-13 16:59:13 -0800355 {
356 .id = ION_AUDIO_HEAP_ID,
357 .type = ION_HEAP_TYPE_CARVEOUT,
358 .name = ION_AUDIO_HEAP_NAME,
359 .size = MSM_ION_AUDIO_SIZE,
360 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700361 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan7355db02012-01-13 16:59:13 -0800362 },
Laura Abbott98e8ddc2013-02-09 09:35:30 -0800363 {
364 .id = ION_ADSP_HEAP_ID,
365 .type = ION_HEAP_TYPE_DMA,
366 .name = ION_ADSP_HEAP_NAME,
367 .size = MSM_ION_ADSP_SIZE,
368 .memory_type = ION_EBI_TYPE,
369 .extra_data = (void *) &co_msm8960_ion_pdata,
370 .priv = &ion_adsp_heap_device.dev,
371 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700372#endif
Benjamin Gaignard63d81032012-06-25 15:27:30 -0700373};
374
375static struct ion_platform_data msm8960_ion_pdata = {
376 .nr = MSM_ION_HEAP_NUM,
377 .heaps = msm8960_heaps,
Laura Abbottd6183792011-08-19 13:42:24 -0700378};
379
Laura Abbottb93525f2012-04-12 09:57:19 -0700380static struct platform_device msm8960_ion_dev = {
Laura Abbottd6183792011-08-19 13:42:24 -0700381 .name = "ion-msm",
382 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700383 .dev = { .platform_data = &msm8960_ion_pdata },
Laura Abbottd6183792011-08-19 13:42:24 -0700384};
385#endif
386
Olav Haugan65f4bd82011-12-13 11:50:08 -0800387static void __init adjust_mem_for_liquid(void)
Laura Abbottd6183792011-08-19 13:42:24 -0700388{
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800389 unsigned int i;
390
Laura Abbottf3aada42013-03-08 14:44:52 -0800391 if (machine_is_msm8960_liquid())
392 msm_ion_sf_size = MSM_LIQUID_ION_SF_SIZE;
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800393
Laura Abbottf3aada42013-03-08 14:44:52 -0800394 if (msm8960_hdmi_as_primary_selected())
395 msm_ion_sf_size = MSM_HDMI_PRIM_ION_SF_SIZE;
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800396
Laura Abbottf3aada42013-03-08 14:44:52 -0800397 if (machine_is_msm8960_liquid() ||
398 msm8960_hdmi_as_primary_selected()) {
399 for (i = 0; i < msm8960_ion_pdata.nr; i++) {
400 if (msm8960_ion_pdata.heaps[i].id ==
401 ION_SF_HEAP_ID) {
402 msm8960_ion_pdata.heaps[i].size =
403 msm_ion_sf_size;
404 pr_debug("msm_ion_sf_size 0x%x\n",
405 msm_ion_sf_size);
406 break;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800407 }
408 }
409 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800410}
411
412static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
413 unsigned long size)
414{
415 msm8960_reserve_table[mem_type].size += size;
416}
417
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700418static void __init msm8960_reserve_fixed_area(unsigned long fixed_area_size)
419{
420#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
421 int ret;
422
423 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
424 panic("fixed area size is larger than %dM\n",
425 MAX_FIXED_AREA_SIZE >> 20);
426
427 reserve_info->fixed_area_size = fixed_area_size;
428 reserve_info->fixed_area_start = MSM8960_FW_START;
429
430 ret = memblock_remove(reserve_info->fixed_area_start,
431 reserve_info->fixed_area_size);
432 BUG_ON(ret);
433#endif
434}
435
Olav Haugan65f4bd82011-12-13 11:50:08 -0800436/**
Larry Basseld653d092013-06-20 10:46:21 -0700437 * Reserve memory for ION. Also handle special case
Olav Hauganf6dc7742012-02-15 09:11:55 -0800438 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
439 * at a higher address than FW in addition to not more than 256MB away from the
Larry Basseld653d092013-06-20 10:46:21 -0700440 * base address of the firmware. In addition the MM heap must be
Olav Hauganf6dc7742012-02-15 09:11:55 -0800441 * adjacent to the FW heap for content protection purposes.
Olav Haugan65f4bd82011-12-13 11:50:08 -0800442 */
443static void __init reserve_ion_memory(void)
444{
445#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
446 unsigned int i;
Laura Abbottc0e64032012-08-03 17:32:09 -0700447 int ret;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700448 unsigned int fixed_size = 0;
449 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
450 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
Laura Abbottc0e64032012-08-03 17:32:09 -0700451 unsigned long cma_alignment;
452 unsigned int low_use_cma = 0;
453 unsigned int middle_use_cma = 0;
454 unsigned int high_use_cma = 0;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800455
456 adjust_mem_for_liquid();
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700457 fixed_low_size = 0;
458 fixed_middle_size = 0;
459 fixed_high_size = 0;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800460
Laura Abbottc0e64032012-08-03 17:32:09 -0700461 cma_alignment = PAGE_SIZE << max(MAX_ORDER, pageblock_order);
462
Laura Abbottb93525f2012-04-12 09:57:19 -0700463 for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
Olav Haugan8726caf2012-05-10 15:11:35 -0700464 struct ion_platform_heap *heap =
Laura Abbottb93525f2012-04-12 09:57:19 -0700465 &(msm8960_ion_pdata.heaps[i]);
Olav Haugan8726caf2012-05-10 15:11:35 -0700466 int align = SZ_4K;
467 int iommu_map_all = 0;
468 int adjacent_mem_id = INVALID_HEAP_ID;
Laura Abbottc0e64032012-08-03 17:32:09 -0700469 int use_cma = 0;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800470
471 if (heap->extra_data) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700472 int fixed_position = NOT_FIXED;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700473
Mitchel Humpherys362b52b2012-09-13 10:53:22 -0700474 switch ((int) heap->type) {
Olav Haugan65f4bd82011-12-13 11:50:08 -0800475 case ION_HEAP_TYPE_CP:
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700476 fixed_position = ((struct ion_cp_heap_pdata *)
477 heap->extra_data)->fixed_position;
Olav Haugan8726caf2012-05-10 15:11:35 -0700478 align = ((struct ion_cp_heap_pdata *)
479 heap->extra_data)->align;
480 iommu_map_all =
481 ((struct ion_cp_heap_pdata *)
482 heap->extra_data)->iommu_map_all;
Laura Abbottc0e64032012-08-03 17:32:09 -0700483 if (((struct ion_cp_heap_pdata *)
484 heap->extra_data)->is_cma) {
485 heap->size = ALIGN(heap->size,
486 cma_alignment);
487 use_cma = 1;
488 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800489 break;
Laura Abbottc0e64032012-08-03 17:32:09 -0700490 case ION_HEAP_TYPE_DMA:
491 use_cma = 1;
492 /* Purposely fall through here */
Olav Haugan65f4bd82011-12-13 11:50:08 -0800493 case ION_HEAP_TYPE_CARVEOUT:
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700494 fixed_position = ((struct ion_co_heap_pdata *)
495 heap->extra_data)->fixed_position;
Olav Haugan8726caf2012-05-10 15:11:35 -0700496 adjacent_mem_id = ((struct ion_co_heap_pdata *)
497 heap->extra_data)->adjacent_mem_id;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700498 break;
499 default:
500 break;
501 }
502
Olav Haugan8726caf2012-05-10 15:11:35 -0700503 if (iommu_map_all) {
504 if (heap->size & (SZ_64K-1)) {
505 heap->size = ALIGN(heap->size, SZ_64K);
506 pr_info("Heap %s not aligned to 64K. Adjusting size to %x\n",
507 heap->name, heap->size);
508 }
509 }
510
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700511 if (fixed_position != NOT_FIXED)
512 fixed_size += heap->size;
Chintan Pandya07f05cd2013-04-12 14:50:29 +0530513 else if (!use_cma)
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700514 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
515
Laura Abbottc0e64032012-08-03 17:32:09 -0700516 if (fixed_position == FIXED_LOW) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700517 fixed_low_size += heap->size;
Laura Abbottc0e64032012-08-03 17:32:09 -0700518 low_use_cma = use_cma;
519 } else if (fixed_position == FIXED_MIDDLE) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700520 fixed_middle_size += heap->size;
Laura Abbottc0e64032012-08-03 17:32:09 -0700521 middle_use_cma = use_cma;
522 } else if (fixed_position == FIXED_HIGH) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700523 fixed_high_size += heap->size;
Laura Abbottc0e64032012-08-03 17:32:09 -0700524 high_use_cma = use_cma;
525 } else if (use_cma) {
526 /*
527 * Heaps that use CMA but are not part of the
528 * fixed set. Create wherever.
529 */
530 dma_declare_contiguous(
531 heap->priv,
532 heap->size,
533 0,
534 0xb0000000);
535 }
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700536 }
537 }
538
539 if (!fixed_size)
540 return;
541
Laura Abbottc0e64032012-08-03 17:32:09 -0700542 /*
543 * Given the setup for the fixed area, we can't round up all sizes.
544 * Some sizes must be set up exactly and aligned correctly. Incorrect
545 * alignments are considered a configuration issue
Larry Bassel4d4f4482012-04-04 11:26:09 -0700546 */
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700547
548 fixed_low_start = MSM8960_FIXED_AREA_START;
Laura Abbottc0e64032012-08-03 17:32:09 -0700549 if (low_use_cma) {
550 BUG_ON(!IS_ALIGNED(fixed_low_start, cma_alignment));
551 BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, cma_alignment));
552 } else {
553 BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, SECTION_SIZE));
554 ret = memblock_remove(fixed_low_start,
555 fixed_low_size + HOLE_SIZE);
556 BUG_ON(ret);
557 }
558
Deepak Kotur35825522012-06-06 15:49:14 -0700559 fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE;
Laura Abbottc0e64032012-08-03 17:32:09 -0700560 if (middle_use_cma) {
561 BUG_ON(!IS_ALIGNED(fixed_middle_start, cma_alignment));
562 BUG_ON(!IS_ALIGNED(fixed_middle_size, cma_alignment));
563 } else {
564 BUG_ON(!IS_ALIGNED(fixed_middle_size, SECTION_SIZE));
565 ret = memblock_remove(fixed_middle_start, fixed_middle_size);
566 BUG_ON(ret);
567 }
568
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700569 fixed_high_start = fixed_middle_start + fixed_middle_size;
Laura Abbottc0e64032012-08-03 17:32:09 -0700570 if (high_use_cma) {
571 fixed_high_size = ALIGN(fixed_high_size, cma_alignment);
572 BUG_ON(!IS_ALIGNED(fixed_high_start, cma_alignment));
573 } else {
574 /* This is the end of the fixed area so it's okay to round up */
575 fixed_high_size = ALIGN(fixed_high_size, SECTION_SIZE);
576 ret = memblock_remove(fixed_high_start, fixed_high_size);
577 BUG_ON(ret);
578 }
579
580
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700581
Laura Abbottb93525f2012-04-12 09:57:19 -0700582 for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
583 struct ion_platform_heap *heap = &(msm8960_ion_pdata.heaps[i]);
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700584
585 if (heap->extra_data) {
586 int fixed_position = NOT_FIXED;
Steve Muckle75c34ca2012-06-12 14:27:40 -0700587 struct ion_cp_heap_pdata *pdata = NULL;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700588
Mitchel Humpherys362b52b2012-09-13 10:53:22 -0700589 switch ((int) heap->type) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700590 case ION_HEAP_TYPE_CP:
Deepak Kotur35825522012-06-06 15:49:14 -0700591 pdata =
592 (struct ion_cp_heap_pdata *)heap->extra_data;
593 fixed_position = pdata->fixed_position;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700594 break;
595 case ION_HEAP_TYPE_CARVEOUT:
Laura Abbottc0e64032012-08-03 17:32:09 -0700596 case ION_HEAP_TYPE_DMA:
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700597 fixed_position = ((struct ion_co_heap_pdata *)
598 heap->extra_data)->fixed_position;
599 break;
600 default:
601 break;
602 }
603
604 switch (fixed_position) {
605 case FIXED_LOW:
606 heap->base = fixed_low_start;
607 break;
608 case FIXED_MIDDLE:
609 heap->base = fixed_middle_start;
Laura Abbottc0e64032012-08-03 17:32:09 -0700610 if (middle_use_cma) {
611 ret = dma_declare_contiguous(
612 &ion_mm_heap_device.dev,
613 heap->size,
614 fixed_middle_start,
615 0xa0000000);
616 WARN_ON(ret);
617 }
Deepak Kotur35825522012-06-06 15:49:14 -0700618 pdata->secure_base = fixed_middle_start
619 - HOLE_SIZE;
620 pdata->secure_size = HOLE_SIZE + heap->size;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700621 break;
622 case FIXED_HIGH:
623 heap->base = fixed_high_start;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800624 break;
625 default:
626 break;
627 }
628 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800629 }
Laura Abbottd6183792011-08-19 13:42:24 -0700630#endif
631}
Huaibin Yanga5419422011-12-08 23:52:10 -0800632
633static void __init reserve_mdp_memory(void)
634{
635 msm8960_mdp_writeback(msm8960_reserve_table);
636}
637
Stephen Boyd668d7652012-04-25 11:31:01 -0700638static void __init reserve_cache_dump_memory(void)
Laura Abbott306bcc22012-03-08 11:24:53 -0800639{
640#ifdef CONFIG_MSM_CACHE_DUMP
Laura Abbott306bcc22012-03-08 11:24:53 -0800641 unsigned int total;
Laura Abbott306bcc22012-03-08 11:24:53 -0800642
Laura Abbott155ab6f2012-05-25 08:52:18 -0700643 total = msm8960_cache_dump_pdata.l1_size +
644 msm8960_cache_dump_pdata.l2_size;
Laura Abbott306bcc22012-03-08 11:24:53 -0800645 msm8960_reserve_table[MEMTYPE_EBI1].size += total;
Laura Abbott306bcc22012-03-08 11:24:53 -0800646#endif
647}
648
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700649static void __init msm8960_calculate_reserve_sizes(void)
650{
Laura Abbottd6183792011-08-19 13:42:24 -0700651 reserve_ion_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800652 reserve_mdp_memory();
Laura Abbottf8c03b92012-02-16 14:57:58 -0800653 reserve_rtb_memory();
Laura Abbott306bcc22012-03-08 11:24:53 -0800654 reserve_cache_dump_memory();
Laura Abbottf3aada42013-03-08 14:44:52 -0800655 msm8960_reserve_table[MEMTYPE_EBI1].size += msm_contig_mem_size;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700656}
657
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700658static struct reserve_info msm8960_reserve_info __initdata = {
659 .memtype_reserve_table = msm8960_reserve_table,
660 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700661 .reserve_fixed_area = msm8960_reserve_fixed_area,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700662 .paddr_to_memtype = msm8960_paddr_to_memtype,
663};
664
Larry Basselb830e182011-10-14 10:46:55 -0700665static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700666{
667 reserve_info = &msm8960_reserve_info;
Larry Basselb830e182011-10-14 10:46:55 -0700668}
669
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800670static char prim_panel_name[PANEL_NAME_MAX_LEN];
671static char ext_panel_name[PANEL_NAME_MAX_LEN];
672static int __init prim_display_setup(char *param)
673{
674 if (strnlen(param, PANEL_NAME_MAX_LEN))
675 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
676 return 0;
677}
678early_param("prim_display", prim_display_setup);
679
680static int __init ext_display_setup(char *param)
681{
682 if (strnlen(param, PANEL_NAME_MAX_LEN))
683 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
684 return 0;
685}
686early_param("ext_display", ext_display_setup);
687
Larry Basselb830e182011-10-14 10:46:55 -0700688static void __init msm8960_reserve(void)
689{
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800690 msm8960_set_display_params(prim_panel_name, ext_panel_name);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700691 msm_reserve();
692}
693
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700694static void __init msm8960_allocate_memory_regions(void)
695{
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800696 msm8960_allocate_fb_region();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700697}
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800698
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700699#ifdef CONFIG_WCD9310_CODEC
700
701#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
702
Patrick Lai3043fba2011-08-01 14:15:57 -0700703/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
704 * 4 micbiases are used to power various analog and digital
705 * microphones operating at 1800 mV. Technically, all micbiases
706 * can source from single cfilter since all microphones operate
707 * at the same voltage level. The arrangement below is to make
708 * sure all cfilters are exercised. LDO_H regulator ouput level
709 * does not need to be as high as 2.85V. It is choosen for
710 * microphone sensitivity purpose.
711 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530712static struct wcd9xxx_pdata tabla_platform_data = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700713 .slimbus_slave_device = {
714 .name = "tabla-slave",
715 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
716 },
717 .irq = MSM_GPIO_TO_INT(62),
718 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530719 .num_irqs = NR_WCD9XXX_IRQS,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700720 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -0700721 .micbias = {
722 .ldoh_v = TABLA_LDOH_2P85_V,
723 .cfilt1_mv = 1800,
Joonwoo Parkcf473b42012-03-29 19:48:16 -0700724 .cfilt2_mv = 2700,
Patrick Lai3043fba2011-08-01 14:15:57 -0700725 .cfilt3_mv = 1800,
726 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
727 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
728 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
729 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530730 },
731 .regulator = {
732 {
733 .name = "CDC_VDD_CP",
734 .min_uV = 1800000,
735 .max_uV = 1800000,
736 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
737 },
738 {
739 .name = "CDC_VDDA_RX",
740 .min_uV = 1800000,
741 .max_uV = 1800000,
742 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
743 },
744 {
745 .name = "CDC_VDDA_TX",
746 .min_uV = 1800000,
747 .max_uV = 1800000,
748 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
749 },
750 {
751 .name = "VDDIO_CDC",
752 .min_uV = 1800000,
753 .max_uV = 1800000,
754 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
755 },
756 {
757 .name = "VDDD_CDC_D",
758 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700759 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530760 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
761 },
762 {
763 .name = "CDC_VDDA_A_1P2V",
764 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700765 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530766 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
767 },
768 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700769};
770
771static struct slim_device msm_slim_tabla = {
772 .name = "tabla-slim",
773 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
774 .dev = {
775 .platform_data = &tabla_platform_data,
776 },
777};
Santosh Mardi60e19d92011-10-28 01:15:14 +0530778
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530779static struct wcd9xxx_pdata tabla20_platform_data = {
Santosh Mardi60e19d92011-10-28 01:15:14 +0530780 .slimbus_slave_device = {
781 .name = "tabla-slave",
782 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
783 },
784 .irq = MSM_GPIO_TO_INT(62),
785 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530786 .num_irqs = NR_WCD9XXX_IRQS,
Santosh Mardi60e19d92011-10-28 01:15:14 +0530787 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
788 .micbias = {
789 .ldoh_v = TABLA_LDOH_2P85_V,
790 .cfilt1_mv = 1800,
Joonwoo Parkcf473b42012-03-29 19:48:16 -0700791 .cfilt2_mv = 2700,
Santosh Mardi60e19d92011-10-28 01:15:14 +0530792 .cfilt3_mv = 1800,
793 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
794 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
795 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
796 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530797 },
798 .regulator = {
799 {
800 .name = "CDC_VDD_CP",
801 .min_uV = 1800000,
802 .max_uV = 1800000,
803 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
804 },
805 {
806 .name = "CDC_VDDA_RX",
807 .min_uV = 1800000,
808 .max_uV = 1800000,
809 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
810 },
811 {
812 .name = "CDC_VDDA_TX",
813 .min_uV = 1800000,
814 .max_uV = 1800000,
815 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
816 },
817 {
818 .name = "VDDIO_CDC",
819 .min_uV = 1800000,
820 .max_uV = 1800000,
821 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
822 },
823 {
824 .name = "VDDD_CDC_D",
825 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700826 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530827 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
828 },
829 {
830 .name = "CDC_VDDA_A_1P2V",
831 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700832 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530833 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
834 },
835 },
Santosh Mardi60e19d92011-10-28 01:15:14 +0530836};
837
838static struct slim_device msm_slim_tabla20 = {
839 .name = "tabla2x-slim",
840 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
841 .dev = {
842 .platform_data = &tabla20_platform_data,
843 },
844};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700845#endif
846
847static struct slim_boardinfo msm_slim_devices[] = {
848#ifdef CONFIG_WCD9310_CODEC
849 {
850 .bus_num = 1,
851 .slim_slave = &msm_slim_tabla,
852 },
Santosh Mardi60e19d92011-10-28 01:15:14 +0530853 {
854 .bus_num = 1,
855 .slim_slave = &msm_slim_tabla20,
856 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700857#endif
858 /* add more slimbus slaves as needed */
859};
860
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700861#define MSM_WCNSS_PHYS 0x03000000
862#define MSM_WCNSS_SIZE 0x280000
863
864static struct resource resources_wcnss_wlan[] = {
865 {
866 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
867 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
868 .name = "wcnss_wlanrx_irq",
869 .flags = IORESOURCE_IRQ,
870 },
871 {
872 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
873 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
874 .name = "wcnss_wlantx_irq",
875 .flags = IORESOURCE_IRQ,
876 },
877 {
878 .start = MSM_WCNSS_PHYS,
879 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
880 .name = "wcnss_mmio",
881 .flags = IORESOURCE_MEM,
882 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -0700883 {
884 .start = 84,
885 .end = 88,
886 .name = "wcnss_gpios_5wire",
887 .flags = IORESOURCE_IO,
888 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700889};
890
Ankur Nandwanib0039b02011-08-09 14:00:45 -0700891static struct qcom_wcnss_opts qcom_wcnss_pdata = {
892 .has_48mhz_xo = 1,
893};
894
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700895static struct platform_device msm_device_wcnss_wlan = {
896 .name = "wcnss_wlan",
897 .id = 0,
898 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
899 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -0700900 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700901};
902
Ramesh Masavarapua26cce72012-04-09 12:32:25 -0700903#ifdef CONFIG_QSEECOM
904/* qseecom bus scaling */
905static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
906 {
907 .src = MSM_BUS_MASTER_SPS,
908 .dst = MSM_BUS_SLAVE_EBI_CH0,
909 .ib = 0,
910 .ab = 0,
911 },
912 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -0700913 .src = MSM_BUS_MASTER_SPS,
914 .dst = MSM_BUS_SLAVE_SPS,
915 .ib = 0,
916 .ab = 0,
917 },
918 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -0700919 .src = MSM_BUS_MASTER_SPDM,
920 .dst = MSM_BUS_SLAVE_SPDM,
921 .ib = 0,
922 .ab = 0,
923 },
924};
925
926static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
927 {
928 .src = MSM_BUS_MASTER_SPS,
929 .dst = MSM_BUS_SLAVE_EBI_CH0,
930 .ib = (492 * 8) * 1000000UL,
931 .ab = (492 * 8) * 100000UL,
932 },
933 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -0700934 .src = MSM_BUS_MASTER_SPS,
935 .dst = MSM_BUS_SLAVE_SPS,
936 .ib = (492 * 8) * 1000000UL,
937 .ab = (492 * 8) * 100000UL,
938 },
939 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -0700940 .src = MSM_BUS_MASTER_SPDM,
941 .dst = MSM_BUS_SLAVE_SPDM,
942 .ib = 0,
943 .ab = 0,
944 },
945};
946
947static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
948 {
949 .src = MSM_BUS_MASTER_SPS,
950 .dst = MSM_BUS_SLAVE_EBI_CH0,
951 .ib = 0,
952 .ab = 0,
953 },
954 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -0700955 .src = MSM_BUS_MASTER_SPS,
956 .dst = MSM_BUS_SLAVE_SPS,
957 .ib = 0,
958 .ab = 0,
959 },
960 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -0700961 .src = MSM_BUS_MASTER_SPDM,
962 .dst = MSM_BUS_SLAVE_SPDM,
963 .ib = (64 * 8) * 1000000UL,
964 .ab = (64 * 8) * 100000UL,
965 },
966};
967
Ramesh Masavarapu8d756582012-10-03 10:18:06 -0700968static struct msm_bus_vectors qseecom_enable_dfab_sfpb_vectors[] = {
969 {
970 .src = MSM_BUS_MASTER_SPS,
971 .dst = MSM_BUS_SLAVE_EBI_CH0,
972 .ib = (492 * 8) * 1000000UL,
973 .ab = (492 * 8) * 100000UL,
974 },
975 {
976 .src = MSM_BUS_MASTER_SPS,
977 .dst = MSM_BUS_SLAVE_SPS,
978 .ib = (492 * 8) * 1000000UL,
979 .ab = (492 * 8) * 100000UL,
980 },
981 {
982 .src = MSM_BUS_MASTER_SPDM,
983 .dst = MSM_BUS_SLAVE_SPDM,
984 .ib = (64 * 8) * 1000000UL,
985 .ab = (64 * 8) * 100000UL,
986 },
987};
988
Ramesh Masavarapua26cce72012-04-09 12:32:25 -0700989static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
990 {
991 ARRAY_SIZE(qseecom_clks_init_vectors),
992 qseecom_clks_init_vectors,
993 },
994 {
995 ARRAY_SIZE(qseecom_enable_dfab_vectors),
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -0700996 qseecom_enable_dfab_vectors,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -0700997 },
998 {
999 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1000 qseecom_enable_sfpb_vectors,
1001 },
Ramesh Masavarapu8d756582012-10-03 10:18:06 -07001002 {
1003 ARRAY_SIZE(qseecom_enable_dfab_sfpb_vectors),
1004 qseecom_enable_dfab_sfpb_vectors,
1005 },
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001006};
1007
1008static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1009 qseecom_hw_bus_scale_usecases,
1010 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1011 .name = "qsee",
1012};
1013
1014static struct platform_device qseecom_device = {
1015 .name = "qseecom",
1016 .id = 0,
1017 .dev = {
1018 .platform_data = &qseecom_bus_pdata,
1019 },
1020};
1021#endif
1022
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001023#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1024 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1025 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1026 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1027
1028#define QCE_SIZE 0x10000
1029#define QCE_0_BASE 0x18500000
1030
1031#define QCE_HW_KEY_SUPPORT 0
1032#define QCE_SHA_HMAC_SUPPORT 1
1033#define QCE_SHARE_CE_RESOURCE 1
1034#define QCE_CE_SHARED 0
1035
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001036/* Begin Bus scaling definitions */
1037static struct msm_bus_vectors crypto_hw_init_vectors[] = {
1038 {
1039 .src = MSM_BUS_MASTER_ADM_PORT0,
1040 .dst = MSM_BUS_SLAVE_EBI_CH0,
1041 .ab = 0,
1042 .ib = 0,
1043 },
1044 {
1045 .src = MSM_BUS_MASTER_ADM_PORT1,
1046 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1047 .ab = 0,
1048 .ib = 0,
1049 },
1050};
1051
1052static struct msm_bus_vectors crypto_hw_active_vectors[] = {
1053 {
1054 .src = MSM_BUS_MASTER_ADM_PORT0,
1055 .dst = MSM_BUS_SLAVE_EBI_CH0,
1056 .ab = 70000000UL,
1057 .ib = 70000000UL,
1058 },
1059 {
1060 .src = MSM_BUS_MASTER_ADM_PORT1,
1061 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1062 .ab = 2480000000UL,
1063 .ib = 2480000000UL,
1064 },
1065};
1066
1067static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
1068 {
1069 ARRAY_SIZE(crypto_hw_init_vectors),
1070 crypto_hw_init_vectors,
1071 },
1072 {
1073 ARRAY_SIZE(crypto_hw_active_vectors),
1074 crypto_hw_active_vectors,
1075 },
1076};
1077
1078static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
1079 crypto_hw_bus_scale_usecases,
1080 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
1081 .name = "cryptohw",
1082};
1083/* End Bus Scaling Definitions*/
1084
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001085static struct resource qcrypto_resources[] = {
1086 [0] = {
1087 .start = QCE_0_BASE,
1088 .end = QCE_0_BASE + QCE_SIZE - 1,
1089 .flags = IORESOURCE_MEM,
1090 },
1091 [1] = {
1092 .name = "crypto_channels",
1093 .start = DMOV_CE_IN_CHAN,
1094 .end = DMOV_CE_OUT_CHAN,
1095 .flags = IORESOURCE_DMA,
1096 },
1097 [2] = {
1098 .name = "crypto_crci_in",
1099 .start = DMOV_CE_IN_CRCI,
1100 .end = DMOV_CE_IN_CRCI,
1101 .flags = IORESOURCE_DMA,
1102 },
1103 [3] = {
1104 .name = "crypto_crci_out",
1105 .start = DMOV_CE_OUT_CRCI,
1106 .end = DMOV_CE_OUT_CRCI,
1107 .flags = IORESOURCE_DMA,
1108 },
1109};
1110
1111static struct resource qcedev_resources[] = {
1112 [0] = {
1113 .start = QCE_0_BASE,
1114 .end = QCE_0_BASE + QCE_SIZE - 1,
1115 .flags = IORESOURCE_MEM,
1116 },
1117 [1] = {
1118 .name = "crypto_channels",
1119 .start = DMOV_CE_IN_CHAN,
1120 .end = DMOV_CE_OUT_CHAN,
1121 .flags = IORESOURCE_DMA,
1122 },
1123 [2] = {
1124 .name = "crypto_crci_in",
1125 .start = DMOV_CE_IN_CRCI,
1126 .end = DMOV_CE_IN_CRCI,
1127 .flags = IORESOURCE_DMA,
1128 },
1129 [3] = {
1130 .name = "crypto_crci_out",
1131 .start = DMOV_CE_OUT_CRCI,
1132 .end = DMOV_CE_OUT_CRCI,
1133 .flags = IORESOURCE_DMA,
1134 },
1135};
1136
1137#endif
1138
1139#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1140 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1141
1142static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1143 .ce_shared = QCE_CE_SHARED,
1144 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1145 .hw_key_support = QCE_HW_KEY_SUPPORT,
1146 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001147 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001148};
1149
1150static struct platform_device qcrypto_device = {
1151 .name = "qcrypto",
1152 .id = 0,
1153 .num_resources = ARRAY_SIZE(qcrypto_resources),
1154 .resource = qcrypto_resources,
1155 .dev = {
1156 .coherent_dma_mask = DMA_BIT_MASK(32),
1157 .platform_data = &qcrypto_ce_hw_suppport,
1158 },
1159};
1160#endif
1161
1162#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1163 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1164
1165static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1166 .ce_shared = QCE_CE_SHARED,
1167 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1168 .hw_key_support = QCE_HW_KEY_SUPPORT,
1169 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001170 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001171};
1172
1173static struct platform_device qcedev_device = {
1174 .name = "qce",
1175 .id = 0,
1176 .num_resources = ARRAY_SIZE(qcedev_resources),
1177 .resource = qcedev_resources,
1178 .dev = {
1179 .coherent_dma_mask = DMA_BIT_MASK(32),
1180 .platform_data = &qcedev_ce_hw_suppport,
1181 },
1182};
1183#endif
1184
Joel King0cbf5d82012-05-24 15:21:38 -07001185static struct mdm_platform_data sglte_platform_data = {
1186 .mdm_version = "4.0",
1187 .ramdump_delay_ms = 1000,
Taniya Das2b7646b2013-01-15 11:28:14 +05301188 /* delay between two PS_HOLDs */
1189 .ps_hold_delay_ms = 500,
Joel King63ce8332012-06-01 09:59:26 -07001190 .soft_reset_inverted = 1,
Joel King0cbf5d82012-05-24 15:21:38 -07001191 .peripheral_platform_device = NULL,
Ameya Thakurc9a7a842012-06-24 22:47:52 -07001192 .ramdump_timeout_ms = 600000,
Ameya Thakura98bde52012-06-28 18:55:19 -07001193 .no_powerdown_after_ramdumps = 1,
Ameya Thakur43248fd2012-07-10 18:50:52 -07001194 .image_upgrade_supported = 1,
Joel Kingb8352a12011-11-15 18:46:24 -08001195};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001196
Joel Nider266a2642011-10-16 10:58:05 +02001197#define MSM_TSIF0_PHYS (0x18200000)
1198#define MSM_TSIF1_PHYS (0x18201000)
1199#define MSM_TSIF_SIZE (0x200)
1200#define MSM_TSPP_PHYS (0x18202000)
1201#define MSM_TSPP_SIZE (0x1000)
1202#define MSM_TSPP_BAM_PHYS (0x18204000)
1203#define MSM_TSPP_BAM_SIZE (0x2000)
1204
1205#define TSIF_0_CLK GPIO_CFG(75, 1, GPIO_CFG_INPUT, \
1206 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1207#define TSIF_0_EN GPIO_CFG(76, 1, GPIO_CFG_INPUT, \
1208 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1209#define TSIF_0_DATA GPIO_CFG(77, 1, GPIO_CFG_INPUT, \
1210 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1211#define TSIF_0_SYNC GPIO_CFG(82, 1, GPIO_CFG_INPUT, \
1212 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1213#define TSIF_1_CLK GPIO_CFG(79, 1, GPIO_CFG_INPUT, \
1214 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1215#define TSIF_1_EN GPIO_CFG(80, 1, GPIO_CFG_INPUT, \
1216 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1217#define TSIF_1_DATA GPIO_CFG(81, 1, GPIO_CFG_INPUT, \
1218 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1219#define TSIF_1_SYNC GPIO_CFG(78, 1, GPIO_CFG_INPUT, \
1220 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1221
1222static const struct msm_gpio tsif_gpios[] = {
1223 { .gpio_cfg = TSIF_0_CLK, .label = "tsif0_clk", },
1224 { .gpio_cfg = TSIF_0_EN, .label = "tsif0_en", },
1225 { .gpio_cfg = TSIF_0_DATA, .label = "tsif0_data", },
1226 { .gpio_cfg = TSIF_0_SYNC, .label = "tsif0_sync", },
1227 { .gpio_cfg = TSIF_1_CLK, .label = "tsif1_clk", },
1228 { .gpio_cfg = TSIF_1_EN, .label = "tsif1_en", },
1229 { .gpio_cfg = TSIF_1_DATA, .label = "tsif1_data", },
1230 { .gpio_cfg = TSIF_1_SYNC, .label = "tsif1_sync", },
1231};
1232
1233static struct resource tspp_resources[] = {
1234 [0] = {
Liron Kuch59339922013-01-01 18:29:47 +02001235 .name = "TSIF_TSPP_IRQ",
Joel Nider266a2642011-10-16 10:58:05 +02001236 .flags = IORESOURCE_IRQ,
1237 .start = TSIF_TSPP_IRQ,
Liron Kuch59339922013-01-01 18:29:47 +02001238 .end = TSIF_TSPP_IRQ,
Joel Nider266a2642011-10-16 10:58:05 +02001239 },
1240 [1] = {
Liron Kuch59339922013-01-01 18:29:47 +02001241 .name = "TSIF0_IRQ",
1242 .flags = IORESOURCE_IRQ,
1243 .start = TSIF1_IRQ,
1244 .end = TSIF1_IRQ,
1245 },
1246 [2] = {
1247 .name = "TSIF1_IRQ",
1248 .flags = IORESOURCE_IRQ,
1249 .start = TSIF2_IRQ,
1250 .end = TSIF2_IRQ,
1251 },
1252 [3] = {
1253 .name = "TSIF_BAM_IRQ",
1254 .flags = IORESOURCE_IRQ,
1255 .start = TSIF_BAM_IRQ,
1256 .end = TSIF_BAM_IRQ,
1257 },
1258 [4] = {
1259 .name = "MSM_TSIF0_PHYS",
Joel Nider266a2642011-10-16 10:58:05 +02001260 .flags = IORESOURCE_MEM,
1261 .start = MSM_TSIF0_PHYS,
1262 .end = MSM_TSIF0_PHYS + MSM_TSIF_SIZE - 1,
1263 },
Liron Kuch59339922013-01-01 18:29:47 +02001264 [5] = {
1265 .name = "MSM_TSIF1_PHYS",
Joel Nider266a2642011-10-16 10:58:05 +02001266 .flags = IORESOURCE_MEM,
1267 .start = MSM_TSIF1_PHYS,
1268 .end = MSM_TSIF1_PHYS + MSM_TSIF_SIZE - 1,
1269 },
Liron Kuch59339922013-01-01 18:29:47 +02001270 [6] = {
1271 .name = "MSM_TSPP_PHYS",
Joel Nider266a2642011-10-16 10:58:05 +02001272 .flags = IORESOURCE_MEM,
1273 .start = MSM_TSPP_PHYS,
1274 .end = MSM_TSPP_PHYS + MSM_TSPP_SIZE - 1,
1275 },
Liron Kuch59339922013-01-01 18:29:47 +02001276 [7] = {
1277 .name = "MSM_TSPP_BAM_PHYS",
Joel Nider266a2642011-10-16 10:58:05 +02001278 .flags = IORESOURCE_MEM,
1279 .start = MSM_TSPP_BAM_PHYS,
1280 .end = MSM_TSPP_BAM_PHYS + MSM_TSPP_BAM_SIZE - 1,
1281 },
1282};
1283
1284static struct msm_tspp_platform_data tspp_platform_data = {
1285 .num_gpios = ARRAY_SIZE(tsif_gpios),
1286 .gpios = tsif_gpios,
1287 .tsif_pclk = "tsif_pclk",
1288 .tsif_ref_clk = "tsif_ref_clk",
Vikram Mulukutlae9ca54b2013-04-19 11:08:42 -07001289 .tsif_vreg_present = 0,
Joel Nider266a2642011-10-16 10:58:05 +02001290};
1291
1292static struct platform_device msm_device_tspp = {
1293 .name = "msm_tspp",
1294 .id = 0,
1295 .num_resources = ARRAY_SIZE(tspp_resources),
1296 .resource = tspp_resources,
1297 .dev = {
1298 .platform_data = &tspp_platform_data
1299 },
1300};
1301
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001302#define MSM_SHARED_RAM_PHYS 0x80000000
1303
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001304static void __init msm8960_map_io(void)
1305{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001306 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001307 msm_map_msm8960_io();
Abhimanyu Kapur91a0a502013-01-11 19:24:59 -08001308 if (socinfo_init() < 0)
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001309 pr_err("socinfo_init() failed!\n");
Abhimanyu Kapur440cdde2012-12-04 00:05:40 -08001310
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001311}
1312
1313static void __init msm8960_init_irq(void)
1314{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001315 struct msm_mpm_device_data *data = NULL;
1316
1317#ifdef CONFIG_MSM_MPM
1318 data = &msm8960_mpm_dev_data;
1319#endif
1320
1321 msm_mpm_irq_extn_init(data);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001322 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001323 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001324}
1325
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001326static void __init msm8960_init_buses(void)
1327{
1328#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -06001329 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -06001330 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
1331 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
Gagan Macae154c4b2011-10-05 19:24:43 -06001332 msm_bus_apps_fabric.dev.platform_data =
1333 &msm_bus_8960_apps_fabric_pdata;
1334 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
Gagan Mac680bfc02012-07-19 19:11:00 -06001335 if (cpu_is_msm8960ab()) {
1336 msm_bus_8960_sg_mm_fabric_pdata.rpm_enabled = 1;
1337 msm_bus_mm_fabric.dev.platform_data =
1338 &msm_bus_8960_sg_mm_fabric_pdata;
1339 } else {
1340 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
1341 msm_bus_mm_fabric.dev.platform_data =
1342 &msm_bus_8960_mm_fabric_pdata;
1343 }
Gagan Macae154c4b2011-10-05 19:24:43 -06001344 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
1345 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001346#endif
1347}
1348
1349static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
1350 .max_clock_speed = 15060000,
Kiran Gundac5fbd7f2012-07-30 13:22:39 +05301351 .infinite_mode = 0xFFC0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001352};
1353
1354#ifdef CONFIG_USB_MSM_OTG_72K
1355static struct msm_otg_platform_data msm_otg_pdata;
1356#else
Anji jonnalaa8b8d732011-12-06 10:03:24 +05301357static int wr_phy_init_seq[] = {
1358 0x44, 0x80, /* set VBUS valid threshold
1359 and disconnect valid threshold */
Chiranjeevi Velempatif983aeb2012-08-23 08:16:50 +05301360 0x68, 0x81, /* update DC voltage level */
Anji jonnalaa8b8d732011-12-06 10:03:24 +05301361 0x14, 0x82, /* set preemphasis and rise/fall time */
1362 0x13, 0x83, /* set source impedance adjusment */
1363 -1};
1364
1365static int liquid_v1_phy_init_seq[] = {
1366 0x44, 0x80,/* set VBUS valid threshold
1367 and disconnect valid threshold */
Chiranjeevi Velempatif983aeb2012-08-23 08:16:50 +05301368 0x6C, 0x81,/* update DC voltage level */
Anji jonnalaa8b8d732011-12-06 10:03:24 +05301369 0x18, 0x82,/* set preemphasis and rise/fall time */
1370 0x23, 0x83,/* set source impedance sdjusment */
1371 -1};
1372
Mayank Ranaa61da7a2012-08-14 10:57:00 +05301373static int sglte_phy_init_seq[] = {
1374 0x44, 0x80, /* set VBUS valid threshold
1375 and disconnect valid threshold */
Chiranjeevi Velempatif983aeb2012-08-23 08:16:50 +05301376 0x6A, 0x81, /* update DC voltage level */
Mayank Ranaa61da7a2012-08-14 10:57:00 +05301377 0x24, 0x82, /* set preemphasis and rise/fall time */
1378 0x13, 0x83, /* set source impedance adjusment */
1379 -1};
1380
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301381#ifdef CONFIG_MSM_BUS_SCALING
1382/* Bandwidth requests (zero) if no vote placed */
1383static struct msm_bus_vectors usb_init_vectors[] = {
1384 {
1385 .src = MSM_BUS_MASTER_SPS,
1386 .dst = MSM_BUS_SLAVE_EBI_CH0,
1387 .ab = 0,
1388 .ib = 0,
1389 },
1390};
1391
1392/* Bus bandwidth requests in Bytes/sec */
1393static struct msm_bus_vectors usb_max_vectors[] = {
1394 {
1395 .src = MSM_BUS_MASTER_SPS,
1396 .dst = MSM_BUS_SLAVE_EBI_CH0,
1397 .ab = 60000000, /* At least 480Mbps on bus. */
1398 .ib = 960000000, /* MAX bursts rate */
1399 },
1400};
1401
1402static struct msm_bus_paths usb_bus_scale_usecases[] = {
1403 {
1404 ARRAY_SIZE(usb_init_vectors),
1405 usb_init_vectors,
1406 },
1407 {
1408 ARRAY_SIZE(usb_max_vectors),
1409 usb_max_vectors,
1410 },
1411};
1412
1413static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
1414 usb_bus_scale_usecases,
1415 ARRAY_SIZE(usb_bus_scale_usecases),
1416 .name = "usb",
1417};
1418#endif
1419
Jack Pham87f202f2012-08-06 00:24:22 -07001420#define MSM_MPM_PIN_USB1_OTGSESSVLD 40
1421
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001422static struct msm_otg_platform_data msm_otg_pdata = {
1423 .mode = USB_OTG,
1424 .otg_control = OTG_PMIC_CONTROL,
1425 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001426 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
Anji jonnala4e3e6772011-09-15 18:53:42 +05301427 .power_budget = 750,
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301428#ifdef CONFIG_MSM_BUS_SCALING
1429 .bus_scale_table = &usb_bus_scale_pdata,
Jack Pham87f202f2012-08-06 00:24:22 -07001430 .mpm_otgsessvld_int = MSM_MPM_PIN_USB1_OTGSESSVLD,
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301431#endif
Pavankumar Kondeti2aec9f32012-06-13 09:06:03 +05301432#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
1433 .mhl_dev_name = "sii8334",
1434#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001435};
1436#endif
1437
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301438#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05301439#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301440static struct msm_hsic_host_platform_data msm_hsic_pdata = {
Manu Gautam3c598392013-03-22 16:59:10 +05301441 .strobe = 150,
1442 .data = 151,
1443 .phy_sof_workaround = true,
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301444};
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301445
1446static struct smsc_hub_platform_data hsic_hub_pdata = {
1447 .hub_reset = HSIC_HUB_RESET_GPIO,
1448};
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301449#else
1450static struct msm_hsic_host_platform_data msm_hsic_pdata;
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301451static struct smsc_hub_platform_data hsic_hub_pdata;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301452#endif
1453
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301454static struct platform_device smsc_hub_device = {
1455 .name = "msm_smsc_hub",
1456 .id = -1,
1457 .dev = {
1458 .platform_data = &hsic_hub_pdata,
1459 },
1460};
1461
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001462#define PID_MAGIC_ID 0x71432909
1463#define SERIAL_NUM_MAGIC_ID 0x61945374
1464#define SERIAL_NUMBER_LENGTH 127
1465#define DLOAD_USB_BASE_ADD 0x2A03F0C8
1466
1467struct magic_num_struct {
1468 uint32_t pid;
1469 uint32_t serial_num;
1470};
1471
1472struct dload_struct {
1473 uint32_t reserved1;
1474 uint32_t reserved2;
1475 uint32_t reserved3;
1476 uint16_t reserved4;
1477 uint16_t pid;
1478 char serial_number[SERIAL_NUMBER_LENGTH];
1479 uint16_t reserved5;
1480 struct magic_num_struct magic_struct;
1481};
1482
1483static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
1484{
1485 struct dload_struct __iomem *dload = 0;
1486
1487 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
1488 if (!dload) {
1489 pr_err("%s: cannot remap I/O memory region: %08x\n",
1490 __func__, DLOAD_USB_BASE_ADD);
1491 return -ENXIO;
1492 }
1493
1494 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
1495 __func__, dload, pid, snum);
1496 /* update pid */
1497 dload->magic_struct.pid = PID_MAGIC_ID;
1498 dload->pid = pid;
1499
1500 /* update serial number */
1501 dload->magic_struct.serial_num = 0;
1502 if (!snum) {
1503 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
1504 goto out;
1505 }
1506
1507 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -07001508 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001509out:
1510 iounmap(dload);
1511 return 0;
1512}
1513
1514static struct android_usb_platform_data android_usb_pdata = {
1515 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1516};
1517
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001518static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001519 .name = "android_usb",
1520 .id = -1,
1521 .dev = {
1522 .platform_data = &android_usb_pdata,
1523 },
1524};
1525
1526static uint8_t spm_wfi_cmd_sequence[] __initdata = {
Praveen Chidambaramc3c90822012-11-07 15:43:49 -07001527 0x03, 0x0f,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001528};
1529
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001530static uint8_t spm_retention_cmd_sequence[] __initdata = {
Praveen Chidambaramc3c90822012-11-07 15:43:49 -07001531 0x00, 0x05, 0x03, 0x0D,
1532 0x0B, 0x00, 0x0f,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001533};
1534
Anji Jonnala1a1711a2013-01-29 13:34:10 +05301535static uint8_t spm_retention_with_krait_v3_cmd_sequence[] __initdata = {
1536 0x42, 0x1B, 0x00,
1537 0x05, 0x03, 0x01, 0x0B,
1538 0x00, 0x42, 0x1B,
1539 0x0f,
1540};
1541
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001542static uint8_t spm_power_collapse_without_rpm[] __initdata = {
Praveen Chidambaramc3c90822012-11-07 15:43:49 -07001543 0x00, 0x24, 0x54, 0x10,
1544 0x09, 0x03, 0x01,
1545 0x10, 0x54, 0x30, 0x0C,
1546 0x24, 0x30, 0x0f,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001547};
1548
1549static uint8_t spm_power_collapse_with_rpm[] __initdata = {
Praveen Chidambaramc3c90822012-11-07 15:43:49 -07001550 0x00, 0x24, 0x54, 0x10,
1551 0x09, 0x07, 0x01, 0x0B,
1552 0x10, 0x54, 0x30, 0x0C,
1553 0x24, 0x30, 0x0f,
1554};
1555
1556/* 8960AB has a different command to assert apc_pdn */
1557static uint8_t spm_power_collapse_without_rpm_krait_v3[] __initdata = {
1558 0x00, 0x24, 0x84, 0x10,
1559 0x09, 0x03, 0x01,
1560 0x10, 0x84, 0x30, 0x0C,
1561 0x24, 0x30, 0x0f,
1562};
1563
1564static uint8_t spm_power_collapse_with_rpm_krait_v3[] __initdata = {
1565 0x00, 0x24, 0x84, 0x10,
1566 0x09, 0x07, 0x01, 0x0B,
1567 0x10, 0x84, 0x30, 0x0C,
1568 0x24, 0x30, 0x0f,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001569};
1570
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001571static struct msm_spm_seq_entry msm_spm_boot_cpu_seq_list[] __initdata = {
1572 [0] = {
1573 .mode = MSM_SPM_MODE_CLOCK_GATING,
1574 .notify_rpm = false,
1575 .cmd = spm_wfi_cmd_sequence,
1576 },
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001577 [1] = {
1578 .mode = MSM_SPM_MODE_POWER_RETENTION,
1579 .notify_rpm = false,
1580 .cmd = spm_retention_cmd_sequence,
1581 },
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001582 [2] = {
1583 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1584 .notify_rpm = false,
1585 .cmd = spm_power_collapse_without_rpm,
1586 },
1587 [3] = {
1588 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1589 .notify_rpm = true,
1590 .cmd = spm_power_collapse_with_rpm,
1591 },
1592};
1593
1594static struct msm_spm_seq_entry msm_spm_nonboot_cpu_seq_list[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001595 [0] = {
1596 .mode = MSM_SPM_MODE_CLOCK_GATING,
1597 .notify_rpm = false,
1598 .cmd = spm_wfi_cmd_sequence,
1599 },
Anji Jonnala1a1711a2013-01-29 13:34:10 +05301600
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001601 [1] = {
Anji Jonnala1a1711a2013-01-29 13:34:10 +05301602 .mode = MSM_SPM_MODE_POWER_RETENTION,
1603 .notify_rpm = false,
1604 .cmd = spm_retention_cmd_sequence,
1605 },
1606
1607 [2] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001608 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1609 .notify_rpm = false,
1610 .cmd = spm_power_collapse_without_rpm,
1611 },
Anji Jonnala1a1711a2013-01-29 13:34:10 +05301612
1613 [3] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001614 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1615 .notify_rpm = true,
1616 .cmd = spm_power_collapse_with_rpm,
1617 },
1618};
1619
1620static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1621 [0] = {
1622 .reg_base_addr = MSM_SAW0_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001623 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001624#if defined(CONFIG_MSM_AVS_HW)
Anji Jonnala39dd7252012-11-26 15:56:26 +05301625 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x58589464,
Praveen Chidambaram631f2822012-03-16 12:08:42 -06001626 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00020000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001627#endif
1628 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001629 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004,
1630 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C,
1631 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001632 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001633 .num_modes = ARRAY_SIZE(msm_spm_boot_cpu_seq_list),
1634 .modes = msm_spm_boot_cpu_seq_list,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001635 },
1636 [1] = {
1637 .reg_base_addr = MSM_SAW1_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001638 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001639#if defined(CONFIG_MSM_AVS_HW)
Anji Jonnala39dd7252012-11-26 15:56:26 +05301640 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x58589464,
Praveen Chidambaram631f2822012-03-16 12:08:42 -06001641 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00020000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001642#endif
1643 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001644 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001645 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1646 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1647 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001648 .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
1649 .modes = msm_spm_nonboot_cpu_seq_list,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001650 },
1651};
1652
1653static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1654 0x00, 0x20, 0x03, 0x20,
1655 0x00, 0x0f,
1656};
1657
1658static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1659 0x00, 0x20, 0x34, 0x64,
1660 0x48, 0x07, 0x48, 0x20,
1661 0x50, 0x64, 0x04, 0x34,
1662 0x50, 0x0f,
1663};
1664static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1665 0x00, 0x10, 0x34, 0x64,
1666 0x48, 0x07, 0x48, 0x10,
1667 0x50, 0x64, 0x04, 0x34,
1668 0x50, 0x0F,
1669};
1670
1671static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1672 [0] = {
1673 .mode = MSM_SPM_L2_MODE_RETENTION,
1674 .notify_rpm = false,
1675 .cmd = l2_spm_wfi_cmd_sequence,
1676 },
1677 [1] = {
1678 .mode = MSM_SPM_L2_MODE_GDHS,
1679 .notify_rpm = true,
1680 .cmd = l2_spm_gdhs_cmd_sequence,
1681 },
1682 [2] = {
1683 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1684 .notify_rpm = true,
1685 .cmd = l2_spm_power_off_cmd_sequence,
1686 },
1687};
1688
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001689static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1690 [0] = {
1691 .reg_base_addr = MSM_SAW_L2_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001692 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001693 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001694 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1695 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1696 .modes = msm_spm_l2_seq_list,
1697 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1698 },
1699};
1700
Anirudh Ghayal15698162012-07-31 11:51:32 +05301701#define HAP_SHIFT_LVL_OE_GPIO 47
1702#define HAP_SHIFT_LVL_OE_GPIO_SGLTE 89
Mohan Pallaka5e490392011-09-09 15:18:41 +05301703#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1704#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
1705
1706static struct msm_xo_voter *xo_handle_d1;
1707
1708static int isa1200_power(int on)
1709{
1710 int rc = 0;
Anirudh Ghayal15698162012-07-31 11:51:32 +05301711 int hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO;
Mohan Pallaka5e490392011-09-09 15:18:41 +05301712
Anirudh Ghayal15698162012-07-31 11:51:32 +05301713 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
1714 hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO_SGLTE;
1715
1716
1717 gpio_set_value(hap_oe_gpio, !!on);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301718
1719 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
1720 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
1721 if (rc < 0) {
1722 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
1723 __func__, on ? "" : "de-", rc);
1724 goto err_xo_vote;
1725 }
1726
1727 return 0;
1728
1729err_xo_vote:
Anirudh Ghayal15698162012-07-31 11:51:32 +05301730 gpio_set_value(hap_oe_gpio, !on);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301731 return rc;
1732}
1733
1734static int isa1200_dev_setup(bool enable)
1735{
1736 int rc = 0;
Anirudh Ghayal15698162012-07-31 11:51:32 +05301737 int hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO;
Mohan Pallaka5e490392011-09-09 15:18:41 +05301738
1739 struct pm_gpio hap_gpio_config = {
1740 .direction = PM_GPIO_DIR_OUT,
1741 .pull = PM_GPIO_PULL_NO,
1742 .out_strength = PM_GPIO_STRENGTH_HIGH,
1743 .function = PM_GPIO_FUNC_NORMAL,
1744 .inv_int_pol = 0,
1745 .vin_sel = 2,
1746 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1747 .output_value = 0,
1748 };
1749
Anirudh Ghayal15698162012-07-31 11:51:32 +05301750 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
1751 hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO_SGLTE;
1752
Mohan Pallaka5e490392011-09-09 15:18:41 +05301753 if (enable == true) {
1754 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
1755 if (rc) {
1756 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1757 __func__, PM_HAP_EN_GPIO, rc);
1758 return rc;
1759 }
1760
1761 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
1762 if (rc) {
1763 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1764 __func__, PM_HAP_LEN_GPIO, rc);
1765 return rc;
1766 }
1767
Anirudh Ghayal15698162012-07-31 11:51:32 +05301768 rc = gpio_request(hap_oe_gpio, "hap_shft_lvl_oe");
Mohan Pallaka5e490392011-09-09 15:18:41 +05301769 if (rc) {
1770 pr_err("%s: unable to request gpio %d (%d)\n",
Anirudh Ghayal15698162012-07-31 11:51:32 +05301771 __func__, hap_oe_gpio, rc);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301772 return rc;
1773 }
1774
Anirudh Ghayal15698162012-07-31 11:51:32 +05301775 rc = gpio_direction_output(hap_oe_gpio, 0);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301776 if (rc) {
1777 pr_err("%s: Unable to set direction\n", __func__);
1778 goto free_gpio;
1779 }
1780
1781 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
1782 if (IS_ERR(xo_handle_d1)) {
1783 rc = PTR_ERR(xo_handle_d1);
1784 pr_err("%s: failed to get the handle for D1(%d)\n",
1785 __func__, rc);
1786 goto gpio_set_dir;
1787 }
1788 } else {
Anirudh Ghayal15698162012-07-31 11:51:32 +05301789 gpio_free(hap_oe_gpio);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301790
1791 msm_xo_put(xo_handle_d1);
1792 }
1793
1794 return 0;
1795
1796gpio_set_dir:
Anirudh Ghayal15698162012-07-31 11:51:32 +05301797 gpio_set_value(hap_oe_gpio, 0);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301798free_gpio:
Anirudh Ghayal15698162012-07-31 11:51:32 +05301799 gpio_free(hap_oe_gpio);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301800 return rc;
1801}
1802
1803static struct isa1200_regulator isa1200_reg_data[] = {
1804 {
1805 .name = "vcc_i2c",
1806 .min_uV = ISA_I2C_VTG_MIN_UV,
1807 .max_uV = ISA_I2C_VTG_MAX_UV,
1808 .load_uA = ISA_I2C_CURR_UA,
1809 },
1810};
1811
1812static struct isa1200_platform_data isa1200_1_pdata = {
1813 .name = "vibrator",
1814 .dev_setup = isa1200_dev_setup,
1815 .power_on = isa1200_power,
1816 .hap_en_gpio = PM_HAP_EN_GPIO,
1817 .hap_len_gpio = PM_HAP_LEN_GPIO,
1818 .max_timeout = 15000,
1819 .mode_ctrl = PWM_GEN_MODE,
1820 .pwm_fd = {
1821 .pwm_div = 256,
1822 },
1823 .is_erm = false,
1824 .smart_en = true,
1825 .ext_clk_en = true,
1826 .chip_en = 1,
1827 .regulator_info = isa1200_reg_data,
1828 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1829};
1830
1831static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1832 {
1833 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
Mohan Pallaka5e490392011-09-09 15:18:41 +05301834 },
1835};
1836
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001837#define CYTTSP_TS_GPIO_IRQ 11
1838#define CYTTSP_TS_SLEEP_GPIO 50
1839#define CYTTSP_TS_RESOUT_N_GPIO 52
1840
1841/*virtual key support */
1842static ssize_t tma340_vkeys_show(struct kobject *kobj,
1843 struct kobj_attribute *attr, char *buf)
1844{
1845 return snprintf(buf, 200,
1846 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1847 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1848 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1849 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1850 "\n");
1851}
1852
1853static struct kobj_attribute tma340_vkeys_attr = {
1854 .attr = {
1855 .mode = S_IRUGO,
1856 },
1857 .show = &tma340_vkeys_show,
1858};
1859
1860static struct attribute *tma340_properties_attrs[] = {
1861 &tma340_vkeys_attr.attr,
1862 NULL
1863};
1864
1865static struct attribute_group tma340_properties_attr_group = {
1866 .attrs = tma340_properties_attrs,
1867};
1868
1869
1870static int cyttsp_platform_init(struct i2c_client *client)
1871{
1872 int rc = 0;
1873 static struct kobject *tma340_properties_kobj;
1874
1875 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1876 tma340_properties_kobj = kobject_create_and_add("board_properties",
1877 NULL);
1878 if (tma340_properties_kobj)
1879 rc = sysfs_create_group(tma340_properties_kobj,
1880 &tma340_properties_attr_group);
1881 if (!tma340_properties_kobj || rc)
1882 pr_err("%s: failed to create board_properties\n",
1883 __func__);
1884
1885 return 0;
1886}
1887
1888static struct cyttsp_regulator regulator_data[] = {
1889 {
1890 .name = "vdd",
1891 .min_uV = CY_TMA300_VTG_MIN_UV,
1892 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301893 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1894 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001895 },
1896 /* TODO: Remove after runtime PM is enabled in I2C driver */
1897 {
1898 .name = "vcc_i2c",
1899 .min_uV = CY_I2C_VTG_MIN_UV,
1900 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301901 .hpm_load_uA = CY_I2C_CURR_UA,
1902 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001903 },
1904};
1905
1906static struct cyttsp_platform_data cyttsp_pdata = {
1907 .panel_maxx = 634,
1908 .panel_maxy = 1166,
1909 .disp_maxx = 616,
1910 .disp_maxy = 1023,
1911 .disp_minx = 0,
1912 .disp_miny = 16,
1913 .flags = 0x01,
1914 .gen = CY_GEN3, /* or */
1915 .use_st = CY_USE_ST,
1916 .use_mt = CY_USE_MT,
1917 .use_hndshk = CY_SEND_HNDSHK,
1918 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05301919 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001920 .use_gestures = CY_USE_GESTURES,
1921 .fw_fname = "cyttsp_8960_cdp.hex",
1922 /* activate up to 4 groups
1923 * and set active distance
1924 */
1925 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
1926 CY_GEST_GRP3 | CY_GEST_GRP4 |
1927 CY_ACT_DIST,
Amy Maloche7b741b22012-06-14 14:37:22 -07001928 .act_intrvl = 10,
1929 .tch_tmout = 200,
1930 .lp_intrvl = 30,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001931 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
1932 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
1933 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1934 .regulator_info = regulator_data,
1935 .num_regulators = ARRAY_SIZE(regulator_data),
1936 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05301937 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001938};
1939
1940static struct i2c_board_info cyttsp_info[] __initdata = {
1941 {
1942 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1943 .platform_data = &cyttsp_pdata,
1944#ifndef CY_USE_TIMER
1945 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1946#endif /* CY_USE_TIMER */
1947 },
1948};
1949
Jing Lindc4413c2012-01-16 15:22:52 -08001950/* configuration data for mxt1386 */
1951static const u8 mxt1386_config_data[] = {
Mohan Pallaka50837382011-09-07 11:00:57 +05301952 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001953 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301954 /* T38 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001955 11, 2, 0, 11, 11, 11, 0, 0, 0, 0,
Jing Lin2f863172011-10-17 10:56:58 -07001956 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1957 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1958 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1959 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1960 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1961 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301962 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001963 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05301964 /* T8 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001965 8, 0, 0, 0, 0, 0, 8, 14, 50, 215,
Mohan Pallaka50837382011-09-07 11:00:57 +05301966 /* T9 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001967 131, 0, 0, 26, 42, 0, 32, 63, 3, 5,
1968 0, 2, 1, 113, 10, 10, 8, 10, 255, 2,
1969 85, 5, 0, 0, 20, 20, 75, 25, 202, 29,
1970 10, 10, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05301971 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001972 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1973 0,
Anirudh Ghayaldab4e0d2012-01-09 14:59:27 +05301974 /* T18 Object */
1975 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301976 /* T22 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001977 5, 0, 0, 0, 0, 0, 0, 0, 30, 0,
1978 0, 0, 5, 8, 10, 13, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301979 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001980 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1981 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301982 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001983 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
1984 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301985 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001986 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301987 /* T28 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001988 0, 0, 0, 8, 12, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05301989 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001990 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301991 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001992 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301993 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001994 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301995};
1996
Jing Lin33b007d2011-12-21 17:40:23 -08001997/* configuration data for mxt1386e using V1.0 firmware */
1998static const u8 mxt1386e_config_data_v1_0[] = {
1999 /* T6 Object */
2000 0, 0, 0, 0, 0, 0,
2001 /* T38 Object */
2002 12, 1, 0, 17, 1, 12, 0, 0, 0, 0,
2003 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2004 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2005 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2006 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2007 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2008 0, 0, 0, 0,
2009 /* T7 Object */
2010 100, 16, 50,
2011 /* T8 Object */
2012 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
2013 /* T9 Object */
2014 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
2015 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
2016 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
2017 10, 5, 0, 0, 0,
2018 /* T18 Object */
2019 0, 0,
2020 /* T24 Object */
2021 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2022 0, 0, 0, 0, 0, 0, 0, 0, 0,
2023 /* T25 Object */
2024 3, 0, 60, 115, 156, 99,
2025 /* T27 Object */
2026 0, 0, 0, 0, 0, 0, 0,
2027 /* T40 Object */
2028 0, 0, 0, 0, 0,
2029 /* T42 Object */
2030 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
2031 /* T43 Object */
2032 0, 0, 0, 0, 0, 0, 0,
2033 /* T46 Object */
2034 64, 0, 20, 20, 0, 0, 0, 0, 0,
2035 /* T47 Object */
2036 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2037 /* T48 Object */
2038 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
2039 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
2040 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
2041 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
2042 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2043 0, 0, 0, 0,
2044 /* T56 Object */
2045 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2046 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2047 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2048 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2049 2, 99, 33,
2050};
2051
2052/* configuration data for mxt1386e using V2.1 firmware */
2053static const u8 mxt1386e_config_data_v2_1[] = {
2054 /* T6 Object */
2055 0, 0, 0, 0, 0, 0,
2056 /* T38 Object */
Jing Lin4a8a3e42012-09-12 10:08:22 -07002057 12, 5, 0, 28, 8, 12, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002058 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2059 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2060 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2061 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2062 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2063 0, 0, 0, 0,
2064 /* T7 Object */
Jing Lin4a8a3e42012-09-12 10:08:22 -07002065 32, 16, 50,
Jing Lin33b007d2011-12-21 17:40:23 -08002066 /* T8 Object */
2067 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
2068 /* T9 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002069 139, 0, 0, 26, 42, 0, 32, 80, 2, 5,
Jing Lina0bc4102012-07-06 17:03:45 -07002070 0, 5, 5, 79, 10, 30, 10, 10, 255, 2,
Jing Lin33b007d2011-12-21 17:40:23 -08002071 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
2072 10, 5, 0, 0, 0,
2073 /* T18 Object */
2074 0, 0,
2075 /* T24 Object */
2076 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2077 0, 0, 0, 0, 0, 0, 0, 0, 0,
2078 /* T25 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002079 1, 0, 60, 115, 156, 99,
Jing Lin33b007d2011-12-21 17:40:23 -08002080 /* T27 Object */
2081 0, 0, 0, 0, 0, 0, 0,
2082 /* T40 Object */
2083 0, 0, 0, 0, 0,
2084 /* T42 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002085 0, 0, 255, 0, 255, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002086 /* T43 Object */
2087 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
2088 16,
2089 /* T46 Object */
Jing Lina0bc4102012-07-06 17:03:45 -07002090 64, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002091 /* T47 Object */
2092 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2093 /* T48 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002094 1, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002095 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
2096 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
2097 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
2098 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2099 0, 0, 0, 0,
2100 /* T56 Object */
2101 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2102 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2103 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2104 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2105 2, 99, 33, 0, 149, 24, 193, 255, 255, 255,
2106 255,
2107};
2108
Jing Lineec88ca2012-02-08 11:18:30 -08002109/* configuration data for mxt1386e on 3D SKU using V2.1 firmware */
2110static const u8 mxt1386e_config_data_3d[] = {
2111 /* T6 Object */
2112 0, 0, 0, 0, 0, 0,
2113 /* T38 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002114 13, 1, 0, 23, 2, 12, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002115 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2116 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2117 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2118 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2119 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2120 0, 0, 0, 0,
2121 /* T7 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002122 100, 10, 50,
Jing Lineec88ca2012-02-08 11:18:30 -08002123 /* T8 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002124 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002125 /* T9 Object */
2126 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
2127 0, 5, 5, 0, 10, 30, 10, 10, 175, 4,
Jing Lin66ba78b2012-02-24 21:25:12 -08002128 127, 7, 26, 21, 17, 19, 143, 35, 207, 40,
2129 20, 5, 54, 49, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002130 /* T18 Object */
2131 0, 0,
2132 /* T24 Object */
2133 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2134 0, 0, 0, 0, 0, 0, 0, 0, 0,
2135 /* T25 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002136 0, 0, 72, 113, 168, 97,
Jing Lineec88ca2012-02-08 11:18:30 -08002137 /* T27 Object */
2138 0, 0, 0, 0, 0, 0, 0,
2139 /* T40 Object */
2140 0, 0, 0, 0, 0,
2141 /* T42 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002142 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002143 /* T43 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002144 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2145 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002146 /* T46 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002147 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002148 /* T47 Object */
2149 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2150 /* T48 Object */
2151 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08002152 32, 50, 0, 10, 10, 0, 0, 100, 10, 90,
2153 0, 0, 0, 0, 0, 0, 0, 10, 1, 30,
2154 52, 10, 5, 0, 33, 0, 1, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002155 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2156 0, 0, 0, 0,
2157 /* T56 Object */
2158 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2159 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2160 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2161 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08002162 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2163 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002164};
2165
Amy Maloche08266db2011-11-04 11:07:16 -07002166#define MXT_TS_GPIO_IRQ 11
2167#define MXT_TS_LDO_EN_GPIO 50
2168#define MXT_TS_RESET_GPIO 52
Mohan Pallaka50837382011-09-07 11:00:57 +05302169
2170static void mxt_init_hw_liquid(void)
2171{
2172 int rc;
2173
Mohan Pallaka50837382011-09-07 11:00:57 +05302174 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
2175 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07002176 pr_err("%s: unable to request mxt_ldo_en_gpio [%d]\n",
2177 __func__, MXT_TS_LDO_EN_GPIO);
2178 return;
Mohan Pallaka50837382011-09-07 11:00:57 +05302179 }
2180
2181 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
2182 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07002183 pr_err("%s: unable to set_direction for mxt_ldo_en_gpio [%d]\n",
2184 __func__, MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05302185 goto err_ldo_gpio_req;
2186 }
2187
Mohan Pallaka50837382011-09-07 11:00:57 +05302188 return;
2189
Mohan Pallaka50837382011-09-07 11:00:57 +05302190err_ldo_gpio_req:
2191 gpio_free(MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05302192}
2193
Jing Lineec88ca2012-02-08 11:18:30 -08002194static struct mxt_config_info mxt_config_array_2d[] = {
Jing Lindc4413c2012-01-16 15:22:52 -08002195 {
2196 .config = mxt1386_config_data,
2197 .config_length = ARRAY_SIZE(mxt1386_config_data),
2198 .family_id = 0xA0,
2199 .variant_id = 0x0,
2200 .version = 0x10,
2201 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002202 .bootldr_id = MXT_BOOTLOADER_ID_1386,
Jing Lindc4413c2012-01-16 15:22:52 -08002203 },
Jing Lin33b007d2011-12-21 17:40:23 -08002204 {
2205 .config = mxt1386e_config_data_v1_0,
2206 .config_length = ARRAY_SIZE(mxt1386e_config_data_v1_0),
2207 .family_id = 0xA0,
2208 .variant_id = 0x2,
2209 .version = 0x10,
2210 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002211 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Linaeaeed52012-03-26 14:57:15 -07002212 .fw_name = "atmel_8960_liquid_v2_2_AA.hex",
Jing Lin33b007d2011-12-21 17:40:23 -08002213 },
2214 {
2215 .config = mxt1386e_config_data_v2_1,
2216 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
2217 .family_id = 0xA0,
2218 .variant_id = 0x7,
2219 .version = 0x21,
2220 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002221 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Linaeaeed52012-03-26 14:57:15 -07002222 .fw_name = "atmel_8960_liquid_v2_2_AA.hex",
2223 },
2224 {
2225 /* The config data for V2.2.AA is the same as for V2.1.AA */
2226 .config = mxt1386e_config_data_v2_1,
2227 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
2228 .family_id = 0xA0,
2229 .variant_id = 0x7,
2230 .version = 0x22,
2231 .build = 0xAA,
2232 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin33b007d2011-12-21 17:40:23 -08002233 },
Jing Lindc4413c2012-01-16 15:22:52 -08002234};
2235
Jing Lineec88ca2012-02-08 11:18:30 -08002236static struct mxt_platform_data mxt_platform_data_2d = {
2237 .config_array = mxt_config_array_2d,
2238 .config_array_size = ARRAY_SIZE(mxt_config_array_2d),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002239 .panel_minx = 0,
2240 .panel_maxx = 1365,
2241 .panel_miny = 0,
2242 .panel_maxy = 767,
2243 .disp_minx = 0,
2244 .disp_maxx = 1365,
2245 .disp_miny = 0,
2246 .disp_maxy = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05302247 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07002248 .i2c_pull_up = true,
Amy Maloche08266db2011-11-04 11:07:16 -07002249 .reset_gpio = MXT_TS_RESET_GPIO,
2250 .irq_gpio = MXT_TS_GPIO_IRQ,
Mohan Pallaka50837382011-09-07 11:00:57 +05302251};
2252
Jing Lineec88ca2012-02-08 11:18:30 -08002253static struct mxt_config_info mxt_config_array_3d[] = {
2254 {
2255 .config = mxt1386e_config_data_3d,
2256 .config_length = ARRAY_SIZE(mxt1386e_config_data_3d),
2257 .family_id = 0xA0,
2258 .variant_id = 0x7,
2259 .version = 0x21,
2260 .build = 0xAA,
2261 },
2262};
2263
2264static struct mxt_platform_data mxt_platform_data_3d = {
2265 .config_array = mxt_config_array_3d,
2266 .config_array_size = ARRAY_SIZE(mxt_config_array_3d),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002267 .panel_minx = 0,
2268 .panel_maxx = 1919,
2269 .panel_miny = 0,
2270 .panel_maxy = 1199,
2271 .disp_minx = 0,
2272 .disp_maxx = 1919,
2273 .disp_miny = 0,
2274 .disp_maxy = 1199,
Jing Lineec88ca2012-02-08 11:18:30 -08002275 .irqflags = IRQF_TRIGGER_FALLING,
2276 .i2c_pull_up = true,
2277 .reset_gpio = MXT_TS_RESET_GPIO,
2278 .irq_gpio = MXT_TS_GPIO_IRQ,
2279};
2280
Mohan Pallaka50837382011-09-07 11:00:57 +05302281static struct i2c_board_info mxt_device_info[] __initdata = {
2282 {
2283 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
Mohan Pallaka50837382011-09-07 11:00:57 +05302284 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
2285 },
2286};
2287
Manoj Rao14648742012-03-30 19:42:12 -07002288static struct msm_mhl_platform_data mhl_platform_data = {
2289 .irq = MSM_GPIO_TO_INT(4),
Manoj Raoc6d904c2012-06-22 00:32:14 -07002290 .gpio_mhl_int = MHL_GPIO_INT,
2291 .gpio_mhl_reset = MHL_GPIO_RESET,
2292 .gpio_mhl_power = 0,
2293 .gpio_hdmi_mhl_mux = 0,
Manoj Rao14648742012-03-30 19:42:12 -07002294};
Manoj Rao14648742012-03-30 19:42:12 -07002295
Eugene Yasmand2316b82011-12-07 18:23:48 +02002296static struct i2c_board_info sii_device_info[] __initdata = {
2297 {
Manoj Rao14648742012-03-30 19:42:12 -07002298#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
2299 /*
2300 * keeps SI 8334 as the default
2301 * MHL TX
2302 */
2303 I2C_BOARD_INFO("sii8334", 0x39),
2304 .platform_data = &mhl_platform_data,
2305#endif
2306#ifdef CONFIG_FB_MSM_HDMI_MHL_9244
Eugene Yasmand2316b82011-12-07 18:23:48 +02002307 I2C_BOARD_INFO("Sil-9244", 0x39),
Eugene Yasmand2316b82011-12-07 18:23:48 +02002308 .irq = MSM_GPIO_TO_INT(15),
Manoj Rao14648742012-03-30 19:42:12 -07002309#endif /* CONFIG_MSM_HDMI_MHL */
2310 .flags = I2C_CLIENT_WAKE,
Eugene Yasmand2316b82011-12-07 18:23:48 +02002311 },
2312};
2313
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002314static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
2315 .clk_freq = 100000,
2316 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002317};
2318
2319static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
2320 .clk_freq = 100000,
2321 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002322};
2323
2324static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
2325 .clk_freq = 100000,
2326 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002327};
2328
2329static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
2330 .clk_freq = 100000,
2331 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002332};
2333
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002334static struct ks8851_pdata spi_eth_pdata = {
2335 .irq_gpio = KS8851_IRQ_GPIO,
2336 .rst_gpio = KS8851_RST_GPIO,
2337};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06002338
Anirudh Ghayal50137fb2012-07-31 16:58:53 +05302339static struct spi_board_info spi_eth_info[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002340 {
2341 .modalias = "ks8851",
2342 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2343 .max_speed_hz = 19200000,
2344 .bus_num = 0,
2345 .chip_select = 0,
2346 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002347 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002348 },
Anirudh Ghayal50137fb2012-07-31 16:58:53 +05302349};
2350static struct spi_board_info spi_board_info[] __initdata = {
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07002351 {
2352 .modalias = "dsi_novatek_3d_panel_spi",
2353 .max_speed_hz = 10800000,
2354 .bus_num = 0,
2355 .chip_select = 1,
2356 .mode = SPI_MODE_0,
2357 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002358};
2359
2360static struct platform_device msm_device_saw_core0 = {
2361 .name = "saw-regulator",
2362 .id = 0,
2363 .dev = {
2364 .platform_data = &msm_saw_regulator_pdata_s5,
2365 },
2366};
2367
2368static struct platform_device msm_device_saw_core1 = {
2369 .name = "saw-regulator",
2370 .id = 1,
2371 .dev = {
2372 .platform_data = &msm_saw_regulator_pdata_s6,
2373 },
2374};
2375
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002376static struct tsens_platform_data msm_tsens_pdata = {
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002377 .slope = {910, 910, 910, 910, 910},
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002378 .tsens_factor = 1000,
2379 .hw_type = MSM_8960,
2380 .tsens_num_sensor = 5,
2381};
2382
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002383static struct platform_device msm_tsens_device = {
2384 .name = "tsens8960-tm",
2385 .id = -1,
2386};
2387
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002388static struct msm_thermal_data msm_thermal_pdata = {
2389 .sensor_id = 0,
Eugene Seah2ee4a5d2012-06-25 18:16:41 -06002390 .poll_ms = 250,
2391 .limit_temp_degC = 60,
2392 .temp_hysteresis_degC = 10,
2393 .freq_step = 2,
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002394};
2395
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002396#ifdef CONFIG_MSM_FAKE_BATTERY
2397static struct platform_device fish_battery_device = {
2398 .name = "fish_battery",
2399};
2400#endif
2401
Binqiang Qiuf165c922012-08-15 18:00:18 -07002402#ifdef CONFIG_BATTERY_BCL
2403static struct platform_device battery_bcl_device = {
2404 .name = "battery_current_limit",
2405 .id = -1,
2406};
2407#endif
2408
David Collins26f05562011-06-20 09:56:28 -07002409static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002410 .name = GPIO_REGULATOR_DEV_NAME,
2411 .id = PM8921_MPP_PM_TO_SYS(7),
2412 .dev = {
2413 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2414 },
2415};
2416
David Collins26f05562011-06-20 09:56:28 -07002417static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002418 .name = GPIO_REGULATOR_DEV_NAME,
2419 .id = 91,
2420 .dev = {
2421 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2422 },
2423};
2424
David Collinsb10be1d2011-09-02 10:29:31 -07002425static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
2426 .name = GPIO_REGULATOR_DEV_NAME,
2427 .id = PM8921_GPIO_PM_TO_SYS(17),
2428 .dev = {
2429 .platform_data =
2430 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2431 },
2432};
2433
David Collins35a78f52011-12-14 15:54:25 -08002434static struct platform_device msm8960_device_ext_otg_sw_vreg __devinitdata = {
2435 .name = GPIO_REGULATOR_DEV_NAME,
2436 .id = PM8921_GPIO_PM_TO_SYS(42),
2437 .dev = {
2438 .platform_data =
2439 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_OTG_SW],
2440 },
2441};
2442
David Collins26f05562011-06-20 09:56:28 -07002443static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
2444 .name = "rpm-regulator",
2445 .id = -1,
2446 .dev = {
2447 .platform_data = &msm_rpm_regulator_pdata,
2448 },
2449};
Mayank Ranae009c922012-03-22 03:02:06 +05302450#ifdef CONFIG_SERIAL_MSM_HS
2451static int configure_uart_gpios(int on)
2452{
2453 int ret = 0, i;
2454 int uart_gpios[] = {93, 94, 95, 96};
2455
2456 for (i = 0; i < ARRAY_SIZE(uart_gpios); i++) {
2457 if (on) {
2458 ret = gpio_request(uart_gpios[i], NULL);
2459 if (ret) {
2460 pr_err("%s: unable to request uart gpio[%d]\n",
2461 __func__, uart_gpios[i]);
2462 break;
2463 }
2464 } else {
2465 gpio_free(uart_gpios[i]);
2466 }
2467 }
2468
2469 if (ret && on && i)
2470 for (; i >= 0; i--)
2471 gpio_free(uart_gpios[i]);
2472 return ret;
2473}
2474
2475static struct msm_serial_hs_platform_data msm_uart_dm9_pdata = {
Mayank Ranad85a5082012-04-29 17:24:13 -07002476 .gpio_config = configure_uart_gpios,
Mayank Ranae009c922012-03-22 03:02:06 +05302477};
Mayank Rana1f02d952012-07-04 19:11:20 +05302478
2479static int configure_gsbi8_uart_gpios(int on)
2480{
2481 int ret = 0, i;
2482 int uart_gpios[] = {34, 35, 36, 37};
2483
2484 for (i = 0; i < ARRAY_SIZE(uart_gpios); i++) {
2485 if (on) {
2486 ret = gpio_request(uart_gpios[i], NULL);
2487 if (ret) {
2488 pr_err("%s: unable to request uart gpio[%d]\n",
2489 __func__, uart_gpios[i]);
2490 break;
2491 }
2492 } else {
2493 gpio_free(uart_gpios[i]);
2494 }
2495 }
2496
2497 if (ret && on && i)
2498 for (; i >= 0; i--)
2499 gpio_free(uart_gpios[i]);
2500 return ret;
2501}
2502
2503static struct msm_serial_hs_platform_data msm_uart_dm8_pdata = {
2504 .gpio_config = configure_gsbi8_uart_gpios,
2505};
Mayank Ranae009c922012-03-22 03:02:06 +05302506#else
Mayank Rana1f02d952012-07-04 19:11:20 +05302507static struct msm_serial_hs_platform_data msm_uart_dm8_pdata;
Mayank Ranae009c922012-03-22 03:02:06 +05302508static struct msm_serial_hs_platform_data msm_uart_dm9_pdata;
2509#endif
David Collins26f05562011-06-20 09:56:28 -07002510
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302511#if defined(CONFIG_BT) && defined(CONFIG_BT_HCIUART_ATH3K)
Ming-yi Lin9baad172012-10-17 11:50:15 +08002512enum WLANBT_STATUS {
2513 WLANOFF_BTOFF = 1,
2514 WLANOFF_BTON,
2515 WLANON_BTOFF,
2516 WLANON_BTON
2517};
2518
2519static DEFINE_MUTEX(ath_wlanbt_mutex);
2520static int gpio_wlan_sys_rest_en = 26;
2521static int ath_wlanbt_status = WLANOFF_BTOFF;
2522
2523static int ath6kl_power_control(int on)
2524{
2525 int rc;
2526
2527 if (on) {
2528 rc = gpio_request(gpio_wlan_sys_rest_en, "wlan sys_rst_n");
2529 if (rc) {
2530 pr_err("%s: unable to request gpio %d (%d)\n",
2531 __func__, gpio_wlan_sys_rest_en, rc);
2532 return rc;
2533 }
2534 rc = gpio_direction_output(gpio_wlan_sys_rest_en, 0);
2535 msleep(200);
2536 rc = gpio_direction_output(gpio_wlan_sys_rest_en, 1);
2537 msleep(100);
2538 } else {
2539 gpio_set_value(gpio_wlan_sys_rest_en, 0);
2540 rc = gpio_direction_input(gpio_wlan_sys_rest_en);
2541 msleep(100);
2542 gpio_free(gpio_wlan_sys_rest_en);
2543 }
2544 return 0;
2545};
2546
2547static int ath6kl_wlan_power(int on)
2548{
2549 int ret = 0;
2550
2551 mutex_lock(&ath_wlanbt_mutex);
2552 if (on) {
2553 if (ath_wlanbt_status == WLANOFF_BTOFF) {
2554 ret = ath6kl_power_control(1);
2555 ath_wlanbt_status = WLANON_BTOFF;
2556 } else if (ath_wlanbt_status == WLANOFF_BTON)
2557 ath_wlanbt_status = WLANON_BTON;
2558 } else {
2559 if (ath_wlanbt_status == WLANON_BTOFF) {
2560 ret = ath6kl_power_control(0);
2561 ath_wlanbt_status = WLANOFF_BTOFF;
2562 } else if (ath_wlanbt_status == WLANON_BTON)
2563 ath_wlanbt_status = WLANOFF_BTON;
2564 }
2565 mutex_unlock(&ath_wlanbt_mutex);
2566 pr_debug("%s on= %d, wlan_status= %d\n",
2567 __func__, on, ath_wlanbt_status);
2568 return ret;
2569};
2570
2571static struct wifi_platform_data ath6kl_wifi_control = {
2572 .set_power = ath6kl_wlan_power,
2573};
2574
2575static struct platform_device msm_wlan_power_device = {
2576 .name = "ath6kl_power",
2577 .dev = {
2578 .platform_data = &ath6kl_wifi_control,
2579 },
2580};
2581
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302582static struct resource bluesleep_resources[] = {
2583 {
2584 .name = "gpio_host_wake",
2585 .start = 27,
2586 .end = 27,
2587 .flags = IORESOURCE_IO,
2588 },
2589 {
2590 .name = "gpio_ext_wake",
2591 .start = 29,
2592 .end = 29,
2593 .flags = IORESOURCE_IO,
2594 },
2595 {
2596 .name = "host_wake",
2597 .start = MSM_GPIO_TO_INT(27),
2598 .end = MSM_GPIO_TO_INT(27),
2599 .flags = IORESOURCE_IRQ,
2600 },
2601};
2602
2603static struct platform_device msm_bluesleep_device = {
2604 .name = "bluesleep",
2605 .id = -1,
2606 .num_resources = ARRAY_SIZE(bluesleep_resources),
2607 .resource = bluesleep_resources,
2608};
2609
2610static struct platform_device msm_bt_power_device = {
2611 .name = "bt_power",
2612};
2613
Ming-yi Lin9baad172012-10-17 11:50:15 +08002614static int gpio_bt_sys_rest_en = 28;
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302615
2616static int bluetooth_power(int on)
2617{
2618 int rc;
2619
Ming-yi Lin9baad172012-10-17 11:50:15 +08002620 mutex_lock(&ath_wlanbt_mutex);
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302621 if (on) {
Ming-yi Lin9baad172012-10-17 11:50:15 +08002622 if (ath_wlanbt_status == WLANOFF_BTOFF) {
2623 ath6kl_power_control(1);
2624 ath_wlanbt_status = WLANOFF_BTON;
2625 } else if (ath_wlanbt_status == WLANON_BTOFF)
2626 ath_wlanbt_status = WLANON_BTON;
2627
Ram Mohan Korukondac4cfb692012-08-18 22:24:03 +05302628 rc = gpio_request(gpio_bt_sys_rest_en, "bt sys_rst_n");
2629 if (rc) {
2630 pr_err("%s: unable to request gpio %d (%d)\n",
2631 __func__, gpio_bt_sys_rest_en, rc);
Ming-yi Lin9baad172012-10-17 11:50:15 +08002632 mutex_unlock(&ath_wlanbt_mutex);
2633 return rc;
Ram Mohan Korukondac4cfb692012-08-18 22:24:03 +05302634 }
2635 rc = gpio_direction_output(gpio_bt_sys_rest_en, 0);
Ming-yi Lin9baad172012-10-17 11:50:15 +08002636 msleep(20);
2637 rc = gpio_direction_output(gpio_bt_sys_rest_en, 1);
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302638 msleep(100);
2639 } else {
2640 gpio_set_value(gpio_bt_sys_rest_en, 0);
2641 rc = gpio_direction_input(gpio_bt_sys_rest_en);
2642 msleep(100);
Ming-yi Lin9baad172012-10-17 11:50:15 +08002643 gpio_free(gpio_bt_sys_rest_en);
Ram Mohan Korukondac4cfb692012-08-18 22:24:03 +05302644
Ming-yi Lin9baad172012-10-17 11:50:15 +08002645 if (ath_wlanbt_status == WLANOFF_BTON) {
2646 ath6kl_power_control(0);
2647 ath_wlanbt_status = WLANOFF_BTOFF;
2648 } else if (ath_wlanbt_status == WLANON_BTON)
2649 ath_wlanbt_status = WLANON_BTOFF;
2650 }
2651 mutex_unlock(&ath_wlanbt_mutex);
2652 pr_debug("%s on= %d, wlan_status= %d\n",
2653 __func__, on, ath_wlanbt_status);
2654 return 0;
2655};
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302656
2657static void __init bt_power_init(void)
2658{
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302659 msm_bt_power_device.dev.platform_data = &bluetooth_power;
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302660 return;
Ming-yi Lin9baad172012-10-17 11:50:15 +08002661};
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302662#else
2663#define bt_power_init(x) do {} while (0)
2664#endif
2665
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002666static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07002667 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002668 &msm_device_smd,
Mayank Rana9f51f582011-08-04 18:35:59 +05302669 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002670 &msm_device_saw_core0,
2671 &msm_device_saw_core1,
2672 &msm8960_device_ext_5v_vreg,
David Collins87579612012-01-30 16:00:15 -08002673 &msm8960_device_ssbi_pmic,
David Collins96aa3e12012-02-29 10:31:34 -08002674 &msm8960_device_ext_otg_sw_vreg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002675 &msm8960_device_qup_spi_gsbi1,
2676 &msm8960_device_qup_i2c_gsbi3,
2677 &msm8960_device_qup_i2c_gsbi4,
2678 &msm8960_device_qup_i2c_gsbi10,
2679#ifndef CONFIG_MSM_DSPS
2680 &msm8960_device_qup_i2c_gsbi12,
2681#endif
2682 &msm_slim_ctrl,
2683 &msm_device_wcnss_wlan,
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302684#if defined(CONFIG_BT) && defined(CONFIG_BT_HCIUART_ATH3K)
2685 &msm_bluesleep_device,
2686 &msm_bt_power_device,
Ming-yi Lin9baad172012-10-17 11:50:15 +08002687 &msm_wlan_power_device,
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302688#endif
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002689#if defined(CONFIG_QSEECOM)
2690 &qseecom_device,
2691#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002692#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2693 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2694 &qcrypto_device,
2695#endif
2696
2697#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2698 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2699 &qcedev_device,
2700#endif
2701#ifdef CONFIG_MSM_ROTATOR
2702 &msm_rotator_device,
2703#endif
2704 &msm_device_sps,
2705#ifdef CONFIG_MSM_FAKE_BATTERY
2706 &fish_battery_device,
2707#endif
Binqiang Qiuf165c922012-08-15 18:00:18 -07002708#ifdef CONFIG_BATTERY_BCL
2709 &battery_bcl_device,
2710#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002711 &msm_device_bam_dmux,
2712 &msm_fm_platform_init,
Joel Nidera1261942011-09-12 16:30:09 +03002713#if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE)
2714#ifdef CONFIG_MSM_USE_TSIF1
2715 &msm_device_tsif[1],
2716#else
2717 &msm_device_tsif[0],
2718#endif
2719#endif
Joel Nider266a2642011-10-16 10:58:05 +02002720 &msm_device_tspp,
Mona Hossain9c430e32011-07-27 11:04:47 -07002721#ifdef CONFIG_HW_RANDOM_MSM
2722 &msm_device_rng,
2723#endif
Laura Abbottd6183792011-08-19 13:42:24 -07002724#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002725 &msm8960_ion_dev,
Laura Abbottd6183792011-08-19 13:42:24 -07002726#endif
Praveen Chidambaram78499012011-11-01 17:15:17 -06002727 &msm8960_rpm_device,
2728 &msm8960_rpm_log_device,
2729 &msm8960_rpm_stat_device,
Anji Jonnala93129922012-10-09 20:57:53 +05302730 &msm8960_rpm_master_stat_device,
Mona Hossain11c03ac2011-10-26 12:42:10 -07002731 &msm_device_tz_log,
Pratik Patel3b0ca882012-06-01 16:54:14 -07002732 &coresight_tpiu_device,
2733 &coresight_etb_device,
2734 &coresight_funnel_device,
2735 &coresight_etm0_device,
2736 &coresight_etm1_device,
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07002737 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002738 &msm8960_device_watchdog,
Laura Abbottb93525f2012-04-12 09:57:19 -07002739 &msm8960_rtb_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002740 &msm8960_device_cache_erp,
Stepan Moskovchenkoc0557252012-06-07 17:39:14 -07002741 &msm8960_device_ebi1_ch0_erp,
2742 &msm8960_device_ebi1_ch1_erp,
Laura Abbottb93525f2012-04-12 09:57:19 -07002743 &msm8960_cache_dump_device,
Laura Abbott0577d7b2012-04-17 11:14:30 -07002744 &msm8960_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002745 &msm_tsens_device,
Anji Jonnalaf91d8972013-02-26 17:55:50 +05302746 &msm8960_cpu_slp_status,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002747};
2748
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002749static struct platform_device *cdp_devices[] __initdata = {
Stephen Boydeb819882011-08-29 14:46:30 -07002750 &msm_8960_q6_lpass,
Stephen Boyd322a9922011-09-20 01:05:54 -07002751 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07002752 &msm_pil_tzapps,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07002753 &msm_pil_dsps,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002754 &msm_pil_vidc,
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002755 &msm8960_device_otg,
2756 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002757 &msm_device_hsusb_host,
2758 &android_usb_device,
2759 &msm_pcm,
Kiran Kandi5e809b02012-01-31 00:24:33 -08002760 &msm_multi_ch_pcm,
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -07002761 &msm_lowlatency_pcm,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002762 &msm_pcm_routing,
2763 &msm_cpudai0,
2764 &msm_cpudai1,
Kiran Kandi97fe19d2012-05-20 22:34:04 -07002765 &msm8960_cpudai_slimbus_2_rx,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002766 &msm8960_cpudai_slimbus_2_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002767 &msm_cpudai_hdmi_rx,
2768 &msm_cpudai_bt_rx,
2769 &msm_cpudai_bt_tx,
2770 &msm_cpudai_fm_rx,
2771 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002772 &msm_cpudai_auxpcm_rx,
2773 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002774 &msm_cpu_fe,
2775 &msm_stub_codec,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002776#ifdef CONFIG_MSM_GEMINI
2777 &msm8960_gemini_device,
2778#endif
Kalyani Oruganti465d1e12012-05-15 10:23:05 -07002779#ifdef CONFIG_MSM_MERCURY
2780 &msm8960_mercury_device,
2781#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002782 &msm_voice,
2783 &msm_voip,
2784 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05302785 &msm_cpudai_afe_01_rx,
2786 &msm_cpudai_afe_01_tx,
2787 &msm_cpudai_afe_02_rx,
2788 &msm_cpudai_afe_02_tx,
2789 &msm_pcm_afe,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05302790 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07002791 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07002792 &msm_cpudai_incall_record_rx,
2793 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002794 &msm_pcm_hostless,
2795 &msm_bus_apps_fabric,
2796 &msm_bus_sys_fabric,
2797 &msm_bus_mm_fabric,
2798 &msm_bus_sys_fpb,
2799 &msm_bus_cpss_fpb,
2800};
2801
2802static void __init msm8960_i2c_init(void)
2803{
Kiran Gundaaf3b3562012-08-31 14:00:05 +05302804 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
2805 msm8960_i2c_qup_gsbi4_pdata.keep_ahb_clk_on = 1;
2806
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002807 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2808 &msm8960_i2c_qup_gsbi4_pdata;
2809
2810 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2811 &msm8960_i2c_qup_gsbi3_pdata;
2812
2813 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2814 &msm8960_i2c_qup_gsbi10_pdata;
2815
2816 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2817 &msm8960_i2c_qup_gsbi12_pdata;
2818}
2819
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002820static void __init msm8960_gfx_init(void)
2821{
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002822 struct kgsl_device_platform_data *kgsl_3d0_pdata =
2823 msm_kgsl_3d0.dev.platform_data;
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06002824 uint32_t soc_platform_version = socinfo_get_version();
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002825
Carter Coopera4a7ed22012-08-20 22:11:42 -06002826 /* Fixup data that needs to change based on GPU ID */
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002827 if (cpu_is_msm8960ab()) {
Hareesh Gunduec2f1d82013-02-20 20:16:11 +05302828 if (SOCINFO_VERSION_MINOR(soc_platform_version) == 0)
2829 kgsl_3d0_pdata->chipid = ADRENO_CHIPID(3, 2, 1, 0);
2830 else
2831 kgsl_3d0_pdata->chipid = ADRENO_CHIPID(3, 2, 1, 1);
Suman Tatiraju03a95db2012-10-29 18:24:53 -07002832 /* 8960PRO nominal clock rate is 320Mhz */
2833 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 320000000;
Lucille Sylvester0a82ff22012-12-06 14:10:19 -07002834#ifdef CONFIG_MSM_BUS_SCALING
2835 kgsl_3d0_pdata->bus_scale_table = &grp3d_bus_scale_pdata_ab;
2836#endif
Harsh Vardhan Dwivedi623b9a22012-10-28 20:54:17 -06002837
2838 /*
2839 * If this an A320 GPU device (MSM8960AB), then
2840 * switch the resource table to 8960AB, to reflect the
2841 * separate register and shader memory mapping used in A320.
2842 */
2843
2844 msm_kgsl_3d0.num_resources = kgsl_num_resources_8960ab;
2845 msm_kgsl_3d0.resource = kgsl_3d0_resources_8960ab;
Carter Coopera4a7ed22012-08-20 22:11:42 -06002846 } else {
2847 kgsl_3d0_pdata->iommu_count = 1;
Harsh Vardhan Dwivedi623b9a22012-10-28 20:54:17 -06002848
Carter Coopera4a7ed22012-08-20 22:11:42 -06002849 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
2850 kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
2851 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
2852 }
2853 if (SOCINFO_VERSION_MAJOR(soc_platform_version) >= 3) {
2854 /* 8960v3 GPU registers returns 5 for patch release
2855 * but it should be 6, so dummy up the chipid here
2856 * based the platform type
2857 */
2858 kgsl_3d0_pdata->chipid = ADRENO_CHIPID(2, 2, 0, 6);
2859 }
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002860 }
Carter Cooper83e9dab2012-08-20 15:17:23 -06002861
2862 /* Register the 3D core */
2863 platform_device_register(&msm_kgsl_3d0);
2864
2865 /* Register the 2D cores if we are not 8960PRO */
2866 if (!cpu_is_msm8960ab()) {
2867 platform_device_register(&msm_kgsl_2d0);
2868 platform_device_register(&msm_kgsl_2d1);
2869 }
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002870}
2871
Subhash Jadavani933e6a62011-12-26 18:05:04 +05302872static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002873 {
2874 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2875 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2876 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002877 1, 784, 180000, 100,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002878 },
2879
2880 {
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002881 MSM_PM_SLEEP_MODE_RETENTION,
2882 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2883 true,
2884 415, 715, 340827, 475,
2885 },
2886
2887 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002888 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2889 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2890 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002891 1300, 228, 1200000, 2000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002892 },
2893
2894 {
2895 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2896 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2897 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002898 2000, 138, 1208400, 3200,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002899 },
2900
2901 {
2902 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06002903 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2904 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002905 6000, 119, 1850300, 9000,
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06002906 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002907
2908 {
2909 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2910 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2911 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002912 9200, 68, 2839200, 16400,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002913 },
2914
2915 {
2916 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2917 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2918 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002919 10300, 63, 3128000, 18200,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002920 },
2921
2922 {
2923 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2924 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2925 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002926 18000, 10, 4602600, 27000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002927 },
2928
2929 {
2930 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2931 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2932 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002933 20000, 2, 5752000, 32000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002934 },
2935};
2936
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002937
Praveen Chidambaram78499012011-11-01 17:15:17 -06002938static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2939 .levels = &msm_rpmrs_levels[0],
2940 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2941 .vdd_mem_levels = {
2942 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2943 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2944 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2945 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2946 },
2947 .vdd_dig_levels = {
2948 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
2949 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
2950 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
2951 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
2952 },
2953 .vdd_mask = 0x7FFFFF,
2954 .rpmrs_target_id = {
2955 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2956 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
2957 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
2958 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
2959 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
2960 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
2961 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2962 },
2963};
2964
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002965static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2966 .mode = MSM_PM_BOOT_CONFIG_TZ,
2967};
2968
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002969#ifdef CONFIG_I2C
2970#define I2C_SURF 1
2971#define I2C_FFA (1 << 1)
2972#define I2C_RUMI (1 << 2)
2973#define I2C_SIM (1 << 3)
2974#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03002975#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002976
2977struct i2c_registry {
2978 u8 machs;
2979 int bus;
2980 struct i2c_board_info *info;
2981 int len;
2982};
2983
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002984/* Sensors DSPS platform data */
2985#ifdef CONFIG_MSM_DSPS
2986#define DSPS_PIL_GENERIC_NAME "dsps"
2987#endif /* CONFIG_MSM_DSPS */
2988
2989static void __init msm8960_init_dsps(void)
2990{
2991#ifdef CONFIG_MSM_DSPS
2992 struct msm_dsps_platform_data *pdata =
2993 msm_dsps_device.dev.platform_data;
2994 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
2995 pdata->gpios = NULL;
2996 pdata->gpios_num = 0;
2997
2998 platform_device_register(&msm_dsps_device);
2999#endif /* CONFIG_MSM_DSPS */
3000}
3001
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -08003002static int hsic_peripheral_status = 1;
3003static DEFINE_MUTEX(hsic_status_lock);
3004
3005void peripheral_connect()
3006{
3007 mutex_lock(&hsic_status_lock);
3008 if (hsic_peripheral_status)
3009 goto out;
3010 platform_device_add(&msm_device_hsic_host);
3011 hsic_peripheral_status = 1;
3012out:
3013 mutex_unlock(&hsic_status_lock);
3014}
3015EXPORT_SYMBOL(peripheral_connect);
3016
3017void peripheral_disconnect()
3018{
3019 mutex_lock(&hsic_status_lock);
3020 if (!hsic_peripheral_status)
3021 goto out;
3022 platform_device_del(&msm_device_hsic_host);
3023 hsic_peripheral_status = 0;
3024out:
3025 mutex_unlock(&hsic_status_lock);
3026}
3027EXPORT_SYMBOL(peripheral_disconnect);
3028
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303029static void __init msm8960_init_smsc_hub(void)
3030{
3031 uint32_t version = socinfo_get_version();
3032
3033 if (SOCINFO_VERSION_MAJOR(version) == 1)
3034 return;
3035
3036 if (machine_is_msm8960_liquid())
3037 platform_device_register(&smsc_hub_device);
3038}
3039
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003040static void __init msm8960_init_hsic(void)
3041{
3042#ifdef CONFIG_USB_EHCI_MSM_HSIC
3043 uint32_t version = socinfo_get_version();
3044
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08003045 if (SOCINFO_VERSION_MAJOR(version) == 1)
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003046 return;
3047
Joel King0cbf5d82012-05-24 15:21:38 -07003048 if (machine_is_msm8960_liquid())
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08003049 platform_device_register(&msm_device_hsic_host);
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003050#endif
3051}
3052
Amir Samuelov5137e392011-09-21 17:31:25 +03003053#ifdef CONFIG_ISL9519_CHARGER
3054static struct isl_platform_data isl_data __initdata = {
3055 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
3056 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
3057 .max_system_voltage = 4200,
3058 .min_system_voltage = 3200,
Amir Samuelov95f49ff2012-01-29 09:14:08 +02003059 .chgcurrent = 1900,
3060 .term_current = 0,
Amir Samuelov5137e392011-09-21 17:31:25 +03003061 .input_current = 2048,
3062};
3063
3064static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
3065 {
3066 I2C_BOARD_INFO("isl9519q", 0x9),
3067 .irq = 0, /* Not required when notify-by-pmic */
3068 .platform_data = &isl_data,
3069 },
3070};
3071#endif /* CONFIG_ISL9519_CHARGER */
3072
Amir Samuelov755616d2011-12-13 16:34:46 +02003073static struct i2c_board_info liquid_io_expander_i2c_info[] __initdata = {
3074 {
3075 I2C_BOARD_INFO("sx1508q", 0x20),
3076 .platform_data = &msm8960_sx150x_data[SX150X_LIQUID]
3077 },
3078};
3079
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003080static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Amir Samuelov5137e392011-09-21 17:31:25 +03003081#ifdef CONFIG_ISL9519_CHARGER
3082 {
3083 I2C_LIQUID,
3084 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
3085 isl_charger_i2c_info,
3086 ARRAY_SIZE(isl_charger_i2c_info),
3087 },
3088#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003089 {
3090 I2C_SURF | I2C_FFA | I2C_FLUID,
3091 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3092 cyttsp_info,
3093 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07003094 },
Mohan Pallaka50837382011-09-07 11:00:57 +05303095 {
3096 I2C_LIQUID,
3097 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3098 mxt_device_info,
3099 ARRAY_SIZE(mxt_device_info),
3100 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05303101 {
Manoj Rao14648742012-03-30 19:42:12 -07003102 I2C_SURF | I2C_FFA | I2C_LIQUID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05303103 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Eugene Yasmand2316b82011-12-07 18:23:48 +02003104 sii_device_info,
3105 ARRAY_SIZE(sii_device_info),
3106 },
3107 {
Anirudh Ghayal15698162012-07-31 11:51:32 +05303108 I2C_LIQUID | I2C_FFA,
Eugene Yasmand2316b82011-12-07 18:23:48 +02003109 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05303110 msm_isa1200_board_info,
3111 ARRAY_SIZE(msm_isa1200_board_info),
3112 },
Amir Samuelov755616d2011-12-13 16:34:46 +02003113 {
3114 I2C_LIQUID,
3115 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
3116 liquid_io_expander_i2c_info,
3117 ARRAY_SIZE(liquid_io_expander_i2c_info),
3118 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003119};
3120#endif /* CONFIG_I2C */
3121
3122static void __init register_i2c_devices(void)
3123{
3124#ifdef CONFIG_I2C
3125 u8 mach_mask = 0;
3126 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08003127#ifdef CONFIG_MSM_CAMERA
3128 struct i2c_registry msm8960_camera_i2c_devices = {
3129 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
3130 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
3131 msm8960_camera_board_info.board_info,
3132 msm8960_camera_board_info.num_i2c_board_info,
3133 };
3134#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003135
3136 /* Build the matching 'supported_machs' bitmask */
3137 if (machine_is_msm8960_cdp())
3138 mach_mask = I2C_SURF;
Amy Maloche2d028032011-07-20 14:08:06 -07003139 else if (machine_is_msm8960_fluid())
3140 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03003141 else if (machine_is_msm8960_liquid())
3142 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07003143 else if (machine_is_msm8960_mtp())
3144 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003145 else
3146 pr_err("unmatched machine ID in register_i2c_devices\n");
3147
Jing Lineec88ca2012-02-08 11:18:30 -08003148 if (machine_is_msm8960_liquid()) {
3149 if (SOCINFO_VERSION_MAJOR(socinfo_get_platform_version()) == 3)
3150 mxt_device_info[0].platform_data =
3151 &mxt_platform_data_3d;
3152 else
3153 mxt_device_info[0].platform_data =
3154 &mxt_platform_data_2d;
3155 }
3156
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003157 /* Run the array and install devices as appropriate */
3158 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
3159 if (msm8960_i2c_devices[i].machs & mach_mask)
3160 i2c_register_board_info(msm8960_i2c_devices[i].bus,
3161 msm8960_i2c_devices[i].info,
3162 msm8960_i2c_devices[i].len);
3163 }
Manoj Raoc6d904c2012-06-22 00:32:14 -07003164
3165 if (!mhl_platform_data.gpio_mhl_power)
3166 pr_debug("mhl device configured for ext debug board\n");
3167
Kevin Chan09f4e662011-12-16 08:17:02 -08003168#ifdef CONFIG_MSM_CAMERA
3169 if (msm8960_camera_i2c_devices.machs & mach_mask)
3170 i2c_register_board_info(msm8960_camera_i2c_devices.bus,
3171 msm8960_camera_i2c_devices.info,
3172 msm8960_camera_i2c_devices.len);
3173#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003174#endif
3175}
3176
Siddartha Mohanadoss30447fe2012-09-26 09:42:32 -07003177static void __init msm8960_tsens_init(void)
3178{
3179 if (cpu_is_msm8960())
3180 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) == 1)
3181 return;
3182
3183 msm_tsens_early_init(&msm_tsens_pdata);
3184}
3185
Praveen Chidambaramc3c90822012-11-07 15:43:49 -07003186static void __init msm8960ab_update_krait_spm(void)
Mahesh Sivasubramanianc5c82f42012-10-22 13:33:59 -06003187{
3188 int i;
3189
Praveen Chidambaramc3c90822012-11-07 15:43:49 -07003190 /* Update the SPM sequences for SPC and PC */
3191 for (i = 0; i < ARRAY_SIZE(msm_spm_data); i++) {
3192 int j;
3193 struct msm_spm_platform_data *pdata = &msm_spm_data[i];
3194 for (j = 0; j < pdata->num_modes; j++) {
3195 if (pdata->modes[j].cmd ==
3196 spm_power_collapse_without_rpm)
3197 pdata->modes[j].cmd =
3198 spm_power_collapse_without_rpm_krait_v3;
3199 else if (pdata->modes[j].cmd ==
3200 spm_power_collapse_with_rpm)
3201 pdata->modes[j].cmd =
3202 spm_power_collapse_with_rpm_krait_v3;
3203 }
3204 }
Mahesh Sivasubramanianc5c82f42012-10-22 13:33:59 -06003205}
3206
Anji Jonnala1a1711a2013-01-29 13:34:10 +05303207static void __init msm8960ab_update_retention_spm(void)
3208{
3209 int i;
3210
3211 /* Update the SPM sequences for krait retention on all cores */
3212 for (i = 0; i < ARRAY_SIZE(msm_spm_data); i++) {
3213 int j;
3214 struct msm_spm_platform_data *pdata = &msm_spm_data[i];
3215 for (j = 0; j < pdata->num_modes; j++) {
3216 if (pdata->modes[j].cmd ==
3217 spm_retention_cmd_sequence)
3218 pdata->modes[j].cmd =
3219 spm_retention_with_krait_v3_cmd_sequence;
3220 }
3221 }
3222}
3223
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003224static void __init msm8960_cdp_init(void)
3225{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07003226 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
3227 pr_err("meminfo_init() failed!\n");
3228
Rohit Vaswanib1cc4932012-07-23 21:30:11 -07003229 platform_device_register(&msm_gpio_device);
Siddartha Mohanadoss30447fe2012-09-26 09:42:32 -07003230 msm8960_tsens_init();
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06003231 msm_thermal_init(&msm_thermal_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06003232 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
3233 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07003234
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003235 regulator_suppress_info_printing();
3236 if (msm_xo_init())
3237 pr_err("Failed to initialize XO votes\n");
David Collinse68647e2012-09-04 15:44:19 -07003238 configure_msm8960_power_grid();
David Collins26f05562011-06-20 09:56:28 -07003239 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07003240 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05303241 if (machine_is_msm8960_liquid())
3242 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003243 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05303244 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
3245 machine_is_msm8960_cdp()) {
Mayank Ranaa61da7a2012-08-14 10:57:00 +05303246 /* Due to availability of USB Switch in SGLTE Platform
3247 * it requires different HSUSB PHY settings compare to
3248 * 8960 MTP/CDP platform.
3249 */
3250 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
3251 msm_otg_pdata.phy_init_seq = sglte_phy_init_seq;
3252 else
3253 msm_otg_pdata.phy_init_seq = wr_phy_init_seq;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05303254 } else if (machine_is_msm8960_liquid()) {
3255 msm_otg_pdata.phy_init_seq =
3256 liquid_v1_phy_init_seq;
3257 }
Ofir Cohen94213a72012-05-03 14:26:32 +03003258 android_usb_pdata.swfi_latency =
Anji jonnalaa7c1c5c2011-12-12 12:20:36 +05303259 msm_rpmrs_levels[0].latency_us;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303260 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303261 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2 &&
3262 machine_is_msm8960_liquid())
3263 msm_device_hsic_host.dev.parent = &smsc_hub_device.dev;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08003264 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003265 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3266 &msm8960_qup_spi_gsbi1_pdata;
3267 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Anirudh Ghayal50137fb2012-07-31 16:58:53 +05303268 if (socinfo_get_platform_subtype() != PLATFORM_SUBTYPE_SGLTE)
3269 spi_register_board_info(spi_eth_info, ARRAY_SIZE(spi_eth_info));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003270
3271 msm8960_init_pmic();
Anirudh Ghayal15698162012-07-31 11:51:32 +05303272 if (machine_is_msm8960_liquid() || (machine_is_msm8960_mtp() &&
Shantanu Jainae54a622012-12-03 15:09:39 +05303273 (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE ||
3274 cpu_is_msm8960ab())))
Mohan Pallakaf69f0492011-11-21 13:08:33 +05303275 msm_isa1200_board_info[0].platform_data = &isa1200_1_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003276 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003277 msm8960_gfx_init();
Mahesh Sivasubramanianc5c82f42012-10-22 13:33:59 -06003278
3279 if (cpu_is_msm8960ab())
Praveen Chidambaramc3c90822012-11-07 15:43:49 -07003280 msm8960ab_update_krait_spm();
Anji Jonnala1a1711a2013-01-29 13:34:10 +05303281 if (cpu_is_krait_v3()) {
Praveen Chidambaramf27a5152013-02-01 11:44:53 -07003282 struct msm_pm_init_data_type *pdata =
3283 msm8960_pm_8x60.dev.platform_data;
3284 pdata->retention_calls_tz = false;
Anji Jonnala1a1711a2013-01-29 13:34:10 +05303285 msm8960ab_update_retention_spm();
Anji Jonnala1a1711a2013-01-29 13:34:10 +05303286 }
Praveen Chidambaramf27a5152013-02-01 11:44:53 -07003287 platform_device_register(&msm8960_pm_8x60);
3288
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003289 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3290 msm_spm_l2_init(msm_spm_l2_data);
Mahesh Sivasubramanianc5c82f42012-10-22 13:33:59 -06003291
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003292 msm8960_init_buses();
Stephen Boyd913c29d2012-10-25 11:46:04 -07003293 if (cpu_is_msm8960ab()) {
3294 platform_add_devices(msm8960ab_footswitch,
3295 msm8960ab_num_footswitch);
3296 } else {
3297 platform_add_devices(msm8960_footswitch,
3298 msm8960_num_footswitch);
3299 }
David Collinsb10be1d2011-09-02 10:29:31 -07003300 if (machine_is_msm8960_liquid())
3301 platform_device_register(&msm8960_device_ext_3p3v_vreg);
David Collinsd5a40732011-11-29 15:53:56 -08003302 if (machine_is_msm8960_cdp())
3303 platform_device_register(&msm8960_device_ext_l2_vreg);
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07003304
3305 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
3306 platform_device_register(&msm8960_device_uart_gsbi8);
3307 else
3308 platform_device_register(&msm8960_device_uart_gsbi5);
3309
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003310 /* For 8960 Fusion 2.2 Primary IPC */
Mayank Ranad85a5082012-04-29 17:24:13 -07003311 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE) {
3312 msm_uart_dm9_pdata.wakeup_irq = gpio_to_irq(94); /* GSBI9(2) */
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003313 msm_device_uart_dm9.dev.platform_data = &msm_uart_dm9_pdata;
Mayank Rana77f83c22012-07-10 09:31:02 +05303314 platform_device_register(&msm_device_uart_dm9);
Mayank Ranad85a5082012-04-29 17:24:13 -07003315 }
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003316
Mayank Rana1f02d952012-07-04 19:11:20 +05303317 /* For 8960 Standalone External Bluetooth Interface */
3318 if (socinfo_get_platform_subtype() != PLATFORM_SUBTYPE_SGLTE) {
3319 msm_device_uart_dm8.dev.platform_data = &msm_uart_dm8_pdata;
3320 platform_device_register(&msm_device_uart_dm8);
3321 }
Patrick Daly6578e0c2012-07-19 18:50:02 -07003322 if (cpu_is_msm8960ab())
3323 platform_device_register(&msm8960ab_device_acpuclk);
3324 else
3325 platform_device_register(&msm8960_device_acpuclk);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003326 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Arun Menon697e91b2012-08-20 15:25:50 -07003327 msm8960_add_vidc_device();
Patrick Daly6578e0c2012-07-19 18:50:02 -07003328
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003329 msm8960_pm8921_gpio_mpp_init();
Stephen Boyded035682012-09-13 12:41:31 -07003330 /* Don't add modem devices on APQ targets */
Stephen Boydbdb53f32012-06-05 18:39:47 -07003331 if (socinfo_get_id() != 124)
3332 platform_device_register(&msm_8960_q6_mss);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003333 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303334 msm8960_init_smsc_hub();
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003335 msm8960_init_hsic();
Steve Mucklef132c6c2012-06-06 18:30:57 -07003336#ifdef CONFIG_MSM_CAMERA
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003337 msm8960_init_cam();
Steve Mucklef132c6c2012-06-06 18:30:57 -07003338#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003339 msm8960_init_mmc();
Mohan Pallaka50837382011-09-07 11:00:57 +05303340 if (machine_is_msm8960_liquid())
3341 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003342 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08003343 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003344 slim_register_board_info(msm_slim_devices,
3345 ARRAY_SIZE(msm_slim_devices));
3346 msm8960_init_dsps();
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06003347 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05303348 bt_power_init();
Joel King0cbf5d82012-05-24 15:21:38 -07003349 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE) {
3350 mdm_sglte_device.dev.platform_data = &sglte_platform_data;
3351 platform_device_register(&mdm_sglte_device);
3352 }
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003353}
3354
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003355MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
3356 .map_io = msm8960_map_io,
3357 .reserve = msm8960_reserve,
3358 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303359 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003360 .timer = &msm_timer,
3361 .init_machine = msm8960_cdp_init,
3362 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003363 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003364 .restart = msm_restart,
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -08003365 .smp = &msm8960_smp_ops,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003366MACHINE_END
3367
3368MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
3369 .map_io = msm8960_map_io,
3370 .reserve = msm8960_reserve,
3371 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303372 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003373 .timer = &msm_timer,
3374 .init_machine = msm8960_cdp_init,
3375 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003376 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003377 .restart = msm_restart,
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -08003378 .smp = &msm8960_smp_ops,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003379MACHINE_END
3380
3381MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
3382 .map_io = msm8960_map_io,
3383 .reserve = msm8960_reserve,
3384 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303385 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003386 .timer = &msm_timer,
3387 .init_machine = msm8960_cdp_init,
3388 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003389 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003390 .restart = msm_restart,
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -08003391 .smp = &msm8960_smp_ops,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003392MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003393
3394MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
3395 .map_io = msm8960_map_io,
3396 .reserve = msm8960_reserve,
3397 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303398 .handle_irq = gic_handle_irq,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003399 .timer = &msm_timer,
3400 .init_machine = msm8960_cdp_init,
3401 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003402 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003403 .restart = msm_restart,
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -08003404 .smp = &msm8960_smp_ops,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003405MACHINE_END