blob: ed17cc4210e1eb9744b44cb6c4dd22b7f6e9add3 [file] [log] [blame]
Manu Gautam5143b252012-01-05 19:25:23 -08001/* Copyright (c) 2011-2012, Code Aurora Forum. 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>
14#include <linux/platform_device.h>
15#include <linux/io.h>
16#include <linux/irq.h>
Kenneth Heitke748593a2011-07-15 15:45:11 -060017#include <linux/i2c.h>
David Keitel2f613d92012-02-15 11:29:16 -080018#include <linux/i2c/smb349.h>
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -080019#include <linux/i2c/sx150x.h>
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -060020#include <linux/slimbus/slimbus.h>
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +053021#include <linux/mfd/wcd9xxx/core.h>
22#include <linux/mfd/wcd9xxx/pdata.h>
Amy Maloche70090f992012-02-16 16:35:26 -080023#include <linux/mfd/pm8xxx/misc.h>
Kenneth Heitke36920d32011-07-20 16:44:30 -060024#include <linux/msm_ssbi.h>
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -070025#include <linux/spi/spi.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070026#include <linux/dma-mapping.h>
27#include <linux/platform_data/qcom_crypto_device.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080028#include <linux/ion.h>
Jack Cheung46bfffa2012-01-19 15:26:24 -080029#include <linux/memory.h>
Larry Bassel67b921d2012-04-06 10:23:27 -070030#include <linux/memblock.h>
Jing Lin21ed4de2012-02-05 15:53:28 -080031#include <linux/i2c/atmel_mxt_ts.h>
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -080032#include <linux/cyttsp.h>
Amy Maloche70090f992012-02-16 16:35:26 -080033#include <linux/i2c/isa1200.h>
Mohan Pallaka474b94b2012-01-25 12:59:58 +053034#include <linux/gpio_keys.h>
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -080035#include <linux/epm_adc.h>
Jay Chokshie7d8d4f2012-04-04 14:47:57 -070036#include <linux/i2c/sx150x.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070037#include <asm/mach-types.h>
38#include <asm/mach/arch.h>
39#include <asm/hardware/gic.h>
Sahitya Tummala3586ed92011-08-03 09:13:23 +053040#include <asm/mach/mmc.h>
Ankit Verma6b7e2ba2012-01-26 15:48:54 -080041#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070042
43#include <mach/board.h>
44#include <mach/msm_iomap.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080045#include <mach/ion.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070046#include <linux/usb/msm_hsusb.h>
47#include <linux/usb/android.h>
48#include <mach/socinfo.h>
Harini Jayaramanc4c58692011-07-19 14:50:10 -060049#include <mach/msm_spi.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070050#include "timer.h"
51#include "devices.h"
Joel King4ebccc62011-07-22 09:43:22 -070052#include <mach/gpio.h>
53#include <mach/gpiomux.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060054#include <mach/rpm.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080055#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -070056#include <linux/android_pmem.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080057#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070058#include <mach/msm_memtypes.h>
59#include <linux/bootmem.h>
60#include <asm/setup.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070061#include <mach/dma.h>
Jin Hongd3024e62012-02-09 16:13:32 -080062#include <mach/msm_dsps.h>
Gagan Mac8a7a5d32011-11-11 16:43:06 -070063#include <mach/msm_bus_board.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060064#include <mach/cpuidle.h>
Joel Kingdacbc822012-01-25 13:30:57 -080065#include <mach/mdm2.h>
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -080066#include <linux/msm_tsens.h>
Stephen Boyd4d0d2582012-02-10 14:49:40 -080067#include <mach/msm_xo.h>
Laura Abbott350c8362012-02-28 14:46:52 -080068#include <mach/msm_rtb.h>
Santosh Mardieff9a742012-04-09 23:23:39 +053069#include <sound/cs8427.h>
Ravi Kumar V05931a22012-04-04 17:09:37 +053070#include <media/gpio-ir-recv.h>
Larry Bassel67b921d2012-04-06 10:23:27 -070071#include <linux/fmem.h>
Joel King4ebccc62011-07-22 09:43:22 -070072
Jeff Ohlstein7e668552011-10-06 16:17:25 -070073#include "msm_watchdog.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080074#include "board-8064.h"
Vikram Mulukutlabc2e9572011-11-04 03:41:38 -070075#include "acpuclock.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060076#include "spm.h"
Subhash Jadavani909e04f2012-04-12 10:52:50 +053077#include <mach/mpm.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060078#include "rpm_resources.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080079#include "pm.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060080#include "pm-boot.h"
Rajesh Sastrulaaee8af32012-01-20 11:46:31 -080081#include "devices-msm8x60.h"
Hanumant Singh50440d42012-04-23 19:27:16 -070082#include "smd_private.h"
Jay Chokshiea67c622011-07-29 17:12:26 -070083
Olav Haugan7c6aa742012-01-16 16:47:37 -080084#define MSM_PMEM_ADSP_SIZE 0x7800000
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -070085#define MSM_PMEM_AUDIO_SIZE 0x4CF000
Olav Haugan7c6aa742012-01-16 16:47:37 -080086#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
87#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
88#else
Chetan Kalyan72aac4f2012-02-23 14:56:54 -080089#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Olav Haugan7c6aa742012-01-16 16:47:37 -080090#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070091
Olav Haugan7c6aa742012-01-16 16:47:37 -080092#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -070093#define MSM_PMEM_KERNEL_EBI1_SIZE 0x65000
Olav Haugan129992c2012-03-22 09:54:01 -070094#ifdef CONFIG_MSM_IOMMU
95#define MSM_ION_MM_SIZE 0x3800000
96#define MSM_ION_SF_SIZE 0
97#define MSM_ION_HEAP_NUM 7
98#else
Olav Haugan7c6aa742012-01-16 16:47:37 -080099#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Haugan129992c2012-03-22 09:54:01 -0700100#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
101#define MSM_ION_HEAP_NUM 8
102#endif
103#define MSM_ION_MM_FW_SIZE 0x200000 /* (2MB) */
Olav Haugan3a9bd232012-02-15 14:23:27 -0800104#define MSM_ION_QSECOM_SIZE 0x300000 /* (3MB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800105#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan2c43fac2012-01-19 11:06:37 -0800106#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Olav Haugan7c6aa742012-01-16 16:47:37 -0800107#else
108#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
109#define MSM_ION_HEAP_NUM 1
110#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700111
Larry Bassel67b921d2012-04-06 10:23:27 -0700112#define APQ8064_FIXED_AREA_START 0xa0000000
113#define MAX_FIXED_AREA_SIZE 0x10000000
114#define MSM_MM_FW_SIZE 0x200000
115#define APQ8064_FW_START (APQ8064_FIXED_AREA_START - MSM_MM_FW_SIZE)
116
Olav Haugan7c6aa742012-01-16 16:47:37 -0800117#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
118static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
119static int __init pmem_kernel_ebi1_size_setup(char *p)
Kevin Chan13be4e22011-10-20 11:30:32 -0700120{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800121 pmem_kernel_ebi1_size = memparse(p, NULL);
122 return 0;
Kevin Chan13be4e22011-10-20 11:30:32 -0700123}
Olav Haugan7c6aa742012-01-16 16:47:37 -0800124early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
125#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700126
Olav Haugan7c6aa742012-01-16 16:47:37 -0800127#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -0700128static unsigned pmem_size = MSM_PMEM_SIZE;
129static int __init pmem_size_setup(char *p)
130{
131 pmem_size = memparse(p, NULL);
132 return 0;
133}
134early_param("pmem_size", pmem_size_setup);
135
136static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
137
138static int __init pmem_adsp_size_setup(char *p)
139{
140 pmem_adsp_size = memparse(p, NULL);
141 return 0;
142}
143early_param("pmem_adsp_size", pmem_adsp_size_setup);
144
145static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
146
147static int __init pmem_audio_size_setup(char *p)
148{
149 pmem_audio_size = memparse(p, NULL);
150 return 0;
151}
152early_param("pmem_audio_size", pmem_audio_size_setup);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800153#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700154
Olav Haugan7c6aa742012-01-16 16:47:37 -0800155#ifdef CONFIG_ANDROID_PMEM
156#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700157static struct android_pmem_platform_data android_pmem_pdata = {
158 .name = "pmem",
159 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
160 .cached = 1,
161 .memory_type = MEMTYPE_EBI1,
162};
163
Laura Abbottb93525f2012-04-12 09:57:19 -0700164static struct platform_device apq8064_android_pmem_device = {
Kevin Chan13be4e22011-10-20 11:30:32 -0700165 .name = "android_pmem",
166 .id = 0,
167 .dev = {.platform_data = &android_pmem_pdata},
168};
169
170static struct android_pmem_platform_data android_pmem_adsp_pdata = {
171 .name = "pmem_adsp",
172 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
173 .cached = 0,
174 .memory_type = MEMTYPE_EBI1,
175};
Laura Abbottb93525f2012-04-12 09:57:19 -0700176static struct platform_device apq8064_android_pmem_adsp_device = {
Kevin Chan13be4e22011-10-20 11:30:32 -0700177 .name = "android_pmem",
178 .id = 2,
179 .dev = { .platform_data = &android_pmem_adsp_pdata },
180};
181
182static struct android_pmem_platform_data android_pmem_audio_pdata = {
183 .name = "pmem_audio",
184 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
185 .cached = 0,
186 .memory_type = MEMTYPE_EBI1,
187};
188
Laura Abbottb93525f2012-04-12 09:57:19 -0700189static struct platform_device apq8064_android_pmem_audio_device = {
Kevin Chan13be4e22011-10-20 11:30:32 -0700190 .name = "android_pmem",
191 .id = 4,
192 .dev = { .platform_data = &android_pmem_audio_pdata },
193};
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700194#endif /* CONFIG_MSM_MULTIMEDIA_USE_ION */
195#endif /* CONFIG_ANDROID_PMEM */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800196
Larry Bassel67b921d2012-04-06 10:23:27 -0700197struct fmem_platform_data apq8064_fmem_pdata = {
198};
199
Olav Haugan7c6aa742012-01-16 16:47:37 -0800200static struct memtype_reserve apq8064_reserve_table[] __initdata = {
201 [MEMTYPE_SMI] = {
202 },
203 [MEMTYPE_EBI0] = {
204 .flags = MEMTYPE_FLAGS_1M_ALIGN,
205 },
206 [MEMTYPE_EBI1] = {
207 .flags = MEMTYPE_FLAGS_1M_ALIGN,
208 },
209};
Kevin Chan13be4e22011-10-20 11:30:32 -0700210
Laura Abbott350c8362012-02-28 14:46:52 -0800211static void __init reserve_rtb_memory(void)
212{
213#if defined(CONFIG_MSM_RTB)
Laura Abbottb93525f2012-04-12 09:57:19 -0700214 apq8064_reserve_table[MEMTYPE_EBI1].size += apq8064_rtb_pdata.size;
Laura Abbott350c8362012-02-28 14:46:52 -0800215#endif
216}
217
218
Kevin Chan13be4e22011-10-20 11:30:32 -0700219static void __init size_pmem_devices(void)
220{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800221#ifdef CONFIG_ANDROID_PMEM
222#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700223 android_pmem_adsp_pdata.size = pmem_adsp_size;
224 android_pmem_pdata.size = pmem_size;
225 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700226#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
227#endif /*CONFIG_ANDROID_PMEM*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700228}
229
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700230#ifdef CONFIG_ANDROID_PMEM
231#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700232static void __init reserve_memory_for(struct android_pmem_platform_data *p)
233{
234 apq8064_reserve_table[p->memory_type].size += p->size;
235}
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700236#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
237#endif /*CONFIG_ANDROID_PMEM*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700238
Kevin Chan13be4e22011-10-20 11:30:32 -0700239static void __init reserve_pmem_memory(void)
240{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800241#ifdef CONFIG_ANDROID_PMEM
242#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700243 reserve_memory_for(&android_pmem_adsp_pdata);
244 reserve_memory_for(&android_pmem_pdata);
245 reserve_memory_for(&android_pmem_audio_pdata);
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700246#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700247 apq8064_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700248#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -0800249}
250
251static int apq8064_paddr_to_memtype(unsigned int paddr)
252{
253 return MEMTYPE_EBI1;
254}
255
Larry Bassel67b921d2012-04-06 10:23:27 -0700256#define FMEM_ENABLED 1
257
Olav Haugan7c6aa742012-01-16 16:47:37 -0800258#ifdef CONFIG_ION_MSM
259#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -0700260static struct ion_cp_heap_pdata cp_mm_apq8064_ion_pdata = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800261 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugand3d29682012-01-19 10:57:07 -0800262 .align = PAGE_SIZE,
Larry Bassel67b921d2012-04-06 10:23:27 -0700263 .reusable = FMEM_ENABLED,
264 .mem_is_fmem = FMEM_ENABLED,
265 .fixed_position = FIXED_MIDDLE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800266};
267
Laura Abbottb93525f2012-04-12 09:57:19 -0700268static struct ion_cp_heap_pdata cp_mfc_apq8064_ion_pdata = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800269 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugand3d29682012-01-19 10:57:07 -0800270 .align = PAGE_SIZE,
Larry Bassel67b921d2012-04-06 10:23:27 -0700271 .reusable = 0,
272 .mem_is_fmem = FMEM_ENABLED,
273 .fixed_position = FIXED_HIGH,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800274};
275
Laura Abbottb93525f2012-04-12 09:57:19 -0700276static struct ion_co_heap_pdata co_apq8064_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800277 .adjacent_mem_id = INVALID_HEAP_ID,
278 .align = PAGE_SIZE,
Larry Bassel67b921d2012-04-06 10:23:27 -0700279 .mem_is_fmem = 0,
Olav Haugand3d29682012-01-19 10:57:07 -0800280};
281
Laura Abbottb93525f2012-04-12 09:57:19 -0700282static struct ion_co_heap_pdata fw_co_apq8064_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800283 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
284 .align = SZ_128K,
Larry Bassel67b921d2012-04-06 10:23:27 -0700285 .mem_is_fmem = FMEM_ENABLED,
286 .fixed_position = FIXED_LOW,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800287};
288#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800289
290/**
291 * These heaps are listed in the order they will be allocated. Due to
292 * video hardware restrictions and content protection the FW heap has to
293 * be allocated adjacent (below) the MM heap and the MFC heap has to be
294 * allocated after the MM heap to ensure MFC heap is not more than 256MB
295 * away from the base address of the FW heap.
296 * However, the order of FW heap and MM heap doesn't matter since these
297 * two heaps are taken care of by separate code to ensure they are adjacent
298 * to each other.
299 * Don't swap the order unless you know what you are doing!
300 */
Laura Abbottb93525f2012-04-12 09:57:19 -0700301static struct ion_platform_data apq8064_ion_pdata = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800302 .nr = MSM_ION_HEAP_NUM,
303 .heaps = {
304 {
305 .id = ION_SYSTEM_HEAP_ID,
306 .type = ION_HEAP_TYPE_SYSTEM,
307 .name = ION_VMALLOC_HEAP_NAME,
308 },
309#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
310 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800311 .id = ION_CP_MM_HEAP_ID,
312 .type = ION_HEAP_TYPE_CP,
313 .name = ION_MM_HEAP_NAME,
314 .size = MSM_ION_MM_SIZE,
315 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700316 .extra_data = (void *) &cp_mm_apq8064_ion_pdata,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800317 },
318 {
Olav Haugand3d29682012-01-19 10:57:07 -0800319 .id = ION_MM_FIRMWARE_HEAP_ID,
320 .type = ION_HEAP_TYPE_CARVEOUT,
321 .name = ION_MM_FIRMWARE_HEAP_NAME,
322 .size = MSM_ION_MM_FW_SIZE,
323 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700324 .extra_data = (void *) &fw_co_apq8064_ion_pdata,
Olav Haugand3d29682012-01-19 10:57:07 -0800325 },
326 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800327 .id = ION_CP_MFC_HEAP_ID,
328 .type = ION_HEAP_TYPE_CP,
329 .name = ION_MFC_HEAP_NAME,
330 .size = MSM_ION_MFC_SIZE,
331 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700332 .extra_data = (void *) &cp_mfc_apq8064_ion_pdata,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800333 },
Olav Haugan129992c2012-03-22 09:54:01 -0700334#ifndef CONFIG_MSM_IOMMU
Olav Haugan7c6aa742012-01-16 16:47:37 -0800335 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800336 .id = ION_SF_HEAP_ID,
337 .type = ION_HEAP_TYPE_CARVEOUT,
338 .name = ION_SF_HEAP_NAME,
339 .size = MSM_ION_SF_SIZE,
340 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700341 .extra_data = (void *) &co_apq8064_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800342 },
Olav Haugan129992c2012-03-22 09:54:01 -0700343#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800344 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800345 .id = ION_IOMMU_HEAP_ID,
346 .type = ION_HEAP_TYPE_IOMMU,
347 .name = ION_IOMMU_HEAP_NAME,
348 },
Olav Hauganf45e2142012-01-19 11:01:01 -0800349 {
350 .id = ION_QSECOM_HEAP_ID,
351 .type = ION_HEAP_TYPE_CARVEOUT,
352 .name = ION_QSECOM_HEAP_NAME,
353 .size = MSM_ION_QSECOM_SIZE,
354 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700355 .extra_data = (void *) &co_apq8064_ion_pdata,
Olav Hauganf45e2142012-01-19 11:01:01 -0800356 },
Olav Haugan2c43fac2012-01-19 11:06:37 -0800357 {
358 .id = ION_AUDIO_HEAP_ID,
359 .type = ION_HEAP_TYPE_CARVEOUT,
360 .name = ION_AUDIO_HEAP_NAME,
361 .size = MSM_ION_AUDIO_SIZE,
362 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700363 .extra_data = (void *) &co_apq8064_ion_pdata,
Olav Haugan2c43fac2012-01-19 11:06:37 -0800364 },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800365#endif
366 }
367};
368
Laura Abbottb93525f2012-04-12 09:57:19 -0700369static struct platform_device apq8064_ion_dev = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800370 .name = "ion-msm",
371 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700372 .dev = { .platform_data = &apq8064_ion_pdata },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800373};
374#endif
375
Larry Bassel67b921d2012-04-06 10:23:27 -0700376static struct platform_device apq8064_fmem_device = {
377 .name = "fmem",
378 .id = 1,
379 .dev = { .platform_data = &apq8064_fmem_pdata },
380};
381
382static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
383 unsigned long size)
384{
385 apq8064_reserve_table[mem_type].size += size;
386}
387
388static void __init apq8064_reserve_fixed_area(unsigned long fixed_area_size)
389{
390#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
391 int ret;
392
393 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
394 panic("fixed area size is larger than %dM\n",
395 MAX_FIXED_AREA_SIZE >> 20);
396
397 reserve_info->fixed_area_size = fixed_area_size;
398 reserve_info->fixed_area_start = APQ8064_FW_START;
399
400 ret = memblock_remove(reserve_info->fixed_area_start,
401 reserve_info->fixed_area_size);
402 BUG_ON(ret);
403#endif
404}
405
406/**
407 * Reserve memory for ION and calculate amount of reusable memory for fmem.
408 * We only reserve memory for heaps that are not reusable. However, we only
409 * support one reusable heap at the moment so we ignore the reusable flag for
410 * other than the first heap with reusable flag set. Also handle special case
411 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
412 * at a higher address than FW in addition to not more than 256MB away from the
413 * base address of the firmware. This means that if MM is reusable the other
414 * two heaps must be allocated in the same region as FW. This is handled by the
415 * mem_is_fmem flag in the platform data. In addition the MM heap must be
416 * adjacent to the FW heap for content protection purposes.
417 */
Stephen Boyd668d7652012-04-25 11:31:01 -0700418static void __init reserve_ion_memory(void)
Olav Haugan7c6aa742012-01-16 16:47:37 -0800419{
420#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Larry Bassel67b921d2012-04-06 10:23:27 -0700421 unsigned int i;
422 unsigned int reusable_count = 0;
423 unsigned int fixed_size = 0;
424 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
425 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
426
427 apq8064_fmem_pdata.size = 0;
428 apq8064_fmem_pdata.reserved_size_low = 0;
429 apq8064_fmem_pdata.reserved_size_high = 0;
Olav Haugan62436252012-05-16 09:09:43 -0700430 apq8064_fmem_pdata.align = PAGE_SIZE;
Larry Bassel67b921d2012-04-06 10:23:27 -0700431 fixed_low_size = 0;
432 fixed_middle_size = 0;
433 fixed_high_size = 0;
434
435 /* We only support 1 reusable heap. Check if more than one heap
436 * is specified as reusable and set as non-reusable if found.
437 */
438 for (i = 0; i < apq8064_ion_pdata.nr; ++i) {
439 const struct ion_platform_heap *heap =
440 &(apq8064_ion_pdata.heaps[i]);
441
442 if (heap->type == ION_HEAP_TYPE_CP && heap->extra_data) {
443 struct ion_cp_heap_pdata *data = heap->extra_data;
444
445 reusable_count += (data->reusable) ? 1 : 0;
446
447 if (data->reusable && reusable_count > 1) {
448 pr_err("%s: Too many heaps specified as "
449 "reusable. Heap %s was not configured "
450 "as reusable.\n", __func__, heap->name);
451 data->reusable = 0;
452 }
453 }
454 }
455
456 for (i = 0; i < apq8064_ion_pdata.nr; ++i) {
457 const struct ion_platform_heap *heap =
458 &(apq8064_ion_pdata.heaps[i]);
459
460 if (heap->extra_data) {
461 int fixed_position = NOT_FIXED;
462 int mem_is_fmem = 0;
463
464 switch (heap->type) {
465 case ION_HEAP_TYPE_CP:
466 mem_is_fmem = ((struct ion_cp_heap_pdata *)
467 heap->extra_data)->mem_is_fmem;
468 fixed_position = ((struct ion_cp_heap_pdata *)
469 heap->extra_data)->fixed_position;
470 break;
471 case ION_HEAP_TYPE_CARVEOUT:
472 mem_is_fmem = ((struct ion_co_heap_pdata *)
473 heap->extra_data)->mem_is_fmem;
474 fixed_position = ((struct ion_co_heap_pdata *)
475 heap->extra_data)->fixed_position;
476 break;
477 default:
478 break;
479 }
480
481 if (fixed_position != NOT_FIXED)
482 fixed_size += heap->size;
483 else
484 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
485
486 if (fixed_position == FIXED_LOW)
487 fixed_low_size += heap->size;
488 else if (fixed_position == FIXED_MIDDLE)
489 fixed_middle_size += heap->size;
490 else if (fixed_position == FIXED_HIGH)
491 fixed_high_size += heap->size;
492
493 if (mem_is_fmem)
494 apq8064_fmem_pdata.size += heap->size;
495 }
496 }
497
498 if (!fixed_size)
499 return;
500
501 if (apq8064_fmem_pdata.size) {
502 apq8064_fmem_pdata.reserved_size_low = fixed_low_size;
503 apq8064_fmem_pdata.reserved_size_high = fixed_high_size;
504 }
505
506 /* Since the fixed area may be carved out of lowmem,
507 * make sure the length is a multiple of 1M.
508 */
509 fixed_size = (fixed_size + MSM_MM_FW_SIZE + SECTION_SIZE - 1)
510 & SECTION_MASK;
511 apq8064_reserve_fixed_area(fixed_size);
512
513 fixed_low_start = APQ8064_FIXED_AREA_START;
514 fixed_middle_start = fixed_low_start + fixed_low_size;
515 fixed_high_start = fixed_middle_start + fixed_middle_size;
516
517 for (i = 0; i < apq8064_ion_pdata.nr; ++i) {
518 struct ion_platform_heap *heap = &(apq8064_ion_pdata.heaps[i]);
519
520 if (heap->extra_data) {
521 int fixed_position = NOT_FIXED;
522
523 switch (heap->type) {
524 case ION_HEAP_TYPE_CP:
525 fixed_position = ((struct ion_cp_heap_pdata *)
526 heap->extra_data)->fixed_position;
527 break;
528 case ION_HEAP_TYPE_CARVEOUT:
529 fixed_position = ((struct ion_co_heap_pdata *)
530 heap->extra_data)->fixed_position;
531 break;
532 default:
533 break;
534 }
535
536 switch (fixed_position) {
537 case FIXED_LOW:
538 heap->base = fixed_low_start;
539 break;
540 case FIXED_MIDDLE:
541 heap->base = fixed_middle_start;
542 break;
543 case FIXED_HIGH:
544 heap->base = fixed_high_start;
545 break;
546 default:
547 break;
548 }
549 }
550 }
Olav Haugan7c6aa742012-01-16 16:47:37 -0800551#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700552}
553
Huaibin Yang4a084e32011-12-15 15:25:52 -0800554static void __init reserve_mdp_memory(void)
555{
556 apq8064_mdp_writeback(apq8064_reserve_table);
557}
558
Kevin Chan13be4e22011-10-20 11:30:32 -0700559static void __init apq8064_calculate_reserve_sizes(void)
560{
561 size_pmem_devices();
562 reserve_pmem_memory();
Olav Haugan7c6aa742012-01-16 16:47:37 -0800563 reserve_ion_memory();
Huaibin Yang4a084e32011-12-15 15:25:52 -0800564 reserve_mdp_memory();
Laura Abbott350c8362012-02-28 14:46:52 -0800565 reserve_rtb_memory();
Kevin Chan13be4e22011-10-20 11:30:32 -0700566}
567
568static struct reserve_info apq8064_reserve_info __initdata = {
569 .memtype_reserve_table = apq8064_reserve_table,
570 .calculate_reserve_sizes = apq8064_calculate_reserve_sizes,
Larry Bassel67b921d2012-04-06 10:23:27 -0700571 .reserve_fixed_area = apq8064_reserve_fixed_area,
Kevin Chan13be4e22011-10-20 11:30:32 -0700572 .paddr_to_memtype = apq8064_paddr_to_memtype,
573};
574
575static int apq8064_memory_bank_size(void)
576{
577 return 1<<29;
578}
579
580static void __init locate_unstable_memory(void)
581{
582 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
583 unsigned long bank_size;
584 unsigned long low, high;
585
586 bank_size = apq8064_memory_bank_size();
587 low = meminfo.bank[0].start;
588 high = mb->start + mb->size;
Olav Haugand76e3a82012-01-16 16:55:07 -0800589
590 /* Check if 32 bit overflow occured */
591 if (high < mb->start)
Larry Bassel67b921d2012-04-06 10:23:27 -0700592 high = -PAGE_SIZE;
Olav Haugand76e3a82012-01-16 16:55:07 -0800593
Kevin Chan13be4e22011-10-20 11:30:32 -0700594 low &= ~(bank_size - 1);
595
596 if (high - low <= bank_size)
Larry Bassel67b921d2012-04-06 10:23:27 -0700597 goto no_dmm;
598
599#ifdef CONFIG_ENABLE_DMM
Jack Cheung46bfffa2012-01-19 15:26:24 -0800600 apq8064_reserve_info.low_unstable_address = mb->start -
601 MIN_MEMORY_BLOCK_SIZE + mb->size;
602 apq8064_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
603
Kevin Chan13be4e22011-10-20 11:30:32 -0700604 apq8064_reserve_info.bank_size = bank_size;
605 pr_info("low unstable address %lx max size %lx bank size %lx\n",
606 apq8064_reserve_info.low_unstable_address,
607 apq8064_reserve_info.max_unstable_size,
608 apq8064_reserve_info.bank_size);
Larry Bassel67b921d2012-04-06 10:23:27 -0700609 return;
610#endif
611no_dmm:
612 apq8064_reserve_info.low_unstable_address = high;
613 apq8064_reserve_info.max_unstable_size = 0;
Kevin Chan13be4e22011-10-20 11:30:32 -0700614}
615
Hanumant Singh50440d42012-04-23 19:27:16 -0700616static int apq8064_change_memory_power(u64 start, u64 size,
617 int change_type)
618{
619 return soc_change_memory_power(start, size, change_type);
620}
621
Aravind Venkateswaran8ac7f412012-03-16 17:57:30 -0700622static char prim_panel_name[PANEL_NAME_MAX_LEN];
623static char ext_panel_name[PANEL_NAME_MAX_LEN];
624static int __init prim_display_setup(char *param)
625{
626 if (strnlen(param, PANEL_NAME_MAX_LEN))
627 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
628 return 0;
629}
630early_param("prim_display", prim_display_setup);
631
632static int __init ext_display_setup(char *param)
633{
634 if (strnlen(param, PANEL_NAME_MAX_LEN))
635 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
636 return 0;
637}
638early_param("ext_display", ext_display_setup);
639
Kevin Chan13be4e22011-10-20 11:30:32 -0700640static void __init apq8064_reserve(void)
641{
Aravind Venkateswaran8ac7f412012-03-16 17:57:30 -0700642 apq8064_set_display_params(prim_panel_name, ext_panel_name);
Kevin Chan13be4e22011-10-20 11:30:32 -0700643 msm_reserve();
Larry Bassel67b921d2012-04-06 10:23:27 -0700644 if (apq8064_fmem_pdata.size) {
645#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
646 if (reserve_info->fixed_area_size) {
647 apq8064_fmem_pdata.phys =
648 reserve_info->fixed_area_start + MSM_MM_FW_SIZE;
649 pr_info("mm fw at %lx (fixed) size %x\n",
650 reserve_info->fixed_area_start, MSM_MM_FW_SIZE);
651 pr_info("fmem start %lx (fixed) size %lx\n",
652 apq8064_fmem_pdata.phys,
653 apq8064_fmem_pdata.size);
654 }
655#endif
656 }
Kevin Chan13be4e22011-10-20 11:30:32 -0700657}
658
Laura Abbott6988cef2012-03-15 14:27:13 -0700659static void __init place_movable_zone(void)
660{
Larry Bassel67b921d2012-04-06 10:23:27 -0700661#ifdef CONFIG_ENABLE_DMM
Laura Abbott6988cef2012-03-15 14:27:13 -0700662 movable_reserved_start = apq8064_reserve_info.low_unstable_address;
663 movable_reserved_size = apq8064_reserve_info.max_unstable_size;
664 pr_info("movable zone start %lx size %lx\n",
665 movable_reserved_start, movable_reserved_size);
Larry Bassel67b921d2012-04-06 10:23:27 -0700666#endif
Laura Abbott6988cef2012-03-15 14:27:13 -0700667}
668
669static void __init apq8064_early_reserve(void)
670{
671 reserve_info = &apq8064_reserve_info;
672 locate_unstable_memory();
673 place_movable_zone();
674
675}
Hemant Kumara945b472012-01-25 15:08:06 -0800676#ifdef CONFIG_USB_EHCI_MSM_HSIC
Hemant Kumare6275972012-02-29 20:06:21 -0800677/* Bandwidth requests (zero) if no vote placed */
678static struct msm_bus_vectors hsic_init_vectors[] = {
679 {
680 .src = MSM_BUS_MASTER_SPS,
681 .dst = MSM_BUS_SLAVE_EBI_CH0,
682 .ab = 0,
683 .ib = 0,
684 },
685 {
686 .src = MSM_BUS_MASTER_SPS,
687 .dst = MSM_BUS_SLAVE_SPS,
688 .ab = 0,
689 .ib = 0,
690 },
691};
692
693/* Bus bandwidth requests in Bytes/sec */
694static struct msm_bus_vectors hsic_max_vectors[] = {
695 {
696 .src = MSM_BUS_MASTER_SPS,
697 .dst = MSM_BUS_SLAVE_EBI_CH0,
698 .ab = 60000000, /* At least 480Mbps on bus. */
699 .ib = 960000000, /* MAX bursts rate */
700 },
701 {
702 .src = MSM_BUS_MASTER_SPS,
703 .dst = MSM_BUS_SLAVE_SPS,
704 .ab = 0,
705 .ib = 512000000, /*vote for 64Mhz dfab clk rate*/
706 },
707};
708
709static struct msm_bus_paths hsic_bus_scale_usecases[] = {
710 {
711 ARRAY_SIZE(hsic_init_vectors),
712 hsic_init_vectors,
713 },
714 {
715 ARRAY_SIZE(hsic_max_vectors),
716 hsic_max_vectors,
717 },
718};
719
720static struct msm_bus_scale_pdata hsic_bus_scale_pdata = {
721 hsic_bus_scale_usecases,
722 ARRAY_SIZE(hsic_bus_scale_usecases),
723 .name = "hsic",
724};
725
Hemant Kumara945b472012-01-25 15:08:06 -0800726static struct msm_hsic_host_platform_data msm_hsic_pdata = {
Hemant Kumare6275972012-02-29 20:06:21 -0800727 .strobe = 88,
728 .data = 89,
729 .bus_scale_table = &hsic_bus_scale_pdata,
Hemant Kumara945b472012-01-25 15:08:06 -0800730};
731#else
732static struct msm_hsic_host_platform_data msm_hsic_pdata;
733#endif
734
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800735#define PID_MAGIC_ID 0x71432909
736#define SERIAL_NUM_MAGIC_ID 0x61945374
737#define SERIAL_NUMBER_LENGTH 127
738#define DLOAD_USB_BASE_ADD 0x2A03F0C8
739
740struct magic_num_struct {
741 uint32_t pid;
742 uint32_t serial_num;
743};
744
745struct dload_struct {
746 uint32_t reserved1;
747 uint32_t reserved2;
748 uint32_t reserved3;
749 uint16_t reserved4;
750 uint16_t pid;
751 char serial_number[SERIAL_NUMBER_LENGTH];
752 uint16_t reserved5;
753 struct magic_num_struct magic_struct;
754};
755
756static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
757{
758 struct dload_struct __iomem *dload = 0;
759
760 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
761 if (!dload) {
762 pr_err("%s: cannot remap I/O memory region: %08x\n",
763 __func__, DLOAD_USB_BASE_ADD);
764 return -ENXIO;
765 }
766
767 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
768 __func__, dload, pid, snum);
769 /* update pid */
770 dload->magic_struct.pid = PID_MAGIC_ID;
771 dload->pid = pid;
772
773 /* update serial number */
774 dload->magic_struct.serial_num = 0;
775 if (!snum) {
776 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
777 goto out;
778 }
779
780 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
781 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
782out:
783 iounmap(dload);
784 return 0;
785}
786
787static struct android_usb_platform_data android_usb_pdata = {
788 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
789};
790
Hemant Kumar4933b072011-10-17 23:43:11 -0700791static struct platform_device android_usb_device = {
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800792 .name = "android_usb",
793 .id = -1,
794 .dev = {
795 .platform_data = &android_usb_pdata,
796 },
Hemant Kumar4933b072011-10-17 23:43:11 -0700797};
798
Hemant Kumar7620eed2012-02-26 09:08:43 -0800799/* Bandwidth requests (zero) if no vote placed */
800static struct msm_bus_vectors usb_init_vectors[] = {
801 {
802 .src = MSM_BUS_MASTER_SPS,
803 .dst = MSM_BUS_SLAVE_EBI_CH0,
804 .ab = 0,
805 .ib = 0,
806 },
807};
808
809/* Bus bandwidth requests in Bytes/sec */
810static struct msm_bus_vectors usb_max_vectors[] = {
811 {
812 .src = MSM_BUS_MASTER_SPS,
813 .dst = MSM_BUS_SLAVE_EBI_CH0,
814 .ab = 60000000, /* At least 480Mbps on bus. */
815 .ib = 960000000, /* MAX bursts rate */
816 },
817};
818
819static struct msm_bus_paths usb_bus_scale_usecases[] = {
820 {
821 ARRAY_SIZE(usb_init_vectors),
822 usb_init_vectors,
823 },
824 {
825 ARRAY_SIZE(usb_max_vectors),
826 usb_max_vectors,
827 },
828};
829
830static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
831 usb_bus_scale_usecases,
832 ARRAY_SIZE(usb_bus_scale_usecases),
833 .name = "usb",
834};
835
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700836static int phy_init_seq[] = {
837 0x38, 0x81, /* update DC voltage level */
838 0x24, 0x82, /* set pre-emphasis and rise/fall time */
839 -1
840};
841
Hemant Kumar4933b072011-10-17 23:43:11 -0700842static struct msm_otg_platform_data msm_otg_pdata = {
Hemant Kumard86c4882012-01-24 19:39:37 -0800843 .mode = USB_OTG,
844 .otg_control = OTG_PMIC_CONTROL,
Hemant Kumar4933b072011-10-17 23:43:11 -0700845 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Hemant Kumard86c4882012-01-24 19:39:37 -0800846 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
847 .power_budget = 750,
Hemant Kumar7620eed2012-02-26 09:08:43 -0800848 .bus_scale_table = &usb_bus_scale_pdata,
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700849 .phy_init_seq = phy_init_seq,
Hemant Kumar4933b072011-10-17 23:43:11 -0700850};
851
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800852static struct msm_usb_host_platform_data msm_ehci_host_pdata3 = {
Manu Gautam91223e02011-11-08 15:27:22 +0530853 .power_budget = 500,
854};
855
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800856#ifdef CONFIG_USB_EHCI_MSM_HOST4
857static struct msm_usb_host_platform_data msm_ehci_host_pdata4;
858#endif
859
Manu Gautam91223e02011-11-08 15:27:22 +0530860static void __init apq8064_ehci_host_init(void)
861{
862 if (machine_is_apq8064_liquid()) {
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800863 msm_ehci_host_pdata3.dock_connect_irq =
Hemant Kumar56925352012-02-13 16:59:52 -0800864 PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9);
865
Manu Gautam91223e02011-11-08 15:27:22 +0530866 apq8064_device_ehci_host3.dev.platform_data =
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800867 &msm_ehci_host_pdata3;
Manu Gautam91223e02011-11-08 15:27:22 +0530868 platform_device_register(&apq8064_device_ehci_host3);
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800869
870#ifdef CONFIG_USB_EHCI_MSM_HOST4
871 apq8064_device_ehci_host4.dev.platform_data =
872 &msm_ehci_host_pdata4;
873 platform_device_register(&apq8064_device_ehci_host4);
874#endif
Manu Gautam91223e02011-11-08 15:27:22 +0530875 }
876}
877
David Keitel2f613d92012-02-15 11:29:16 -0800878static struct smb349_platform_data smb349_data __initdata = {
879 .en_n_gpio = PM8921_GPIO_PM_TO_SYS(37),
880 .chg_susp_gpio = PM8921_GPIO_PM_TO_SYS(30),
881 .chg_current_ma = 2200,
882};
883
884static struct i2c_board_info smb349_charger_i2c_info[] __initdata = {
885 {
886 I2C_BOARD_INFO(SMB349_NAME, 0x1B),
887 .platform_data = &smb349_data,
888 },
889};
890
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -0800891struct sx150x_platform_data apq8064_sx150x_data[] = {
892 [SX150X_EPM] = {
893 .gpio_base = GPIO_EPM_EXPANDER_BASE,
894 .oscio_is_gpo = false,
895 .io_pullup_ena = 0x0,
896 .io_pulldn_ena = 0x0,
897 .io_open_drain_ena = 0x0,
898 .io_polarity = 0,
899 .irq_summary = -1,
900 },
901};
902
903static struct epm_chan_properties ads_adc_channel_data[] = {
904 {10, 100}, {500, 50}, {1, 1}, {1, 1},
905 {20, 50}, {10, 100}, {1, 1}, {1, 1},
906 {10, 100}, {10, 100}, {100, 100}, {200, 100},
907 {100, 50}, {2000, 50}, {1000, 50}, {200, 50},
908 {200, 100}, {1, 1}, {20, 50}, {500, 50},
909 {50, 50}, {200, 100}, {500, 100}, {20, 50},
910 {200, 50}, {2000, 100}, {1000, 50}, {100, 50},
911 {200, 100}, {500, 50}, {1000, 100}, {200, 50},
912 {1000, 50}, {50, 50}, {100, 50}, {100, 50},
913 {1, 1}, {1, 1}, {20, 100}, {20, 50},
914 {500, 100}, {1000, 100}, {100, 50}, {1000, 50},
915 {100, 50}, {1000, 100}, {100, 50}, {100, 50},
916};
917
918static struct epm_adc_platform_data epm_adc_pdata = {
919 .channel = ads_adc_channel_data,
920 .bus_id = 0x0,
921 .epm_i2c_board_info = {
922 .type = "sx1509q",
923 .addr = 0x3e,
924 .platform_data = &apq8064_sx150x_data[SX150X_EPM],
925 },
926 .gpio_expander_base_addr = GPIO_EPM_EXPANDER_BASE,
927};
928
929static struct platform_device epm_adc_device = {
930 .name = "epm_adc",
931 .id = -1,
932 .dev = {
933 .platform_data = &epm_adc_pdata,
934 },
935};
936
937static void __init apq8064_epm_adc_init(void)
938{
939 epm_adc_pdata.num_channels = 32;
940 epm_adc_pdata.num_adc = 2;
941 epm_adc_pdata.chan_per_adc = 16;
942 epm_adc_pdata.chan_per_mux = 8;
943};
944
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800945/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
946 * 4 micbiases are used to power various analog and digital
947 * microphones operating at 1800 mV. Technically, all micbiases
948 * can source from single cfilter since all microphones operate
949 * at the same voltage level. The arrangement below is to make
950 * sure all cfilters are exercised. LDO_H regulator ouput level
951 * does not need to be as high as 2.85V. It is choosen for
952 * microphone sensitivity purpose.
953 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530954static struct wcd9xxx_pdata apq8064_tabla_platform_data = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800955 .slimbus_slave_device = {
956 .name = "tabla-slave",
957 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
958 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800959 .irq = MSM_GPIO_TO_INT(42),
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800960 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530961 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800962 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
963 .micbias = {
964 .ldoh_v = TABLA_LDOH_2P85_V,
965 .cfilt1_mv = 1800,
966 .cfilt2_mv = 1800,
967 .cfilt3_mv = 1800,
968 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
969 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
970 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
971 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530972 },
973 .regulator = {
974 {
975 .name = "CDC_VDD_CP",
976 .min_uV = 1800000,
977 .max_uV = 1800000,
978 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
979 },
980 {
981 .name = "CDC_VDDA_RX",
982 .min_uV = 1800000,
983 .max_uV = 1800000,
984 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
985 },
986 {
987 .name = "CDC_VDDA_TX",
988 .min_uV = 1800000,
989 .max_uV = 1800000,
990 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
991 },
992 {
993 .name = "VDDIO_CDC",
994 .min_uV = 1800000,
995 .max_uV = 1800000,
996 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
997 },
998 {
999 .name = "VDDD_CDC_D",
1000 .min_uV = 1225000,
1001 .max_uV = 1225000,
1002 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1003 },
1004 {
1005 .name = "CDC_VDDA_A_1P2V",
1006 .min_uV = 1225000,
1007 .max_uV = 1225000,
1008 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1009 },
1010 },
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001011};
1012
1013static struct slim_device apq8064_slim_tabla = {
1014 .name = "tabla-slim",
1015 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
1016 .dev = {
1017 .platform_data = &apq8064_tabla_platform_data,
1018 },
1019};
1020
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301021static struct wcd9xxx_pdata apq8064_tabla20_platform_data = {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001022 .slimbus_slave_device = {
1023 .name = "tabla-slave",
1024 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
1025 },
1026 .irq = MSM_GPIO_TO_INT(42),
1027 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301028 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001029 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
1030 .micbias = {
1031 .ldoh_v = TABLA_LDOH_2P85_V,
1032 .cfilt1_mv = 1800,
1033 .cfilt2_mv = 1800,
1034 .cfilt3_mv = 1800,
1035 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
1036 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
1037 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
1038 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301039 },
1040 .regulator = {
1041 {
1042 .name = "CDC_VDD_CP",
1043 .min_uV = 1800000,
1044 .max_uV = 1800000,
1045 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
1046 },
1047 {
1048 .name = "CDC_VDDA_RX",
1049 .min_uV = 1800000,
1050 .max_uV = 1800000,
1051 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
1052 },
1053 {
1054 .name = "CDC_VDDA_TX",
1055 .min_uV = 1800000,
1056 .max_uV = 1800000,
1057 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
1058 },
1059 {
1060 .name = "VDDIO_CDC",
1061 .min_uV = 1800000,
1062 .max_uV = 1800000,
1063 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1064 },
1065 {
1066 .name = "VDDD_CDC_D",
1067 .min_uV = 1225000,
1068 .max_uV = 1225000,
1069 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1070 },
1071 {
1072 .name = "CDC_VDDA_A_1P2V",
1073 .min_uV = 1225000,
1074 .max_uV = 1225000,
1075 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1076 },
1077 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001078};
1079
1080static struct slim_device apq8064_slim_tabla20 = {
1081 .name = "tabla2x-slim",
1082 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
1083 .dev = {
1084 .platform_data = &apq8064_tabla20_platform_data,
1085 },
1086};
1087
Santosh Mardi695be0d2012-04-10 23:21:12 +05301088/* enable the level shifter for cs8427 to make sure the I2C
1089 * clock is running at 100KHz and voltage levels are at 3.3
1090 * and 5 volts
1091 */
1092static int enable_100KHz_ls(int enable)
1093{
1094 int ret = 0;
1095 if (enable) {
1096 ret = gpio_request(SX150X_GPIO(1, 10),
1097 "cs8427_100KHZ_ENABLE");
1098 if (ret) {
1099 pr_err("%s: Failed to request gpio %d\n", __func__,
1100 SX150X_GPIO(1, 10));
1101 return ret;
1102 }
1103 gpio_direction_output(SX150X_GPIO(1, 10), 1);
1104 } else
1105 gpio_free(SX150X_GPIO(1, 10));
1106 return ret;
1107}
1108
Santosh Mardieff9a742012-04-09 23:23:39 +05301109static struct cs8427_platform_data cs8427_i2c_platform_data = {
1110 .irq = SX150X_GPIO(1, 4),
1111 .reset_gpio = SX150X_GPIO(1, 6),
Santosh Mardi695be0d2012-04-10 23:21:12 +05301112 .enable = enable_100KHz_ls,
Santosh Mardieff9a742012-04-09 23:23:39 +05301113};
1114
1115static struct i2c_board_info cs8427_device_info[] __initdata = {
1116 {
1117 I2C_BOARD_INFO("cs8427", CS8427_ADDR4),
1118 .platform_data = &cs8427_i2c_platform_data,
1119 },
1120};
1121
Amy Maloche70090f992012-02-16 16:35:26 -08001122#define HAP_SHIFT_LVL_OE_GPIO PM8921_MPP_PM_TO_SYS(8)
1123#define ISA1200_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1124#define ISA1200_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
1125#define ISA1200_HAP_CLK PM8921_GPIO_PM_TO_SYS(44)
1126
1127static int isa1200_power(int on)
1128{
Amy Maloche8f973892012-03-26 14:53:13 -07001129 int rc = 0;
1130
Amy Maloche70090f992012-02-16 16:35:26 -08001131 gpio_set_value_cansleep(ISA1200_HAP_CLK, !!on);
1132
Amy Maloche8f973892012-03-26 14:53:13 -07001133 if (on)
1134 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_1, true);
1135 else
1136 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_NONE, true);
1137
1138 if (rc) {
1139 pr_err("%s: unable to write aux clock register(%d)\n",
1140 __func__, rc);
1141 }
1142
1143 return rc;
Amy Maloche70090f992012-02-16 16:35:26 -08001144}
1145
1146static int isa1200_dev_setup(bool enable)
1147{
1148 int rc = 0;
1149
Amy Maloche70090f992012-02-16 16:35:26 -08001150 if (!enable)
1151 goto free_gpio;
1152
1153 rc = gpio_request(ISA1200_HAP_CLK, "haptics_clk");
1154 if (rc) {
1155 pr_err("%s: unable to request gpio %d config(%d)\n",
1156 __func__, ISA1200_HAP_CLK, rc);
1157 return rc;
1158 }
1159
1160 rc = gpio_direction_output(ISA1200_HAP_CLK, 0);
1161 if (rc) {
1162 pr_err("%s: unable to set direction\n", __func__);
1163 goto free_gpio;
1164 }
1165
1166 return 0;
1167
1168free_gpio:
1169 gpio_free(ISA1200_HAP_CLK);
1170 return rc;
1171}
1172
1173static struct isa1200_regulator isa1200_reg_data[] = {
1174 {
1175 .name = "vddp",
1176 .min_uV = ISA_I2C_VTG_MIN_UV,
1177 .max_uV = ISA_I2C_VTG_MAX_UV,
1178 .load_uA = ISA_I2C_CURR_UA,
1179 },
1180};
1181
1182static struct isa1200_platform_data isa1200_1_pdata = {
1183 .name = "vibrator",
1184 .dev_setup = isa1200_dev_setup,
1185 .power_on = isa1200_power,
1186 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
1187 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
1188 .max_timeout = 15000,
1189 .mode_ctrl = PWM_GEN_MODE,
1190 .pwm_fd = {
1191 .pwm_div = 256,
1192 },
1193 .is_erm = false,
1194 .smart_en = true,
1195 .ext_clk_en = true,
1196 .chip_en = 1,
1197 .regulator_info = isa1200_reg_data,
1198 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1199};
1200
1201static struct i2c_board_info isa1200_board_info[] __initdata = {
1202 {
1203 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1204 .platform_data = &isa1200_1_pdata,
1205 },
1206};
Jing Lin21ed4de2012-02-05 15:53:28 -08001207/* configuration data for mxt1386e using V2.1 firmware */
1208static const u8 mxt1386e_config_data_v2_1[] = {
1209 /* T6 Object */
1210 0, 0, 0, 0, 0, 0,
1211 /* T38 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001212 14, 1, 0, 22, 2, 12, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001213 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1214 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1215 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1216 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1217 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1218 0, 0, 0, 0,
1219 /* T7 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001220 100, 10, 50,
Jing Lin21ed4de2012-02-05 15:53:28 -08001221 /* T8 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001222 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001223 /* T9 Object */
1224 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
1225 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
Jing Linf1208fd2012-02-23 11:15:42 -08001226 85, 5, 0, 5, 9, 5, 12, 35, 70, 40,
1227 20, 5, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001228 /* T18 Object */
1229 0, 0,
1230 /* T24 Object */
1231 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1232 0, 0, 0, 0, 0, 0, 0, 0, 0,
1233 /* T25 Object */
1234 3, 0, 60, 115, 156, 99,
1235 /* T27 Object */
1236 0, 0, 0, 0, 0, 0, 0,
1237 /* T40 Object */
1238 0, 0, 0, 0, 0,
1239 /* T42 Object */
1240 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
1241 /* T43 Object */
1242 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
1243 16,
1244 /* T46 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001245 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001246 /* T47 Object */
1247 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
1248 /* T48 Object */
1249 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001250 32, 40, 0, 10, 10, 0, 0, 100, 10, 90,
1251 0, 0, 0, 0, 0, 0, 0, 10, 1, 10,
1252 52, 10, 12, 0, 33, 0, 1, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001253 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1254 0, 0, 0, 0,
1255 /* T56 Object */
1256 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1257 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1258 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1259 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001260 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1261 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001262};
1263
1264#define MXT_TS_GPIO_IRQ 6
1265#define MXT_TS_PWR_EN_GPIO PM8921_GPIO_PM_TO_SYS(23)
1266#define MXT_TS_RESET_GPIO 33
1267
1268static struct mxt_config_info mxt_config_array[] = {
1269 {
1270 .config = mxt1386e_config_data_v2_1,
1271 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1272 .family_id = 0xA0,
1273 .variant_id = 0x7,
1274 .version = 0x21,
1275 .build = 0xAA,
Jing Linef4aa9b2012-03-26 12:01:41 -07001276 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
1277 .fw_name = "atmel_8064_liquid_v2_2_AA.hex",
1278 },
1279 {
1280 /* The config data for V2.2.AA is the same as for V2.1.AA */
1281 .config = mxt1386e_config_data_v2_1,
1282 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1283 .family_id = 0xA0,
1284 .variant_id = 0x7,
1285 .version = 0x22,
1286 .build = 0xAA,
1287 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin21ed4de2012-02-05 15:53:28 -08001288 },
1289};
1290
1291static struct mxt_platform_data mxt_platform_data = {
1292 .config_array = mxt_config_array,
1293 .config_array_size = ARRAY_SIZE(mxt_config_array),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08001294 .panel_minx = 0,
1295 .panel_maxx = 1365,
1296 .panel_miny = 0,
1297 .panel_maxy = 767,
1298 .disp_minx = 0,
1299 .disp_maxx = 1365,
1300 .disp_miny = 0,
1301 .disp_maxy = 767,
Anirudh Ghayal39dbe3f2012-04-13 15:43:16 +05301302 .irqflags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
Jing Lin21ed4de2012-02-05 15:53:28 -08001303 .i2c_pull_up = true,
1304 .reset_gpio = MXT_TS_RESET_GPIO,
1305 .irq_gpio = MXT_TS_GPIO_IRQ,
1306};
1307
1308static struct i2c_board_info mxt_device_info[] __initdata = {
1309 {
1310 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
1311 .platform_data = &mxt_platform_data,
1312 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1313 },
1314};
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001315#define CYTTSP_TS_GPIO_IRQ 6
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001316#define CYTTSP_TS_GPIO_SLEEP 33
1317
1318static ssize_t tma340_vkeys_show(struct kobject *kobj,
1319 struct kobj_attribute *attr, char *buf)
1320{
1321 return snprintf(buf, 200,
1322 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1323 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1324 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1325 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1326 "\n");
1327}
1328
1329static struct kobj_attribute tma340_vkeys_attr = {
1330 .attr = {
1331 .mode = S_IRUGO,
1332 },
1333 .show = &tma340_vkeys_show,
1334};
1335
1336static struct attribute *tma340_properties_attrs[] = {
1337 &tma340_vkeys_attr.attr,
1338 NULL
1339};
1340
1341static struct attribute_group tma340_properties_attr_group = {
1342 .attrs = tma340_properties_attrs,
1343};
1344
1345static int cyttsp_platform_init(struct i2c_client *client)
1346{
1347 int rc = 0;
1348 static struct kobject *tma340_properties_kobj;
1349
1350 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1351 tma340_properties_kobj = kobject_create_and_add("board_properties",
1352 NULL);
1353 if (tma340_properties_kobj)
1354 rc = sysfs_create_group(tma340_properties_kobj,
1355 &tma340_properties_attr_group);
1356 if (!tma340_properties_kobj || rc)
1357 pr_err("%s: failed to create board_properties\n",
1358 __func__);
1359
1360 return 0;
1361}
1362
1363static struct cyttsp_regulator cyttsp_regulator_data[] = {
1364 {
1365 .name = "vdd",
1366 .min_uV = CY_TMA300_VTG_MIN_UV,
1367 .max_uV = CY_TMA300_VTG_MAX_UV,
1368 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1369 .lpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1370 },
1371 {
1372 .name = "vcc_i2c",
1373 .min_uV = CY_I2C_VTG_MIN_UV,
1374 .max_uV = CY_I2C_VTG_MAX_UV,
1375 .hpm_load_uA = CY_I2C_CURR_UA,
1376 .lpm_load_uA = CY_I2C_CURR_UA,
1377 },
1378};
1379
1380static struct cyttsp_platform_data cyttsp_pdata = {
1381 .panel_maxx = 634,
1382 .panel_maxy = 1166,
1383 .disp_maxx = 599,
1384 .disp_maxy = 1023,
1385 .disp_minx = 0,
1386 .disp_miny = 0,
1387 .flags = 0x01,
1388 .gen = CY_GEN3,
1389 .use_st = CY_USE_ST,
1390 .use_mt = CY_USE_MT,
1391 .use_hndshk = CY_SEND_HNDSHK,
1392 .use_trk_id = CY_USE_TRACKING_ID,
1393 .use_sleep = CY_USE_DEEP_SLEEP_SEL,
1394 .use_gestures = CY_USE_GESTURES,
1395 .fw_fname = "cyttsp_8064_mtp.hex",
1396 /* change act_intrvl to customize the Active power state
1397 * scanning/processing refresh interval for Operating mode
1398 */
1399 .act_intrvl = CY_ACT_INTRVL_DFLT,
1400 /* change tch_tmout to customize the touch timeout for the
1401 * Active power state for Operating mode
1402 */
1403 .tch_tmout = CY_TCH_TMOUT_DFLT,
1404 /* change lp_intrvl to customize the Low Power power state
1405 * scanning/processing refresh interval for Operating mode
1406 */
1407 .lp_intrvl = CY_LP_INTRVL_DFLT,
1408 .sleep_gpio = CYTTSP_TS_GPIO_SLEEP,
Amy Maloche9ba3ffe2012-04-26 10:31:20 -07001409 .resout_gpio = -1,
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001410 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1411 .regulator_info = cyttsp_regulator_data,
1412 .num_regulators = ARRAY_SIZE(cyttsp_regulator_data),
1413 .init = cyttsp_platform_init,
1414 .correct_fw_ver = 17,
1415};
1416
1417static struct i2c_board_info cyttsp_info[] __initdata = {
1418 {
1419 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1420 .platform_data = &cyttsp_pdata,
1421 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1422 },
1423};
Jing Lin21ed4de2012-02-05 15:53:28 -08001424
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001425#define MSM_WCNSS_PHYS 0x03000000
1426#define MSM_WCNSS_SIZE 0x280000
1427
1428static struct resource resources_wcnss_wlan[] = {
1429 {
1430 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1431 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1432 .name = "wcnss_wlanrx_irq",
1433 .flags = IORESOURCE_IRQ,
1434 },
1435 {
1436 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1437 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1438 .name = "wcnss_wlantx_irq",
1439 .flags = IORESOURCE_IRQ,
1440 },
1441 {
1442 .start = MSM_WCNSS_PHYS,
1443 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1444 .name = "wcnss_mmio",
1445 .flags = IORESOURCE_MEM,
1446 },
1447 {
1448 .start = 64,
1449 .end = 68,
1450 .name = "wcnss_gpios_5wire",
1451 .flags = IORESOURCE_IO,
1452 },
1453};
1454
1455static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1456 .has_48mhz_xo = 1,
1457};
1458
1459static struct platform_device msm_device_wcnss_wlan = {
1460 .name = "wcnss_wlan",
1461 .id = 0,
1462 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1463 .resource = resources_wcnss_wlan,
1464 .dev = {.platform_data = &qcom_wcnss_pdata},
1465};
1466
Ankit Vermab7c26e62012-02-28 15:04:15 -08001467static struct platform_device msm_device_iris_fm __devinitdata = {
1468 .name = "iris_fm",
1469 .id = -1,
1470};
1471
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001472#ifdef CONFIG_QSEECOM
1473/* qseecom bus scaling */
1474static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
1475 {
1476 .src = MSM_BUS_MASTER_SPS,
1477 .dst = MSM_BUS_SLAVE_EBI_CH0,
1478 .ib = 0,
1479 .ab = 0,
1480 },
1481 {
1482 .src = MSM_BUS_MASTER_SPDM,
1483 .dst = MSM_BUS_SLAVE_SPDM,
1484 .ib = 0,
1485 .ab = 0,
1486 },
1487};
1488
1489static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
1490 {
1491 .src = MSM_BUS_MASTER_SPS,
1492 .dst = MSM_BUS_SLAVE_EBI_CH0,
1493 .ib = (492 * 8) * 1000000UL,
1494 .ab = (492 * 8) * 100000UL,
1495 },
1496 {
1497 .src = MSM_BUS_MASTER_SPDM,
1498 .dst = MSM_BUS_SLAVE_SPDM,
1499 .ib = 0,
1500 .ab = 0,
1501 },
1502};
1503
1504static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1505 {
1506 .src = MSM_BUS_MASTER_SPS,
1507 .dst = MSM_BUS_SLAVE_EBI_CH0,
1508 .ib = 0,
1509 .ab = 0,
1510 },
1511 {
1512 .src = MSM_BUS_MASTER_SPDM,
1513 .dst = MSM_BUS_SLAVE_SPDM,
1514 .ib = (64 * 8) * 1000000UL,
1515 .ab = (64 * 8) * 100000UL,
1516 },
1517};
1518
1519static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1520 {
1521 ARRAY_SIZE(qseecom_clks_init_vectors),
1522 qseecom_clks_init_vectors,
1523 },
1524 {
1525 ARRAY_SIZE(qseecom_enable_dfab_vectors),
1526 qseecom_enable_sfpb_vectors,
1527 },
1528 {
1529 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1530 qseecom_enable_sfpb_vectors,
1531 },
1532};
1533
1534static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1535 qseecom_hw_bus_scale_usecases,
1536 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1537 .name = "qsee",
1538};
1539
1540static struct platform_device qseecom_device = {
1541 .name = "qseecom",
1542 .id = 0,
1543 .dev = {
1544 .platform_data = &qseecom_bus_pdata,
1545 },
1546};
1547#endif
1548
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001549#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1550 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1551 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1552 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1553
1554#define QCE_SIZE 0x10000
1555#define QCE_0_BASE 0x11000000
1556
1557#define QCE_HW_KEY_SUPPORT 0
1558#define QCE_SHA_HMAC_SUPPORT 1
1559#define QCE_SHARE_CE_RESOURCE 3
1560#define QCE_CE_SHARED 0
1561
1562static struct resource qcrypto_resources[] = {
1563 [0] = {
1564 .start = QCE_0_BASE,
1565 .end = QCE_0_BASE + QCE_SIZE - 1,
1566 .flags = IORESOURCE_MEM,
1567 },
1568 [1] = {
1569 .name = "crypto_channels",
1570 .start = DMOV8064_CE_IN_CHAN,
1571 .end = DMOV8064_CE_OUT_CHAN,
1572 .flags = IORESOURCE_DMA,
1573 },
1574 [2] = {
1575 .name = "crypto_crci_in",
1576 .start = DMOV8064_CE_IN_CRCI,
1577 .end = DMOV8064_CE_IN_CRCI,
1578 .flags = IORESOURCE_DMA,
1579 },
1580 [3] = {
1581 .name = "crypto_crci_out",
1582 .start = DMOV8064_CE_OUT_CRCI,
1583 .end = DMOV8064_CE_OUT_CRCI,
1584 .flags = IORESOURCE_DMA,
1585 },
1586};
1587
1588static struct resource qcedev_resources[] = {
1589 [0] = {
1590 .start = QCE_0_BASE,
1591 .end = QCE_0_BASE + QCE_SIZE - 1,
1592 .flags = IORESOURCE_MEM,
1593 },
1594 [1] = {
1595 .name = "crypto_channels",
1596 .start = DMOV8064_CE_IN_CHAN,
1597 .end = DMOV8064_CE_OUT_CHAN,
1598 .flags = IORESOURCE_DMA,
1599 },
1600 [2] = {
1601 .name = "crypto_crci_in",
1602 .start = DMOV8064_CE_IN_CRCI,
1603 .end = DMOV8064_CE_IN_CRCI,
1604 .flags = IORESOURCE_DMA,
1605 },
1606 [3] = {
1607 .name = "crypto_crci_out",
1608 .start = DMOV8064_CE_OUT_CRCI,
1609 .end = DMOV8064_CE_OUT_CRCI,
1610 .flags = IORESOURCE_DMA,
1611 },
1612};
1613
1614#endif
1615
1616#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1617 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1618
1619static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1620 .ce_shared = QCE_CE_SHARED,
1621 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1622 .hw_key_support = QCE_HW_KEY_SUPPORT,
1623 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001624 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001625};
1626
1627static struct platform_device qcrypto_device = {
1628 .name = "qcrypto",
1629 .id = 0,
1630 .num_resources = ARRAY_SIZE(qcrypto_resources),
1631 .resource = qcrypto_resources,
1632 .dev = {
1633 .coherent_dma_mask = DMA_BIT_MASK(32),
1634 .platform_data = &qcrypto_ce_hw_suppport,
1635 },
1636};
1637#endif
1638
1639#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1640 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1641
1642static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1643 .ce_shared = QCE_CE_SHARED,
1644 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1645 .hw_key_support = QCE_HW_KEY_SUPPORT,
1646 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001647 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001648};
1649
1650static struct platform_device qcedev_device = {
1651 .name = "qce",
1652 .id = 0,
1653 .num_resources = ARRAY_SIZE(qcedev_resources),
1654 .resource = qcedev_resources,
1655 .dev = {
1656 .coherent_dma_mask = DMA_BIT_MASK(32),
1657 .platform_data = &qcedev_ce_hw_suppport,
1658 },
1659};
1660#endif
1661
Joel Kingdacbc822012-01-25 13:30:57 -08001662static struct mdm_platform_data mdm_platform_data = {
1663 .mdm_version = "3.0",
1664 .ramdump_delay_ms = 2000,
Hemant Kumara945b472012-01-25 15:08:06 -08001665 .peripheral_platform_device = &apq8064_device_hsic_host,
Joel Kingdacbc822012-01-25 13:30:57 -08001666};
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001667
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001668static struct tsens_platform_data apq_tsens_pdata = {
1669 .tsens_factor = 1000,
1670 .hw_type = APQ_8064,
1671 .tsens_num_sensor = 11,
1672 .slope = {1176, 1176, 1154, 1176, 1111,
1673 1132, 1132, 1199, 1132, 1199, 1132},
1674};
1675
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07001676static struct platform_device msm_tsens_device = {
1677 .name = "tsens8960-tm",
1678 .id = -1,
1679};
1680
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001681#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001682static void __init apq8064_map_io(void)
1683{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001684 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001685 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001686 if (socinfo_init() < 0)
1687 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001688}
1689
1690static void __init apq8064_init_irq(void)
1691{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001692 struct msm_mpm_device_data *data = NULL;
1693
1694#ifdef CONFIG_MSM_MPM
1695 data = &apq8064_mpm_dev_data;
1696#endif
1697
1698 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001699 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1700 (void *)MSM_QGIC_CPU_BASE);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001701}
1702
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001703static struct platform_device msm8064_device_saw_regulator_core0 = {
1704 .name = "saw-regulator",
1705 .id = 0,
1706 .dev = {
1707 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
1708 },
1709};
1710
1711static struct platform_device msm8064_device_saw_regulator_core1 = {
1712 .name = "saw-regulator",
1713 .id = 1,
1714 .dev = {
1715 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
1716 },
1717};
1718
1719static struct platform_device msm8064_device_saw_regulator_core2 = {
1720 .name = "saw-regulator",
1721 .id = 2,
1722 .dev = {
1723 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
1724 },
1725};
1726
1727static struct platform_device msm8064_device_saw_regulator_core3 = {
1728 .name = "saw-regulator",
1729 .id = 3,
1730 .dev = {
1731 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001732
1733 },
1734};
1735
Oluwafemi Adeyemif5a31422012-03-08 16:58:45 -08001736static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001737 {
1738 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1739 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1740 true,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001741 100, 650, 801, 200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001742 },
1743
1744 {
1745 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1746 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1747 true,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001748 2000, 200, 576000, 2000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001749 },
1750
1751 {
1752 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1753 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1754 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001755 8500, 51, 1122000, 8500,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001756 },
1757
1758 {
1759 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1760 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
1761 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001762 9000, 51, 1130300, 9000,
1763 },
1764 {
1765 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1766 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
1767 false,
1768 10000, 51, 1130300, 10000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001769 },
1770
1771 {
1772 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1773 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1774 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001775 12000, 14, 2205900, 12000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001776 },
1777
1778 {
1779 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1780 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1781 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001782 18000, 12, 2364250, 18000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001783 },
1784
1785 {
1786 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1787 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1788 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001789 23500, 10, 2667000, 23500,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001790 },
1791
1792 {
1793 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1794 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1795 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001796 29700, 5, 2867000, 30000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001797 },
1798};
1799
1800static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1801 .mode = MSM_PM_BOOT_CONFIG_TZ,
1802};
1803
1804static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
1805 .levels = &msm_rpmrs_levels[0],
1806 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
1807 .vdd_mem_levels = {
1808 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
1809 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
1810 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
1811 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
1812 },
1813 .vdd_dig_levels = {
1814 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
1815 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
1816 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
1817 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
1818 },
1819 .vdd_mask = 0x7FFFFF,
1820 .rpmrs_target_id = {
1821 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
1822 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
1823 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
1824 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
1825 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
1826 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
1827 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
1828 },
1829};
1830
Praveen Chidambaram78499012011-11-01 17:15:17 -06001831static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1832 0x03, 0x0f,
1833};
1834
1835static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1836 0x00, 0x24, 0x54, 0x10,
1837 0x09, 0x03, 0x01,
1838 0x10, 0x54, 0x30, 0x0C,
1839 0x24, 0x30, 0x0f,
1840};
1841
1842static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1843 0x00, 0x24, 0x54, 0x10,
1844 0x09, 0x07, 0x01, 0x0B,
1845 0x10, 0x54, 0x30, 0x0C,
1846 0x24, 0x30, 0x0f,
1847};
1848
1849static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1850 [0] = {
1851 .mode = MSM_SPM_MODE_CLOCK_GATING,
1852 .notify_rpm = false,
1853 .cmd = spm_wfi_cmd_sequence,
1854 },
1855 [1] = {
1856 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1857 .notify_rpm = false,
1858 .cmd = spm_power_collapse_without_rpm,
1859 },
1860 [2] = {
1861 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1862 .notify_rpm = true,
1863 .cmd = spm_power_collapse_with_rpm,
1864 },
1865};
1866
1867static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1868 0x00, 0x20, 0x03, 0x20,
1869 0x00, 0x0f,
1870};
1871
1872static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1873 0x00, 0x20, 0x34, 0x64,
1874 0x48, 0x07, 0x48, 0x20,
1875 0x50, 0x64, 0x04, 0x34,
1876 0x50, 0x0f,
1877};
1878static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1879 0x00, 0x10, 0x34, 0x64,
1880 0x48, 0x07, 0x48, 0x10,
1881 0x50, 0x64, 0x04, 0x34,
1882 0x50, 0x0F,
1883};
1884
1885static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1886 [0] = {
1887 .mode = MSM_SPM_L2_MODE_RETENTION,
1888 .notify_rpm = false,
1889 .cmd = l2_spm_wfi_cmd_sequence,
1890 },
1891 [1] = {
1892 .mode = MSM_SPM_L2_MODE_GDHS,
1893 .notify_rpm = true,
1894 .cmd = l2_spm_gdhs_cmd_sequence,
1895 },
1896 [2] = {
1897 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1898 .notify_rpm = true,
1899 .cmd = l2_spm_power_off_cmd_sequence,
1900 },
1901};
1902
1903
1904static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1905 [0] = {
1906 .reg_base_addr = MSM_SAW_L2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001907 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001908 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001909 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1910 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1911 .modes = msm_spm_l2_seq_list,
1912 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1913 },
1914};
1915
1916static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1917 [0] = {
1918 .reg_base_addr = MSM_SAW0_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001919 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001920#if defined(CONFIG_MSM_AVS_HW)
1921 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1922 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1923#endif
1924 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001925 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001926 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1927 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1928 .vctl_timeout_us = 50,
1929 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1930 .modes = msm_spm_seq_list,
1931 },
1932 [1] = {
1933 .reg_base_addr = MSM_SAW1_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001934 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001935#if defined(CONFIG_MSM_AVS_HW)
1936 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1937 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1938#endif
1939 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001940 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001941 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1942 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1943 .vctl_timeout_us = 50,
1944 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1945 .modes = msm_spm_seq_list,
1946 },
1947 [2] = {
1948 .reg_base_addr = MSM_SAW2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001949 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001950#if defined(CONFIG_MSM_AVS_HW)
1951 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1952 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1953#endif
1954 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001955 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001956 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1957 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1958 .vctl_timeout_us = 50,
1959 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1960 .modes = msm_spm_seq_list,
1961 },
1962 [3] = {
1963 .reg_base_addr = MSM_SAW3_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001964 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001965#if defined(CONFIG_MSM_AVS_HW)
1966 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1967 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1968#endif
1969 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001970 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001971 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1972 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1973 .vctl_timeout_us = 50,
1974 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1975 .modes = msm_spm_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001976 },
1977};
1978
Praveen Chidambaram4d19be42012-04-03 18:05:52 -06001979static struct msm_pm_sleep_status_data msm_pm_slp_sts_data = {
1980 .base_addr = MSM_ACC0_BASE + 0x08,
1981 .cpu_offset = MSM_ACC1_BASE - MSM_ACC0_BASE,
1982 .mask = 1UL << 13,
1983};
1984
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001985static void __init apq8064_init_buses(void)
1986{
1987 msm_bus_rpm_set_mt_mask();
1988 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
1989 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
1990 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
1991 msm_bus_8064_apps_fabric.dev.platform_data =
1992 &msm_bus_8064_apps_fabric_pdata;
1993 msm_bus_8064_sys_fabric.dev.platform_data =
1994 &msm_bus_8064_sys_fabric_pdata;
1995 msm_bus_8064_mm_fabric.dev.platform_data =
1996 &msm_bus_8064_mm_fabric_pdata;
1997 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
1998 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
1999}
2000
David Collinsf0d00732012-01-25 15:46:50 -08002001static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
2002 .name = GPIO_REGULATOR_DEV_NAME,
2003 .id = PM8921_MPP_PM_TO_SYS(7),
2004 .dev = {
2005 .platform_data
2006 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2007 },
2008};
2009
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08002010static struct platform_device apq8064_device_ext_mpp8_vreg __devinitdata = {
2011 .name = GPIO_REGULATOR_DEV_NAME,
2012 .id = PM8921_MPP_PM_TO_SYS(8),
2013 .dev = {
2014 .platform_data
2015 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_MPP8],
2016 },
2017};
2018
David Collinsf0d00732012-01-25 15:46:50 -08002019static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
2020 .name = GPIO_REGULATOR_DEV_NAME,
2021 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
2022 .dev = {
2023 .platform_data =
2024 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2025 },
2026};
2027
David Collins390fc332012-02-07 14:38:16 -08002028static struct platform_device apq8064_device_ext_ts_sw_vreg __devinitdata = {
2029 .name = GPIO_REGULATOR_DEV_NAME,
2030 .id = PM8921_GPIO_PM_TO_SYS(23),
2031 .dev = {
2032 .platform_data
2033 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_TS_SW],
2034 },
2035};
2036
David Collins2782b5c2012-02-06 10:02:42 -08002037static struct platform_device apq8064_device_rpm_regulator __devinitdata = {
2038 .name = "rpm-regulator",
2039 .id = -1,
2040 .dev = {
2041 .platform_data = &apq8064_rpm_regulator_pdata,
2042 },
2043};
2044
Ravi Kumar V05931a22012-04-04 17:09:37 +05302045static struct gpio_ir_recv_platform_data gpio_ir_recv_pdata = {
2046 .gpio_nr = 88,
2047 .active_low = 1,
2048};
2049
2050static struct platform_device gpio_ir_recv_pdev = {
2051 .name = "gpio-rc-recv",
2052 .dev = {
2053 .platform_data = &gpio_ir_recv_pdata,
2054 },
2055};
2056
Terence Hampson36b70722012-05-10 13:18:16 -04002057static struct platform_device *common_not_mpq_devices[] __initdata = {
David Keitel3c40fc52012-02-09 17:53:52 -08002058 &apq8064_device_qup_i2c_gsbi1,
Jing Lin04601f92012-02-05 15:36:07 -08002059 &apq8064_device_qup_i2c_gsbi3,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002060 &apq8064_device_qup_i2c_gsbi4,
Terence Hampson36b70722012-05-10 13:18:16 -04002061};
2062
2063static struct platform_device *common_devices[] __initdata = {
2064 &apq8064_device_dmov,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002065 &apq8064_device_qup_spi_gsbi5,
David Collinsf0d00732012-01-25 15:46:50 -08002066 &apq8064_device_ext_5v_vreg,
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08002067 &apq8064_device_ext_mpp8_vreg,
David Collinsf0d00732012-01-25 15:46:50 -08002068 &apq8064_device_ext_3p3v_vreg,
David Collins390fc332012-02-07 14:38:16 -08002069 &apq8064_device_ext_ts_sw_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07002070 &apq8064_device_ssbi_pmic1,
2071 &apq8064_device_ssbi_pmic2,
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06002072 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07002073 &apq8064_device_otg,
2074 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08002075 &apq8064_device_hsusb_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07002076 &android_usb_device,
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08002077 &msm_device_wcnss_wlan,
Ankit Vermab7c26e62012-02-28 15:04:15 -08002078 &msm_device_iris_fm,
Larry Bassel67b921d2012-04-06 10:23:27 -07002079 &apq8064_fmem_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08002080#ifdef CONFIG_ANDROID_PMEM
2081#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002082 &apq8064_android_pmem_device,
2083 &apq8064_android_pmem_adsp_device,
2084 &apq8064_android_pmem_audio_device,
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -07002085#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
2086#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -08002087#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002088 &apq8064_ion_dev,
Olav Haugan7c6aa742012-01-16 16:47:37 -08002089#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002090 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08002091 &msm8064_device_saw_regulator_core0,
2092 &msm8064_device_saw_regulator_core1,
2093 &msm8064_device_saw_regulator_core2,
2094 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002095#if defined(CONFIG_QSEECOM)
2096 &qseecom_device,
2097#endif
2098
Ramesh Masavarapu28311912011-10-27 11:04:12 -07002099#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2100 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2101 &qcrypto_device,
2102#endif
2103
2104#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2105 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2106 &qcedev_device,
2107#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07002108
2109#ifdef CONFIG_HW_RANDOM_MSM
2110 &apq8064_device_rng,
2111#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002112 &apq_pcm,
2113 &apq_pcm_routing,
2114 &apq_cpudai0,
2115 &apq_cpudai1,
Santosh Mardieff9a742012-04-09 23:23:39 +05302116 &mpq_cpudai_sec_i2s_rx,
Kuirong Wangf23f8c52012-03-31 12:34:51 -07002117 &mpq_cpudai_mi2s_tx,
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002118 &apq_cpudai_hdmi_rx,
2119 &apq_cpudai_bt_rx,
2120 &apq_cpudai_bt_tx,
2121 &apq_cpudai_fm_rx,
2122 &apq_cpudai_fm_tx,
2123 &apq_cpu_fe,
2124 &apq_stub_codec,
2125 &apq_voice,
2126 &apq_voip,
2127 &apq_lpa_pcm,
Krishnankutty Kolathappilly4374e332012-03-18 22:27:30 -07002128 &apq_compr_dsp,
2129 &apq_multi_ch_pcm,
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002130 &apq_pcm_hostless,
2131 &apq_cpudai_afe_01_rx,
2132 &apq_cpudai_afe_01_tx,
2133 &apq_cpudai_afe_02_rx,
2134 &apq_cpudai_afe_02_tx,
2135 &apq_pcm_afe,
2136 &apq_cpudai_auxpcm_rx,
2137 &apq_cpudai_auxpcm_tx,
Neema Shetty8427c262012-02-16 11:23:43 -08002138 &apq_cpudai_stub,
Neema Shetty3c9d2862012-03-11 01:25:32 -08002139 &apq_cpudai_slimbus_1_rx,
2140 &apq_cpudai_slimbus_1_tx,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002141 &apq_cpudai_slimbus_2_tx,
Neema Shettyc9d86c32012-05-09 12:01:39 -07002142 &apq_cpudai_slimbus_3_rx,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002143 &apq8064_rpm_device,
2144 &apq8064_rpm_log_device,
2145 &apq8064_rpm_stat_device,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002146 &msm_bus_8064_apps_fabric,
2147 &msm_bus_8064_sys_fabric,
2148 &msm_bus_8064_mm_fabric,
2149 &msm_bus_8064_sys_fpb,
2150 &msm_bus_8064_cpss_fpb,
Mohan Kumar Gubbihalli Lachma Naik7f72edd2012-02-06 17:26:47 -08002151 &apq8064_msm_device_vidc,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07002152 &msm_pil_dsps,
Matt Wagantalled832652012-02-02 19:23:17 -08002153 &msm_8960_riva,
Matt Wagantallb94b9a52012-02-02 21:59:54 -08002154 &msm_8960_q6_lpass,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002155 &msm_pil_vidc,
Matt Wagantall292aace2012-01-26 19:12:34 -08002156 &msm_gss,
Laura Abbottb93525f2012-04-12 09:57:19 -07002157 &apq8064_rtb_device,
Praveen Chidambaram8ea3dcd2011-12-07 14:46:31 -07002158 &apq8064_cpu_idle_device,
Praveen Chidambaram5c8adf22012-02-23 18:44:37 -07002159 &apq8064_msm_gov_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002160 &apq8064_device_cache_erp,
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002161 &epm_adc_device,
Pratik Patel212ab362012-03-16 12:30:07 -07002162 &apq8064_qdss_device,
2163 &msm_etb_device,
2164 &msm_tpiu_device,
2165 &msm_funnel_device,
2166 &apq8064_etm_device,
Helen Zeng8f925502012-03-05 16:50:17 -08002167 &apq_cpudai_slim_4_rx,
2168 &apq_cpudai_slim_4_tx,
Jignesh Mehta921649d2012-04-19 06:57:23 -07002169 &msm8960_gemini_device,
Laura Abbott0577d7b2012-04-17 11:14:30 -07002170 &apq8064_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002171 &msm_tsens_device,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002172};
2173
Joel King4e7ad222011-08-17 15:47:38 -07002174static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002175 &apq8064_device_uart_gsbi3,
Yan He06913ce2011-08-26 16:33:46 -07002176 &msm_device_sps_apq8064,
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002177};
2178
2179static struct platform_device *rumi3_devices[] __initdata = {
2180 &apq8064_device_uart_gsbi1,
Yan He435ed612011-11-23 17:34:59 -08002181 &msm_device_sps_apq8064,
Huaibin Yang4a084e32011-12-15 15:25:52 -08002182#ifdef CONFIG_MSM_ROTATOR
2183 &msm_rotator_device,
2184#endif
Joel King4e7ad222011-08-17 15:47:38 -07002185};
2186
Joel King82b7e3f2012-01-05 10:03:27 -08002187static struct platform_device *cdp_devices[] __initdata = {
2188 &apq8064_device_uart_gsbi1,
Jin Hong4bbbfba2012-02-02 21:48:07 -08002189 &apq8064_device_uart_gsbi7,
Joel King82b7e3f2012-01-05 10:03:27 -08002190 &msm_device_sps_apq8064,
Aravind Venkateswaran4ca27532012-02-16 14:27:05 -08002191#ifdef CONFIG_MSM_ROTATOR
2192 &msm_rotator_device,
2193#endif
Joel King82b7e3f2012-01-05 10:03:27 -08002194};
2195
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002196static struct platform_device
2197mpq8064_device_ext_5v_frc_vreg __devinitdata = {
2198 .name = GPIO_REGULATOR_DEV_NAME,
2199 .id = SX150X_GPIO(4, 10),
2200 .dev = {
2201 .platform_data =
2202 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_FRC_5V],
2203 },
2204};
2205
2206static struct platform_device
2207mpq8064_device_ext_1p2_buck_vreg __devinitdata = {
2208 .name = GPIO_REGULATOR_DEV_NAME,
2209 .id = SX150X_GPIO(4, 2),
2210 .dev = {
2211 .platform_data =
2212 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P2V],
2213 },
2214};
2215
2216static struct platform_device
2217mpq8064_device_ext_1p8_buck_vreg __devinitdata = {
2218 .name = GPIO_REGULATOR_DEV_NAME,
2219 .id = SX150X_GPIO(4, 4),
2220 .dev = {
2221 .platform_data =
2222 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P8V],
2223 },
2224};
2225
2226static struct platform_device
2227mpq8064_device_ext_2p2_buck_vreg __devinitdata = {
2228 .name = GPIO_REGULATOR_DEV_NAME,
2229 .id = SX150X_GPIO(4, 14),
2230 .dev = {
2231 .platform_data =
2232 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_2P2V],
2233 },
2234};
2235
2236static struct platform_device
2237mpq8064_device_ext_5v_buck_vreg __devinitdata = {
2238 .name = GPIO_REGULATOR_DEV_NAME,
2239 .id = SX150X_GPIO(4, 3),
2240 .dev = {
2241 .platform_data =
2242 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_5V],
2243 },
2244};
2245
2246static struct platform_device
2247mpq8064_device_ext_3p3v_ldo_vreg __devinitdata = {
2248 .name = GPIO_REGULATOR_DEV_NAME,
2249 .id = SX150X_GPIO(4, 15),
2250 .dev = {
2251 .platform_data =
2252 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_3P3V],
2253 },
2254};
2255
Ravi Kumar V1c903012012-05-15 16:11:35 +05302256static struct platform_device rc_input_loopback_pdev = {
2257 .name = "rc-user-input",
2258 .id = -1,
2259};
2260
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002261static struct platform_device *mpq_devices[] __initdata = {
2262 &msm_device_sps_apq8064,
2263 &mpq8064_device_qup_i2c_gsbi5,
2264#ifdef CONFIG_MSM_ROTATOR
2265 &msm_rotator_device,
2266#endif
Ravi Kumar V05931a22012-04-04 17:09:37 +05302267 &gpio_ir_recv_pdev,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002268 &mpq8064_device_ext_5v_frc_vreg,
2269 &mpq8064_device_ext_1p2_buck_vreg,
2270 &mpq8064_device_ext_1p8_buck_vreg,
2271 &mpq8064_device_ext_2p2_buck_vreg,
2272 &mpq8064_device_ext_5v_buck_vreg,
2273 &mpq8064_device_ext_3p3v_ldo_vreg,
Terence Hampson2e1705f2012-04-11 19:55:29 -04002274#ifdef CONFIG_MSM_VCAP
2275 &msm8064_device_vcap,
2276#endif
Ravi Kumar V1c903012012-05-15 16:11:35 +05302277 &rc_input_loopback_pdev,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002278};
2279
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002280static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002281 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002282};
2283
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002284#define KS8851_IRQ_GPIO 43
2285
2286static struct spi_board_info spi_board_info[] __initdata = {
2287 {
2288 .modalias = "ks8851",
2289 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2290 .max_speed_hz = 19200000,
2291 .bus_num = 0,
2292 .chip_select = 2,
2293 .mode = SPI_MODE_0,
2294 },
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002295 {
2296 .modalias = "epm_adc",
2297 .max_speed_hz = 1100000,
2298 .bus_num = 0,
2299 .chip_select = 3,
2300 .mode = SPI_MODE_0,
2301 },
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002302};
2303
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002304static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002305 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08002306 .bus_num = 1,
2307 .slim_slave = &apq8064_slim_tabla,
2308 },
2309 {
2310 .bus_num = 1,
2311 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002312 },
2313 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002314};
2315
David Keitel3c40fc52012-02-09 17:53:52 -08002316static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi1_pdata = {
2317 .clk_freq = 100000,
2318 .src_clk_rate = 24000000,
2319};
2320
Jing Lin04601f92012-02-05 15:36:07 -08002321static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi3_pdata = {
Anirudh Ghayalc2163472012-04-10 14:58:14 +05302322 .clk_freq = 384000,
Jing Lin04601f92012-02-05 15:36:07 -08002323 .src_clk_rate = 24000000,
2324};
2325
Kenneth Heitke748593a2011-07-15 15:45:11 -06002326static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
2327 .clk_freq = 100000,
2328 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002329};
2330
Joel King8f839b92012-04-01 14:37:46 -07002331static struct msm_i2c_platform_data mpq8064_i2c_qup_gsbi5_pdata = {
2332 .clk_freq = 100000,
2333 .src_clk_rate = 24000000,
2334};
2335
David Keitel3c40fc52012-02-09 17:53:52 -08002336#define GSBI_DUAL_MODE_CODE 0x60
2337#define MSM_GSBI1_PHYS 0x12440000
Kenneth Heitke748593a2011-07-15 15:45:11 -06002338static void __init apq8064_i2c_init(void)
2339{
David Keitel3c40fc52012-02-09 17:53:52 -08002340 void __iomem *gsbi_mem;
2341
2342 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2343 &apq8064_i2c_qup_gsbi1_pdata;
2344 gsbi_mem = ioremap_nocache(MSM_GSBI1_PHYS, 4);
2345 writel_relaxed(GSBI_DUAL_MODE_CODE, gsbi_mem);
2346 /* Ensure protocol code is written before proceeding */
2347 wmb();
2348 iounmap(gsbi_mem);
2349 apq8064_i2c_qup_gsbi1_pdata.use_gsbi_shared_mode = 1;
Jing Lin04601f92012-02-05 15:36:07 -08002350 apq8064_device_qup_i2c_gsbi3.dev.platform_data =
2351 &apq8064_i2c_qup_gsbi3_pdata;
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002352 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2353 &apq8064_i2c_qup_gsbi1_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002354 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
2355 &apq8064_i2c_qup_gsbi4_pdata;
Joel King8f839b92012-04-01 14:37:46 -07002356 mpq8064_device_qup_i2c_gsbi5.dev.platform_data =
2357 &mpq8064_i2c_qup_gsbi5_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002358}
2359
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002360#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002361static int ethernet_init(void)
2362{
2363 int ret;
2364 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
2365 if (ret) {
2366 pr_err("ks8851 gpio_request failed: %d\n", ret);
2367 goto fail;
2368 }
2369
2370 return 0;
2371fail:
2372 return ret;
2373}
2374#else
2375static int ethernet_init(void)
2376{
2377 return 0;
2378}
2379#endif
2380
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302381#define GPIO_KEY_HOME PM8921_GPIO_PM_TO_SYS(27)
2382#define GPIO_KEY_VOLUME_UP PM8921_GPIO_PM_TO_SYS(35)
2383#define GPIO_KEY_VOLUME_DOWN PM8921_GPIO_PM_TO_SYS(38)
2384#define GPIO_KEY_CAM_FOCUS PM8921_GPIO_PM_TO_SYS(3)
2385#define GPIO_KEY_CAM_SNAP PM8921_GPIO_PM_TO_SYS(4)
Jing Lin3f8f8422012-03-05 09:32:11 -08002386#define GPIO_KEY_ROTATION PM8921_GPIO_PM_TO_SYS(42)
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302387
2388static struct gpio_keys_button cdp_keys[] = {
2389 {
2390 .code = KEY_HOME,
2391 .gpio = GPIO_KEY_HOME,
2392 .desc = "home_key",
2393 .active_low = 1,
2394 .type = EV_KEY,
2395 .wakeup = 1,
2396 .debounce_interval = 15,
2397 },
2398 {
2399 .code = KEY_VOLUMEUP,
2400 .gpio = GPIO_KEY_VOLUME_UP,
2401 .desc = "volume_up_key",
2402 .active_low = 1,
2403 .type = EV_KEY,
2404 .wakeup = 1,
2405 .debounce_interval = 15,
2406 },
2407 {
2408 .code = KEY_VOLUMEDOWN,
2409 .gpio = GPIO_KEY_VOLUME_DOWN,
2410 .desc = "volume_down_key",
2411 .active_low = 1,
2412 .type = EV_KEY,
2413 .wakeup = 1,
2414 .debounce_interval = 15,
2415 },
2416 {
2417 .code = SW_ROTATE_LOCK,
2418 .gpio = GPIO_KEY_ROTATION,
2419 .desc = "rotate_key",
2420 .active_low = 1,
2421 .type = EV_SW,
2422 .debounce_interval = 15,
2423 },
2424};
2425
2426static struct gpio_keys_platform_data cdp_keys_data = {
2427 .buttons = cdp_keys,
2428 .nbuttons = ARRAY_SIZE(cdp_keys),
2429};
2430
2431static struct platform_device cdp_kp_pdev = {
2432 .name = "gpio-keys",
2433 .id = -1,
2434 .dev = {
2435 .platform_data = &cdp_keys_data,
2436 },
2437};
2438
2439static struct gpio_keys_button mtp_keys[] = {
2440 {
2441 .code = KEY_CAMERA_FOCUS,
2442 .gpio = GPIO_KEY_CAM_FOCUS,
2443 .desc = "cam_focus_key",
2444 .active_low = 1,
2445 .type = EV_KEY,
2446 .wakeup = 1,
2447 .debounce_interval = 15,
2448 },
2449 {
2450 .code = KEY_VOLUMEUP,
2451 .gpio = GPIO_KEY_VOLUME_UP,
2452 .desc = "volume_up_key",
2453 .active_low = 1,
2454 .type = EV_KEY,
2455 .wakeup = 1,
2456 .debounce_interval = 15,
2457 },
2458 {
2459 .code = KEY_VOLUMEDOWN,
2460 .gpio = GPIO_KEY_VOLUME_DOWN,
2461 .desc = "volume_down_key",
2462 .active_low = 1,
2463 .type = EV_KEY,
2464 .wakeup = 1,
2465 .debounce_interval = 15,
2466 },
2467 {
2468 .code = KEY_CAMERA_SNAPSHOT,
2469 .gpio = GPIO_KEY_CAM_SNAP,
2470 .desc = "cam_snap_key",
2471 .active_low = 1,
2472 .type = EV_KEY,
2473 .debounce_interval = 15,
2474 },
2475};
2476
2477static struct gpio_keys_platform_data mtp_keys_data = {
2478 .buttons = mtp_keys,
2479 .nbuttons = ARRAY_SIZE(mtp_keys),
2480};
2481
2482static struct platform_device mtp_kp_pdev = {
2483 .name = "gpio-keys",
2484 .id = -1,
2485 .dev = {
2486 .platform_data = &mtp_keys_data,
2487 },
2488};
2489
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05302490static struct gpio_keys_button mpq_keys[] = {
2491 {
2492 .code = KEY_VOLUMEDOWN,
2493 .gpio = GPIO_KEY_VOLUME_DOWN,
2494 .desc = "volume_down_key",
2495 .active_low = 1,
2496 .type = EV_KEY,
2497 .wakeup = 1,
2498 .debounce_interval = 15,
2499 },
2500 {
2501 .code = KEY_VOLUMEUP,
2502 .gpio = GPIO_KEY_VOLUME_UP,
2503 .desc = "volume_up_key",
2504 .active_low = 1,
2505 .type = EV_KEY,
2506 .wakeup = 1,
2507 .debounce_interval = 15,
2508 },
2509};
2510
2511static struct gpio_keys_platform_data mpq_keys_data = {
2512 .buttons = mpq_keys,
2513 .nbuttons = ARRAY_SIZE(mpq_keys),
2514};
2515
2516static struct platform_device mpq_gpio_keys_pdev = {
2517 .name = "gpio-keys",
2518 .id = -1,
2519 .dev = {
2520 .platform_data = &mpq_keys_data,
2521 },
2522};
2523
2524#define MPQ_KP_ROW_BASE SX150X_EXP2_GPIO_BASE
2525#define MPQ_KP_COL_BASE (SX150X_EXP2_GPIO_BASE + 4)
2526
2527static unsigned int mpq_row_gpios[] = {MPQ_KP_ROW_BASE, MPQ_KP_ROW_BASE + 1,
2528 MPQ_KP_ROW_BASE + 2, MPQ_KP_ROW_BASE + 3};
2529static unsigned int mpq_col_gpios[] = {MPQ_KP_COL_BASE, MPQ_KP_COL_BASE + 1,
2530 MPQ_KP_COL_BASE + 2};
2531
2532static const unsigned int mpq_keymap[] = {
2533 KEY(0, 0, KEY_UP),
2534 KEY(0, 1, KEY_ENTER),
2535 KEY(0, 2, KEY_3),
2536
2537 KEY(1, 0, KEY_DOWN),
2538 KEY(1, 1, KEY_EXIT),
2539 KEY(1, 2, KEY_4),
2540
2541 KEY(2, 0, KEY_LEFT),
2542 KEY(2, 1, KEY_1),
2543 KEY(2, 2, KEY_5),
2544
2545 KEY(3, 0, KEY_RIGHT),
2546 KEY(3, 1, KEY_2),
2547 KEY(3, 2, KEY_6),
2548};
2549
2550static struct matrix_keymap_data mpq_keymap_data = {
2551 .keymap_size = ARRAY_SIZE(mpq_keymap),
2552 .keymap = mpq_keymap,
2553};
2554
2555static struct matrix_keypad_platform_data mpq_keypad_data = {
2556 .keymap_data = &mpq_keymap_data,
2557 .row_gpios = mpq_row_gpios,
2558 .col_gpios = mpq_col_gpios,
2559 .num_row_gpios = ARRAY_SIZE(mpq_row_gpios),
2560 .num_col_gpios = ARRAY_SIZE(mpq_col_gpios),
2561 .col_scan_delay_us = 32000,
2562 .debounce_ms = 20,
2563 .wakeup = 1,
2564 .active_low = 1,
2565 .no_autorepeat = 1,
2566};
2567
2568static struct platform_device mpq_keypad_device = {
2569 .name = "matrix-keypad",
2570 .id = -1,
2571 .dev = {
2572 .platform_data = &mpq_keypad_data,
2573 },
2574};
2575
Jin Hongd3024e62012-02-09 16:13:32 -08002576/* Sensors DSPS platform data */
2577#define DSPS_PIL_GENERIC_NAME "dsps"
2578static void __init apq8064_init_dsps(void)
2579{
2580 struct msm_dsps_platform_data *pdata =
2581 msm_dsps_device_8064.dev.platform_data;
2582 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
2583 pdata->gpios = NULL;
2584 pdata->gpios_num = 0;
2585
2586 platform_device_register(&msm_dsps_device_8064);
2587}
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302588
Jing Lin417fa452012-02-05 14:31:06 -08002589#define I2C_SURF 1
2590#define I2C_FFA (1 << 1)
2591#define I2C_RUMI (1 << 2)
2592#define I2C_SIM (1 << 3)
2593#define I2C_LIQUID (1 << 4)
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002594#define I2C_MPQ_CDP BIT(5)
2595#define I2C_MPQ_HRD BIT(6)
2596#define I2C_MPQ_DTV BIT(7)
Jing Lin417fa452012-02-05 14:31:06 -08002597
2598struct i2c_registry {
2599 u8 machs;
2600 int bus;
2601 struct i2c_board_info *info;
2602 int len;
2603};
2604
2605static struct i2c_registry apq8064_i2c_devices[] __initdata = {
Jing Lin21ed4de2012-02-05 15:53:28 -08002606 {
David Keitel2f613d92012-02-15 11:29:16 -08002607 I2C_LIQUID,
2608 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
2609 smb349_charger_i2c_info,
2610 ARRAY_SIZE(smb349_charger_i2c_info)
2611 },
2612 {
Jing Lin21ed4de2012-02-05 15:53:28 -08002613 I2C_SURF | I2C_LIQUID,
2614 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
2615 mxt_device_info,
2616 ARRAY_SIZE(mxt_device_info),
2617 },
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08002618 {
2619 I2C_FFA,
2620 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
2621 cyttsp_info,
2622 ARRAY_SIZE(cyttsp_info),
2623 },
Amy Maloche70090f992012-02-16 16:35:26 -08002624 {
2625 I2C_FFA | I2C_LIQUID,
2626 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
2627 isa1200_board_info,
2628 ARRAY_SIZE(isa1200_board_info),
2629 },
Santosh Mardieff9a742012-04-09 23:23:39 +05302630 {
2631 I2C_MPQ_CDP,
2632 APQ_8064_GSBI5_QUP_I2C_BUS_ID,
2633 cs8427_device_info,
2634 ARRAY_SIZE(cs8427_device_info),
2635 },
Jing Lin417fa452012-02-05 14:31:06 -08002636};
2637
Jay Chokshi607f61b2012-04-25 18:21:21 -07002638#define SX150X_EXP1_INT_N PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9)
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05302639#define SX150X_EXP2_INT_N MSM_GPIO_TO_INT(81)
Jay Chokshi607f61b2012-04-25 18:21:21 -07002640
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002641struct sx150x_platform_data mpq8064_sx150x_pdata[] = {
2642 [SX150X_EXP1] = {
2643 .gpio_base = SX150X_EXP1_GPIO_BASE,
2644 .oscio_is_gpo = false,
2645 .io_pullup_ena = 0x0,
2646 .io_pulldn_ena = 0x0,
2647 .io_open_drain_ena = 0x0,
2648 .io_polarity = 0,
Jay Chokshi607f61b2012-04-25 18:21:21 -07002649 .irq_summary = SX150X_EXP1_INT_N,
2650 .irq_base = SX150X_EXP1_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002651 },
2652 [SX150X_EXP2] = {
2653 .gpio_base = SX150X_EXP2_GPIO_BASE,
2654 .oscio_is_gpo = false,
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05302655 .io_pullup_ena = 0x0f,
2656 .io_pulldn_ena = 0x70,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002657 .io_open_drain_ena = 0x0,
2658 .io_polarity = 0,
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05302659 .irq_summary = SX150X_EXP2_INT_N,
2660 .irq_base = SX150X_EXP2_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002661 },
2662 [SX150X_EXP3] = {
2663 .gpio_base = SX150X_EXP3_GPIO_BASE,
2664 .oscio_is_gpo = false,
2665 .io_pullup_ena = 0x0,
2666 .io_pulldn_ena = 0x0,
2667 .io_open_drain_ena = 0x0,
2668 .io_polarity = 0,
2669 .irq_summary = -1,
2670 },
2671 [SX150X_EXP4] = {
2672 .gpio_base = SX150X_EXP4_GPIO_BASE,
2673 .oscio_is_gpo = false,
2674 .io_pullup_ena = 0x0,
2675 .io_pulldn_ena = 0x0,
2676 .io_open_drain_ena = 0x0,
2677 .io_polarity = 0,
2678 .irq_summary = -1,
2679 },
2680};
2681
2682static struct i2c_board_info sx150x_gpio_exp_info[] = {
2683 {
2684 I2C_BOARD_INFO("sx1509q", 0x70),
2685 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP1],
2686 },
2687 {
2688 I2C_BOARD_INFO("sx1508q", 0x23),
2689 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP2],
2690 },
2691 {
2692 I2C_BOARD_INFO("sx1508q", 0x22),
2693 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP3],
2694 },
2695 {
2696 I2C_BOARD_INFO("sx1509q", 0x3E),
2697 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP4],
2698 },
2699};
2700
2701#define MPQ8064_I2C_GSBI5_BUS_ID 5
2702
2703static struct i2c_registry mpq8064_i2c_devices[] __initdata = {
2704 {
2705 I2C_MPQ_CDP,
2706 MPQ8064_I2C_GSBI5_BUS_ID,
2707 sx150x_gpio_exp_info,
2708 ARRAY_SIZE(sx150x_gpio_exp_info),
2709 },
2710};
2711
Jing Lin417fa452012-02-05 14:31:06 -08002712static void __init register_i2c_devices(void)
2713{
2714 u8 mach_mask = 0;
2715 int i;
2716
Kevin Chand07220e2012-02-13 15:52:22 -08002717#ifdef CONFIG_MSM_CAMERA
2718 struct i2c_registry apq8064_camera_i2c_devices = {
2719 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_RUMI,
2720 APQ_8064_GSBI4_QUP_I2C_BUS_ID,
2721 apq8064_camera_board_info.board_info,
2722 apq8064_camera_board_info.num_i2c_board_info,
2723 };
2724#endif
Jing Lin417fa452012-02-05 14:31:06 -08002725 /* Build the matching 'supported_machs' bitmask */
2726 if (machine_is_apq8064_cdp())
2727 mach_mask = I2C_SURF;
2728 else if (machine_is_apq8064_mtp())
2729 mach_mask = I2C_FFA;
2730 else if (machine_is_apq8064_liquid())
2731 mach_mask = I2C_LIQUID;
2732 else if (machine_is_apq8064_rumi3())
2733 mach_mask = I2C_RUMI;
2734 else if (machine_is_apq8064_sim())
2735 mach_mask = I2C_SIM;
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002736 else if (PLATFORM_IS_MPQ8064())
2737 mach_mask = I2C_MPQ_CDP;
Jing Lin417fa452012-02-05 14:31:06 -08002738 else
2739 pr_err("unmatched machine ID in register_i2c_devices\n");
2740
2741 /* Run the array and install devices as appropriate */
2742 for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) {
2743 if (apq8064_i2c_devices[i].machs & mach_mask)
2744 i2c_register_board_info(apq8064_i2c_devices[i].bus,
2745 apq8064_i2c_devices[i].info,
2746 apq8064_i2c_devices[i].len);
2747 }
Kevin Chand07220e2012-02-13 15:52:22 -08002748#ifdef CONFIG_MSM_CAMERA
2749 if (apq8064_camera_i2c_devices.machs & mach_mask)
2750 i2c_register_board_info(apq8064_camera_i2c_devices.bus,
2751 apq8064_camera_i2c_devices.info,
2752 apq8064_camera_i2c_devices.len);
2753#endif
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002754
2755 for (i = 0; i < ARRAY_SIZE(mpq8064_i2c_devices); ++i) {
2756 if (mpq8064_i2c_devices[i].machs & mach_mask)
2757 i2c_register_board_info(
2758 mpq8064_i2c_devices[i].bus,
2759 mpq8064_i2c_devices[i].info,
2760 mpq8064_i2c_devices[i].len);
2761 }
Jing Lin417fa452012-02-05 14:31:06 -08002762}
2763
Jay Chokshi994ff122012-03-27 15:43:48 -07002764static void enable_ddr3_regulator(void)
2765{
2766 static struct regulator *ext_ddr3;
2767
2768 /* Use MPP7 output state as a flag for PCDDR3 presence. */
2769 if (gpio_get_value_cansleep(PM8921_MPP_PM_TO_SYS(7)) > 0) {
2770 ext_ddr3 = regulator_get(NULL, "ext_ddr3");
2771 if (IS_ERR(ext_ddr3) || ext_ddr3 == NULL)
2772 pr_err("Could not get MPP7 regulator\n");
2773 else
2774 regulator_enable(ext_ddr3);
2775 }
2776}
2777
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002778static void enable_avc_i2c_bus(void)
2779{
2780 int avc_i2c_en_mpp = PM8921_MPP_PM_TO_SYS(8);
2781 int rc;
2782
2783 rc = gpio_request(avc_i2c_en_mpp, "avc_i2c_en");
2784 if (rc)
2785 pr_err("request for avc_i2c_en mpp failed,"
2786 "rc=%d\n", rc);
2787 else
2788 gpio_set_value_cansleep(avc_i2c_en_mpp, 1);
2789}
2790
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002791static void __init apq8064_common_init(void)
2792{
Joel King8f839b92012-04-01 14:37:46 -07002793 msm_tsens_early_init(&apq_tsens_pdata);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002794 if (socinfo_init() < 0)
2795 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06002796 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
2797 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
David Collins2782b5c2012-02-06 10:02:42 -08002798 regulator_suppress_info_printing();
2799 platform_device_register(&apq8064_device_rpm_regulator);
Stephen Boyd4d0d2582012-02-10 14:49:40 -08002800 if (msm_xo_init())
2801 pr_err("Failed to initialize XO votes\n");
Matt Wagantallc51e5602012-02-27 17:25:25 -08002802 msm_clock_init(&apq8064_clock_init_data);
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08002803 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06002804 apq8064_i2c_init();
Jing Lin417fa452012-02-05 14:31:06 -08002805 register_i2c_devices();
Kenneth Heitke36920d32011-07-20 16:44:30 -06002806
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002807 apq8064_device_qup_spi_gsbi5.dev.platform_data =
2808 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08002809 apq8064_init_pmic();
Hemant Kumar94e7da22012-02-03 16:52:29 -08002810 if (machine_is_apq8064_liquid())
2811 msm_otg_pdata.mhl_enable = true;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07002812
Ofir Cohen94213a72012-05-03 14:26:32 +03002813 android_usb_pdata.swfi_latency =
2814 msm_rpmrs_levels[0].latency_us;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07002815
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002816 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Manu Gautam91223e02011-11-08 15:27:22 +05302817 apq8064_ehci_host_init();
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002818 apq8064_init_buses();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002819 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Terence Hampson36b70722012-05-10 13:18:16 -04002820 if (!(machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
2821 machine_is_mpq8064_dtv()))
2822 platform_add_devices(common_not_mpq_devices,
2823 ARRAY_SIZE(common_not_mpq_devices));
Jay Chokshi994ff122012-03-27 15:43:48 -07002824 enable_ddr3_regulator();
Hemant Kumarf1ca9192012-02-07 18:59:33 -08002825 if (machine_is_apq8064_mtp()) {
2826 apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
2827 device_initialize(&apq8064_device_hsic_host.dev);
2828 }
Jay Chokshie8741282012-01-25 15:22:55 -08002829 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05302830 apq8064_init_mmc();
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08002831
2832 if (machine_is_apq8064_mtp()) {
2833 mdm_8064_device.dev.platform_data = &mdm_platform_data;
2834 platform_device_register(&mdm_8064_device);
2835 }
2836 platform_device_register(&apq8064_slim_ctrl);
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002837 slim_register_board_info(apq8064_slim_devices,
2838 ARRAY_SIZE(apq8064_slim_devices));
Jin Hongd3024e62012-02-09 16:13:32 -08002839 apq8064_init_dsps();
Praveen Chidambaram78499012011-11-01 17:15:17 -06002840 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Mahesh Sivasubramaniancbce1ec2012-01-24 10:32:44 -07002841 acpuclk_init(&acpuclk_8064_soc_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002842 msm_spm_l2_init(msm_spm_l2_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002843 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Praveen Chidambaram4d19be42012-04-03 18:05:52 -06002844 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002845 apq8064_epm_adc_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002846}
2847
Huaibin Yang4a084e32011-12-15 15:25:52 -08002848static void __init apq8064_allocate_memory_regions(void)
2849{
2850 apq8064_allocate_fb_region();
2851}
2852
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002853static void __init apq8064_sim_init(void)
2854{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002855 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
2856 &msm8064_device_watchdog.dev.platform_data;
2857
2858 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002859 apq8064_common_init();
Joel King4e7ad222011-08-17 15:47:38 -07002860 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
2861}
2862
2863static void __init apq8064_rumi3_init(void)
2864{
2865 apq8064_common_init();
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002866 ethernet_init();
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002867 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002868 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002869}
2870
Joel King82b7e3f2012-01-05 10:03:27 -08002871static void __init apq8064_cdp_init(void)
2872{
Hanumant Singh50440d42012-04-23 19:27:16 -07002873 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2874 pr_err("meminfo_init() failed!\n");
Joel King82b7e3f2012-01-05 10:03:27 -08002875 apq8064_common_init();
Joel King8f839b92012-04-01 14:37:46 -07002876 if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
2877 machine_is_mpq8064_dtv()) {
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002878 enable_avc_i2c_bus();
Joel King8f839b92012-04-01 14:37:46 -07002879 platform_add_devices(mpq_devices, ARRAY_SIZE(mpq_devices));
2880 } else {
2881 ethernet_init();
2882 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
2883 spi_register_board_info(spi_board_info,
2884 ARRAY_SIZE(spi_board_info));
2885 }
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002886 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07002887 apq8064_init_gpu();
Matt Wagantall1f65d9d2012-04-25 14:24:20 -07002888 platform_add_devices(apq8064_footswitch, apq8064_num_footswitch);
Kevin Chand07220e2012-02-13 15:52:22 -08002889 apq8064_init_cam();
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302890
2891 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
2892 platform_device_register(&cdp_kp_pdev);
2893
2894 if (machine_is_apq8064_mtp())
2895 platform_device_register(&mtp_kp_pdev);
Hanumant Singh50440d42012-04-23 19:27:16 -07002896
2897 change_memory_power = &apq8064_change_memory_power;
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05302898
2899 if (machine_is_mpq8064_cdp()) {
2900 platform_device_register(&mpq_gpio_keys_pdev);
2901 platform_device_register(&mpq_keypad_device);
2902 }
Joel King82b7e3f2012-01-05 10:03:27 -08002903}
2904
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002905MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
2906 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002907 .reserve = apq8064_reserve,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002908 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302909 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002910 .timer = &msm_timer,
2911 .init_machine = apq8064_sim_init,
2912MACHINE_END
2913
Joel King4e7ad222011-08-17 15:47:38 -07002914MACHINE_START(APQ8064_RUMI3, "QCT APQ8064 RUMI3")
2915 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002916 .reserve = apq8064_reserve,
Joel King4e7ad222011-08-17 15:47:38 -07002917 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302918 .handle_irq = gic_handle_irq,
Joel King4e7ad222011-08-17 15:47:38 -07002919 .timer = &msm_timer,
2920 .init_machine = apq8064_rumi3_init,
Huaibin Yang4a084e32011-12-15 15:25:52 -08002921 .init_early = apq8064_allocate_memory_regions,
Joel King4e7ad222011-08-17 15:47:38 -07002922MACHINE_END
2923
Joel King82b7e3f2012-01-05 10:03:27 -08002924MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
2925 .map_io = apq8064_map_io,
2926 .reserve = apq8064_reserve,
2927 .init_irq = apq8064_init_irq,
2928 .handle_irq = gic_handle_irq,
2929 .timer = &msm_timer,
2930 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002931 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07002932 .init_very_early = apq8064_early_reserve,
Joel King82b7e3f2012-01-05 10:03:27 -08002933MACHINE_END
2934
2935MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
2936 .map_io = apq8064_map_io,
2937 .reserve = apq8064_reserve,
2938 .init_irq = apq8064_init_irq,
2939 .handle_irq = gic_handle_irq,
2940 .timer = &msm_timer,
2941 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002942 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07002943 .init_very_early = apq8064_early_reserve,
Joel King82b7e3f2012-01-05 10:03:27 -08002944MACHINE_END
2945
2946MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
2947 .map_io = apq8064_map_io,
2948 .reserve = apq8064_reserve,
2949 .init_irq = apq8064_init_irq,
2950 .handle_irq = gic_handle_irq,
2951 .timer = &msm_timer,
2952 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002953 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07002954 .init_very_early = apq8064_early_reserve,
Joel King82b7e3f2012-01-05 10:03:27 -08002955MACHINE_END
2956
Joel King064bbf82012-04-01 13:23:39 -07002957MACHINE_START(MPQ8064_CDP, "QCT MPQ8064 CDP")
2958 .map_io = apq8064_map_io,
2959 .reserve = apq8064_reserve,
2960 .init_irq = apq8064_init_irq,
2961 .handle_irq = gic_handle_irq,
2962 .timer = &msm_timer,
2963 .init_machine = apq8064_cdp_init,
2964 .init_early = apq8064_allocate_memory_regions,
2965 .init_very_early = apq8064_early_reserve,
2966MACHINE_END
2967
Joel King11ca8202012-02-13 16:19:03 -08002968MACHINE_START(MPQ8064_HRD, "QCT MPQ8064 HRD")
2969 .map_io = apq8064_map_io,
2970 .reserve = apq8064_reserve,
2971 .init_irq = apq8064_init_irq,
2972 .handle_irq = gic_handle_irq,
2973 .timer = &msm_timer,
2974 .init_machine = apq8064_cdp_init,
Laura Abbott6988cef2012-03-15 14:27:13 -07002975 .init_very_early = apq8064_early_reserve,
Joel King11ca8202012-02-13 16:19:03 -08002976MACHINE_END
2977
2978MACHINE_START(MPQ8064_DTV, "QCT MPQ8064 DTV")
2979 .map_io = apq8064_map_io,
2980 .reserve = apq8064_reserve,
2981 .init_irq = apq8064_init_irq,
2982 .handle_irq = gic_handle_irq,
2983 .timer = &msm_timer,
2984 .init_machine = apq8064_cdp_init,
Laura Abbott6988cef2012-03-15 14:27:13 -07002985 .init_very_early = apq8064_early_reserve,
Joel King11ca8202012-02-13 16:19:03 -08002986MACHINE_END
2987