blob: 74477a35ec482f6c770e72b78b9f74fc4bfe8013 [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"
Jay Chokshiea67c622011-07-29 17:12:26 -070080
Olav Haugan7c6aa742012-01-16 16:47:37 -080081#define MSM_PMEM_ADSP_SIZE 0x7800000
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -070082#define MSM_PMEM_AUDIO_SIZE 0x4CF000
Olav Haugan7c6aa742012-01-16 16:47:37 -080083#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
84#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
85#else
Chetan Kalyan72aac4f2012-02-23 14:56:54 -080086#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Olav Haugan7c6aa742012-01-16 16:47:37 -080087#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070088
Olav Haugan7c6aa742012-01-16 16:47:37 -080089#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -070090#define MSM_PMEM_KERNEL_EBI1_SIZE 0x65000
Olav Haugan129992c2012-03-22 09:54:01 -070091#ifdef CONFIG_MSM_IOMMU
92#define MSM_ION_MM_SIZE 0x3800000
93#define MSM_ION_SF_SIZE 0
94#define MSM_ION_HEAP_NUM 7
95#else
Olav Haugan7c6aa742012-01-16 16:47:37 -080096#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Haugan129992c2012-03-22 09:54:01 -070097#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
98#define MSM_ION_HEAP_NUM 8
99#endif
100#define MSM_ION_MM_FW_SIZE 0x200000 /* (2MB) */
Olav Haugan3a9bd232012-02-15 14:23:27 -0800101#define MSM_ION_QSECOM_SIZE 0x300000 /* (3MB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800102#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan2c43fac2012-01-19 11:06:37 -0800103#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Olav Haugan7c6aa742012-01-16 16:47:37 -0800104#else
105#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
106#define MSM_ION_HEAP_NUM 1
107#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700108
Olav Haugan7c6aa742012-01-16 16:47:37 -0800109#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
110static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
111static int __init pmem_kernel_ebi1_size_setup(char *p)
Kevin Chan13be4e22011-10-20 11:30:32 -0700112{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800113 pmem_kernel_ebi1_size = memparse(p, NULL);
114 return 0;
Kevin Chan13be4e22011-10-20 11:30:32 -0700115}
Olav Haugan7c6aa742012-01-16 16:47:37 -0800116early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
117#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700118
Olav Haugan7c6aa742012-01-16 16:47:37 -0800119#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -0700120static unsigned pmem_size = MSM_PMEM_SIZE;
121static int __init pmem_size_setup(char *p)
122{
123 pmem_size = memparse(p, NULL);
124 return 0;
125}
126early_param("pmem_size", pmem_size_setup);
127
128static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
129
130static int __init pmem_adsp_size_setup(char *p)
131{
132 pmem_adsp_size = memparse(p, NULL);
133 return 0;
134}
135early_param("pmem_adsp_size", pmem_adsp_size_setup);
136
137static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
138
139static int __init pmem_audio_size_setup(char *p)
140{
141 pmem_audio_size = memparse(p, NULL);
142 return 0;
143}
144early_param("pmem_audio_size", pmem_audio_size_setup);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800145#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700146
Olav Haugan7c6aa742012-01-16 16:47:37 -0800147#ifdef CONFIG_ANDROID_PMEM
148#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700149static struct android_pmem_platform_data android_pmem_pdata = {
150 .name = "pmem",
151 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
152 .cached = 1,
153 .memory_type = MEMTYPE_EBI1,
154};
155
156static struct platform_device android_pmem_device = {
157 .name = "android_pmem",
158 .id = 0,
159 .dev = {.platform_data = &android_pmem_pdata},
160};
161
162static struct android_pmem_platform_data android_pmem_adsp_pdata = {
163 .name = "pmem_adsp",
164 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
165 .cached = 0,
166 .memory_type = MEMTYPE_EBI1,
167};
Kevin Chan13be4e22011-10-20 11:30:32 -0700168static struct platform_device android_pmem_adsp_device = {
169 .name = "android_pmem",
170 .id = 2,
171 .dev = { .platform_data = &android_pmem_adsp_pdata },
172};
173
174static struct android_pmem_platform_data android_pmem_audio_pdata = {
175 .name = "pmem_audio",
176 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
177 .cached = 0,
178 .memory_type = MEMTYPE_EBI1,
179};
180
181static struct platform_device android_pmem_audio_device = {
182 .name = "android_pmem",
183 .id = 4,
184 .dev = { .platform_data = &android_pmem_audio_pdata },
185};
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700186#endif /* CONFIG_MSM_MULTIMEDIA_USE_ION */
187#endif /* CONFIG_ANDROID_PMEM */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800188
189static struct memtype_reserve apq8064_reserve_table[] __initdata = {
190 [MEMTYPE_SMI] = {
191 },
192 [MEMTYPE_EBI0] = {
193 .flags = MEMTYPE_FLAGS_1M_ALIGN,
194 },
195 [MEMTYPE_EBI1] = {
196 .flags = MEMTYPE_FLAGS_1M_ALIGN,
197 },
198};
Kevin Chan13be4e22011-10-20 11:30:32 -0700199
Laura Abbott350c8362012-02-28 14:46:52 -0800200#if defined(CONFIG_MSM_RTB)
201static struct msm_rtb_platform_data msm_rtb_pdata = {
202 .size = SZ_1M,
203};
204
205static int __init msm_rtb_set_buffer_size(char *p)
206{
207 int s;
208
209 s = memparse(p, NULL);
210 msm_rtb_pdata.size = ALIGN(s, SZ_4K);
211 return 0;
212}
213early_param("msm_rtb_size", msm_rtb_set_buffer_size);
214
215
216static struct platform_device msm_rtb_device = {
217 .name = "msm_rtb",
218 .id = -1,
219 .dev = {
220 .platform_data = &msm_rtb_pdata,
221 },
222};
223#endif
224
225static void __init reserve_rtb_memory(void)
226{
227#if defined(CONFIG_MSM_RTB)
228 apq8064_reserve_table[MEMTYPE_EBI1].size += msm_rtb_pdata.size;
229#endif
230}
231
232
Kevin Chan13be4e22011-10-20 11:30:32 -0700233static void __init size_pmem_devices(void)
234{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800235#ifdef CONFIG_ANDROID_PMEM
236#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700237 android_pmem_adsp_pdata.size = pmem_adsp_size;
238 android_pmem_pdata.size = pmem_size;
239 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700240#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
241#endif /*CONFIG_ANDROID_PMEM*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700242}
243
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700244#ifdef CONFIG_ANDROID_PMEM
245#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700246static void __init reserve_memory_for(struct android_pmem_platform_data *p)
247{
248 apq8064_reserve_table[p->memory_type].size += p->size;
249}
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700250#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
251#endif /*CONFIG_ANDROID_PMEM*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700252
Kevin Chan13be4e22011-10-20 11:30:32 -0700253static void __init reserve_pmem_memory(void)
254{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800255#ifdef CONFIG_ANDROID_PMEM
256#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700257 reserve_memory_for(&android_pmem_adsp_pdata);
258 reserve_memory_for(&android_pmem_pdata);
259 reserve_memory_for(&android_pmem_audio_pdata);
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700260#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700261 apq8064_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700262#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -0800263}
264
265static int apq8064_paddr_to_memtype(unsigned int paddr)
266{
267 return MEMTYPE_EBI1;
268}
269
270#ifdef CONFIG_ION_MSM
271#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
272static struct ion_cp_heap_pdata cp_mm_ion_pdata = {
273 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugand3d29682012-01-19 10:57:07 -0800274 .align = PAGE_SIZE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800275};
276
277static struct ion_cp_heap_pdata cp_mfc_ion_pdata = {
278 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugand3d29682012-01-19 10:57:07 -0800279 .align = PAGE_SIZE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800280};
281
282static struct ion_co_heap_pdata co_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800283 .adjacent_mem_id = INVALID_HEAP_ID,
284 .align = PAGE_SIZE,
285};
286
287static struct ion_co_heap_pdata fw_co_ion_pdata = {
288 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
289 .align = SZ_128K,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800290};
291#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800292
293/**
294 * These heaps are listed in the order they will be allocated. Due to
295 * video hardware restrictions and content protection the FW heap has to
296 * be allocated adjacent (below) the MM heap and the MFC heap has to be
297 * allocated after the MM heap to ensure MFC heap is not more than 256MB
298 * away from the base address of the FW heap.
299 * However, the order of FW heap and MM heap doesn't matter since these
300 * two heaps are taken care of by separate code to ensure they are adjacent
301 * to each other.
302 * Don't swap the order unless you know what you are doing!
303 */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800304static struct ion_platform_data ion_pdata = {
305 .nr = MSM_ION_HEAP_NUM,
306 .heaps = {
307 {
308 .id = ION_SYSTEM_HEAP_ID,
309 .type = ION_HEAP_TYPE_SYSTEM,
310 .name = ION_VMALLOC_HEAP_NAME,
311 },
312#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
313 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800314 .id = ION_CP_MM_HEAP_ID,
315 .type = ION_HEAP_TYPE_CP,
316 .name = ION_MM_HEAP_NAME,
317 .size = MSM_ION_MM_SIZE,
318 .memory_type = ION_EBI_TYPE,
319 .extra_data = (void *) &cp_mm_ion_pdata,
320 },
321 {
Olav Haugand3d29682012-01-19 10:57:07 -0800322 .id = ION_MM_FIRMWARE_HEAP_ID,
323 .type = ION_HEAP_TYPE_CARVEOUT,
324 .name = ION_MM_FIRMWARE_HEAP_NAME,
325 .size = MSM_ION_MM_FW_SIZE,
326 .memory_type = ION_EBI_TYPE,
327 .extra_data = (void *) &fw_co_ion_pdata,
328 },
329 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800330 .id = ION_CP_MFC_HEAP_ID,
331 .type = ION_HEAP_TYPE_CP,
332 .name = ION_MFC_HEAP_NAME,
333 .size = MSM_ION_MFC_SIZE,
334 .memory_type = ION_EBI_TYPE,
335 .extra_data = (void *) &cp_mfc_ion_pdata,
336 },
Olav Haugan129992c2012-03-22 09:54:01 -0700337#ifndef CONFIG_MSM_IOMMU
Olav Haugan7c6aa742012-01-16 16:47:37 -0800338 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800339 .id = ION_SF_HEAP_ID,
340 .type = ION_HEAP_TYPE_CARVEOUT,
341 .name = ION_SF_HEAP_NAME,
342 .size = MSM_ION_SF_SIZE,
343 .memory_type = ION_EBI_TYPE,
344 .extra_data = (void *) &co_ion_pdata,
345 },
Olav Haugan129992c2012-03-22 09:54:01 -0700346#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800347 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800348 .id = ION_IOMMU_HEAP_ID,
349 .type = ION_HEAP_TYPE_IOMMU,
350 .name = ION_IOMMU_HEAP_NAME,
351 },
Olav Hauganf45e2142012-01-19 11:01:01 -0800352 {
353 .id = ION_QSECOM_HEAP_ID,
354 .type = ION_HEAP_TYPE_CARVEOUT,
355 .name = ION_QSECOM_HEAP_NAME,
356 .size = MSM_ION_QSECOM_SIZE,
357 .memory_type = ION_EBI_TYPE,
358 .extra_data = (void *) &co_ion_pdata,
359 },
Olav Haugan2c43fac2012-01-19 11:06:37 -0800360 {
361 .id = ION_AUDIO_HEAP_ID,
362 .type = ION_HEAP_TYPE_CARVEOUT,
363 .name = ION_AUDIO_HEAP_NAME,
364 .size = MSM_ION_AUDIO_SIZE,
365 .memory_type = ION_EBI_TYPE,
366 .extra_data = (void *) &co_ion_pdata,
367 },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800368#endif
369 }
370};
371
372static struct platform_device ion_dev = {
373 .name = "ion-msm",
374 .id = 1,
375 .dev = { .platform_data = &ion_pdata },
376};
377#endif
378
379static void reserve_ion_memory(void)
380{
381#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
382 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_SIZE;
Olav Haugand3d29682012-01-19 10:57:07 -0800383 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_FW_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800384 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_SF_SIZE;
385 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MFC_SIZE;
Olav Hauganf45e2142012-01-19 11:01:01 -0800386 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_QSECOM_SIZE;
Olav Haugan2c43fac2012-01-19 11:06:37 -0800387 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_AUDIO_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800388#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700389}
390
Huaibin Yang4a084e32011-12-15 15:25:52 -0800391static void __init reserve_mdp_memory(void)
392{
393 apq8064_mdp_writeback(apq8064_reserve_table);
394}
395
Kevin Chan13be4e22011-10-20 11:30:32 -0700396static void __init apq8064_calculate_reserve_sizes(void)
397{
398 size_pmem_devices();
399 reserve_pmem_memory();
Olav Haugan7c6aa742012-01-16 16:47:37 -0800400 reserve_ion_memory();
Huaibin Yang4a084e32011-12-15 15:25:52 -0800401 reserve_mdp_memory();
Laura Abbott350c8362012-02-28 14:46:52 -0800402 reserve_rtb_memory();
Kevin Chan13be4e22011-10-20 11:30:32 -0700403}
404
405static struct reserve_info apq8064_reserve_info __initdata = {
406 .memtype_reserve_table = apq8064_reserve_table,
407 .calculate_reserve_sizes = apq8064_calculate_reserve_sizes,
408 .paddr_to_memtype = apq8064_paddr_to_memtype,
409};
410
411static int apq8064_memory_bank_size(void)
412{
413 return 1<<29;
414}
415
416static void __init locate_unstable_memory(void)
417{
418 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
419 unsigned long bank_size;
420 unsigned long low, high;
421
422 bank_size = apq8064_memory_bank_size();
423 low = meminfo.bank[0].start;
424 high = mb->start + mb->size;
Olav Haugand76e3a82012-01-16 16:55:07 -0800425
426 /* Check if 32 bit overflow occured */
427 if (high < mb->start)
428 high = ~0UL;
429
Kevin Chan13be4e22011-10-20 11:30:32 -0700430 low &= ~(bank_size - 1);
431
432 if (high - low <= bank_size)
433 return;
Jack Cheung46bfffa2012-01-19 15:26:24 -0800434 apq8064_reserve_info.low_unstable_address = mb->start -
435 MIN_MEMORY_BLOCK_SIZE + mb->size;
436 apq8064_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
437
Kevin Chan13be4e22011-10-20 11:30:32 -0700438 apq8064_reserve_info.bank_size = bank_size;
439 pr_info("low unstable address %lx max size %lx bank size %lx\n",
440 apq8064_reserve_info.low_unstable_address,
441 apq8064_reserve_info.max_unstable_size,
442 apq8064_reserve_info.bank_size);
443}
444
Aravind Venkateswaran8ac7f412012-03-16 17:57:30 -0700445static char prim_panel_name[PANEL_NAME_MAX_LEN];
446static char ext_panel_name[PANEL_NAME_MAX_LEN];
447static int __init prim_display_setup(char *param)
448{
449 if (strnlen(param, PANEL_NAME_MAX_LEN))
450 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
451 return 0;
452}
453early_param("prim_display", prim_display_setup);
454
455static int __init ext_display_setup(char *param)
456{
457 if (strnlen(param, PANEL_NAME_MAX_LEN))
458 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
459 return 0;
460}
461early_param("ext_display", ext_display_setup);
462
Kevin Chan13be4e22011-10-20 11:30:32 -0700463static void __init apq8064_reserve(void)
464{
Aravind Venkateswaran8ac7f412012-03-16 17:57:30 -0700465 apq8064_set_display_params(prim_panel_name, ext_panel_name);
Kevin Chan13be4e22011-10-20 11:30:32 -0700466 msm_reserve();
467}
468
Laura Abbott6988cef2012-03-15 14:27:13 -0700469static void __init place_movable_zone(void)
470{
471 movable_reserved_start = apq8064_reserve_info.low_unstable_address;
472 movable_reserved_size = apq8064_reserve_info.max_unstable_size;
473 pr_info("movable zone start %lx size %lx\n",
474 movable_reserved_start, movable_reserved_size);
475}
476
477static void __init apq8064_early_reserve(void)
478{
479 reserve_info = &apq8064_reserve_info;
480 locate_unstable_memory();
481 place_movable_zone();
482
483}
Hemant Kumara945b472012-01-25 15:08:06 -0800484#ifdef CONFIG_USB_EHCI_MSM_HSIC
Hemant Kumare6275972012-02-29 20:06:21 -0800485/* Bandwidth requests (zero) if no vote placed */
486static struct msm_bus_vectors hsic_init_vectors[] = {
487 {
488 .src = MSM_BUS_MASTER_SPS,
489 .dst = MSM_BUS_SLAVE_EBI_CH0,
490 .ab = 0,
491 .ib = 0,
492 },
493 {
494 .src = MSM_BUS_MASTER_SPS,
495 .dst = MSM_BUS_SLAVE_SPS,
496 .ab = 0,
497 .ib = 0,
498 },
499};
500
501/* Bus bandwidth requests in Bytes/sec */
502static struct msm_bus_vectors hsic_max_vectors[] = {
503 {
504 .src = MSM_BUS_MASTER_SPS,
505 .dst = MSM_BUS_SLAVE_EBI_CH0,
506 .ab = 60000000, /* At least 480Mbps on bus. */
507 .ib = 960000000, /* MAX bursts rate */
508 },
509 {
510 .src = MSM_BUS_MASTER_SPS,
511 .dst = MSM_BUS_SLAVE_SPS,
512 .ab = 0,
513 .ib = 512000000, /*vote for 64Mhz dfab clk rate*/
514 },
515};
516
517static struct msm_bus_paths hsic_bus_scale_usecases[] = {
518 {
519 ARRAY_SIZE(hsic_init_vectors),
520 hsic_init_vectors,
521 },
522 {
523 ARRAY_SIZE(hsic_max_vectors),
524 hsic_max_vectors,
525 },
526};
527
528static struct msm_bus_scale_pdata hsic_bus_scale_pdata = {
529 hsic_bus_scale_usecases,
530 ARRAY_SIZE(hsic_bus_scale_usecases),
531 .name = "hsic",
532};
533
Hemant Kumara945b472012-01-25 15:08:06 -0800534static struct msm_hsic_host_platform_data msm_hsic_pdata = {
Hemant Kumare6275972012-02-29 20:06:21 -0800535 .strobe = 88,
536 .data = 89,
537 .bus_scale_table = &hsic_bus_scale_pdata,
Hemant Kumara945b472012-01-25 15:08:06 -0800538};
539#else
540static struct msm_hsic_host_platform_data msm_hsic_pdata;
541#endif
542
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800543#define PID_MAGIC_ID 0x71432909
544#define SERIAL_NUM_MAGIC_ID 0x61945374
545#define SERIAL_NUMBER_LENGTH 127
546#define DLOAD_USB_BASE_ADD 0x2A03F0C8
547
548struct magic_num_struct {
549 uint32_t pid;
550 uint32_t serial_num;
551};
552
553struct dload_struct {
554 uint32_t reserved1;
555 uint32_t reserved2;
556 uint32_t reserved3;
557 uint16_t reserved4;
558 uint16_t pid;
559 char serial_number[SERIAL_NUMBER_LENGTH];
560 uint16_t reserved5;
561 struct magic_num_struct magic_struct;
562};
563
564static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
565{
566 struct dload_struct __iomem *dload = 0;
567
568 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
569 if (!dload) {
570 pr_err("%s: cannot remap I/O memory region: %08x\n",
571 __func__, DLOAD_USB_BASE_ADD);
572 return -ENXIO;
573 }
574
575 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
576 __func__, dload, pid, snum);
577 /* update pid */
578 dload->magic_struct.pid = PID_MAGIC_ID;
579 dload->pid = pid;
580
581 /* update serial number */
582 dload->magic_struct.serial_num = 0;
583 if (!snum) {
584 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
585 goto out;
586 }
587
588 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
589 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
590out:
591 iounmap(dload);
592 return 0;
593}
594
595static struct android_usb_platform_data android_usb_pdata = {
596 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
597};
598
Hemant Kumar4933b072011-10-17 23:43:11 -0700599static struct platform_device android_usb_device = {
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800600 .name = "android_usb",
601 .id = -1,
602 .dev = {
603 .platform_data = &android_usb_pdata,
604 },
Hemant Kumar4933b072011-10-17 23:43:11 -0700605};
606
Hemant Kumar7620eed2012-02-26 09:08:43 -0800607/* Bandwidth requests (zero) if no vote placed */
608static struct msm_bus_vectors usb_init_vectors[] = {
609 {
610 .src = MSM_BUS_MASTER_SPS,
611 .dst = MSM_BUS_SLAVE_EBI_CH0,
612 .ab = 0,
613 .ib = 0,
614 },
615};
616
617/* Bus bandwidth requests in Bytes/sec */
618static struct msm_bus_vectors usb_max_vectors[] = {
619 {
620 .src = MSM_BUS_MASTER_SPS,
621 .dst = MSM_BUS_SLAVE_EBI_CH0,
622 .ab = 60000000, /* At least 480Mbps on bus. */
623 .ib = 960000000, /* MAX bursts rate */
624 },
625};
626
627static struct msm_bus_paths usb_bus_scale_usecases[] = {
628 {
629 ARRAY_SIZE(usb_init_vectors),
630 usb_init_vectors,
631 },
632 {
633 ARRAY_SIZE(usb_max_vectors),
634 usb_max_vectors,
635 },
636};
637
638static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
639 usb_bus_scale_usecases,
640 ARRAY_SIZE(usb_bus_scale_usecases),
641 .name = "usb",
642};
643
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700644static int phy_init_seq[] = {
645 0x38, 0x81, /* update DC voltage level */
646 0x24, 0x82, /* set pre-emphasis and rise/fall time */
647 -1
648};
649
Hemant Kumar4933b072011-10-17 23:43:11 -0700650static struct msm_otg_platform_data msm_otg_pdata = {
Hemant Kumard86c4882012-01-24 19:39:37 -0800651 .mode = USB_OTG,
652 .otg_control = OTG_PMIC_CONTROL,
Hemant Kumar4933b072011-10-17 23:43:11 -0700653 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Hemant Kumard86c4882012-01-24 19:39:37 -0800654 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
655 .power_budget = 750,
Hemant Kumar7620eed2012-02-26 09:08:43 -0800656 .bus_scale_table = &usb_bus_scale_pdata,
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700657 .phy_init_seq = phy_init_seq,
Hemant Kumar4933b072011-10-17 23:43:11 -0700658};
659
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800660static struct msm_usb_host_platform_data msm_ehci_host_pdata3 = {
Manu Gautam91223e02011-11-08 15:27:22 +0530661 .power_budget = 500,
662};
663
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800664#ifdef CONFIG_USB_EHCI_MSM_HOST4
665static struct msm_usb_host_platform_data msm_ehci_host_pdata4;
666#endif
667
Manu Gautam91223e02011-11-08 15:27:22 +0530668static void __init apq8064_ehci_host_init(void)
669{
670 if (machine_is_apq8064_liquid()) {
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800671 msm_ehci_host_pdata3.dock_connect_irq =
Hemant Kumar56925352012-02-13 16:59:52 -0800672 PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9);
673
Manu Gautam91223e02011-11-08 15:27:22 +0530674 apq8064_device_ehci_host3.dev.platform_data =
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800675 &msm_ehci_host_pdata3;
Manu Gautam91223e02011-11-08 15:27:22 +0530676 platform_device_register(&apq8064_device_ehci_host3);
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800677
678#ifdef CONFIG_USB_EHCI_MSM_HOST4
679 apq8064_device_ehci_host4.dev.platform_data =
680 &msm_ehci_host_pdata4;
681 platform_device_register(&apq8064_device_ehci_host4);
682#endif
Manu Gautam91223e02011-11-08 15:27:22 +0530683 }
684}
685
David Keitel2f613d92012-02-15 11:29:16 -0800686static struct smb349_platform_data smb349_data __initdata = {
687 .en_n_gpio = PM8921_GPIO_PM_TO_SYS(37),
688 .chg_susp_gpio = PM8921_GPIO_PM_TO_SYS(30),
689 .chg_current_ma = 2200,
690};
691
692static struct i2c_board_info smb349_charger_i2c_info[] __initdata = {
693 {
694 I2C_BOARD_INFO(SMB349_NAME, 0x1B),
695 .platform_data = &smb349_data,
696 },
697};
698
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -0800699struct sx150x_platform_data apq8064_sx150x_data[] = {
700 [SX150X_EPM] = {
701 .gpio_base = GPIO_EPM_EXPANDER_BASE,
702 .oscio_is_gpo = false,
703 .io_pullup_ena = 0x0,
704 .io_pulldn_ena = 0x0,
705 .io_open_drain_ena = 0x0,
706 .io_polarity = 0,
707 .irq_summary = -1,
708 },
709};
710
711static struct epm_chan_properties ads_adc_channel_data[] = {
712 {10, 100}, {500, 50}, {1, 1}, {1, 1},
713 {20, 50}, {10, 100}, {1, 1}, {1, 1},
714 {10, 100}, {10, 100}, {100, 100}, {200, 100},
715 {100, 50}, {2000, 50}, {1000, 50}, {200, 50},
716 {200, 100}, {1, 1}, {20, 50}, {500, 50},
717 {50, 50}, {200, 100}, {500, 100}, {20, 50},
718 {200, 50}, {2000, 100}, {1000, 50}, {100, 50},
719 {200, 100}, {500, 50}, {1000, 100}, {200, 50},
720 {1000, 50}, {50, 50}, {100, 50}, {100, 50},
721 {1, 1}, {1, 1}, {20, 100}, {20, 50},
722 {500, 100}, {1000, 100}, {100, 50}, {1000, 50},
723 {100, 50}, {1000, 100}, {100, 50}, {100, 50},
724};
725
726static struct epm_adc_platform_data epm_adc_pdata = {
727 .channel = ads_adc_channel_data,
728 .bus_id = 0x0,
729 .epm_i2c_board_info = {
730 .type = "sx1509q",
731 .addr = 0x3e,
732 .platform_data = &apq8064_sx150x_data[SX150X_EPM],
733 },
734 .gpio_expander_base_addr = GPIO_EPM_EXPANDER_BASE,
735};
736
737static struct platform_device epm_adc_device = {
738 .name = "epm_adc",
739 .id = -1,
740 .dev = {
741 .platform_data = &epm_adc_pdata,
742 },
743};
744
745static void __init apq8064_epm_adc_init(void)
746{
747 epm_adc_pdata.num_channels = 32;
748 epm_adc_pdata.num_adc = 2;
749 epm_adc_pdata.chan_per_adc = 16;
750 epm_adc_pdata.chan_per_mux = 8;
751};
752
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800753/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
754 * 4 micbiases are used to power various analog and digital
755 * microphones operating at 1800 mV. Technically, all micbiases
756 * can source from single cfilter since all microphones operate
757 * at the same voltage level. The arrangement below is to make
758 * sure all cfilters are exercised. LDO_H regulator ouput level
759 * does not need to be as high as 2.85V. It is choosen for
760 * microphone sensitivity purpose.
761 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530762static struct wcd9xxx_pdata apq8064_tabla_platform_data = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800763 .slimbus_slave_device = {
764 .name = "tabla-slave",
765 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
766 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800767 .irq = MSM_GPIO_TO_INT(42),
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800768 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530769 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800770 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
771 .micbias = {
772 .ldoh_v = TABLA_LDOH_2P85_V,
773 .cfilt1_mv = 1800,
774 .cfilt2_mv = 1800,
775 .cfilt3_mv = 1800,
776 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
777 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
778 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
779 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530780 },
781 .regulator = {
782 {
783 .name = "CDC_VDD_CP",
784 .min_uV = 1800000,
785 .max_uV = 1800000,
786 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
787 },
788 {
789 .name = "CDC_VDDA_RX",
790 .min_uV = 1800000,
791 .max_uV = 1800000,
792 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
793 },
794 {
795 .name = "CDC_VDDA_TX",
796 .min_uV = 1800000,
797 .max_uV = 1800000,
798 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
799 },
800 {
801 .name = "VDDIO_CDC",
802 .min_uV = 1800000,
803 .max_uV = 1800000,
804 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
805 },
806 {
807 .name = "VDDD_CDC_D",
808 .min_uV = 1225000,
809 .max_uV = 1225000,
810 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
811 },
812 {
813 .name = "CDC_VDDA_A_1P2V",
814 .min_uV = 1225000,
815 .max_uV = 1225000,
816 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
817 },
818 },
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800819};
820
821static struct slim_device apq8064_slim_tabla = {
822 .name = "tabla-slim",
823 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
824 .dev = {
825 .platform_data = &apq8064_tabla_platform_data,
826 },
827};
828
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530829static struct wcd9xxx_pdata apq8064_tabla20_platform_data = {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800830 .slimbus_slave_device = {
831 .name = "tabla-slave",
832 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
833 },
834 .irq = MSM_GPIO_TO_INT(42),
835 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530836 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800837 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
838 .micbias = {
839 .ldoh_v = TABLA_LDOH_2P85_V,
840 .cfilt1_mv = 1800,
841 .cfilt2_mv = 1800,
842 .cfilt3_mv = 1800,
843 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
844 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
845 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
846 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530847 },
848 .regulator = {
849 {
850 .name = "CDC_VDD_CP",
851 .min_uV = 1800000,
852 .max_uV = 1800000,
853 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
854 },
855 {
856 .name = "CDC_VDDA_RX",
857 .min_uV = 1800000,
858 .max_uV = 1800000,
859 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
860 },
861 {
862 .name = "CDC_VDDA_TX",
863 .min_uV = 1800000,
864 .max_uV = 1800000,
865 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
866 },
867 {
868 .name = "VDDIO_CDC",
869 .min_uV = 1800000,
870 .max_uV = 1800000,
871 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
872 },
873 {
874 .name = "VDDD_CDC_D",
875 .min_uV = 1225000,
876 .max_uV = 1225000,
877 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
878 },
879 {
880 .name = "CDC_VDDA_A_1P2V",
881 .min_uV = 1225000,
882 .max_uV = 1225000,
883 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
884 },
885 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800886};
887
888static struct slim_device apq8064_slim_tabla20 = {
889 .name = "tabla2x-slim",
890 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
891 .dev = {
892 .platform_data = &apq8064_tabla20_platform_data,
893 },
894};
895
Santosh Mardi695be0d2012-04-10 23:21:12 +0530896/* enable the level shifter for cs8427 to make sure the I2C
897 * clock is running at 100KHz and voltage levels are at 3.3
898 * and 5 volts
899 */
900static int enable_100KHz_ls(int enable)
901{
902 int ret = 0;
903 if (enable) {
904 ret = gpio_request(SX150X_GPIO(1, 10),
905 "cs8427_100KHZ_ENABLE");
906 if (ret) {
907 pr_err("%s: Failed to request gpio %d\n", __func__,
908 SX150X_GPIO(1, 10));
909 return ret;
910 }
911 gpio_direction_output(SX150X_GPIO(1, 10), 1);
912 } else
913 gpio_free(SX150X_GPIO(1, 10));
914 return ret;
915}
916
Santosh Mardieff9a742012-04-09 23:23:39 +0530917static struct cs8427_platform_data cs8427_i2c_platform_data = {
918 .irq = SX150X_GPIO(1, 4),
919 .reset_gpio = SX150X_GPIO(1, 6),
Santosh Mardi695be0d2012-04-10 23:21:12 +0530920 .enable = enable_100KHz_ls,
Santosh Mardieff9a742012-04-09 23:23:39 +0530921};
922
923static struct i2c_board_info cs8427_device_info[] __initdata = {
924 {
925 I2C_BOARD_INFO("cs8427", CS8427_ADDR4),
926 .platform_data = &cs8427_i2c_platform_data,
927 },
928};
929
Amy Maloche70090f992012-02-16 16:35:26 -0800930#define HAP_SHIFT_LVL_OE_GPIO PM8921_MPP_PM_TO_SYS(8)
931#define ISA1200_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
932#define ISA1200_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
933#define ISA1200_HAP_CLK PM8921_GPIO_PM_TO_SYS(44)
934
935static int isa1200_power(int on)
936{
Amy Maloche8f973892012-03-26 14:53:13 -0700937 int rc = 0;
938
Amy Maloche70090f992012-02-16 16:35:26 -0800939 gpio_set_value_cansleep(ISA1200_HAP_CLK, !!on);
940
Amy Maloche8f973892012-03-26 14:53:13 -0700941 if (on)
942 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_1, true);
943 else
944 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_NONE, true);
945
946 if (rc) {
947 pr_err("%s: unable to write aux clock register(%d)\n",
948 __func__, rc);
949 }
950
951 return rc;
Amy Maloche70090f992012-02-16 16:35:26 -0800952}
953
954static int isa1200_dev_setup(bool enable)
955{
956 int rc = 0;
957
Amy Maloche70090f992012-02-16 16:35:26 -0800958 if (!enable)
959 goto free_gpio;
960
961 rc = gpio_request(ISA1200_HAP_CLK, "haptics_clk");
962 if (rc) {
963 pr_err("%s: unable to request gpio %d config(%d)\n",
964 __func__, ISA1200_HAP_CLK, rc);
965 return rc;
966 }
967
968 rc = gpio_direction_output(ISA1200_HAP_CLK, 0);
969 if (rc) {
970 pr_err("%s: unable to set direction\n", __func__);
971 goto free_gpio;
972 }
973
974 return 0;
975
976free_gpio:
977 gpio_free(ISA1200_HAP_CLK);
978 return rc;
979}
980
981static struct isa1200_regulator isa1200_reg_data[] = {
982 {
983 .name = "vddp",
984 .min_uV = ISA_I2C_VTG_MIN_UV,
985 .max_uV = ISA_I2C_VTG_MAX_UV,
986 .load_uA = ISA_I2C_CURR_UA,
987 },
988};
989
990static struct isa1200_platform_data isa1200_1_pdata = {
991 .name = "vibrator",
992 .dev_setup = isa1200_dev_setup,
993 .power_on = isa1200_power,
994 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
995 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
996 .max_timeout = 15000,
997 .mode_ctrl = PWM_GEN_MODE,
998 .pwm_fd = {
999 .pwm_div = 256,
1000 },
1001 .is_erm = false,
1002 .smart_en = true,
1003 .ext_clk_en = true,
1004 .chip_en = 1,
1005 .regulator_info = isa1200_reg_data,
1006 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1007};
1008
1009static struct i2c_board_info isa1200_board_info[] __initdata = {
1010 {
1011 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1012 .platform_data = &isa1200_1_pdata,
1013 },
1014};
Jing Lin21ed4de2012-02-05 15:53:28 -08001015/* configuration data for mxt1386e using V2.1 firmware */
1016static const u8 mxt1386e_config_data_v2_1[] = {
1017 /* T6 Object */
1018 0, 0, 0, 0, 0, 0,
1019 /* T38 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001020 14, 1, 0, 22, 2, 12, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001021 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1022 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1023 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1024 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1025 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1026 0, 0, 0, 0,
1027 /* T7 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001028 100, 10, 50,
Jing Lin21ed4de2012-02-05 15:53:28 -08001029 /* T8 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001030 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001031 /* T9 Object */
1032 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
1033 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
Jing Linf1208fd2012-02-23 11:15:42 -08001034 85, 5, 0, 5, 9, 5, 12, 35, 70, 40,
1035 20, 5, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001036 /* T18 Object */
1037 0, 0,
1038 /* T24 Object */
1039 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1040 0, 0, 0, 0, 0, 0, 0, 0, 0,
1041 /* T25 Object */
1042 3, 0, 60, 115, 156, 99,
1043 /* T27 Object */
1044 0, 0, 0, 0, 0, 0, 0,
1045 /* T40 Object */
1046 0, 0, 0, 0, 0,
1047 /* T42 Object */
1048 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
1049 /* T43 Object */
1050 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
1051 16,
1052 /* T46 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001053 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001054 /* T47 Object */
1055 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
1056 /* T48 Object */
1057 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001058 32, 40, 0, 10, 10, 0, 0, 100, 10, 90,
1059 0, 0, 0, 0, 0, 0, 0, 10, 1, 10,
1060 52, 10, 12, 0, 33, 0, 1, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001061 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1062 0, 0, 0, 0,
1063 /* T56 Object */
1064 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1065 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1066 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1067 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001068 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1069 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001070};
1071
Terence Hampson2e1705f2012-04-11 19:55:29 -04001072#ifndef CONFIG_MSM_VCAP
Jing Lin21ed4de2012-02-05 15:53:28 -08001073#define MXT_TS_GPIO_IRQ 6
1074#define MXT_TS_PWR_EN_GPIO PM8921_GPIO_PM_TO_SYS(23)
1075#define MXT_TS_RESET_GPIO 33
1076
1077static struct mxt_config_info mxt_config_array[] = {
1078 {
1079 .config = mxt1386e_config_data_v2_1,
1080 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1081 .family_id = 0xA0,
1082 .variant_id = 0x7,
1083 .version = 0x21,
1084 .build = 0xAA,
Jing Linef4aa9b2012-03-26 12:01:41 -07001085 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
1086 .fw_name = "atmel_8064_liquid_v2_2_AA.hex",
1087 },
1088 {
1089 /* The config data for V2.2.AA is the same as for V2.1.AA */
1090 .config = mxt1386e_config_data_v2_1,
1091 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1092 .family_id = 0xA0,
1093 .variant_id = 0x7,
1094 .version = 0x22,
1095 .build = 0xAA,
1096 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin21ed4de2012-02-05 15:53:28 -08001097 },
1098};
1099
1100static struct mxt_platform_data mxt_platform_data = {
1101 .config_array = mxt_config_array,
1102 .config_array_size = ARRAY_SIZE(mxt_config_array),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08001103 .panel_minx = 0,
1104 .panel_maxx = 1365,
1105 .panel_miny = 0,
1106 .panel_maxy = 767,
1107 .disp_minx = 0,
1108 .disp_maxx = 1365,
1109 .disp_miny = 0,
1110 .disp_maxy = 767,
Anirudh Ghayal39dbe3f2012-04-13 15:43:16 +05301111 .irqflags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
Jing Lin21ed4de2012-02-05 15:53:28 -08001112 .i2c_pull_up = true,
1113 .reset_gpio = MXT_TS_RESET_GPIO,
1114 .irq_gpio = MXT_TS_GPIO_IRQ,
1115};
1116
1117static struct i2c_board_info mxt_device_info[] __initdata = {
1118 {
1119 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
1120 .platform_data = &mxt_platform_data,
1121 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1122 },
1123};
Terence Hampson2e1705f2012-04-11 19:55:29 -04001124#endif
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001125#define CYTTSP_TS_GPIO_IRQ 6
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001126#define CYTTSP_TS_GPIO_SLEEP 33
1127
1128static ssize_t tma340_vkeys_show(struct kobject *kobj,
1129 struct kobj_attribute *attr, char *buf)
1130{
1131 return snprintf(buf, 200,
1132 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1133 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1134 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1135 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1136 "\n");
1137}
1138
1139static struct kobj_attribute tma340_vkeys_attr = {
1140 .attr = {
1141 .mode = S_IRUGO,
1142 },
1143 .show = &tma340_vkeys_show,
1144};
1145
1146static struct attribute *tma340_properties_attrs[] = {
1147 &tma340_vkeys_attr.attr,
1148 NULL
1149};
1150
1151static struct attribute_group tma340_properties_attr_group = {
1152 .attrs = tma340_properties_attrs,
1153};
1154
1155static int cyttsp_platform_init(struct i2c_client *client)
1156{
1157 int rc = 0;
1158 static struct kobject *tma340_properties_kobj;
1159
1160 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1161 tma340_properties_kobj = kobject_create_and_add("board_properties",
1162 NULL);
1163 if (tma340_properties_kobj)
1164 rc = sysfs_create_group(tma340_properties_kobj,
1165 &tma340_properties_attr_group);
1166 if (!tma340_properties_kobj || rc)
1167 pr_err("%s: failed to create board_properties\n",
1168 __func__);
1169
1170 return 0;
1171}
1172
1173static struct cyttsp_regulator cyttsp_regulator_data[] = {
1174 {
1175 .name = "vdd",
1176 .min_uV = CY_TMA300_VTG_MIN_UV,
1177 .max_uV = CY_TMA300_VTG_MAX_UV,
1178 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1179 .lpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1180 },
1181 {
1182 .name = "vcc_i2c",
1183 .min_uV = CY_I2C_VTG_MIN_UV,
1184 .max_uV = CY_I2C_VTG_MAX_UV,
1185 .hpm_load_uA = CY_I2C_CURR_UA,
1186 .lpm_load_uA = CY_I2C_CURR_UA,
1187 },
1188};
1189
1190static struct cyttsp_platform_data cyttsp_pdata = {
1191 .panel_maxx = 634,
1192 .panel_maxy = 1166,
1193 .disp_maxx = 599,
1194 .disp_maxy = 1023,
1195 .disp_minx = 0,
1196 .disp_miny = 0,
1197 .flags = 0x01,
1198 .gen = CY_GEN3,
1199 .use_st = CY_USE_ST,
1200 .use_mt = CY_USE_MT,
1201 .use_hndshk = CY_SEND_HNDSHK,
1202 .use_trk_id = CY_USE_TRACKING_ID,
1203 .use_sleep = CY_USE_DEEP_SLEEP_SEL,
1204 .use_gestures = CY_USE_GESTURES,
1205 .fw_fname = "cyttsp_8064_mtp.hex",
1206 /* change act_intrvl to customize the Active power state
1207 * scanning/processing refresh interval for Operating mode
1208 */
1209 .act_intrvl = CY_ACT_INTRVL_DFLT,
1210 /* change tch_tmout to customize the touch timeout for the
1211 * Active power state for Operating mode
1212 */
1213 .tch_tmout = CY_TCH_TMOUT_DFLT,
1214 /* change lp_intrvl to customize the Low Power power state
1215 * scanning/processing refresh interval for Operating mode
1216 */
1217 .lp_intrvl = CY_LP_INTRVL_DFLT,
1218 .sleep_gpio = CYTTSP_TS_GPIO_SLEEP,
Amy Maloche9ba3ffe2012-04-26 10:31:20 -07001219 .resout_gpio = -1,
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001220 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1221 .regulator_info = cyttsp_regulator_data,
1222 .num_regulators = ARRAY_SIZE(cyttsp_regulator_data),
1223 .init = cyttsp_platform_init,
1224 .correct_fw_ver = 17,
1225};
1226
1227static struct i2c_board_info cyttsp_info[] __initdata = {
1228 {
1229 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1230 .platform_data = &cyttsp_pdata,
1231 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1232 },
1233};
Jing Lin21ed4de2012-02-05 15:53:28 -08001234
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001235#define MSM_WCNSS_PHYS 0x03000000
1236#define MSM_WCNSS_SIZE 0x280000
1237
1238static struct resource resources_wcnss_wlan[] = {
1239 {
1240 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1241 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1242 .name = "wcnss_wlanrx_irq",
1243 .flags = IORESOURCE_IRQ,
1244 },
1245 {
1246 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1247 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1248 .name = "wcnss_wlantx_irq",
1249 .flags = IORESOURCE_IRQ,
1250 },
1251 {
1252 .start = MSM_WCNSS_PHYS,
1253 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1254 .name = "wcnss_mmio",
1255 .flags = IORESOURCE_MEM,
1256 },
1257 {
1258 .start = 64,
1259 .end = 68,
1260 .name = "wcnss_gpios_5wire",
1261 .flags = IORESOURCE_IO,
1262 },
1263};
1264
1265static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1266 .has_48mhz_xo = 1,
1267};
1268
1269static struct platform_device msm_device_wcnss_wlan = {
1270 .name = "wcnss_wlan",
1271 .id = 0,
1272 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1273 .resource = resources_wcnss_wlan,
1274 .dev = {.platform_data = &qcom_wcnss_pdata},
1275};
1276
Ankit Vermab7c26e62012-02-28 15:04:15 -08001277static struct platform_device msm_device_iris_fm __devinitdata = {
1278 .name = "iris_fm",
1279 .id = -1,
1280};
1281
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001282#ifdef CONFIG_QSEECOM
1283/* qseecom bus scaling */
1284static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
1285 {
1286 .src = MSM_BUS_MASTER_SPS,
1287 .dst = MSM_BUS_SLAVE_EBI_CH0,
1288 .ib = 0,
1289 .ab = 0,
1290 },
1291 {
1292 .src = MSM_BUS_MASTER_SPDM,
1293 .dst = MSM_BUS_SLAVE_SPDM,
1294 .ib = 0,
1295 .ab = 0,
1296 },
1297};
1298
1299static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
1300 {
1301 .src = MSM_BUS_MASTER_SPS,
1302 .dst = MSM_BUS_SLAVE_EBI_CH0,
1303 .ib = (492 * 8) * 1000000UL,
1304 .ab = (492 * 8) * 100000UL,
1305 },
1306 {
1307 .src = MSM_BUS_MASTER_SPDM,
1308 .dst = MSM_BUS_SLAVE_SPDM,
1309 .ib = 0,
1310 .ab = 0,
1311 },
1312};
1313
1314static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1315 {
1316 .src = MSM_BUS_MASTER_SPS,
1317 .dst = MSM_BUS_SLAVE_EBI_CH0,
1318 .ib = 0,
1319 .ab = 0,
1320 },
1321 {
1322 .src = MSM_BUS_MASTER_SPDM,
1323 .dst = MSM_BUS_SLAVE_SPDM,
1324 .ib = (64 * 8) * 1000000UL,
1325 .ab = (64 * 8) * 100000UL,
1326 },
1327};
1328
1329static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1330 {
1331 ARRAY_SIZE(qseecom_clks_init_vectors),
1332 qseecom_clks_init_vectors,
1333 },
1334 {
1335 ARRAY_SIZE(qseecom_enable_dfab_vectors),
1336 qseecom_enable_sfpb_vectors,
1337 },
1338 {
1339 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1340 qseecom_enable_sfpb_vectors,
1341 },
1342};
1343
1344static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1345 qseecom_hw_bus_scale_usecases,
1346 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1347 .name = "qsee",
1348};
1349
1350static struct platform_device qseecom_device = {
1351 .name = "qseecom",
1352 .id = 0,
1353 .dev = {
1354 .platform_data = &qseecom_bus_pdata,
1355 },
1356};
1357#endif
1358
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001359#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1360 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1361 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1362 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1363
1364#define QCE_SIZE 0x10000
1365#define QCE_0_BASE 0x11000000
1366
1367#define QCE_HW_KEY_SUPPORT 0
1368#define QCE_SHA_HMAC_SUPPORT 1
1369#define QCE_SHARE_CE_RESOURCE 3
1370#define QCE_CE_SHARED 0
1371
1372static struct resource qcrypto_resources[] = {
1373 [0] = {
1374 .start = QCE_0_BASE,
1375 .end = QCE_0_BASE + QCE_SIZE - 1,
1376 .flags = IORESOURCE_MEM,
1377 },
1378 [1] = {
1379 .name = "crypto_channels",
1380 .start = DMOV8064_CE_IN_CHAN,
1381 .end = DMOV8064_CE_OUT_CHAN,
1382 .flags = IORESOURCE_DMA,
1383 },
1384 [2] = {
1385 .name = "crypto_crci_in",
1386 .start = DMOV8064_CE_IN_CRCI,
1387 .end = DMOV8064_CE_IN_CRCI,
1388 .flags = IORESOURCE_DMA,
1389 },
1390 [3] = {
1391 .name = "crypto_crci_out",
1392 .start = DMOV8064_CE_OUT_CRCI,
1393 .end = DMOV8064_CE_OUT_CRCI,
1394 .flags = IORESOURCE_DMA,
1395 },
1396};
1397
1398static struct resource qcedev_resources[] = {
1399 [0] = {
1400 .start = QCE_0_BASE,
1401 .end = QCE_0_BASE + QCE_SIZE - 1,
1402 .flags = IORESOURCE_MEM,
1403 },
1404 [1] = {
1405 .name = "crypto_channels",
1406 .start = DMOV8064_CE_IN_CHAN,
1407 .end = DMOV8064_CE_OUT_CHAN,
1408 .flags = IORESOURCE_DMA,
1409 },
1410 [2] = {
1411 .name = "crypto_crci_in",
1412 .start = DMOV8064_CE_IN_CRCI,
1413 .end = DMOV8064_CE_IN_CRCI,
1414 .flags = IORESOURCE_DMA,
1415 },
1416 [3] = {
1417 .name = "crypto_crci_out",
1418 .start = DMOV8064_CE_OUT_CRCI,
1419 .end = DMOV8064_CE_OUT_CRCI,
1420 .flags = IORESOURCE_DMA,
1421 },
1422};
1423
1424#endif
1425
1426#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1427 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1428
1429static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1430 .ce_shared = QCE_CE_SHARED,
1431 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1432 .hw_key_support = QCE_HW_KEY_SUPPORT,
1433 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001434 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001435};
1436
1437static struct platform_device qcrypto_device = {
1438 .name = "qcrypto",
1439 .id = 0,
1440 .num_resources = ARRAY_SIZE(qcrypto_resources),
1441 .resource = qcrypto_resources,
1442 .dev = {
1443 .coherent_dma_mask = DMA_BIT_MASK(32),
1444 .platform_data = &qcrypto_ce_hw_suppport,
1445 },
1446};
1447#endif
1448
1449#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1450 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1451
1452static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1453 .ce_shared = QCE_CE_SHARED,
1454 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1455 .hw_key_support = QCE_HW_KEY_SUPPORT,
1456 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001457 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001458};
1459
1460static struct platform_device qcedev_device = {
1461 .name = "qce",
1462 .id = 0,
1463 .num_resources = ARRAY_SIZE(qcedev_resources),
1464 .resource = qcedev_resources,
1465 .dev = {
1466 .coherent_dma_mask = DMA_BIT_MASK(32),
1467 .platform_data = &qcedev_ce_hw_suppport,
1468 },
1469};
1470#endif
1471
Joel Kingdacbc822012-01-25 13:30:57 -08001472static struct mdm_platform_data mdm_platform_data = {
1473 .mdm_version = "3.0",
1474 .ramdump_delay_ms = 2000,
Hemant Kumara945b472012-01-25 15:08:06 -08001475 .peripheral_platform_device = &apq8064_device_hsic_host,
Joel Kingdacbc822012-01-25 13:30:57 -08001476};
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001477
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001478static struct tsens_platform_data apq_tsens_pdata = {
1479 .tsens_factor = 1000,
1480 .hw_type = APQ_8064,
1481 .tsens_num_sensor = 11,
1482 .slope = {1176, 1176, 1154, 1176, 1111,
1483 1132, 1132, 1199, 1132, 1199, 1132},
1484};
1485
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001486#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001487static void __init apq8064_map_io(void)
1488{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001489 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001490 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001491 if (socinfo_init() < 0)
1492 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001493}
1494
1495static void __init apq8064_init_irq(void)
1496{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001497 struct msm_mpm_device_data *data = NULL;
1498
1499#ifdef CONFIG_MSM_MPM
1500 data = &apq8064_mpm_dev_data;
1501#endif
1502
1503 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001504 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1505 (void *)MSM_QGIC_CPU_BASE);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001506}
1507
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001508static struct platform_device msm8064_device_saw_regulator_core0 = {
1509 .name = "saw-regulator",
1510 .id = 0,
1511 .dev = {
1512 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
1513 },
1514};
1515
1516static struct platform_device msm8064_device_saw_regulator_core1 = {
1517 .name = "saw-regulator",
1518 .id = 1,
1519 .dev = {
1520 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
1521 },
1522};
1523
1524static struct platform_device msm8064_device_saw_regulator_core2 = {
1525 .name = "saw-regulator",
1526 .id = 2,
1527 .dev = {
1528 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
1529 },
1530};
1531
1532static struct platform_device msm8064_device_saw_regulator_core3 = {
1533 .name = "saw-regulator",
1534 .id = 3,
1535 .dev = {
1536 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001537
1538 },
1539};
1540
Oluwafemi Adeyemif5a31422012-03-08 16:58:45 -08001541static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001542 {
1543 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1544 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1545 true,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001546 100, 650, 801, 200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001547 },
1548
1549 {
1550 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1551 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1552 true,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001553 2000, 200, 576000, 2000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001554 },
1555
1556 {
1557 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1558 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1559 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001560 8500, 51, 1122000, 8500,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001561 },
1562
1563 {
1564 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1565 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
1566 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001567 9000, 51, 1130300, 9000,
1568 },
1569 {
1570 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1571 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
1572 false,
1573 10000, 51, 1130300, 10000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001574 },
1575
1576 {
1577 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1578 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1579 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001580 12000, 14, 2205900, 12000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001581 },
1582
1583 {
1584 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1585 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1586 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001587 18000, 12, 2364250, 18000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001588 },
1589
1590 {
1591 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1592 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1593 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001594 23500, 10, 2667000, 23500,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001595 },
1596
1597 {
1598 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1599 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1600 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001601 29700, 5, 2867000, 30000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001602 },
1603};
1604
Oluwafemi Adeyemif5a31422012-03-08 16:58:45 -08001605uint32_t apq8064_rpm_get_swfi_latency(void)
1606{
1607 int i;
1608
1609 for (i = 0; i < ARRAY_SIZE(msm_rpmrs_levels); i++) {
1610 if (msm_rpmrs_levels[i].sleep_mode ==
1611 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)
1612 return msm_rpmrs_levels[i].latency_us;
1613 }
1614
1615 return 0;
1616}
1617
Praveen Chidambaram78499012011-11-01 17:15:17 -06001618static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1619 .mode = MSM_PM_BOOT_CONFIG_TZ,
1620};
1621
1622static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
1623 .levels = &msm_rpmrs_levels[0],
1624 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
1625 .vdd_mem_levels = {
1626 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
1627 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
1628 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
1629 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
1630 },
1631 .vdd_dig_levels = {
1632 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
1633 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
1634 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
1635 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
1636 },
1637 .vdd_mask = 0x7FFFFF,
1638 .rpmrs_target_id = {
1639 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
1640 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
1641 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
1642 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
1643 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
1644 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
1645 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
1646 },
1647};
1648
Praveen Chidambaram78499012011-11-01 17:15:17 -06001649static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1650 0x03, 0x0f,
1651};
1652
1653static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1654 0x00, 0x24, 0x54, 0x10,
1655 0x09, 0x03, 0x01,
1656 0x10, 0x54, 0x30, 0x0C,
1657 0x24, 0x30, 0x0f,
1658};
1659
1660static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1661 0x00, 0x24, 0x54, 0x10,
1662 0x09, 0x07, 0x01, 0x0B,
1663 0x10, 0x54, 0x30, 0x0C,
1664 0x24, 0x30, 0x0f,
1665};
1666
1667static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1668 [0] = {
1669 .mode = MSM_SPM_MODE_CLOCK_GATING,
1670 .notify_rpm = false,
1671 .cmd = spm_wfi_cmd_sequence,
1672 },
1673 [1] = {
1674 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1675 .notify_rpm = false,
1676 .cmd = spm_power_collapse_without_rpm,
1677 },
1678 [2] = {
1679 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1680 .notify_rpm = true,
1681 .cmd = spm_power_collapse_with_rpm,
1682 },
1683};
1684
1685static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1686 0x00, 0x20, 0x03, 0x20,
1687 0x00, 0x0f,
1688};
1689
1690static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1691 0x00, 0x20, 0x34, 0x64,
1692 0x48, 0x07, 0x48, 0x20,
1693 0x50, 0x64, 0x04, 0x34,
1694 0x50, 0x0f,
1695};
1696static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1697 0x00, 0x10, 0x34, 0x64,
1698 0x48, 0x07, 0x48, 0x10,
1699 0x50, 0x64, 0x04, 0x34,
1700 0x50, 0x0F,
1701};
1702
1703static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1704 [0] = {
1705 .mode = MSM_SPM_L2_MODE_RETENTION,
1706 .notify_rpm = false,
1707 .cmd = l2_spm_wfi_cmd_sequence,
1708 },
1709 [1] = {
1710 .mode = MSM_SPM_L2_MODE_GDHS,
1711 .notify_rpm = true,
1712 .cmd = l2_spm_gdhs_cmd_sequence,
1713 },
1714 [2] = {
1715 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1716 .notify_rpm = true,
1717 .cmd = l2_spm_power_off_cmd_sequence,
1718 },
1719};
1720
1721
1722static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1723 [0] = {
1724 .reg_base_addr = MSM_SAW_L2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001725 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001726 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001727 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1728 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1729 .modes = msm_spm_l2_seq_list,
1730 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1731 },
1732};
1733
1734static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1735 [0] = {
1736 .reg_base_addr = MSM_SAW0_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001737 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001738#if defined(CONFIG_MSM_AVS_HW)
1739 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1740 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1741#endif
1742 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001743 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001744 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1745 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1746 .vctl_timeout_us = 50,
1747 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1748 .modes = msm_spm_seq_list,
1749 },
1750 [1] = {
1751 .reg_base_addr = MSM_SAW1_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001752 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001753#if defined(CONFIG_MSM_AVS_HW)
1754 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1755 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1756#endif
1757 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001758 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001759 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1760 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1761 .vctl_timeout_us = 50,
1762 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1763 .modes = msm_spm_seq_list,
1764 },
1765 [2] = {
1766 .reg_base_addr = MSM_SAW2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001767 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001768#if defined(CONFIG_MSM_AVS_HW)
1769 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1770 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1771#endif
1772 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001773 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001774 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1775 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1776 .vctl_timeout_us = 50,
1777 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1778 .modes = msm_spm_seq_list,
1779 },
1780 [3] = {
1781 .reg_base_addr = MSM_SAW3_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001782 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001783#if defined(CONFIG_MSM_AVS_HW)
1784 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1785 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1786#endif
1787 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001788 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001789 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1790 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1791 .vctl_timeout_us = 50,
1792 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1793 .modes = msm_spm_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001794 },
1795};
1796
Praveen Chidambaram4d19be42012-04-03 18:05:52 -06001797static struct msm_pm_sleep_status_data msm_pm_slp_sts_data = {
1798 .base_addr = MSM_ACC0_BASE + 0x08,
1799 .cpu_offset = MSM_ACC1_BASE - MSM_ACC0_BASE,
1800 .mask = 1UL << 13,
1801};
1802
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001803static void __init apq8064_init_buses(void)
1804{
1805 msm_bus_rpm_set_mt_mask();
1806 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
1807 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
1808 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
1809 msm_bus_8064_apps_fabric.dev.platform_data =
1810 &msm_bus_8064_apps_fabric_pdata;
1811 msm_bus_8064_sys_fabric.dev.platform_data =
1812 &msm_bus_8064_sys_fabric_pdata;
1813 msm_bus_8064_mm_fabric.dev.platform_data =
1814 &msm_bus_8064_mm_fabric_pdata;
1815 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
1816 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
1817}
1818
David Collinsf0d00732012-01-25 15:46:50 -08001819static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
1820 .name = GPIO_REGULATOR_DEV_NAME,
1821 .id = PM8921_MPP_PM_TO_SYS(7),
1822 .dev = {
1823 .platform_data
1824 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
1825 },
1826};
1827
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08001828static struct platform_device apq8064_device_ext_mpp8_vreg __devinitdata = {
1829 .name = GPIO_REGULATOR_DEV_NAME,
1830 .id = PM8921_MPP_PM_TO_SYS(8),
1831 .dev = {
1832 .platform_data
1833 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_MPP8],
1834 },
1835};
1836
David Collinsf0d00732012-01-25 15:46:50 -08001837static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
1838 .name = GPIO_REGULATOR_DEV_NAME,
1839 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
1840 .dev = {
1841 .platform_data =
1842 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
1843 },
1844};
1845
David Collins390fc332012-02-07 14:38:16 -08001846static struct platform_device apq8064_device_ext_ts_sw_vreg __devinitdata = {
1847 .name = GPIO_REGULATOR_DEV_NAME,
1848 .id = PM8921_GPIO_PM_TO_SYS(23),
1849 .dev = {
1850 .platform_data
1851 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_TS_SW],
1852 },
1853};
1854
David Collins2782b5c2012-02-06 10:02:42 -08001855static struct platform_device apq8064_device_rpm_regulator __devinitdata = {
1856 .name = "rpm-regulator",
1857 .id = -1,
1858 .dev = {
1859 .platform_data = &apq8064_rpm_regulator_pdata,
1860 },
1861};
1862
Ravi Kumar V05931a22012-04-04 17:09:37 +05301863static struct gpio_ir_recv_platform_data gpio_ir_recv_pdata = {
1864 .gpio_nr = 88,
1865 .active_low = 1,
1866};
1867
1868static struct platform_device gpio_ir_recv_pdev = {
1869 .name = "gpio-rc-recv",
1870 .dev = {
1871 .platform_data = &gpio_ir_recv_pdata,
1872 },
1873};
1874
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001875static struct platform_device *common_devices[] __initdata = {
Jin Hong01f2dbb2011-11-03 22:13:51 -07001876 &apq8064_device_dmov,
Terence Hampson2e1705f2012-04-11 19:55:29 -04001877#ifndef CONFIG_MSM_VCAP
David Keitel3c40fc52012-02-09 17:53:52 -08001878 &apq8064_device_qup_i2c_gsbi1,
Jing Lin04601f92012-02-05 15:36:07 -08001879 &apq8064_device_qup_i2c_gsbi3,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001880 &apq8064_device_qup_i2c_gsbi4,
Terence Hampson2e1705f2012-04-11 19:55:29 -04001881#endif
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001882 &apq8064_device_qup_spi_gsbi5,
David Collinsf0d00732012-01-25 15:46:50 -08001883 &apq8064_device_ext_5v_vreg,
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08001884 &apq8064_device_ext_mpp8_vreg,
David Collinsf0d00732012-01-25 15:46:50 -08001885 &apq8064_device_ext_3p3v_vreg,
David Collins390fc332012-02-07 14:38:16 -08001886 &apq8064_device_ext_ts_sw_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07001887 &apq8064_device_ssbi_pmic1,
1888 &apq8064_device_ssbi_pmic2,
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001889 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07001890 &apq8064_device_otg,
1891 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08001892 &apq8064_device_hsusb_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07001893 &android_usb_device,
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001894 &msm_device_wcnss_wlan,
Ankit Vermab7c26e62012-02-28 15:04:15 -08001895 &msm_device_iris_fm,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001896#ifdef CONFIG_ANDROID_PMEM
1897#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -07001898 &android_pmem_device,
1899 &android_pmem_adsp_device,
1900 &android_pmem_audio_device,
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -07001901#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
1902#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -08001903#ifdef CONFIG_ION_MSM
1904 &ion_dev,
1905#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001906 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001907 &msm8064_device_saw_regulator_core0,
1908 &msm8064_device_saw_regulator_core1,
1909 &msm8064_device_saw_regulator_core2,
1910 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001911#if defined(CONFIG_QSEECOM)
1912 &qseecom_device,
1913#endif
1914
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001915#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1916 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1917 &qcrypto_device,
1918#endif
1919
1920#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1921 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1922 &qcedev_device,
1923#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07001924
1925#ifdef CONFIG_HW_RANDOM_MSM
1926 &apq8064_device_rng,
1927#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08001928 &apq_pcm,
1929 &apq_pcm_routing,
1930 &apq_cpudai0,
1931 &apq_cpudai1,
Santosh Mardieff9a742012-04-09 23:23:39 +05301932 &mpq_cpudai_sec_i2s_rx,
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08001933 &apq_cpudai_hdmi_rx,
1934 &apq_cpudai_bt_rx,
1935 &apq_cpudai_bt_tx,
1936 &apq_cpudai_fm_rx,
1937 &apq_cpudai_fm_tx,
1938 &apq_cpu_fe,
1939 &apq_stub_codec,
1940 &apq_voice,
1941 &apq_voip,
1942 &apq_lpa_pcm,
Krishnankutty Kolathappilly4374e332012-03-18 22:27:30 -07001943 &apq_compr_dsp,
1944 &apq_multi_ch_pcm,
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08001945 &apq_pcm_hostless,
1946 &apq_cpudai_afe_01_rx,
1947 &apq_cpudai_afe_01_tx,
1948 &apq_cpudai_afe_02_rx,
1949 &apq_cpudai_afe_02_tx,
1950 &apq_pcm_afe,
1951 &apq_cpudai_auxpcm_rx,
1952 &apq_cpudai_auxpcm_tx,
Neema Shetty8427c262012-02-16 11:23:43 -08001953 &apq_cpudai_stub,
Neema Shetty3c9d2862012-03-11 01:25:32 -08001954 &apq_cpudai_slimbus_1_rx,
1955 &apq_cpudai_slimbus_1_tx,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07001956 &apq_cpudai_slimbus_2_tx,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001957 &apq8064_rpm_device,
1958 &apq8064_rpm_log_device,
1959 &apq8064_rpm_stat_device,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001960 &msm_bus_8064_apps_fabric,
1961 &msm_bus_8064_sys_fabric,
1962 &msm_bus_8064_mm_fabric,
1963 &msm_bus_8064_sys_fpb,
1964 &msm_bus_8064_cpss_fpb,
Mohan Kumar Gubbihalli Lachma Naik7f72edd2012-02-06 17:26:47 -08001965 &apq8064_msm_device_vidc,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07001966 &msm_pil_dsps,
Matt Wagantalled832652012-02-02 19:23:17 -08001967 &msm_8960_riva,
Matt Wagantallb94b9a52012-02-02 21:59:54 -08001968 &msm_8960_q6_lpass,
Stephen Boyd7b973de2012-03-09 12:26:16 -08001969 &msm_pil_vidc,
Matt Wagantall292aace2012-01-26 19:12:34 -08001970 &msm_gss,
Laura Abbott350c8362012-02-28 14:46:52 -08001971#ifdef CONFIG_MSM_RTB
1972 &msm_rtb_device,
1973#endif
Praveen Chidambaram8ea3dcd2011-12-07 14:46:31 -07001974 &apq8064_cpu_idle_device,
Praveen Chidambaram5c8adf22012-02-23 18:44:37 -07001975 &apq8064_msm_gov_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08001976 &apq8064_device_cache_erp,
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08001977 &epm_adc_device,
Pratik Patel212ab362012-03-16 12:30:07 -07001978 &apq8064_qdss_device,
1979 &msm_etb_device,
1980 &msm_tpiu_device,
1981 &msm_funnel_device,
1982 &apq8064_etm_device,
Helen Zeng8f925502012-03-05 16:50:17 -08001983 &apq_cpudai_slim_4_rx,
1984 &apq_cpudai_slim_4_tx,
Jignesh Mehta921649d2012-04-19 06:57:23 -07001985 &msm8960_gemini_device,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001986};
1987
Joel King4e7ad222011-08-17 15:47:38 -07001988static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001989 &apq8064_device_uart_gsbi3,
Yan He06913ce2011-08-26 16:33:46 -07001990 &msm_device_sps_apq8064,
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001991};
1992
1993static struct platform_device *rumi3_devices[] __initdata = {
1994 &apq8064_device_uart_gsbi1,
Yan He435ed612011-11-23 17:34:59 -08001995 &msm_device_sps_apq8064,
Huaibin Yang4a084e32011-12-15 15:25:52 -08001996#ifdef CONFIG_MSM_ROTATOR
1997 &msm_rotator_device,
1998#endif
Joel King4e7ad222011-08-17 15:47:38 -07001999};
2000
Joel King82b7e3f2012-01-05 10:03:27 -08002001static struct platform_device *cdp_devices[] __initdata = {
2002 &apq8064_device_uart_gsbi1,
Jin Hong4bbbfba2012-02-02 21:48:07 -08002003 &apq8064_device_uart_gsbi7,
Joel King82b7e3f2012-01-05 10:03:27 -08002004 &msm_device_sps_apq8064,
Aravind Venkateswaran4ca27532012-02-16 14:27:05 -08002005#ifdef CONFIG_MSM_ROTATOR
2006 &msm_rotator_device,
2007#endif
Joel King82b7e3f2012-01-05 10:03:27 -08002008};
2009
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002010static struct platform_device
2011mpq8064_device_ext_5v_frc_vreg __devinitdata = {
2012 .name = GPIO_REGULATOR_DEV_NAME,
2013 .id = SX150X_GPIO(4, 10),
2014 .dev = {
2015 .platform_data =
2016 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_FRC_5V],
2017 },
2018};
2019
2020static struct platform_device
2021mpq8064_device_ext_1p2_buck_vreg __devinitdata = {
2022 .name = GPIO_REGULATOR_DEV_NAME,
2023 .id = SX150X_GPIO(4, 2),
2024 .dev = {
2025 .platform_data =
2026 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P2V],
2027 },
2028};
2029
2030static struct platform_device
2031mpq8064_device_ext_1p8_buck_vreg __devinitdata = {
2032 .name = GPIO_REGULATOR_DEV_NAME,
2033 .id = SX150X_GPIO(4, 4),
2034 .dev = {
2035 .platform_data =
2036 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P8V],
2037 },
2038};
2039
2040static struct platform_device
2041mpq8064_device_ext_2p2_buck_vreg __devinitdata = {
2042 .name = GPIO_REGULATOR_DEV_NAME,
2043 .id = SX150X_GPIO(4, 14),
2044 .dev = {
2045 .platform_data =
2046 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_2P2V],
2047 },
2048};
2049
2050static struct platform_device
2051mpq8064_device_ext_5v_buck_vreg __devinitdata = {
2052 .name = GPIO_REGULATOR_DEV_NAME,
2053 .id = SX150X_GPIO(4, 3),
2054 .dev = {
2055 .platform_data =
2056 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_5V],
2057 },
2058};
2059
2060static struct platform_device
2061mpq8064_device_ext_3p3v_ldo_vreg __devinitdata = {
2062 .name = GPIO_REGULATOR_DEV_NAME,
2063 .id = SX150X_GPIO(4, 15),
2064 .dev = {
2065 .platform_data =
2066 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_3P3V],
2067 },
2068};
2069
2070static struct platform_device *mpq_devices[] __initdata = {
2071 &msm_device_sps_apq8064,
2072 &mpq8064_device_qup_i2c_gsbi5,
2073#ifdef CONFIG_MSM_ROTATOR
2074 &msm_rotator_device,
2075#endif
Ravi Kumar V05931a22012-04-04 17:09:37 +05302076 &gpio_ir_recv_pdev,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002077 &mpq8064_device_ext_5v_frc_vreg,
2078 &mpq8064_device_ext_1p2_buck_vreg,
2079 &mpq8064_device_ext_1p8_buck_vreg,
2080 &mpq8064_device_ext_2p2_buck_vreg,
2081 &mpq8064_device_ext_5v_buck_vreg,
2082 &mpq8064_device_ext_3p3v_ldo_vreg,
Terence Hampson2e1705f2012-04-11 19:55:29 -04002083#ifdef CONFIG_MSM_VCAP
2084 &msm8064_device_vcap,
2085#endif
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002086};
2087
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002088static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002089 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002090};
2091
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002092#define KS8851_IRQ_GPIO 43
2093
2094static struct spi_board_info spi_board_info[] __initdata = {
2095 {
2096 .modalias = "ks8851",
2097 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2098 .max_speed_hz = 19200000,
2099 .bus_num = 0,
2100 .chip_select = 2,
2101 .mode = SPI_MODE_0,
2102 },
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002103 {
2104 .modalias = "epm_adc",
2105 .max_speed_hz = 1100000,
2106 .bus_num = 0,
2107 .chip_select = 3,
2108 .mode = SPI_MODE_0,
2109 },
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002110};
2111
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002112static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002113 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08002114 .bus_num = 1,
2115 .slim_slave = &apq8064_slim_tabla,
2116 },
2117 {
2118 .bus_num = 1,
2119 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002120 },
2121 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002122};
2123
David Keitel3c40fc52012-02-09 17:53:52 -08002124static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi1_pdata = {
2125 .clk_freq = 100000,
2126 .src_clk_rate = 24000000,
2127};
2128
Jing Lin04601f92012-02-05 15:36:07 -08002129static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi3_pdata = {
2130 .clk_freq = 100000,
2131 .src_clk_rate = 24000000,
2132};
2133
Kenneth Heitke748593a2011-07-15 15:45:11 -06002134static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
2135 .clk_freq = 100000,
2136 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002137};
2138
Joel King8f839b92012-04-01 14:37:46 -07002139static struct msm_i2c_platform_data mpq8064_i2c_qup_gsbi5_pdata = {
2140 .clk_freq = 100000,
2141 .src_clk_rate = 24000000,
2142};
2143
David Keitel3c40fc52012-02-09 17:53:52 -08002144#define GSBI_DUAL_MODE_CODE 0x60
2145#define MSM_GSBI1_PHYS 0x12440000
Kenneth Heitke748593a2011-07-15 15:45:11 -06002146static void __init apq8064_i2c_init(void)
2147{
David Keitel3c40fc52012-02-09 17:53:52 -08002148 void __iomem *gsbi_mem;
2149
2150 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2151 &apq8064_i2c_qup_gsbi1_pdata;
2152 gsbi_mem = ioremap_nocache(MSM_GSBI1_PHYS, 4);
2153 writel_relaxed(GSBI_DUAL_MODE_CODE, gsbi_mem);
2154 /* Ensure protocol code is written before proceeding */
2155 wmb();
2156 iounmap(gsbi_mem);
2157 apq8064_i2c_qup_gsbi1_pdata.use_gsbi_shared_mode = 1;
Jing Lin04601f92012-02-05 15:36:07 -08002158 apq8064_device_qup_i2c_gsbi3.dev.platform_data =
2159 &apq8064_i2c_qup_gsbi3_pdata;
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002160 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2161 &apq8064_i2c_qup_gsbi1_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002162 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
2163 &apq8064_i2c_qup_gsbi4_pdata;
Joel King8f839b92012-04-01 14:37:46 -07002164 mpq8064_device_qup_i2c_gsbi5.dev.platform_data =
2165 &mpq8064_i2c_qup_gsbi5_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002166}
2167
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002168#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002169static int ethernet_init(void)
2170{
2171 int ret;
2172 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
2173 if (ret) {
2174 pr_err("ks8851 gpio_request failed: %d\n", ret);
2175 goto fail;
2176 }
2177
2178 return 0;
2179fail:
2180 return ret;
2181}
2182#else
2183static int ethernet_init(void)
2184{
2185 return 0;
2186}
2187#endif
2188
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302189#define GPIO_KEY_HOME PM8921_GPIO_PM_TO_SYS(27)
2190#define GPIO_KEY_VOLUME_UP PM8921_GPIO_PM_TO_SYS(35)
2191#define GPIO_KEY_VOLUME_DOWN PM8921_GPIO_PM_TO_SYS(38)
2192#define GPIO_KEY_CAM_FOCUS PM8921_GPIO_PM_TO_SYS(3)
2193#define GPIO_KEY_CAM_SNAP PM8921_GPIO_PM_TO_SYS(4)
Jing Lin3f8f8422012-03-05 09:32:11 -08002194#define GPIO_KEY_ROTATION PM8921_GPIO_PM_TO_SYS(42)
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302195
2196static struct gpio_keys_button cdp_keys[] = {
2197 {
2198 .code = KEY_HOME,
2199 .gpio = GPIO_KEY_HOME,
2200 .desc = "home_key",
2201 .active_low = 1,
2202 .type = EV_KEY,
2203 .wakeup = 1,
2204 .debounce_interval = 15,
2205 },
2206 {
2207 .code = KEY_VOLUMEUP,
2208 .gpio = GPIO_KEY_VOLUME_UP,
2209 .desc = "volume_up_key",
2210 .active_low = 1,
2211 .type = EV_KEY,
2212 .wakeup = 1,
2213 .debounce_interval = 15,
2214 },
2215 {
2216 .code = KEY_VOLUMEDOWN,
2217 .gpio = GPIO_KEY_VOLUME_DOWN,
2218 .desc = "volume_down_key",
2219 .active_low = 1,
2220 .type = EV_KEY,
2221 .wakeup = 1,
2222 .debounce_interval = 15,
2223 },
2224 {
2225 .code = SW_ROTATE_LOCK,
2226 .gpio = GPIO_KEY_ROTATION,
2227 .desc = "rotate_key",
2228 .active_low = 1,
2229 .type = EV_SW,
2230 .debounce_interval = 15,
2231 },
2232};
2233
2234static struct gpio_keys_platform_data cdp_keys_data = {
2235 .buttons = cdp_keys,
2236 .nbuttons = ARRAY_SIZE(cdp_keys),
2237};
2238
2239static struct platform_device cdp_kp_pdev = {
2240 .name = "gpio-keys",
2241 .id = -1,
2242 .dev = {
2243 .platform_data = &cdp_keys_data,
2244 },
2245};
2246
2247static struct gpio_keys_button mtp_keys[] = {
2248 {
2249 .code = KEY_CAMERA_FOCUS,
2250 .gpio = GPIO_KEY_CAM_FOCUS,
2251 .desc = "cam_focus_key",
2252 .active_low = 1,
2253 .type = EV_KEY,
2254 .wakeup = 1,
2255 .debounce_interval = 15,
2256 },
2257 {
2258 .code = KEY_VOLUMEUP,
2259 .gpio = GPIO_KEY_VOLUME_UP,
2260 .desc = "volume_up_key",
2261 .active_low = 1,
2262 .type = EV_KEY,
2263 .wakeup = 1,
2264 .debounce_interval = 15,
2265 },
2266 {
2267 .code = KEY_VOLUMEDOWN,
2268 .gpio = GPIO_KEY_VOLUME_DOWN,
2269 .desc = "volume_down_key",
2270 .active_low = 1,
2271 .type = EV_KEY,
2272 .wakeup = 1,
2273 .debounce_interval = 15,
2274 },
2275 {
2276 .code = KEY_CAMERA_SNAPSHOT,
2277 .gpio = GPIO_KEY_CAM_SNAP,
2278 .desc = "cam_snap_key",
2279 .active_low = 1,
2280 .type = EV_KEY,
2281 .debounce_interval = 15,
2282 },
2283};
2284
2285static struct gpio_keys_platform_data mtp_keys_data = {
2286 .buttons = mtp_keys,
2287 .nbuttons = ARRAY_SIZE(mtp_keys),
2288};
2289
2290static struct platform_device mtp_kp_pdev = {
2291 .name = "gpio-keys",
2292 .id = -1,
2293 .dev = {
2294 .platform_data = &mtp_keys_data,
2295 },
2296};
2297
Jin Hongd3024e62012-02-09 16:13:32 -08002298/* Sensors DSPS platform data */
2299#define DSPS_PIL_GENERIC_NAME "dsps"
2300static void __init apq8064_init_dsps(void)
2301{
2302 struct msm_dsps_platform_data *pdata =
2303 msm_dsps_device_8064.dev.platform_data;
2304 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
2305 pdata->gpios = NULL;
2306 pdata->gpios_num = 0;
2307
2308 platform_device_register(&msm_dsps_device_8064);
2309}
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302310
Jing Lin417fa452012-02-05 14:31:06 -08002311#define I2C_SURF 1
2312#define I2C_FFA (1 << 1)
2313#define I2C_RUMI (1 << 2)
2314#define I2C_SIM (1 << 3)
2315#define I2C_LIQUID (1 << 4)
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002316#define I2C_MPQ_CDP BIT(5)
2317#define I2C_MPQ_HRD BIT(6)
2318#define I2C_MPQ_DTV BIT(7)
Jing Lin417fa452012-02-05 14:31:06 -08002319
2320struct i2c_registry {
2321 u8 machs;
2322 int bus;
2323 struct i2c_board_info *info;
2324 int len;
2325};
2326
2327static struct i2c_registry apq8064_i2c_devices[] __initdata = {
Jing Lin21ed4de2012-02-05 15:53:28 -08002328 {
David Keitel2f613d92012-02-15 11:29:16 -08002329 I2C_LIQUID,
2330 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
2331 smb349_charger_i2c_info,
2332 ARRAY_SIZE(smb349_charger_i2c_info)
2333 },
Terence Hampson2e1705f2012-04-11 19:55:29 -04002334#ifndef CONFIG_MSM_VCAP
David Keitel2f613d92012-02-15 11:29:16 -08002335 {
Jing Lin21ed4de2012-02-05 15:53:28 -08002336 I2C_SURF | I2C_LIQUID,
2337 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
2338 mxt_device_info,
2339 ARRAY_SIZE(mxt_device_info),
2340 },
Terence Hampson2e1705f2012-04-11 19:55:29 -04002341#endif
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08002342 {
2343 I2C_FFA,
2344 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
2345 cyttsp_info,
2346 ARRAY_SIZE(cyttsp_info),
2347 },
Amy Maloche70090f992012-02-16 16:35:26 -08002348 {
2349 I2C_FFA | I2C_LIQUID,
2350 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
2351 isa1200_board_info,
2352 ARRAY_SIZE(isa1200_board_info),
2353 },
Santosh Mardieff9a742012-04-09 23:23:39 +05302354 {
2355 I2C_MPQ_CDP,
2356 APQ_8064_GSBI5_QUP_I2C_BUS_ID,
2357 cs8427_device_info,
2358 ARRAY_SIZE(cs8427_device_info),
2359 },
Jing Lin417fa452012-02-05 14:31:06 -08002360};
2361
Jay Chokshi607f61b2012-04-25 18:21:21 -07002362#define SX150X_EXP1_INT_N PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9)
2363
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002364struct sx150x_platform_data mpq8064_sx150x_pdata[] = {
2365 [SX150X_EXP1] = {
2366 .gpio_base = SX150X_EXP1_GPIO_BASE,
2367 .oscio_is_gpo = false,
2368 .io_pullup_ena = 0x0,
2369 .io_pulldn_ena = 0x0,
2370 .io_open_drain_ena = 0x0,
2371 .io_polarity = 0,
Jay Chokshi607f61b2012-04-25 18:21:21 -07002372 .irq_summary = SX150X_EXP1_INT_N,
2373 .irq_base = SX150X_EXP1_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002374 },
2375 [SX150X_EXP2] = {
2376 .gpio_base = SX150X_EXP2_GPIO_BASE,
2377 .oscio_is_gpo = false,
2378 .io_pullup_ena = 0x0,
2379 .io_pulldn_ena = 0x0,
2380 .io_open_drain_ena = 0x0,
2381 .io_polarity = 0,
2382 .irq_summary = -1,
2383 },
2384 [SX150X_EXP3] = {
2385 .gpio_base = SX150X_EXP3_GPIO_BASE,
2386 .oscio_is_gpo = false,
2387 .io_pullup_ena = 0x0,
2388 .io_pulldn_ena = 0x0,
2389 .io_open_drain_ena = 0x0,
2390 .io_polarity = 0,
2391 .irq_summary = -1,
2392 },
2393 [SX150X_EXP4] = {
2394 .gpio_base = SX150X_EXP4_GPIO_BASE,
2395 .oscio_is_gpo = false,
2396 .io_pullup_ena = 0x0,
2397 .io_pulldn_ena = 0x0,
2398 .io_open_drain_ena = 0x0,
2399 .io_polarity = 0,
2400 .irq_summary = -1,
2401 },
2402};
2403
2404static struct i2c_board_info sx150x_gpio_exp_info[] = {
2405 {
2406 I2C_BOARD_INFO("sx1509q", 0x70),
2407 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP1],
2408 },
2409 {
2410 I2C_BOARD_INFO("sx1508q", 0x23),
2411 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP2],
2412 },
2413 {
2414 I2C_BOARD_INFO("sx1508q", 0x22),
2415 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP3],
2416 },
2417 {
2418 I2C_BOARD_INFO("sx1509q", 0x3E),
2419 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP4],
2420 },
2421};
2422
2423#define MPQ8064_I2C_GSBI5_BUS_ID 5
2424
2425static struct i2c_registry mpq8064_i2c_devices[] __initdata = {
2426 {
2427 I2C_MPQ_CDP,
2428 MPQ8064_I2C_GSBI5_BUS_ID,
2429 sx150x_gpio_exp_info,
2430 ARRAY_SIZE(sx150x_gpio_exp_info),
2431 },
2432};
2433
Jing Lin417fa452012-02-05 14:31:06 -08002434static void __init register_i2c_devices(void)
2435{
2436 u8 mach_mask = 0;
2437 int i;
2438
Kevin Chand07220e2012-02-13 15:52:22 -08002439#ifdef CONFIG_MSM_CAMERA
2440 struct i2c_registry apq8064_camera_i2c_devices = {
2441 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_RUMI,
2442 APQ_8064_GSBI4_QUP_I2C_BUS_ID,
2443 apq8064_camera_board_info.board_info,
2444 apq8064_camera_board_info.num_i2c_board_info,
2445 };
2446#endif
Jing Lin417fa452012-02-05 14:31:06 -08002447 /* Build the matching 'supported_machs' bitmask */
2448 if (machine_is_apq8064_cdp())
2449 mach_mask = I2C_SURF;
2450 else if (machine_is_apq8064_mtp())
2451 mach_mask = I2C_FFA;
2452 else if (machine_is_apq8064_liquid())
2453 mach_mask = I2C_LIQUID;
2454 else if (machine_is_apq8064_rumi3())
2455 mach_mask = I2C_RUMI;
2456 else if (machine_is_apq8064_sim())
2457 mach_mask = I2C_SIM;
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002458 else if (PLATFORM_IS_MPQ8064())
2459 mach_mask = I2C_MPQ_CDP;
Jing Lin417fa452012-02-05 14:31:06 -08002460 else
2461 pr_err("unmatched machine ID in register_i2c_devices\n");
2462
2463 /* Run the array and install devices as appropriate */
2464 for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) {
2465 if (apq8064_i2c_devices[i].machs & mach_mask)
2466 i2c_register_board_info(apq8064_i2c_devices[i].bus,
2467 apq8064_i2c_devices[i].info,
2468 apq8064_i2c_devices[i].len);
2469 }
Kevin Chand07220e2012-02-13 15:52:22 -08002470#ifdef CONFIG_MSM_CAMERA
2471 if (apq8064_camera_i2c_devices.machs & mach_mask)
2472 i2c_register_board_info(apq8064_camera_i2c_devices.bus,
2473 apq8064_camera_i2c_devices.info,
2474 apq8064_camera_i2c_devices.len);
2475#endif
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002476
2477 for (i = 0; i < ARRAY_SIZE(mpq8064_i2c_devices); ++i) {
2478 if (mpq8064_i2c_devices[i].machs & mach_mask)
2479 i2c_register_board_info(
2480 mpq8064_i2c_devices[i].bus,
2481 mpq8064_i2c_devices[i].info,
2482 mpq8064_i2c_devices[i].len);
2483 }
Jing Lin417fa452012-02-05 14:31:06 -08002484}
2485
Jay Chokshi994ff122012-03-27 15:43:48 -07002486static void enable_ddr3_regulator(void)
2487{
2488 static struct regulator *ext_ddr3;
2489
2490 /* Use MPP7 output state as a flag for PCDDR3 presence. */
2491 if (gpio_get_value_cansleep(PM8921_MPP_PM_TO_SYS(7)) > 0) {
2492 ext_ddr3 = regulator_get(NULL, "ext_ddr3");
2493 if (IS_ERR(ext_ddr3) || ext_ddr3 == NULL)
2494 pr_err("Could not get MPP7 regulator\n");
2495 else
2496 regulator_enable(ext_ddr3);
2497 }
2498}
2499
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002500static void enable_avc_i2c_bus(void)
2501{
2502 int avc_i2c_en_mpp = PM8921_MPP_PM_TO_SYS(8);
2503 int rc;
2504
2505 rc = gpio_request(avc_i2c_en_mpp, "avc_i2c_en");
2506 if (rc)
2507 pr_err("request for avc_i2c_en mpp failed,"
2508 "rc=%d\n", rc);
2509 else
2510 gpio_set_value_cansleep(avc_i2c_en_mpp, 1);
2511}
2512
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002513static void __init apq8064_common_init(void)
2514{
Joel King8f839b92012-04-01 14:37:46 -07002515 msm_tsens_early_init(&apq_tsens_pdata);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002516 if (socinfo_init() < 0)
2517 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06002518 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
2519 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
David Collins2782b5c2012-02-06 10:02:42 -08002520 regulator_suppress_info_printing();
2521 platform_device_register(&apq8064_device_rpm_regulator);
Stephen Boyd4d0d2582012-02-10 14:49:40 -08002522 if (msm_xo_init())
2523 pr_err("Failed to initialize XO votes\n");
Matt Wagantallc51e5602012-02-27 17:25:25 -08002524 msm_clock_init(&apq8064_clock_init_data);
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08002525 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06002526 apq8064_i2c_init();
Jing Lin417fa452012-02-05 14:31:06 -08002527 register_i2c_devices();
Kenneth Heitke36920d32011-07-20 16:44:30 -06002528
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002529 apq8064_device_qup_spi_gsbi5.dev.platform_data =
2530 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08002531 apq8064_init_pmic();
Hemant Kumar94e7da22012-02-03 16:52:29 -08002532 if (machine_is_apq8064_liquid())
2533 msm_otg_pdata.mhl_enable = true;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07002534
2535 msm_otg_pdata.swfi_latency =
2536 msm_rpmrs_levels[0].latency_us + 1;
2537
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002538 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Manu Gautam91223e02011-11-08 15:27:22 +05302539 apq8064_ehci_host_init();
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002540 apq8064_init_buses();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002541 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Jay Chokshi994ff122012-03-27 15:43:48 -07002542 enable_ddr3_regulator();
Hemant Kumarf1ca9192012-02-07 18:59:33 -08002543 if (machine_is_apq8064_mtp()) {
2544 apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
2545 device_initialize(&apq8064_device_hsic_host.dev);
2546 }
Jay Chokshie8741282012-01-25 15:22:55 -08002547 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05302548 apq8064_init_mmc();
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08002549
2550 if (machine_is_apq8064_mtp()) {
2551 mdm_8064_device.dev.platform_data = &mdm_platform_data;
2552 platform_device_register(&mdm_8064_device);
2553 }
2554 platform_device_register(&apq8064_slim_ctrl);
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002555 slim_register_board_info(apq8064_slim_devices,
2556 ARRAY_SIZE(apq8064_slim_devices));
Jin Hongd3024e62012-02-09 16:13:32 -08002557 apq8064_init_dsps();
Praveen Chidambaram78499012011-11-01 17:15:17 -06002558 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Mahesh Sivasubramaniancbce1ec2012-01-24 10:32:44 -07002559 acpuclk_init(&acpuclk_8064_soc_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002560 msm_spm_l2_init(msm_spm_l2_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002561 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Praveen Chidambaram4d19be42012-04-03 18:05:52 -06002562 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002563 apq8064_epm_adc_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002564}
2565
Huaibin Yang4a084e32011-12-15 15:25:52 -08002566static void __init apq8064_allocate_memory_regions(void)
2567{
2568 apq8064_allocate_fb_region();
2569}
2570
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002571static void __init apq8064_sim_init(void)
2572{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002573 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
2574 &msm8064_device_watchdog.dev.platform_data;
2575
2576 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002577 apq8064_common_init();
Joel King4e7ad222011-08-17 15:47:38 -07002578 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
2579}
2580
2581static void __init apq8064_rumi3_init(void)
2582{
2583 apq8064_common_init();
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002584 ethernet_init();
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002585 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002586 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002587}
2588
Joel King82b7e3f2012-01-05 10:03:27 -08002589static void __init apq8064_cdp_init(void)
2590{
2591 apq8064_common_init();
Joel King8f839b92012-04-01 14:37:46 -07002592 if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
2593 machine_is_mpq8064_dtv()) {
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002594 enable_avc_i2c_bus();
Joel King8f839b92012-04-01 14:37:46 -07002595 platform_add_devices(mpq_devices, ARRAY_SIZE(mpq_devices));
2596 } else {
2597 ethernet_init();
2598 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
2599 spi_register_board_info(spi_board_info,
2600 ARRAY_SIZE(spi_board_info));
2601 }
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002602 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07002603 apq8064_init_gpu();
Matt Wagantall1875d322012-02-22 16:11:33 -08002604 platform_add_devices(apq8064_fs_devices, apq8064_num_fs_devices);
Kevin Chand07220e2012-02-13 15:52:22 -08002605 apq8064_init_cam();
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302606
2607 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
2608 platform_device_register(&cdp_kp_pdev);
2609
2610 if (machine_is_apq8064_mtp())
2611 platform_device_register(&mtp_kp_pdev);
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