blob: a017347a657b7605c05f49acc8b9cfe64554bb7a [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>
Joel King4ebccc62011-07-22 09:43:22 -070069
Jeff Ohlstein7e668552011-10-06 16:17:25 -070070#include "msm_watchdog.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080071#include "board-8064.h"
Vikram Mulukutlabc2e9572011-11-04 03:41:38 -070072#include "acpuclock.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060073#include "spm.h"
74#include "mpm.h"
75#include "rpm_resources.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080076#include "pm.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060077#include "pm-boot.h"
Rajesh Sastrulaaee8af32012-01-20 11:46:31 -080078#include "devices-msm8x60.h"
Jay Chokshiea67c622011-07-29 17:12:26 -070079
Olav Haugan7c6aa742012-01-16 16:47:37 -080080#define MSM_PMEM_ADSP_SIZE 0x7800000
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -070081#define MSM_PMEM_AUDIO_SIZE 0x4CF000
Olav Haugan7c6aa742012-01-16 16:47:37 -080082#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
83#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
84#else
Chetan Kalyan72aac4f2012-02-23 14:56:54 -080085#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Olav Haugan7c6aa742012-01-16 16:47:37 -080086#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070087
Olav Haugan7c6aa742012-01-16 16:47:37 -080088#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -070089#define MSM_PMEM_KERNEL_EBI1_SIZE 0x65000
Olav Haugan129992c2012-03-22 09:54:01 -070090#ifdef CONFIG_MSM_IOMMU
91#define MSM_ION_MM_SIZE 0x3800000
92#define MSM_ION_SF_SIZE 0
93#define MSM_ION_HEAP_NUM 7
94#else
Olav Haugan7c6aa742012-01-16 16:47:37 -080095#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Haugan129992c2012-03-22 09:54:01 -070096#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
97#define MSM_ION_HEAP_NUM 8
98#endif
99#define MSM_ION_MM_FW_SIZE 0x200000 /* (2MB) */
Olav Haugan3a9bd232012-02-15 14:23:27 -0800100#define MSM_ION_QSECOM_SIZE 0x300000 /* (3MB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800101#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan2c43fac2012-01-19 11:06:37 -0800102#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Olav Haugan7c6aa742012-01-16 16:47:37 -0800103#else
104#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
105#define MSM_ION_HEAP_NUM 1
106#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700107
Olav Haugan7c6aa742012-01-16 16:47:37 -0800108#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
109static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
110static int __init pmem_kernel_ebi1_size_setup(char *p)
Kevin Chan13be4e22011-10-20 11:30:32 -0700111{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800112 pmem_kernel_ebi1_size = memparse(p, NULL);
113 return 0;
Kevin Chan13be4e22011-10-20 11:30:32 -0700114}
Olav Haugan7c6aa742012-01-16 16:47:37 -0800115early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
116#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700117
Olav Haugan7c6aa742012-01-16 16:47:37 -0800118#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -0700119static unsigned pmem_size = MSM_PMEM_SIZE;
120static int __init pmem_size_setup(char *p)
121{
122 pmem_size = memparse(p, NULL);
123 return 0;
124}
125early_param("pmem_size", pmem_size_setup);
126
127static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
128
129static int __init pmem_adsp_size_setup(char *p)
130{
131 pmem_adsp_size = memparse(p, NULL);
132 return 0;
133}
134early_param("pmem_adsp_size", pmem_adsp_size_setup);
135
136static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
137
138static int __init pmem_audio_size_setup(char *p)
139{
140 pmem_audio_size = memparse(p, NULL);
141 return 0;
142}
143early_param("pmem_audio_size", pmem_audio_size_setup);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800144#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700145
Olav Haugan7c6aa742012-01-16 16:47:37 -0800146#ifdef CONFIG_ANDROID_PMEM
147#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700148static struct android_pmem_platform_data android_pmem_pdata = {
149 .name = "pmem",
150 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
151 .cached = 1,
152 .memory_type = MEMTYPE_EBI1,
153};
154
155static struct platform_device android_pmem_device = {
156 .name = "android_pmem",
157 .id = 0,
158 .dev = {.platform_data = &android_pmem_pdata},
159};
160
161static struct android_pmem_platform_data android_pmem_adsp_pdata = {
162 .name = "pmem_adsp",
163 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
164 .cached = 0,
165 .memory_type = MEMTYPE_EBI1,
166};
Kevin Chan13be4e22011-10-20 11:30:32 -0700167static struct platform_device android_pmem_adsp_device = {
168 .name = "android_pmem",
169 .id = 2,
170 .dev = { .platform_data = &android_pmem_adsp_pdata },
171};
172
173static struct android_pmem_platform_data android_pmem_audio_pdata = {
174 .name = "pmem_audio",
175 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
176 .cached = 0,
177 .memory_type = MEMTYPE_EBI1,
178};
179
180static struct platform_device android_pmem_audio_device = {
181 .name = "android_pmem",
182 .id = 4,
183 .dev = { .platform_data = &android_pmem_audio_pdata },
184};
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700185#endif /* CONFIG_MSM_MULTIMEDIA_USE_ION */
186#endif /* CONFIG_ANDROID_PMEM */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800187
188static struct memtype_reserve apq8064_reserve_table[] __initdata = {
189 [MEMTYPE_SMI] = {
190 },
191 [MEMTYPE_EBI0] = {
192 .flags = MEMTYPE_FLAGS_1M_ALIGN,
193 },
194 [MEMTYPE_EBI1] = {
195 .flags = MEMTYPE_FLAGS_1M_ALIGN,
196 },
197};
Kevin Chan13be4e22011-10-20 11:30:32 -0700198
Laura Abbott350c8362012-02-28 14:46:52 -0800199#if defined(CONFIG_MSM_RTB)
200static struct msm_rtb_platform_data msm_rtb_pdata = {
201 .size = SZ_1M,
202};
203
204static int __init msm_rtb_set_buffer_size(char *p)
205{
206 int s;
207
208 s = memparse(p, NULL);
209 msm_rtb_pdata.size = ALIGN(s, SZ_4K);
210 return 0;
211}
212early_param("msm_rtb_size", msm_rtb_set_buffer_size);
213
214
215static struct platform_device msm_rtb_device = {
216 .name = "msm_rtb",
217 .id = -1,
218 .dev = {
219 .platform_data = &msm_rtb_pdata,
220 },
221};
222#endif
223
224static void __init reserve_rtb_memory(void)
225{
226#if defined(CONFIG_MSM_RTB)
227 apq8064_reserve_table[MEMTYPE_EBI1].size += msm_rtb_pdata.size;
228#endif
229}
230
231
Kevin Chan13be4e22011-10-20 11:30:32 -0700232static void __init size_pmem_devices(void)
233{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800234#ifdef CONFIG_ANDROID_PMEM
235#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700236 android_pmem_adsp_pdata.size = pmem_adsp_size;
237 android_pmem_pdata.size = pmem_size;
238 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700239#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
240#endif /*CONFIG_ANDROID_PMEM*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700241}
242
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700243#ifdef CONFIG_ANDROID_PMEM
244#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700245static void __init reserve_memory_for(struct android_pmem_platform_data *p)
246{
247 apq8064_reserve_table[p->memory_type].size += p->size;
248}
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700249#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
250#endif /*CONFIG_ANDROID_PMEM*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700251
Kevin Chan13be4e22011-10-20 11:30:32 -0700252static void __init reserve_pmem_memory(void)
253{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800254#ifdef CONFIG_ANDROID_PMEM
255#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700256 reserve_memory_for(&android_pmem_adsp_pdata);
257 reserve_memory_for(&android_pmem_pdata);
258 reserve_memory_for(&android_pmem_audio_pdata);
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700259#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700260 apq8064_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700261#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -0800262}
263
264static int apq8064_paddr_to_memtype(unsigned int paddr)
265{
266 return MEMTYPE_EBI1;
267}
268
269#ifdef CONFIG_ION_MSM
270#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
271static struct ion_cp_heap_pdata cp_mm_ion_pdata = {
272 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugand3d29682012-01-19 10:57:07 -0800273 .align = PAGE_SIZE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800274};
275
276static struct ion_cp_heap_pdata cp_mfc_ion_pdata = {
277 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugand3d29682012-01-19 10:57:07 -0800278 .align = PAGE_SIZE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800279};
280
281static struct ion_co_heap_pdata co_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800282 .adjacent_mem_id = INVALID_HEAP_ID,
283 .align = PAGE_SIZE,
284};
285
286static struct ion_co_heap_pdata fw_co_ion_pdata = {
287 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
288 .align = SZ_128K,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800289};
290#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800291
292/**
293 * These heaps are listed in the order they will be allocated. Due to
294 * video hardware restrictions and content protection the FW heap has to
295 * be allocated adjacent (below) the MM heap and the MFC heap has to be
296 * allocated after the MM heap to ensure MFC heap is not more than 256MB
297 * away from the base address of the FW heap.
298 * However, the order of FW heap and MM heap doesn't matter since these
299 * two heaps are taken care of by separate code to ensure they are adjacent
300 * to each other.
301 * Don't swap the order unless you know what you are doing!
302 */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800303static struct ion_platform_data ion_pdata = {
304 .nr = MSM_ION_HEAP_NUM,
305 .heaps = {
306 {
307 .id = ION_SYSTEM_HEAP_ID,
308 .type = ION_HEAP_TYPE_SYSTEM,
309 .name = ION_VMALLOC_HEAP_NAME,
310 },
311#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
312 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800313 .id = ION_CP_MM_HEAP_ID,
314 .type = ION_HEAP_TYPE_CP,
315 .name = ION_MM_HEAP_NAME,
316 .size = MSM_ION_MM_SIZE,
317 .memory_type = ION_EBI_TYPE,
318 .extra_data = (void *) &cp_mm_ion_pdata,
319 },
320 {
Olav Haugand3d29682012-01-19 10:57:07 -0800321 .id = ION_MM_FIRMWARE_HEAP_ID,
322 .type = ION_HEAP_TYPE_CARVEOUT,
323 .name = ION_MM_FIRMWARE_HEAP_NAME,
324 .size = MSM_ION_MM_FW_SIZE,
325 .memory_type = ION_EBI_TYPE,
326 .extra_data = (void *) &fw_co_ion_pdata,
327 },
328 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800329 .id = ION_CP_MFC_HEAP_ID,
330 .type = ION_HEAP_TYPE_CP,
331 .name = ION_MFC_HEAP_NAME,
332 .size = MSM_ION_MFC_SIZE,
333 .memory_type = ION_EBI_TYPE,
334 .extra_data = (void *) &cp_mfc_ion_pdata,
335 },
Olav Haugan129992c2012-03-22 09:54:01 -0700336#ifndef CONFIG_MSM_IOMMU
Olav Haugan7c6aa742012-01-16 16:47:37 -0800337 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800338 .id = ION_SF_HEAP_ID,
339 .type = ION_HEAP_TYPE_CARVEOUT,
340 .name = ION_SF_HEAP_NAME,
341 .size = MSM_ION_SF_SIZE,
342 .memory_type = ION_EBI_TYPE,
343 .extra_data = (void *) &co_ion_pdata,
344 },
Olav Haugan129992c2012-03-22 09:54:01 -0700345#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800346 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800347 .id = ION_IOMMU_HEAP_ID,
348 .type = ION_HEAP_TYPE_IOMMU,
349 .name = ION_IOMMU_HEAP_NAME,
350 },
Olav Hauganf45e2142012-01-19 11:01:01 -0800351 {
352 .id = ION_QSECOM_HEAP_ID,
353 .type = ION_HEAP_TYPE_CARVEOUT,
354 .name = ION_QSECOM_HEAP_NAME,
355 .size = MSM_ION_QSECOM_SIZE,
356 .memory_type = ION_EBI_TYPE,
357 .extra_data = (void *) &co_ion_pdata,
358 },
Olav Haugan2c43fac2012-01-19 11:06:37 -0800359 {
360 .id = ION_AUDIO_HEAP_ID,
361 .type = ION_HEAP_TYPE_CARVEOUT,
362 .name = ION_AUDIO_HEAP_NAME,
363 .size = MSM_ION_AUDIO_SIZE,
364 .memory_type = ION_EBI_TYPE,
365 .extra_data = (void *) &co_ion_pdata,
366 },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800367#endif
368 }
369};
370
371static struct platform_device ion_dev = {
372 .name = "ion-msm",
373 .id = 1,
374 .dev = { .platform_data = &ion_pdata },
375};
376#endif
377
378static void reserve_ion_memory(void)
379{
380#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
381 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_SIZE;
Olav Haugand3d29682012-01-19 10:57:07 -0800382 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_FW_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800383 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_SF_SIZE;
384 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MFC_SIZE;
Olav Hauganf45e2142012-01-19 11:01:01 -0800385 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_QSECOM_SIZE;
Olav Haugan2c43fac2012-01-19 11:06:37 -0800386 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_AUDIO_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800387#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700388}
389
Huaibin Yang4a084e32011-12-15 15:25:52 -0800390static void __init reserve_mdp_memory(void)
391{
392 apq8064_mdp_writeback(apq8064_reserve_table);
393}
394
Kevin Chan13be4e22011-10-20 11:30:32 -0700395static void __init apq8064_calculate_reserve_sizes(void)
396{
397 size_pmem_devices();
398 reserve_pmem_memory();
Olav Haugan7c6aa742012-01-16 16:47:37 -0800399 reserve_ion_memory();
Huaibin Yang4a084e32011-12-15 15:25:52 -0800400 reserve_mdp_memory();
Laura Abbott350c8362012-02-28 14:46:52 -0800401 reserve_rtb_memory();
Kevin Chan13be4e22011-10-20 11:30:32 -0700402}
403
404static struct reserve_info apq8064_reserve_info __initdata = {
405 .memtype_reserve_table = apq8064_reserve_table,
406 .calculate_reserve_sizes = apq8064_calculate_reserve_sizes,
407 .paddr_to_memtype = apq8064_paddr_to_memtype,
408};
409
410static int apq8064_memory_bank_size(void)
411{
412 return 1<<29;
413}
414
415static void __init locate_unstable_memory(void)
416{
417 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
418 unsigned long bank_size;
419 unsigned long low, high;
420
421 bank_size = apq8064_memory_bank_size();
422 low = meminfo.bank[0].start;
423 high = mb->start + mb->size;
Olav Haugand76e3a82012-01-16 16:55:07 -0800424
425 /* Check if 32 bit overflow occured */
426 if (high < mb->start)
427 high = ~0UL;
428
Kevin Chan13be4e22011-10-20 11:30:32 -0700429 low &= ~(bank_size - 1);
430
431 if (high - low <= bank_size)
432 return;
Jack Cheung46bfffa2012-01-19 15:26:24 -0800433 apq8064_reserve_info.low_unstable_address = mb->start -
434 MIN_MEMORY_BLOCK_SIZE + mb->size;
435 apq8064_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
436
Kevin Chan13be4e22011-10-20 11:30:32 -0700437 apq8064_reserve_info.bank_size = bank_size;
438 pr_info("low unstable address %lx max size %lx bank size %lx\n",
439 apq8064_reserve_info.low_unstable_address,
440 apq8064_reserve_info.max_unstable_size,
441 apq8064_reserve_info.bank_size);
442}
443
Aravind Venkateswaran8ac7f412012-03-16 17:57:30 -0700444static char prim_panel_name[PANEL_NAME_MAX_LEN];
445static char ext_panel_name[PANEL_NAME_MAX_LEN];
446static int __init prim_display_setup(char *param)
447{
448 if (strnlen(param, PANEL_NAME_MAX_LEN))
449 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
450 return 0;
451}
452early_param("prim_display", prim_display_setup);
453
454static int __init ext_display_setup(char *param)
455{
456 if (strnlen(param, PANEL_NAME_MAX_LEN))
457 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
458 return 0;
459}
460early_param("ext_display", ext_display_setup);
461
Kevin Chan13be4e22011-10-20 11:30:32 -0700462static void __init apq8064_reserve(void)
463{
Aravind Venkateswaran8ac7f412012-03-16 17:57:30 -0700464 apq8064_set_display_params(prim_panel_name, ext_panel_name);
Kevin Chan13be4e22011-10-20 11:30:32 -0700465 msm_reserve();
466}
467
Laura Abbott6988cef2012-03-15 14:27:13 -0700468static void __init place_movable_zone(void)
469{
470 movable_reserved_start = apq8064_reserve_info.low_unstable_address;
471 movable_reserved_size = apq8064_reserve_info.max_unstable_size;
472 pr_info("movable zone start %lx size %lx\n",
473 movable_reserved_start, movable_reserved_size);
474}
475
476static void __init apq8064_early_reserve(void)
477{
478 reserve_info = &apq8064_reserve_info;
479 locate_unstable_memory();
480 place_movable_zone();
481
482}
Hemant Kumara945b472012-01-25 15:08:06 -0800483#ifdef CONFIG_USB_EHCI_MSM_HSIC
Hemant Kumare6275972012-02-29 20:06:21 -0800484/* Bandwidth requests (zero) if no vote placed */
485static struct msm_bus_vectors hsic_init_vectors[] = {
486 {
487 .src = MSM_BUS_MASTER_SPS,
488 .dst = MSM_BUS_SLAVE_EBI_CH0,
489 .ab = 0,
490 .ib = 0,
491 },
492 {
493 .src = MSM_BUS_MASTER_SPS,
494 .dst = MSM_BUS_SLAVE_SPS,
495 .ab = 0,
496 .ib = 0,
497 },
498};
499
500/* Bus bandwidth requests in Bytes/sec */
501static struct msm_bus_vectors hsic_max_vectors[] = {
502 {
503 .src = MSM_BUS_MASTER_SPS,
504 .dst = MSM_BUS_SLAVE_EBI_CH0,
505 .ab = 60000000, /* At least 480Mbps on bus. */
506 .ib = 960000000, /* MAX bursts rate */
507 },
508 {
509 .src = MSM_BUS_MASTER_SPS,
510 .dst = MSM_BUS_SLAVE_SPS,
511 .ab = 0,
512 .ib = 512000000, /*vote for 64Mhz dfab clk rate*/
513 },
514};
515
516static struct msm_bus_paths hsic_bus_scale_usecases[] = {
517 {
518 ARRAY_SIZE(hsic_init_vectors),
519 hsic_init_vectors,
520 },
521 {
522 ARRAY_SIZE(hsic_max_vectors),
523 hsic_max_vectors,
524 },
525};
526
527static struct msm_bus_scale_pdata hsic_bus_scale_pdata = {
528 hsic_bus_scale_usecases,
529 ARRAY_SIZE(hsic_bus_scale_usecases),
530 .name = "hsic",
531};
532
Hemant Kumara945b472012-01-25 15:08:06 -0800533static struct msm_hsic_host_platform_data msm_hsic_pdata = {
Hemant Kumare6275972012-02-29 20:06:21 -0800534 .strobe = 88,
535 .data = 89,
536 .bus_scale_table = &hsic_bus_scale_pdata,
Hemant Kumara945b472012-01-25 15:08:06 -0800537};
538#else
539static struct msm_hsic_host_platform_data msm_hsic_pdata;
540#endif
541
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800542#define PID_MAGIC_ID 0x71432909
543#define SERIAL_NUM_MAGIC_ID 0x61945374
544#define SERIAL_NUMBER_LENGTH 127
545#define DLOAD_USB_BASE_ADD 0x2A03F0C8
546
547struct magic_num_struct {
548 uint32_t pid;
549 uint32_t serial_num;
550};
551
552struct dload_struct {
553 uint32_t reserved1;
554 uint32_t reserved2;
555 uint32_t reserved3;
556 uint16_t reserved4;
557 uint16_t pid;
558 char serial_number[SERIAL_NUMBER_LENGTH];
559 uint16_t reserved5;
560 struct magic_num_struct magic_struct;
561};
562
563static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
564{
565 struct dload_struct __iomem *dload = 0;
566
567 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
568 if (!dload) {
569 pr_err("%s: cannot remap I/O memory region: %08x\n",
570 __func__, DLOAD_USB_BASE_ADD);
571 return -ENXIO;
572 }
573
574 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
575 __func__, dload, pid, snum);
576 /* update pid */
577 dload->magic_struct.pid = PID_MAGIC_ID;
578 dload->pid = pid;
579
580 /* update serial number */
581 dload->magic_struct.serial_num = 0;
582 if (!snum) {
583 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
584 goto out;
585 }
586
587 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
588 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
589out:
590 iounmap(dload);
591 return 0;
592}
593
594static struct android_usb_platform_data android_usb_pdata = {
595 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
596};
597
Hemant Kumar4933b072011-10-17 23:43:11 -0700598static struct platform_device android_usb_device = {
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800599 .name = "android_usb",
600 .id = -1,
601 .dev = {
602 .platform_data = &android_usb_pdata,
603 },
Hemant Kumar4933b072011-10-17 23:43:11 -0700604};
605
Hemant Kumar7620eed2012-02-26 09:08:43 -0800606/* Bandwidth requests (zero) if no vote placed */
607static struct msm_bus_vectors usb_init_vectors[] = {
608 {
609 .src = MSM_BUS_MASTER_SPS,
610 .dst = MSM_BUS_SLAVE_EBI_CH0,
611 .ab = 0,
612 .ib = 0,
613 },
614};
615
616/* Bus bandwidth requests in Bytes/sec */
617static struct msm_bus_vectors usb_max_vectors[] = {
618 {
619 .src = MSM_BUS_MASTER_SPS,
620 .dst = MSM_BUS_SLAVE_EBI_CH0,
621 .ab = 60000000, /* At least 480Mbps on bus. */
622 .ib = 960000000, /* MAX bursts rate */
623 },
624};
625
626static struct msm_bus_paths usb_bus_scale_usecases[] = {
627 {
628 ARRAY_SIZE(usb_init_vectors),
629 usb_init_vectors,
630 },
631 {
632 ARRAY_SIZE(usb_max_vectors),
633 usb_max_vectors,
634 },
635};
636
637static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
638 usb_bus_scale_usecases,
639 ARRAY_SIZE(usb_bus_scale_usecases),
640 .name = "usb",
641};
642
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700643static int phy_init_seq[] = {
644 0x38, 0x81, /* update DC voltage level */
645 0x24, 0x82, /* set pre-emphasis and rise/fall time */
646 -1
647};
648
Hemant Kumar4933b072011-10-17 23:43:11 -0700649static struct msm_otg_platform_data msm_otg_pdata = {
Hemant Kumard86c4882012-01-24 19:39:37 -0800650 .mode = USB_OTG,
651 .otg_control = OTG_PMIC_CONTROL,
Hemant Kumar4933b072011-10-17 23:43:11 -0700652 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Hemant Kumard86c4882012-01-24 19:39:37 -0800653 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
654 .power_budget = 750,
Hemant Kumar7620eed2012-02-26 09:08:43 -0800655 .bus_scale_table = &usb_bus_scale_pdata,
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700656 .phy_init_seq = phy_init_seq,
Hemant Kumar4933b072011-10-17 23:43:11 -0700657};
658
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800659static struct msm_usb_host_platform_data msm_ehci_host_pdata3 = {
Manu Gautam91223e02011-11-08 15:27:22 +0530660 .power_budget = 500,
661};
662
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800663#ifdef CONFIG_USB_EHCI_MSM_HOST4
664static struct msm_usb_host_platform_data msm_ehci_host_pdata4;
665#endif
666
Manu Gautam91223e02011-11-08 15:27:22 +0530667static void __init apq8064_ehci_host_init(void)
668{
669 if (machine_is_apq8064_liquid()) {
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800670 msm_ehci_host_pdata3.dock_connect_irq =
Hemant Kumar56925352012-02-13 16:59:52 -0800671 PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9);
672
Manu Gautam91223e02011-11-08 15:27:22 +0530673 apq8064_device_ehci_host3.dev.platform_data =
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800674 &msm_ehci_host_pdata3;
Manu Gautam91223e02011-11-08 15:27:22 +0530675 platform_device_register(&apq8064_device_ehci_host3);
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800676
677#ifdef CONFIG_USB_EHCI_MSM_HOST4
678 apq8064_device_ehci_host4.dev.platform_data =
679 &msm_ehci_host_pdata4;
680 platform_device_register(&apq8064_device_ehci_host4);
681#endif
Manu Gautam91223e02011-11-08 15:27:22 +0530682 }
683}
684
David Keitel2f613d92012-02-15 11:29:16 -0800685static struct smb349_platform_data smb349_data __initdata = {
686 .en_n_gpio = PM8921_GPIO_PM_TO_SYS(37),
687 .chg_susp_gpio = PM8921_GPIO_PM_TO_SYS(30),
688 .chg_current_ma = 2200,
689};
690
691static struct i2c_board_info smb349_charger_i2c_info[] __initdata = {
692 {
693 I2C_BOARD_INFO(SMB349_NAME, 0x1B),
694 .platform_data = &smb349_data,
695 },
696};
697
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -0800698struct sx150x_platform_data apq8064_sx150x_data[] = {
699 [SX150X_EPM] = {
700 .gpio_base = GPIO_EPM_EXPANDER_BASE,
701 .oscio_is_gpo = false,
702 .io_pullup_ena = 0x0,
703 .io_pulldn_ena = 0x0,
704 .io_open_drain_ena = 0x0,
705 .io_polarity = 0,
706 .irq_summary = -1,
707 },
708};
709
710static struct epm_chan_properties ads_adc_channel_data[] = {
711 {10, 100}, {500, 50}, {1, 1}, {1, 1},
712 {20, 50}, {10, 100}, {1, 1}, {1, 1},
713 {10, 100}, {10, 100}, {100, 100}, {200, 100},
714 {100, 50}, {2000, 50}, {1000, 50}, {200, 50},
715 {200, 100}, {1, 1}, {20, 50}, {500, 50},
716 {50, 50}, {200, 100}, {500, 100}, {20, 50},
717 {200, 50}, {2000, 100}, {1000, 50}, {100, 50},
718 {200, 100}, {500, 50}, {1000, 100}, {200, 50},
719 {1000, 50}, {50, 50}, {100, 50}, {100, 50},
720 {1, 1}, {1, 1}, {20, 100}, {20, 50},
721 {500, 100}, {1000, 100}, {100, 50}, {1000, 50},
722 {100, 50}, {1000, 100}, {100, 50}, {100, 50},
723};
724
725static struct epm_adc_platform_data epm_adc_pdata = {
726 .channel = ads_adc_channel_data,
727 .bus_id = 0x0,
728 .epm_i2c_board_info = {
729 .type = "sx1509q",
730 .addr = 0x3e,
731 .platform_data = &apq8064_sx150x_data[SX150X_EPM],
732 },
733 .gpio_expander_base_addr = GPIO_EPM_EXPANDER_BASE,
734};
735
736static struct platform_device epm_adc_device = {
737 .name = "epm_adc",
738 .id = -1,
739 .dev = {
740 .platform_data = &epm_adc_pdata,
741 },
742};
743
744static void __init apq8064_epm_adc_init(void)
745{
746 epm_adc_pdata.num_channels = 32;
747 epm_adc_pdata.num_adc = 2;
748 epm_adc_pdata.chan_per_adc = 16;
749 epm_adc_pdata.chan_per_mux = 8;
750};
751
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800752/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
753 * 4 micbiases are used to power various analog and digital
754 * microphones operating at 1800 mV. Technically, all micbiases
755 * can source from single cfilter since all microphones operate
756 * at the same voltage level. The arrangement below is to make
757 * sure all cfilters are exercised. LDO_H regulator ouput level
758 * does not need to be as high as 2.85V. It is choosen for
759 * microphone sensitivity purpose.
760 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530761static struct wcd9xxx_pdata apq8064_tabla_platform_data = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800762 .slimbus_slave_device = {
763 .name = "tabla-slave",
764 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
765 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800766 .irq = MSM_GPIO_TO_INT(42),
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800767 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530768 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800769 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
770 .micbias = {
771 .ldoh_v = TABLA_LDOH_2P85_V,
772 .cfilt1_mv = 1800,
773 .cfilt2_mv = 1800,
774 .cfilt3_mv = 1800,
775 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
776 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
777 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
778 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530779 },
780 .regulator = {
781 {
782 .name = "CDC_VDD_CP",
783 .min_uV = 1800000,
784 .max_uV = 1800000,
785 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
786 },
787 {
788 .name = "CDC_VDDA_RX",
789 .min_uV = 1800000,
790 .max_uV = 1800000,
791 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
792 },
793 {
794 .name = "CDC_VDDA_TX",
795 .min_uV = 1800000,
796 .max_uV = 1800000,
797 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
798 },
799 {
800 .name = "VDDIO_CDC",
801 .min_uV = 1800000,
802 .max_uV = 1800000,
803 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
804 },
805 {
806 .name = "VDDD_CDC_D",
807 .min_uV = 1225000,
808 .max_uV = 1225000,
809 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
810 },
811 {
812 .name = "CDC_VDDA_A_1P2V",
813 .min_uV = 1225000,
814 .max_uV = 1225000,
815 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
816 },
817 },
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800818};
819
820static struct slim_device apq8064_slim_tabla = {
821 .name = "tabla-slim",
822 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
823 .dev = {
824 .platform_data = &apq8064_tabla_platform_data,
825 },
826};
827
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530828static struct wcd9xxx_pdata apq8064_tabla20_platform_data = {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800829 .slimbus_slave_device = {
830 .name = "tabla-slave",
831 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
832 },
833 .irq = MSM_GPIO_TO_INT(42),
834 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530835 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800836 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
837 .micbias = {
838 .ldoh_v = TABLA_LDOH_2P85_V,
839 .cfilt1_mv = 1800,
840 .cfilt2_mv = 1800,
841 .cfilt3_mv = 1800,
842 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
843 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
844 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
845 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530846 },
847 .regulator = {
848 {
849 .name = "CDC_VDD_CP",
850 .min_uV = 1800000,
851 .max_uV = 1800000,
852 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
853 },
854 {
855 .name = "CDC_VDDA_RX",
856 .min_uV = 1800000,
857 .max_uV = 1800000,
858 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
859 },
860 {
861 .name = "CDC_VDDA_TX",
862 .min_uV = 1800000,
863 .max_uV = 1800000,
864 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
865 },
866 {
867 .name = "VDDIO_CDC",
868 .min_uV = 1800000,
869 .max_uV = 1800000,
870 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
871 },
872 {
873 .name = "VDDD_CDC_D",
874 .min_uV = 1225000,
875 .max_uV = 1225000,
876 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
877 },
878 {
879 .name = "CDC_VDDA_A_1P2V",
880 .min_uV = 1225000,
881 .max_uV = 1225000,
882 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
883 },
884 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800885};
886
887static struct slim_device apq8064_slim_tabla20 = {
888 .name = "tabla2x-slim",
889 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
890 .dev = {
891 .platform_data = &apq8064_tabla20_platform_data,
892 },
893};
894
Santosh Mardi695be0d2012-04-10 23:21:12 +0530895/* enable the level shifter for cs8427 to make sure the I2C
896 * clock is running at 100KHz and voltage levels are at 3.3
897 * and 5 volts
898 */
899static int enable_100KHz_ls(int enable)
900{
901 int ret = 0;
902 if (enable) {
903 ret = gpio_request(SX150X_GPIO(1, 10),
904 "cs8427_100KHZ_ENABLE");
905 if (ret) {
906 pr_err("%s: Failed to request gpio %d\n", __func__,
907 SX150X_GPIO(1, 10));
908 return ret;
909 }
910 gpio_direction_output(SX150X_GPIO(1, 10), 1);
911 } else
912 gpio_free(SX150X_GPIO(1, 10));
913 return ret;
914}
915
Santosh Mardieff9a742012-04-09 23:23:39 +0530916static struct cs8427_platform_data cs8427_i2c_platform_data = {
917 .irq = SX150X_GPIO(1, 4),
918 .reset_gpio = SX150X_GPIO(1, 6),
Santosh Mardi695be0d2012-04-10 23:21:12 +0530919 .enable = enable_100KHz_ls,
Santosh Mardieff9a742012-04-09 23:23:39 +0530920};
921
922static struct i2c_board_info cs8427_device_info[] __initdata = {
923 {
924 I2C_BOARD_INFO("cs8427", CS8427_ADDR4),
925 .platform_data = &cs8427_i2c_platform_data,
926 },
927};
928
Amy Maloche70090f992012-02-16 16:35:26 -0800929#define HAP_SHIFT_LVL_OE_GPIO PM8921_MPP_PM_TO_SYS(8)
930#define ISA1200_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
931#define ISA1200_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
932#define ISA1200_HAP_CLK PM8921_GPIO_PM_TO_SYS(44)
933
934static int isa1200_power(int on)
935{
936 gpio_set_value_cansleep(ISA1200_HAP_CLK, !!on);
937
938 return 0;
939}
940
941static int isa1200_dev_setup(bool enable)
942{
943 int rc = 0;
944
945 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_1, enable);
946 if (rc) {
947 pr_err("%s: unable to write aux clock register(%d)\n",
948 __func__, rc);
949 return rc;
950 }
951
952 if (!enable)
953 goto free_gpio;
954
955 rc = gpio_request(ISA1200_HAP_CLK, "haptics_clk");
956 if (rc) {
957 pr_err("%s: unable to request gpio %d config(%d)\n",
958 __func__, ISA1200_HAP_CLK, rc);
959 return rc;
960 }
961
962 rc = gpio_direction_output(ISA1200_HAP_CLK, 0);
963 if (rc) {
964 pr_err("%s: unable to set direction\n", __func__);
965 goto free_gpio;
966 }
967
968 return 0;
969
970free_gpio:
971 gpio_free(ISA1200_HAP_CLK);
972 return rc;
973}
974
975static struct isa1200_regulator isa1200_reg_data[] = {
976 {
977 .name = "vddp",
978 .min_uV = ISA_I2C_VTG_MIN_UV,
979 .max_uV = ISA_I2C_VTG_MAX_UV,
980 .load_uA = ISA_I2C_CURR_UA,
981 },
982};
983
984static struct isa1200_platform_data isa1200_1_pdata = {
985 .name = "vibrator",
986 .dev_setup = isa1200_dev_setup,
987 .power_on = isa1200_power,
988 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
989 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
990 .max_timeout = 15000,
991 .mode_ctrl = PWM_GEN_MODE,
992 .pwm_fd = {
993 .pwm_div = 256,
994 },
995 .is_erm = false,
996 .smart_en = true,
997 .ext_clk_en = true,
998 .chip_en = 1,
999 .regulator_info = isa1200_reg_data,
1000 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1001};
1002
1003static struct i2c_board_info isa1200_board_info[] __initdata = {
1004 {
1005 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1006 .platform_data = &isa1200_1_pdata,
1007 },
1008};
Jing Lin21ed4de2012-02-05 15:53:28 -08001009/* configuration data for mxt1386e using V2.1 firmware */
1010static const u8 mxt1386e_config_data_v2_1[] = {
1011 /* T6 Object */
1012 0, 0, 0, 0, 0, 0,
1013 /* T38 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001014 14, 1, 0, 22, 2, 12, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001015 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1016 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1017 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1018 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1019 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1020 0, 0, 0, 0,
1021 /* T7 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001022 100, 10, 50,
Jing Lin21ed4de2012-02-05 15:53:28 -08001023 /* T8 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001024 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001025 /* T9 Object */
1026 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
1027 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
Jing Linf1208fd2012-02-23 11:15:42 -08001028 85, 5, 0, 5, 9, 5, 12, 35, 70, 40,
1029 20, 5, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001030 /* T18 Object */
1031 0, 0,
1032 /* T24 Object */
1033 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1034 0, 0, 0, 0, 0, 0, 0, 0, 0,
1035 /* T25 Object */
1036 3, 0, 60, 115, 156, 99,
1037 /* T27 Object */
1038 0, 0, 0, 0, 0, 0, 0,
1039 /* T40 Object */
1040 0, 0, 0, 0, 0,
1041 /* T42 Object */
1042 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
1043 /* T43 Object */
1044 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
1045 16,
1046 /* T46 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001047 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001048 /* T47 Object */
1049 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
1050 /* T48 Object */
1051 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001052 32, 40, 0, 10, 10, 0, 0, 100, 10, 90,
1053 0, 0, 0, 0, 0, 0, 0, 10, 1, 10,
1054 52, 10, 12, 0, 33, 0, 1, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001055 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1056 0, 0, 0, 0,
1057 /* T56 Object */
1058 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1059 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1060 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1061 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001062 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1063 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001064};
1065
1066#define MXT_TS_GPIO_IRQ 6
1067#define MXT_TS_PWR_EN_GPIO PM8921_GPIO_PM_TO_SYS(23)
1068#define MXT_TS_RESET_GPIO 33
1069
1070static struct mxt_config_info mxt_config_array[] = {
1071 {
1072 .config = mxt1386e_config_data_v2_1,
1073 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1074 .family_id = 0xA0,
1075 .variant_id = 0x7,
1076 .version = 0x21,
1077 .build = 0xAA,
Jing Linef4aa9b2012-03-26 12:01:41 -07001078 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
1079 .fw_name = "atmel_8064_liquid_v2_2_AA.hex",
1080 },
1081 {
1082 /* The config data for V2.2.AA is the same as for V2.1.AA */
1083 .config = mxt1386e_config_data_v2_1,
1084 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1085 .family_id = 0xA0,
1086 .variant_id = 0x7,
1087 .version = 0x22,
1088 .build = 0xAA,
1089 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin21ed4de2012-02-05 15:53:28 -08001090 },
1091};
1092
1093static struct mxt_platform_data mxt_platform_data = {
1094 .config_array = mxt_config_array,
1095 .config_array_size = ARRAY_SIZE(mxt_config_array),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08001096 .panel_minx = 0,
1097 .panel_maxx = 1365,
1098 .panel_miny = 0,
1099 .panel_maxy = 767,
1100 .disp_minx = 0,
1101 .disp_maxx = 1365,
1102 .disp_miny = 0,
1103 .disp_maxy = 767,
Anirudh Ghayal39dbe3f2012-04-13 15:43:16 +05301104 .irqflags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
Jing Lin21ed4de2012-02-05 15:53:28 -08001105 .i2c_pull_up = true,
1106 .reset_gpio = MXT_TS_RESET_GPIO,
1107 .irq_gpio = MXT_TS_GPIO_IRQ,
1108};
1109
1110static struct i2c_board_info mxt_device_info[] __initdata = {
1111 {
1112 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
1113 .platform_data = &mxt_platform_data,
1114 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1115 },
1116};
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001117#define CYTTSP_TS_GPIO_IRQ 6
1118#define CYTTSP_TS_GPIO_RESOUT 7
1119#define CYTTSP_TS_GPIO_SLEEP 33
1120
1121static ssize_t tma340_vkeys_show(struct kobject *kobj,
1122 struct kobj_attribute *attr, char *buf)
1123{
1124 return snprintf(buf, 200,
1125 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1126 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1127 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1128 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1129 "\n");
1130}
1131
1132static struct kobj_attribute tma340_vkeys_attr = {
1133 .attr = {
1134 .mode = S_IRUGO,
1135 },
1136 .show = &tma340_vkeys_show,
1137};
1138
1139static struct attribute *tma340_properties_attrs[] = {
1140 &tma340_vkeys_attr.attr,
1141 NULL
1142};
1143
1144static struct attribute_group tma340_properties_attr_group = {
1145 .attrs = tma340_properties_attrs,
1146};
1147
1148static int cyttsp_platform_init(struct i2c_client *client)
1149{
1150 int rc = 0;
1151 static struct kobject *tma340_properties_kobj;
1152
1153 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1154 tma340_properties_kobj = kobject_create_and_add("board_properties",
1155 NULL);
1156 if (tma340_properties_kobj)
1157 rc = sysfs_create_group(tma340_properties_kobj,
1158 &tma340_properties_attr_group);
1159 if (!tma340_properties_kobj || rc)
1160 pr_err("%s: failed to create board_properties\n",
1161 __func__);
1162
1163 return 0;
1164}
1165
1166static struct cyttsp_regulator cyttsp_regulator_data[] = {
1167 {
1168 .name = "vdd",
1169 .min_uV = CY_TMA300_VTG_MIN_UV,
1170 .max_uV = CY_TMA300_VTG_MAX_UV,
1171 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1172 .lpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1173 },
1174 {
1175 .name = "vcc_i2c",
1176 .min_uV = CY_I2C_VTG_MIN_UV,
1177 .max_uV = CY_I2C_VTG_MAX_UV,
1178 .hpm_load_uA = CY_I2C_CURR_UA,
1179 .lpm_load_uA = CY_I2C_CURR_UA,
1180 },
1181};
1182
1183static struct cyttsp_platform_data cyttsp_pdata = {
1184 .panel_maxx = 634,
1185 .panel_maxy = 1166,
1186 .disp_maxx = 599,
1187 .disp_maxy = 1023,
1188 .disp_minx = 0,
1189 .disp_miny = 0,
1190 .flags = 0x01,
1191 .gen = CY_GEN3,
1192 .use_st = CY_USE_ST,
1193 .use_mt = CY_USE_MT,
1194 .use_hndshk = CY_SEND_HNDSHK,
1195 .use_trk_id = CY_USE_TRACKING_ID,
1196 .use_sleep = CY_USE_DEEP_SLEEP_SEL,
1197 .use_gestures = CY_USE_GESTURES,
1198 .fw_fname = "cyttsp_8064_mtp.hex",
1199 /* change act_intrvl to customize the Active power state
1200 * scanning/processing refresh interval for Operating mode
1201 */
1202 .act_intrvl = CY_ACT_INTRVL_DFLT,
1203 /* change tch_tmout to customize the touch timeout for the
1204 * Active power state for Operating mode
1205 */
1206 .tch_tmout = CY_TCH_TMOUT_DFLT,
1207 /* change lp_intrvl to customize the Low Power power state
1208 * scanning/processing refresh interval for Operating mode
1209 */
1210 .lp_intrvl = CY_LP_INTRVL_DFLT,
1211 .sleep_gpio = CYTTSP_TS_GPIO_SLEEP,
1212 .resout_gpio = CYTTSP_TS_GPIO_RESOUT,
1213 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1214 .regulator_info = cyttsp_regulator_data,
1215 .num_regulators = ARRAY_SIZE(cyttsp_regulator_data),
1216 .init = cyttsp_platform_init,
1217 .correct_fw_ver = 17,
1218};
1219
1220static struct i2c_board_info cyttsp_info[] __initdata = {
1221 {
1222 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1223 .platform_data = &cyttsp_pdata,
1224 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1225 },
1226};
Jing Lin21ed4de2012-02-05 15:53:28 -08001227
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001228#define MSM_WCNSS_PHYS 0x03000000
1229#define MSM_WCNSS_SIZE 0x280000
1230
1231static struct resource resources_wcnss_wlan[] = {
1232 {
1233 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1234 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1235 .name = "wcnss_wlanrx_irq",
1236 .flags = IORESOURCE_IRQ,
1237 },
1238 {
1239 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1240 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1241 .name = "wcnss_wlantx_irq",
1242 .flags = IORESOURCE_IRQ,
1243 },
1244 {
1245 .start = MSM_WCNSS_PHYS,
1246 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1247 .name = "wcnss_mmio",
1248 .flags = IORESOURCE_MEM,
1249 },
1250 {
1251 .start = 64,
1252 .end = 68,
1253 .name = "wcnss_gpios_5wire",
1254 .flags = IORESOURCE_IO,
1255 },
1256};
1257
1258static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1259 .has_48mhz_xo = 1,
1260};
1261
1262static struct platform_device msm_device_wcnss_wlan = {
1263 .name = "wcnss_wlan",
1264 .id = 0,
1265 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1266 .resource = resources_wcnss_wlan,
1267 .dev = {.platform_data = &qcom_wcnss_pdata},
1268};
1269
Ankit Vermab7c26e62012-02-28 15:04:15 -08001270static struct platform_device msm_device_iris_fm __devinitdata = {
1271 .name = "iris_fm",
1272 .id = -1,
1273};
1274
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001275#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1276 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1277 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1278 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1279
1280#define QCE_SIZE 0x10000
1281#define QCE_0_BASE 0x11000000
1282
1283#define QCE_HW_KEY_SUPPORT 0
1284#define QCE_SHA_HMAC_SUPPORT 1
1285#define QCE_SHARE_CE_RESOURCE 3
1286#define QCE_CE_SHARED 0
1287
1288static struct resource qcrypto_resources[] = {
1289 [0] = {
1290 .start = QCE_0_BASE,
1291 .end = QCE_0_BASE + QCE_SIZE - 1,
1292 .flags = IORESOURCE_MEM,
1293 },
1294 [1] = {
1295 .name = "crypto_channels",
1296 .start = DMOV8064_CE_IN_CHAN,
1297 .end = DMOV8064_CE_OUT_CHAN,
1298 .flags = IORESOURCE_DMA,
1299 },
1300 [2] = {
1301 .name = "crypto_crci_in",
1302 .start = DMOV8064_CE_IN_CRCI,
1303 .end = DMOV8064_CE_IN_CRCI,
1304 .flags = IORESOURCE_DMA,
1305 },
1306 [3] = {
1307 .name = "crypto_crci_out",
1308 .start = DMOV8064_CE_OUT_CRCI,
1309 .end = DMOV8064_CE_OUT_CRCI,
1310 .flags = IORESOURCE_DMA,
1311 },
1312};
1313
1314static struct resource qcedev_resources[] = {
1315 [0] = {
1316 .start = QCE_0_BASE,
1317 .end = QCE_0_BASE + QCE_SIZE - 1,
1318 .flags = IORESOURCE_MEM,
1319 },
1320 [1] = {
1321 .name = "crypto_channels",
1322 .start = DMOV8064_CE_IN_CHAN,
1323 .end = DMOV8064_CE_OUT_CHAN,
1324 .flags = IORESOURCE_DMA,
1325 },
1326 [2] = {
1327 .name = "crypto_crci_in",
1328 .start = DMOV8064_CE_IN_CRCI,
1329 .end = DMOV8064_CE_IN_CRCI,
1330 .flags = IORESOURCE_DMA,
1331 },
1332 [3] = {
1333 .name = "crypto_crci_out",
1334 .start = DMOV8064_CE_OUT_CRCI,
1335 .end = DMOV8064_CE_OUT_CRCI,
1336 .flags = IORESOURCE_DMA,
1337 },
1338};
1339
1340#endif
1341
1342#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1343 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1344
1345static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1346 .ce_shared = QCE_CE_SHARED,
1347 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1348 .hw_key_support = QCE_HW_KEY_SUPPORT,
1349 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001350 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001351};
1352
1353static struct platform_device qcrypto_device = {
1354 .name = "qcrypto",
1355 .id = 0,
1356 .num_resources = ARRAY_SIZE(qcrypto_resources),
1357 .resource = qcrypto_resources,
1358 .dev = {
1359 .coherent_dma_mask = DMA_BIT_MASK(32),
1360 .platform_data = &qcrypto_ce_hw_suppport,
1361 },
1362};
1363#endif
1364
1365#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1366 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1367
1368static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1369 .ce_shared = QCE_CE_SHARED,
1370 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1371 .hw_key_support = QCE_HW_KEY_SUPPORT,
1372 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001373 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001374};
1375
1376static struct platform_device qcedev_device = {
1377 .name = "qce",
1378 .id = 0,
1379 .num_resources = ARRAY_SIZE(qcedev_resources),
1380 .resource = qcedev_resources,
1381 .dev = {
1382 .coherent_dma_mask = DMA_BIT_MASK(32),
1383 .platform_data = &qcedev_ce_hw_suppport,
1384 },
1385};
1386#endif
1387
Joel Kingdacbc822012-01-25 13:30:57 -08001388static struct mdm_platform_data mdm_platform_data = {
1389 .mdm_version = "3.0",
1390 .ramdump_delay_ms = 2000,
Hemant Kumara945b472012-01-25 15:08:06 -08001391 .peripheral_platform_device = &apq8064_device_hsic_host,
Joel Kingdacbc822012-01-25 13:30:57 -08001392};
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001393
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001394static struct tsens_platform_data apq_tsens_pdata = {
1395 .tsens_factor = 1000,
1396 .hw_type = APQ_8064,
1397 .tsens_num_sensor = 11,
1398 .slope = {1176, 1176, 1154, 1176, 1111,
1399 1132, 1132, 1199, 1132, 1199, 1132},
1400};
1401
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001402#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001403static void __init apq8064_map_io(void)
1404{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001405 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001406 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001407 if (socinfo_init() < 0)
1408 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001409}
1410
1411static void __init apq8064_init_irq(void)
1412{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001413 struct msm_mpm_device_data *data = NULL;
1414
1415#ifdef CONFIG_MSM_MPM
1416 data = &apq8064_mpm_dev_data;
1417#endif
1418
1419 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001420 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1421 (void *)MSM_QGIC_CPU_BASE);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001422}
1423
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001424static struct platform_device msm8064_device_saw_regulator_core0 = {
1425 .name = "saw-regulator",
1426 .id = 0,
1427 .dev = {
1428 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
1429 },
1430};
1431
1432static struct platform_device msm8064_device_saw_regulator_core1 = {
1433 .name = "saw-regulator",
1434 .id = 1,
1435 .dev = {
1436 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
1437 },
1438};
1439
1440static struct platform_device msm8064_device_saw_regulator_core2 = {
1441 .name = "saw-regulator",
1442 .id = 2,
1443 .dev = {
1444 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
1445 },
1446};
1447
1448static struct platform_device msm8064_device_saw_regulator_core3 = {
1449 .name = "saw-regulator",
1450 .id = 3,
1451 .dev = {
1452 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001453
1454 },
1455};
1456
Oluwafemi Adeyemif5a31422012-03-08 16:58:45 -08001457static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001458 {
1459 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1460 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1461 true,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001462 100, 650, 801, 200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001463 },
1464
1465 {
1466 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1467 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1468 true,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001469 2000, 200, 576000, 2000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001470 },
1471
1472 {
1473 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1474 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1475 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001476 8500, 51, 1122000, 8500,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001477 },
1478
1479 {
1480 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1481 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
1482 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001483 9000, 51, 1130300, 9000,
1484 },
1485 {
1486 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1487 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
1488 false,
1489 10000, 51, 1130300, 10000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001490 },
1491
1492 {
1493 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1494 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1495 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001496 12000, 14, 2205900, 12000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001497 },
1498
1499 {
1500 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1501 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1502 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001503 18000, 12, 2364250, 18000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001504 },
1505
1506 {
1507 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1508 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1509 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001510 23500, 10, 2667000, 23500,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001511 },
1512
1513 {
1514 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1515 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1516 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001517 29700, 5, 2867000, 30000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001518 },
1519};
1520
Oluwafemi Adeyemif5a31422012-03-08 16:58:45 -08001521uint32_t apq8064_rpm_get_swfi_latency(void)
1522{
1523 int i;
1524
1525 for (i = 0; i < ARRAY_SIZE(msm_rpmrs_levels); i++) {
1526 if (msm_rpmrs_levels[i].sleep_mode ==
1527 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)
1528 return msm_rpmrs_levels[i].latency_us;
1529 }
1530
1531 return 0;
1532}
1533
Praveen Chidambaram78499012011-11-01 17:15:17 -06001534static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1535 .mode = MSM_PM_BOOT_CONFIG_TZ,
1536};
1537
1538static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
1539 .levels = &msm_rpmrs_levels[0],
1540 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
1541 .vdd_mem_levels = {
1542 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
1543 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
1544 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
1545 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
1546 },
1547 .vdd_dig_levels = {
1548 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
1549 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
1550 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
1551 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
1552 },
1553 .vdd_mask = 0x7FFFFF,
1554 .rpmrs_target_id = {
1555 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
1556 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
1557 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
1558 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
1559 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
1560 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
1561 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
1562 },
1563};
1564
1565static struct msm_cpuidle_state msm_cstates[] __initdata = {
1566 {0, 0, "C0", "WFI",
1567 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1568
1569 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1570 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1571
1572 {0, 2, "C2", "POWER_COLLAPSE",
1573 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
1574
1575 {1, 0, "C0", "WFI",
1576 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1577
1578 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1579 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1580
1581 {2, 0, "C0", "WFI",
1582 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1583
1584 {2, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1585 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1586
1587 {3, 0, "C0", "WFI",
1588 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1589
1590 {3, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1591 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1592};
1593
1594static struct msm_pm_platform_data msm_pm_data[] = {
1595 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1596 .idle_supported = 1,
1597 .suspend_supported = 1,
1598 .idle_enabled = 0,
1599 .suspend_enabled = 0,
1600 },
1601
1602 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1603 .idle_supported = 1,
1604 .suspend_supported = 1,
1605 .idle_enabled = 0,
1606 .suspend_enabled = 0,
1607 },
1608
1609 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1610 .idle_supported = 1,
1611 .suspend_supported = 1,
1612 .idle_enabled = 1,
1613 .suspend_enabled = 1,
1614 },
1615
1616 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1617 .idle_supported = 0,
1618 .suspend_supported = 1,
1619 .idle_enabled = 0,
1620 .suspend_enabled = 0,
1621 },
1622
1623 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1624 .idle_supported = 1,
1625 .suspend_supported = 1,
1626 .idle_enabled = 0,
1627 .suspend_enabled = 0,
1628 },
1629
1630 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1631 .idle_supported = 1,
1632 .suspend_supported = 0,
1633 .idle_enabled = 1,
1634 .suspend_enabled = 0,
1635 },
1636
1637 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1638 .idle_supported = 0,
1639 .suspend_supported = 1,
1640 .idle_enabled = 0,
1641 .suspend_enabled = 0,
1642 },
1643
1644 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1645 .idle_supported = 1,
1646 .suspend_supported = 1,
1647 .idle_enabled = 0,
1648 .suspend_enabled = 0,
1649 },
1650
1651 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1652 .idle_supported = 1,
1653 .suspend_supported = 0,
1654 .idle_enabled = 1,
1655 .suspend_enabled = 0,
1656 },
1657
1658 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1659 .idle_supported = 0,
1660 .suspend_supported = 1,
1661 .idle_enabled = 0,
1662 .suspend_enabled = 0,
1663 },
1664
1665 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1666 .idle_supported = 1,
1667 .suspend_supported = 1,
1668 .idle_enabled = 0,
1669 .suspend_enabled = 0,
1670 },
1671
1672 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1673 .idle_supported = 1,
1674 .suspend_supported = 0,
1675 .idle_enabled = 1,
1676 .suspend_enabled = 0,
1677 },
1678};
1679
1680static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1681 0x03, 0x0f,
1682};
1683
1684static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1685 0x00, 0x24, 0x54, 0x10,
1686 0x09, 0x03, 0x01,
1687 0x10, 0x54, 0x30, 0x0C,
1688 0x24, 0x30, 0x0f,
1689};
1690
1691static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1692 0x00, 0x24, 0x54, 0x10,
1693 0x09, 0x07, 0x01, 0x0B,
1694 0x10, 0x54, 0x30, 0x0C,
1695 0x24, 0x30, 0x0f,
1696};
1697
1698static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1699 [0] = {
1700 .mode = MSM_SPM_MODE_CLOCK_GATING,
1701 .notify_rpm = false,
1702 .cmd = spm_wfi_cmd_sequence,
1703 },
1704 [1] = {
1705 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1706 .notify_rpm = false,
1707 .cmd = spm_power_collapse_without_rpm,
1708 },
1709 [2] = {
1710 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1711 .notify_rpm = true,
1712 .cmd = spm_power_collapse_with_rpm,
1713 },
1714};
1715
1716static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1717 0x00, 0x20, 0x03, 0x20,
1718 0x00, 0x0f,
1719};
1720
1721static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1722 0x00, 0x20, 0x34, 0x64,
1723 0x48, 0x07, 0x48, 0x20,
1724 0x50, 0x64, 0x04, 0x34,
1725 0x50, 0x0f,
1726};
1727static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1728 0x00, 0x10, 0x34, 0x64,
1729 0x48, 0x07, 0x48, 0x10,
1730 0x50, 0x64, 0x04, 0x34,
1731 0x50, 0x0F,
1732};
1733
1734static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1735 [0] = {
1736 .mode = MSM_SPM_L2_MODE_RETENTION,
1737 .notify_rpm = false,
1738 .cmd = l2_spm_wfi_cmd_sequence,
1739 },
1740 [1] = {
1741 .mode = MSM_SPM_L2_MODE_GDHS,
1742 .notify_rpm = true,
1743 .cmd = l2_spm_gdhs_cmd_sequence,
1744 },
1745 [2] = {
1746 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1747 .notify_rpm = true,
1748 .cmd = l2_spm_power_off_cmd_sequence,
1749 },
1750};
1751
1752
1753static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1754 [0] = {
1755 .reg_base_addr = MSM_SAW_L2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001756 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001757 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001758 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1759 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1760 .modes = msm_spm_l2_seq_list,
1761 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1762 },
1763};
1764
1765static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1766 [0] = {
1767 .reg_base_addr = MSM_SAW0_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001768 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001769#if defined(CONFIG_MSM_AVS_HW)
1770 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1771 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1772#endif
1773 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001774 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001775 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1776 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1777 .vctl_timeout_us = 50,
1778 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1779 .modes = msm_spm_seq_list,
1780 },
1781 [1] = {
1782 .reg_base_addr = MSM_SAW1_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001783 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001784#if defined(CONFIG_MSM_AVS_HW)
1785 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1786 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1787#endif
1788 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001789 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001790 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1791 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1792 .vctl_timeout_us = 50,
1793 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1794 .modes = msm_spm_seq_list,
1795 },
1796 [2] = {
1797 .reg_base_addr = MSM_SAW2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001798 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001799#if defined(CONFIG_MSM_AVS_HW)
1800 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1801 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1802#endif
1803 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001804 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001805 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1806 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1807 .vctl_timeout_us = 50,
1808 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1809 .modes = msm_spm_seq_list,
1810 },
1811 [3] = {
1812 .reg_base_addr = MSM_SAW3_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001813 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001814#if defined(CONFIG_MSM_AVS_HW)
1815 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1816 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1817#endif
1818 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001819 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001820 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1821 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1822 .vctl_timeout_us = 50,
1823 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1824 .modes = msm_spm_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001825 },
1826};
1827
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001828static void __init apq8064_init_buses(void)
1829{
1830 msm_bus_rpm_set_mt_mask();
1831 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
1832 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
1833 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
1834 msm_bus_8064_apps_fabric.dev.platform_data =
1835 &msm_bus_8064_apps_fabric_pdata;
1836 msm_bus_8064_sys_fabric.dev.platform_data =
1837 &msm_bus_8064_sys_fabric_pdata;
1838 msm_bus_8064_mm_fabric.dev.platform_data =
1839 &msm_bus_8064_mm_fabric_pdata;
1840 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
1841 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
1842}
1843
David Collinsf0d00732012-01-25 15:46:50 -08001844static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
1845 .name = GPIO_REGULATOR_DEV_NAME,
1846 .id = PM8921_MPP_PM_TO_SYS(7),
1847 .dev = {
1848 .platform_data
1849 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
1850 },
1851};
1852
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08001853static struct platform_device apq8064_device_ext_mpp8_vreg __devinitdata = {
1854 .name = GPIO_REGULATOR_DEV_NAME,
1855 .id = PM8921_MPP_PM_TO_SYS(8),
1856 .dev = {
1857 .platform_data
1858 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_MPP8],
1859 },
1860};
1861
David Collinsf0d00732012-01-25 15:46:50 -08001862static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
1863 .name = GPIO_REGULATOR_DEV_NAME,
1864 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
1865 .dev = {
1866 .platform_data =
1867 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
1868 },
1869};
1870
David Collins390fc332012-02-07 14:38:16 -08001871static struct platform_device apq8064_device_ext_ts_sw_vreg __devinitdata = {
1872 .name = GPIO_REGULATOR_DEV_NAME,
1873 .id = PM8921_GPIO_PM_TO_SYS(23),
1874 .dev = {
1875 .platform_data
1876 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_TS_SW],
1877 },
1878};
1879
David Collins2782b5c2012-02-06 10:02:42 -08001880static struct platform_device apq8064_device_rpm_regulator __devinitdata = {
1881 .name = "rpm-regulator",
1882 .id = -1,
1883 .dev = {
1884 .platform_data = &apq8064_rpm_regulator_pdata,
1885 },
1886};
1887
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001888static struct platform_device *common_devices[] __initdata = {
Jin Hong01f2dbb2011-11-03 22:13:51 -07001889 &apq8064_device_dmov,
David Keitel3c40fc52012-02-09 17:53:52 -08001890 &apq8064_device_qup_i2c_gsbi1,
Jing Lin04601f92012-02-05 15:36:07 -08001891 &apq8064_device_qup_i2c_gsbi3,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001892 &apq8064_device_qup_i2c_gsbi4,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001893 &apq8064_device_qup_spi_gsbi5,
David Collinsf0d00732012-01-25 15:46:50 -08001894 &apq8064_device_ext_5v_vreg,
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08001895 &apq8064_device_ext_mpp8_vreg,
David Collinsf0d00732012-01-25 15:46:50 -08001896 &apq8064_device_ext_3p3v_vreg,
David Collins390fc332012-02-07 14:38:16 -08001897 &apq8064_device_ext_ts_sw_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07001898 &apq8064_device_ssbi_pmic1,
1899 &apq8064_device_ssbi_pmic2,
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001900 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07001901 &apq8064_device_otg,
1902 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08001903 &apq8064_device_hsusb_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07001904 &android_usb_device,
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001905 &msm_device_wcnss_wlan,
Ankit Vermab7c26e62012-02-28 15:04:15 -08001906 &msm_device_iris_fm,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001907#ifdef CONFIG_ANDROID_PMEM
1908#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -07001909 &android_pmem_device,
1910 &android_pmem_adsp_device,
1911 &android_pmem_audio_device,
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -07001912#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
1913#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -08001914#ifdef CONFIG_ION_MSM
1915 &ion_dev,
1916#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001917 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001918 &msm8064_device_saw_regulator_core0,
1919 &msm8064_device_saw_regulator_core1,
1920 &msm8064_device_saw_regulator_core2,
1921 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001922#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1923 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1924 &qcrypto_device,
1925#endif
1926
1927#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1928 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1929 &qcedev_device,
1930#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07001931
1932#ifdef CONFIG_HW_RANDOM_MSM
1933 &apq8064_device_rng,
1934#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08001935 &apq_pcm,
1936 &apq_pcm_routing,
1937 &apq_cpudai0,
1938 &apq_cpudai1,
Santosh Mardieff9a742012-04-09 23:23:39 +05301939 &mpq_cpudai_sec_i2s_rx,
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08001940 &apq_cpudai_hdmi_rx,
1941 &apq_cpudai_bt_rx,
1942 &apq_cpudai_bt_tx,
1943 &apq_cpudai_fm_rx,
1944 &apq_cpudai_fm_tx,
1945 &apq_cpu_fe,
1946 &apq_stub_codec,
1947 &apq_voice,
1948 &apq_voip,
1949 &apq_lpa_pcm,
Krishnankutty Kolathappilly4374e332012-03-18 22:27:30 -07001950 &apq_compr_dsp,
1951 &apq_multi_ch_pcm,
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08001952 &apq_pcm_hostless,
1953 &apq_cpudai_afe_01_rx,
1954 &apq_cpudai_afe_01_tx,
1955 &apq_cpudai_afe_02_rx,
1956 &apq_cpudai_afe_02_tx,
1957 &apq_pcm_afe,
1958 &apq_cpudai_auxpcm_rx,
1959 &apq_cpudai_auxpcm_tx,
Neema Shetty8427c262012-02-16 11:23:43 -08001960 &apq_cpudai_stub,
Neema Shetty3c9d2862012-03-11 01:25:32 -08001961 &apq_cpudai_slimbus_1_rx,
1962 &apq_cpudai_slimbus_1_tx,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001963 &apq8064_rpm_device,
1964 &apq8064_rpm_log_device,
1965 &apq8064_rpm_stat_device,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001966 &msm_bus_8064_apps_fabric,
1967 &msm_bus_8064_sys_fabric,
1968 &msm_bus_8064_mm_fabric,
1969 &msm_bus_8064_sys_fpb,
1970 &msm_bus_8064_cpss_fpb,
Mohan Kumar Gubbihalli Lachma Naik7f72edd2012-02-06 17:26:47 -08001971 &apq8064_msm_device_vidc,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07001972 &msm_pil_dsps,
Matt Wagantalled832652012-02-02 19:23:17 -08001973 &msm_8960_riva,
Matt Wagantallb94b9a52012-02-02 21:59:54 -08001974 &msm_8960_q6_lpass,
Stephen Boyd7b973de2012-03-09 12:26:16 -08001975 &msm_pil_vidc,
Matt Wagantall292aace2012-01-26 19:12:34 -08001976 &msm_gss,
Laura Abbott350c8362012-02-28 14:46:52 -08001977#ifdef CONFIG_MSM_RTB
1978 &msm_rtb_device,
1979#endif
Praveen Chidambaram8ea3dcd2011-12-07 14:46:31 -07001980 &apq8064_cpu_idle_device,
Praveen Chidambaram5c8adf22012-02-23 18:44:37 -07001981 &apq8064_msm_gov_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08001982 &apq8064_device_cache_erp,
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08001983 &epm_adc_device,
Pratik Patel212ab362012-03-16 12:30:07 -07001984 &apq8064_qdss_device,
1985 &msm_etb_device,
1986 &msm_tpiu_device,
1987 &msm_funnel_device,
1988 &apq8064_etm_device,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001989};
1990
Joel King4e7ad222011-08-17 15:47:38 -07001991static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001992 &apq8064_device_uart_gsbi3,
Yan He06913ce2011-08-26 16:33:46 -07001993 &msm_device_sps_apq8064,
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001994};
1995
1996static struct platform_device *rumi3_devices[] __initdata = {
1997 &apq8064_device_uart_gsbi1,
Yan He435ed612011-11-23 17:34:59 -08001998 &msm_device_sps_apq8064,
Huaibin Yang4a084e32011-12-15 15:25:52 -08001999#ifdef CONFIG_MSM_ROTATOR
2000 &msm_rotator_device,
2001#endif
Joel King4e7ad222011-08-17 15:47:38 -07002002};
2003
Joel King82b7e3f2012-01-05 10:03:27 -08002004static struct platform_device *cdp_devices[] __initdata = {
2005 &apq8064_device_uart_gsbi1,
Jin Hong4bbbfba2012-02-02 21:48:07 -08002006 &apq8064_device_uart_gsbi7,
Joel King82b7e3f2012-01-05 10:03:27 -08002007 &msm_device_sps_apq8064,
Aravind Venkateswaran4ca27532012-02-16 14:27:05 -08002008#ifdef CONFIG_MSM_ROTATOR
2009 &msm_rotator_device,
2010#endif
Joel King82b7e3f2012-01-05 10:03:27 -08002011};
2012
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002013static struct platform_device
2014mpq8064_device_ext_5v_frc_vreg __devinitdata = {
2015 .name = GPIO_REGULATOR_DEV_NAME,
2016 .id = SX150X_GPIO(4, 10),
2017 .dev = {
2018 .platform_data =
2019 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_FRC_5V],
2020 },
2021};
2022
2023static struct platform_device
2024mpq8064_device_ext_1p2_buck_vreg __devinitdata = {
2025 .name = GPIO_REGULATOR_DEV_NAME,
2026 .id = SX150X_GPIO(4, 2),
2027 .dev = {
2028 .platform_data =
2029 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P2V],
2030 },
2031};
2032
2033static struct platform_device
2034mpq8064_device_ext_1p8_buck_vreg __devinitdata = {
2035 .name = GPIO_REGULATOR_DEV_NAME,
2036 .id = SX150X_GPIO(4, 4),
2037 .dev = {
2038 .platform_data =
2039 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P8V],
2040 },
2041};
2042
2043static struct platform_device
2044mpq8064_device_ext_2p2_buck_vreg __devinitdata = {
2045 .name = GPIO_REGULATOR_DEV_NAME,
2046 .id = SX150X_GPIO(4, 14),
2047 .dev = {
2048 .platform_data =
2049 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_2P2V],
2050 },
2051};
2052
2053static struct platform_device
2054mpq8064_device_ext_5v_buck_vreg __devinitdata = {
2055 .name = GPIO_REGULATOR_DEV_NAME,
2056 .id = SX150X_GPIO(4, 3),
2057 .dev = {
2058 .platform_data =
2059 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_5V],
2060 },
2061};
2062
2063static struct platform_device
2064mpq8064_device_ext_3p3v_ldo_vreg __devinitdata = {
2065 .name = GPIO_REGULATOR_DEV_NAME,
2066 .id = SX150X_GPIO(4, 15),
2067 .dev = {
2068 .platform_data =
2069 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_3P3V],
2070 },
2071};
2072
2073static struct platform_device *mpq_devices[] __initdata = {
2074 &msm_device_sps_apq8064,
2075 &mpq8064_device_qup_i2c_gsbi5,
2076#ifdef CONFIG_MSM_ROTATOR
2077 &msm_rotator_device,
2078#endif
2079 &mpq8064_device_ext_5v_frc_vreg,
2080 &mpq8064_device_ext_1p2_buck_vreg,
2081 &mpq8064_device_ext_1p8_buck_vreg,
2082 &mpq8064_device_ext_2p2_buck_vreg,
2083 &mpq8064_device_ext_5v_buck_vreg,
2084 &mpq8064_device_ext_3p3v_ldo_vreg,
2085};
2086
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002087static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002088 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002089};
2090
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002091#define KS8851_IRQ_GPIO 43
2092
2093static struct spi_board_info spi_board_info[] __initdata = {
2094 {
2095 .modalias = "ks8851",
2096 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2097 .max_speed_hz = 19200000,
2098 .bus_num = 0,
2099 .chip_select = 2,
2100 .mode = SPI_MODE_0,
2101 },
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002102 {
2103 .modalias = "epm_adc",
2104 .max_speed_hz = 1100000,
2105 .bus_num = 0,
2106 .chip_select = 3,
2107 .mode = SPI_MODE_0,
2108 },
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002109};
2110
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002111static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002112 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08002113 .bus_num = 1,
2114 .slim_slave = &apq8064_slim_tabla,
2115 },
2116 {
2117 .bus_num = 1,
2118 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002119 },
2120 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002121};
2122
David Keitel3c40fc52012-02-09 17:53:52 -08002123static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi1_pdata = {
2124 .clk_freq = 100000,
2125 .src_clk_rate = 24000000,
2126};
2127
Jing Lin04601f92012-02-05 15:36:07 -08002128static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi3_pdata = {
2129 .clk_freq = 100000,
2130 .src_clk_rate = 24000000,
2131};
2132
Kenneth Heitke748593a2011-07-15 15:45:11 -06002133static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
2134 .clk_freq = 100000,
2135 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002136};
2137
Joel King8f839b92012-04-01 14:37:46 -07002138static struct msm_i2c_platform_data mpq8064_i2c_qup_gsbi5_pdata = {
2139 .clk_freq = 100000,
2140 .src_clk_rate = 24000000,
2141};
2142
David Keitel3c40fc52012-02-09 17:53:52 -08002143#define GSBI_DUAL_MODE_CODE 0x60
2144#define MSM_GSBI1_PHYS 0x12440000
Kenneth Heitke748593a2011-07-15 15:45:11 -06002145static void __init apq8064_i2c_init(void)
2146{
David Keitel3c40fc52012-02-09 17:53:52 -08002147 void __iomem *gsbi_mem;
2148
2149 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2150 &apq8064_i2c_qup_gsbi1_pdata;
2151 gsbi_mem = ioremap_nocache(MSM_GSBI1_PHYS, 4);
2152 writel_relaxed(GSBI_DUAL_MODE_CODE, gsbi_mem);
2153 /* Ensure protocol code is written before proceeding */
2154 wmb();
2155 iounmap(gsbi_mem);
2156 apq8064_i2c_qup_gsbi1_pdata.use_gsbi_shared_mode = 1;
Jing Lin04601f92012-02-05 15:36:07 -08002157 apq8064_device_qup_i2c_gsbi3.dev.platform_data =
2158 &apq8064_i2c_qup_gsbi3_pdata;
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002159 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2160 &apq8064_i2c_qup_gsbi1_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002161 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
2162 &apq8064_i2c_qup_gsbi4_pdata;
Joel King8f839b92012-04-01 14:37:46 -07002163 mpq8064_device_qup_i2c_gsbi5.dev.platform_data =
2164 &mpq8064_i2c_qup_gsbi5_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002165}
2166
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002167#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002168static int ethernet_init(void)
2169{
2170 int ret;
2171 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
2172 if (ret) {
2173 pr_err("ks8851 gpio_request failed: %d\n", ret);
2174 goto fail;
2175 }
2176
2177 return 0;
2178fail:
2179 return ret;
2180}
2181#else
2182static int ethernet_init(void)
2183{
2184 return 0;
2185}
2186#endif
2187
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302188#define GPIO_KEY_HOME PM8921_GPIO_PM_TO_SYS(27)
2189#define GPIO_KEY_VOLUME_UP PM8921_GPIO_PM_TO_SYS(35)
2190#define GPIO_KEY_VOLUME_DOWN PM8921_GPIO_PM_TO_SYS(38)
2191#define GPIO_KEY_CAM_FOCUS PM8921_GPIO_PM_TO_SYS(3)
2192#define GPIO_KEY_CAM_SNAP PM8921_GPIO_PM_TO_SYS(4)
Jing Lin3f8f8422012-03-05 09:32:11 -08002193#define GPIO_KEY_ROTATION PM8921_GPIO_PM_TO_SYS(42)
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302194
2195static struct gpio_keys_button cdp_keys[] = {
2196 {
2197 .code = KEY_HOME,
2198 .gpio = GPIO_KEY_HOME,
2199 .desc = "home_key",
2200 .active_low = 1,
2201 .type = EV_KEY,
2202 .wakeup = 1,
2203 .debounce_interval = 15,
2204 },
2205 {
2206 .code = KEY_VOLUMEUP,
2207 .gpio = GPIO_KEY_VOLUME_UP,
2208 .desc = "volume_up_key",
2209 .active_low = 1,
2210 .type = EV_KEY,
2211 .wakeup = 1,
2212 .debounce_interval = 15,
2213 },
2214 {
2215 .code = KEY_VOLUMEDOWN,
2216 .gpio = GPIO_KEY_VOLUME_DOWN,
2217 .desc = "volume_down_key",
2218 .active_low = 1,
2219 .type = EV_KEY,
2220 .wakeup = 1,
2221 .debounce_interval = 15,
2222 },
2223 {
2224 .code = SW_ROTATE_LOCK,
2225 .gpio = GPIO_KEY_ROTATION,
2226 .desc = "rotate_key",
2227 .active_low = 1,
2228 .type = EV_SW,
2229 .debounce_interval = 15,
2230 },
2231};
2232
2233static struct gpio_keys_platform_data cdp_keys_data = {
2234 .buttons = cdp_keys,
2235 .nbuttons = ARRAY_SIZE(cdp_keys),
2236};
2237
2238static struct platform_device cdp_kp_pdev = {
2239 .name = "gpio-keys",
2240 .id = -1,
2241 .dev = {
2242 .platform_data = &cdp_keys_data,
2243 },
2244};
2245
2246static struct gpio_keys_button mtp_keys[] = {
2247 {
2248 .code = KEY_CAMERA_FOCUS,
2249 .gpio = GPIO_KEY_CAM_FOCUS,
2250 .desc = "cam_focus_key",
2251 .active_low = 1,
2252 .type = EV_KEY,
2253 .wakeup = 1,
2254 .debounce_interval = 15,
2255 },
2256 {
2257 .code = KEY_VOLUMEUP,
2258 .gpio = GPIO_KEY_VOLUME_UP,
2259 .desc = "volume_up_key",
2260 .active_low = 1,
2261 .type = EV_KEY,
2262 .wakeup = 1,
2263 .debounce_interval = 15,
2264 },
2265 {
2266 .code = KEY_VOLUMEDOWN,
2267 .gpio = GPIO_KEY_VOLUME_DOWN,
2268 .desc = "volume_down_key",
2269 .active_low = 1,
2270 .type = EV_KEY,
2271 .wakeup = 1,
2272 .debounce_interval = 15,
2273 },
2274 {
2275 .code = KEY_CAMERA_SNAPSHOT,
2276 .gpio = GPIO_KEY_CAM_SNAP,
2277 .desc = "cam_snap_key",
2278 .active_low = 1,
2279 .type = EV_KEY,
2280 .debounce_interval = 15,
2281 },
2282};
2283
2284static struct gpio_keys_platform_data mtp_keys_data = {
2285 .buttons = mtp_keys,
2286 .nbuttons = ARRAY_SIZE(mtp_keys),
2287};
2288
2289static struct platform_device mtp_kp_pdev = {
2290 .name = "gpio-keys",
2291 .id = -1,
2292 .dev = {
2293 .platform_data = &mtp_keys_data,
2294 },
2295};
2296
Jin Hongd3024e62012-02-09 16:13:32 -08002297/* Sensors DSPS platform data */
2298#define DSPS_PIL_GENERIC_NAME "dsps"
2299static void __init apq8064_init_dsps(void)
2300{
2301 struct msm_dsps_platform_data *pdata =
2302 msm_dsps_device_8064.dev.platform_data;
2303 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
2304 pdata->gpios = NULL;
2305 pdata->gpios_num = 0;
2306
2307 platform_device_register(&msm_dsps_device_8064);
2308}
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302309
Tianyi Gou41515e22011-09-01 19:37:43 -07002310static void __init apq8064_clock_init(void)
2311{
Tianyi Gouacb588d2012-01-27 18:24:05 -08002312 if (machine_is_apq8064_rumi3())
Tianyi Gou41515e22011-09-01 19:37:43 -07002313 msm_clock_init(&apq8064_dummy_clock_init_data);
Tianyi Gouacb588d2012-01-27 18:24:05 -08002314 else
2315 msm_clock_init(&apq8064_clock_init_data);
Tianyi Gou41515e22011-09-01 19:37:43 -07002316}
2317
Jing Lin417fa452012-02-05 14:31:06 -08002318#define I2C_SURF 1
2319#define I2C_FFA (1 << 1)
2320#define I2C_RUMI (1 << 2)
2321#define I2C_SIM (1 << 3)
2322#define I2C_LIQUID (1 << 4)
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002323#define I2C_MPQ_CDP BIT(5)
2324#define I2C_MPQ_HRD BIT(6)
2325#define I2C_MPQ_DTV BIT(7)
Jing Lin417fa452012-02-05 14:31:06 -08002326
2327struct i2c_registry {
2328 u8 machs;
2329 int bus;
2330 struct i2c_board_info *info;
2331 int len;
2332};
2333
2334static struct i2c_registry apq8064_i2c_devices[] __initdata = {
Jing Lin21ed4de2012-02-05 15:53:28 -08002335 {
David Keitel2f613d92012-02-15 11:29:16 -08002336 I2C_LIQUID,
2337 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
2338 smb349_charger_i2c_info,
2339 ARRAY_SIZE(smb349_charger_i2c_info)
2340 },
2341 {
Jing Lin21ed4de2012-02-05 15:53:28 -08002342 I2C_SURF | I2C_LIQUID,
2343 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
2344 mxt_device_info,
2345 ARRAY_SIZE(mxt_device_info),
2346 },
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08002347 {
2348 I2C_FFA,
2349 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
2350 cyttsp_info,
2351 ARRAY_SIZE(cyttsp_info),
2352 },
Amy Maloche70090f992012-02-16 16:35:26 -08002353 {
2354 I2C_FFA | I2C_LIQUID,
2355 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
2356 isa1200_board_info,
2357 ARRAY_SIZE(isa1200_board_info),
2358 },
Santosh Mardieff9a742012-04-09 23:23:39 +05302359 {
2360 I2C_MPQ_CDP,
2361 APQ_8064_GSBI5_QUP_I2C_BUS_ID,
2362 cs8427_device_info,
2363 ARRAY_SIZE(cs8427_device_info),
2364 },
Jing Lin417fa452012-02-05 14:31:06 -08002365};
2366
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002367struct sx150x_platform_data mpq8064_sx150x_pdata[] = {
2368 [SX150X_EXP1] = {
2369 .gpio_base = SX150X_EXP1_GPIO_BASE,
2370 .oscio_is_gpo = false,
2371 .io_pullup_ena = 0x0,
2372 .io_pulldn_ena = 0x0,
2373 .io_open_drain_ena = 0x0,
2374 .io_polarity = 0,
2375 .irq_summary = -1,
2376 },
2377 [SX150X_EXP2] = {
2378 .gpio_base = SX150X_EXP2_GPIO_BASE,
2379 .oscio_is_gpo = false,
2380 .io_pullup_ena = 0x0,
2381 .io_pulldn_ena = 0x0,
2382 .io_open_drain_ena = 0x0,
2383 .io_polarity = 0,
2384 .irq_summary = -1,
2385 },
2386 [SX150X_EXP3] = {
2387 .gpio_base = SX150X_EXP3_GPIO_BASE,
2388 .oscio_is_gpo = false,
2389 .io_pullup_ena = 0x0,
2390 .io_pulldn_ena = 0x0,
2391 .io_open_drain_ena = 0x0,
2392 .io_polarity = 0,
2393 .irq_summary = -1,
2394 },
2395 [SX150X_EXP4] = {
2396 .gpio_base = SX150X_EXP4_GPIO_BASE,
2397 .oscio_is_gpo = false,
2398 .io_pullup_ena = 0x0,
2399 .io_pulldn_ena = 0x0,
2400 .io_open_drain_ena = 0x0,
2401 .io_polarity = 0,
2402 .irq_summary = -1,
2403 },
2404};
2405
2406static struct i2c_board_info sx150x_gpio_exp_info[] = {
2407 {
2408 I2C_BOARD_INFO("sx1509q", 0x70),
2409 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP1],
2410 },
2411 {
2412 I2C_BOARD_INFO("sx1508q", 0x23),
2413 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP2],
2414 },
2415 {
2416 I2C_BOARD_INFO("sx1508q", 0x22),
2417 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP3],
2418 },
2419 {
2420 I2C_BOARD_INFO("sx1509q", 0x3E),
2421 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP4],
2422 },
2423};
2424
2425#define MPQ8064_I2C_GSBI5_BUS_ID 5
2426
2427static struct i2c_registry mpq8064_i2c_devices[] __initdata = {
2428 {
2429 I2C_MPQ_CDP,
2430 MPQ8064_I2C_GSBI5_BUS_ID,
2431 sx150x_gpio_exp_info,
2432 ARRAY_SIZE(sx150x_gpio_exp_info),
2433 },
2434};
2435
Jing Lin417fa452012-02-05 14:31:06 -08002436static void __init register_i2c_devices(void)
2437{
2438 u8 mach_mask = 0;
2439 int i;
2440
Kevin Chand07220e2012-02-13 15:52:22 -08002441#ifdef CONFIG_MSM_CAMERA
2442 struct i2c_registry apq8064_camera_i2c_devices = {
2443 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_RUMI,
2444 APQ_8064_GSBI4_QUP_I2C_BUS_ID,
2445 apq8064_camera_board_info.board_info,
2446 apq8064_camera_board_info.num_i2c_board_info,
2447 };
2448#endif
Jing Lin417fa452012-02-05 14:31:06 -08002449 /* Build the matching 'supported_machs' bitmask */
2450 if (machine_is_apq8064_cdp())
2451 mach_mask = I2C_SURF;
2452 else if (machine_is_apq8064_mtp())
2453 mach_mask = I2C_FFA;
2454 else if (machine_is_apq8064_liquid())
2455 mach_mask = I2C_LIQUID;
2456 else if (machine_is_apq8064_rumi3())
2457 mach_mask = I2C_RUMI;
2458 else if (machine_is_apq8064_sim())
2459 mach_mask = I2C_SIM;
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002460 else if (PLATFORM_IS_MPQ8064())
2461 mach_mask = I2C_MPQ_CDP;
Jing Lin417fa452012-02-05 14:31:06 -08002462 else
2463 pr_err("unmatched machine ID in register_i2c_devices\n");
2464
2465 /* Run the array and install devices as appropriate */
2466 for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) {
2467 if (apq8064_i2c_devices[i].machs & mach_mask)
2468 i2c_register_board_info(apq8064_i2c_devices[i].bus,
2469 apq8064_i2c_devices[i].info,
2470 apq8064_i2c_devices[i].len);
2471 }
Kevin Chand07220e2012-02-13 15:52:22 -08002472#ifdef CONFIG_MSM_CAMERA
2473 if (apq8064_camera_i2c_devices.machs & mach_mask)
2474 i2c_register_board_info(apq8064_camera_i2c_devices.bus,
2475 apq8064_camera_i2c_devices.info,
2476 apq8064_camera_i2c_devices.len);
2477#endif
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002478
2479 for (i = 0; i < ARRAY_SIZE(mpq8064_i2c_devices); ++i) {
2480 if (mpq8064_i2c_devices[i].machs & mach_mask)
2481 i2c_register_board_info(
2482 mpq8064_i2c_devices[i].bus,
2483 mpq8064_i2c_devices[i].info,
2484 mpq8064_i2c_devices[i].len);
2485 }
Jing Lin417fa452012-02-05 14:31:06 -08002486}
2487
Jay Chokshi994ff122012-03-27 15:43:48 -07002488static void enable_ddr3_regulator(void)
2489{
2490 static struct regulator *ext_ddr3;
2491
2492 /* Use MPP7 output state as a flag for PCDDR3 presence. */
2493 if (gpio_get_value_cansleep(PM8921_MPP_PM_TO_SYS(7)) > 0) {
2494 ext_ddr3 = regulator_get(NULL, "ext_ddr3");
2495 if (IS_ERR(ext_ddr3) || ext_ddr3 == NULL)
2496 pr_err("Could not get MPP7 regulator\n");
2497 else
2498 regulator_enable(ext_ddr3);
2499 }
2500}
2501
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002502static void enable_avc_i2c_bus(void)
2503{
2504 int avc_i2c_en_mpp = PM8921_MPP_PM_TO_SYS(8);
2505 int rc;
2506
2507 rc = gpio_request(avc_i2c_en_mpp, "avc_i2c_en");
2508 if (rc)
2509 pr_err("request for avc_i2c_en mpp failed,"
2510 "rc=%d\n", rc);
2511 else
2512 gpio_set_value_cansleep(avc_i2c_en_mpp, 1);
2513}
2514
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002515static void __init apq8064_common_init(void)
2516{
Joel King8f839b92012-04-01 14:37:46 -07002517 msm_tsens_early_init(&apq_tsens_pdata);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002518 if (socinfo_init() < 0)
2519 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06002520 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
2521 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
David Collins2782b5c2012-02-06 10:02:42 -08002522 regulator_suppress_info_printing();
2523 platform_device_register(&apq8064_device_rpm_regulator);
Stephen Boyd4d0d2582012-02-10 14:49:40 -08002524 if (msm_xo_init())
2525 pr_err("Failed to initialize XO votes\n");
Tianyi Gou41515e22011-09-01 19:37:43 -07002526 apq8064_clock_init();
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08002527 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06002528 apq8064_i2c_init();
Jing Lin417fa452012-02-05 14:31:06 -08002529 register_i2c_devices();
Kenneth Heitke36920d32011-07-20 16:44:30 -06002530
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002531 apq8064_device_qup_spi_gsbi5.dev.platform_data =
2532 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08002533 apq8064_init_pmic();
Hemant Kumar94e7da22012-02-03 16:52:29 -08002534 if (machine_is_apq8064_liquid())
2535 msm_otg_pdata.mhl_enable = true;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07002536
2537 msm_otg_pdata.swfi_latency =
2538 msm_rpmrs_levels[0].latency_us + 1;
2539
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002540 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Manu Gautam91223e02011-11-08 15:27:22 +05302541 apq8064_ehci_host_init();
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002542 apq8064_init_buses();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002543 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Jay Chokshi994ff122012-03-27 15:43:48 -07002544 enable_ddr3_regulator();
Hemant Kumarf1ca9192012-02-07 18:59:33 -08002545 if (machine_is_apq8064_mtp()) {
2546 apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
2547 device_initialize(&apq8064_device_hsic_host.dev);
2548 }
Jay Chokshie8741282012-01-25 15:22:55 -08002549 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05302550 apq8064_init_mmc();
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08002551
2552 if (machine_is_apq8064_mtp()) {
2553 mdm_8064_device.dev.platform_data = &mdm_platform_data;
2554 platform_device_register(&mdm_8064_device);
2555 }
2556 platform_device_register(&apq8064_slim_ctrl);
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002557 slim_register_board_info(apq8064_slim_devices,
2558 ARRAY_SIZE(apq8064_slim_devices));
Jin Hongd3024e62012-02-09 16:13:32 -08002559 apq8064_init_dsps();
Praveen Chidambaram78499012011-11-01 17:15:17 -06002560 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Mahesh Sivasubramaniancbce1ec2012-01-24 10:32:44 -07002561 acpuclk_init(&acpuclk_8064_soc_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002562 msm_spm_l2_init(msm_spm_l2_data);
2563 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2564 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2565 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2566 msm_pm_data);
2567 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002568 apq8064_epm_adc_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002569}
2570
Huaibin Yang4a084e32011-12-15 15:25:52 -08002571static void __init apq8064_allocate_memory_regions(void)
2572{
2573 apq8064_allocate_fb_region();
2574}
2575
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002576static void __init apq8064_sim_init(void)
2577{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002578 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
2579 &msm8064_device_watchdog.dev.platform_data;
2580
2581 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002582 apq8064_common_init();
Joel King4e7ad222011-08-17 15:47:38 -07002583 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
2584}
2585
2586static void __init apq8064_rumi3_init(void)
2587{
2588 apq8064_common_init();
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002589 ethernet_init();
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002590 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002591 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002592}
2593
Joel King82b7e3f2012-01-05 10:03:27 -08002594static void __init apq8064_cdp_init(void)
2595{
2596 apq8064_common_init();
Joel King8f839b92012-04-01 14:37:46 -07002597 if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
2598 machine_is_mpq8064_dtv()) {
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002599 enable_avc_i2c_bus();
Joel King8f839b92012-04-01 14:37:46 -07002600 platform_add_devices(mpq_devices, ARRAY_SIZE(mpq_devices));
2601 } else {
2602 ethernet_init();
2603 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
2604 spi_register_board_info(spi_board_info,
2605 ARRAY_SIZE(spi_board_info));
2606 }
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002607 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07002608 apq8064_init_gpu();
Matt Wagantall1875d322012-02-22 16:11:33 -08002609 platform_add_devices(apq8064_fs_devices, apq8064_num_fs_devices);
Kevin Chand07220e2012-02-13 15:52:22 -08002610 apq8064_init_cam();
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302611
2612 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
2613 platform_device_register(&cdp_kp_pdev);
2614
2615 if (machine_is_apq8064_mtp())
2616 platform_device_register(&mtp_kp_pdev);
Joel King82b7e3f2012-01-05 10:03:27 -08002617}
2618
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002619MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
2620 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002621 .reserve = apq8064_reserve,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002622 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302623 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002624 .timer = &msm_timer,
2625 .init_machine = apq8064_sim_init,
2626MACHINE_END
2627
Joel King4e7ad222011-08-17 15:47:38 -07002628MACHINE_START(APQ8064_RUMI3, "QCT APQ8064 RUMI3")
2629 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002630 .reserve = apq8064_reserve,
Joel King4e7ad222011-08-17 15:47:38 -07002631 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302632 .handle_irq = gic_handle_irq,
Joel King4e7ad222011-08-17 15:47:38 -07002633 .timer = &msm_timer,
2634 .init_machine = apq8064_rumi3_init,
Huaibin Yang4a084e32011-12-15 15:25:52 -08002635 .init_early = apq8064_allocate_memory_regions,
Joel King4e7ad222011-08-17 15:47:38 -07002636MACHINE_END
2637
Joel King82b7e3f2012-01-05 10:03:27 -08002638MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
2639 .map_io = apq8064_map_io,
2640 .reserve = apq8064_reserve,
2641 .init_irq = apq8064_init_irq,
2642 .handle_irq = gic_handle_irq,
2643 .timer = &msm_timer,
2644 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002645 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07002646 .init_very_early = apq8064_early_reserve,
Joel King82b7e3f2012-01-05 10:03:27 -08002647MACHINE_END
2648
2649MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
2650 .map_io = apq8064_map_io,
2651 .reserve = apq8064_reserve,
2652 .init_irq = apq8064_init_irq,
2653 .handle_irq = gic_handle_irq,
2654 .timer = &msm_timer,
2655 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002656 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07002657 .init_very_early = apq8064_early_reserve,
Joel King82b7e3f2012-01-05 10:03:27 -08002658MACHINE_END
2659
2660MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
2661 .map_io = apq8064_map_io,
2662 .reserve = apq8064_reserve,
2663 .init_irq = apq8064_init_irq,
2664 .handle_irq = gic_handle_irq,
2665 .timer = &msm_timer,
2666 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002667 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07002668 .init_very_early = apq8064_early_reserve,
Joel King82b7e3f2012-01-05 10:03:27 -08002669MACHINE_END
2670
Joel King064bbf82012-04-01 13:23:39 -07002671MACHINE_START(MPQ8064_CDP, "QCT MPQ8064 CDP")
2672 .map_io = apq8064_map_io,
2673 .reserve = apq8064_reserve,
2674 .init_irq = apq8064_init_irq,
2675 .handle_irq = gic_handle_irq,
2676 .timer = &msm_timer,
2677 .init_machine = apq8064_cdp_init,
2678 .init_early = apq8064_allocate_memory_regions,
2679 .init_very_early = apq8064_early_reserve,
2680MACHINE_END
2681
Joel King11ca8202012-02-13 16:19:03 -08002682MACHINE_START(MPQ8064_HRD, "QCT MPQ8064 HRD")
2683 .map_io = apq8064_map_io,
2684 .reserve = apq8064_reserve,
2685 .init_irq = apq8064_init_irq,
2686 .handle_irq = gic_handle_irq,
2687 .timer = &msm_timer,
2688 .init_machine = apq8064_cdp_init,
Laura Abbott6988cef2012-03-15 14:27:13 -07002689 .init_very_early = apq8064_early_reserve,
Joel King11ca8202012-02-13 16:19:03 -08002690MACHINE_END
2691
2692MACHINE_START(MPQ8064_DTV, "QCT MPQ8064 DTV")
2693 .map_io = apq8064_map_io,
2694 .reserve = apq8064_reserve,
2695 .init_irq = apq8064_init_irq,
2696 .handle_irq = gic_handle_irq,
2697 .timer = &msm_timer,
2698 .init_machine = apq8064_cdp_init,
Laura Abbott6988cef2012-03-15 14:27:13 -07002699 .init_very_early = apq8064_early_reserve,
Joel King11ca8202012-02-13 16:19:03 -08002700MACHINE_END
2701