blob: 85d3bbaebaaf5d97775d0f9e98bc2b15427ff0a3 [file] [log] [blame]
Deepak Verma888204f2013-01-25 11:43:09 +05301/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
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 *
12 */
13#include <linux/kernel.h>
Niranjana Vishwanathapurac1edd402012-06-28 15:32:50 -060014#include <linux/bitops.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070015#include <linux/platform_device.h>
Steve Mucklef132c6c2012-06-06 18:30:57 -070016#include <linux/gpio.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070017#include <linux/io.h>
18#include <linux/irq.h>
Kenneth Heitke748593a2011-07-15 15:45:11 -060019#include <linux/i2c.h>
David Keitel2f613d92012-02-15 11:29:16 -080020#include <linux/i2c/smb349.h>
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -080021#include <linux/i2c/sx150x.h>
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -060022#include <linux/slimbus/slimbus.h>
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +053023#include <linux/mfd/wcd9xxx/core.h>
24#include <linux/mfd/wcd9xxx/pdata.h>
Amy Maloche70090f992012-02-16 16:35:26 -080025#include <linux/mfd/pm8xxx/misc.h>
Kenneth Heitke36920d32011-07-20 16:44:30 -060026#include <linux/msm_ssbi.h>
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -070027#include <linux/spi/spi.h>
Laura Abbott0ae40a02012-08-10 10:49:33 -070028#include <linux/dma-contiguous.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070029#include <linux/dma-mapping.h>
30#include <linux/platform_data/qcom_crypto_device.h>
Mitchel Humpherys6ff930c2012-09-06 11:32:54 -070031#include <linux/msm_ion.h>
Jack Cheung46bfffa2012-01-19 15:26:24 -080032#include <linux/memory.h>
Larry Bassel67b921d2012-04-06 10:23:27 -070033#include <linux/memblock.h>
Praveen Chidambaram877d7a42012-06-05 14:33:20 -060034#include <linux/msm_thermal.h>
Jing Lin21ed4de2012-02-05 15:53:28 -080035#include <linux/i2c/atmel_mxt_ts.h>
Steve Mucklef132c6c2012-06-06 18:30:57 -070036#include <linux/cyttsp-qc.h>
Amy Maloche70090f992012-02-16 16:35:26 -080037#include <linux/i2c/isa1200.h>
Mohan Pallaka474b94b2012-01-25 12:59:58 +053038#include <linux/gpio_keys.h>
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -080039#include <linux/epm_adc.h>
Jay Chokshie7d8d4f2012-04-04 14:47:57 -070040#include <linux/i2c/sx150x.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070041#include <asm/mach-types.h>
42#include <asm/mach/arch.h>
43#include <asm/hardware/gic.h>
Sahitya Tummala3586ed92011-08-03 09:13:23 +053044#include <asm/mach/mmc.h>
Ankit Verma6b7e2ba2012-01-26 15:48:54 -080045#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070046
47#include <mach/board.h>
48#include <mach/msm_iomap.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080049#include <mach/ion.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070050#include <linux/usb/msm_hsusb.h>
51#include <linux/usb/android.h>
52#include <mach/socinfo.h>
Harini Jayaramanc4c58692011-07-19 14:50:10 -060053#include <mach/msm_spi.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070054#include "timer.h"
55#include "devices.h"
Joel King4ebccc62011-07-22 09:43:22 -070056#include <mach/gpiomux.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060057#include <mach/rpm.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080058#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -070059#include <linux/android_pmem.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080060#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070061#include <mach/msm_memtypes.h>
62#include <linux/bootmem.h>
63#include <asm/setup.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070064#include <mach/dma.h>
Jin Hongd3024e62012-02-09 16:13:32 -080065#include <mach/msm_dsps.h>
Gagan Mac8a7a5d32011-11-11 16:43:06 -070066#include <mach/msm_bus_board.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060067#include <mach/cpuidle.h>
Joel Kingdacbc822012-01-25 13:30:57 -080068#include <mach/mdm2.h>
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -080069#include <linux/msm_tsens.h>
Stephen Boyd4d0d2582012-02-10 14:49:40 -080070#include <mach/msm_xo.h>
Laura Abbott350c8362012-02-28 14:46:52 -080071#include <mach/msm_rtb.h>
Mayank Rana33681af2012-05-10 15:14:00 -070072#include <mach/msm_serial_hs.h>
Santosh Mardieff9a742012-04-09 23:23:39 +053073#include <sound/cs8427.h>
Ravi Kumar V05931a22012-04-04 17:09:37 +053074#include <media/gpio-ir-recv.h>
Larry Bassel67b921d2012-04-06 10:23:27 -070075#include <linux/fmem.h>
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -060076#include <mach/msm_pcie.h>
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -070077#include <mach/restart.h>
Niranjana Vishwanathapurac1edd402012-06-28 15:32:50 -060078#include <mach/msm_iomap.h>
Mayank Ranae98f1e42013-02-22 19:58:59 +053079#include <mach/msm_serial_hs.h>
Joel King4ebccc62011-07-22 09:43:22 -070080
Jeff Ohlstein7e668552011-10-06 16:17:25 -070081#include "msm_watchdog.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080082#include "board-8064.h"
Matt Wagantalld55b90f2012-02-23 23:27:44 -080083#include "clock.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060084#include "spm.h"
Subhash Jadavani909e04f2012-04-12 10:52:50 +053085#include <mach/mpm.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060086#include "rpm_resources.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080087#include "pm.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060088#include "pm-boot.h"
Rajesh Sastrulaaee8af32012-01-20 11:46:31 -080089#include "devices-msm8x60.h"
Hanumant Singh50440d42012-04-23 19:27:16 -070090#include "smd_private.h"
Ameya Thakurffd21b02013-01-30 11:33:22 -080091#include "sysmon.h"
Jay Chokshiea67c622011-07-29 17:12:26 -070092
Olav Haugan7c6aa742012-01-16 16:47:37 -080093#define MSM_PMEM_ADSP_SIZE 0x7800000
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -070094#define MSM_PMEM_AUDIO_SIZE 0x4CF000
Olav Haugan7c6aa742012-01-16 16:47:37 -080095#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
96#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
97#else
Chetan Kalyan72aac4f2012-02-23 14:56:54 -080098#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Olav Haugan7c6aa742012-01-16 16:47:37 -080099#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700100
Olav Haugan7c6aa742012-01-16 16:47:37 -0800101#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Hanumant Singheadb7502012-05-15 18:14:04 -0700102#define HOLE_SIZE 0x20000
Deepak Verma888204f2013-01-25 11:43:09 +0530103#define MSM_ION_MFC_META_SIZE 0x40000 /* 256 Kbytes */
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700104#define MSM_CONTIG_MEM_SIZE 0x65000
Olav Haugan129992c2012-03-22 09:54:01 -0700105#ifdef CONFIG_MSM_IOMMU
106#define MSM_ION_MM_SIZE 0x3800000
107#define MSM_ION_SF_SIZE 0
Olav Haugan39477bb2012-05-14 16:05:36 -0700108#define MSM_ION_QSECOM_SIZE 0x780000 /* (7.5MB) */
Laura Abbott03e3cd72013-02-09 09:35:30 -0800109#define MSM_ION_HEAP_NUM 8
Olav Haugan129992c2012-03-22 09:54:01 -0700110#else
Olav Haugan7c6aa742012-01-16 16:47:37 -0800111#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Haugan129992c2012-03-22 09:54:01 -0700112#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Haugan39477bb2012-05-14 16:05:36 -0700113#define MSM_ION_QSECOM_SIZE 0x600000 /* (6MB) */
Olav Haugan129992c2012-03-22 09:54:01 -0700114#define MSM_ION_HEAP_NUM 8
115#endif
Hanumant Singheadb7502012-05-15 18:14:04 -0700116#define MSM_ION_MM_FW_SIZE (0x200000 - HOLE_SIZE) /* (2MB - 128KB) */
Deepak Verma888204f2013-01-25 11:43:09 +0530117#define MSM_ION_MFC_SIZE (SZ_8K + MSM_ION_MFC_META_SIZE)
Olav Haugan2c43fac2012-01-19 11:06:37 -0800118#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Olav Haugan7c6aa742012-01-16 16:47:37 -0800119#else
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700120#define MSM_CONTIG_MEM_SIZE 0x110C000
Olav Haugan7c6aa742012-01-16 16:47:37 -0800121#define MSM_ION_HEAP_NUM 1
122#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700123
Hanumant Singheadb7502012-05-15 18:14:04 -0700124#define APQ8064_FIXED_AREA_START (0xa0000000 - (MSM_ION_MM_FW_SIZE + \
125 HOLE_SIZE))
Larry Bassel67b921d2012-04-06 10:23:27 -0700126#define MAX_FIXED_AREA_SIZE 0x10000000
Hanumant Singheadb7502012-05-15 18:14:04 -0700127#define MSM_MM_FW_SIZE (0x200000 - HOLE_SIZE)
128#define APQ8064_FW_START APQ8064_FIXED_AREA_START
Laura Abbott03e3cd72013-02-09 09:35:30 -0800129#define MSM_ION_ADSP_SIZE SZ_8M
Larry Bassel67b921d2012-04-06 10:23:27 -0700130
Niranjana Vishwanathapurac1edd402012-06-28 15:32:50 -0600131#define QFPROM_RAW_FEAT_CONFIG_ROW0_MSB (MSM_QFPROM_BASE + 0x23c)
132#define QFPROM_RAW_OEM_CONFIG_ROW0_LSB (MSM_QFPROM_BASE + 0x220)
133
Niranjana Vishwanathapura68210ff2012-06-24 18:03:49 -0600134/* PCIE AXI address space */
135#define PCIE_AXI_BAR_PHYS 0x08000000
136#define PCIE_AXI_BAR_SIZE SZ_128M
137
Niranjana Vishwanathapura459a27d2012-07-20 12:23:55 -0600138/* PCIe pmic gpios */
139#define PCIE_WAKE_N_PMIC_GPIO 12
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -0600140#define PCIE_PWR_EN_PMIC_GPIO 13
141#define PCIE_RST_N_PMIC_MPP 1
142
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700143#ifdef CONFIG_KERNEL_MSM_CONTIG_MEM_REGION
144static unsigned msm_contig_mem_size = MSM_CONTIG_MEM_SIZE;
145static int __init msm_contig_mem_size_setup(char *p)
Kevin Chan13be4e22011-10-20 11:30:32 -0700146{
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700147 msm_contig_mem_size = memparse(p, NULL);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800148 return 0;
Kevin Chan13be4e22011-10-20 11:30:32 -0700149}
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700150early_param("msm_contig_mem_size", msm_contig_mem_size_setup);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800151#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700152
Olav Haugan7c6aa742012-01-16 16:47:37 -0800153#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -0700154static unsigned pmem_size = MSM_PMEM_SIZE;
155static int __init pmem_size_setup(char *p)
156{
157 pmem_size = memparse(p, NULL);
158 return 0;
159}
160early_param("pmem_size", pmem_size_setup);
161
162static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
163
164static int __init pmem_adsp_size_setup(char *p)
165{
166 pmem_adsp_size = memparse(p, NULL);
167 return 0;
168}
169early_param("pmem_adsp_size", pmem_adsp_size_setup);
170
171static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
172
173static int __init pmem_audio_size_setup(char *p)
174{
175 pmem_audio_size = memparse(p, NULL);
176 return 0;
177}
178early_param("pmem_audio_size", pmem_audio_size_setup);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800179#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700180
Olav Haugan7c6aa742012-01-16 16:47:37 -0800181#ifdef CONFIG_ANDROID_PMEM
182#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700183static struct android_pmem_platform_data android_pmem_pdata = {
184 .name = "pmem",
185 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
186 .cached = 1,
187 .memory_type = MEMTYPE_EBI1,
188};
189
Laura Abbottb93525f2012-04-12 09:57:19 -0700190static struct platform_device apq8064_android_pmem_device = {
Kevin Chan13be4e22011-10-20 11:30:32 -0700191 .name = "android_pmem",
192 .id = 0,
193 .dev = {.platform_data = &android_pmem_pdata},
194};
195
196static struct android_pmem_platform_data android_pmem_adsp_pdata = {
197 .name = "pmem_adsp",
198 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
199 .cached = 0,
200 .memory_type = MEMTYPE_EBI1,
201};
Laura Abbottb93525f2012-04-12 09:57:19 -0700202static struct platform_device apq8064_android_pmem_adsp_device = {
Kevin Chan13be4e22011-10-20 11:30:32 -0700203 .name = "android_pmem",
204 .id = 2,
205 .dev = { .platform_data = &android_pmem_adsp_pdata },
206};
207
208static struct android_pmem_platform_data android_pmem_audio_pdata = {
209 .name = "pmem_audio",
210 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
211 .cached = 0,
212 .memory_type = MEMTYPE_EBI1,
213};
214
Laura Abbottb93525f2012-04-12 09:57:19 -0700215static struct platform_device apq8064_android_pmem_audio_device = {
Kevin Chan13be4e22011-10-20 11:30:32 -0700216 .name = "android_pmem",
217 .id = 4,
218 .dev = { .platform_data = &android_pmem_audio_pdata },
219};
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700220#endif /* CONFIG_MSM_MULTIMEDIA_USE_ION */
221#endif /* CONFIG_ANDROID_PMEM */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800222
Anji Jonnalafde57a32013-03-20 17:22:39 +0530223#ifdef CONFIG_BATTERY_BCL
224static struct platform_device battery_bcl_device = {
225 .name = "battery_current_limit",
226 .id = -1,
227 };
228#endif
229
Larry Bassel67b921d2012-04-06 10:23:27 -0700230struct fmem_platform_data apq8064_fmem_pdata = {
231};
232
Olav Haugan7c6aa742012-01-16 16:47:37 -0800233static struct memtype_reserve apq8064_reserve_table[] __initdata = {
234 [MEMTYPE_SMI] = {
235 },
236 [MEMTYPE_EBI0] = {
237 .flags = MEMTYPE_FLAGS_1M_ALIGN,
238 },
239 [MEMTYPE_EBI1] = {
240 .flags = MEMTYPE_FLAGS_1M_ALIGN,
241 },
242};
Kevin Chan13be4e22011-10-20 11:30:32 -0700243
Laura Abbott350c8362012-02-28 14:46:52 -0800244static void __init reserve_rtb_memory(void)
245{
246#if defined(CONFIG_MSM_RTB)
Laura Abbottb93525f2012-04-12 09:57:19 -0700247 apq8064_reserve_table[MEMTYPE_EBI1].size += apq8064_rtb_pdata.size;
Laura Abbott350c8362012-02-28 14:46:52 -0800248#endif
249}
250
251
Kevin Chan13be4e22011-10-20 11:30:32 -0700252static void __init size_pmem_devices(void)
253{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800254#ifdef CONFIG_ANDROID_PMEM
255#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700256 android_pmem_adsp_pdata.size = pmem_adsp_size;
257 android_pmem_pdata.size = pmem_size;
258 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700259#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
260#endif /*CONFIG_ANDROID_PMEM*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700261}
262
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700263#ifdef CONFIG_ANDROID_PMEM
264#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700265static void __init reserve_memory_for(struct android_pmem_platform_data *p)
266{
267 apq8064_reserve_table[p->memory_type].size += p->size;
268}
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700269#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
270#endif /*CONFIG_ANDROID_PMEM*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700271
Kevin Chan13be4e22011-10-20 11:30:32 -0700272static void __init reserve_pmem_memory(void)
273{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800274#ifdef CONFIG_ANDROID_PMEM
275#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700276 reserve_memory_for(&android_pmem_adsp_pdata);
277 reserve_memory_for(&android_pmem_pdata);
278 reserve_memory_for(&android_pmem_audio_pdata);
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700279#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700280 apq8064_reserve_table[MEMTYPE_EBI1].size += msm_contig_mem_size;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700281#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -0800282}
283
284static int apq8064_paddr_to_memtype(unsigned int paddr)
285{
286 return MEMTYPE_EBI1;
287}
288
Steve Mucklef132c6c2012-06-06 18:30:57 -0700289#define FMEM_ENABLED 0
Larry Bassel67b921d2012-04-06 10:23:27 -0700290
Olav Haugan7c6aa742012-01-16 16:47:37 -0800291#ifdef CONFIG_ION_MSM
292#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -0700293static struct ion_cp_heap_pdata cp_mm_apq8064_ion_pdata = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800294 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugand3d29682012-01-19 10:57:07 -0800295 .align = PAGE_SIZE,
Larry Bassel67b921d2012-04-06 10:23:27 -0700296 .reusable = FMEM_ENABLED,
297 .mem_is_fmem = FMEM_ENABLED,
298 .fixed_position = FIXED_MIDDLE,
Laura Abbottadec9c72012-12-05 11:49:59 -0800299 .is_cma = 1,
Laura Abbott5249a052012-12-11 15:09:03 -0800300 .no_nonsecure_alloc = 1,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800301};
302
Laura Abbottb93525f2012-04-12 09:57:19 -0700303static struct ion_cp_heap_pdata cp_mfc_apq8064_ion_pdata = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800304 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugand3d29682012-01-19 10:57:07 -0800305 .align = PAGE_SIZE,
Larry Bassel67b921d2012-04-06 10:23:27 -0700306 .reusable = 0,
307 .mem_is_fmem = FMEM_ENABLED,
308 .fixed_position = FIXED_HIGH,
Laura Abbott5249a052012-12-11 15:09:03 -0800309 .no_nonsecure_alloc = 1,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800310};
311
Laura Abbottb93525f2012-04-12 09:57:19 -0700312static struct ion_co_heap_pdata co_apq8064_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800313 .adjacent_mem_id = INVALID_HEAP_ID,
314 .align = PAGE_SIZE,
Larry Bassel67b921d2012-04-06 10:23:27 -0700315 .mem_is_fmem = 0,
Olav Haugand3d29682012-01-19 10:57:07 -0800316};
317
Laura Abbottb93525f2012-04-12 09:57:19 -0700318static struct ion_co_heap_pdata fw_co_apq8064_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800319 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
320 .align = SZ_128K,
Larry Bassel67b921d2012-04-06 10:23:27 -0700321 .mem_is_fmem = FMEM_ENABLED,
322 .fixed_position = FIXED_LOW,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800323};
324#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800325
Laura Abbott0ae40a02012-08-10 10:49:33 -0700326static u64 msm_dmamask = DMA_BIT_MASK(32);
327
328static struct platform_device ion_mm_heap_device = {
329 .name = "ion-mm-heap-device",
330 .id = -1,
331 .dev = {
332 .dma_mask = &msm_dmamask,
333 .coherent_dma_mask = DMA_BIT_MASK(32),
334 }
335};
336
Laura Abbott03e3cd72013-02-09 09:35:30 -0800337static struct platform_device ion_adsp_heap_device = {
338 .name = "ion-adsp-heap-device",
339 .id = -1,
340 .dev = {
341 .dma_mask = &msm_dmamask,
342 .coherent_dma_mask = DMA_BIT_MASK(32),
343 }
344};
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800345/**
346 * These heaps are listed in the order they will be allocated. Due to
347 * video hardware restrictions and content protection the FW heap has to
348 * be allocated adjacent (below) the MM heap and the MFC heap has to be
349 * allocated after the MM heap to ensure MFC heap is not more than 256MB
350 * away from the base address of the FW heap.
351 * However, the order of FW heap and MM heap doesn't matter since these
352 * two heaps are taken care of by separate code to ensure they are adjacent
353 * to each other.
354 * Don't swap the order unless you know what you are doing!
355 */
Benjamin Gaignardb2d367c2012-06-25 15:27:30 -0700356struct ion_platform_heap apq8064_heaps[] = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800357 {
358 .id = ION_SYSTEM_HEAP_ID,
359 .type = ION_HEAP_TYPE_SYSTEM,
360 .name = ION_VMALLOC_HEAP_NAME,
361 },
362#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
363 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800364 .id = ION_CP_MM_HEAP_ID,
365 .type = ION_HEAP_TYPE_CP,
366 .name = ION_MM_HEAP_NAME,
367 .size = MSM_ION_MM_SIZE,
368 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700369 .extra_data = (void *) &cp_mm_apq8064_ion_pdata,
Laura Abbott0ae40a02012-08-10 10:49:33 -0700370 .priv = &ion_mm_heap_device.dev
Olav Haugan7c6aa742012-01-16 16:47:37 -0800371 },
372 {
Olav Haugand3d29682012-01-19 10:57:07 -0800373 .id = ION_MM_FIRMWARE_HEAP_ID,
374 .type = ION_HEAP_TYPE_CARVEOUT,
375 .name = ION_MM_FIRMWARE_HEAP_NAME,
376 .size = MSM_ION_MM_FW_SIZE,
377 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700378 .extra_data = (void *) &fw_co_apq8064_ion_pdata,
Olav Haugand3d29682012-01-19 10:57:07 -0800379 },
380 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800381 .id = ION_CP_MFC_HEAP_ID,
382 .type = ION_HEAP_TYPE_CP,
383 .name = ION_MFC_HEAP_NAME,
384 .size = MSM_ION_MFC_SIZE,
385 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700386 .extra_data = (void *) &cp_mfc_apq8064_ion_pdata,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800387 },
Olav Haugan129992c2012-03-22 09:54:01 -0700388#ifndef CONFIG_MSM_IOMMU
Olav Haugan7c6aa742012-01-16 16:47:37 -0800389 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800390 .id = ION_SF_HEAP_ID,
391 .type = ION_HEAP_TYPE_CARVEOUT,
392 .name = ION_SF_HEAP_NAME,
393 .size = MSM_ION_SF_SIZE,
394 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700395 .extra_data = (void *) &co_apq8064_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800396 },
Olav Haugan129992c2012-03-22 09:54:01 -0700397#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800398 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800399 .id = ION_IOMMU_HEAP_ID,
400 .type = ION_HEAP_TYPE_IOMMU,
401 .name = ION_IOMMU_HEAP_NAME,
402 },
Olav Hauganf45e2142012-01-19 11:01:01 -0800403 {
404 .id = ION_QSECOM_HEAP_ID,
405 .type = ION_HEAP_TYPE_CARVEOUT,
406 .name = ION_QSECOM_HEAP_NAME,
407 .size = MSM_ION_QSECOM_SIZE,
408 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700409 .extra_data = (void *) &co_apq8064_ion_pdata,
Olav Hauganf45e2142012-01-19 11:01:01 -0800410 },
Olav Haugan2c43fac2012-01-19 11:06:37 -0800411 {
412 .id = ION_AUDIO_HEAP_ID,
413 .type = ION_HEAP_TYPE_CARVEOUT,
414 .name = ION_AUDIO_HEAP_NAME,
415 .size = MSM_ION_AUDIO_SIZE,
416 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700417 .extra_data = (void *) &co_apq8064_ion_pdata,
Olav Haugan2c43fac2012-01-19 11:06:37 -0800418 },
Laura Abbott03e3cd72013-02-09 09:35:30 -0800419 {
420 .id = ION_ADSP_HEAP_ID,
421 .type = ION_HEAP_TYPE_DMA,
422 .name = ION_ADSP_HEAP_NAME,
423 .size = MSM_ION_ADSP_SIZE,
424 .memory_type = ION_EBI_TYPE,
425 .extra_data = (void *) &co_apq8064_ion_pdata,
426 .priv = &ion_adsp_heap_device.dev,
427 },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800428#endif
Benjamin Gaignardb2d367c2012-06-25 15:27:30 -0700429};
430
431static struct ion_platform_data apq8064_ion_pdata = {
432 .nr = MSM_ION_HEAP_NUM,
433 .heaps = apq8064_heaps,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800434};
435
Laura Abbottb93525f2012-04-12 09:57:19 -0700436static struct platform_device apq8064_ion_dev = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800437 .name = "ion-msm",
438 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700439 .dev = { .platform_data = &apq8064_ion_pdata },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800440};
441#endif
442
Larry Bassel67b921d2012-04-06 10:23:27 -0700443static struct platform_device apq8064_fmem_device = {
444 .name = "fmem",
445 .id = 1,
446 .dev = { .platform_data = &apq8064_fmem_pdata },
447};
448
449static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
450 unsigned long size)
451{
452 apq8064_reserve_table[mem_type].size += size;
453}
454
455static void __init apq8064_reserve_fixed_area(unsigned long fixed_area_size)
456{
457#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
458 int ret;
459
460 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
461 panic("fixed area size is larger than %dM\n",
462 MAX_FIXED_AREA_SIZE >> 20);
463
464 reserve_info->fixed_area_size = fixed_area_size;
465 reserve_info->fixed_area_start = APQ8064_FW_START;
466
467 ret = memblock_remove(reserve_info->fixed_area_start,
468 reserve_info->fixed_area_size);
469 BUG_ON(ret);
470#endif
471}
472
473/**
474 * Reserve memory for ION and calculate amount of reusable memory for fmem.
475 * We only reserve memory for heaps that are not reusable. However, we only
476 * support one reusable heap at the moment so we ignore the reusable flag for
477 * other than the first heap with reusable flag set. Also handle special case
478 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
479 * at a higher address than FW in addition to not more than 256MB away from the
480 * base address of the firmware. This means that if MM is reusable the other
481 * two heaps must be allocated in the same region as FW. This is handled by the
482 * mem_is_fmem flag in the platform data. In addition the MM heap must be
483 * adjacent to the FW heap for content protection purposes.
484 */
Stephen Boyd668d7652012-04-25 11:31:01 -0700485static void __init reserve_ion_memory(void)
Olav Haugan7c6aa742012-01-16 16:47:37 -0800486{
487#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Larry Bassel67b921d2012-04-06 10:23:27 -0700488 unsigned int i;
Laura Abbott0ae40a02012-08-10 10:49:33 -0700489 unsigned int ret;
Larry Bassel67b921d2012-04-06 10:23:27 -0700490 unsigned int fixed_size = 0;
491 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
492 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
Laura Abbott0ae40a02012-08-10 10:49:33 -0700493 unsigned long cma_alignment;
494 unsigned int low_use_cma = 0;
495 unsigned int middle_use_cma = 0;
496 unsigned int high_use_cma = 0;
497
Larry Bassel67b921d2012-04-06 10:23:27 -0700498
Larry Bassel67b921d2012-04-06 10:23:27 -0700499 fixed_low_size = 0;
500 fixed_middle_size = 0;
501 fixed_high_size = 0;
502
Laura Abbott0ae40a02012-08-10 10:49:33 -0700503 cma_alignment = PAGE_SIZE << max(MAX_ORDER, pageblock_order);
504
Larry Bassel67b921d2012-04-06 10:23:27 -0700505 for (i = 0; i < apq8064_ion_pdata.nr; ++i) {
Laura Abbott0ae40a02012-08-10 10:49:33 -0700506 struct ion_platform_heap *heap =
Larry Bassel67b921d2012-04-06 10:23:27 -0700507 &(apq8064_ion_pdata.heaps[i]);
Laura Abbott0ae40a02012-08-10 10:49:33 -0700508 int use_cma = 0;
509
Larry Bassel67b921d2012-04-06 10:23:27 -0700510
511 if (heap->extra_data) {
512 int fixed_position = NOT_FIXED;
Larry Bassel67b921d2012-04-06 10:23:27 -0700513
Mitchel Humpherysdc4d01d2012-09-13 10:53:22 -0700514 switch ((int)heap->type) {
Larry Bassel67b921d2012-04-06 10:23:27 -0700515 case ION_HEAP_TYPE_CP:
Laura Abbott0ae40a02012-08-10 10:49:33 -0700516 if (((struct ion_cp_heap_pdata *)
517 heap->extra_data)->is_cma) {
518 heap->size = ALIGN(heap->size,
519 cma_alignment);
520 use_cma = 1;
521 }
Larry Bassel67b921d2012-04-06 10:23:27 -0700522 fixed_position = ((struct ion_cp_heap_pdata *)
523 heap->extra_data)->fixed_position;
524 break;
Laura Abbott0ae40a02012-08-10 10:49:33 -0700525 case ION_HEAP_TYPE_DMA:
526 use_cma = 1;
527 /* Purposely fall through here */
Larry Bassel67b921d2012-04-06 10:23:27 -0700528 case ION_HEAP_TYPE_CARVEOUT:
Larry Bassel67b921d2012-04-06 10:23:27 -0700529 fixed_position = ((struct ion_co_heap_pdata *)
530 heap->extra_data)->fixed_position;
531 break;
532 default:
533 break;
534 }
535
536 if (fixed_position != NOT_FIXED)
537 fixed_size += heap->size;
538 else
539 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
540
Laura Abbott0ae40a02012-08-10 10:49:33 -0700541 if (fixed_position == FIXED_LOW) {
Larry Bassel67b921d2012-04-06 10:23:27 -0700542 fixed_low_size += heap->size;
Laura Abbott0ae40a02012-08-10 10:49:33 -0700543 low_use_cma = use_cma;
544 } else if (fixed_position == FIXED_MIDDLE) {
Larry Bassel67b921d2012-04-06 10:23:27 -0700545 fixed_middle_size += heap->size;
Laura Abbott0ae40a02012-08-10 10:49:33 -0700546 middle_use_cma = use_cma;
547 } else if (fixed_position == FIXED_HIGH) {
Larry Bassel67b921d2012-04-06 10:23:27 -0700548 fixed_high_size += heap->size;
Laura Abbott0ae40a02012-08-10 10:49:33 -0700549 high_use_cma = use_cma;
550 } else if (use_cma) {
551 /*
552 * Heaps that use CMA but are not part of the
553 * fixed set. Create wherever.
554 */
555 dma_declare_contiguous(
556 heap->priv,
557 heap->size,
558 0,
559 0xb0000000);
560
561 }
Larry Bassel67b921d2012-04-06 10:23:27 -0700562 }
563 }
564
565 if (!fixed_size)
566 return;
567
Laura Abbott0ae40a02012-08-10 10:49:33 -0700568 /*
569 * Given the setup for the fixed area, we can't round up all sizes.
570 * Some sizes must be set up exactly and aligned correctly. Incorrect
571 * alignments are considered a configuration issue
Larry Bassel67b921d2012-04-06 10:23:27 -0700572 */
Larry Bassel67b921d2012-04-06 10:23:27 -0700573
574 fixed_low_start = APQ8064_FIXED_AREA_START;
Laura Abbott0ae40a02012-08-10 10:49:33 -0700575 if (low_use_cma) {
576 BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, cma_alignment));
577 BUG_ON(!IS_ALIGNED(fixed_low_start, cma_alignment));
578 } else {
579 BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, SECTION_SIZE));
580 ret = memblock_remove(fixed_low_start,
581 fixed_low_size + HOLE_SIZE);
582 BUG_ON(ret);
583 }
584
Hanumant Singheadb7502012-05-15 18:14:04 -0700585 fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE;
Laura Abbott0ae40a02012-08-10 10:49:33 -0700586 if (middle_use_cma) {
587 BUG_ON(!IS_ALIGNED(fixed_middle_start, cma_alignment));
588 BUG_ON(!IS_ALIGNED(fixed_middle_size, cma_alignment));
589 } else {
590 BUG_ON(!IS_ALIGNED(fixed_middle_size, SECTION_SIZE));
591 ret = memblock_remove(fixed_middle_start, fixed_middle_size);
592 BUG_ON(ret);
593 }
594
Larry Bassel67b921d2012-04-06 10:23:27 -0700595 fixed_high_start = fixed_middle_start + fixed_middle_size;
Laura Abbott0ae40a02012-08-10 10:49:33 -0700596 if (high_use_cma) {
597 fixed_high_size = ALIGN(fixed_high_size, cma_alignment);
598 BUG_ON(!IS_ALIGNED(fixed_high_start, cma_alignment));
599 } else {
600 /* This is the end of the fixed area so it's okay to round up */
601 fixed_high_size = ALIGN(fixed_high_size, SECTION_SIZE);
602 ret = memblock_remove(fixed_high_start, fixed_high_size);
603 BUG_ON(ret);
604 }
Larry Bassel67b921d2012-04-06 10:23:27 -0700605
606 for (i = 0; i < apq8064_ion_pdata.nr; ++i) {
607 struct ion_platform_heap *heap = &(apq8064_ion_pdata.heaps[i]);
608
609 if (heap->extra_data) {
610 int fixed_position = NOT_FIXED;
Steve Mucklef132c6c2012-06-06 18:30:57 -0700611 struct ion_cp_heap_pdata *pdata = NULL;
Larry Bassel67b921d2012-04-06 10:23:27 -0700612
Mitchel Humpherysdc4d01d2012-09-13 10:53:22 -0700613 switch ((int) heap->type) {
Larry Bassel67b921d2012-04-06 10:23:27 -0700614 case ION_HEAP_TYPE_CP:
Hanumant Singheadb7502012-05-15 18:14:04 -0700615 pdata =
616 (struct ion_cp_heap_pdata *)heap->extra_data;
617 fixed_position = pdata->fixed_position;
Larry Bassel67b921d2012-04-06 10:23:27 -0700618 break;
619 case ION_HEAP_TYPE_CARVEOUT:
Laura Abbott0ae40a02012-08-10 10:49:33 -0700620 case ION_HEAP_TYPE_DMA:
Larry Bassel67b921d2012-04-06 10:23:27 -0700621 fixed_position = ((struct ion_co_heap_pdata *)
622 heap->extra_data)->fixed_position;
623 break;
624 default:
625 break;
626 }
627
628 switch (fixed_position) {
629 case FIXED_LOW:
630 heap->base = fixed_low_start;
631 break;
632 case FIXED_MIDDLE:
633 heap->base = fixed_middle_start;
Laura Abbott0ae40a02012-08-10 10:49:33 -0700634 if (middle_use_cma) {
635 ret = dma_declare_contiguous(
636 heap->priv,
637 heap->size,
638 fixed_middle_start,
639 0xa0000000);
640 WARN_ON(ret);
641 }
Hanumant Singheadb7502012-05-15 18:14:04 -0700642 pdata->secure_base = fixed_middle_start
643 - HOLE_SIZE;
644 pdata->secure_size = HOLE_SIZE + heap->size;
Larry Bassel67b921d2012-04-06 10:23:27 -0700645 break;
646 case FIXED_HIGH:
647 heap->base = fixed_high_start;
648 break;
649 default:
650 break;
651 }
652 }
653 }
Olav Haugan7c6aa742012-01-16 16:47:37 -0800654#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700655}
656
Huaibin Yang4a084e32011-12-15 15:25:52 -0800657static void __init reserve_mdp_memory(void)
658{
659 apq8064_mdp_writeback(apq8064_reserve_table);
660}
661
Laura Abbott93a4a352012-05-25 09:26:35 -0700662static void __init reserve_cache_dump_memory(void)
663{
664#ifdef CONFIG_MSM_CACHE_DUMP
665 unsigned int total;
666
667 total = apq8064_cache_dump_pdata.l1_size +
668 apq8064_cache_dump_pdata.l2_size;
669 apq8064_reserve_table[MEMTYPE_EBI1].size += total;
670#endif
671}
672
Abhijeet Dharmapurikar3edb5de2012-09-13 11:02:03 -0700673static void __init reserve_mpdcvs_memory(void)
674{
675 apq8064_reserve_table[MEMTYPE_EBI1].size += SZ_32K;
676}
677
Kevin Chan13be4e22011-10-20 11:30:32 -0700678static void __init apq8064_calculate_reserve_sizes(void)
679{
680 size_pmem_devices();
681 reserve_pmem_memory();
Olav Haugan7c6aa742012-01-16 16:47:37 -0800682 reserve_ion_memory();
Huaibin Yang4a084e32011-12-15 15:25:52 -0800683 reserve_mdp_memory();
Laura Abbott350c8362012-02-28 14:46:52 -0800684 reserve_rtb_memory();
Laura Abbott93a4a352012-05-25 09:26:35 -0700685 reserve_cache_dump_memory();
Abhijeet Dharmapurikar3edb5de2012-09-13 11:02:03 -0700686 reserve_mpdcvs_memory();
Kevin Chan13be4e22011-10-20 11:30:32 -0700687}
688
689static struct reserve_info apq8064_reserve_info __initdata = {
690 .memtype_reserve_table = apq8064_reserve_table,
691 .calculate_reserve_sizes = apq8064_calculate_reserve_sizes,
Larry Bassel67b921d2012-04-06 10:23:27 -0700692 .reserve_fixed_area = apq8064_reserve_fixed_area,
Kevin Chan13be4e22011-10-20 11:30:32 -0700693 .paddr_to_memtype = apq8064_paddr_to_memtype,
694};
695
Aravind Venkateswaran8ac7f412012-03-16 17:57:30 -0700696static char prim_panel_name[PANEL_NAME_MAX_LEN];
697static char ext_panel_name[PANEL_NAME_MAX_LEN];
Ajay Singh Parmar6b82d2b2012-07-19 17:23:26 +0530698
699static int ext_resolution;
700
Aravind Venkateswaran8ac7f412012-03-16 17:57:30 -0700701static int __init prim_display_setup(char *param)
702{
703 if (strnlen(param, PANEL_NAME_MAX_LEN))
704 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
705 return 0;
706}
707early_param("prim_display", prim_display_setup);
708
709static int __init ext_display_setup(char *param)
710{
711 if (strnlen(param, PANEL_NAME_MAX_LEN))
712 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
713 return 0;
714}
715early_param("ext_display", ext_display_setup);
716
Ajay Singh Parmar6b82d2b2012-07-19 17:23:26 +0530717static int __init hdmi_resulution_setup(char *param)
718{
719 int ret;
720 ret = kstrtoint(param, 10, &ext_resolution);
721 return ret;
722}
723early_param("ext_resolution", hdmi_resulution_setup);
724
Kevin Chan13be4e22011-10-20 11:30:32 -0700725static void __init apq8064_reserve(void)
726{
Ajay Singh Parmar6b82d2b2012-07-19 17:23:26 +0530727 apq8064_set_display_params(prim_panel_name, ext_panel_name,
728 ext_resolution);
Kevin Chan13be4e22011-10-20 11:30:32 -0700729 msm_reserve();
730}
731
Laura Abbott6988cef2012-03-15 14:27:13 -0700732static void __init apq8064_early_reserve(void)
733{
734 reserve_info = &apq8064_reserve_info;
Laura Abbott6988cef2012-03-15 14:27:13 -0700735}
Hemant Kumara945b472012-01-25 15:08:06 -0800736#ifdef CONFIG_USB_EHCI_MSM_HSIC
Hemant Kumare6275972012-02-29 20:06:21 -0800737/* Bandwidth requests (zero) if no vote placed */
738static struct msm_bus_vectors hsic_init_vectors[] = {
739 {
740 .src = MSM_BUS_MASTER_SPS,
Hemant Kumare6275972012-02-29 20:06:21 -0800741 .dst = MSM_BUS_SLAVE_SPS,
742 .ab = 0,
743 .ib = 0,
744 },
745};
746
747/* Bus bandwidth requests in Bytes/sec */
748static struct msm_bus_vectors hsic_max_vectors[] = {
749 {
750 .src = MSM_BUS_MASTER_SPS,
Hemant Kumare6275972012-02-29 20:06:21 -0800751 .dst = MSM_BUS_SLAVE_SPS,
752 .ab = 0,
Hemant Kumar266d9d52012-10-17 13:48:10 -0700753 .ib = 256000000, /*vote for 32Mhz dfab clk rate*/
Hemant Kumare6275972012-02-29 20:06:21 -0800754 },
755};
756
757static struct msm_bus_paths hsic_bus_scale_usecases[] = {
758 {
759 ARRAY_SIZE(hsic_init_vectors),
760 hsic_init_vectors,
761 },
762 {
763 ARRAY_SIZE(hsic_max_vectors),
764 hsic_max_vectors,
765 },
766};
767
768static struct msm_bus_scale_pdata hsic_bus_scale_pdata = {
769 hsic_bus_scale_usecases,
770 ARRAY_SIZE(hsic_bus_scale_usecases),
771 .name = "hsic",
772};
773
Hemant Kumara945b472012-01-25 15:08:06 -0800774static struct msm_hsic_host_platform_data msm_hsic_pdata = {
Hemant Kumare6275972012-02-29 20:06:21 -0800775 .strobe = 88,
776 .data = 89,
777 .bus_scale_table = &hsic_bus_scale_pdata,
Hemant Kumara945b472012-01-25 15:08:06 -0800778};
779#else
780static struct msm_hsic_host_platform_data msm_hsic_pdata;
781#endif
782
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800783#define PID_MAGIC_ID 0x71432909
784#define SERIAL_NUM_MAGIC_ID 0x61945374
785#define SERIAL_NUMBER_LENGTH 127
786#define DLOAD_USB_BASE_ADD 0x2A03F0C8
787
788struct magic_num_struct {
789 uint32_t pid;
790 uint32_t serial_num;
791};
792
793struct dload_struct {
794 uint32_t reserved1;
795 uint32_t reserved2;
796 uint32_t reserved3;
797 uint16_t reserved4;
798 uint16_t pid;
799 char serial_number[SERIAL_NUMBER_LENGTH];
800 uint16_t reserved5;
801 struct magic_num_struct magic_struct;
802};
803
804static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
805{
806 struct dload_struct __iomem *dload = 0;
807
808 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
809 if (!dload) {
810 pr_err("%s: cannot remap I/O memory region: %08x\n",
811 __func__, DLOAD_USB_BASE_ADD);
812 return -ENXIO;
813 }
814
815 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
816 __func__, dload, pid, snum);
817 /* update pid */
818 dload->magic_struct.pid = PID_MAGIC_ID;
819 dload->pid = pid;
820
821 /* update serial number */
822 dload->magic_struct.serial_num = 0;
823 if (!snum) {
824 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
825 goto out;
826 }
827
828 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
829 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
830out:
831 iounmap(dload);
832 return 0;
833}
834
835static struct android_usb_platform_data android_usb_pdata = {
836 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
837};
838
Hemant Kumar4933b072011-10-17 23:43:11 -0700839static struct platform_device android_usb_device = {
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800840 .name = "android_usb",
841 .id = -1,
842 .dev = {
843 .platform_data = &android_usb_pdata,
844 },
Hemant Kumar4933b072011-10-17 23:43:11 -0700845};
846
Hemant Kumar7620eed2012-02-26 09:08:43 -0800847/* Bandwidth requests (zero) if no vote placed */
848static struct msm_bus_vectors usb_init_vectors[] = {
849 {
850 .src = MSM_BUS_MASTER_SPS,
851 .dst = MSM_BUS_SLAVE_EBI_CH0,
852 .ab = 0,
853 .ib = 0,
854 },
855};
856
857/* Bus bandwidth requests in Bytes/sec */
858static struct msm_bus_vectors usb_max_vectors[] = {
859 {
860 .src = MSM_BUS_MASTER_SPS,
861 .dst = MSM_BUS_SLAVE_EBI_CH0,
862 .ab = 60000000, /* At least 480Mbps on bus. */
863 .ib = 960000000, /* MAX bursts rate */
864 },
865};
866
867static struct msm_bus_paths usb_bus_scale_usecases[] = {
868 {
869 ARRAY_SIZE(usb_init_vectors),
870 usb_init_vectors,
871 },
872 {
873 ARRAY_SIZE(usb_max_vectors),
874 usb_max_vectors,
875 },
876};
877
878static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
879 usb_bus_scale_usecases,
880 ARRAY_SIZE(usb_bus_scale_usecases),
881 .name = "usb",
882};
883
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700884static int phy_init_seq[] = {
885 0x38, 0x81, /* update DC voltage level */
886 0x24, 0x82, /* set pre-emphasis and rise/fall time */
887 -1
888};
889
Vijayavardhan Vennapusa4fa13692012-08-02 14:35:03 +0530890#define PMIC_GPIO_DP 27 /* PMIC GPIO for D+ change */
891#define PMIC_GPIO_DP_IRQ PM8921_GPIO_IRQ(PM8921_IRQ_BASE, PMIC_GPIO_DP)
Jack Pham87f202f2012-08-06 00:24:22 -0700892#define MSM_MPM_PIN_USB1_OTGSESSVLD 40
893
Hemant Kumar4933b072011-10-17 23:43:11 -0700894static struct msm_otg_platform_data msm_otg_pdata = {
Hemant Kumard86c4882012-01-24 19:39:37 -0800895 .mode = USB_OTG,
896 .otg_control = OTG_PMIC_CONTROL,
Hemant Kumar4933b072011-10-17 23:43:11 -0700897 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Hemant Kumard86c4882012-01-24 19:39:37 -0800898 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
899 .power_budget = 750,
Hemant Kumar7620eed2012-02-26 09:08:43 -0800900 .bus_scale_table = &usb_bus_scale_pdata,
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700901 .phy_init_seq = phy_init_seq,
Jack Pham87f202f2012-08-06 00:24:22 -0700902 .mpm_otgsessvld_int = MSM_MPM_PIN_USB1_OTGSESSVLD,
Hemant Kumar4933b072011-10-17 23:43:11 -0700903};
904
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800905static struct msm_usb_host_platform_data msm_ehci_host_pdata3 = {
Manu Gautam91223e02011-11-08 15:27:22 +0530906 .power_budget = 500,
907};
908
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800909#ifdef CONFIG_USB_EHCI_MSM_HOST4
910static struct msm_usb_host_platform_data msm_ehci_host_pdata4;
911#endif
912
Manu Gautam91223e02011-11-08 15:27:22 +0530913static void __init apq8064_ehci_host_init(void)
914{
Chiranjeevi Velempatib822fa32012-05-23 22:05:59 +0530915 if (machine_is_apq8064_liquid() || machine_is_mpq8064_cdp() ||
916 machine_is_mpq8064_hrd() || machine_is_mpq8064_dtv()) {
917 if (machine_is_apq8064_liquid())
918 msm_ehci_host_pdata3.dock_connect_irq =
919 PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9);
Vijayavardhan Vennapusa4fa13692012-08-02 14:35:03 +0530920 else
921 msm_ehci_host_pdata3.pmic_gpio_dp_irq =
922 PMIC_GPIO_DP_IRQ;
Hemant Kumar56925352012-02-13 16:59:52 -0800923
Manu Gautam91223e02011-11-08 15:27:22 +0530924 apq8064_device_ehci_host3.dev.platform_data =
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800925 &msm_ehci_host_pdata3;
Manu Gautam91223e02011-11-08 15:27:22 +0530926 platform_device_register(&apq8064_device_ehci_host3);
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800927
928#ifdef CONFIG_USB_EHCI_MSM_HOST4
929 apq8064_device_ehci_host4.dev.platform_data =
930 &msm_ehci_host_pdata4;
931 platform_device_register(&apq8064_device_ehci_host4);
932#endif
Manu Gautam91223e02011-11-08 15:27:22 +0530933 }
934}
935
David Keitel2f613d92012-02-15 11:29:16 -0800936static struct smb349_platform_data smb349_data __initdata = {
937 .en_n_gpio = PM8921_GPIO_PM_TO_SYS(37),
938 .chg_susp_gpio = PM8921_GPIO_PM_TO_SYS(30),
939 .chg_current_ma = 2200,
940};
941
942static struct i2c_board_info smb349_charger_i2c_info[] __initdata = {
943 {
944 I2C_BOARD_INFO(SMB349_NAME, 0x1B),
945 .platform_data = &smb349_data,
946 },
947};
948
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -0800949struct sx150x_platform_data apq8064_sx150x_data[] = {
950 [SX150X_EPM] = {
951 .gpio_base = GPIO_EPM_EXPANDER_BASE,
952 .oscio_is_gpo = false,
953 .io_pullup_ena = 0x0,
954 .io_pulldn_ena = 0x0,
955 .io_open_drain_ena = 0x0,
956 .io_polarity = 0,
957 .irq_summary = -1,
958 },
959};
960
961static struct epm_chan_properties ads_adc_channel_data[] = {
Yan Hec942e402012-08-31 11:14:58 -0700962 {10, 100}, {1000, 1}, {10, 100}, {1000, 1},
963 {10, 100}, {1000, 1}, {10, 100}, {1000, 1},
964 {10, 100}, {20, 100}, {500, 100}, {5, 100},
965 {1000, 1}, {200, 100}, {50, 100}, {10, 100},
966 {510, 100}, {50, 100}, {20, 100}, {100, 100},
967 {510, 100}, {20, 100}, {50, 100}, {200, 100},
968 {10, 100}, {20, 100}, {1000, 1}, {10, 100},
969 {200, 100}, {510, 100}, {1000, 100}, {200, 100},
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -0800970};
971
972static struct epm_adc_platform_data epm_adc_pdata = {
973 .channel = ads_adc_channel_data,
974 .bus_id = 0x0,
975 .epm_i2c_board_info = {
976 .type = "sx1509q",
977 .addr = 0x3e,
978 .platform_data = &apq8064_sx150x_data[SX150X_EPM],
979 },
980 .gpio_expander_base_addr = GPIO_EPM_EXPANDER_BASE,
981};
982
983static struct platform_device epm_adc_device = {
984 .name = "epm_adc",
985 .id = -1,
986 .dev = {
987 .platform_data = &epm_adc_pdata,
988 },
989};
990
991static void __init apq8064_epm_adc_init(void)
992{
993 epm_adc_pdata.num_channels = 32;
994 epm_adc_pdata.num_adc = 2;
995 epm_adc_pdata.chan_per_adc = 16;
996 epm_adc_pdata.chan_per_mux = 8;
997};
998
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800999/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
1000 * 4 micbiases are used to power various analog and digital
1001 * microphones operating at 1800 mV. Technically, all micbiases
1002 * can source from single cfilter since all microphones operate
1003 * at the same voltage level. The arrangement below is to make
1004 * sure all cfilters are exercised. LDO_H regulator ouput level
1005 * does not need to be as high as 2.85V. It is choosen for
1006 * microphone sensitivity purpose.
1007 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301008static struct wcd9xxx_pdata apq8064_tabla_platform_data = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001009 .slimbus_slave_device = {
1010 .name = "tabla-slave",
1011 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
1012 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001013 .irq = MSM_GPIO_TO_INT(42),
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001014 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301015 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001016 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
1017 .micbias = {
1018 .ldoh_v = TABLA_LDOH_2P85_V,
1019 .cfilt1_mv = 1800,
Bhalchandra Gajare975c53a2012-08-10 12:16:49 -07001020 .cfilt2_mv = 2700,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001021 .cfilt3_mv = 1800,
1022 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
1023 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
1024 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
1025 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301026 },
1027 .regulator = {
1028 {
1029 .name = "CDC_VDD_CP",
1030 .min_uV = 1800000,
1031 .max_uV = 1800000,
1032 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
1033 },
1034 {
1035 .name = "CDC_VDDA_RX",
1036 .min_uV = 1800000,
1037 .max_uV = 1800000,
1038 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
1039 },
1040 {
1041 .name = "CDC_VDDA_TX",
1042 .min_uV = 1800000,
1043 .max_uV = 1800000,
1044 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
1045 },
1046 {
1047 .name = "VDDIO_CDC",
1048 .min_uV = 1800000,
1049 .max_uV = 1800000,
1050 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1051 },
1052 {
1053 .name = "VDDD_CDC_D",
1054 .min_uV = 1225000,
David Collins62debe82012-06-06 17:01:03 -07001055 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301056 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1057 },
1058 {
1059 .name = "CDC_VDDA_A_1P2V",
1060 .min_uV = 1225000,
David Collins62debe82012-06-06 17:01:03 -07001061 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301062 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1063 },
1064 },
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001065};
1066
1067static struct slim_device apq8064_slim_tabla = {
1068 .name = "tabla-slim",
1069 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
1070 .dev = {
1071 .platform_data = &apq8064_tabla_platform_data,
1072 },
1073};
1074
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301075static struct wcd9xxx_pdata apq8064_tabla20_platform_data = {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001076 .slimbus_slave_device = {
1077 .name = "tabla-slave",
1078 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
1079 },
1080 .irq = MSM_GPIO_TO_INT(42),
1081 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301082 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001083 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
1084 .micbias = {
1085 .ldoh_v = TABLA_LDOH_2P85_V,
1086 .cfilt1_mv = 1800,
Bhalchandra Gajare975c53a2012-08-10 12:16:49 -07001087 .cfilt2_mv = 2700,
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001088 .cfilt3_mv = 1800,
1089 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
1090 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
1091 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
1092 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301093 },
1094 .regulator = {
1095 {
1096 .name = "CDC_VDD_CP",
1097 .min_uV = 1800000,
1098 .max_uV = 1800000,
1099 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
1100 },
1101 {
1102 .name = "CDC_VDDA_RX",
1103 .min_uV = 1800000,
1104 .max_uV = 1800000,
1105 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
1106 },
1107 {
1108 .name = "CDC_VDDA_TX",
1109 .min_uV = 1800000,
1110 .max_uV = 1800000,
1111 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
1112 },
1113 {
1114 .name = "VDDIO_CDC",
1115 .min_uV = 1800000,
1116 .max_uV = 1800000,
1117 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1118 },
1119 {
1120 .name = "VDDD_CDC_D",
1121 .min_uV = 1225000,
David Collins62debe82012-06-06 17:01:03 -07001122 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301123 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1124 },
1125 {
1126 .name = "CDC_VDDA_A_1P2V",
1127 .min_uV = 1225000,
David Collins62debe82012-06-06 17:01:03 -07001128 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301129 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1130 },
1131 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001132};
1133
1134static struct slim_device apq8064_slim_tabla20 = {
1135 .name = "tabla2x-slim",
1136 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
1137 .dev = {
1138 .platform_data = &apq8064_tabla20_platform_data,
1139 },
1140};
1141
Santosh Mardi695be0d2012-04-10 23:21:12 +05301142/* enable the level shifter for cs8427 to make sure the I2C
1143 * clock is running at 100KHz and voltage levels are at 3.3
1144 * and 5 volts
1145 */
1146static int enable_100KHz_ls(int enable)
1147{
1148 int ret = 0;
1149 if (enable) {
1150 ret = gpio_request(SX150X_GPIO(1, 10),
1151 "cs8427_100KHZ_ENABLE");
1152 if (ret) {
1153 pr_err("%s: Failed to request gpio %d\n", __func__,
1154 SX150X_GPIO(1, 10));
1155 return ret;
1156 }
1157 gpio_direction_output(SX150X_GPIO(1, 10), 1);
Santosh Mardid706fcf2012-08-31 19:26:54 +05301158 } else {
1159 gpio_direction_output(SX150X_GPIO(1, 10), 0);
Santosh Mardi695be0d2012-04-10 23:21:12 +05301160 gpio_free(SX150X_GPIO(1, 10));
Santosh Mardid706fcf2012-08-31 19:26:54 +05301161 }
Santosh Mardi695be0d2012-04-10 23:21:12 +05301162 return ret;
1163}
1164
Santosh Mardieff9a742012-04-09 23:23:39 +05301165static struct cs8427_platform_data cs8427_i2c_platform_data = {
1166 .irq = SX150X_GPIO(1, 4),
1167 .reset_gpio = SX150X_GPIO(1, 6),
Santosh Mardi695be0d2012-04-10 23:21:12 +05301168 .enable = enable_100KHz_ls,
Santosh Mardieff9a742012-04-09 23:23:39 +05301169};
1170
1171static struct i2c_board_info cs8427_device_info[] __initdata = {
1172 {
1173 I2C_BOARD_INFO("cs8427", CS8427_ADDR4),
1174 .platform_data = &cs8427_i2c_platform_data,
1175 },
1176};
1177
Amy Maloche70090f992012-02-16 16:35:26 -08001178#define HAP_SHIFT_LVL_OE_GPIO PM8921_MPP_PM_TO_SYS(8)
1179#define ISA1200_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1180#define ISA1200_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
David Collins6f7c3472012-08-22 13:18:06 -07001181#define ISA1200_HAP_CLK_PM8921 PM8921_GPIO_PM_TO_SYS(44)
1182#define ISA1200_HAP_CLK_PM8917 PM8921_GPIO_PM_TO_SYS(38)
Amy Maloche70090f992012-02-16 16:35:26 -08001183
Mohan Pallaka2d877602012-05-11 13:07:30 +05301184static int isa1200_clk_enable(bool on)
Amy Maloche70090f992012-02-16 16:35:26 -08001185{
David Collins6f7c3472012-08-22 13:18:06 -07001186 unsigned int gpio = ISA1200_HAP_CLK_PM8921;
Amy Maloche8f973892012-03-26 14:53:13 -07001187 int rc = 0;
1188
David Collins6f7c3472012-08-22 13:18:06 -07001189 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
1190 gpio = ISA1200_HAP_CLK_PM8917;
1191
1192 gpio_set_value_cansleep(gpio, on);
Amy Maloche70090f992012-02-16 16:35:26 -08001193
Mohan Pallaka2d877602012-05-11 13:07:30 +05301194 if (on) {
Amy Maloche8f973892012-03-26 14:53:13 -07001195 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_1, true);
Mohan Pallaka2d877602012-05-11 13:07:30 +05301196 if (rc) {
1197 pr_err("%s: unable to write aux clock register(%d)\n",
1198 __func__, rc);
1199 goto err_gpio_dis;
1200 }
1201 } else {
Amy Maloche8f973892012-03-26 14:53:13 -07001202 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_NONE, true);
Mohan Pallaka2d877602012-05-11 13:07:30 +05301203 if (rc)
1204 pr_err("%s: unable to write aux clock register(%d)\n",
1205 __func__, rc);
Amy Maloche8f973892012-03-26 14:53:13 -07001206 }
1207
1208 return rc;
Mohan Pallaka2d877602012-05-11 13:07:30 +05301209
1210err_gpio_dis:
David Collins6f7c3472012-08-22 13:18:06 -07001211 gpio_set_value_cansleep(gpio, !on);
Mohan Pallaka2d877602012-05-11 13:07:30 +05301212 return rc;
Amy Maloche70090f992012-02-16 16:35:26 -08001213}
1214
1215static int isa1200_dev_setup(bool enable)
1216{
David Collins6f7c3472012-08-22 13:18:06 -07001217 unsigned int gpio = ISA1200_HAP_CLK_PM8921;
Amy Maloche70090f992012-02-16 16:35:26 -08001218 int rc = 0;
1219
David Collins6f7c3472012-08-22 13:18:06 -07001220 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
1221 gpio = ISA1200_HAP_CLK_PM8917;
1222
Amy Maloche70090f992012-02-16 16:35:26 -08001223 if (!enable)
1224 goto free_gpio;
1225
David Collins6f7c3472012-08-22 13:18:06 -07001226 rc = gpio_request(gpio, "haptics_clk");
Amy Maloche70090f992012-02-16 16:35:26 -08001227 if (rc) {
1228 pr_err("%s: unable to request gpio %d config(%d)\n",
David Collins6f7c3472012-08-22 13:18:06 -07001229 __func__, gpio, rc);
Amy Maloche70090f992012-02-16 16:35:26 -08001230 return rc;
1231 }
1232
David Collins6f7c3472012-08-22 13:18:06 -07001233 rc = gpio_direction_output(gpio, 0);
Amy Maloche70090f992012-02-16 16:35:26 -08001234 if (rc) {
1235 pr_err("%s: unable to set direction\n", __func__);
1236 goto free_gpio;
1237 }
1238
1239 return 0;
1240
1241free_gpio:
David Collins6f7c3472012-08-22 13:18:06 -07001242 gpio_free(gpio);
Amy Maloche70090f992012-02-16 16:35:26 -08001243 return rc;
1244}
1245
1246static struct isa1200_regulator isa1200_reg_data[] = {
1247 {
1248 .name = "vddp",
1249 .min_uV = ISA_I2C_VTG_MIN_UV,
1250 .max_uV = ISA_I2C_VTG_MAX_UV,
1251 .load_uA = ISA_I2C_CURR_UA,
1252 },
1253};
1254
1255static struct isa1200_platform_data isa1200_1_pdata = {
1256 .name = "vibrator",
1257 .dev_setup = isa1200_dev_setup,
Mohan Pallaka2d877602012-05-11 13:07:30 +05301258 .clk_enable = isa1200_clk_enable,
Mohan Pallaka32f20a72012-06-14 14:41:11 +05301259 .need_pwm_clk = true,
Amy Maloche70090f992012-02-16 16:35:26 -08001260 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
1261 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
1262 .max_timeout = 15000,
1263 .mode_ctrl = PWM_GEN_MODE,
1264 .pwm_fd = {
1265 .pwm_div = 256,
1266 },
1267 .is_erm = false,
1268 .smart_en = true,
1269 .ext_clk_en = true,
1270 .chip_en = 1,
1271 .regulator_info = isa1200_reg_data,
1272 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1273};
1274
1275static struct i2c_board_info isa1200_board_info[] __initdata = {
1276 {
1277 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1278 .platform_data = &isa1200_1_pdata,
1279 },
1280};
Jing Lin21ed4de2012-02-05 15:53:28 -08001281/* configuration data for mxt1386e using V2.1 firmware */
1282static const u8 mxt1386e_config_data_v2_1[] = {
1283 /* T6 Object */
1284 0, 0, 0, 0, 0, 0,
1285 /* T38 Object */
Jing Line4c47042012-08-31 10:54:44 -07001286 14, 3, 0, 5, 7, 12, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001287 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1288 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1289 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1290 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1291 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1292 0, 0, 0, 0,
1293 /* T7 Object */
Jing Line4c47042012-08-31 10:54:44 -07001294 32, 10, 50,
Jing Lin21ed4de2012-02-05 15:53:28 -08001295 /* T8 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001296 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001297 /* T9 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001298 139, 0, 0, 26, 42, 0, 32, 80, 2, 5,
Jing Line4c47042012-08-31 10:54:44 -07001299 0, 5, 5, 79, 10, 30, 10, 10, 255, 2,
Jing Linf1208fd2012-02-23 11:15:42 -08001300 85, 5, 0, 5, 9, 5, 12, 35, 70, 40,
1301 20, 5, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001302 /* T18 Object */
1303 0, 0,
1304 /* T24 Object */
1305 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1306 0, 0, 0, 0, 0, 0, 0, 0, 0,
1307 /* T25 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001308 1, 0, 60, 115, 156, 99,
Jing Lin21ed4de2012-02-05 15:53:28 -08001309 /* T27 Object */
1310 0, 0, 0, 0, 0, 0, 0,
1311 /* T40 Object */
1312 0, 0, 0, 0, 0,
1313 /* T42 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001314 0, 0, 255, 0, 255, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001315 /* T43 Object */
1316 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
1317 16,
1318 /* T46 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001319 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001320 /* T47 Object */
1321 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
1322 /* T48 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001323 1, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001324 32, 40, 0, 10, 10, 0, 0, 100, 10, 90,
1325 0, 0, 0, 0, 0, 0, 0, 10, 1, 10,
1326 52, 10, 12, 0, 33, 0, 1, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001327 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1328 0, 0, 0, 0,
1329 /* T56 Object */
1330 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1331 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1332 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1333 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001334 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1335 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001336};
1337
1338#define MXT_TS_GPIO_IRQ 6
1339#define MXT_TS_PWR_EN_GPIO PM8921_GPIO_PM_TO_SYS(23)
1340#define MXT_TS_RESET_GPIO 33
1341
1342static struct mxt_config_info mxt_config_array[] = {
1343 {
1344 .config = mxt1386e_config_data_v2_1,
1345 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1346 .family_id = 0xA0,
1347 .variant_id = 0x7,
1348 .version = 0x21,
1349 .build = 0xAA,
Jing Linef4aa9b2012-03-26 12:01:41 -07001350 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
1351 .fw_name = "atmel_8064_liquid_v2_2_AA.hex",
1352 },
1353 {
1354 /* The config data for V2.2.AA is the same as for V2.1.AA */
1355 .config = mxt1386e_config_data_v2_1,
1356 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1357 .family_id = 0xA0,
1358 .variant_id = 0x7,
1359 .version = 0x22,
1360 .build = 0xAA,
1361 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin21ed4de2012-02-05 15:53:28 -08001362 },
1363};
1364
1365static struct mxt_platform_data mxt_platform_data = {
1366 .config_array = mxt_config_array,
1367 .config_array_size = ARRAY_SIZE(mxt_config_array),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08001368 .panel_minx = 0,
1369 .panel_maxx = 1365,
1370 .panel_miny = 0,
1371 .panel_maxy = 767,
1372 .disp_minx = 0,
1373 .disp_maxx = 1365,
1374 .disp_miny = 0,
1375 .disp_maxy = 767,
Anirudh Ghayal39dbe3f2012-04-13 15:43:16 +05301376 .irqflags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
Jing Lin21ed4de2012-02-05 15:53:28 -08001377 .i2c_pull_up = true,
1378 .reset_gpio = MXT_TS_RESET_GPIO,
1379 .irq_gpio = MXT_TS_GPIO_IRQ,
1380};
1381
1382static struct i2c_board_info mxt_device_info[] __initdata = {
1383 {
1384 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
1385 .platform_data = &mxt_platform_data,
1386 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1387 },
1388};
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001389#define CYTTSP_TS_GPIO_IRQ 6
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001390#define CYTTSP_TS_GPIO_SLEEP 33
Amy Maloche609bb5e2012-08-03 09:41:42 -07001391#define CYTTSP_TS_GPIO_SLEEP_ALT 12
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001392
1393static ssize_t tma340_vkeys_show(struct kobject *kobj,
1394 struct kobj_attribute *attr, char *buf)
1395{
1396 return snprintf(buf, 200,
1397 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1398 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1399 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1400 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1401 "\n");
1402}
1403
1404static struct kobj_attribute tma340_vkeys_attr = {
1405 .attr = {
1406 .mode = S_IRUGO,
1407 },
1408 .show = &tma340_vkeys_show,
1409};
1410
1411static struct attribute *tma340_properties_attrs[] = {
1412 &tma340_vkeys_attr.attr,
1413 NULL
1414};
1415
1416static struct attribute_group tma340_properties_attr_group = {
1417 .attrs = tma340_properties_attrs,
1418};
1419
1420static int cyttsp_platform_init(struct i2c_client *client)
1421{
1422 int rc = 0;
1423 static struct kobject *tma340_properties_kobj;
1424
1425 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1426 tma340_properties_kobj = kobject_create_and_add("board_properties",
1427 NULL);
1428 if (tma340_properties_kobj)
1429 rc = sysfs_create_group(tma340_properties_kobj,
1430 &tma340_properties_attr_group);
1431 if (!tma340_properties_kobj || rc)
1432 pr_err("%s: failed to create board_properties\n",
1433 __func__);
1434
1435 return 0;
1436}
1437
1438static struct cyttsp_regulator cyttsp_regulator_data[] = {
1439 {
1440 .name = "vdd",
1441 .min_uV = CY_TMA300_VTG_MIN_UV,
1442 .max_uV = CY_TMA300_VTG_MAX_UV,
1443 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1444 .lpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1445 },
1446 {
1447 .name = "vcc_i2c",
1448 .min_uV = CY_I2C_VTG_MIN_UV,
1449 .max_uV = CY_I2C_VTG_MAX_UV,
1450 .hpm_load_uA = CY_I2C_CURR_UA,
1451 .lpm_load_uA = CY_I2C_CURR_UA,
1452 },
1453};
1454
1455static struct cyttsp_platform_data cyttsp_pdata = {
1456 .panel_maxx = 634,
1457 .panel_maxy = 1166,
Amy Maloche684fcda2012-12-05 14:28:53 -08001458 .disp_minx = 18,
1459 .disp_maxx = 617,
1460 .disp_miny = 18,
1461 .disp_maxy = 1041,
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001462 .flags = 0x01,
1463 .gen = CY_GEN3,
1464 .use_st = CY_USE_ST,
1465 .use_mt = CY_USE_MT,
1466 .use_hndshk = CY_SEND_HNDSHK,
1467 .use_trk_id = CY_USE_TRACKING_ID,
1468 .use_sleep = CY_USE_DEEP_SLEEP_SEL,
1469 .use_gestures = CY_USE_GESTURES,
1470 .fw_fname = "cyttsp_8064_mtp.hex",
1471 /* change act_intrvl to customize the Active power state
1472 * scanning/processing refresh interval for Operating mode
1473 */
1474 .act_intrvl = CY_ACT_INTRVL_DFLT,
1475 /* change tch_tmout to customize the touch timeout for the
1476 * Active power state for Operating mode
1477 */
1478 .tch_tmout = CY_TCH_TMOUT_DFLT,
1479 /* change lp_intrvl to customize the Low Power power state
1480 * scanning/processing refresh interval for Operating mode
1481 */
1482 .lp_intrvl = CY_LP_INTRVL_DFLT,
1483 .sleep_gpio = CYTTSP_TS_GPIO_SLEEP,
Amy Maloche9ba3ffe2012-04-26 10:31:20 -07001484 .resout_gpio = -1,
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001485 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1486 .regulator_info = cyttsp_regulator_data,
1487 .num_regulators = ARRAY_SIZE(cyttsp_regulator_data),
1488 .init = cyttsp_platform_init,
1489 .correct_fw_ver = 17,
1490};
1491
1492static struct i2c_board_info cyttsp_info[] __initdata = {
1493 {
1494 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1495 .platform_data = &cyttsp_pdata,
1496 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1497 },
1498};
Jing Lin21ed4de2012-02-05 15:53:28 -08001499
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001500#define MSM_WCNSS_PHYS 0x03000000
1501#define MSM_WCNSS_SIZE 0x280000
1502
1503static struct resource resources_wcnss_wlan[] = {
1504 {
1505 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1506 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1507 .name = "wcnss_wlanrx_irq",
1508 .flags = IORESOURCE_IRQ,
1509 },
1510 {
1511 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1512 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1513 .name = "wcnss_wlantx_irq",
1514 .flags = IORESOURCE_IRQ,
1515 },
1516 {
1517 .start = MSM_WCNSS_PHYS,
1518 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1519 .name = "wcnss_mmio",
1520 .flags = IORESOURCE_MEM,
1521 },
1522 {
1523 .start = 64,
1524 .end = 68,
1525 .name = "wcnss_gpios_5wire",
1526 .flags = IORESOURCE_IO,
1527 },
1528};
1529
1530static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1531 .has_48mhz_xo = 1,
1532};
1533
1534static struct platform_device msm_device_wcnss_wlan = {
1535 .name = "wcnss_wlan",
1536 .id = 0,
1537 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1538 .resource = resources_wcnss_wlan,
1539 .dev = {.platform_data = &qcom_wcnss_pdata},
1540};
1541
Ankit Vermab7c26e62012-02-28 15:04:15 -08001542static struct platform_device msm_device_iris_fm __devinitdata = {
1543 .name = "iris_fm",
1544 .id = -1,
1545};
1546
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001547#ifdef CONFIG_QSEECOM
1548/* qseecom bus scaling */
1549static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
1550 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001551 .src = MSM_BUS_MASTER_ADM_PORT0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001552 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001553 .ab = 0,
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001554 .ib = 0,
1555 },
1556 {
1557 .src = MSM_BUS_MASTER_ADM_PORT1,
1558 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1559 .ab = 0,
1560 .ib = 0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001561 },
1562 {
1563 .src = MSM_BUS_MASTER_SPDM,
1564 .dst = MSM_BUS_SLAVE_SPDM,
1565 .ib = 0,
1566 .ab = 0,
1567 },
1568};
1569
1570static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
1571 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001572 .src = MSM_BUS_MASTER_ADM_PORT0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001573 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001574 .ab = 70000000UL,
1575 .ib = 70000000UL,
1576 },
1577 {
1578 .src = MSM_BUS_MASTER_ADM_PORT1,
1579 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1580 .ab = 2480000000UL,
1581 .ib = 2480000000UL,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001582 },
1583 {
1584 .src = MSM_BUS_MASTER_SPDM,
1585 .dst = MSM_BUS_SLAVE_SPDM,
1586 .ib = 0,
1587 .ab = 0,
1588 },
1589};
1590
1591static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1592 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001593 .src = MSM_BUS_MASTER_ADM_PORT0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001594 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001595 .ab = 0,
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001596 .ib = 0,
1597 },
1598 {
1599 .src = MSM_BUS_MASTER_ADM_PORT1,
1600 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1601 .ab = 0,
1602 .ib = 0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001603 },
1604 {
1605 .src = MSM_BUS_MASTER_SPDM,
1606 .dst = MSM_BUS_SLAVE_SPDM,
1607 .ib = (64 * 8) * 1000000UL,
1608 .ab = (64 * 8) * 100000UL,
1609 },
1610};
1611
Ramesh Masavarapu4f091cb2012-10-03 10:18:06 -07001612static struct msm_bus_vectors qseecom_enable_dfab_sfpb_vectors[] = {
1613 {
1614 .src = MSM_BUS_MASTER_ADM_PORT0,
1615 .dst = MSM_BUS_SLAVE_EBI_CH0,
1616 .ab = 70000000UL,
1617 .ib = 70000000UL,
1618 },
1619 {
1620 .src = MSM_BUS_MASTER_ADM_PORT1,
1621 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1622 .ab = 2480000000UL,
1623 .ib = 2480000000UL,
1624 },
1625 {
1626 .src = MSM_BUS_MASTER_SPDM,
1627 .dst = MSM_BUS_SLAVE_SPDM,
1628 .ib = (64 * 8) * 1000000UL,
1629 .ab = (64 * 8) * 100000UL,
1630 },
1631};
1632
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001633static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1634 {
1635 ARRAY_SIZE(qseecom_clks_init_vectors),
1636 qseecom_clks_init_vectors,
1637 },
1638 {
1639 ARRAY_SIZE(qseecom_enable_dfab_vectors),
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001640 qseecom_enable_dfab_vectors,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001641 },
1642 {
1643 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1644 qseecom_enable_sfpb_vectors,
1645 },
Ramesh Masavarapu4f091cb2012-10-03 10:18:06 -07001646 {
1647 ARRAY_SIZE(qseecom_enable_dfab_sfpb_vectors),
1648 qseecom_enable_dfab_sfpb_vectors,
1649 },
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001650};
1651
1652static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1653 qseecom_hw_bus_scale_usecases,
1654 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1655 .name = "qsee",
1656};
1657
1658static struct platform_device qseecom_device = {
1659 .name = "qseecom",
1660 .id = 0,
1661 .dev = {
1662 .platform_data = &qseecom_bus_pdata,
1663 },
1664};
1665#endif
1666
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001667#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1668 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1669 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1670 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1671
1672#define QCE_SIZE 0x10000
1673#define QCE_0_BASE 0x11000000
1674
1675#define QCE_HW_KEY_SUPPORT 0
1676#define QCE_SHA_HMAC_SUPPORT 1
1677#define QCE_SHARE_CE_RESOURCE 3
1678#define QCE_CE_SHARED 0
1679
1680static struct resource qcrypto_resources[] = {
1681 [0] = {
1682 .start = QCE_0_BASE,
1683 .end = QCE_0_BASE + QCE_SIZE - 1,
1684 .flags = IORESOURCE_MEM,
1685 },
1686 [1] = {
1687 .name = "crypto_channels",
1688 .start = DMOV8064_CE_IN_CHAN,
1689 .end = DMOV8064_CE_OUT_CHAN,
1690 .flags = IORESOURCE_DMA,
1691 },
1692 [2] = {
1693 .name = "crypto_crci_in",
1694 .start = DMOV8064_CE_IN_CRCI,
1695 .end = DMOV8064_CE_IN_CRCI,
1696 .flags = IORESOURCE_DMA,
1697 },
1698 [3] = {
1699 .name = "crypto_crci_out",
1700 .start = DMOV8064_CE_OUT_CRCI,
1701 .end = DMOV8064_CE_OUT_CRCI,
1702 .flags = IORESOURCE_DMA,
1703 },
1704};
1705
1706static struct resource qcedev_resources[] = {
1707 [0] = {
1708 .start = QCE_0_BASE,
1709 .end = QCE_0_BASE + QCE_SIZE - 1,
1710 .flags = IORESOURCE_MEM,
1711 },
1712 [1] = {
1713 .name = "crypto_channels",
1714 .start = DMOV8064_CE_IN_CHAN,
1715 .end = DMOV8064_CE_OUT_CHAN,
1716 .flags = IORESOURCE_DMA,
1717 },
1718 [2] = {
1719 .name = "crypto_crci_in",
1720 .start = DMOV8064_CE_IN_CRCI,
1721 .end = DMOV8064_CE_IN_CRCI,
1722 .flags = IORESOURCE_DMA,
1723 },
1724 [3] = {
1725 .name = "crypto_crci_out",
1726 .start = DMOV8064_CE_OUT_CRCI,
1727 .end = DMOV8064_CE_OUT_CRCI,
1728 .flags = IORESOURCE_DMA,
1729 },
1730};
1731
1732#endif
1733
1734#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1735 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1736
1737static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1738 .ce_shared = QCE_CE_SHARED,
1739 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1740 .hw_key_support = QCE_HW_KEY_SUPPORT,
1741 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001742 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001743};
1744
1745static struct platform_device qcrypto_device = {
1746 .name = "qcrypto",
1747 .id = 0,
1748 .num_resources = ARRAY_SIZE(qcrypto_resources),
1749 .resource = qcrypto_resources,
1750 .dev = {
1751 .coherent_dma_mask = DMA_BIT_MASK(32),
1752 .platform_data = &qcrypto_ce_hw_suppport,
1753 },
1754};
1755#endif
1756
1757#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1758 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1759
1760static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1761 .ce_shared = QCE_CE_SHARED,
1762 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1763 .hw_key_support = QCE_HW_KEY_SUPPORT,
1764 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001765 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001766};
1767
1768static struct platform_device qcedev_device = {
1769 .name = "qce",
1770 .id = 0,
1771 .num_resources = ARRAY_SIZE(qcedev_resources),
1772 .resource = qcedev_resources,
1773 .dev = {
1774 .coherent_dma_mask = DMA_BIT_MASK(32),
1775 .platform_data = &qcedev_ce_hw_suppport,
1776 },
1777};
1778#endif
1779
Joel Kingef390842012-05-23 16:42:48 -07001780static struct mdm_vddmin_resource mdm_vddmin_rscs = {
1781 .rpm_id = MSM_RPM_ID_VDDMIN_GPIO,
1782 .ap2mdm_vddmin_gpio = 30,
1783 .modes = 0x03,
1784 .drive_strength = 8,
1785 .mdm2ap_vddmin_gpio = 80,
1786};
1787
Joel King269aa602012-07-23 08:07:35 -07001788static struct gpiomux_setting mdm2ap_status_gpio_run_cfg = {
1789 .func = GPIOMUX_FUNC_GPIO,
1790 .drv = GPIOMUX_DRV_8MA,
1791 .pull = GPIOMUX_PULL_NONE,
1792};
1793
Joel Kingdacbc822012-01-25 13:30:57 -08001794static struct mdm_platform_data mdm_platform_data = {
1795 .mdm_version = "3.0",
1796 .ramdump_delay_ms = 2000,
Joel King14fe7fa2012-05-27 14:26:11 -07001797 .early_power_on = 1,
1798 .sfr_query = 1,
Joel Kingef390842012-05-23 16:42:48 -07001799 .vddmin_resource = &mdm_vddmin_rscs,
Hemant Kumara945b472012-01-25 15:08:06 -08001800 .peripheral_platform_device = &apq8064_device_hsic_host,
Ameya Thakurc9a7a842012-06-24 22:47:52 -07001801 .ramdump_timeout_ms = 120000,
Joel King269aa602012-07-23 08:07:35 -07001802 .mdm2ap_status_gpio_run_cfg = &mdm2ap_status_gpio_run_cfg,
Ameya Thakurffd21b02013-01-30 11:33:22 -08001803 .sysmon_subsys_id_valid = 1,
1804 .sysmon_subsys_id = SYSMON_SS_EXT_MODEM,
Joel Kingdacbc822012-01-25 13:30:57 -08001805};
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001806
Joel Kingfdde32b2013-02-06 17:38:05 -08001807static struct mdm_platform_data amdm_platform_data = {
1808 .mdm_version = "3.0",
1809 .ramdump_delay_ms = 2000,
1810 .early_power_on = 1,
1811 .sfr_query = 1,
1812 .send_shdn = 1,
1813 .vddmin_resource = &mdm_vddmin_rscs,
1814 .peripheral_platform_device = &apq8064_device_hsic_host,
1815 .ramdump_timeout_ms = 120000,
1816 .mdm2ap_status_gpio_run_cfg = &mdm2ap_status_gpio_run_cfg,
1817 .sysmon_subsys_id_valid = 1,
1818 .sysmon_subsys_id = SYSMON_SS_EXT_MODEM,
1819 .no_a2m_errfatal_on_ssr = 1,
1820};
1821
Ameya Thakur2702baf2013-01-30 11:55:25 -08001822static struct mdm_vddmin_resource bmdm_vddmin_rscs = {
1823 .rpm_id = MSM_RPM_ID_VDDMIN_GPIO,
1824 .ap2mdm_vddmin_gpio = 30,
1825 .modes = 0x03,
1826 .drive_strength = 8,
1827 .mdm2ap_vddmin_gpio = 64,
1828};
1829
1830static struct mdm_platform_data bmdm_platform_data = {
1831 .mdm_version = "3.0",
1832 .ramdump_delay_ms = 2000,
1833 .sfr_query = 1,
1834 .send_shdn = 1,
1835 .vddmin_resource = &bmdm_vddmin_rscs,
1836 .peripheral_platform_device = &apq8064_device_ehci_host3,
1837 .ramdump_timeout_ms = 120000,
1838 .mdm2ap_status_gpio_run_cfg = &mdm2ap_status_gpio_run_cfg,
Joel Kingfdde32b2013-02-06 17:38:05 -08001839 .sysmon_subsys_id_valid = 1,
1840 .sysmon_subsys_id = SYSMON_SS_EXT_MODEM2,
1841 .no_a2m_errfatal_on_ssr = 1,
Ameya Thakur2702baf2013-01-30 11:55:25 -08001842};
1843
Joel King57aefdd2013-03-11 13:46:05 -07001844static struct mdm_platform_data sglte2_mdm_platform_data = {
1845 .mdm_version = "3.0",
1846 .ramdump_delay_ms = 2000,
1847 .early_power_on = 1,
1848 .sfr_query = 1,
1849 .vddmin_resource = &mdm_vddmin_rscs,
1850 .peripheral_platform_device = &apq8064_device_hsic_host,
1851 .ramdump_timeout_ms = 120000,
1852 .mdm2ap_status_gpio_run_cfg = &mdm2ap_status_gpio_run_cfg,
1853 .sysmon_subsys_id_valid = 1,
1854 .sysmon_subsys_id = SYSMON_SS_EXT_MODEM,
1855 .no_a2m_errfatal_on_ssr = 1,
Joel Kinga0e9ce92013-03-25 10:42:35 -07001856 .subsys_name = "external_modem_mdm",
Joel King57aefdd2013-03-11 13:46:05 -07001857};
1858
Joel King3166e892013-02-26 11:16:08 -08001859static struct mdm_platform_data sglte2_qsc_platform_data = {
1860 .mdm_version = "3.0",
1861 .ramdump_delay_ms = 2000,
1862 .ramdump_timeout_ms = 600000,
1863 .no_powerdown_after_ramdumps = 1,
1864 .image_upgrade_supported = 1,
Joel King57aefdd2013-03-11 13:46:05 -07001865 .no_a2m_errfatal_on_ssr = 1,
Joel King68cb5462013-03-15 12:54:33 -07001866 .no_reset_on_first_powerup = 1,
Joel King64677852013-03-20 12:59:23 -07001867 .kpd_not_inverted = 1,
Joel Kinga0e9ce92013-03-25 10:42:35 -07001868 .subsys_name = "external_modem",
Joel King3166e892013-02-26 11:16:08 -08001869};
1870
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001871static struct tsens_platform_data apq_tsens_pdata = {
1872 .tsens_factor = 1000,
1873 .hw_type = APQ_8064,
1874 .tsens_num_sensor = 11,
1875 .slope = {1176, 1176, 1154, 1176, 1111,
1876 1132, 1132, 1199, 1132, 1199, 1132},
1877};
1878
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07001879static struct platform_device msm_tsens_device = {
1880 .name = "tsens8960-tm",
1881 .id = -1,
1882};
1883
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06001884static struct msm_thermal_data msm_thermal_pdata = {
1885 .sensor_id = 7,
Eugene Seah2ee4a5d2012-06-25 18:16:41 -06001886 .poll_ms = 250,
1887 .limit_temp_degC = 60,
1888 .temp_hysteresis_degC = 10,
1889 .freq_step = 2,
Praveen Chidambaram771c7892013-02-21 11:44:38 -07001890 .core_limit_temp_degC = 80,
1891 .core_temp_hysteresis_degC = 10,
1892 .core_control_mask = 0xe,
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06001893};
1894
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001895#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001896static void __init apq8064_map_io(void)
1897{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001898 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001899 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001900 if (socinfo_init() < 0)
1901 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001902}
1903
1904static void __init apq8064_init_irq(void)
1905{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001906 struct msm_mpm_device_data *data = NULL;
1907
1908#ifdef CONFIG_MSM_MPM
1909 data = &apq8064_mpm_dev_data;
1910#endif
1911
1912 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001913 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1914 (void *)MSM_QGIC_CPU_BASE);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001915}
1916
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001917static struct platform_device msm8064_device_saw_regulator_core0 = {
1918 .name = "saw-regulator",
1919 .id = 0,
1920 .dev = {
1921 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
1922 },
1923};
1924
1925static struct platform_device msm8064_device_saw_regulator_core1 = {
1926 .name = "saw-regulator",
1927 .id = 1,
1928 .dev = {
1929 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
1930 },
1931};
1932
1933static struct platform_device msm8064_device_saw_regulator_core2 = {
1934 .name = "saw-regulator",
1935 .id = 2,
1936 .dev = {
1937 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
1938 },
1939};
1940
1941static struct platform_device msm8064_device_saw_regulator_core3 = {
1942 .name = "saw-regulator",
1943 .id = 3,
1944 .dev = {
1945 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001946
1947 },
1948};
1949
Oluwafemi Adeyemif5a31422012-03-08 16:58:45 -08001950static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001951 {
1952 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1953 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1954 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001955 1, 784, 180000, 100,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001956 },
1957
1958 {
Anji Jonnala85b29ff2013-01-15 14:12:45 +05301959 MSM_PM_SLEEP_MODE_RETENTION,
1960 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1961 true,
1962 415, 715, 340827, 475,
1963 },
1964
1965 {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001966 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1967 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1968 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001969 1300, 228, 1200000, 2000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001970 },
1971
1972 {
1973 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1974 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1975 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001976 2000, 138, 1208400, 3200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001977 },
1978
1979 {
1980 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001981 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
1982 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001983 6000, 119, 1850300, 9000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001984 },
1985
1986 {
1987 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1988 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1989 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001990 9200, 68, 2839200, 16400,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001991 },
1992
1993 {
1994 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1995 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1996 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001997 10300, 63, 3128000, 18200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001998 },
1999
2000 {
2001 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2002 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2003 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002004 18000, 10, 4602600, 27000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002005 },
2006
2007 {
2008 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2009 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2010 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002011 20000, 2, 5752000, 32000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002012 },
2013};
2014
2015static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2016 .mode = MSM_PM_BOOT_CONFIG_TZ,
2017};
2018
2019static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2020 .levels = &msm_rpmrs_levels[0],
2021 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2022 .vdd_mem_levels = {
2023 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2024 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2025 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2026 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2027 },
2028 .vdd_dig_levels = {
2029 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
2030 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
2031 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
2032 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
2033 },
2034 .vdd_mask = 0x7FFFFF,
2035 .rpmrs_target_id = {
2036 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2037 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
2038 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
2039 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
2040 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
2041 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
2042 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2043 },
2044};
2045
Praveen Chidambaram78499012011-11-01 17:15:17 -06002046static uint8_t spm_wfi_cmd_sequence[] __initdata = {
2047 0x03, 0x0f,
2048};
2049
2050static uint8_t spm_power_collapse_without_rpm[] __initdata = {
2051 0x00, 0x24, 0x54, 0x10,
2052 0x09, 0x03, 0x01,
2053 0x10, 0x54, 0x30, 0x0C,
2054 0x24, 0x30, 0x0f,
2055};
2056
Anji Jonnala85b29ff2013-01-15 14:12:45 +05302057static uint8_t spm_retention_cmd_sequence[] __initdata = {
2058 0x00, 0x05, 0x03, 0x0D,
2059 0x0B, 0x00, 0x0f,
2060};
2061
Anji Jonnala786b39e2013-01-29 13:34:10 +05302062static uint8_t spm_retention_with_krait_v3_cmd_sequence[] __initdata = {
2063 0x42, 0x1B, 0x00,
2064 0x05, 0x03, 0x0D, 0x0B,
2065 0x00, 0x42, 0x1B,
2066 0x0f,
2067};
2068
Praveen Chidambaram78499012011-11-01 17:15:17 -06002069static uint8_t spm_power_collapse_with_rpm[] __initdata = {
2070 0x00, 0x24, 0x54, 0x10,
2071 0x09, 0x07, 0x01, 0x0B,
2072 0x10, 0x54, 0x30, 0x0C,
2073 0x24, 0x30, 0x0f,
2074};
2075
Anji Jonnala0f297a92013-01-19 11:22:25 +05302076/* 8064AB has a different command to assert apc_pdn */
2077static uint8_t spm_power_collapse_without_rpm_krait_v3[] __initdata = {
2078 0x00, 0x24, 0x84, 0x10,
2079 0x09, 0x03, 0x01,
2080 0x10, 0x84, 0x30, 0x0C,
2081 0x24, 0x30, 0x0f,
2082};
2083
2084static uint8_t spm_power_collapse_with_rpm_krait_v3[] __initdata = {
2085 0x00, 0x24, 0x84, 0x10,
2086 0x09, 0x07, 0x01, 0x0B,
2087 0x10, 0x84, 0x30, 0x0C,
2088 0x24, 0x30, 0x0f,
2089};
2090
Anji Jonnala85b29ff2013-01-15 14:12:45 +05302091static struct msm_spm_seq_entry msm_spm_boot_cpu_seq_list[] __initdata = {
2092 [0] = {
2093 .mode = MSM_SPM_MODE_CLOCK_GATING,
2094 .notify_rpm = false,
2095 .cmd = spm_wfi_cmd_sequence,
2096 },
2097 [1] = {
2098 .mode = MSM_SPM_MODE_POWER_RETENTION,
2099 .notify_rpm = false,
2100 .cmd = spm_retention_cmd_sequence,
2101 },
2102 [2] = {
2103 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2104 .notify_rpm = false,
2105 .cmd = spm_power_collapse_without_rpm,
2106 },
2107 [3] = {
2108 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2109 .notify_rpm = true,
2110 .cmd = spm_power_collapse_with_rpm,
2111 },
2112};
2113static struct msm_spm_seq_entry msm_spm_nonboot_cpu_seq_list[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06002114 [0] = {
2115 .mode = MSM_SPM_MODE_CLOCK_GATING,
2116 .notify_rpm = false,
2117 .cmd = spm_wfi_cmd_sequence,
2118 },
2119 [1] = {
Anji Jonnala786b39e2013-01-29 13:34:10 +05302120 .mode = MSM_SPM_MODE_POWER_RETENTION,
2121 .notify_rpm = false,
2122 .cmd = spm_retention_cmd_sequence,
2123 },
2124 [2] = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06002125 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2126 .notify_rpm = false,
2127 .cmd = spm_power_collapse_without_rpm,
2128 },
Anji Jonnala786b39e2013-01-29 13:34:10 +05302129 [3] = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06002130 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2131 .notify_rpm = true,
2132 .cmd = spm_power_collapse_with_rpm,
2133 },
2134};
2135
2136static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
2137 0x00, 0x20, 0x03, 0x20,
2138 0x00, 0x0f,
2139};
2140
2141static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
2142 0x00, 0x20, 0x34, 0x64,
2143 0x48, 0x07, 0x48, 0x20,
2144 0x50, 0x64, 0x04, 0x34,
2145 0x50, 0x0f,
2146};
2147static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
2148 0x00, 0x10, 0x34, 0x64,
2149 0x48, 0x07, 0x48, 0x10,
2150 0x50, 0x64, 0x04, 0x34,
2151 0x50, 0x0F,
2152};
2153
2154static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
2155 [0] = {
2156 .mode = MSM_SPM_L2_MODE_RETENTION,
2157 .notify_rpm = false,
2158 .cmd = l2_spm_wfi_cmd_sequence,
2159 },
2160 [1] = {
2161 .mode = MSM_SPM_L2_MODE_GDHS,
2162 .notify_rpm = true,
2163 .cmd = l2_spm_gdhs_cmd_sequence,
2164 },
2165 [2] = {
2166 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
2167 .notify_rpm = true,
2168 .cmd = l2_spm_power_off_cmd_sequence,
2169 },
2170};
2171
2172
2173static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
2174 [0] = {
2175 .reg_base_addr = MSM_SAW_L2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002176 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07002177 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002178 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
2179 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
2180 .modes = msm_spm_l2_seq_list,
2181 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
2182 },
2183};
2184
2185static struct msm_spm_platform_data msm_spm_data[] __initdata = {
2186 [0] = {
2187 .reg_base_addr = MSM_SAW0_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002188 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002189#if defined(CONFIG_MSM_AVS_HW)
2190 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2191 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2192#endif
2193 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Anji Jonnala85b29ff2013-01-15 14:12:45 +05302194 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004,
2195 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C,
2196 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002197 .vctl_timeout_us = 50,
Anji Jonnala85b29ff2013-01-15 14:12:45 +05302198 .num_modes = ARRAY_SIZE(msm_spm_boot_cpu_seq_list),
2199 .modes = msm_spm_boot_cpu_seq_list,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002200 },
2201 [1] = {
2202 .reg_base_addr = MSM_SAW1_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002203 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002204#if defined(CONFIG_MSM_AVS_HW)
2205 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2206 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2207#endif
2208 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Anji Jonnala786b39e2013-01-29 13:34:10 +05302209 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004,
2210 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C,
2211 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002212 .vctl_timeout_us = 50,
Anji Jonnala85b29ff2013-01-15 14:12:45 +05302213 .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
2214 .modes = msm_spm_nonboot_cpu_seq_list,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002215 },
2216 [2] = {
2217 .reg_base_addr = MSM_SAW2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002218 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002219#if defined(CONFIG_MSM_AVS_HW)
2220 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2221 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2222#endif
2223 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Anji Jonnala786b39e2013-01-29 13:34:10 +05302224 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004,
2225 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C,
2226 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002227 .vctl_timeout_us = 50,
Anji Jonnala85b29ff2013-01-15 14:12:45 +05302228 .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
2229 .modes = msm_spm_nonboot_cpu_seq_list,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002230 },
2231 [3] = {
2232 .reg_base_addr = MSM_SAW3_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002233 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002234#if defined(CONFIG_MSM_AVS_HW)
2235 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2236 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2237#endif
2238 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Anji Jonnala786b39e2013-01-29 13:34:10 +05302239 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004,
2240 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C,
2241 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002242 .vctl_timeout_us = 50,
Anji Jonnala85b29ff2013-01-15 14:12:45 +05302243 .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
2244 .modes = msm_spm_nonboot_cpu_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08002245 },
2246};
2247
Anji Jonnala0f297a92013-01-19 11:22:25 +05302248static void __init apq8064ab_update_krait_spm(void)
2249{
2250 int i;
2251
2252 /* Update the SPM sequences for SPC and PC */
2253 for (i = 0; i < ARRAY_SIZE(msm_spm_data); i++) {
2254 int j;
2255 struct msm_spm_platform_data *pdata = &msm_spm_data[i];
2256 for (j = 0; j < pdata->num_modes; j++) {
2257 if (pdata->modes[j].cmd ==
2258 spm_power_collapse_without_rpm)
2259 pdata->modes[j].cmd =
2260 spm_power_collapse_without_rpm_krait_v3;
2261 else if (pdata->modes[j].cmd ==
2262 spm_power_collapse_with_rpm)
2263 pdata->modes[j].cmd =
2264 spm_power_collapse_with_rpm_krait_v3;
2265 }
2266 }
2267}
2268
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002269static void __init apq8064_init_buses(void)
2270{
2271 msm_bus_rpm_set_mt_mask();
2272 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
2273 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
2274 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
2275 msm_bus_8064_apps_fabric.dev.platform_data =
2276 &msm_bus_8064_apps_fabric_pdata;
2277 msm_bus_8064_sys_fabric.dev.platform_data =
2278 &msm_bus_8064_sys_fabric_pdata;
2279 msm_bus_8064_mm_fabric.dev.platform_data =
2280 &msm_bus_8064_mm_fabric_pdata;
2281 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
2282 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
2283}
2284
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002285/* PCIe gpios */
2286static struct msm_pcie_gpio_info_t msm_pcie_gpio_info[MSM_PCIE_MAX_GPIO] = {
2287 {"rst_n", PM8921_MPP_PM_TO_SYS(PCIE_RST_N_PMIC_MPP), 0},
2288 {"pwr_en", PM8921_GPIO_PM_TO_SYS(PCIE_PWR_EN_PMIC_GPIO), 1},
2289};
2290
2291static struct msm_pcie_platform msm_pcie_platform_data = {
2292 .gpio = msm_pcie_gpio_info,
Niranjana Vishwanathapura68210ff2012-06-24 18:03:49 -06002293 .axi_addr = PCIE_AXI_BAR_PHYS,
2294 .axi_size = PCIE_AXI_BAR_SIZE,
Niranjana Vishwanathapura459a27d2012-07-20 12:23:55 -06002295 .wake_n = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, PCIE_WAKE_N_PMIC_GPIO),
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002296};
2297
Niranjana Vishwanathapurac1edd402012-06-28 15:32:50 -06002298static int __init mpq8064_pcie_enabled(void)
2299{
2300 return !((readl_relaxed(QFPROM_RAW_FEAT_CONFIG_ROW0_MSB) & BIT(21)) ||
2301 (readl_relaxed(QFPROM_RAW_OEM_CONFIG_ROW0_LSB) & BIT(4)));
2302}
2303
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002304static void __init mpq8064_pcie_init(void)
2305{
Niranjana Vishwanathapurac1edd402012-06-28 15:32:50 -06002306 if (mpq8064_pcie_enabled()) {
2307 msm_device_pcie.dev.platform_data = &msm_pcie_platform_data;
2308 platform_device_register(&msm_device_pcie);
2309 }
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002310}
2311
David Collinsf0d00732012-01-25 15:46:50 -08002312static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
2313 .name = GPIO_REGULATOR_DEV_NAME,
2314 .id = PM8921_MPP_PM_TO_SYS(7),
2315 .dev = {
2316 .platform_data
2317 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2318 },
2319};
2320
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08002321static struct platform_device apq8064_device_ext_mpp8_vreg __devinitdata = {
2322 .name = GPIO_REGULATOR_DEV_NAME,
2323 .id = PM8921_MPP_PM_TO_SYS(8),
2324 .dev = {
2325 .platform_data
2326 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_MPP8],
2327 },
2328};
2329
David Collinsf0d00732012-01-25 15:46:50 -08002330static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
2331 .name = GPIO_REGULATOR_DEV_NAME,
2332 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
2333 .dev = {
2334 .platform_data =
2335 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2336 },
2337};
2338
David Collins390fc332012-02-07 14:38:16 -08002339static struct platform_device apq8064_device_ext_ts_sw_vreg __devinitdata = {
2340 .name = GPIO_REGULATOR_DEV_NAME,
2341 .id = PM8921_GPIO_PM_TO_SYS(23),
2342 .dev = {
2343 .platform_data
2344 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_TS_SW],
2345 },
2346};
2347
David Collins2782b5c2012-02-06 10:02:42 -08002348static struct platform_device apq8064_device_rpm_regulator __devinitdata = {
2349 .name = "rpm-regulator",
David Collins36199252012-08-21 15:43:02 -07002350 .id = 0,
David Collins2782b5c2012-02-06 10:02:42 -08002351 .dev = {
2352 .platform_data = &apq8064_rpm_regulator_pdata,
2353 },
2354};
2355
David Collins36199252012-08-21 15:43:02 -07002356static struct platform_device
2357apq8064_pm8921_device_rpm_regulator __devinitdata = {
2358 .name = "rpm-regulator",
2359 .id = 1,
2360 .dev = {
2361 .platform_data = &apq8064_rpm_regulator_pm8921_pdata,
2362 },
2363};
2364
Ravi Kumar V05931a22012-04-04 17:09:37 +05302365static struct gpio_ir_recv_platform_data gpio_ir_recv_pdata = {
2366 .gpio_nr = 88,
2367 .active_low = 1,
2368};
2369
2370static struct platform_device gpio_ir_recv_pdev = {
2371 .name = "gpio-rc-recv",
2372 .dev = {
2373 .platform_data = &gpio_ir_recv_pdata,
2374 },
2375};
2376
Terence Hampson36b70722012-05-10 13:18:16 -04002377static struct platform_device *common_not_mpq_devices[] __initdata = {
David Keitel3c40fc52012-02-09 17:53:52 -08002378 &apq8064_device_qup_i2c_gsbi1,
Jing Lin04601f92012-02-05 15:36:07 -08002379 &apq8064_device_qup_i2c_gsbi3,
Terence Hampson36b70722012-05-10 13:18:16 -04002380};
2381
David Collins36199252012-08-21 15:43:02 -07002382static struct platform_device *early_common_devices[] __initdata = {
Matt Wagantallf5cc3892012-06-07 19:47:02 -07002383 &apq8064_device_acpuclk,
Terence Hampson36b70722012-05-10 13:18:16 -04002384 &apq8064_device_dmov,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002385 &apq8064_device_qup_spi_gsbi5,
David Collins36199252012-08-21 15:43:02 -07002386};
2387
2388static struct platform_device *pm8921_common_devices[] __initdata = {
David Collinsf0d00732012-01-25 15:46:50 -08002389 &apq8064_device_ext_5v_vreg,
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08002390 &apq8064_device_ext_mpp8_vreg,
David Collinsf0d00732012-01-25 15:46:50 -08002391 &apq8064_device_ext_3p3v_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07002392 &apq8064_device_ssbi_pmic1,
2393 &apq8064_device_ssbi_pmic2,
David Collins36199252012-08-21 15:43:02 -07002394};
2395
2396static struct platform_device *pm8917_common_devices[] __initdata = {
2397 &apq8064_device_ext_mpp8_vreg,
2398 &apq8064_device_ext_3p3v_vreg,
2399 &apq8064_device_ssbi_pmic1,
2400 &apq8064_device_ssbi_pmic2,
David Collins36199252012-08-21 15:43:02 -07002401};
2402
2403static struct platform_device *common_devices[] __initdata = {
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06002404 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07002405 &apq8064_device_otg,
2406 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08002407 &apq8064_device_hsusb_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07002408 &android_usb_device,
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08002409 &msm_device_wcnss_wlan,
Ankit Vermab7c26e62012-02-28 15:04:15 -08002410 &msm_device_iris_fm,
Larry Bassel67b921d2012-04-06 10:23:27 -07002411 &apq8064_fmem_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08002412#ifdef CONFIG_ANDROID_PMEM
2413#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002414 &apq8064_android_pmem_device,
2415 &apq8064_android_pmem_adsp_device,
2416 &apq8064_android_pmem_audio_device,
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -07002417#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
2418#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -08002419#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002420 &apq8064_ion_dev,
Olav Haugan7c6aa742012-01-16 16:47:37 -08002421#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002422 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08002423 &msm8064_device_saw_regulator_core0,
2424 &msm8064_device_saw_regulator_core1,
2425 &msm8064_device_saw_regulator_core2,
2426 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002427#if defined(CONFIG_QSEECOM)
2428 &qseecom_device,
2429#endif
2430
Joel Nider6b9a7bc2012-06-26 11:19:19 +03002431 &msm_8064_device_tsif[0],
2432 &msm_8064_device_tsif[1],
2433
Ramesh Masavarapu28311912011-10-27 11:04:12 -07002434#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2435 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2436 &qcrypto_device,
2437#endif
2438
2439#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2440 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2441 &qcedev_device,
2442#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07002443
2444#ifdef CONFIG_HW_RANDOM_MSM
2445 &apq8064_device_rng,
2446#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002447 &apq_pcm,
2448 &apq_pcm_routing,
2449 &apq_cpudai0,
2450 &apq_cpudai1,
Santosh Mardieff9a742012-04-09 23:23:39 +05302451 &mpq_cpudai_sec_i2s_rx,
Kuirong Wangf23f8c52012-03-31 12:34:51 -07002452 &mpq_cpudai_mi2s_tx,
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002453 &apq_cpudai_hdmi_rx,
2454 &apq_cpudai_bt_rx,
2455 &apq_cpudai_bt_tx,
2456 &apq_cpudai_fm_rx,
2457 &apq_cpudai_fm_tx,
2458 &apq_cpu_fe,
2459 &apq_stub_codec,
2460 &apq_voice,
2461 &apq_voip,
2462 &apq_lpa_pcm,
Krishnankutty Kolathappilly4374e332012-03-18 22:27:30 -07002463 &apq_compr_dsp,
2464 &apq_multi_ch_pcm,
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -07002465 &apq_lowlatency_pcm,
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002466 &apq_pcm_hostless,
2467 &apq_cpudai_afe_01_rx,
2468 &apq_cpudai_afe_01_tx,
2469 &apq_cpudai_afe_02_rx,
2470 &apq_cpudai_afe_02_tx,
2471 &apq_pcm_afe,
2472 &apq_cpudai_auxpcm_rx,
2473 &apq_cpudai_auxpcm_tx,
Neema Shetty8427c262012-02-16 11:23:43 -08002474 &apq_cpudai_stub,
Neema Shetty3c9d2862012-03-11 01:25:32 -08002475 &apq_cpudai_slimbus_1_rx,
2476 &apq_cpudai_slimbus_1_tx,
Kiran Kandi97fe19d2012-05-20 22:34:04 -07002477 &apq_cpudai_slimbus_2_rx,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002478 &apq_cpudai_slimbus_2_tx,
Neema Shettyc9d86c32012-05-09 12:01:39 -07002479 &apq_cpudai_slimbus_3_rx,
Helen Zeng38c3c962012-05-17 14:56:20 -07002480 &apq_cpudai_slimbus_3_tx,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002481 &apq8064_rpm_device,
2482 &apq8064_rpm_log_device,
2483 &apq8064_rpm_stat_device,
Anji Jonnala2a8bd312012-11-01 13:11:42 +05302484 &apq8064_rpm_master_stat_device,
Ramesh Masavarapuf31ff242012-05-10 18:55:21 -07002485 &apq_device_tz_log,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002486 &msm_bus_8064_apps_fabric,
2487 &msm_bus_8064_sys_fabric,
2488 &msm_bus_8064_mm_fabric,
2489 &msm_bus_8064_sys_fpb,
2490 &msm_bus_8064_cpss_fpb,
Mohan Kumar Gubbihalli Lachma Naik7f72edd2012-02-06 17:26:47 -08002491 &apq8064_msm_device_vidc,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07002492 &msm_pil_dsps,
Matt Wagantallb94b9a52012-02-02 21:59:54 -08002493 &msm_8960_q6_lpass,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002494 &msm_pil_vidc,
Matt Wagantall292aace2012-01-26 19:12:34 -08002495 &msm_gss,
Laura Abbottb93525f2012-04-12 09:57:19 -07002496 &apq8064_rtb_device,
Steve Mucklea9aac292012-11-02 15:41:00 -07002497 &apq8064_dcvs_device,
Abhijeet Dharmapurikarde91d2c2012-08-23 14:36:59 -07002498 &apq8064_msm_gov_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002499 &apq8064_device_cache_erp,
Stepan Moskovchenko0f3de112012-06-08 18:11:46 -07002500 &msm8960_device_ebi1_ch0_erp,
2501 &msm8960_device_ebi1_ch1_erp,
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002502 &epm_adc_device,
Pratik Patel3b0ca882012-06-01 16:54:14 -07002503 &coresight_tpiu_device,
2504 &coresight_etb_device,
2505 &apq8064_coresight_funnel_device,
2506 &coresight_etm0_device,
2507 &coresight_etm1_device,
2508 &coresight_etm2_device,
2509 &coresight_etm3_device,
Helen Zeng8f925502012-03-05 16:50:17 -08002510 &apq_cpudai_slim_4_rx,
2511 &apq_cpudai_slim_4_tx,
Steve Mucklef132c6c2012-06-06 18:30:57 -07002512#ifdef CONFIG_MSM_GEMINI
Jignesh Mehta921649d2012-04-19 06:57:23 -07002513 &msm8960_gemini_device,
Steve Mucklef132c6c2012-06-06 18:30:57 -07002514#endif
Laura Abbott0577d7b2012-04-17 11:14:30 -07002515 &apq8064_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002516 &msm_tsens_device,
Laura Abbott93a4a352012-05-25 09:26:35 -07002517 &apq8064_cache_dump_device,
Joel Nider0e4a16d2012-08-05 14:20:11 +03002518 &msm_8064_device_tspp,
Abhijeet Dharmapurikarde91d2c2012-08-23 14:36:59 -07002519#ifdef CONFIG_BATTERY_BCL
2520 &battery_bcl_device,
2521#endif
2522 &apq8064_msm_mpd_device,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002523};
2524
Joel King82b7e3f2012-01-05 10:03:27 -08002525static struct platform_device *cdp_devices[] __initdata = {
2526 &apq8064_device_uart_gsbi1,
Jin Hong4bbbfba2012-02-02 21:48:07 -08002527 &apq8064_device_uart_gsbi7,
Joel King82b7e3f2012-01-05 10:03:27 -08002528 &msm_device_sps_apq8064,
Aravind Venkateswaran4ca27532012-02-16 14:27:05 -08002529#ifdef CONFIG_MSM_ROTATOR
2530 &msm_rotator_device,
2531#endif
Anji Jonnalae84292b2012-09-21 13:34:44 +05302532 &msm8064_pc_cntr,
Joel King82b7e3f2012-01-05 10:03:27 -08002533};
2534
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002535static struct platform_device
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002536mpq8064_device_ext_1p2_buck_vreg __devinitdata = {
2537 .name = GPIO_REGULATOR_DEV_NAME,
2538 .id = SX150X_GPIO(4, 2),
2539 .dev = {
2540 .platform_data =
2541 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P2V],
2542 },
2543};
2544
2545static struct platform_device
2546mpq8064_device_ext_1p8_buck_vreg __devinitdata = {
2547 .name = GPIO_REGULATOR_DEV_NAME,
2548 .id = SX150X_GPIO(4, 4),
2549 .dev = {
2550 .platform_data =
2551 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P8V],
2552 },
2553};
2554
2555static struct platform_device
2556mpq8064_device_ext_2p2_buck_vreg __devinitdata = {
2557 .name = GPIO_REGULATOR_DEV_NAME,
2558 .id = SX150X_GPIO(4, 14),
2559 .dev = {
2560 .platform_data =
2561 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_2P2V],
2562 },
2563};
2564
2565static struct platform_device
2566mpq8064_device_ext_5v_buck_vreg __devinitdata = {
2567 .name = GPIO_REGULATOR_DEV_NAME,
2568 .id = SX150X_GPIO(4, 3),
2569 .dev = {
2570 .platform_data =
2571 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_5V],
2572 },
2573};
2574
2575static struct platform_device
2576mpq8064_device_ext_3p3v_ldo_vreg __devinitdata = {
2577 .name = GPIO_REGULATOR_DEV_NAME,
2578 .id = SX150X_GPIO(4, 15),
2579 .dev = {
2580 .platform_data =
2581 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_3P3V],
2582 },
2583};
2584
Ravi Kumar V1c903012012-05-15 16:11:35 +05302585static struct platform_device rc_input_loopback_pdev = {
2586 .name = "rc-user-input",
2587 .id = -1,
2588};
2589
Ravi Kumar V040eeff2012-05-23 21:29:23 +05302590static int rf4ce_gpio_init(void)
2591{
Ravi Kumar V0143c582012-08-14 17:18:11 +05302592 if (!machine_is_mpq8064_cdp() &&
2593 !machine_is_mpq8064_hrd() &&
2594 !machine_is_mpq8064_dtv())
Ravi Kumar V040eeff2012-05-23 21:29:23 +05302595 return -EINVAL;
2596
2597 /* CC2533 SRDY Input */
2598 if (!gpio_request(SX150X_GPIO(4, 6), "rf4ce_srdy")) {
2599 gpio_direction_input(SX150X_GPIO(4, 6));
2600 gpio_export(SX150X_GPIO(4, 6), true);
2601 }
2602
2603 /* CC2533 MRDY Output */
2604 if (!gpio_request(SX150X_GPIO(4, 5), "rf4ce_mrdy")) {
2605 gpio_direction_output(SX150X_GPIO(4, 5), 1);
2606 gpio_export(SX150X_GPIO(4, 5), true);
2607 }
2608
2609 /* CC2533 Reset Output */
2610 if (!gpio_request(SX150X_GPIO(4, 7), "rf4ce_reset")) {
2611 gpio_direction_output(SX150X_GPIO(4, 7), 0);
2612 gpio_export(SX150X_GPIO(4, 7), true);
2613 }
2614
2615 return 0;
2616}
2617late_initcall(rf4ce_gpio_init);
2618
Mayank Rana33681af2012-05-10 15:14:00 -07002619#ifdef CONFIG_SERIAL_MSM_HS
Mayank Rana33681af2012-05-10 15:14:00 -07002620static struct msm_serial_hs_platform_data mpq8064_gsbi6_uartdm_pdata = {
Mayank Rana60ae1af2013-03-08 14:09:51 +05302621 .config_gpio = 4,
2622 .uart_tx_gpio = 14,
2623 .uart_rx_gpio = 15,
2624 .uart_cts_gpio = 16,
2625 .uart_rfr_gpio = 17,
Mayank Rana33681af2012-05-10 15:14:00 -07002626 .inject_rx_on_wakeup = 1,
2627 .rx_to_inject = 0xFD,
Mayank Rana33681af2012-05-10 15:14:00 -07002628};
2629#else
2630static struct msm_serial_hs_platform_data msm_uart_dm9_pdata;
2631#endif
2632
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002633static struct platform_device *mpq_devices[] __initdata = {
2634 &msm_device_sps_apq8064,
2635 &mpq8064_device_qup_i2c_gsbi5,
2636#ifdef CONFIG_MSM_ROTATOR
2637 &msm_rotator_device,
2638#endif
Ravi Kumar V05931a22012-04-04 17:09:37 +05302639 &gpio_ir_recv_pdev,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002640 &mpq8064_device_ext_1p2_buck_vreg,
2641 &mpq8064_device_ext_1p8_buck_vreg,
2642 &mpq8064_device_ext_2p2_buck_vreg,
2643 &mpq8064_device_ext_5v_buck_vreg,
2644 &mpq8064_device_ext_3p3v_ldo_vreg,
Terence Hampson2e1705f2012-04-11 19:55:29 -04002645#ifdef CONFIG_MSM_VCAP
2646 &msm8064_device_vcap,
2647#endif
Ravi Kumar V1c903012012-05-15 16:11:35 +05302648 &rc_input_loopback_pdev,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002649};
2650
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002651static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002652 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002653};
2654
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002655#define KS8851_IRQ_GPIO 43
2656
2657static struct spi_board_info spi_board_info[] __initdata = {
2658 {
2659 .modalias = "ks8851",
2660 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2661 .max_speed_hz = 19200000,
2662 .bus_num = 0,
2663 .chip_select = 2,
2664 .mode = SPI_MODE_0,
2665 },
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002666 {
2667 .modalias = "epm_adc",
2668 .max_speed_hz = 1100000,
2669 .bus_num = 0,
2670 .chip_select = 3,
2671 .mode = SPI_MODE_0,
2672 },
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002673};
2674
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002675static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002676 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08002677 .bus_num = 1,
2678 .slim_slave = &apq8064_slim_tabla,
2679 },
2680 {
2681 .bus_num = 1,
2682 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002683 },
2684 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002685};
2686
David Keitel3c40fc52012-02-09 17:53:52 -08002687static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi1_pdata = {
2688 .clk_freq = 100000,
2689 .src_clk_rate = 24000000,
2690};
2691
Jing Lin04601f92012-02-05 15:36:07 -08002692static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi3_pdata = {
Anirudh Ghayalc2163472012-04-10 14:58:14 +05302693 .clk_freq = 384000,
Jing Lin04601f92012-02-05 15:36:07 -08002694 .src_clk_rate = 24000000,
2695};
2696
Kenneth Heitke748593a2011-07-15 15:45:11 -06002697static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
2698 .clk_freq = 100000,
2699 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002700};
2701
Joel King8f839b92012-04-01 14:37:46 -07002702static struct msm_i2c_platform_data mpq8064_i2c_qup_gsbi5_pdata = {
2703 .clk_freq = 100000,
2704 .src_clk_rate = 24000000,
2705};
2706
David Keitel3c40fc52012-02-09 17:53:52 -08002707#define GSBI_DUAL_MODE_CODE 0x60
2708#define MSM_GSBI1_PHYS 0x12440000
Kenneth Heitke748593a2011-07-15 15:45:11 -06002709static void __init apq8064_i2c_init(void)
2710{
David Keitel3c40fc52012-02-09 17:53:52 -08002711 void __iomem *gsbi_mem;
2712
2713 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2714 &apq8064_i2c_qup_gsbi1_pdata;
2715 gsbi_mem = ioremap_nocache(MSM_GSBI1_PHYS, 4);
2716 writel_relaxed(GSBI_DUAL_MODE_CODE, gsbi_mem);
2717 /* Ensure protocol code is written before proceeding */
2718 wmb();
2719 iounmap(gsbi_mem);
2720 apq8064_i2c_qup_gsbi1_pdata.use_gsbi_shared_mode = 1;
Jing Lin04601f92012-02-05 15:36:07 -08002721 apq8064_device_qup_i2c_gsbi3.dev.platform_data =
2722 &apq8064_i2c_qup_gsbi3_pdata;
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002723 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2724 &apq8064_i2c_qup_gsbi1_pdata;
Mayank Ranae98f1e42013-02-22 19:58:59 +05302725
2726 /* Add GSBI4 I2C pdata for non-fusion3 SGLTE2 */
2727 if (socinfo_get_platform_subtype() !=
2728 PLATFORM_SUBTYPE_SGLTE2) {
2729 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
Kenneth Heitke748593a2011-07-15 15:45:11 -06002730 &apq8064_i2c_qup_gsbi4_pdata;
Mayank Ranae98f1e42013-02-22 19:58:59 +05302731 }
Joel King8f839b92012-04-01 14:37:46 -07002732 mpq8064_device_qup_i2c_gsbi5.dev.platform_data =
2733 &mpq8064_i2c_qup_gsbi5_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002734}
2735
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002736#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002737static int ethernet_init(void)
2738{
2739 int ret;
2740 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
2741 if (ret) {
2742 pr_err("ks8851 gpio_request failed: %d\n", ret);
2743 goto fail;
2744 }
2745
2746 return 0;
2747fail:
2748 return ret;
2749}
2750#else
2751static int ethernet_init(void)
2752{
2753 return 0;
2754}
2755#endif
2756
David Collins6f7c3472012-08-22 13:18:06 -07002757#define GPIO_KEY_HOME PM8921_GPIO_PM_TO_SYS(27)
2758#define GPIO_KEY_VOLUME_UP PM8921_GPIO_PM_TO_SYS(35)
2759#define GPIO_KEY_VOLUME_DOWN_PM8921 PM8921_GPIO_PM_TO_SYS(38)
2760#define GPIO_KEY_VOLUME_DOWN_PM8917 PM8921_GPIO_PM_TO_SYS(30)
2761#define GPIO_KEY_CAM_FOCUS PM8921_GPIO_PM_TO_SYS(3)
2762#define GPIO_KEY_CAM_SNAP PM8921_GPIO_PM_TO_SYS(4)
2763#define GPIO_KEY_ROTATION_PM8921 PM8921_GPIO_PM_TO_SYS(42)
2764#define GPIO_KEY_ROTATION_PM8917 PM8921_GPIO_PM_TO_SYS(8)
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302765
David Collins6f7c3472012-08-22 13:18:06 -07002766static struct gpio_keys_button cdp_keys_pm8921[] = {
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302767 {
2768 .code = KEY_HOME,
2769 .gpio = GPIO_KEY_HOME,
2770 .desc = "home_key",
2771 .active_low = 1,
2772 .type = EV_KEY,
2773 .wakeup = 1,
2774 .debounce_interval = 15,
2775 },
2776 {
2777 .code = KEY_VOLUMEUP,
2778 .gpio = GPIO_KEY_VOLUME_UP,
2779 .desc = "volume_up_key",
2780 .active_low = 1,
2781 .type = EV_KEY,
2782 .wakeup = 1,
2783 .debounce_interval = 15,
2784 },
2785 {
2786 .code = KEY_VOLUMEDOWN,
David Collins6f7c3472012-08-22 13:18:06 -07002787 .gpio = GPIO_KEY_VOLUME_DOWN_PM8921,
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302788 .desc = "volume_down_key",
2789 .active_low = 1,
2790 .type = EV_KEY,
2791 .wakeup = 1,
2792 .debounce_interval = 15,
2793 },
2794 {
2795 .code = SW_ROTATE_LOCK,
David Collins6f7c3472012-08-22 13:18:06 -07002796 .gpio = GPIO_KEY_ROTATION_PM8921,
2797 .desc = "rotate_key",
2798 .active_low = 1,
2799 .type = EV_SW,
2800 .debounce_interval = 15,
2801 },
2802};
2803
2804static struct gpio_keys_button cdp_keys_pm8917[] = {
2805 {
2806 .code = KEY_HOME,
2807 .gpio = GPIO_KEY_HOME,
2808 .desc = "home_key",
2809 .active_low = 1,
2810 .type = EV_KEY,
2811 .wakeup = 1,
2812 .debounce_interval = 15,
2813 },
2814 {
2815 .code = KEY_VOLUMEUP,
2816 .gpio = GPIO_KEY_VOLUME_UP,
2817 .desc = "volume_up_key",
2818 .active_low = 1,
2819 .type = EV_KEY,
2820 .wakeup = 1,
2821 .debounce_interval = 15,
2822 },
2823 {
2824 .code = KEY_VOLUMEDOWN,
2825 .gpio = GPIO_KEY_VOLUME_DOWN_PM8917,
2826 .desc = "volume_down_key",
2827 .active_low = 1,
2828 .type = EV_KEY,
2829 .wakeup = 1,
2830 .debounce_interval = 15,
2831 },
2832 {
2833 .code = SW_ROTATE_LOCK,
2834 .gpio = GPIO_KEY_ROTATION_PM8917,
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302835 .desc = "rotate_key",
2836 .active_low = 1,
2837 .type = EV_SW,
2838 .debounce_interval = 15,
2839 },
2840};
2841
2842static struct gpio_keys_platform_data cdp_keys_data = {
David Collins6f7c3472012-08-22 13:18:06 -07002843 .buttons = cdp_keys_pm8921,
2844 .nbuttons = ARRAY_SIZE(cdp_keys_pm8921),
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302845};
2846
2847static struct platform_device cdp_kp_pdev = {
2848 .name = "gpio-keys",
2849 .id = -1,
2850 .dev = {
2851 .platform_data = &cdp_keys_data,
2852 },
2853};
2854
2855static struct gpio_keys_button mtp_keys[] = {
2856 {
2857 .code = KEY_CAMERA_FOCUS,
2858 .gpio = GPIO_KEY_CAM_FOCUS,
2859 .desc = "cam_focus_key",
2860 .active_low = 1,
2861 .type = EV_KEY,
2862 .wakeup = 1,
2863 .debounce_interval = 15,
2864 },
2865 {
2866 .code = KEY_VOLUMEUP,
2867 .gpio = GPIO_KEY_VOLUME_UP,
2868 .desc = "volume_up_key",
2869 .active_low = 1,
2870 .type = EV_KEY,
2871 .wakeup = 1,
2872 .debounce_interval = 15,
2873 },
2874 {
2875 .code = KEY_VOLUMEDOWN,
David Collins6f7c3472012-08-22 13:18:06 -07002876 .gpio = GPIO_KEY_VOLUME_DOWN_PM8921,
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302877 .desc = "volume_down_key",
2878 .active_low = 1,
2879 .type = EV_KEY,
2880 .wakeup = 1,
2881 .debounce_interval = 15,
2882 },
2883 {
2884 .code = KEY_CAMERA_SNAPSHOT,
2885 .gpio = GPIO_KEY_CAM_SNAP,
2886 .desc = "cam_snap_key",
2887 .active_low = 1,
2888 .type = EV_KEY,
2889 .debounce_interval = 15,
2890 },
2891};
2892
2893static struct gpio_keys_platform_data mtp_keys_data = {
2894 .buttons = mtp_keys,
2895 .nbuttons = ARRAY_SIZE(mtp_keys),
2896};
2897
2898static struct platform_device mtp_kp_pdev = {
2899 .name = "gpio-keys",
2900 .id = -1,
2901 .dev = {
2902 .platform_data = &mtp_keys_data,
2903 },
2904};
2905
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05302906static struct gpio_keys_button mpq_keys[] = {
2907 {
2908 .code = KEY_VOLUMEDOWN,
David Collins6f7c3472012-08-22 13:18:06 -07002909 .gpio = GPIO_KEY_VOLUME_DOWN_PM8921,
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05302910 .desc = "volume_down_key",
2911 .active_low = 1,
2912 .type = EV_KEY,
2913 .wakeup = 1,
2914 .debounce_interval = 15,
2915 },
2916 {
2917 .code = KEY_VOLUMEUP,
2918 .gpio = GPIO_KEY_VOLUME_UP,
2919 .desc = "volume_up_key",
2920 .active_low = 1,
2921 .type = EV_KEY,
2922 .wakeup = 1,
2923 .debounce_interval = 15,
2924 },
2925};
2926
2927static struct gpio_keys_platform_data mpq_keys_data = {
2928 .buttons = mpq_keys,
2929 .nbuttons = ARRAY_SIZE(mpq_keys),
2930};
2931
2932static struct platform_device mpq_gpio_keys_pdev = {
2933 .name = "gpio-keys",
2934 .id = -1,
2935 .dev = {
2936 .platform_data = &mpq_keys_data,
2937 },
2938};
2939
2940#define MPQ_KP_ROW_BASE SX150X_EXP2_GPIO_BASE
2941#define MPQ_KP_COL_BASE (SX150X_EXP2_GPIO_BASE + 4)
2942
2943static unsigned int mpq_row_gpios[] = {MPQ_KP_ROW_BASE, MPQ_KP_ROW_BASE + 1,
2944 MPQ_KP_ROW_BASE + 2, MPQ_KP_ROW_BASE + 3};
2945static unsigned int mpq_col_gpios[] = {MPQ_KP_COL_BASE, MPQ_KP_COL_BASE + 1,
2946 MPQ_KP_COL_BASE + 2};
2947
2948static const unsigned int mpq_keymap[] = {
2949 KEY(0, 0, KEY_UP),
2950 KEY(0, 1, KEY_ENTER),
2951 KEY(0, 2, KEY_3),
2952
2953 KEY(1, 0, KEY_DOWN),
2954 KEY(1, 1, KEY_EXIT),
2955 KEY(1, 2, KEY_4),
2956
2957 KEY(2, 0, KEY_LEFT),
2958 KEY(2, 1, KEY_1),
2959 KEY(2, 2, KEY_5),
2960
2961 KEY(3, 0, KEY_RIGHT),
2962 KEY(3, 1, KEY_2),
2963 KEY(3, 2, KEY_6),
2964};
2965
2966static struct matrix_keymap_data mpq_keymap_data = {
2967 .keymap_size = ARRAY_SIZE(mpq_keymap),
2968 .keymap = mpq_keymap,
2969};
2970
2971static struct matrix_keypad_platform_data mpq_keypad_data = {
2972 .keymap_data = &mpq_keymap_data,
2973 .row_gpios = mpq_row_gpios,
2974 .col_gpios = mpq_col_gpios,
2975 .num_row_gpios = ARRAY_SIZE(mpq_row_gpios),
2976 .num_col_gpios = ARRAY_SIZE(mpq_col_gpios),
2977 .col_scan_delay_us = 32000,
2978 .debounce_ms = 20,
2979 .wakeup = 1,
2980 .active_low = 1,
2981 .no_autorepeat = 1,
2982};
2983
2984static struct platform_device mpq_keypad_device = {
2985 .name = "matrix-keypad",
2986 .id = -1,
2987 .dev = {
2988 .platform_data = &mpq_keypad_data,
2989 },
2990};
2991
Jin Hongd3024e62012-02-09 16:13:32 -08002992/* Sensors DSPS platform data */
2993#define DSPS_PIL_GENERIC_NAME "dsps"
2994static void __init apq8064_init_dsps(void)
2995{
2996 struct msm_dsps_platform_data *pdata =
2997 msm_dsps_device_8064.dev.platform_data;
2998 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
2999 pdata->gpios = NULL;
3000 pdata->gpios_num = 0;
3001
3002 platform_device_register(&msm_dsps_device_8064);
3003}
Mohan Pallaka474b94b2012-01-25 12:59:58 +05303004
Jing Lin417fa452012-02-05 14:31:06 -08003005#define I2C_SURF 1
3006#define I2C_FFA (1 << 1)
3007#define I2C_RUMI (1 << 2)
3008#define I2C_SIM (1 << 3)
3009#define I2C_LIQUID (1 << 4)
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003010#define I2C_MPQ_CDP BIT(5)
3011#define I2C_MPQ_HRD BIT(6)
3012#define I2C_MPQ_DTV BIT(7)
Jing Lin417fa452012-02-05 14:31:06 -08003013
3014struct i2c_registry {
3015 u8 machs;
3016 int bus;
3017 struct i2c_board_info *info;
3018 int len;
3019};
3020
3021static struct i2c_registry apq8064_i2c_devices[] __initdata = {
Jing Lin21ed4de2012-02-05 15:53:28 -08003022 {
David Keitel2f613d92012-02-15 11:29:16 -08003023 I2C_LIQUID,
3024 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
3025 smb349_charger_i2c_info,
3026 ARRAY_SIZE(smb349_charger_i2c_info)
3027 },
3028 {
Jing Lin21ed4de2012-02-05 15:53:28 -08003029 I2C_SURF | I2C_LIQUID,
3030 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
3031 mxt_device_info,
3032 ARRAY_SIZE(mxt_device_info),
3033 },
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08003034 {
3035 I2C_FFA,
3036 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
3037 cyttsp_info,
3038 ARRAY_SIZE(cyttsp_info),
3039 },
Amy Maloche70090f992012-02-16 16:35:26 -08003040 {
3041 I2C_FFA | I2C_LIQUID,
3042 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
3043 isa1200_board_info,
3044 ARRAY_SIZE(isa1200_board_info),
3045 },
Santosh Mardieff9a742012-04-09 23:23:39 +05303046 {
3047 I2C_MPQ_CDP,
3048 APQ_8064_GSBI5_QUP_I2C_BUS_ID,
3049 cs8427_device_info,
3050 ARRAY_SIZE(cs8427_device_info),
3051 },
Jing Lin417fa452012-02-05 14:31:06 -08003052};
3053
Jay Chokshi607f61b2012-04-25 18:21:21 -07003054#define SX150X_EXP1_INT_N PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9)
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05303055#define SX150X_EXP2_INT_N MSM_GPIO_TO_INT(81)
Jay Chokshi607f61b2012-04-25 18:21:21 -07003056
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003057struct sx150x_platform_data mpq8064_sx150x_pdata[] = {
3058 [SX150X_EXP1] = {
3059 .gpio_base = SX150X_EXP1_GPIO_BASE,
3060 .oscio_is_gpo = false,
3061 .io_pullup_ena = 0x0,
3062 .io_pulldn_ena = 0x0,
3063 .io_open_drain_ena = 0x0,
3064 .io_polarity = 0,
Jay Chokshi607f61b2012-04-25 18:21:21 -07003065 .irq_summary = SX150X_EXP1_INT_N,
3066 .irq_base = SX150X_EXP1_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003067 },
3068 [SX150X_EXP2] = {
3069 .gpio_base = SX150X_EXP2_GPIO_BASE,
3070 .oscio_is_gpo = false,
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05303071 .io_pullup_ena = 0x0f,
3072 .io_pulldn_ena = 0x70,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003073 .io_open_drain_ena = 0x0,
3074 .io_polarity = 0,
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05303075 .irq_summary = SX150X_EXP2_INT_N,
3076 .irq_base = SX150X_EXP2_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003077 },
3078 [SX150X_EXP3] = {
3079 .gpio_base = SX150X_EXP3_GPIO_BASE,
3080 .oscio_is_gpo = false,
3081 .io_pullup_ena = 0x0,
3082 .io_pulldn_ena = 0x0,
3083 .io_open_drain_ena = 0x0,
3084 .io_polarity = 0,
3085 .irq_summary = -1,
3086 },
3087 [SX150X_EXP4] = {
3088 .gpio_base = SX150X_EXP4_GPIO_BASE,
3089 .oscio_is_gpo = false,
3090 .io_pullup_ena = 0x0,
3091 .io_pulldn_ena = 0x0,
3092 .io_open_drain_ena = 0x0,
3093 .io_polarity = 0,
3094 .irq_summary = -1,
3095 },
3096};
3097
3098static struct i2c_board_info sx150x_gpio_exp_info[] = {
3099 {
3100 I2C_BOARD_INFO("sx1509q", 0x70),
3101 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP1],
3102 },
3103 {
3104 I2C_BOARD_INFO("sx1508q", 0x23),
3105 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP2],
3106 },
3107 {
3108 I2C_BOARD_INFO("sx1508q", 0x22),
3109 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP3],
3110 },
3111 {
3112 I2C_BOARD_INFO("sx1509q", 0x3E),
3113 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP4],
3114 },
3115};
3116
3117#define MPQ8064_I2C_GSBI5_BUS_ID 5
3118
3119static struct i2c_registry mpq8064_i2c_devices[] __initdata = {
3120 {
3121 I2C_MPQ_CDP,
3122 MPQ8064_I2C_GSBI5_BUS_ID,
3123 sx150x_gpio_exp_info,
3124 ARRAY_SIZE(sx150x_gpio_exp_info),
3125 },
3126};
3127
Jing Lin417fa452012-02-05 14:31:06 -08003128static void __init register_i2c_devices(void)
3129{
3130 u8 mach_mask = 0;
3131 int i;
3132
Kevin Chand07220e2012-02-13 15:52:22 -08003133#ifdef CONFIG_MSM_CAMERA
3134 struct i2c_registry apq8064_camera_i2c_devices = {
3135 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_RUMI,
3136 APQ_8064_GSBI4_QUP_I2C_BUS_ID,
3137 apq8064_camera_board_info.board_info,
3138 apq8064_camera_board_info.num_i2c_board_info,
3139 };
3140#endif
Jing Lin417fa452012-02-05 14:31:06 -08003141 /* Build the matching 'supported_machs' bitmask */
3142 if (machine_is_apq8064_cdp())
3143 mach_mask = I2C_SURF;
3144 else if (machine_is_apq8064_mtp())
3145 mach_mask = I2C_FFA;
3146 else if (machine_is_apq8064_liquid())
3147 mach_mask = I2C_LIQUID;
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003148 else if (PLATFORM_IS_MPQ8064())
3149 mach_mask = I2C_MPQ_CDP;
Jing Lin417fa452012-02-05 14:31:06 -08003150 else
3151 pr_err("unmatched machine ID in register_i2c_devices\n");
3152
3153 /* Run the array and install devices as appropriate */
3154 for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) {
3155 if (apq8064_i2c_devices[i].machs & mach_mask)
3156 i2c_register_board_info(apq8064_i2c_devices[i].bus,
3157 apq8064_i2c_devices[i].info,
3158 apq8064_i2c_devices[i].len);
3159 }
Kevin Chand07220e2012-02-13 15:52:22 -08003160#ifdef CONFIG_MSM_CAMERA
3161 if (apq8064_camera_i2c_devices.machs & mach_mask)
3162 i2c_register_board_info(apq8064_camera_i2c_devices.bus,
3163 apq8064_camera_i2c_devices.info,
3164 apq8064_camera_i2c_devices.len);
3165#endif
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003166
3167 for (i = 0; i < ARRAY_SIZE(mpq8064_i2c_devices); ++i) {
3168 if (mpq8064_i2c_devices[i].machs & mach_mask)
3169 i2c_register_board_info(
3170 mpq8064_i2c_devices[i].bus,
3171 mpq8064_i2c_devices[i].info,
3172 mpq8064_i2c_devices[i].len);
3173 }
Jing Lin417fa452012-02-05 14:31:06 -08003174}
3175
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003176static void enable_avc_i2c_bus(void)
3177{
3178 int avc_i2c_en_mpp = PM8921_MPP_PM_TO_SYS(8);
3179 int rc;
3180
3181 rc = gpio_request(avc_i2c_en_mpp, "avc_i2c_en");
3182 if (rc)
3183 pr_err("request for avc_i2c_en mpp failed,"
3184 "rc=%d\n", rc);
3185 else
3186 gpio_set_value_cansleep(avc_i2c_en_mpp, 1);
3187}
3188
David Collins6f7c3472012-08-22 13:18:06 -07003189/* Modify platform data values to match requirements for PM8917. */
3190static void __init apq8064_pm8917_pdata_fixup(void)
3191{
3192 cdp_keys_data.buttons = cdp_keys_pm8917;
3193 cdp_keys_data.nbuttons = ARRAY_SIZE(cdp_keys_pm8917);
3194}
3195
Mayank Ranae98f1e42013-02-22 19:58:59 +05303196#ifdef CONFIG_SERIAL_MSM_HS
Mayank Ranae98f1e42013-02-22 19:58:59 +05303197static struct msm_serial_hs_platform_data apq8064_uartdm_gsbi4_pdata = {
Mayank Rana60ae1af2013-03-08 14:09:51 +05303198 .config_gpio = 4,
3199 .uart_tx_gpio = 10,
3200 .uart_rx_gpio = 11,
3201 .uart_cts_gpio = 12,
3202 .uart_rfr_gpio = 13,
Mayank Ranae98f1e42013-02-22 19:58:59 +05303203};
3204#else
3205static struct msm_serial_hs_platform_data apq8064_uartdm_gsbi4_pdata;
3206#endif
3207
Anji Jonnala786b39e2013-01-29 13:34:10 +05303208static void __init apq8064ab_update_retention_spm(void)
3209{
3210 int i;
3211
3212 /* Update the SPM sequences for krait retention on all cores */
3213 for (i = 0; i < ARRAY_SIZE(msm_spm_data); i++) {
3214 int j;
3215 struct msm_spm_platform_data *pdata = &msm_spm_data[i];
3216 for (j = 0; j < pdata->num_modes; j++) {
3217 if (pdata->modes[j].cmd ==
3218 spm_retention_cmd_sequence)
3219 pdata->modes[j].cmd =
3220 spm_retention_with_krait_v3_cmd_sequence;
3221 }
3222 }
3223}
3224
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003225static void __init apq8064_common_init(void)
3226{
Ameya Thakur2702baf2013-01-30 11:55:25 -08003227 u32 platform_version = socinfo_get_platform_version();
David Collins6f7c3472012-08-22 13:18:06 -07003228
3229 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
3230 apq8064_pm8917_pdata_fixup();
Rohit Vaswanib1cc4932012-07-23 21:30:11 -07003231 platform_device_register(&msm_gpio_device);
Praveen Chidambaram4908abf2013-03-06 18:10:15 -07003232 if (cpu_is_apq8064ab())
3233 apq8064ab_update_krait_spm();
3234 if (cpu_is_krait_v3()) {
3235 msm_pm_set_tz_retention_flag(0);
3236 apq8064ab_update_retention_spm();
3237 } else {
3238 msm_pm_set_tz_retention_flag(1);
3239 }
3240 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3241 msm_spm_l2_init(msm_spm_l2_data);
Joel King8f839b92012-04-01 14:37:46 -07003242 msm_tsens_early_init(&apq_tsens_pdata);
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06003243 msm_thermal_init(&msm_thermal_pdata);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003244 if (socinfo_init() < 0)
3245 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06003246 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
3247 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
David Collins2782b5c2012-02-06 10:02:42 -08003248 regulator_suppress_info_printing();
David Collins36199252012-08-21 15:43:02 -07003249 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
3250 configure_apq8064_pm8917_power_grid();
David Collins2782b5c2012-02-06 10:02:42 -08003251 platform_device_register(&apq8064_device_rpm_regulator);
David Collins36199252012-08-21 15:43:02 -07003252 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917)
3253 platform_device_register(&apq8064_pm8921_device_rpm_regulator);
Stephen Boyd4d0d2582012-02-10 14:49:40 -08003254 if (msm_xo_init())
3255 pr_err("Failed to initialize XO votes\n");
Matt Wagantallc51e5602012-02-27 17:25:25 -08003256 msm_clock_init(&apq8064_clock_init_data);
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08003257 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06003258 apq8064_i2c_init();
Jing Lin417fa452012-02-05 14:31:06 -08003259 register_i2c_devices();
Kenneth Heitke36920d32011-07-20 16:44:30 -06003260
Harini Jayaramanc4c58692011-07-19 14:50:10 -06003261 apq8064_device_qup_spi_gsbi5.dev.platform_data =
3262 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08003263 apq8064_init_pmic();
Hemant Kumar94e7da22012-02-03 16:52:29 -08003264 if (machine_is_apq8064_liquid())
3265 msm_otg_pdata.mhl_enable = true;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07003266
Ofir Cohen94213a72012-05-03 14:26:32 +03003267 android_usb_pdata.swfi_latency =
3268 msm_rpmrs_levels[0].latency_us;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07003269
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003270 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Manu Gautam91223e02011-11-08 15:27:22 +05303271 apq8064_ehci_host_init();
Gagan Mac8a7a5d32011-11-11 16:43:06 -07003272 apq8064_init_buses();
David Collins36199252012-08-21 15:43:02 -07003273
3274 platform_add_devices(early_common_devices,
3275 ARRAY_SIZE(early_common_devices));
3276 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917)
3277 platform_add_devices(pm8921_common_devices,
3278 ARRAY_SIZE(pm8921_common_devices));
3279 else
3280 platform_add_devices(pm8917_common_devices,
3281 ARRAY_SIZE(pm8917_common_devices));
Joel King024437b2013-03-20 12:38:00 -07003282
3283 if (!machine_is_apq8064_mtp())
3284 platform_device_register(&apq8064_device_ext_ts_sw_vreg);
3285
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003286 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Terence Hampson36b70722012-05-10 13:18:16 -04003287 if (!(machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
Mayank Ranae98f1e42013-02-22 19:58:59 +05303288 machine_is_mpq8064_dtv())) {
Terence Hampson36b70722012-05-10 13:18:16 -04003289 platform_add_devices(common_not_mpq_devices,
3290 ARRAY_SIZE(common_not_mpq_devices));
Mayank Ranae98f1e42013-02-22 19:58:59 +05303291
3292 /* Add GSBI4 I2C Device for non-fusion3 platform */
3293 if (socinfo_get_platform_subtype() !=
3294 PLATFORM_SUBTYPE_SGLTE2) {
3295 platform_device_register(&apq8064_device_qup_i2c_gsbi4);
3296 }
3297 }
3298
Pavankumar Kondetife2d4d32012-09-07 15:33:09 +05303299 msm_hsic_pdata.swfi_latency =
3300 msm_rpmrs_levels[0].latency_us;
Hemant Kumarf1ca9192012-02-07 18:59:33 -08003301 if (machine_is_apq8064_mtp()) {
Ajay Dudanic4e40db2012-08-20 14:44:40 -07003302 msm_hsic_pdata.log2_irq_thresh = 5,
Hemant Kumarf1ca9192012-02-07 18:59:33 -08003303 apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
3304 device_initialize(&apq8064_device_hsic_host.dev);
Ameya Thakur2702baf2013-01-30 11:55:25 -08003305 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_DSDA2) {
3306 apq8064_device_ehci_host3.dev.platform_data =
3307 &msm_ehci_host_pdata3;
3308 device_initialize(&apq8064_device_ehci_host3.dev);
3309 }
Hemant Kumarf1ca9192012-02-07 18:59:33 -08003310 }
Jay Chokshie8741282012-01-25 15:22:55 -08003311 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05303312 apq8064_init_mmc();
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08003313
3314 if (machine_is_apq8064_mtp()) {
Ameya Thakur2702baf2013-01-30 11:55:25 -08003315 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_DSDA2) {
Joel Kingfdde32b2013-02-06 17:38:05 -08003316 amdm_8064_device.dev.platform_data =
3317 &amdm_platform_data;
Ameya Thakur2702baf2013-01-30 11:55:25 -08003318 platform_device_register(&amdm_8064_device);
3319 bmdm_8064_device.dev.platform_data =
3320 &bmdm_platform_data;
3321 platform_device_register(&bmdm_8064_device);
Joel King3166e892013-02-26 11:16:08 -08003322 } else if (socinfo_get_platform_subtype() ==
3323 PLATFORM_SUBTYPE_SGLTE2) {
3324 sglte_mdm_8064_device.dev.platform_data =
Joel King57aefdd2013-03-11 13:46:05 -07003325 &sglte2_mdm_platform_data;
Joel King3166e892013-02-26 11:16:08 -08003326 platform_device_register(&sglte_mdm_8064_device);
3327 sglte2_qsc_8064_device.dev.platform_data =
3328 &sglte2_qsc_platform_data;
3329 platform_device_register(&sglte2_qsc_8064_device);
Mayank Ranae98f1e42013-02-22 19:58:59 +05303330
3331 /* GSBI4 UART device for Primay IPC */
Mayank Ranaa04d8342013-04-10 00:46:23 +05303332 apq8064_uartdm_gsbi4_pdata.wakeup_irq = gpio_to_irq(11);
Mayank Ranae98f1e42013-02-22 19:58:59 +05303333 apq8064_device_uartdm_gsbi4.dev.platform_data =
3334 &apq8064_uartdm_gsbi4_pdata;
3335 platform_device_register(&apq8064_device_uartdm_gsbi4);
Ameya Thakur2702baf2013-01-30 11:55:25 -08003336 } else if (SOCINFO_VERSION_MINOR(platform_version) == 1) {
Ameya Thakure155ece2012-07-09 12:08:37 -07003337 i2s_mdm_8064_device.dev.platform_data =
3338 &mdm_platform_data;
3339 platform_device_register(&i2s_mdm_8064_device);
3340 } else {
3341 mdm_8064_device.dev.platform_data = &mdm_platform_data;
3342 platform_device_register(&mdm_8064_device);
3343 }
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08003344 }
3345 platform_device_register(&apq8064_slim_ctrl);
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06003346 slim_register_board_info(apq8064_slim_devices,
3347 ARRAY_SIZE(apq8064_slim_devices));
Taniya Dasbbf633d2012-07-31 16:07:47 +05303348 if (!PLATFORM_IS_MPQ8064()) {
Taniya Das30cae292012-07-31 15:56:12 +05303349 apq8064_init_dsps();
Taniya Dasbbf633d2012-07-31 16:07:47 +05303350 platform_device_register(&msm_8960_riva);
3351 }
Praveen Chidambaram78499012011-11-01 17:15:17 -06003352 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08003353 apq8064_epm_adc_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003354}
3355
Huaibin Yang4a084e32011-12-15 15:25:52 -08003356static void __init apq8064_allocate_memory_regions(void)
3357{
3358 apq8064_allocate_fb_region();
3359}
3360
Joel King82b7e3f2012-01-05 10:03:27 -08003361static void __init apq8064_cdp_init(void)
3362{
Hanumant Singh50440d42012-04-23 19:27:16 -07003363 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
3364 pr_err("meminfo_init() failed!\n");
Amy Maloche609bb5e2012-08-03 09:41:42 -07003365 if (machine_is_apq8064_mtp() &&
3366 SOCINFO_VERSION_MINOR(socinfo_get_platform_version()) == 1)
3367 cyttsp_pdata.sleep_gpio = CYTTSP_TS_GPIO_SLEEP_ALT;
Joel King82b7e3f2012-01-05 10:03:27 -08003368 apq8064_common_init();
Joel King8f839b92012-04-01 14:37:46 -07003369 if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
3370 machine_is_mpq8064_dtv()) {
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003371 enable_avc_i2c_bus();
Olav Hauganef95ae32012-05-15 09:50:30 -07003372 msm_rotator_set_split_iommu_domain();
Joel King8f839b92012-04-01 14:37:46 -07003373 platform_add_devices(mpq_devices, ARRAY_SIZE(mpq_devices));
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06003374 mpq8064_pcie_init();
Joel King8f839b92012-04-01 14:37:46 -07003375 } else {
3376 ethernet_init();
Olav Hauganef95ae32012-05-15 09:50:30 -07003377 msm_rotator_set_split_iommu_domain();
Joel King8f839b92012-04-01 14:37:46 -07003378 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
3379 spi_register_board_info(spi_board_info,
3380 ARRAY_SIZE(spi_board_info));
3381 }
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003382 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07003383 apq8064_init_gpu();
Matt Wagantall1f65d9d2012-04-25 14:24:20 -07003384 platform_add_devices(apq8064_footswitch, apq8064_num_footswitch);
Steve Mucklef132c6c2012-06-06 18:30:57 -07003385#ifdef CONFIG_MSM_CAMERA
Kevin Chand07220e2012-02-13 15:52:22 -08003386 apq8064_init_cam();
Steve Mucklef132c6c2012-06-06 18:30:57 -07003387#endif
Mohan Pallaka474b94b2012-01-25 12:59:58 +05303388
Mayank Rana33681af2012-05-10 15:14:00 -07003389 if (machine_is_mpq8064_hrd() || machine_is_mpq8064_dtv()) {
3390#ifdef CONFIG_SERIAL_MSM_HS
3391 /* GSBI6(2) - UARTDM_RX */
3392 mpq8064_gsbi6_uartdm_pdata.wakeup_irq = gpio_to_irq(15);
3393 mpq8064_device_uartdm_gsbi6.dev.platform_data =
3394 &mpq8064_gsbi6_uartdm_pdata;
3395#endif
3396 platform_device_register(&mpq8064_device_uartdm_gsbi6);
3397 }
3398
Mohan Pallaka474b94b2012-01-25 12:59:58 +05303399 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
3400 platform_device_register(&cdp_kp_pdev);
3401
3402 if (machine_is_apq8064_mtp())
3403 platform_device_register(&mtp_kp_pdev);
Hanumant Singh50440d42012-04-23 19:27:16 -07003404
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05303405 if (machine_is_mpq8064_cdp()) {
3406 platform_device_register(&mpq_gpio_keys_pdev);
3407 platform_device_register(&mpq_keypad_device);
3408 }
Joel King82b7e3f2012-01-05 10:03:27 -08003409}
3410
Joel King82b7e3f2012-01-05 10:03:27 -08003411MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
3412 .map_io = apq8064_map_io,
3413 .reserve = apq8064_reserve,
3414 .init_irq = apq8064_init_irq,
3415 .handle_irq = gic_handle_irq,
3416 .timer = &msm_timer,
3417 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003418 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003419 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003420 .restart = msm_restart,
Joel King82b7e3f2012-01-05 10:03:27 -08003421MACHINE_END
3422
3423MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
3424 .map_io = apq8064_map_io,
3425 .reserve = apq8064_reserve,
3426 .init_irq = apq8064_init_irq,
3427 .handle_irq = gic_handle_irq,
3428 .timer = &msm_timer,
3429 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003430 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003431 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003432 .restart = msm_restart,
Joel King82b7e3f2012-01-05 10:03:27 -08003433MACHINE_END
3434
3435MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
3436 .map_io = apq8064_map_io,
3437 .reserve = apq8064_reserve,
3438 .init_irq = apq8064_init_irq,
3439 .handle_irq = gic_handle_irq,
3440 .timer = &msm_timer,
3441 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003442 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003443 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003444 .restart = msm_restart,
Joel King82b7e3f2012-01-05 10:03:27 -08003445MACHINE_END
3446
Joel King064bbf82012-04-01 13:23:39 -07003447MACHINE_START(MPQ8064_CDP, "QCT MPQ8064 CDP")
3448 .map_io = apq8064_map_io,
3449 .reserve = apq8064_reserve,
3450 .init_irq = apq8064_init_irq,
3451 .handle_irq = gic_handle_irq,
3452 .timer = &msm_timer,
3453 .init_machine = apq8064_cdp_init,
3454 .init_early = apq8064_allocate_memory_regions,
3455 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003456 .restart = msm_restart,
Joel King064bbf82012-04-01 13:23:39 -07003457MACHINE_END
3458
Joel King11ca8202012-02-13 16:19:03 -08003459MACHINE_START(MPQ8064_HRD, "QCT MPQ8064 HRD")
3460 .map_io = apq8064_map_io,
3461 .reserve = apq8064_reserve,
3462 .init_irq = apq8064_init_irq,
3463 .handle_irq = gic_handle_irq,
3464 .timer = &msm_timer,
3465 .init_machine = apq8064_cdp_init,
Joel King3a57e772012-05-28 11:22:55 -07003466 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003467 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003468 .restart = msm_restart,
Joel King11ca8202012-02-13 16:19:03 -08003469MACHINE_END
3470
3471MACHINE_START(MPQ8064_DTV, "QCT MPQ8064 DTV")
3472 .map_io = apq8064_map_io,
3473 .reserve = apq8064_reserve,
3474 .init_irq = apq8064_init_irq,
3475 .handle_irq = gic_handle_irq,
3476 .timer = &msm_timer,
3477 .init_machine = apq8064_cdp_init,
Joel King3a57e772012-05-28 11:22:55 -07003478 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003479 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003480 .restart = msm_restart,
Joel King11ca8202012-02-13 16:19:03 -08003481MACHINE_END
3482