blob: 5b0b9c34a6ca77faf6abfcda0f0a209ba631ab11 [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>
Jing Lin21ed4de2012-02-05 15:53:28 -080030#include <linux/i2c/atmel_mxt_ts.h>
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -080031#include <linux/cyttsp.h>
Amy Maloche70090f992012-02-16 16:35:26 -080032#include <linux/i2c/isa1200.h>
Mohan Pallaka474b94b2012-01-25 12:59:58 +053033#include <linux/gpio_keys.h>
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -080034#include <linux/epm_adc.h>
Jay Chokshie7d8d4f2012-04-04 14:47:57 -070035#include <linux/i2c/sx150x.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070036#include <asm/mach-types.h>
37#include <asm/mach/arch.h>
38#include <asm/hardware/gic.h>
Sahitya Tummala3586ed92011-08-03 09:13:23 +053039#include <asm/mach/mmc.h>
Ankit Verma6b7e2ba2012-01-26 15:48:54 -080040#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070041
42#include <mach/board.h>
43#include <mach/msm_iomap.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080044#include <mach/ion.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070045#include <linux/usb/msm_hsusb.h>
46#include <linux/usb/android.h>
47#include <mach/socinfo.h>
Harini Jayaramanc4c58692011-07-19 14:50:10 -060048#include <mach/msm_spi.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070049#include "timer.h"
50#include "devices.h"
Joel King4ebccc62011-07-22 09:43:22 -070051#include <mach/gpio.h>
52#include <mach/gpiomux.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060053#include <mach/rpm.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080054#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -070055#include <linux/android_pmem.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080056#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070057#include <mach/msm_memtypes.h>
58#include <linux/bootmem.h>
59#include <asm/setup.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070060#include <mach/dma.h>
Jin Hongd3024e62012-02-09 16:13:32 -080061#include <mach/msm_dsps.h>
Gagan Mac8a7a5d32011-11-11 16:43:06 -070062#include <mach/msm_bus_board.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060063#include <mach/cpuidle.h>
Joel Kingdacbc822012-01-25 13:30:57 -080064#include <mach/mdm2.h>
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -080065#include <linux/msm_tsens.h>
Stephen Boyd4d0d2582012-02-10 14:49:40 -080066#include <mach/msm_xo.h>
Laura Abbott350c8362012-02-28 14:46:52 -080067#include <mach/msm_rtb.h>
Santosh Mardieff9a742012-04-09 23:23:39 +053068#include <sound/cs8427.h>
Ravi Kumar V05931a22012-04-04 17:09:37 +053069#include <media/gpio-ir-recv.h>
Joel King4ebccc62011-07-22 09:43:22 -070070
Jeff Ohlstein7e668552011-10-06 16:17:25 -070071#include "msm_watchdog.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080072#include "board-8064.h"
Vikram Mulukutlabc2e9572011-11-04 03:41:38 -070073#include "acpuclock.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060074#include "spm.h"
Subhash Jadavani909e04f2012-04-12 10:52:50 +053075#include <mach/mpm.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060076#include "rpm_resources.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080077#include "pm.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060078#include "pm-boot.h"
Rajesh Sastrulaaee8af32012-01-20 11:46:31 -080079#include "devices-msm8x60.h"
Hanumant Singh50440d42012-04-23 19:27:16 -070080#include "smd_private.h"
Jay Chokshiea67c622011-07-29 17:12:26 -070081
Olav Haugan7c6aa742012-01-16 16:47:37 -080082#define MSM_PMEM_ADSP_SIZE 0x7800000
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -070083#define MSM_PMEM_AUDIO_SIZE 0x4CF000
Olav Haugan7c6aa742012-01-16 16:47:37 -080084#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
85#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
86#else
Chetan Kalyan72aac4f2012-02-23 14:56:54 -080087#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Olav Haugan7c6aa742012-01-16 16:47:37 -080088#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070089
Olav Haugan7c6aa742012-01-16 16:47:37 -080090#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -070091#define MSM_PMEM_KERNEL_EBI1_SIZE 0x65000
Olav Haugan129992c2012-03-22 09:54:01 -070092#ifdef CONFIG_MSM_IOMMU
93#define MSM_ION_MM_SIZE 0x3800000
94#define MSM_ION_SF_SIZE 0
95#define MSM_ION_HEAP_NUM 7
96#else
Olav Haugan7c6aa742012-01-16 16:47:37 -080097#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Haugan129992c2012-03-22 09:54:01 -070098#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
99#define MSM_ION_HEAP_NUM 8
100#endif
101#define MSM_ION_MM_FW_SIZE 0x200000 /* (2MB) */
Olav Haugan3a9bd232012-02-15 14:23:27 -0800102#define MSM_ION_QSECOM_SIZE 0x300000 /* (3MB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800103#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan2c43fac2012-01-19 11:06:37 -0800104#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Olav Haugan7c6aa742012-01-16 16:47:37 -0800105#else
106#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
107#define MSM_ION_HEAP_NUM 1
108#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700109
Olav Haugan7c6aa742012-01-16 16:47:37 -0800110#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
111static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
112static int __init pmem_kernel_ebi1_size_setup(char *p)
Kevin Chan13be4e22011-10-20 11:30:32 -0700113{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800114 pmem_kernel_ebi1_size = memparse(p, NULL);
115 return 0;
Kevin Chan13be4e22011-10-20 11:30:32 -0700116}
Olav Haugan7c6aa742012-01-16 16:47:37 -0800117early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
118#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700119
Olav Haugan7c6aa742012-01-16 16:47:37 -0800120#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -0700121static unsigned pmem_size = MSM_PMEM_SIZE;
122static int __init pmem_size_setup(char *p)
123{
124 pmem_size = memparse(p, NULL);
125 return 0;
126}
127early_param("pmem_size", pmem_size_setup);
128
129static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
130
131static int __init pmem_adsp_size_setup(char *p)
132{
133 pmem_adsp_size = memparse(p, NULL);
134 return 0;
135}
136early_param("pmem_adsp_size", pmem_adsp_size_setup);
137
138static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
139
140static int __init pmem_audio_size_setup(char *p)
141{
142 pmem_audio_size = memparse(p, NULL);
143 return 0;
144}
145early_param("pmem_audio_size", pmem_audio_size_setup);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800146#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700147
Olav Haugan7c6aa742012-01-16 16:47:37 -0800148#ifdef CONFIG_ANDROID_PMEM
149#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700150static struct android_pmem_platform_data android_pmem_pdata = {
151 .name = "pmem",
152 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
153 .cached = 1,
154 .memory_type = MEMTYPE_EBI1,
155};
156
157static struct platform_device android_pmem_device = {
158 .name = "android_pmem",
159 .id = 0,
160 .dev = {.platform_data = &android_pmem_pdata},
161};
162
163static struct android_pmem_platform_data android_pmem_adsp_pdata = {
164 .name = "pmem_adsp",
165 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
166 .cached = 0,
167 .memory_type = MEMTYPE_EBI1,
168};
Kevin Chan13be4e22011-10-20 11:30:32 -0700169static struct platform_device android_pmem_adsp_device = {
170 .name = "android_pmem",
171 .id = 2,
172 .dev = { .platform_data = &android_pmem_adsp_pdata },
173};
174
175static struct android_pmem_platform_data android_pmem_audio_pdata = {
176 .name = "pmem_audio",
177 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
178 .cached = 0,
179 .memory_type = MEMTYPE_EBI1,
180};
181
182static struct platform_device android_pmem_audio_device = {
183 .name = "android_pmem",
184 .id = 4,
185 .dev = { .platform_data = &android_pmem_audio_pdata },
186};
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700187#endif /* CONFIG_MSM_MULTIMEDIA_USE_ION */
188#endif /* CONFIG_ANDROID_PMEM */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800189
190static struct memtype_reserve apq8064_reserve_table[] __initdata = {
191 [MEMTYPE_SMI] = {
192 },
193 [MEMTYPE_EBI0] = {
194 .flags = MEMTYPE_FLAGS_1M_ALIGN,
195 },
196 [MEMTYPE_EBI1] = {
197 .flags = MEMTYPE_FLAGS_1M_ALIGN,
198 },
199};
Kevin Chan13be4e22011-10-20 11:30:32 -0700200
Laura Abbott350c8362012-02-28 14:46:52 -0800201#if defined(CONFIG_MSM_RTB)
202static struct msm_rtb_platform_data msm_rtb_pdata = {
203 .size = SZ_1M,
204};
205
206static int __init msm_rtb_set_buffer_size(char *p)
207{
208 int s;
209
210 s = memparse(p, NULL);
211 msm_rtb_pdata.size = ALIGN(s, SZ_4K);
212 return 0;
213}
214early_param("msm_rtb_size", msm_rtb_set_buffer_size);
215
216
217static struct platform_device msm_rtb_device = {
218 .name = "msm_rtb",
219 .id = -1,
220 .dev = {
221 .platform_data = &msm_rtb_pdata,
222 },
223};
224#endif
225
226static void __init reserve_rtb_memory(void)
227{
228#if defined(CONFIG_MSM_RTB)
229 apq8064_reserve_table[MEMTYPE_EBI1].size += msm_rtb_pdata.size;
230#endif
231}
232
233
Kevin Chan13be4e22011-10-20 11:30:32 -0700234static void __init size_pmem_devices(void)
235{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800236#ifdef CONFIG_ANDROID_PMEM
237#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700238 android_pmem_adsp_pdata.size = pmem_adsp_size;
239 android_pmem_pdata.size = pmem_size;
240 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700241#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
242#endif /*CONFIG_ANDROID_PMEM*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700243}
244
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700245#ifdef CONFIG_ANDROID_PMEM
246#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700247static void __init reserve_memory_for(struct android_pmem_platform_data *p)
248{
249 apq8064_reserve_table[p->memory_type].size += p->size;
250}
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700251#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
252#endif /*CONFIG_ANDROID_PMEM*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700253
Kevin Chan13be4e22011-10-20 11:30:32 -0700254static void __init reserve_pmem_memory(void)
255{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800256#ifdef CONFIG_ANDROID_PMEM
257#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700258 reserve_memory_for(&android_pmem_adsp_pdata);
259 reserve_memory_for(&android_pmem_pdata);
260 reserve_memory_for(&android_pmem_audio_pdata);
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700261#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700262 apq8064_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700263#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -0800264}
265
266static int apq8064_paddr_to_memtype(unsigned int paddr)
267{
268 return MEMTYPE_EBI1;
269}
270
271#ifdef CONFIG_ION_MSM
272#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
273static struct ion_cp_heap_pdata cp_mm_ion_pdata = {
274 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugand3d29682012-01-19 10:57:07 -0800275 .align = PAGE_SIZE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800276};
277
278static struct ion_cp_heap_pdata cp_mfc_ion_pdata = {
279 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugand3d29682012-01-19 10:57:07 -0800280 .align = PAGE_SIZE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800281};
282
283static struct ion_co_heap_pdata co_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800284 .adjacent_mem_id = INVALID_HEAP_ID,
285 .align = PAGE_SIZE,
286};
287
288static struct ion_co_heap_pdata fw_co_ion_pdata = {
289 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
290 .align = SZ_128K,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800291};
292#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800293
294/**
295 * These heaps are listed in the order they will be allocated. Due to
296 * video hardware restrictions and content protection the FW heap has to
297 * be allocated adjacent (below) the MM heap and the MFC heap has to be
298 * allocated after the MM heap to ensure MFC heap is not more than 256MB
299 * away from the base address of the FW heap.
300 * However, the order of FW heap and MM heap doesn't matter since these
301 * two heaps are taken care of by separate code to ensure they are adjacent
302 * to each other.
303 * Don't swap the order unless you know what you are doing!
304 */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800305static struct ion_platform_data ion_pdata = {
306 .nr = MSM_ION_HEAP_NUM,
307 .heaps = {
308 {
309 .id = ION_SYSTEM_HEAP_ID,
310 .type = ION_HEAP_TYPE_SYSTEM,
311 .name = ION_VMALLOC_HEAP_NAME,
312 },
313#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
314 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800315 .id = ION_CP_MM_HEAP_ID,
316 .type = ION_HEAP_TYPE_CP,
317 .name = ION_MM_HEAP_NAME,
318 .size = MSM_ION_MM_SIZE,
319 .memory_type = ION_EBI_TYPE,
320 .extra_data = (void *) &cp_mm_ion_pdata,
321 },
322 {
Olav Haugand3d29682012-01-19 10:57:07 -0800323 .id = ION_MM_FIRMWARE_HEAP_ID,
324 .type = ION_HEAP_TYPE_CARVEOUT,
325 .name = ION_MM_FIRMWARE_HEAP_NAME,
326 .size = MSM_ION_MM_FW_SIZE,
327 .memory_type = ION_EBI_TYPE,
328 .extra_data = (void *) &fw_co_ion_pdata,
329 },
330 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800331 .id = ION_CP_MFC_HEAP_ID,
332 .type = ION_HEAP_TYPE_CP,
333 .name = ION_MFC_HEAP_NAME,
334 .size = MSM_ION_MFC_SIZE,
335 .memory_type = ION_EBI_TYPE,
336 .extra_data = (void *) &cp_mfc_ion_pdata,
337 },
Olav Haugan129992c2012-03-22 09:54:01 -0700338#ifndef CONFIG_MSM_IOMMU
Olav Haugan7c6aa742012-01-16 16:47:37 -0800339 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800340 .id = ION_SF_HEAP_ID,
341 .type = ION_HEAP_TYPE_CARVEOUT,
342 .name = ION_SF_HEAP_NAME,
343 .size = MSM_ION_SF_SIZE,
344 .memory_type = ION_EBI_TYPE,
345 .extra_data = (void *) &co_ion_pdata,
346 },
Olav Haugan129992c2012-03-22 09:54:01 -0700347#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800348 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800349 .id = ION_IOMMU_HEAP_ID,
350 .type = ION_HEAP_TYPE_IOMMU,
351 .name = ION_IOMMU_HEAP_NAME,
352 },
Olav Hauganf45e2142012-01-19 11:01:01 -0800353 {
354 .id = ION_QSECOM_HEAP_ID,
355 .type = ION_HEAP_TYPE_CARVEOUT,
356 .name = ION_QSECOM_HEAP_NAME,
357 .size = MSM_ION_QSECOM_SIZE,
358 .memory_type = ION_EBI_TYPE,
359 .extra_data = (void *) &co_ion_pdata,
360 },
Olav Haugan2c43fac2012-01-19 11:06:37 -0800361 {
362 .id = ION_AUDIO_HEAP_ID,
363 .type = ION_HEAP_TYPE_CARVEOUT,
364 .name = ION_AUDIO_HEAP_NAME,
365 .size = MSM_ION_AUDIO_SIZE,
366 .memory_type = ION_EBI_TYPE,
367 .extra_data = (void *) &co_ion_pdata,
368 },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800369#endif
370 }
371};
372
373static struct platform_device ion_dev = {
374 .name = "ion-msm",
375 .id = 1,
376 .dev = { .platform_data = &ion_pdata },
377};
378#endif
379
Stephen Boyd668d7652012-04-25 11:31:01 -0700380static void __init reserve_ion_memory(void)
Olav Haugan7c6aa742012-01-16 16:47:37 -0800381{
382#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
383 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_SIZE;
Olav Haugand3d29682012-01-19 10:57:07 -0800384 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_FW_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800385 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_SF_SIZE;
386 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MFC_SIZE;
Olav Hauganf45e2142012-01-19 11:01:01 -0800387 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_QSECOM_SIZE;
Olav Haugan2c43fac2012-01-19 11:06:37 -0800388 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_AUDIO_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800389#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700390}
391
Huaibin Yang4a084e32011-12-15 15:25:52 -0800392static void __init reserve_mdp_memory(void)
393{
394 apq8064_mdp_writeback(apq8064_reserve_table);
395}
396
Kevin Chan13be4e22011-10-20 11:30:32 -0700397static void __init apq8064_calculate_reserve_sizes(void)
398{
399 size_pmem_devices();
400 reserve_pmem_memory();
Olav Haugan7c6aa742012-01-16 16:47:37 -0800401 reserve_ion_memory();
Huaibin Yang4a084e32011-12-15 15:25:52 -0800402 reserve_mdp_memory();
Laura Abbott350c8362012-02-28 14:46:52 -0800403 reserve_rtb_memory();
Kevin Chan13be4e22011-10-20 11:30:32 -0700404}
405
406static struct reserve_info apq8064_reserve_info __initdata = {
407 .memtype_reserve_table = apq8064_reserve_table,
408 .calculate_reserve_sizes = apq8064_calculate_reserve_sizes,
409 .paddr_to_memtype = apq8064_paddr_to_memtype,
410};
411
412static int apq8064_memory_bank_size(void)
413{
414 return 1<<29;
415}
416
417static void __init locate_unstable_memory(void)
418{
419 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
420 unsigned long bank_size;
421 unsigned long low, high;
422
423 bank_size = apq8064_memory_bank_size();
424 low = meminfo.bank[0].start;
425 high = mb->start + mb->size;
Olav Haugand76e3a82012-01-16 16:55:07 -0800426
427 /* Check if 32 bit overflow occured */
428 if (high < mb->start)
429 high = ~0UL;
430
Kevin Chan13be4e22011-10-20 11:30:32 -0700431 low &= ~(bank_size - 1);
432
433 if (high - low <= bank_size)
434 return;
Jack Cheung46bfffa2012-01-19 15:26:24 -0800435 apq8064_reserve_info.low_unstable_address = mb->start -
436 MIN_MEMORY_BLOCK_SIZE + mb->size;
437 apq8064_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
438
Kevin Chan13be4e22011-10-20 11:30:32 -0700439 apq8064_reserve_info.bank_size = bank_size;
440 pr_info("low unstable address %lx max size %lx bank size %lx\n",
441 apq8064_reserve_info.low_unstable_address,
442 apq8064_reserve_info.max_unstable_size,
443 apq8064_reserve_info.bank_size);
444}
445
Hanumant Singh50440d42012-04-23 19:27:16 -0700446static int apq8064_change_memory_power(u64 start, u64 size,
447 int change_type)
448{
449 return soc_change_memory_power(start, size, change_type);
450}
451
Aravind Venkateswaran8ac7f412012-03-16 17:57:30 -0700452static char prim_panel_name[PANEL_NAME_MAX_LEN];
453static char ext_panel_name[PANEL_NAME_MAX_LEN];
454static int __init prim_display_setup(char *param)
455{
456 if (strnlen(param, PANEL_NAME_MAX_LEN))
457 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
458 return 0;
459}
460early_param("prim_display", prim_display_setup);
461
462static int __init ext_display_setup(char *param)
463{
464 if (strnlen(param, PANEL_NAME_MAX_LEN))
465 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
466 return 0;
467}
468early_param("ext_display", ext_display_setup);
469
Kevin Chan13be4e22011-10-20 11:30:32 -0700470static void __init apq8064_reserve(void)
471{
Aravind Venkateswaran8ac7f412012-03-16 17:57:30 -0700472 apq8064_set_display_params(prim_panel_name, ext_panel_name);
Kevin Chan13be4e22011-10-20 11:30:32 -0700473 msm_reserve();
474}
475
Laura Abbott6988cef2012-03-15 14:27:13 -0700476static void __init place_movable_zone(void)
477{
478 movable_reserved_start = apq8064_reserve_info.low_unstable_address;
479 movable_reserved_size = apq8064_reserve_info.max_unstable_size;
480 pr_info("movable zone start %lx size %lx\n",
481 movable_reserved_start, movable_reserved_size);
482}
483
484static void __init apq8064_early_reserve(void)
485{
486 reserve_info = &apq8064_reserve_info;
487 locate_unstable_memory();
488 place_movable_zone();
489
490}
Hemant Kumara945b472012-01-25 15:08:06 -0800491#ifdef CONFIG_USB_EHCI_MSM_HSIC
Hemant Kumare6275972012-02-29 20:06:21 -0800492/* Bandwidth requests (zero) if no vote placed */
493static struct msm_bus_vectors hsic_init_vectors[] = {
494 {
495 .src = MSM_BUS_MASTER_SPS,
496 .dst = MSM_BUS_SLAVE_EBI_CH0,
497 .ab = 0,
498 .ib = 0,
499 },
500 {
501 .src = MSM_BUS_MASTER_SPS,
502 .dst = MSM_BUS_SLAVE_SPS,
503 .ab = 0,
504 .ib = 0,
505 },
506};
507
508/* Bus bandwidth requests in Bytes/sec */
509static struct msm_bus_vectors hsic_max_vectors[] = {
510 {
511 .src = MSM_BUS_MASTER_SPS,
512 .dst = MSM_BUS_SLAVE_EBI_CH0,
513 .ab = 60000000, /* At least 480Mbps on bus. */
514 .ib = 960000000, /* MAX bursts rate */
515 },
516 {
517 .src = MSM_BUS_MASTER_SPS,
518 .dst = MSM_BUS_SLAVE_SPS,
519 .ab = 0,
520 .ib = 512000000, /*vote for 64Mhz dfab clk rate*/
521 },
522};
523
524static struct msm_bus_paths hsic_bus_scale_usecases[] = {
525 {
526 ARRAY_SIZE(hsic_init_vectors),
527 hsic_init_vectors,
528 },
529 {
530 ARRAY_SIZE(hsic_max_vectors),
531 hsic_max_vectors,
532 },
533};
534
535static struct msm_bus_scale_pdata hsic_bus_scale_pdata = {
536 hsic_bus_scale_usecases,
537 ARRAY_SIZE(hsic_bus_scale_usecases),
538 .name = "hsic",
539};
540
Hemant Kumara945b472012-01-25 15:08:06 -0800541static struct msm_hsic_host_platform_data msm_hsic_pdata = {
Hemant Kumare6275972012-02-29 20:06:21 -0800542 .strobe = 88,
543 .data = 89,
544 .bus_scale_table = &hsic_bus_scale_pdata,
Hemant Kumara945b472012-01-25 15:08:06 -0800545};
546#else
547static struct msm_hsic_host_platform_data msm_hsic_pdata;
548#endif
549
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800550#define PID_MAGIC_ID 0x71432909
551#define SERIAL_NUM_MAGIC_ID 0x61945374
552#define SERIAL_NUMBER_LENGTH 127
553#define DLOAD_USB_BASE_ADD 0x2A03F0C8
554
555struct magic_num_struct {
556 uint32_t pid;
557 uint32_t serial_num;
558};
559
560struct dload_struct {
561 uint32_t reserved1;
562 uint32_t reserved2;
563 uint32_t reserved3;
564 uint16_t reserved4;
565 uint16_t pid;
566 char serial_number[SERIAL_NUMBER_LENGTH];
567 uint16_t reserved5;
568 struct magic_num_struct magic_struct;
569};
570
571static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
572{
573 struct dload_struct __iomem *dload = 0;
574
575 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
576 if (!dload) {
577 pr_err("%s: cannot remap I/O memory region: %08x\n",
578 __func__, DLOAD_USB_BASE_ADD);
579 return -ENXIO;
580 }
581
582 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
583 __func__, dload, pid, snum);
584 /* update pid */
585 dload->magic_struct.pid = PID_MAGIC_ID;
586 dload->pid = pid;
587
588 /* update serial number */
589 dload->magic_struct.serial_num = 0;
590 if (!snum) {
591 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
592 goto out;
593 }
594
595 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
596 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
597out:
598 iounmap(dload);
599 return 0;
600}
601
602static struct android_usb_platform_data android_usb_pdata = {
603 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
604};
605
Hemant Kumar4933b072011-10-17 23:43:11 -0700606static struct platform_device android_usb_device = {
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800607 .name = "android_usb",
608 .id = -1,
609 .dev = {
610 .platform_data = &android_usb_pdata,
611 },
Hemant Kumar4933b072011-10-17 23:43:11 -0700612};
613
Hemant Kumar7620eed2012-02-26 09:08:43 -0800614/* Bandwidth requests (zero) if no vote placed */
615static struct msm_bus_vectors usb_init_vectors[] = {
616 {
617 .src = MSM_BUS_MASTER_SPS,
618 .dst = MSM_BUS_SLAVE_EBI_CH0,
619 .ab = 0,
620 .ib = 0,
621 },
622};
623
624/* Bus bandwidth requests in Bytes/sec */
625static struct msm_bus_vectors usb_max_vectors[] = {
626 {
627 .src = MSM_BUS_MASTER_SPS,
628 .dst = MSM_BUS_SLAVE_EBI_CH0,
629 .ab = 60000000, /* At least 480Mbps on bus. */
630 .ib = 960000000, /* MAX bursts rate */
631 },
632};
633
634static struct msm_bus_paths usb_bus_scale_usecases[] = {
635 {
636 ARRAY_SIZE(usb_init_vectors),
637 usb_init_vectors,
638 },
639 {
640 ARRAY_SIZE(usb_max_vectors),
641 usb_max_vectors,
642 },
643};
644
645static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
646 usb_bus_scale_usecases,
647 ARRAY_SIZE(usb_bus_scale_usecases),
648 .name = "usb",
649};
650
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700651static int phy_init_seq[] = {
652 0x38, 0x81, /* update DC voltage level */
653 0x24, 0x82, /* set pre-emphasis and rise/fall time */
654 -1
655};
656
Hemant Kumar4933b072011-10-17 23:43:11 -0700657static struct msm_otg_platform_data msm_otg_pdata = {
Hemant Kumard86c4882012-01-24 19:39:37 -0800658 .mode = USB_OTG,
659 .otg_control = OTG_PMIC_CONTROL,
Hemant Kumar4933b072011-10-17 23:43:11 -0700660 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Hemant Kumard86c4882012-01-24 19:39:37 -0800661 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
662 .power_budget = 750,
Hemant Kumar7620eed2012-02-26 09:08:43 -0800663 .bus_scale_table = &usb_bus_scale_pdata,
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700664 .phy_init_seq = phy_init_seq,
Hemant Kumar4933b072011-10-17 23:43:11 -0700665};
666
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800667static struct msm_usb_host_platform_data msm_ehci_host_pdata3 = {
Manu Gautam91223e02011-11-08 15:27:22 +0530668 .power_budget = 500,
669};
670
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800671#ifdef CONFIG_USB_EHCI_MSM_HOST4
672static struct msm_usb_host_platform_data msm_ehci_host_pdata4;
673#endif
674
Manu Gautam91223e02011-11-08 15:27:22 +0530675static void __init apq8064_ehci_host_init(void)
676{
677 if (machine_is_apq8064_liquid()) {
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800678 msm_ehci_host_pdata3.dock_connect_irq =
Hemant Kumar56925352012-02-13 16:59:52 -0800679 PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9);
680
Manu Gautam91223e02011-11-08 15:27:22 +0530681 apq8064_device_ehci_host3.dev.platform_data =
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800682 &msm_ehci_host_pdata3;
Manu Gautam91223e02011-11-08 15:27:22 +0530683 platform_device_register(&apq8064_device_ehci_host3);
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800684
685#ifdef CONFIG_USB_EHCI_MSM_HOST4
686 apq8064_device_ehci_host4.dev.platform_data =
687 &msm_ehci_host_pdata4;
688 platform_device_register(&apq8064_device_ehci_host4);
689#endif
Manu Gautam91223e02011-11-08 15:27:22 +0530690 }
691}
692
David Keitel2f613d92012-02-15 11:29:16 -0800693static struct smb349_platform_data smb349_data __initdata = {
694 .en_n_gpio = PM8921_GPIO_PM_TO_SYS(37),
695 .chg_susp_gpio = PM8921_GPIO_PM_TO_SYS(30),
696 .chg_current_ma = 2200,
697};
698
699static struct i2c_board_info smb349_charger_i2c_info[] __initdata = {
700 {
701 I2C_BOARD_INFO(SMB349_NAME, 0x1B),
702 .platform_data = &smb349_data,
703 },
704};
705
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -0800706struct sx150x_platform_data apq8064_sx150x_data[] = {
707 [SX150X_EPM] = {
708 .gpio_base = GPIO_EPM_EXPANDER_BASE,
709 .oscio_is_gpo = false,
710 .io_pullup_ena = 0x0,
711 .io_pulldn_ena = 0x0,
712 .io_open_drain_ena = 0x0,
713 .io_polarity = 0,
714 .irq_summary = -1,
715 },
716};
717
718static struct epm_chan_properties ads_adc_channel_data[] = {
719 {10, 100}, {500, 50}, {1, 1}, {1, 1},
720 {20, 50}, {10, 100}, {1, 1}, {1, 1},
721 {10, 100}, {10, 100}, {100, 100}, {200, 100},
722 {100, 50}, {2000, 50}, {1000, 50}, {200, 50},
723 {200, 100}, {1, 1}, {20, 50}, {500, 50},
724 {50, 50}, {200, 100}, {500, 100}, {20, 50},
725 {200, 50}, {2000, 100}, {1000, 50}, {100, 50},
726 {200, 100}, {500, 50}, {1000, 100}, {200, 50},
727 {1000, 50}, {50, 50}, {100, 50}, {100, 50},
728 {1, 1}, {1, 1}, {20, 100}, {20, 50},
729 {500, 100}, {1000, 100}, {100, 50}, {1000, 50},
730 {100, 50}, {1000, 100}, {100, 50}, {100, 50},
731};
732
733static struct epm_adc_platform_data epm_adc_pdata = {
734 .channel = ads_adc_channel_data,
735 .bus_id = 0x0,
736 .epm_i2c_board_info = {
737 .type = "sx1509q",
738 .addr = 0x3e,
739 .platform_data = &apq8064_sx150x_data[SX150X_EPM],
740 },
741 .gpio_expander_base_addr = GPIO_EPM_EXPANDER_BASE,
742};
743
744static struct platform_device epm_adc_device = {
745 .name = "epm_adc",
746 .id = -1,
747 .dev = {
748 .platform_data = &epm_adc_pdata,
749 },
750};
751
752static void __init apq8064_epm_adc_init(void)
753{
754 epm_adc_pdata.num_channels = 32;
755 epm_adc_pdata.num_adc = 2;
756 epm_adc_pdata.chan_per_adc = 16;
757 epm_adc_pdata.chan_per_mux = 8;
758};
759
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800760/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
761 * 4 micbiases are used to power various analog and digital
762 * microphones operating at 1800 mV. Technically, all micbiases
763 * can source from single cfilter since all microphones operate
764 * at the same voltage level. The arrangement below is to make
765 * sure all cfilters are exercised. LDO_H regulator ouput level
766 * does not need to be as high as 2.85V. It is choosen for
767 * microphone sensitivity purpose.
768 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530769static struct wcd9xxx_pdata apq8064_tabla_platform_data = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800770 .slimbus_slave_device = {
771 .name = "tabla-slave",
772 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
773 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800774 .irq = MSM_GPIO_TO_INT(42),
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800775 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530776 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800777 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
778 .micbias = {
779 .ldoh_v = TABLA_LDOH_2P85_V,
780 .cfilt1_mv = 1800,
781 .cfilt2_mv = 1800,
782 .cfilt3_mv = 1800,
783 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
784 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
785 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
786 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530787 },
788 .regulator = {
789 {
790 .name = "CDC_VDD_CP",
791 .min_uV = 1800000,
792 .max_uV = 1800000,
793 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
794 },
795 {
796 .name = "CDC_VDDA_RX",
797 .min_uV = 1800000,
798 .max_uV = 1800000,
799 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
800 },
801 {
802 .name = "CDC_VDDA_TX",
803 .min_uV = 1800000,
804 .max_uV = 1800000,
805 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
806 },
807 {
808 .name = "VDDIO_CDC",
809 .min_uV = 1800000,
810 .max_uV = 1800000,
811 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
812 },
813 {
814 .name = "VDDD_CDC_D",
815 .min_uV = 1225000,
816 .max_uV = 1225000,
817 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
818 },
819 {
820 .name = "CDC_VDDA_A_1P2V",
821 .min_uV = 1225000,
822 .max_uV = 1225000,
823 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
824 },
825 },
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800826};
827
828static struct slim_device apq8064_slim_tabla = {
829 .name = "tabla-slim",
830 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
831 .dev = {
832 .platform_data = &apq8064_tabla_platform_data,
833 },
834};
835
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530836static struct wcd9xxx_pdata apq8064_tabla20_platform_data = {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800837 .slimbus_slave_device = {
838 .name = "tabla-slave",
839 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
840 },
841 .irq = MSM_GPIO_TO_INT(42),
842 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530843 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800844 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
845 .micbias = {
846 .ldoh_v = TABLA_LDOH_2P85_V,
847 .cfilt1_mv = 1800,
848 .cfilt2_mv = 1800,
849 .cfilt3_mv = 1800,
850 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
851 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
852 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
853 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530854 },
855 .regulator = {
856 {
857 .name = "CDC_VDD_CP",
858 .min_uV = 1800000,
859 .max_uV = 1800000,
860 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
861 },
862 {
863 .name = "CDC_VDDA_RX",
864 .min_uV = 1800000,
865 .max_uV = 1800000,
866 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
867 },
868 {
869 .name = "CDC_VDDA_TX",
870 .min_uV = 1800000,
871 .max_uV = 1800000,
872 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
873 },
874 {
875 .name = "VDDIO_CDC",
876 .min_uV = 1800000,
877 .max_uV = 1800000,
878 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
879 },
880 {
881 .name = "VDDD_CDC_D",
882 .min_uV = 1225000,
883 .max_uV = 1225000,
884 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
885 },
886 {
887 .name = "CDC_VDDA_A_1P2V",
888 .min_uV = 1225000,
889 .max_uV = 1225000,
890 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
891 },
892 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800893};
894
895static struct slim_device apq8064_slim_tabla20 = {
896 .name = "tabla2x-slim",
897 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
898 .dev = {
899 .platform_data = &apq8064_tabla20_platform_data,
900 },
901};
902
Santosh Mardi695be0d2012-04-10 23:21:12 +0530903/* enable the level shifter for cs8427 to make sure the I2C
904 * clock is running at 100KHz and voltage levels are at 3.3
905 * and 5 volts
906 */
907static int enable_100KHz_ls(int enable)
908{
909 int ret = 0;
910 if (enable) {
911 ret = gpio_request(SX150X_GPIO(1, 10),
912 "cs8427_100KHZ_ENABLE");
913 if (ret) {
914 pr_err("%s: Failed to request gpio %d\n", __func__,
915 SX150X_GPIO(1, 10));
916 return ret;
917 }
918 gpio_direction_output(SX150X_GPIO(1, 10), 1);
919 } else
920 gpio_free(SX150X_GPIO(1, 10));
921 return ret;
922}
923
Santosh Mardieff9a742012-04-09 23:23:39 +0530924static struct cs8427_platform_data cs8427_i2c_platform_data = {
925 .irq = SX150X_GPIO(1, 4),
926 .reset_gpio = SX150X_GPIO(1, 6),
Santosh Mardi695be0d2012-04-10 23:21:12 +0530927 .enable = enable_100KHz_ls,
Santosh Mardieff9a742012-04-09 23:23:39 +0530928};
929
930static struct i2c_board_info cs8427_device_info[] __initdata = {
931 {
932 I2C_BOARD_INFO("cs8427", CS8427_ADDR4),
933 .platform_data = &cs8427_i2c_platform_data,
934 },
935};
936
Amy Maloche70090f992012-02-16 16:35:26 -0800937#define HAP_SHIFT_LVL_OE_GPIO PM8921_MPP_PM_TO_SYS(8)
938#define ISA1200_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
939#define ISA1200_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
940#define ISA1200_HAP_CLK PM8921_GPIO_PM_TO_SYS(44)
941
942static int isa1200_power(int on)
943{
Amy Maloche8f973892012-03-26 14:53:13 -0700944 int rc = 0;
945
Amy Maloche70090f992012-02-16 16:35:26 -0800946 gpio_set_value_cansleep(ISA1200_HAP_CLK, !!on);
947
Amy Maloche8f973892012-03-26 14:53:13 -0700948 if (on)
949 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_1, true);
950 else
951 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_NONE, true);
952
953 if (rc) {
954 pr_err("%s: unable to write aux clock register(%d)\n",
955 __func__, rc);
956 }
957
958 return rc;
Amy Maloche70090f992012-02-16 16:35:26 -0800959}
960
961static int isa1200_dev_setup(bool enable)
962{
963 int rc = 0;
964
Amy Maloche70090f992012-02-16 16:35:26 -0800965 if (!enable)
966 goto free_gpio;
967
968 rc = gpio_request(ISA1200_HAP_CLK, "haptics_clk");
969 if (rc) {
970 pr_err("%s: unable to request gpio %d config(%d)\n",
971 __func__, ISA1200_HAP_CLK, rc);
972 return rc;
973 }
974
975 rc = gpio_direction_output(ISA1200_HAP_CLK, 0);
976 if (rc) {
977 pr_err("%s: unable to set direction\n", __func__);
978 goto free_gpio;
979 }
980
981 return 0;
982
983free_gpio:
984 gpio_free(ISA1200_HAP_CLK);
985 return rc;
986}
987
988static struct isa1200_regulator isa1200_reg_data[] = {
989 {
990 .name = "vddp",
991 .min_uV = ISA_I2C_VTG_MIN_UV,
992 .max_uV = ISA_I2C_VTG_MAX_UV,
993 .load_uA = ISA_I2C_CURR_UA,
994 },
995};
996
997static struct isa1200_platform_data isa1200_1_pdata = {
998 .name = "vibrator",
999 .dev_setup = isa1200_dev_setup,
1000 .power_on = isa1200_power,
1001 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
1002 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
1003 .max_timeout = 15000,
1004 .mode_ctrl = PWM_GEN_MODE,
1005 .pwm_fd = {
1006 .pwm_div = 256,
1007 },
1008 .is_erm = false,
1009 .smart_en = true,
1010 .ext_clk_en = true,
1011 .chip_en = 1,
1012 .regulator_info = isa1200_reg_data,
1013 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1014};
1015
1016static struct i2c_board_info isa1200_board_info[] __initdata = {
1017 {
1018 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1019 .platform_data = &isa1200_1_pdata,
1020 },
1021};
Jing Lin21ed4de2012-02-05 15:53:28 -08001022/* configuration data for mxt1386e using V2.1 firmware */
1023static const u8 mxt1386e_config_data_v2_1[] = {
1024 /* T6 Object */
1025 0, 0, 0, 0, 0, 0,
1026 /* T38 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001027 14, 1, 0, 22, 2, 12, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001028 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1029 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1030 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1031 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1032 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1033 0, 0, 0, 0,
1034 /* T7 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001035 100, 10, 50,
Jing Lin21ed4de2012-02-05 15:53:28 -08001036 /* T8 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001037 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001038 /* T9 Object */
1039 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
1040 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
Jing Linf1208fd2012-02-23 11:15:42 -08001041 85, 5, 0, 5, 9, 5, 12, 35, 70, 40,
1042 20, 5, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001043 /* T18 Object */
1044 0, 0,
1045 /* T24 Object */
1046 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1047 0, 0, 0, 0, 0, 0, 0, 0, 0,
1048 /* T25 Object */
1049 3, 0, 60, 115, 156, 99,
1050 /* T27 Object */
1051 0, 0, 0, 0, 0, 0, 0,
1052 /* T40 Object */
1053 0, 0, 0, 0, 0,
1054 /* T42 Object */
1055 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
1056 /* T43 Object */
1057 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
1058 16,
1059 /* T46 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001060 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001061 /* T47 Object */
1062 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
1063 /* T48 Object */
1064 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001065 32, 40, 0, 10, 10, 0, 0, 100, 10, 90,
1066 0, 0, 0, 0, 0, 0, 0, 10, 1, 10,
1067 52, 10, 12, 0, 33, 0, 1, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001068 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1069 0, 0, 0, 0,
1070 /* T56 Object */
1071 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1072 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1073 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1074 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001075 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1076 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001077};
1078
Terence Hampson2e1705f2012-04-11 19:55:29 -04001079#ifndef CONFIG_MSM_VCAP
Jing Lin21ed4de2012-02-05 15:53:28 -08001080#define MXT_TS_GPIO_IRQ 6
1081#define MXT_TS_PWR_EN_GPIO PM8921_GPIO_PM_TO_SYS(23)
1082#define MXT_TS_RESET_GPIO 33
1083
1084static struct mxt_config_info mxt_config_array[] = {
1085 {
1086 .config = mxt1386e_config_data_v2_1,
1087 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1088 .family_id = 0xA0,
1089 .variant_id = 0x7,
1090 .version = 0x21,
1091 .build = 0xAA,
Jing Linef4aa9b2012-03-26 12:01:41 -07001092 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
1093 .fw_name = "atmel_8064_liquid_v2_2_AA.hex",
1094 },
1095 {
1096 /* The config data for V2.2.AA is the same as for V2.1.AA */
1097 .config = mxt1386e_config_data_v2_1,
1098 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1099 .family_id = 0xA0,
1100 .variant_id = 0x7,
1101 .version = 0x22,
1102 .build = 0xAA,
1103 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin21ed4de2012-02-05 15:53:28 -08001104 },
1105};
1106
1107static struct mxt_platform_data mxt_platform_data = {
1108 .config_array = mxt_config_array,
1109 .config_array_size = ARRAY_SIZE(mxt_config_array),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08001110 .panel_minx = 0,
1111 .panel_maxx = 1365,
1112 .panel_miny = 0,
1113 .panel_maxy = 767,
1114 .disp_minx = 0,
1115 .disp_maxx = 1365,
1116 .disp_miny = 0,
1117 .disp_maxy = 767,
Anirudh Ghayal39dbe3f2012-04-13 15:43:16 +05301118 .irqflags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
Jing Lin21ed4de2012-02-05 15:53:28 -08001119 .i2c_pull_up = true,
1120 .reset_gpio = MXT_TS_RESET_GPIO,
1121 .irq_gpio = MXT_TS_GPIO_IRQ,
1122};
1123
1124static struct i2c_board_info mxt_device_info[] __initdata = {
1125 {
1126 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
1127 .platform_data = &mxt_platform_data,
1128 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1129 },
1130};
Terence Hampson2e1705f2012-04-11 19:55:29 -04001131#endif
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001132#define CYTTSP_TS_GPIO_IRQ 6
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001133#define CYTTSP_TS_GPIO_SLEEP 33
1134
1135static ssize_t tma340_vkeys_show(struct kobject *kobj,
1136 struct kobj_attribute *attr, char *buf)
1137{
1138 return snprintf(buf, 200,
1139 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1140 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1141 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1142 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1143 "\n");
1144}
1145
1146static struct kobj_attribute tma340_vkeys_attr = {
1147 .attr = {
1148 .mode = S_IRUGO,
1149 },
1150 .show = &tma340_vkeys_show,
1151};
1152
1153static struct attribute *tma340_properties_attrs[] = {
1154 &tma340_vkeys_attr.attr,
1155 NULL
1156};
1157
1158static struct attribute_group tma340_properties_attr_group = {
1159 .attrs = tma340_properties_attrs,
1160};
1161
1162static int cyttsp_platform_init(struct i2c_client *client)
1163{
1164 int rc = 0;
1165 static struct kobject *tma340_properties_kobj;
1166
1167 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1168 tma340_properties_kobj = kobject_create_and_add("board_properties",
1169 NULL);
1170 if (tma340_properties_kobj)
1171 rc = sysfs_create_group(tma340_properties_kobj,
1172 &tma340_properties_attr_group);
1173 if (!tma340_properties_kobj || rc)
1174 pr_err("%s: failed to create board_properties\n",
1175 __func__);
1176
1177 return 0;
1178}
1179
1180static struct cyttsp_regulator cyttsp_regulator_data[] = {
1181 {
1182 .name = "vdd",
1183 .min_uV = CY_TMA300_VTG_MIN_UV,
1184 .max_uV = CY_TMA300_VTG_MAX_UV,
1185 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1186 .lpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1187 },
1188 {
1189 .name = "vcc_i2c",
1190 .min_uV = CY_I2C_VTG_MIN_UV,
1191 .max_uV = CY_I2C_VTG_MAX_UV,
1192 .hpm_load_uA = CY_I2C_CURR_UA,
1193 .lpm_load_uA = CY_I2C_CURR_UA,
1194 },
1195};
1196
1197static struct cyttsp_platform_data cyttsp_pdata = {
1198 .panel_maxx = 634,
1199 .panel_maxy = 1166,
1200 .disp_maxx = 599,
1201 .disp_maxy = 1023,
1202 .disp_minx = 0,
1203 .disp_miny = 0,
1204 .flags = 0x01,
1205 .gen = CY_GEN3,
1206 .use_st = CY_USE_ST,
1207 .use_mt = CY_USE_MT,
1208 .use_hndshk = CY_SEND_HNDSHK,
1209 .use_trk_id = CY_USE_TRACKING_ID,
1210 .use_sleep = CY_USE_DEEP_SLEEP_SEL,
1211 .use_gestures = CY_USE_GESTURES,
1212 .fw_fname = "cyttsp_8064_mtp.hex",
1213 /* change act_intrvl to customize the Active power state
1214 * scanning/processing refresh interval for Operating mode
1215 */
1216 .act_intrvl = CY_ACT_INTRVL_DFLT,
1217 /* change tch_tmout to customize the touch timeout for the
1218 * Active power state for Operating mode
1219 */
1220 .tch_tmout = CY_TCH_TMOUT_DFLT,
1221 /* change lp_intrvl to customize the Low Power power state
1222 * scanning/processing refresh interval for Operating mode
1223 */
1224 .lp_intrvl = CY_LP_INTRVL_DFLT,
1225 .sleep_gpio = CYTTSP_TS_GPIO_SLEEP,
Amy Maloche9ba3ffe2012-04-26 10:31:20 -07001226 .resout_gpio = -1,
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001227 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1228 .regulator_info = cyttsp_regulator_data,
1229 .num_regulators = ARRAY_SIZE(cyttsp_regulator_data),
1230 .init = cyttsp_platform_init,
1231 .correct_fw_ver = 17,
1232};
1233
1234static struct i2c_board_info cyttsp_info[] __initdata = {
1235 {
1236 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1237 .platform_data = &cyttsp_pdata,
1238 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1239 },
1240};
Jing Lin21ed4de2012-02-05 15:53:28 -08001241
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001242#define MSM_WCNSS_PHYS 0x03000000
1243#define MSM_WCNSS_SIZE 0x280000
1244
1245static struct resource resources_wcnss_wlan[] = {
1246 {
1247 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1248 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1249 .name = "wcnss_wlanrx_irq",
1250 .flags = IORESOURCE_IRQ,
1251 },
1252 {
1253 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1254 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1255 .name = "wcnss_wlantx_irq",
1256 .flags = IORESOURCE_IRQ,
1257 },
1258 {
1259 .start = MSM_WCNSS_PHYS,
1260 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1261 .name = "wcnss_mmio",
1262 .flags = IORESOURCE_MEM,
1263 },
1264 {
1265 .start = 64,
1266 .end = 68,
1267 .name = "wcnss_gpios_5wire",
1268 .flags = IORESOURCE_IO,
1269 },
1270};
1271
1272static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1273 .has_48mhz_xo = 1,
1274};
1275
1276static struct platform_device msm_device_wcnss_wlan = {
1277 .name = "wcnss_wlan",
1278 .id = 0,
1279 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1280 .resource = resources_wcnss_wlan,
1281 .dev = {.platform_data = &qcom_wcnss_pdata},
1282};
1283
Ankit Vermab7c26e62012-02-28 15:04:15 -08001284static struct platform_device msm_device_iris_fm __devinitdata = {
1285 .name = "iris_fm",
1286 .id = -1,
1287};
1288
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001289#ifdef CONFIG_QSEECOM
1290/* qseecom bus scaling */
1291static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
1292 {
1293 .src = MSM_BUS_MASTER_SPS,
1294 .dst = MSM_BUS_SLAVE_EBI_CH0,
1295 .ib = 0,
1296 .ab = 0,
1297 },
1298 {
1299 .src = MSM_BUS_MASTER_SPDM,
1300 .dst = MSM_BUS_SLAVE_SPDM,
1301 .ib = 0,
1302 .ab = 0,
1303 },
1304};
1305
1306static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
1307 {
1308 .src = MSM_BUS_MASTER_SPS,
1309 .dst = MSM_BUS_SLAVE_EBI_CH0,
1310 .ib = (492 * 8) * 1000000UL,
1311 .ab = (492 * 8) * 100000UL,
1312 },
1313 {
1314 .src = MSM_BUS_MASTER_SPDM,
1315 .dst = MSM_BUS_SLAVE_SPDM,
1316 .ib = 0,
1317 .ab = 0,
1318 },
1319};
1320
1321static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1322 {
1323 .src = MSM_BUS_MASTER_SPS,
1324 .dst = MSM_BUS_SLAVE_EBI_CH0,
1325 .ib = 0,
1326 .ab = 0,
1327 },
1328 {
1329 .src = MSM_BUS_MASTER_SPDM,
1330 .dst = MSM_BUS_SLAVE_SPDM,
1331 .ib = (64 * 8) * 1000000UL,
1332 .ab = (64 * 8) * 100000UL,
1333 },
1334};
1335
1336static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1337 {
1338 ARRAY_SIZE(qseecom_clks_init_vectors),
1339 qseecom_clks_init_vectors,
1340 },
1341 {
1342 ARRAY_SIZE(qseecom_enable_dfab_vectors),
1343 qseecom_enable_sfpb_vectors,
1344 },
1345 {
1346 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1347 qseecom_enable_sfpb_vectors,
1348 },
1349};
1350
1351static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1352 qseecom_hw_bus_scale_usecases,
1353 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1354 .name = "qsee",
1355};
1356
1357static struct platform_device qseecom_device = {
1358 .name = "qseecom",
1359 .id = 0,
1360 .dev = {
1361 .platform_data = &qseecom_bus_pdata,
1362 },
1363};
1364#endif
1365
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001366#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1367 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1368 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1369 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1370
1371#define QCE_SIZE 0x10000
1372#define QCE_0_BASE 0x11000000
1373
1374#define QCE_HW_KEY_SUPPORT 0
1375#define QCE_SHA_HMAC_SUPPORT 1
1376#define QCE_SHARE_CE_RESOURCE 3
1377#define QCE_CE_SHARED 0
1378
1379static struct resource qcrypto_resources[] = {
1380 [0] = {
1381 .start = QCE_0_BASE,
1382 .end = QCE_0_BASE + QCE_SIZE - 1,
1383 .flags = IORESOURCE_MEM,
1384 },
1385 [1] = {
1386 .name = "crypto_channels",
1387 .start = DMOV8064_CE_IN_CHAN,
1388 .end = DMOV8064_CE_OUT_CHAN,
1389 .flags = IORESOURCE_DMA,
1390 },
1391 [2] = {
1392 .name = "crypto_crci_in",
1393 .start = DMOV8064_CE_IN_CRCI,
1394 .end = DMOV8064_CE_IN_CRCI,
1395 .flags = IORESOURCE_DMA,
1396 },
1397 [3] = {
1398 .name = "crypto_crci_out",
1399 .start = DMOV8064_CE_OUT_CRCI,
1400 .end = DMOV8064_CE_OUT_CRCI,
1401 .flags = IORESOURCE_DMA,
1402 },
1403};
1404
1405static struct resource qcedev_resources[] = {
1406 [0] = {
1407 .start = QCE_0_BASE,
1408 .end = QCE_0_BASE + QCE_SIZE - 1,
1409 .flags = IORESOURCE_MEM,
1410 },
1411 [1] = {
1412 .name = "crypto_channels",
1413 .start = DMOV8064_CE_IN_CHAN,
1414 .end = DMOV8064_CE_OUT_CHAN,
1415 .flags = IORESOURCE_DMA,
1416 },
1417 [2] = {
1418 .name = "crypto_crci_in",
1419 .start = DMOV8064_CE_IN_CRCI,
1420 .end = DMOV8064_CE_IN_CRCI,
1421 .flags = IORESOURCE_DMA,
1422 },
1423 [3] = {
1424 .name = "crypto_crci_out",
1425 .start = DMOV8064_CE_OUT_CRCI,
1426 .end = DMOV8064_CE_OUT_CRCI,
1427 .flags = IORESOURCE_DMA,
1428 },
1429};
1430
1431#endif
1432
1433#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1434 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1435
1436static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1437 .ce_shared = QCE_CE_SHARED,
1438 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1439 .hw_key_support = QCE_HW_KEY_SUPPORT,
1440 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001441 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001442};
1443
1444static struct platform_device qcrypto_device = {
1445 .name = "qcrypto",
1446 .id = 0,
1447 .num_resources = ARRAY_SIZE(qcrypto_resources),
1448 .resource = qcrypto_resources,
1449 .dev = {
1450 .coherent_dma_mask = DMA_BIT_MASK(32),
1451 .platform_data = &qcrypto_ce_hw_suppport,
1452 },
1453};
1454#endif
1455
1456#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1457 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1458
1459static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1460 .ce_shared = QCE_CE_SHARED,
1461 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1462 .hw_key_support = QCE_HW_KEY_SUPPORT,
1463 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001464 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001465};
1466
1467static struct platform_device qcedev_device = {
1468 .name = "qce",
1469 .id = 0,
1470 .num_resources = ARRAY_SIZE(qcedev_resources),
1471 .resource = qcedev_resources,
1472 .dev = {
1473 .coherent_dma_mask = DMA_BIT_MASK(32),
1474 .platform_data = &qcedev_ce_hw_suppport,
1475 },
1476};
1477#endif
1478
Joel Kingdacbc822012-01-25 13:30:57 -08001479static struct mdm_platform_data mdm_platform_data = {
1480 .mdm_version = "3.0",
1481 .ramdump_delay_ms = 2000,
Hemant Kumara945b472012-01-25 15:08:06 -08001482 .peripheral_platform_device = &apq8064_device_hsic_host,
Joel Kingdacbc822012-01-25 13:30:57 -08001483};
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001484
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001485static struct tsens_platform_data apq_tsens_pdata = {
1486 .tsens_factor = 1000,
1487 .hw_type = APQ_8064,
1488 .tsens_num_sensor = 11,
1489 .slope = {1176, 1176, 1154, 1176, 1111,
1490 1132, 1132, 1199, 1132, 1199, 1132},
1491};
1492
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001493#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001494static void __init apq8064_map_io(void)
1495{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001496 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001497 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001498 if (socinfo_init() < 0)
1499 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001500}
1501
1502static void __init apq8064_init_irq(void)
1503{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001504 struct msm_mpm_device_data *data = NULL;
1505
1506#ifdef CONFIG_MSM_MPM
1507 data = &apq8064_mpm_dev_data;
1508#endif
1509
1510 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001511 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1512 (void *)MSM_QGIC_CPU_BASE);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001513}
1514
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001515static struct platform_device msm8064_device_saw_regulator_core0 = {
1516 .name = "saw-regulator",
1517 .id = 0,
1518 .dev = {
1519 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
1520 },
1521};
1522
1523static struct platform_device msm8064_device_saw_regulator_core1 = {
1524 .name = "saw-regulator",
1525 .id = 1,
1526 .dev = {
1527 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
1528 },
1529};
1530
1531static struct platform_device msm8064_device_saw_regulator_core2 = {
1532 .name = "saw-regulator",
1533 .id = 2,
1534 .dev = {
1535 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
1536 },
1537};
1538
1539static struct platform_device msm8064_device_saw_regulator_core3 = {
1540 .name = "saw-regulator",
1541 .id = 3,
1542 .dev = {
1543 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001544
1545 },
1546};
1547
Oluwafemi Adeyemif5a31422012-03-08 16:58:45 -08001548static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001549 {
1550 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1551 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1552 true,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001553 100, 650, 801, 200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001554 },
1555
1556 {
1557 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1558 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1559 true,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001560 2000, 200, 576000, 2000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001561 },
1562
1563 {
1564 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1565 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1566 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001567 8500, 51, 1122000, 8500,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001568 },
1569
1570 {
1571 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1572 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
1573 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001574 9000, 51, 1130300, 9000,
1575 },
1576 {
1577 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1578 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
1579 false,
1580 10000, 51, 1130300, 10000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001581 },
1582
1583 {
1584 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1585 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1586 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001587 12000, 14, 2205900, 12000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001588 },
1589
1590 {
1591 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1592 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1593 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001594 18000, 12, 2364250, 18000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001595 },
1596
1597 {
1598 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1599 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1600 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001601 23500, 10, 2667000, 23500,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001602 },
1603
1604 {
1605 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1606 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1607 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001608 29700, 5, 2867000, 30000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001609 },
1610};
1611
1612static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1613 .mode = MSM_PM_BOOT_CONFIG_TZ,
1614};
1615
1616static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
1617 .levels = &msm_rpmrs_levels[0],
1618 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
1619 .vdd_mem_levels = {
1620 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
1621 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
1622 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
1623 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
1624 },
1625 .vdd_dig_levels = {
1626 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
1627 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
1628 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
1629 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
1630 },
1631 .vdd_mask = 0x7FFFFF,
1632 .rpmrs_target_id = {
1633 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
1634 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
1635 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
1636 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
1637 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
1638 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
1639 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
1640 },
1641};
1642
Praveen Chidambaram78499012011-11-01 17:15:17 -06001643static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1644 0x03, 0x0f,
1645};
1646
1647static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1648 0x00, 0x24, 0x54, 0x10,
1649 0x09, 0x03, 0x01,
1650 0x10, 0x54, 0x30, 0x0C,
1651 0x24, 0x30, 0x0f,
1652};
1653
1654static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1655 0x00, 0x24, 0x54, 0x10,
1656 0x09, 0x07, 0x01, 0x0B,
1657 0x10, 0x54, 0x30, 0x0C,
1658 0x24, 0x30, 0x0f,
1659};
1660
1661static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1662 [0] = {
1663 .mode = MSM_SPM_MODE_CLOCK_GATING,
1664 .notify_rpm = false,
1665 .cmd = spm_wfi_cmd_sequence,
1666 },
1667 [1] = {
1668 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1669 .notify_rpm = false,
1670 .cmd = spm_power_collapse_without_rpm,
1671 },
1672 [2] = {
1673 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1674 .notify_rpm = true,
1675 .cmd = spm_power_collapse_with_rpm,
1676 },
1677};
1678
1679static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1680 0x00, 0x20, 0x03, 0x20,
1681 0x00, 0x0f,
1682};
1683
1684static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1685 0x00, 0x20, 0x34, 0x64,
1686 0x48, 0x07, 0x48, 0x20,
1687 0x50, 0x64, 0x04, 0x34,
1688 0x50, 0x0f,
1689};
1690static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1691 0x00, 0x10, 0x34, 0x64,
1692 0x48, 0x07, 0x48, 0x10,
1693 0x50, 0x64, 0x04, 0x34,
1694 0x50, 0x0F,
1695};
1696
1697static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1698 [0] = {
1699 .mode = MSM_SPM_L2_MODE_RETENTION,
1700 .notify_rpm = false,
1701 .cmd = l2_spm_wfi_cmd_sequence,
1702 },
1703 [1] = {
1704 .mode = MSM_SPM_L2_MODE_GDHS,
1705 .notify_rpm = true,
1706 .cmd = l2_spm_gdhs_cmd_sequence,
1707 },
1708 [2] = {
1709 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1710 .notify_rpm = true,
1711 .cmd = l2_spm_power_off_cmd_sequence,
1712 },
1713};
1714
1715
1716static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1717 [0] = {
1718 .reg_base_addr = MSM_SAW_L2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001719 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001720 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001721 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1722 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1723 .modes = msm_spm_l2_seq_list,
1724 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1725 },
1726};
1727
1728static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1729 [0] = {
1730 .reg_base_addr = MSM_SAW0_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001731 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001732#if defined(CONFIG_MSM_AVS_HW)
1733 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1734 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1735#endif
1736 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001737 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001738 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1739 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1740 .vctl_timeout_us = 50,
1741 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1742 .modes = msm_spm_seq_list,
1743 },
1744 [1] = {
1745 .reg_base_addr = MSM_SAW1_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001746 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001747#if defined(CONFIG_MSM_AVS_HW)
1748 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1749 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1750#endif
1751 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001752 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001753 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1754 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1755 .vctl_timeout_us = 50,
1756 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1757 .modes = msm_spm_seq_list,
1758 },
1759 [2] = {
1760 .reg_base_addr = MSM_SAW2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001761 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001762#if defined(CONFIG_MSM_AVS_HW)
1763 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1764 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1765#endif
1766 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001767 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001768 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1769 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1770 .vctl_timeout_us = 50,
1771 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1772 .modes = msm_spm_seq_list,
1773 },
1774 [3] = {
1775 .reg_base_addr = MSM_SAW3_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001776 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001777#if defined(CONFIG_MSM_AVS_HW)
1778 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1779 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1780#endif
1781 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001782 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001783 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1784 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1785 .vctl_timeout_us = 50,
1786 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1787 .modes = msm_spm_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001788 },
1789};
1790
Praveen Chidambaram4d19be42012-04-03 18:05:52 -06001791static struct msm_pm_sleep_status_data msm_pm_slp_sts_data = {
1792 .base_addr = MSM_ACC0_BASE + 0x08,
1793 .cpu_offset = MSM_ACC1_BASE - MSM_ACC0_BASE,
1794 .mask = 1UL << 13,
1795};
1796
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001797static void __init apq8064_init_buses(void)
1798{
1799 msm_bus_rpm_set_mt_mask();
1800 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
1801 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
1802 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
1803 msm_bus_8064_apps_fabric.dev.platform_data =
1804 &msm_bus_8064_apps_fabric_pdata;
1805 msm_bus_8064_sys_fabric.dev.platform_data =
1806 &msm_bus_8064_sys_fabric_pdata;
1807 msm_bus_8064_mm_fabric.dev.platform_data =
1808 &msm_bus_8064_mm_fabric_pdata;
1809 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
1810 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
1811}
1812
David Collinsf0d00732012-01-25 15:46:50 -08001813static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
1814 .name = GPIO_REGULATOR_DEV_NAME,
1815 .id = PM8921_MPP_PM_TO_SYS(7),
1816 .dev = {
1817 .platform_data
1818 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
1819 },
1820};
1821
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08001822static struct platform_device apq8064_device_ext_mpp8_vreg __devinitdata = {
1823 .name = GPIO_REGULATOR_DEV_NAME,
1824 .id = PM8921_MPP_PM_TO_SYS(8),
1825 .dev = {
1826 .platform_data
1827 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_MPP8],
1828 },
1829};
1830
David Collinsf0d00732012-01-25 15:46:50 -08001831static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
1832 .name = GPIO_REGULATOR_DEV_NAME,
1833 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
1834 .dev = {
1835 .platform_data =
1836 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
1837 },
1838};
1839
David Collins390fc332012-02-07 14:38:16 -08001840static struct platform_device apq8064_device_ext_ts_sw_vreg __devinitdata = {
1841 .name = GPIO_REGULATOR_DEV_NAME,
1842 .id = PM8921_GPIO_PM_TO_SYS(23),
1843 .dev = {
1844 .platform_data
1845 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_TS_SW],
1846 },
1847};
1848
David Collins2782b5c2012-02-06 10:02:42 -08001849static struct platform_device apq8064_device_rpm_regulator __devinitdata = {
1850 .name = "rpm-regulator",
1851 .id = -1,
1852 .dev = {
1853 .platform_data = &apq8064_rpm_regulator_pdata,
1854 },
1855};
1856
Ravi Kumar V05931a22012-04-04 17:09:37 +05301857static struct gpio_ir_recv_platform_data gpio_ir_recv_pdata = {
1858 .gpio_nr = 88,
1859 .active_low = 1,
1860};
1861
1862static struct platform_device gpio_ir_recv_pdev = {
1863 .name = "gpio-rc-recv",
1864 .dev = {
1865 .platform_data = &gpio_ir_recv_pdata,
1866 },
1867};
1868
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001869static struct platform_device *common_devices[] __initdata = {
Jin Hong01f2dbb2011-11-03 22:13:51 -07001870 &apq8064_device_dmov,
Terence Hampson2e1705f2012-04-11 19:55:29 -04001871#ifndef CONFIG_MSM_VCAP
David Keitel3c40fc52012-02-09 17:53:52 -08001872 &apq8064_device_qup_i2c_gsbi1,
Jing Lin04601f92012-02-05 15:36:07 -08001873 &apq8064_device_qup_i2c_gsbi3,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001874 &apq8064_device_qup_i2c_gsbi4,
Terence Hampson2e1705f2012-04-11 19:55:29 -04001875#endif
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001876 &apq8064_device_qup_spi_gsbi5,
David Collinsf0d00732012-01-25 15:46:50 -08001877 &apq8064_device_ext_5v_vreg,
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08001878 &apq8064_device_ext_mpp8_vreg,
David Collinsf0d00732012-01-25 15:46:50 -08001879 &apq8064_device_ext_3p3v_vreg,
David Collins390fc332012-02-07 14:38:16 -08001880 &apq8064_device_ext_ts_sw_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07001881 &apq8064_device_ssbi_pmic1,
1882 &apq8064_device_ssbi_pmic2,
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001883 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07001884 &apq8064_device_otg,
1885 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08001886 &apq8064_device_hsusb_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07001887 &android_usb_device,
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001888 &msm_device_wcnss_wlan,
Ankit Vermab7c26e62012-02-28 15:04:15 -08001889 &msm_device_iris_fm,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001890#ifdef CONFIG_ANDROID_PMEM
1891#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -07001892 &android_pmem_device,
1893 &android_pmem_adsp_device,
1894 &android_pmem_audio_device,
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -07001895#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
1896#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -08001897#ifdef CONFIG_ION_MSM
1898 &ion_dev,
1899#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001900 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001901 &msm8064_device_saw_regulator_core0,
1902 &msm8064_device_saw_regulator_core1,
1903 &msm8064_device_saw_regulator_core2,
1904 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001905#if defined(CONFIG_QSEECOM)
1906 &qseecom_device,
1907#endif
1908
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001909#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1910 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1911 &qcrypto_device,
1912#endif
1913
1914#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1915 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1916 &qcedev_device,
1917#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07001918
1919#ifdef CONFIG_HW_RANDOM_MSM
1920 &apq8064_device_rng,
1921#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08001922 &apq_pcm,
1923 &apq_pcm_routing,
1924 &apq_cpudai0,
1925 &apq_cpudai1,
Santosh Mardieff9a742012-04-09 23:23:39 +05301926 &mpq_cpudai_sec_i2s_rx,
Kuirong Wangf23f8c52012-03-31 12:34:51 -07001927 &mpq_cpudai_mi2s_tx,
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08001928 &apq_cpudai_hdmi_rx,
1929 &apq_cpudai_bt_rx,
1930 &apq_cpudai_bt_tx,
1931 &apq_cpudai_fm_rx,
1932 &apq_cpudai_fm_tx,
1933 &apq_cpu_fe,
1934 &apq_stub_codec,
1935 &apq_voice,
1936 &apq_voip,
1937 &apq_lpa_pcm,
Krishnankutty Kolathappilly4374e332012-03-18 22:27:30 -07001938 &apq_compr_dsp,
1939 &apq_multi_ch_pcm,
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08001940 &apq_pcm_hostless,
1941 &apq_cpudai_afe_01_rx,
1942 &apq_cpudai_afe_01_tx,
1943 &apq_cpudai_afe_02_rx,
1944 &apq_cpudai_afe_02_tx,
1945 &apq_pcm_afe,
1946 &apq_cpudai_auxpcm_rx,
1947 &apq_cpudai_auxpcm_tx,
Neema Shetty8427c262012-02-16 11:23:43 -08001948 &apq_cpudai_stub,
Neema Shetty3c9d2862012-03-11 01:25:32 -08001949 &apq_cpudai_slimbus_1_rx,
1950 &apq_cpudai_slimbus_1_tx,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07001951 &apq_cpudai_slimbus_2_tx,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001952 &apq8064_rpm_device,
1953 &apq8064_rpm_log_device,
1954 &apq8064_rpm_stat_device,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001955 &msm_bus_8064_apps_fabric,
1956 &msm_bus_8064_sys_fabric,
1957 &msm_bus_8064_mm_fabric,
1958 &msm_bus_8064_sys_fpb,
1959 &msm_bus_8064_cpss_fpb,
Mohan Kumar Gubbihalli Lachma Naik7f72edd2012-02-06 17:26:47 -08001960 &apq8064_msm_device_vidc,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07001961 &msm_pil_dsps,
Matt Wagantalled832652012-02-02 19:23:17 -08001962 &msm_8960_riva,
Matt Wagantallb94b9a52012-02-02 21:59:54 -08001963 &msm_8960_q6_lpass,
Stephen Boyd7b973de2012-03-09 12:26:16 -08001964 &msm_pil_vidc,
Matt Wagantall292aace2012-01-26 19:12:34 -08001965 &msm_gss,
Laura Abbott350c8362012-02-28 14:46:52 -08001966#ifdef CONFIG_MSM_RTB
1967 &msm_rtb_device,
1968#endif
Praveen Chidambaram8ea3dcd2011-12-07 14:46:31 -07001969 &apq8064_cpu_idle_device,
Praveen Chidambaram5c8adf22012-02-23 18:44:37 -07001970 &apq8064_msm_gov_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08001971 &apq8064_device_cache_erp,
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08001972 &epm_adc_device,
Pratik Patel212ab362012-03-16 12:30:07 -07001973 &apq8064_qdss_device,
1974 &msm_etb_device,
1975 &msm_tpiu_device,
1976 &msm_funnel_device,
1977 &apq8064_etm_device,
Helen Zeng8f925502012-03-05 16:50:17 -08001978 &apq_cpudai_slim_4_rx,
1979 &apq_cpudai_slim_4_tx,
Jignesh Mehta921649d2012-04-19 06:57:23 -07001980 &msm8960_gemini_device,
Laura Abbott0577d7b2012-04-17 11:14:30 -07001981 &apq8064_iommu_domain_device,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001982};
1983
Joel King4e7ad222011-08-17 15:47:38 -07001984static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001985 &apq8064_device_uart_gsbi3,
Yan He06913ce2011-08-26 16:33:46 -07001986 &msm_device_sps_apq8064,
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001987};
1988
1989static struct platform_device *rumi3_devices[] __initdata = {
1990 &apq8064_device_uart_gsbi1,
Yan He435ed612011-11-23 17:34:59 -08001991 &msm_device_sps_apq8064,
Huaibin Yang4a084e32011-12-15 15:25:52 -08001992#ifdef CONFIG_MSM_ROTATOR
1993 &msm_rotator_device,
1994#endif
Joel King4e7ad222011-08-17 15:47:38 -07001995};
1996
Joel King82b7e3f2012-01-05 10:03:27 -08001997static struct platform_device *cdp_devices[] __initdata = {
1998 &apq8064_device_uart_gsbi1,
Jin Hong4bbbfba2012-02-02 21:48:07 -08001999 &apq8064_device_uart_gsbi7,
Joel King82b7e3f2012-01-05 10:03:27 -08002000 &msm_device_sps_apq8064,
Aravind Venkateswaran4ca27532012-02-16 14:27:05 -08002001#ifdef CONFIG_MSM_ROTATOR
2002 &msm_rotator_device,
2003#endif
Joel King82b7e3f2012-01-05 10:03:27 -08002004};
2005
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002006static struct platform_device
2007mpq8064_device_ext_5v_frc_vreg __devinitdata = {
2008 .name = GPIO_REGULATOR_DEV_NAME,
2009 .id = SX150X_GPIO(4, 10),
2010 .dev = {
2011 .platform_data =
2012 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_FRC_5V],
2013 },
2014};
2015
2016static struct platform_device
2017mpq8064_device_ext_1p2_buck_vreg __devinitdata = {
2018 .name = GPIO_REGULATOR_DEV_NAME,
2019 .id = SX150X_GPIO(4, 2),
2020 .dev = {
2021 .platform_data =
2022 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P2V],
2023 },
2024};
2025
2026static struct platform_device
2027mpq8064_device_ext_1p8_buck_vreg __devinitdata = {
2028 .name = GPIO_REGULATOR_DEV_NAME,
2029 .id = SX150X_GPIO(4, 4),
2030 .dev = {
2031 .platform_data =
2032 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P8V],
2033 },
2034};
2035
2036static struct platform_device
2037mpq8064_device_ext_2p2_buck_vreg __devinitdata = {
2038 .name = GPIO_REGULATOR_DEV_NAME,
2039 .id = SX150X_GPIO(4, 14),
2040 .dev = {
2041 .platform_data =
2042 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_2P2V],
2043 },
2044};
2045
2046static struct platform_device
2047mpq8064_device_ext_5v_buck_vreg __devinitdata = {
2048 .name = GPIO_REGULATOR_DEV_NAME,
2049 .id = SX150X_GPIO(4, 3),
2050 .dev = {
2051 .platform_data =
2052 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_5V],
2053 },
2054};
2055
2056static struct platform_device
2057mpq8064_device_ext_3p3v_ldo_vreg __devinitdata = {
2058 .name = GPIO_REGULATOR_DEV_NAME,
2059 .id = SX150X_GPIO(4, 15),
2060 .dev = {
2061 .platform_data =
2062 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_3P3V],
2063 },
2064};
2065
2066static struct platform_device *mpq_devices[] __initdata = {
2067 &msm_device_sps_apq8064,
2068 &mpq8064_device_qup_i2c_gsbi5,
2069#ifdef CONFIG_MSM_ROTATOR
2070 &msm_rotator_device,
2071#endif
Ravi Kumar V05931a22012-04-04 17:09:37 +05302072 &gpio_ir_recv_pdev,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002073 &mpq8064_device_ext_5v_frc_vreg,
2074 &mpq8064_device_ext_1p2_buck_vreg,
2075 &mpq8064_device_ext_1p8_buck_vreg,
2076 &mpq8064_device_ext_2p2_buck_vreg,
2077 &mpq8064_device_ext_5v_buck_vreg,
2078 &mpq8064_device_ext_3p3v_ldo_vreg,
Terence Hampson2e1705f2012-04-11 19:55:29 -04002079#ifdef CONFIG_MSM_VCAP
2080 &msm8064_device_vcap,
2081#endif
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002082};
2083
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002084static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002085 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002086};
2087
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002088#define KS8851_IRQ_GPIO 43
2089
2090static struct spi_board_info spi_board_info[] __initdata = {
2091 {
2092 .modalias = "ks8851",
2093 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2094 .max_speed_hz = 19200000,
2095 .bus_num = 0,
2096 .chip_select = 2,
2097 .mode = SPI_MODE_0,
2098 },
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002099 {
2100 .modalias = "epm_adc",
2101 .max_speed_hz = 1100000,
2102 .bus_num = 0,
2103 .chip_select = 3,
2104 .mode = SPI_MODE_0,
2105 },
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002106};
2107
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002108static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002109 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08002110 .bus_num = 1,
2111 .slim_slave = &apq8064_slim_tabla,
2112 },
2113 {
2114 .bus_num = 1,
2115 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002116 },
2117 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002118};
2119
David Keitel3c40fc52012-02-09 17:53:52 -08002120static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi1_pdata = {
2121 .clk_freq = 100000,
2122 .src_clk_rate = 24000000,
2123};
2124
Jing Lin04601f92012-02-05 15:36:07 -08002125static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi3_pdata = {
Anirudh Ghayalc2163472012-04-10 14:58:14 +05302126 .clk_freq = 384000,
Jing Lin04601f92012-02-05 15:36:07 -08002127 .src_clk_rate = 24000000,
2128};
2129
Kenneth Heitke748593a2011-07-15 15:45:11 -06002130static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
2131 .clk_freq = 100000,
2132 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002133};
2134
Joel King8f839b92012-04-01 14:37:46 -07002135static struct msm_i2c_platform_data mpq8064_i2c_qup_gsbi5_pdata = {
2136 .clk_freq = 100000,
2137 .src_clk_rate = 24000000,
2138};
2139
David Keitel3c40fc52012-02-09 17:53:52 -08002140#define GSBI_DUAL_MODE_CODE 0x60
2141#define MSM_GSBI1_PHYS 0x12440000
Kenneth Heitke748593a2011-07-15 15:45:11 -06002142static void __init apq8064_i2c_init(void)
2143{
David Keitel3c40fc52012-02-09 17:53:52 -08002144 void __iomem *gsbi_mem;
2145
2146 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2147 &apq8064_i2c_qup_gsbi1_pdata;
2148 gsbi_mem = ioremap_nocache(MSM_GSBI1_PHYS, 4);
2149 writel_relaxed(GSBI_DUAL_MODE_CODE, gsbi_mem);
2150 /* Ensure protocol code is written before proceeding */
2151 wmb();
2152 iounmap(gsbi_mem);
2153 apq8064_i2c_qup_gsbi1_pdata.use_gsbi_shared_mode = 1;
Jing Lin04601f92012-02-05 15:36:07 -08002154 apq8064_device_qup_i2c_gsbi3.dev.platform_data =
2155 &apq8064_i2c_qup_gsbi3_pdata;
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002156 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2157 &apq8064_i2c_qup_gsbi1_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002158 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
2159 &apq8064_i2c_qup_gsbi4_pdata;
Joel King8f839b92012-04-01 14:37:46 -07002160 mpq8064_device_qup_i2c_gsbi5.dev.platform_data =
2161 &mpq8064_i2c_qup_gsbi5_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002162}
2163
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002164#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002165static int ethernet_init(void)
2166{
2167 int ret;
2168 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
2169 if (ret) {
2170 pr_err("ks8851 gpio_request failed: %d\n", ret);
2171 goto fail;
2172 }
2173
2174 return 0;
2175fail:
2176 return ret;
2177}
2178#else
2179static int ethernet_init(void)
2180{
2181 return 0;
2182}
2183#endif
2184
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302185#define GPIO_KEY_HOME PM8921_GPIO_PM_TO_SYS(27)
2186#define GPIO_KEY_VOLUME_UP PM8921_GPIO_PM_TO_SYS(35)
2187#define GPIO_KEY_VOLUME_DOWN PM8921_GPIO_PM_TO_SYS(38)
2188#define GPIO_KEY_CAM_FOCUS PM8921_GPIO_PM_TO_SYS(3)
2189#define GPIO_KEY_CAM_SNAP PM8921_GPIO_PM_TO_SYS(4)
Jing Lin3f8f8422012-03-05 09:32:11 -08002190#define GPIO_KEY_ROTATION PM8921_GPIO_PM_TO_SYS(42)
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302191
2192static struct gpio_keys_button cdp_keys[] = {
2193 {
2194 .code = KEY_HOME,
2195 .gpio = GPIO_KEY_HOME,
2196 .desc = "home_key",
2197 .active_low = 1,
2198 .type = EV_KEY,
2199 .wakeup = 1,
2200 .debounce_interval = 15,
2201 },
2202 {
2203 .code = KEY_VOLUMEUP,
2204 .gpio = GPIO_KEY_VOLUME_UP,
2205 .desc = "volume_up_key",
2206 .active_low = 1,
2207 .type = EV_KEY,
2208 .wakeup = 1,
2209 .debounce_interval = 15,
2210 },
2211 {
2212 .code = KEY_VOLUMEDOWN,
2213 .gpio = GPIO_KEY_VOLUME_DOWN,
2214 .desc = "volume_down_key",
2215 .active_low = 1,
2216 .type = EV_KEY,
2217 .wakeup = 1,
2218 .debounce_interval = 15,
2219 },
2220 {
2221 .code = SW_ROTATE_LOCK,
2222 .gpio = GPIO_KEY_ROTATION,
2223 .desc = "rotate_key",
2224 .active_low = 1,
2225 .type = EV_SW,
2226 .debounce_interval = 15,
2227 },
2228};
2229
2230static struct gpio_keys_platform_data cdp_keys_data = {
2231 .buttons = cdp_keys,
2232 .nbuttons = ARRAY_SIZE(cdp_keys),
2233};
2234
2235static struct platform_device cdp_kp_pdev = {
2236 .name = "gpio-keys",
2237 .id = -1,
2238 .dev = {
2239 .platform_data = &cdp_keys_data,
2240 },
2241};
2242
2243static struct gpio_keys_button mtp_keys[] = {
2244 {
2245 .code = KEY_CAMERA_FOCUS,
2246 .gpio = GPIO_KEY_CAM_FOCUS,
2247 .desc = "cam_focus_key",
2248 .active_low = 1,
2249 .type = EV_KEY,
2250 .wakeup = 1,
2251 .debounce_interval = 15,
2252 },
2253 {
2254 .code = KEY_VOLUMEUP,
2255 .gpio = GPIO_KEY_VOLUME_UP,
2256 .desc = "volume_up_key",
2257 .active_low = 1,
2258 .type = EV_KEY,
2259 .wakeup = 1,
2260 .debounce_interval = 15,
2261 },
2262 {
2263 .code = KEY_VOLUMEDOWN,
2264 .gpio = GPIO_KEY_VOLUME_DOWN,
2265 .desc = "volume_down_key",
2266 .active_low = 1,
2267 .type = EV_KEY,
2268 .wakeup = 1,
2269 .debounce_interval = 15,
2270 },
2271 {
2272 .code = KEY_CAMERA_SNAPSHOT,
2273 .gpio = GPIO_KEY_CAM_SNAP,
2274 .desc = "cam_snap_key",
2275 .active_low = 1,
2276 .type = EV_KEY,
2277 .debounce_interval = 15,
2278 },
2279};
2280
2281static struct gpio_keys_platform_data mtp_keys_data = {
2282 .buttons = mtp_keys,
2283 .nbuttons = ARRAY_SIZE(mtp_keys),
2284};
2285
2286static struct platform_device mtp_kp_pdev = {
2287 .name = "gpio-keys",
2288 .id = -1,
2289 .dev = {
2290 .platform_data = &mtp_keys_data,
2291 },
2292};
2293
Jin Hongd3024e62012-02-09 16:13:32 -08002294/* Sensors DSPS platform data */
2295#define DSPS_PIL_GENERIC_NAME "dsps"
2296static void __init apq8064_init_dsps(void)
2297{
2298 struct msm_dsps_platform_data *pdata =
2299 msm_dsps_device_8064.dev.platform_data;
2300 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
2301 pdata->gpios = NULL;
2302 pdata->gpios_num = 0;
2303
2304 platform_device_register(&msm_dsps_device_8064);
2305}
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302306
Jing Lin417fa452012-02-05 14:31:06 -08002307#define I2C_SURF 1
2308#define I2C_FFA (1 << 1)
2309#define I2C_RUMI (1 << 2)
2310#define I2C_SIM (1 << 3)
2311#define I2C_LIQUID (1 << 4)
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002312#define I2C_MPQ_CDP BIT(5)
2313#define I2C_MPQ_HRD BIT(6)
2314#define I2C_MPQ_DTV BIT(7)
Jing Lin417fa452012-02-05 14:31:06 -08002315
2316struct i2c_registry {
2317 u8 machs;
2318 int bus;
2319 struct i2c_board_info *info;
2320 int len;
2321};
2322
2323static struct i2c_registry apq8064_i2c_devices[] __initdata = {
Jing Lin21ed4de2012-02-05 15:53:28 -08002324 {
David Keitel2f613d92012-02-15 11:29:16 -08002325 I2C_LIQUID,
2326 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
2327 smb349_charger_i2c_info,
2328 ARRAY_SIZE(smb349_charger_i2c_info)
2329 },
Terence Hampson2e1705f2012-04-11 19:55:29 -04002330#ifndef CONFIG_MSM_VCAP
David Keitel2f613d92012-02-15 11:29:16 -08002331 {
Jing Lin21ed4de2012-02-05 15:53:28 -08002332 I2C_SURF | I2C_LIQUID,
2333 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
2334 mxt_device_info,
2335 ARRAY_SIZE(mxt_device_info),
2336 },
Terence Hampson2e1705f2012-04-11 19:55:29 -04002337#endif
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08002338 {
2339 I2C_FFA,
2340 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
2341 cyttsp_info,
2342 ARRAY_SIZE(cyttsp_info),
2343 },
Amy Maloche70090f992012-02-16 16:35:26 -08002344 {
2345 I2C_FFA | I2C_LIQUID,
2346 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
2347 isa1200_board_info,
2348 ARRAY_SIZE(isa1200_board_info),
2349 },
Santosh Mardieff9a742012-04-09 23:23:39 +05302350 {
2351 I2C_MPQ_CDP,
2352 APQ_8064_GSBI5_QUP_I2C_BUS_ID,
2353 cs8427_device_info,
2354 ARRAY_SIZE(cs8427_device_info),
2355 },
Jing Lin417fa452012-02-05 14:31:06 -08002356};
2357
Jay Chokshi607f61b2012-04-25 18:21:21 -07002358#define SX150X_EXP1_INT_N PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9)
2359
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002360struct sx150x_platform_data mpq8064_sx150x_pdata[] = {
2361 [SX150X_EXP1] = {
2362 .gpio_base = SX150X_EXP1_GPIO_BASE,
2363 .oscio_is_gpo = false,
2364 .io_pullup_ena = 0x0,
2365 .io_pulldn_ena = 0x0,
2366 .io_open_drain_ena = 0x0,
2367 .io_polarity = 0,
Jay Chokshi607f61b2012-04-25 18:21:21 -07002368 .irq_summary = SX150X_EXP1_INT_N,
2369 .irq_base = SX150X_EXP1_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002370 },
2371 [SX150X_EXP2] = {
2372 .gpio_base = SX150X_EXP2_GPIO_BASE,
2373 .oscio_is_gpo = false,
2374 .io_pullup_ena = 0x0,
2375 .io_pulldn_ena = 0x0,
2376 .io_open_drain_ena = 0x0,
2377 .io_polarity = 0,
2378 .irq_summary = -1,
2379 },
2380 [SX150X_EXP3] = {
2381 .gpio_base = SX150X_EXP3_GPIO_BASE,
2382 .oscio_is_gpo = false,
2383 .io_pullup_ena = 0x0,
2384 .io_pulldn_ena = 0x0,
2385 .io_open_drain_ena = 0x0,
2386 .io_polarity = 0,
2387 .irq_summary = -1,
2388 },
2389 [SX150X_EXP4] = {
2390 .gpio_base = SX150X_EXP4_GPIO_BASE,
2391 .oscio_is_gpo = false,
2392 .io_pullup_ena = 0x0,
2393 .io_pulldn_ena = 0x0,
2394 .io_open_drain_ena = 0x0,
2395 .io_polarity = 0,
2396 .irq_summary = -1,
2397 },
2398};
2399
2400static struct i2c_board_info sx150x_gpio_exp_info[] = {
2401 {
2402 I2C_BOARD_INFO("sx1509q", 0x70),
2403 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP1],
2404 },
2405 {
2406 I2C_BOARD_INFO("sx1508q", 0x23),
2407 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP2],
2408 },
2409 {
2410 I2C_BOARD_INFO("sx1508q", 0x22),
2411 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP3],
2412 },
2413 {
2414 I2C_BOARD_INFO("sx1509q", 0x3E),
2415 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP4],
2416 },
2417};
2418
2419#define MPQ8064_I2C_GSBI5_BUS_ID 5
2420
2421static struct i2c_registry mpq8064_i2c_devices[] __initdata = {
2422 {
2423 I2C_MPQ_CDP,
2424 MPQ8064_I2C_GSBI5_BUS_ID,
2425 sx150x_gpio_exp_info,
2426 ARRAY_SIZE(sx150x_gpio_exp_info),
2427 },
2428};
2429
Jing Lin417fa452012-02-05 14:31:06 -08002430static void __init register_i2c_devices(void)
2431{
2432 u8 mach_mask = 0;
2433 int i;
2434
Kevin Chand07220e2012-02-13 15:52:22 -08002435#ifdef CONFIG_MSM_CAMERA
2436 struct i2c_registry apq8064_camera_i2c_devices = {
2437 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_RUMI,
2438 APQ_8064_GSBI4_QUP_I2C_BUS_ID,
2439 apq8064_camera_board_info.board_info,
2440 apq8064_camera_board_info.num_i2c_board_info,
2441 };
2442#endif
Jing Lin417fa452012-02-05 14:31:06 -08002443 /* Build the matching 'supported_machs' bitmask */
2444 if (machine_is_apq8064_cdp())
2445 mach_mask = I2C_SURF;
2446 else if (machine_is_apq8064_mtp())
2447 mach_mask = I2C_FFA;
2448 else if (machine_is_apq8064_liquid())
2449 mach_mask = I2C_LIQUID;
2450 else if (machine_is_apq8064_rumi3())
2451 mach_mask = I2C_RUMI;
2452 else if (machine_is_apq8064_sim())
2453 mach_mask = I2C_SIM;
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002454 else if (PLATFORM_IS_MPQ8064())
2455 mach_mask = I2C_MPQ_CDP;
Jing Lin417fa452012-02-05 14:31:06 -08002456 else
2457 pr_err("unmatched machine ID in register_i2c_devices\n");
2458
2459 /* Run the array and install devices as appropriate */
2460 for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) {
2461 if (apq8064_i2c_devices[i].machs & mach_mask)
2462 i2c_register_board_info(apq8064_i2c_devices[i].bus,
2463 apq8064_i2c_devices[i].info,
2464 apq8064_i2c_devices[i].len);
2465 }
Kevin Chand07220e2012-02-13 15:52:22 -08002466#ifdef CONFIG_MSM_CAMERA
2467 if (apq8064_camera_i2c_devices.machs & mach_mask)
2468 i2c_register_board_info(apq8064_camera_i2c_devices.bus,
2469 apq8064_camera_i2c_devices.info,
2470 apq8064_camera_i2c_devices.len);
2471#endif
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002472
2473 for (i = 0; i < ARRAY_SIZE(mpq8064_i2c_devices); ++i) {
2474 if (mpq8064_i2c_devices[i].machs & mach_mask)
2475 i2c_register_board_info(
2476 mpq8064_i2c_devices[i].bus,
2477 mpq8064_i2c_devices[i].info,
2478 mpq8064_i2c_devices[i].len);
2479 }
Jing Lin417fa452012-02-05 14:31:06 -08002480}
2481
Jay Chokshi994ff122012-03-27 15:43:48 -07002482static void enable_ddr3_regulator(void)
2483{
2484 static struct regulator *ext_ddr3;
2485
2486 /* Use MPP7 output state as a flag for PCDDR3 presence. */
2487 if (gpio_get_value_cansleep(PM8921_MPP_PM_TO_SYS(7)) > 0) {
2488 ext_ddr3 = regulator_get(NULL, "ext_ddr3");
2489 if (IS_ERR(ext_ddr3) || ext_ddr3 == NULL)
2490 pr_err("Could not get MPP7 regulator\n");
2491 else
2492 regulator_enable(ext_ddr3);
2493 }
2494}
2495
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002496static void enable_avc_i2c_bus(void)
2497{
2498 int avc_i2c_en_mpp = PM8921_MPP_PM_TO_SYS(8);
2499 int rc;
2500
2501 rc = gpio_request(avc_i2c_en_mpp, "avc_i2c_en");
2502 if (rc)
2503 pr_err("request for avc_i2c_en mpp failed,"
2504 "rc=%d\n", rc);
2505 else
2506 gpio_set_value_cansleep(avc_i2c_en_mpp, 1);
2507}
2508
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002509static void __init apq8064_common_init(void)
2510{
Joel King8f839b92012-04-01 14:37:46 -07002511 msm_tsens_early_init(&apq_tsens_pdata);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002512 if (socinfo_init() < 0)
2513 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06002514 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
2515 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
David Collins2782b5c2012-02-06 10:02:42 -08002516 regulator_suppress_info_printing();
2517 platform_device_register(&apq8064_device_rpm_regulator);
Stephen Boyd4d0d2582012-02-10 14:49:40 -08002518 if (msm_xo_init())
2519 pr_err("Failed to initialize XO votes\n");
Matt Wagantallc51e5602012-02-27 17:25:25 -08002520 msm_clock_init(&apq8064_clock_init_data);
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08002521 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06002522 apq8064_i2c_init();
Jing Lin417fa452012-02-05 14:31:06 -08002523 register_i2c_devices();
Kenneth Heitke36920d32011-07-20 16:44:30 -06002524
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002525 apq8064_device_qup_spi_gsbi5.dev.platform_data =
2526 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08002527 apq8064_init_pmic();
Hemant Kumar94e7da22012-02-03 16:52:29 -08002528 if (machine_is_apq8064_liquid())
2529 msm_otg_pdata.mhl_enable = true;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07002530
2531 msm_otg_pdata.swfi_latency =
2532 msm_rpmrs_levels[0].latency_us + 1;
2533
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002534 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Manu Gautam91223e02011-11-08 15:27:22 +05302535 apq8064_ehci_host_init();
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002536 apq8064_init_buses();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002537 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Jay Chokshi994ff122012-03-27 15:43:48 -07002538 enable_ddr3_regulator();
Hemant Kumarf1ca9192012-02-07 18:59:33 -08002539 if (machine_is_apq8064_mtp()) {
2540 apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
2541 device_initialize(&apq8064_device_hsic_host.dev);
2542 }
Jay Chokshie8741282012-01-25 15:22:55 -08002543 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05302544 apq8064_init_mmc();
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08002545
2546 if (machine_is_apq8064_mtp()) {
2547 mdm_8064_device.dev.platform_data = &mdm_platform_data;
2548 platform_device_register(&mdm_8064_device);
2549 }
2550 platform_device_register(&apq8064_slim_ctrl);
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002551 slim_register_board_info(apq8064_slim_devices,
2552 ARRAY_SIZE(apq8064_slim_devices));
Jin Hongd3024e62012-02-09 16:13:32 -08002553 apq8064_init_dsps();
Praveen Chidambaram78499012011-11-01 17:15:17 -06002554 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Mahesh Sivasubramaniancbce1ec2012-01-24 10:32:44 -07002555 acpuclk_init(&acpuclk_8064_soc_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002556 msm_spm_l2_init(msm_spm_l2_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002557 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Praveen Chidambaram4d19be42012-04-03 18:05:52 -06002558 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002559 apq8064_epm_adc_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002560}
2561
Huaibin Yang4a084e32011-12-15 15:25:52 -08002562static void __init apq8064_allocate_memory_regions(void)
2563{
2564 apq8064_allocate_fb_region();
2565}
2566
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002567static void __init apq8064_sim_init(void)
2568{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002569 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
2570 &msm8064_device_watchdog.dev.platform_data;
2571
2572 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002573 apq8064_common_init();
Joel King4e7ad222011-08-17 15:47:38 -07002574 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
2575}
2576
2577static void __init apq8064_rumi3_init(void)
2578{
2579 apq8064_common_init();
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002580 ethernet_init();
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002581 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002582 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002583}
2584
Joel King82b7e3f2012-01-05 10:03:27 -08002585static void __init apq8064_cdp_init(void)
2586{
Hanumant Singh50440d42012-04-23 19:27:16 -07002587 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2588 pr_err("meminfo_init() failed!\n");
Joel King82b7e3f2012-01-05 10:03:27 -08002589 apq8064_common_init();
Joel King8f839b92012-04-01 14:37:46 -07002590 if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
2591 machine_is_mpq8064_dtv()) {
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002592 enable_avc_i2c_bus();
Joel King8f839b92012-04-01 14:37:46 -07002593 platform_add_devices(mpq_devices, ARRAY_SIZE(mpq_devices));
2594 } else {
2595 ethernet_init();
2596 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
2597 spi_register_board_info(spi_board_info,
2598 ARRAY_SIZE(spi_board_info));
2599 }
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002600 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07002601 apq8064_init_gpu();
Matt Wagantall1875d322012-02-22 16:11:33 -08002602 platform_add_devices(apq8064_fs_devices, apq8064_num_fs_devices);
Kevin Chand07220e2012-02-13 15:52:22 -08002603 apq8064_init_cam();
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302604
2605 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
2606 platform_device_register(&cdp_kp_pdev);
2607
2608 if (machine_is_apq8064_mtp())
2609 platform_device_register(&mtp_kp_pdev);
Hanumant Singh50440d42012-04-23 19:27:16 -07002610
2611 change_memory_power = &apq8064_change_memory_power;
Joel King82b7e3f2012-01-05 10:03:27 -08002612}
2613
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002614MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
2615 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002616 .reserve = apq8064_reserve,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002617 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302618 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002619 .timer = &msm_timer,
2620 .init_machine = apq8064_sim_init,
2621MACHINE_END
2622
Joel King4e7ad222011-08-17 15:47:38 -07002623MACHINE_START(APQ8064_RUMI3, "QCT APQ8064 RUMI3")
2624 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002625 .reserve = apq8064_reserve,
Joel King4e7ad222011-08-17 15:47:38 -07002626 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302627 .handle_irq = gic_handle_irq,
Joel King4e7ad222011-08-17 15:47:38 -07002628 .timer = &msm_timer,
2629 .init_machine = apq8064_rumi3_init,
Huaibin Yang4a084e32011-12-15 15:25:52 -08002630 .init_early = apq8064_allocate_memory_regions,
Joel King4e7ad222011-08-17 15:47:38 -07002631MACHINE_END
2632
Joel King82b7e3f2012-01-05 10:03:27 -08002633MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
2634 .map_io = apq8064_map_io,
2635 .reserve = apq8064_reserve,
2636 .init_irq = apq8064_init_irq,
2637 .handle_irq = gic_handle_irq,
2638 .timer = &msm_timer,
2639 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002640 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07002641 .init_very_early = apq8064_early_reserve,
Joel King82b7e3f2012-01-05 10:03:27 -08002642MACHINE_END
2643
2644MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
2645 .map_io = apq8064_map_io,
2646 .reserve = apq8064_reserve,
2647 .init_irq = apq8064_init_irq,
2648 .handle_irq = gic_handle_irq,
2649 .timer = &msm_timer,
2650 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002651 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07002652 .init_very_early = apq8064_early_reserve,
Joel King82b7e3f2012-01-05 10:03:27 -08002653MACHINE_END
2654
2655MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
2656 .map_io = apq8064_map_io,
2657 .reserve = apq8064_reserve,
2658 .init_irq = apq8064_init_irq,
2659 .handle_irq = gic_handle_irq,
2660 .timer = &msm_timer,
2661 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002662 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07002663 .init_very_early = apq8064_early_reserve,
Joel King82b7e3f2012-01-05 10:03:27 -08002664MACHINE_END
2665
Joel King064bbf82012-04-01 13:23:39 -07002666MACHINE_START(MPQ8064_CDP, "QCT MPQ8064 CDP")
2667 .map_io = apq8064_map_io,
2668 .reserve = apq8064_reserve,
2669 .init_irq = apq8064_init_irq,
2670 .handle_irq = gic_handle_irq,
2671 .timer = &msm_timer,
2672 .init_machine = apq8064_cdp_init,
2673 .init_early = apq8064_allocate_memory_regions,
2674 .init_very_early = apq8064_early_reserve,
2675MACHINE_END
2676
Joel King11ca8202012-02-13 16:19:03 -08002677MACHINE_START(MPQ8064_HRD, "QCT MPQ8064 HRD")
2678 .map_io = apq8064_map_io,
2679 .reserve = apq8064_reserve,
2680 .init_irq = apq8064_init_irq,
2681 .handle_irq = gic_handle_irq,
2682 .timer = &msm_timer,
2683 .init_machine = apq8064_cdp_init,
Laura Abbott6988cef2012-03-15 14:27:13 -07002684 .init_very_early = apq8064_early_reserve,
Joel King11ca8202012-02-13 16:19:03 -08002685MACHINE_END
2686
2687MACHINE_START(MPQ8064_DTV, "QCT MPQ8064 DTV")
2688 .map_io = apq8064_map_io,
2689 .reserve = apq8064_reserve,
2690 .init_irq = apq8064_init_irq,
2691 .handle_irq = gic_handle_irq,
2692 .timer = &msm_timer,
2693 .init_machine = apq8064_cdp_init,
Laura Abbott6988cef2012-03-15 14:27:13 -07002694 .init_very_early = apq8064_early_reserve,
Joel King11ca8202012-02-13 16:19:03 -08002695MACHINE_END
2696