blob: ac937a24e58a479498a1ccf2bbd811d51802591b [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>
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -060018#include <linux/slimbus/slimbus.h>
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +053019#include <linux/mfd/wcd9xxx/core.h>
20#include <linux/mfd/wcd9xxx/pdata.h>
Amy Maloche70090f992012-02-16 16:35:26 -080021#include <linux/mfd/pm8xxx/misc.h>
Kenneth Heitke36920d32011-07-20 16:44:30 -060022#include <linux/msm_ssbi.h>
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -070023#include <linux/spi/spi.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070024#include <linux/dma-mapping.h>
25#include <linux/platform_data/qcom_crypto_device.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080026#include <linux/ion.h>
Jack Cheung46bfffa2012-01-19 15:26:24 -080027#include <linux/memory.h>
Jing Lin21ed4de2012-02-05 15:53:28 -080028#include <linux/i2c/atmel_mxt_ts.h>
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -080029#include <linux/cyttsp.h>
Amy Maloche70090f992012-02-16 16:35:26 -080030#include <linux/i2c/isa1200.h>
Mohan Pallaka474b94b2012-01-25 12:59:58 +053031#include <linux/gpio_keys.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070032#include <asm/mach-types.h>
33#include <asm/mach/arch.h>
34#include <asm/hardware/gic.h>
Sahitya Tummala3586ed92011-08-03 09:13:23 +053035#include <asm/mach/mmc.h>
Ankit Verma6b7e2ba2012-01-26 15:48:54 -080036#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070037
38#include <mach/board.h>
39#include <mach/msm_iomap.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080040#include <mach/ion.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070041#include <linux/usb/msm_hsusb.h>
42#include <linux/usb/android.h>
43#include <mach/socinfo.h>
Harini Jayaramanc4c58692011-07-19 14:50:10 -060044#include <mach/msm_spi.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070045#include "timer.h"
46#include "devices.h"
Joel King4ebccc62011-07-22 09:43:22 -070047#include <mach/gpio.h>
48#include <mach/gpiomux.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060049#include <mach/rpm.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080050#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -070051#include <linux/android_pmem.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080052#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070053#include <mach/msm_memtypes.h>
54#include <linux/bootmem.h>
55#include <asm/setup.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070056#include <mach/dma.h>
Gagan Mac8a7a5d32011-11-11 16:43:06 -070057#include <mach/msm_bus_board.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060058#include <mach/cpuidle.h>
Joel Kingdacbc822012-01-25 13:30:57 -080059#include <mach/mdm2.h>
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -080060#include <linux/msm_tsens.h>
Stephen Boyd4d0d2582012-02-10 14:49:40 -080061#include <mach/msm_xo.h>
Joel King4ebccc62011-07-22 09:43:22 -070062
Jeff Ohlstein7e668552011-10-06 16:17:25 -070063#include "msm_watchdog.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080064#include "board-8064.h"
Vikram Mulukutlabc2e9572011-11-04 03:41:38 -070065#include "acpuclock.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060066#include "spm.h"
67#include "mpm.h"
68#include "rpm_resources.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080069#include "pm.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060070#include "pm-boot.h"
Rajesh Sastrulaaee8af32012-01-20 11:46:31 -080071#include "devices-msm8x60.h"
Jay Chokshiea67c622011-07-29 17:12:26 -070072
Olav Haugan7c6aa742012-01-16 16:47:37 -080073#define MSM_PMEM_ADSP_SIZE 0x7800000
Ben Romberger3ffcd812011-12-08 19:12:10 -080074#define MSM_PMEM_AUDIO_SIZE 0x2B4000
Olav Haugan7c6aa742012-01-16 16:47:37 -080075#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
76#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
77#else
78#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
79#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070080
Olav Haugan7c6aa742012-01-16 16:47:37 -080081#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Olav Hauganedcf6832012-01-24 08:35:41 -080082#define MSM_PMEM_KERNEL_EBI1_SIZE 0x280000
Olav Haugan7c6aa742012-01-16 16:47:37 -080083#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Haugand3d29682012-01-19 10:57:07 -080084#define MSM_ION_MM_FW_SIZE 0x200000 /* (2MB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -080085#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Haugan3a9bd232012-02-15 14:23:27 -080086#define MSM_ION_QSECOM_SIZE 0x300000 /* (3MB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -080087#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan2c43fac2012-01-19 11:06:37 -080088#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
89#define MSM_ION_HEAP_NUM 8
Olav Haugan7c6aa742012-01-16 16:47:37 -080090#else
91#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
92#define MSM_ION_HEAP_NUM 1
93#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070094
Olav Haugan7c6aa742012-01-16 16:47:37 -080095#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
96static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
97static int __init pmem_kernel_ebi1_size_setup(char *p)
Kevin Chan13be4e22011-10-20 11:30:32 -070098{
Olav Haugan7c6aa742012-01-16 16:47:37 -080099 pmem_kernel_ebi1_size = memparse(p, NULL);
100 return 0;
Kevin Chan13be4e22011-10-20 11:30:32 -0700101}
Olav Haugan7c6aa742012-01-16 16:47:37 -0800102early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
103#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700104
Olav Haugan7c6aa742012-01-16 16:47:37 -0800105#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -0700106static unsigned pmem_size = MSM_PMEM_SIZE;
107static int __init pmem_size_setup(char *p)
108{
109 pmem_size = memparse(p, NULL);
110 return 0;
111}
112early_param("pmem_size", pmem_size_setup);
113
114static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
115
116static int __init pmem_adsp_size_setup(char *p)
117{
118 pmem_adsp_size = memparse(p, NULL);
119 return 0;
120}
121early_param("pmem_adsp_size", pmem_adsp_size_setup);
122
123static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
124
125static int __init pmem_audio_size_setup(char *p)
126{
127 pmem_audio_size = memparse(p, NULL);
128 return 0;
129}
130early_param("pmem_audio_size", pmem_audio_size_setup);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800131#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700132
Olav Haugan7c6aa742012-01-16 16:47:37 -0800133#ifdef CONFIG_ANDROID_PMEM
134#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700135static struct android_pmem_platform_data android_pmem_pdata = {
136 .name = "pmem",
137 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
138 .cached = 1,
139 .memory_type = MEMTYPE_EBI1,
140};
141
142static struct platform_device android_pmem_device = {
143 .name = "android_pmem",
144 .id = 0,
145 .dev = {.platform_data = &android_pmem_pdata},
146};
147
148static struct android_pmem_platform_data android_pmem_adsp_pdata = {
149 .name = "pmem_adsp",
150 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
151 .cached = 0,
152 .memory_type = MEMTYPE_EBI1,
153};
Kevin Chan13be4e22011-10-20 11:30:32 -0700154static struct platform_device android_pmem_adsp_device = {
155 .name = "android_pmem",
156 .id = 2,
157 .dev = { .platform_data = &android_pmem_adsp_pdata },
158};
Olav Haugan7c6aa742012-01-16 16:47:37 -0800159#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700160
161static struct android_pmem_platform_data android_pmem_audio_pdata = {
162 .name = "pmem_audio",
163 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
164 .cached = 0,
165 .memory_type = MEMTYPE_EBI1,
166};
167
168static struct platform_device android_pmem_audio_device = {
169 .name = "android_pmem",
170 .id = 4,
171 .dev = { .platform_data = &android_pmem_audio_pdata },
172};
Olav Haugan7c6aa742012-01-16 16:47:37 -0800173#endif
174
175static struct memtype_reserve apq8064_reserve_table[] __initdata = {
176 [MEMTYPE_SMI] = {
177 },
178 [MEMTYPE_EBI0] = {
179 .flags = MEMTYPE_FLAGS_1M_ALIGN,
180 },
181 [MEMTYPE_EBI1] = {
182 .flags = MEMTYPE_FLAGS_1M_ALIGN,
183 },
184};
Kevin Chan13be4e22011-10-20 11:30:32 -0700185
186static void __init size_pmem_devices(void)
187{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800188#ifdef CONFIG_ANDROID_PMEM
189#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700190 android_pmem_adsp_pdata.size = pmem_adsp_size;
191 android_pmem_pdata.size = pmem_size;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800192#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700193 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800194#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700195}
196
197static void __init reserve_memory_for(struct android_pmem_platform_data *p)
198{
199 apq8064_reserve_table[p->memory_type].size += p->size;
200}
201
Kevin Chan13be4e22011-10-20 11:30:32 -0700202static void __init reserve_pmem_memory(void)
203{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800204#ifdef CONFIG_ANDROID_PMEM
205#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700206 reserve_memory_for(&android_pmem_adsp_pdata);
207 reserve_memory_for(&android_pmem_pdata);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800208#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700209 reserve_memory_for(&android_pmem_audio_pdata);
210 apq8064_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800211#endif
212}
213
214static int apq8064_paddr_to_memtype(unsigned int paddr)
215{
216 return MEMTYPE_EBI1;
217}
218
219#ifdef CONFIG_ION_MSM
220#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
221static struct ion_cp_heap_pdata cp_mm_ion_pdata = {
222 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugand3d29682012-01-19 10:57:07 -0800223 .align = PAGE_SIZE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800224};
225
226static struct ion_cp_heap_pdata cp_mfc_ion_pdata = {
227 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugand3d29682012-01-19 10:57:07 -0800228 .align = PAGE_SIZE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800229};
230
231static struct ion_co_heap_pdata co_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800232 .adjacent_mem_id = INVALID_HEAP_ID,
233 .align = PAGE_SIZE,
234};
235
236static struct ion_co_heap_pdata fw_co_ion_pdata = {
237 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
238 .align = SZ_128K,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800239};
240#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800241
242/**
243 * These heaps are listed in the order they will be allocated. Due to
244 * video hardware restrictions and content protection the FW heap has to
245 * be allocated adjacent (below) the MM heap and the MFC heap has to be
246 * allocated after the MM heap to ensure MFC heap is not more than 256MB
247 * away from the base address of the FW heap.
248 * However, the order of FW heap and MM heap doesn't matter since these
249 * two heaps are taken care of by separate code to ensure they are adjacent
250 * to each other.
251 * Don't swap the order unless you know what you are doing!
252 */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800253static struct ion_platform_data ion_pdata = {
254 .nr = MSM_ION_HEAP_NUM,
255 .heaps = {
256 {
257 .id = ION_SYSTEM_HEAP_ID,
258 .type = ION_HEAP_TYPE_SYSTEM,
259 .name = ION_VMALLOC_HEAP_NAME,
260 },
261#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
262 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800263 .id = ION_CP_MM_HEAP_ID,
264 .type = ION_HEAP_TYPE_CP,
265 .name = ION_MM_HEAP_NAME,
266 .size = MSM_ION_MM_SIZE,
267 .memory_type = ION_EBI_TYPE,
268 .extra_data = (void *) &cp_mm_ion_pdata,
269 },
270 {
Olav Haugand3d29682012-01-19 10:57:07 -0800271 .id = ION_MM_FIRMWARE_HEAP_ID,
272 .type = ION_HEAP_TYPE_CARVEOUT,
273 .name = ION_MM_FIRMWARE_HEAP_NAME,
274 .size = MSM_ION_MM_FW_SIZE,
275 .memory_type = ION_EBI_TYPE,
276 .extra_data = (void *) &fw_co_ion_pdata,
277 },
278 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800279 .id = ION_CP_MFC_HEAP_ID,
280 .type = ION_HEAP_TYPE_CP,
281 .name = ION_MFC_HEAP_NAME,
282 .size = MSM_ION_MFC_SIZE,
283 .memory_type = ION_EBI_TYPE,
284 .extra_data = (void *) &cp_mfc_ion_pdata,
285 },
286 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800287 .id = ION_SF_HEAP_ID,
288 .type = ION_HEAP_TYPE_CARVEOUT,
289 .name = ION_SF_HEAP_NAME,
290 .size = MSM_ION_SF_SIZE,
291 .memory_type = ION_EBI_TYPE,
292 .extra_data = (void *) &co_ion_pdata,
293 },
294 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800295 .id = ION_IOMMU_HEAP_ID,
296 .type = ION_HEAP_TYPE_IOMMU,
297 .name = ION_IOMMU_HEAP_NAME,
298 },
Olav Hauganf45e2142012-01-19 11:01:01 -0800299 {
300 .id = ION_QSECOM_HEAP_ID,
301 .type = ION_HEAP_TYPE_CARVEOUT,
302 .name = ION_QSECOM_HEAP_NAME,
303 .size = MSM_ION_QSECOM_SIZE,
304 .memory_type = ION_EBI_TYPE,
305 .extra_data = (void *) &co_ion_pdata,
306 },
Olav Haugan2c43fac2012-01-19 11:06:37 -0800307 {
308 .id = ION_AUDIO_HEAP_ID,
309 .type = ION_HEAP_TYPE_CARVEOUT,
310 .name = ION_AUDIO_HEAP_NAME,
311 .size = MSM_ION_AUDIO_SIZE,
312 .memory_type = ION_EBI_TYPE,
313 .extra_data = (void *) &co_ion_pdata,
314 },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800315#endif
316 }
317};
318
319static struct platform_device ion_dev = {
320 .name = "ion-msm",
321 .id = 1,
322 .dev = { .platform_data = &ion_pdata },
323};
324#endif
325
326static void reserve_ion_memory(void)
327{
328#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
329 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_SIZE;
Olav Haugand3d29682012-01-19 10:57:07 -0800330 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_FW_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800331 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_SF_SIZE;
332 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MFC_SIZE;
Olav Hauganf45e2142012-01-19 11:01:01 -0800333 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_QSECOM_SIZE;
Olav Haugan2c43fac2012-01-19 11:06:37 -0800334 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_AUDIO_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800335#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700336}
337
Huaibin Yang4a084e32011-12-15 15:25:52 -0800338static void __init reserve_mdp_memory(void)
339{
340 apq8064_mdp_writeback(apq8064_reserve_table);
341}
342
Kevin Chan13be4e22011-10-20 11:30:32 -0700343static void __init apq8064_calculate_reserve_sizes(void)
344{
345 size_pmem_devices();
346 reserve_pmem_memory();
Olav Haugan7c6aa742012-01-16 16:47:37 -0800347 reserve_ion_memory();
Huaibin Yang4a084e32011-12-15 15:25:52 -0800348 reserve_mdp_memory();
Kevin Chan13be4e22011-10-20 11:30:32 -0700349}
350
351static struct reserve_info apq8064_reserve_info __initdata = {
352 .memtype_reserve_table = apq8064_reserve_table,
353 .calculate_reserve_sizes = apq8064_calculate_reserve_sizes,
354 .paddr_to_memtype = apq8064_paddr_to_memtype,
355};
356
357static int apq8064_memory_bank_size(void)
358{
359 return 1<<29;
360}
361
362static void __init locate_unstable_memory(void)
363{
364 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
365 unsigned long bank_size;
366 unsigned long low, high;
367
368 bank_size = apq8064_memory_bank_size();
369 low = meminfo.bank[0].start;
370 high = mb->start + mb->size;
Olav Haugand76e3a82012-01-16 16:55:07 -0800371
372 /* Check if 32 bit overflow occured */
373 if (high < mb->start)
374 high = ~0UL;
375
Kevin Chan13be4e22011-10-20 11:30:32 -0700376 low &= ~(bank_size - 1);
377
378 if (high - low <= bank_size)
379 return;
Jack Cheung46bfffa2012-01-19 15:26:24 -0800380 apq8064_reserve_info.low_unstable_address = mb->start -
381 MIN_MEMORY_BLOCK_SIZE + mb->size;
382 apq8064_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
383
Kevin Chan13be4e22011-10-20 11:30:32 -0700384 apq8064_reserve_info.bank_size = bank_size;
385 pr_info("low unstable address %lx max size %lx bank size %lx\n",
386 apq8064_reserve_info.low_unstable_address,
387 apq8064_reserve_info.max_unstable_size,
388 apq8064_reserve_info.bank_size);
389}
390
391static void __init apq8064_reserve(void)
392{
393 reserve_info = &apq8064_reserve_info;
394 locate_unstable_memory();
395 msm_reserve();
396}
397
Hemant Kumara945b472012-01-25 15:08:06 -0800398#ifdef CONFIG_USB_EHCI_MSM_HSIC
399static struct msm_hsic_host_platform_data msm_hsic_pdata = {
400 .strobe = 88,
401 .data = 89,
402};
403#else
404static struct msm_hsic_host_platform_data msm_hsic_pdata;
405#endif
406
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800407#define PID_MAGIC_ID 0x71432909
408#define SERIAL_NUM_MAGIC_ID 0x61945374
409#define SERIAL_NUMBER_LENGTH 127
410#define DLOAD_USB_BASE_ADD 0x2A03F0C8
411
412struct magic_num_struct {
413 uint32_t pid;
414 uint32_t serial_num;
415};
416
417struct dload_struct {
418 uint32_t reserved1;
419 uint32_t reserved2;
420 uint32_t reserved3;
421 uint16_t reserved4;
422 uint16_t pid;
423 char serial_number[SERIAL_NUMBER_LENGTH];
424 uint16_t reserved5;
425 struct magic_num_struct magic_struct;
426};
427
428static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
429{
430 struct dload_struct __iomem *dload = 0;
431
432 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
433 if (!dload) {
434 pr_err("%s: cannot remap I/O memory region: %08x\n",
435 __func__, DLOAD_USB_BASE_ADD);
436 return -ENXIO;
437 }
438
439 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
440 __func__, dload, pid, snum);
441 /* update pid */
442 dload->magic_struct.pid = PID_MAGIC_ID;
443 dload->pid = pid;
444
445 /* update serial number */
446 dload->magic_struct.serial_num = 0;
447 if (!snum) {
448 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
449 goto out;
450 }
451
452 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
453 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
454out:
455 iounmap(dload);
456 return 0;
457}
458
459static struct android_usb_platform_data android_usb_pdata = {
460 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
461};
462
Hemant Kumar4933b072011-10-17 23:43:11 -0700463static struct platform_device android_usb_device = {
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800464 .name = "android_usb",
465 .id = -1,
466 .dev = {
467 .platform_data = &android_usb_pdata,
468 },
Hemant Kumar4933b072011-10-17 23:43:11 -0700469};
470
471static struct msm_otg_platform_data msm_otg_pdata = {
Hemant Kumard86c4882012-01-24 19:39:37 -0800472 .mode = USB_OTG,
473 .otg_control = OTG_PMIC_CONTROL,
Hemant Kumar4933b072011-10-17 23:43:11 -0700474 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Hemant Kumard86c4882012-01-24 19:39:37 -0800475 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
476 .power_budget = 750,
Hemant Kumar4933b072011-10-17 23:43:11 -0700477};
478
Manu Gautam91223e02011-11-08 15:27:22 +0530479static struct msm_usb_host_platform_data msm_ehci_host_pdata = {
480 .power_budget = 500,
481};
482
483static void __init apq8064_ehci_host_init(void)
484{
485 if (machine_is_apq8064_liquid()) {
486 apq8064_device_ehci_host3.dev.platform_data =
487 &msm_ehci_host_pdata;
488 platform_device_register(&apq8064_device_ehci_host3);
489 }
490}
491
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800492#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
493
494/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
495 * 4 micbiases are used to power various analog and digital
496 * microphones operating at 1800 mV. Technically, all micbiases
497 * can source from single cfilter since all microphones operate
498 * at the same voltage level. The arrangement below is to make
499 * sure all cfilters are exercised. LDO_H regulator ouput level
500 * does not need to be as high as 2.85V. It is choosen for
501 * microphone sensitivity purpose.
502 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530503static struct wcd9xxx_pdata apq8064_tabla_platform_data = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800504 .slimbus_slave_device = {
505 .name = "tabla-slave",
506 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
507 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800508 .irq = MSM_GPIO_TO_INT(42),
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800509 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530510 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800511 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
512 .micbias = {
513 .ldoh_v = TABLA_LDOH_2P85_V,
514 .cfilt1_mv = 1800,
515 .cfilt2_mv = 1800,
516 .cfilt3_mv = 1800,
517 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
518 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
519 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
520 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530521 },
522 .regulator = {
523 {
524 .name = "CDC_VDD_CP",
525 .min_uV = 1800000,
526 .max_uV = 1800000,
527 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
528 },
529 {
530 .name = "CDC_VDDA_RX",
531 .min_uV = 1800000,
532 .max_uV = 1800000,
533 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
534 },
535 {
536 .name = "CDC_VDDA_TX",
537 .min_uV = 1800000,
538 .max_uV = 1800000,
539 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
540 },
541 {
542 .name = "VDDIO_CDC",
543 .min_uV = 1800000,
544 .max_uV = 1800000,
545 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
546 },
547 {
548 .name = "VDDD_CDC_D",
549 .min_uV = 1225000,
550 .max_uV = 1225000,
551 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
552 },
553 {
554 .name = "CDC_VDDA_A_1P2V",
555 .min_uV = 1225000,
556 .max_uV = 1225000,
557 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
558 },
559 },
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800560};
561
562static struct slim_device apq8064_slim_tabla = {
563 .name = "tabla-slim",
564 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
565 .dev = {
566 .platform_data = &apq8064_tabla_platform_data,
567 },
568};
569
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530570static struct wcd9xxx_pdata apq8064_tabla20_platform_data = {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800571 .slimbus_slave_device = {
572 .name = "tabla-slave",
573 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
574 },
575 .irq = MSM_GPIO_TO_INT(42),
576 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530577 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800578 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
579 .micbias = {
580 .ldoh_v = TABLA_LDOH_2P85_V,
581 .cfilt1_mv = 1800,
582 .cfilt2_mv = 1800,
583 .cfilt3_mv = 1800,
584 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
585 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
586 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
587 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530588 },
589 .regulator = {
590 {
591 .name = "CDC_VDD_CP",
592 .min_uV = 1800000,
593 .max_uV = 1800000,
594 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
595 },
596 {
597 .name = "CDC_VDDA_RX",
598 .min_uV = 1800000,
599 .max_uV = 1800000,
600 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
601 },
602 {
603 .name = "CDC_VDDA_TX",
604 .min_uV = 1800000,
605 .max_uV = 1800000,
606 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
607 },
608 {
609 .name = "VDDIO_CDC",
610 .min_uV = 1800000,
611 .max_uV = 1800000,
612 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
613 },
614 {
615 .name = "VDDD_CDC_D",
616 .min_uV = 1225000,
617 .max_uV = 1225000,
618 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
619 },
620 {
621 .name = "CDC_VDDA_A_1P2V",
622 .min_uV = 1225000,
623 .max_uV = 1225000,
624 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
625 },
626 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800627};
628
629static struct slim_device apq8064_slim_tabla20 = {
630 .name = "tabla2x-slim",
631 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
632 .dev = {
633 .platform_data = &apq8064_tabla20_platform_data,
634 },
635};
636
Amy Maloche70090f992012-02-16 16:35:26 -0800637#define HAP_SHIFT_LVL_OE_GPIO PM8921_MPP_PM_TO_SYS(8)
638#define ISA1200_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
639#define ISA1200_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
640#define ISA1200_HAP_CLK PM8921_GPIO_PM_TO_SYS(44)
641
642static int isa1200_power(int on)
643{
644 gpio_set_value_cansleep(ISA1200_HAP_CLK, !!on);
645
646 return 0;
647}
648
649static int isa1200_dev_setup(bool enable)
650{
651 int rc = 0;
652
653 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_1, enable);
654 if (rc) {
655 pr_err("%s: unable to write aux clock register(%d)\n",
656 __func__, rc);
657 return rc;
658 }
659
660 if (!enable)
661 goto free_gpio;
662
663 rc = gpio_request(ISA1200_HAP_CLK, "haptics_clk");
664 if (rc) {
665 pr_err("%s: unable to request gpio %d config(%d)\n",
666 __func__, ISA1200_HAP_CLK, rc);
667 return rc;
668 }
669
670 rc = gpio_direction_output(ISA1200_HAP_CLK, 0);
671 if (rc) {
672 pr_err("%s: unable to set direction\n", __func__);
673 goto free_gpio;
674 }
675
676 return 0;
677
678free_gpio:
679 gpio_free(ISA1200_HAP_CLK);
680 return rc;
681}
682
683static struct isa1200_regulator isa1200_reg_data[] = {
684 {
685 .name = "vddp",
686 .min_uV = ISA_I2C_VTG_MIN_UV,
687 .max_uV = ISA_I2C_VTG_MAX_UV,
688 .load_uA = ISA_I2C_CURR_UA,
689 },
690};
691
692static struct isa1200_platform_data isa1200_1_pdata = {
693 .name = "vibrator",
694 .dev_setup = isa1200_dev_setup,
695 .power_on = isa1200_power,
696 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
697 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
698 .max_timeout = 15000,
699 .mode_ctrl = PWM_GEN_MODE,
700 .pwm_fd = {
701 .pwm_div = 256,
702 },
703 .is_erm = false,
704 .smart_en = true,
705 .ext_clk_en = true,
706 .chip_en = 1,
707 .regulator_info = isa1200_reg_data,
708 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
709};
710
711static struct i2c_board_info isa1200_board_info[] __initdata = {
712 {
713 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
714 .platform_data = &isa1200_1_pdata,
715 },
716};
Jing Lin21ed4de2012-02-05 15:53:28 -0800717/* configuration data for mxt1386e using V2.1 firmware */
718static const u8 mxt1386e_config_data_v2_1[] = {
719 /* T6 Object */
720 0, 0, 0, 0, 0, 0,
721 /* T38 Object */
Jing Linf1208fd2012-02-23 11:15:42 -0800722 14, 1, 0, 22, 2, 12, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800723 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
724 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
725 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
726 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
727 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
728 0, 0, 0, 0,
729 /* T7 Object */
Jing Linf1208fd2012-02-23 11:15:42 -0800730 100, 10, 50,
Jing Lin21ed4de2012-02-05 15:53:28 -0800731 /* T8 Object */
Jing Linf1208fd2012-02-23 11:15:42 -0800732 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800733 /* T9 Object */
734 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
735 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
Jing Linf1208fd2012-02-23 11:15:42 -0800736 85, 5, 0, 5, 9, 5, 12, 35, 70, 40,
737 20, 5, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800738 /* T18 Object */
739 0, 0,
740 /* T24 Object */
741 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
742 0, 0, 0, 0, 0, 0, 0, 0, 0,
743 /* T25 Object */
744 3, 0, 60, 115, 156, 99,
745 /* T27 Object */
746 0, 0, 0, 0, 0, 0, 0,
747 /* T40 Object */
748 0, 0, 0, 0, 0,
749 /* T42 Object */
750 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
751 /* T43 Object */
752 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
753 16,
754 /* T46 Object */
Jing Linf1208fd2012-02-23 11:15:42 -0800755 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800756 /* T47 Object */
757 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
758 /* T48 Object */
759 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -0800760 32, 40, 0, 10, 10, 0, 0, 100, 10, 90,
761 0, 0, 0, 0, 0, 0, 0, 10, 1, 10,
762 52, 10, 12, 0, 33, 0, 1, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800763 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
764 0, 0, 0, 0,
765 /* T56 Object */
766 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
767 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
768 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
769 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -0800770 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
771 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800772};
773
774#define MXT_TS_GPIO_IRQ 6
775#define MXT_TS_PWR_EN_GPIO PM8921_GPIO_PM_TO_SYS(23)
776#define MXT_TS_RESET_GPIO 33
777
778static struct mxt_config_info mxt_config_array[] = {
779 {
780 .config = mxt1386e_config_data_v2_1,
781 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
782 .family_id = 0xA0,
783 .variant_id = 0x7,
784 .version = 0x21,
785 .build = 0xAA,
786 },
787};
788
789static struct mxt_platform_data mxt_platform_data = {
790 .config_array = mxt_config_array,
791 .config_array_size = ARRAY_SIZE(mxt_config_array),
792 .x_size = 1365,
793 .y_size = 767,
794 .irqflags = IRQF_TRIGGER_FALLING,
795 .i2c_pull_up = true,
796 .reset_gpio = MXT_TS_RESET_GPIO,
797 .irq_gpio = MXT_TS_GPIO_IRQ,
798};
799
800static struct i2c_board_info mxt_device_info[] __initdata = {
801 {
802 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
803 .platform_data = &mxt_platform_data,
804 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
805 },
806};
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -0800807#define CYTTSP_TS_GPIO_IRQ 6
808#define CYTTSP_TS_GPIO_RESOUT 7
809#define CYTTSP_TS_GPIO_SLEEP 33
810
811static ssize_t tma340_vkeys_show(struct kobject *kobj,
812 struct kobj_attribute *attr, char *buf)
813{
814 return snprintf(buf, 200,
815 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
816 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
817 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
818 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
819 "\n");
820}
821
822static struct kobj_attribute tma340_vkeys_attr = {
823 .attr = {
824 .mode = S_IRUGO,
825 },
826 .show = &tma340_vkeys_show,
827};
828
829static struct attribute *tma340_properties_attrs[] = {
830 &tma340_vkeys_attr.attr,
831 NULL
832};
833
834static struct attribute_group tma340_properties_attr_group = {
835 .attrs = tma340_properties_attrs,
836};
837
838static int cyttsp_platform_init(struct i2c_client *client)
839{
840 int rc = 0;
841 static struct kobject *tma340_properties_kobj;
842
843 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
844 tma340_properties_kobj = kobject_create_and_add("board_properties",
845 NULL);
846 if (tma340_properties_kobj)
847 rc = sysfs_create_group(tma340_properties_kobj,
848 &tma340_properties_attr_group);
849 if (!tma340_properties_kobj || rc)
850 pr_err("%s: failed to create board_properties\n",
851 __func__);
852
853 return 0;
854}
855
856static struct cyttsp_regulator cyttsp_regulator_data[] = {
857 {
858 .name = "vdd",
859 .min_uV = CY_TMA300_VTG_MIN_UV,
860 .max_uV = CY_TMA300_VTG_MAX_UV,
861 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
862 .lpm_load_uA = CY_TMA300_CURR_24HZ_UA,
863 },
864 {
865 .name = "vcc_i2c",
866 .min_uV = CY_I2C_VTG_MIN_UV,
867 .max_uV = CY_I2C_VTG_MAX_UV,
868 .hpm_load_uA = CY_I2C_CURR_UA,
869 .lpm_load_uA = CY_I2C_CURR_UA,
870 },
871};
872
873static struct cyttsp_platform_data cyttsp_pdata = {
874 .panel_maxx = 634,
875 .panel_maxy = 1166,
876 .disp_maxx = 599,
877 .disp_maxy = 1023,
878 .disp_minx = 0,
879 .disp_miny = 0,
880 .flags = 0x01,
881 .gen = CY_GEN3,
882 .use_st = CY_USE_ST,
883 .use_mt = CY_USE_MT,
884 .use_hndshk = CY_SEND_HNDSHK,
885 .use_trk_id = CY_USE_TRACKING_ID,
886 .use_sleep = CY_USE_DEEP_SLEEP_SEL,
887 .use_gestures = CY_USE_GESTURES,
888 .fw_fname = "cyttsp_8064_mtp.hex",
889 /* change act_intrvl to customize the Active power state
890 * scanning/processing refresh interval for Operating mode
891 */
892 .act_intrvl = CY_ACT_INTRVL_DFLT,
893 /* change tch_tmout to customize the touch timeout for the
894 * Active power state for Operating mode
895 */
896 .tch_tmout = CY_TCH_TMOUT_DFLT,
897 /* change lp_intrvl to customize the Low Power power state
898 * scanning/processing refresh interval for Operating mode
899 */
900 .lp_intrvl = CY_LP_INTRVL_DFLT,
901 .sleep_gpio = CYTTSP_TS_GPIO_SLEEP,
902 .resout_gpio = CYTTSP_TS_GPIO_RESOUT,
903 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
904 .regulator_info = cyttsp_regulator_data,
905 .num_regulators = ARRAY_SIZE(cyttsp_regulator_data),
906 .init = cyttsp_platform_init,
907 .correct_fw_ver = 17,
908};
909
910static struct i2c_board_info cyttsp_info[] __initdata = {
911 {
912 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
913 .platform_data = &cyttsp_pdata,
914 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
915 },
916};
Jing Lin21ed4de2012-02-05 15:53:28 -0800917
Ankit Verma6b7e2ba2012-01-26 15:48:54 -0800918#define MSM_WCNSS_PHYS 0x03000000
919#define MSM_WCNSS_SIZE 0x280000
920
921static struct resource resources_wcnss_wlan[] = {
922 {
923 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
924 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
925 .name = "wcnss_wlanrx_irq",
926 .flags = IORESOURCE_IRQ,
927 },
928 {
929 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
930 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
931 .name = "wcnss_wlantx_irq",
932 .flags = IORESOURCE_IRQ,
933 },
934 {
935 .start = MSM_WCNSS_PHYS,
936 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
937 .name = "wcnss_mmio",
938 .flags = IORESOURCE_MEM,
939 },
940 {
941 .start = 64,
942 .end = 68,
943 .name = "wcnss_gpios_5wire",
944 .flags = IORESOURCE_IO,
945 },
946};
947
948static struct qcom_wcnss_opts qcom_wcnss_pdata = {
949 .has_48mhz_xo = 1,
950};
951
952static struct platform_device msm_device_wcnss_wlan = {
953 .name = "wcnss_wlan",
954 .id = 0,
955 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
956 .resource = resources_wcnss_wlan,
957 .dev = {.platform_data = &qcom_wcnss_pdata},
958};
959
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700960#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
961 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
962 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
963 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
964
965#define QCE_SIZE 0x10000
966#define QCE_0_BASE 0x11000000
967
968#define QCE_HW_KEY_SUPPORT 0
969#define QCE_SHA_HMAC_SUPPORT 1
970#define QCE_SHARE_CE_RESOURCE 3
971#define QCE_CE_SHARED 0
972
973static struct resource qcrypto_resources[] = {
974 [0] = {
975 .start = QCE_0_BASE,
976 .end = QCE_0_BASE + QCE_SIZE - 1,
977 .flags = IORESOURCE_MEM,
978 },
979 [1] = {
980 .name = "crypto_channels",
981 .start = DMOV8064_CE_IN_CHAN,
982 .end = DMOV8064_CE_OUT_CHAN,
983 .flags = IORESOURCE_DMA,
984 },
985 [2] = {
986 .name = "crypto_crci_in",
987 .start = DMOV8064_CE_IN_CRCI,
988 .end = DMOV8064_CE_IN_CRCI,
989 .flags = IORESOURCE_DMA,
990 },
991 [3] = {
992 .name = "crypto_crci_out",
993 .start = DMOV8064_CE_OUT_CRCI,
994 .end = DMOV8064_CE_OUT_CRCI,
995 .flags = IORESOURCE_DMA,
996 },
997};
998
999static struct resource qcedev_resources[] = {
1000 [0] = {
1001 .start = QCE_0_BASE,
1002 .end = QCE_0_BASE + QCE_SIZE - 1,
1003 .flags = IORESOURCE_MEM,
1004 },
1005 [1] = {
1006 .name = "crypto_channels",
1007 .start = DMOV8064_CE_IN_CHAN,
1008 .end = DMOV8064_CE_OUT_CHAN,
1009 .flags = IORESOURCE_DMA,
1010 },
1011 [2] = {
1012 .name = "crypto_crci_in",
1013 .start = DMOV8064_CE_IN_CRCI,
1014 .end = DMOV8064_CE_IN_CRCI,
1015 .flags = IORESOURCE_DMA,
1016 },
1017 [3] = {
1018 .name = "crypto_crci_out",
1019 .start = DMOV8064_CE_OUT_CRCI,
1020 .end = DMOV8064_CE_OUT_CRCI,
1021 .flags = IORESOURCE_DMA,
1022 },
1023};
1024
1025#endif
1026
1027#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1028 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1029
1030static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1031 .ce_shared = QCE_CE_SHARED,
1032 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1033 .hw_key_support = QCE_HW_KEY_SUPPORT,
1034 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001035 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001036};
1037
1038static struct platform_device qcrypto_device = {
1039 .name = "qcrypto",
1040 .id = 0,
1041 .num_resources = ARRAY_SIZE(qcrypto_resources),
1042 .resource = qcrypto_resources,
1043 .dev = {
1044 .coherent_dma_mask = DMA_BIT_MASK(32),
1045 .platform_data = &qcrypto_ce_hw_suppport,
1046 },
1047};
1048#endif
1049
1050#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1051 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1052
1053static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1054 .ce_shared = QCE_CE_SHARED,
1055 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1056 .hw_key_support = QCE_HW_KEY_SUPPORT,
1057 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001058 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001059};
1060
1061static struct platform_device qcedev_device = {
1062 .name = "qce",
1063 .id = 0,
1064 .num_resources = ARRAY_SIZE(qcedev_resources),
1065 .resource = qcedev_resources,
1066 .dev = {
1067 .coherent_dma_mask = DMA_BIT_MASK(32),
1068 .platform_data = &qcedev_ce_hw_suppport,
1069 },
1070};
1071#endif
1072
Joel Kingdacbc822012-01-25 13:30:57 -08001073static struct mdm_platform_data mdm_platform_data = {
1074 .mdm_version = "3.0",
1075 .ramdump_delay_ms = 2000,
Hemant Kumara945b472012-01-25 15:08:06 -08001076 .peripheral_platform_device = &apq8064_device_hsic_host,
Joel Kingdacbc822012-01-25 13:30:57 -08001077};
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001078
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001079static struct tsens_platform_data apq_tsens_pdata = {
1080 .tsens_factor = 1000,
1081 .hw_type = APQ_8064,
1082 .tsens_num_sensor = 11,
1083 .slope = {1176, 1176, 1154, 1176, 1111,
1084 1132, 1132, 1199, 1132, 1199, 1132},
1085};
1086
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001087#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001088static void __init apq8064_map_io(void)
1089{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001090 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001091 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001092 if (socinfo_init() < 0)
1093 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001094}
1095
1096static void __init apq8064_init_irq(void)
1097{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001098 struct msm_mpm_device_data *data = NULL;
1099
1100#ifdef CONFIG_MSM_MPM
1101 data = &apq8064_mpm_dev_data;
1102#endif
1103
1104 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001105 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1106 (void *)MSM_QGIC_CPU_BASE);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001107}
1108
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001109static struct platform_device msm8064_device_saw_regulator_core0 = {
1110 .name = "saw-regulator",
1111 .id = 0,
1112 .dev = {
1113 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
1114 },
1115};
1116
1117static struct platform_device msm8064_device_saw_regulator_core1 = {
1118 .name = "saw-regulator",
1119 .id = 1,
1120 .dev = {
1121 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
1122 },
1123};
1124
1125static struct platform_device msm8064_device_saw_regulator_core2 = {
1126 .name = "saw-regulator",
1127 .id = 2,
1128 .dev = {
1129 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
1130 },
1131};
1132
1133static struct platform_device msm8064_device_saw_regulator_core3 = {
1134 .name = "saw-regulator",
1135 .id = 3,
1136 .dev = {
1137 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001138
1139 },
1140};
1141
1142static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
1143 {
1144 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1145 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1146 true,
1147 100, 8000, 100000, 1,
1148 },
1149
1150 {
1151 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1152 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1153 true,
1154 2000, 6000, 60100000, 3000,
1155 },
1156
1157 {
1158 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1159 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1160 false,
1161 4200, 5000, 60350000, 3500,
1162 },
1163
1164 {
1165 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1166 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
1167 false,
1168 6300, 4500, 65350000, 4800,
1169 },
1170
1171 {
1172 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1173 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1174 false,
1175 11700, 2500, 67850000, 5500,
1176 },
1177
1178 {
1179 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1180 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1181 false,
1182 13800, 2000, 71850000, 6800,
1183 },
1184
1185 {
1186 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1187 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1188 false,
1189 29700, 500, 75850000, 8800,
1190 },
1191
1192 {
1193 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1194 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1195 false,
1196 29700, 0, 76350000, 9800,
1197 },
1198};
1199
1200static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1201 .mode = MSM_PM_BOOT_CONFIG_TZ,
1202};
1203
1204static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
1205 .levels = &msm_rpmrs_levels[0],
1206 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
1207 .vdd_mem_levels = {
1208 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
1209 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
1210 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
1211 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
1212 },
1213 .vdd_dig_levels = {
1214 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
1215 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
1216 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
1217 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
1218 },
1219 .vdd_mask = 0x7FFFFF,
1220 .rpmrs_target_id = {
1221 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
1222 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
1223 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
1224 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
1225 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
1226 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
1227 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
1228 },
1229};
1230
1231static struct msm_cpuidle_state msm_cstates[] __initdata = {
1232 {0, 0, "C0", "WFI",
1233 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1234
1235 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1236 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1237
1238 {0, 2, "C2", "POWER_COLLAPSE",
1239 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
1240
1241 {1, 0, "C0", "WFI",
1242 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1243
1244 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1245 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1246
1247 {2, 0, "C0", "WFI",
1248 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1249
1250 {2, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1251 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1252
1253 {3, 0, "C0", "WFI",
1254 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1255
1256 {3, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1257 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1258};
1259
1260static struct msm_pm_platform_data msm_pm_data[] = {
1261 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1262 .idle_supported = 1,
1263 .suspend_supported = 1,
1264 .idle_enabled = 0,
1265 .suspend_enabled = 0,
1266 },
1267
1268 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1269 .idle_supported = 1,
1270 .suspend_supported = 1,
1271 .idle_enabled = 0,
1272 .suspend_enabled = 0,
1273 },
1274
1275 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1276 .idle_supported = 1,
1277 .suspend_supported = 1,
1278 .idle_enabled = 1,
1279 .suspend_enabled = 1,
1280 },
1281
1282 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1283 .idle_supported = 0,
1284 .suspend_supported = 1,
1285 .idle_enabled = 0,
1286 .suspend_enabled = 0,
1287 },
1288
1289 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1290 .idle_supported = 1,
1291 .suspend_supported = 1,
1292 .idle_enabled = 0,
1293 .suspend_enabled = 0,
1294 },
1295
1296 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1297 .idle_supported = 1,
1298 .suspend_supported = 0,
1299 .idle_enabled = 1,
1300 .suspend_enabled = 0,
1301 },
1302
1303 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1304 .idle_supported = 0,
1305 .suspend_supported = 1,
1306 .idle_enabled = 0,
1307 .suspend_enabled = 0,
1308 },
1309
1310 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1311 .idle_supported = 1,
1312 .suspend_supported = 1,
1313 .idle_enabled = 0,
1314 .suspend_enabled = 0,
1315 },
1316
1317 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1318 .idle_supported = 1,
1319 .suspend_supported = 0,
1320 .idle_enabled = 1,
1321 .suspend_enabled = 0,
1322 },
1323
1324 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1325 .idle_supported = 0,
1326 .suspend_supported = 1,
1327 .idle_enabled = 0,
1328 .suspend_enabled = 0,
1329 },
1330
1331 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1332 .idle_supported = 1,
1333 .suspend_supported = 1,
1334 .idle_enabled = 0,
1335 .suspend_enabled = 0,
1336 },
1337
1338 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1339 .idle_supported = 1,
1340 .suspend_supported = 0,
1341 .idle_enabled = 1,
1342 .suspend_enabled = 0,
1343 },
1344};
1345
1346static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1347 0x03, 0x0f,
1348};
1349
1350static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1351 0x00, 0x24, 0x54, 0x10,
1352 0x09, 0x03, 0x01,
1353 0x10, 0x54, 0x30, 0x0C,
1354 0x24, 0x30, 0x0f,
1355};
1356
1357static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1358 0x00, 0x24, 0x54, 0x10,
1359 0x09, 0x07, 0x01, 0x0B,
1360 0x10, 0x54, 0x30, 0x0C,
1361 0x24, 0x30, 0x0f,
1362};
1363
1364static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1365 [0] = {
1366 .mode = MSM_SPM_MODE_CLOCK_GATING,
1367 .notify_rpm = false,
1368 .cmd = spm_wfi_cmd_sequence,
1369 },
1370 [1] = {
1371 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1372 .notify_rpm = false,
1373 .cmd = spm_power_collapse_without_rpm,
1374 },
1375 [2] = {
1376 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1377 .notify_rpm = true,
1378 .cmd = spm_power_collapse_with_rpm,
1379 },
1380};
1381
1382static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1383 0x00, 0x20, 0x03, 0x20,
1384 0x00, 0x0f,
1385};
1386
1387static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1388 0x00, 0x20, 0x34, 0x64,
1389 0x48, 0x07, 0x48, 0x20,
1390 0x50, 0x64, 0x04, 0x34,
1391 0x50, 0x0f,
1392};
1393static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1394 0x00, 0x10, 0x34, 0x64,
1395 0x48, 0x07, 0x48, 0x10,
1396 0x50, 0x64, 0x04, 0x34,
1397 0x50, 0x0F,
1398};
1399
1400static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1401 [0] = {
1402 .mode = MSM_SPM_L2_MODE_RETENTION,
1403 .notify_rpm = false,
1404 .cmd = l2_spm_wfi_cmd_sequence,
1405 },
1406 [1] = {
1407 .mode = MSM_SPM_L2_MODE_GDHS,
1408 .notify_rpm = true,
1409 .cmd = l2_spm_gdhs_cmd_sequence,
1410 },
1411 [2] = {
1412 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1413 .notify_rpm = true,
1414 .cmd = l2_spm_power_off_cmd_sequence,
1415 },
1416};
1417
1418
1419static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1420 [0] = {
1421 .reg_base_addr = MSM_SAW_L2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001422 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
1423 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1424 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1425 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1426 .modes = msm_spm_l2_seq_list,
1427 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1428 },
1429};
1430
1431static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1432 [0] = {
1433 .reg_base_addr = MSM_SAW0_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001434 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001435#if defined(CONFIG_MSM_AVS_HW)
1436 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1437 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1438#endif
1439 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1440 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1441 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1442 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1443 .vctl_timeout_us = 50,
1444 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1445 .modes = msm_spm_seq_list,
1446 },
1447 [1] = {
1448 .reg_base_addr = MSM_SAW1_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001449 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001450#if defined(CONFIG_MSM_AVS_HW)
1451 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1452 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1453#endif
1454 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1455 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1456 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1457 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1458 .vctl_timeout_us = 50,
1459 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1460 .modes = msm_spm_seq_list,
1461 },
1462 [2] = {
1463 .reg_base_addr = MSM_SAW2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001464 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001465#if defined(CONFIG_MSM_AVS_HW)
1466 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1467 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1468#endif
1469 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1470 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1471 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1472 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1473 .vctl_timeout_us = 50,
1474 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1475 .modes = msm_spm_seq_list,
1476 },
1477 [3] = {
1478 .reg_base_addr = MSM_SAW3_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001479 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001480#if defined(CONFIG_MSM_AVS_HW)
1481 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1482 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1483#endif
1484 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1485 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1486 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1487 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1488 .vctl_timeout_us = 50,
1489 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1490 .modes = msm_spm_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001491 },
1492};
1493
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001494static void __init apq8064_init_buses(void)
1495{
1496 msm_bus_rpm_set_mt_mask();
1497 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
1498 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
1499 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
1500 msm_bus_8064_apps_fabric.dev.platform_data =
1501 &msm_bus_8064_apps_fabric_pdata;
1502 msm_bus_8064_sys_fabric.dev.platform_data =
1503 &msm_bus_8064_sys_fabric_pdata;
1504 msm_bus_8064_mm_fabric.dev.platform_data =
1505 &msm_bus_8064_mm_fabric_pdata;
1506 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
1507 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
1508}
1509
David Collinsf0d00732012-01-25 15:46:50 -08001510static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
1511 .name = GPIO_REGULATOR_DEV_NAME,
1512 .id = PM8921_MPP_PM_TO_SYS(7),
1513 .dev = {
1514 .platform_data
1515 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
1516 },
1517};
1518
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08001519static struct platform_device apq8064_device_ext_mpp8_vreg __devinitdata = {
1520 .name = GPIO_REGULATOR_DEV_NAME,
1521 .id = PM8921_MPP_PM_TO_SYS(8),
1522 .dev = {
1523 .platform_data
1524 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_MPP8],
1525 },
1526};
1527
David Collinsf0d00732012-01-25 15:46:50 -08001528static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
1529 .name = GPIO_REGULATOR_DEV_NAME,
1530 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
1531 .dev = {
1532 .platform_data =
1533 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
1534 },
1535};
1536
David Collins390fc332012-02-07 14:38:16 -08001537static struct platform_device apq8064_device_ext_ts_sw_vreg __devinitdata = {
1538 .name = GPIO_REGULATOR_DEV_NAME,
1539 .id = PM8921_GPIO_PM_TO_SYS(23),
1540 .dev = {
1541 .platform_data
1542 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_TS_SW],
1543 },
1544};
1545
David Collins2782b5c2012-02-06 10:02:42 -08001546static struct platform_device apq8064_device_rpm_regulator __devinitdata = {
1547 .name = "rpm-regulator",
1548 .id = -1,
1549 .dev = {
1550 .platform_data = &apq8064_rpm_regulator_pdata,
1551 },
1552};
1553
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001554static struct platform_device *common_devices[] __initdata = {
Jin Hong01f2dbb2011-11-03 22:13:51 -07001555 &apq8064_device_dmov,
David Keitel3c40fc52012-02-09 17:53:52 -08001556 &apq8064_device_qup_i2c_gsbi1,
Jing Lin04601f92012-02-05 15:36:07 -08001557 &apq8064_device_qup_i2c_gsbi3,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001558 &apq8064_device_qup_i2c_gsbi4,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001559 &apq8064_device_qup_spi_gsbi5,
David Collinsf0d00732012-01-25 15:46:50 -08001560 &apq8064_device_ext_5v_vreg,
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08001561 &apq8064_device_ext_mpp8_vreg,
David Collinsf0d00732012-01-25 15:46:50 -08001562 &apq8064_device_ext_3p3v_vreg,
David Collins390fc332012-02-07 14:38:16 -08001563 &apq8064_device_ext_ts_sw_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07001564 &apq8064_device_ssbi_pmic1,
1565 &apq8064_device_ssbi_pmic2,
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001566 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07001567 &apq8064_device_otg,
1568 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08001569 &apq8064_device_hsusb_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07001570 &android_usb_device,
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001571 &msm_device_wcnss_wlan,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001572#ifdef CONFIG_ANDROID_PMEM
1573#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -07001574 &android_pmem_device,
1575 &android_pmem_adsp_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001576#endif
Kevin Chan13be4e22011-10-20 11:30:32 -07001577 &android_pmem_audio_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001578#endif
1579#ifdef CONFIG_ION_MSM
1580 &ion_dev,
1581#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001582 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001583 &msm8064_device_saw_regulator_core0,
1584 &msm8064_device_saw_regulator_core1,
1585 &msm8064_device_saw_regulator_core2,
1586 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001587#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1588 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1589 &qcrypto_device,
1590#endif
1591
1592#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1593 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1594 &qcedev_device,
1595#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07001596
1597#ifdef CONFIG_HW_RANDOM_MSM
1598 &apq8064_device_rng,
1599#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08001600 &apq_pcm,
1601 &apq_pcm_routing,
1602 &apq_cpudai0,
1603 &apq_cpudai1,
1604 &apq_cpudai_hdmi_rx,
1605 &apq_cpudai_bt_rx,
1606 &apq_cpudai_bt_tx,
1607 &apq_cpudai_fm_rx,
1608 &apq_cpudai_fm_tx,
1609 &apq_cpu_fe,
1610 &apq_stub_codec,
1611 &apq_voice,
1612 &apq_voip,
1613 &apq_lpa_pcm,
1614 &apq_pcm_hostless,
1615 &apq_cpudai_afe_01_rx,
1616 &apq_cpudai_afe_01_tx,
1617 &apq_cpudai_afe_02_rx,
1618 &apq_cpudai_afe_02_tx,
1619 &apq_pcm_afe,
1620 &apq_cpudai_auxpcm_rx,
1621 &apq_cpudai_auxpcm_tx,
Neema Shetty8427c262012-02-16 11:23:43 -08001622 &apq_cpudai_stub,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001623 &apq8064_rpm_device,
1624 &apq8064_rpm_log_device,
1625 &apq8064_rpm_stat_device,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001626 &msm_bus_8064_apps_fabric,
1627 &msm_bus_8064_sys_fabric,
1628 &msm_bus_8064_mm_fabric,
1629 &msm_bus_8064_sys_fpb,
1630 &msm_bus_8064_cpss_fpb,
Mohan Kumar Gubbihalli Lachma Naik7f72edd2012-02-06 17:26:47 -08001631 &apq8064_msm_device_vidc,
Matt Wagantalled832652012-02-02 19:23:17 -08001632 &msm_8960_riva,
Matt Wagantallb94b9a52012-02-02 21:59:54 -08001633 &msm_8960_q6_lpass,
Matt Wagantall292aace2012-01-26 19:12:34 -08001634 &msm_gss,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001635};
1636
Joel King4e7ad222011-08-17 15:47:38 -07001637static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001638 &apq8064_device_uart_gsbi3,
Yan He06913ce2011-08-26 16:33:46 -07001639 &msm_device_sps_apq8064,
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001640};
1641
1642static struct platform_device *rumi3_devices[] __initdata = {
1643 &apq8064_device_uart_gsbi1,
Yan He435ed612011-11-23 17:34:59 -08001644 &msm_device_sps_apq8064,
Huaibin Yang4a084e32011-12-15 15:25:52 -08001645#ifdef CONFIG_MSM_ROTATOR
1646 &msm_rotator_device,
1647#endif
Joel King4e7ad222011-08-17 15:47:38 -07001648};
1649
Joel King82b7e3f2012-01-05 10:03:27 -08001650static struct platform_device *cdp_devices[] __initdata = {
1651 &apq8064_device_uart_gsbi1,
Jin Hong4bbbfba2012-02-02 21:48:07 -08001652 &apq8064_device_uart_gsbi7,
Joel King82b7e3f2012-01-05 10:03:27 -08001653 &msm_device_sps_apq8064,
1654};
1655
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001656static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08001657 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001658};
1659
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001660#define KS8851_IRQ_GPIO 43
1661
1662static struct spi_board_info spi_board_info[] __initdata = {
1663 {
1664 .modalias = "ks8851",
1665 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1666 .max_speed_hz = 19200000,
1667 .bus_num = 0,
1668 .chip_select = 2,
1669 .mode = SPI_MODE_0,
1670 },
1671};
1672
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001673static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001674 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001675 .bus_num = 1,
1676 .slim_slave = &apq8064_slim_tabla,
1677 },
1678 {
1679 .bus_num = 1,
1680 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001681 },
1682 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001683};
1684
David Keitel3c40fc52012-02-09 17:53:52 -08001685static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi1_pdata = {
1686 .clk_freq = 100000,
1687 .src_clk_rate = 24000000,
1688};
1689
Jing Lin04601f92012-02-05 15:36:07 -08001690static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi3_pdata = {
1691 .clk_freq = 100000,
1692 .src_clk_rate = 24000000,
1693};
1694
Kenneth Heitke748593a2011-07-15 15:45:11 -06001695static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
1696 .clk_freq = 100000,
1697 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001698};
1699
David Keitel3c40fc52012-02-09 17:53:52 -08001700#define GSBI_DUAL_MODE_CODE 0x60
1701#define MSM_GSBI1_PHYS 0x12440000
Kenneth Heitke748593a2011-07-15 15:45:11 -06001702static void __init apq8064_i2c_init(void)
1703{
David Keitel3c40fc52012-02-09 17:53:52 -08001704 void __iomem *gsbi_mem;
1705
1706 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
1707 &apq8064_i2c_qup_gsbi1_pdata;
1708 gsbi_mem = ioremap_nocache(MSM_GSBI1_PHYS, 4);
1709 writel_relaxed(GSBI_DUAL_MODE_CODE, gsbi_mem);
1710 /* Ensure protocol code is written before proceeding */
1711 wmb();
1712 iounmap(gsbi_mem);
1713 apq8064_i2c_qup_gsbi1_pdata.use_gsbi_shared_mode = 1;
Jing Lin04601f92012-02-05 15:36:07 -08001714 apq8064_device_qup_i2c_gsbi3.dev.platform_data =
1715 &apq8064_i2c_qup_gsbi3_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06001716 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
1717 &apq8064_i2c_qup_gsbi4_pdata;
1718}
1719
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08001720#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001721static int ethernet_init(void)
1722{
1723 int ret;
1724 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
1725 if (ret) {
1726 pr_err("ks8851 gpio_request failed: %d\n", ret);
1727 goto fail;
1728 }
1729
1730 return 0;
1731fail:
1732 return ret;
1733}
1734#else
1735static int ethernet_init(void)
1736{
1737 return 0;
1738}
1739#endif
1740
Mohan Pallaka474b94b2012-01-25 12:59:58 +05301741#define GPIO_KEY_HOME PM8921_GPIO_PM_TO_SYS(27)
1742#define GPIO_KEY_VOLUME_UP PM8921_GPIO_PM_TO_SYS(35)
1743#define GPIO_KEY_VOLUME_DOWN PM8921_GPIO_PM_TO_SYS(38)
1744#define GPIO_KEY_CAM_FOCUS PM8921_GPIO_PM_TO_SYS(3)
1745#define GPIO_KEY_CAM_SNAP PM8921_GPIO_PM_TO_SYS(4)
1746#define GPIO_KEY_ROTATION 46
1747
1748static struct gpio_keys_button cdp_keys[] = {
1749 {
1750 .code = KEY_HOME,
1751 .gpio = GPIO_KEY_HOME,
1752 .desc = "home_key",
1753 .active_low = 1,
1754 .type = EV_KEY,
1755 .wakeup = 1,
1756 .debounce_interval = 15,
1757 },
1758 {
1759 .code = KEY_VOLUMEUP,
1760 .gpio = GPIO_KEY_VOLUME_UP,
1761 .desc = "volume_up_key",
1762 .active_low = 1,
1763 .type = EV_KEY,
1764 .wakeup = 1,
1765 .debounce_interval = 15,
1766 },
1767 {
1768 .code = KEY_VOLUMEDOWN,
1769 .gpio = GPIO_KEY_VOLUME_DOWN,
1770 .desc = "volume_down_key",
1771 .active_low = 1,
1772 .type = EV_KEY,
1773 .wakeup = 1,
1774 .debounce_interval = 15,
1775 },
1776 {
1777 .code = SW_ROTATE_LOCK,
1778 .gpio = GPIO_KEY_ROTATION,
1779 .desc = "rotate_key",
1780 .active_low = 1,
1781 .type = EV_SW,
1782 .debounce_interval = 15,
1783 },
1784};
1785
1786static struct gpio_keys_platform_data cdp_keys_data = {
1787 .buttons = cdp_keys,
1788 .nbuttons = ARRAY_SIZE(cdp_keys),
1789};
1790
1791static struct platform_device cdp_kp_pdev = {
1792 .name = "gpio-keys",
1793 .id = -1,
1794 .dev = {
1795 .platform_data = &cdp_keys_data,
1796 },
1797};
1798
1799static struct gpio_keys_button mtp_keys[] = {
1800 {
1801 .code = KEY_CAMERA_FOCUS,
1802 .gpio = GPIO_KEY_CAM_FOCUS,
1803 .desc = "cam_focus_key",
1804 .active_low = 1,
1805 .type = EV_KEY,
1806 .wakeup = 1,
1807 .debounce_interval = 15,
1808 },
1809 {
1810 .code = KEY_VOLUMEUP,
1811 .gpio = GPIO_KEY_VOLUME_UP,
1812 .desc = "volume_up_key",
1813 .active_low = 1,
1814 .type = EV_KEY,
1815 .wakeup = 1,
1816 .debounce_interval = 15,
1817 },
1818 {
1819 .code = KEY_VOLUMEDOWN,
1820 .gpio = GPIO_KEY_VOLUME_DOWN,
1821 .desc = "volume_down_key",
1822 .active_low = 1,
1823 .type = EV_KEY,
1824 .wakeup = 1,
1825 .debounce_interval = 15,
1826 },
1827 {
1828 .code = KEY_CAMERA_SNAPSHOT,
1829 .gpio = GPIO_KEY_CAM_SNAP,
1830 .desc = "cam_snap_key",
1831 .active_low = 1,
1832 .type = EV_KEY,
1833 .debounce_interval = 15,
1834 },
1835};
1836
1837static struct gpio_keys_platform_data mtp_keys_data = {
1838 .buttons = mtp_keys,
1839 .nbuttons = ARRAY_SIZE(mtp_keys),
1840};
1841
1842static struct platform_device mtp_kp_pdev = {
1843 .name = "gpio-keys",
1844 .id = -1,
1845 .dev = {
1846 .platform_data = &mtp_keys_data,
1847 },
1848};
1849
1850
Tianyi Gou41515e22011-09-01 19:37:43 -07001851static void __init apq8064_clock_init(void)
1852{
Tianyi Gouacb588d2012-01-27 18:24:05 -08001853 if (machine_is_apq8064_rumi3())
Tianyi Gou41515e22011-09-01 19:37:43 -07001854 msm_clock_init(&apq8064_dummy_clock_init_data);
Tianyi Gouacb588d2012-01-27 18:24:05 -08001855 else
1856 msm_clock_init(&apq8064_clock_init_data);
Tianyi Gou41515e22011-09-01 19:37:43 -07001857}
1858
Jing Lin417fa452012-02-05 14:31:06 -08001859#define I2C_SURF 1
1860#define I2C_FFA (1 << 1)
1861#define I2C_RUMI (1 << 2)
1862#define I2C_SIM (1 << 3)
1863#define I2C_LIQUID (1 << 4)
1864
1865struct i2c_registry {
1866 u8 machs;
1867 int bus;
1868 struct i2c_board_info *info;
1869 int len;
1870};
1871
1872static struct i2c_registry apq8064_i2c_devices[] __initdata = {
Jing Lin21ed4de2012-02-05 15:53:28 -08001873 {
1874 I2C_SURF | I2C_LIQUID,
1875 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
1876 mxt_device_info,
1877 ARRAY_SIZE(mxt_device_info),
1878 },
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001879 {
1880 I2C_FFA,
1881 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
1882 cyttsp_info,
1883 ARRAY_SIZE(cyttsp_info),
1884 },
Amy Maloche70090f992012-02-16 16:35:26 -08001885 {
1886 I2C_FFA | I2C_LIQUID,
1887 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
1888 isa1200_board_info,
1889 ARRAY_SIZE(isa1200_board_info),
1890 },
Jing Lin417fa452012-02-05 14:31:06 -08001891};
1892
1893static void __init register_i2c_devices(void)
1894{
1895 u8 mach_mask = 0;
1896 int i;
1897
Kevin Chand07220e2012-02-13 15:52:22 -08001898#ifdef CONFIG_MSM_CAMERA
1899 struct i2c_registry apq8064_camera_i2c_devices = {
1900 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_RUMI,
1901 APQ_8064_GSBI4_QUP_I2C_BUS_ID,
1902 apq8064_camera_board_info.board_info,
1903 apq8064_camera_board_info.num_i2c_board_info,
1904 };
1905#endif
Jing Lin417fa452012-02-05 14:31:06 -08001906 /* Build the matching 'supported_machs' bitmask */
1907 if (machine_is_apq8064_cdp())
1908 mach_mask = I2C_SURF;
1909 else if (machine_is_apq8064_mtp())
1910 mach_mask = I2C_FFA;
1911 else if (machine_is_apq8064_liquid())
1912 mach_mask = I2C_LIQUID;
1913 else if (machine_is_apq8064_rumi3())
1914 mach_mask = I2C_RUMI;
1915 else if (machine_is_apq8064_sim())
1916 mach_mask = I2C_SIM;
1917 else
1918 pr_err("unmatched machine ID in register_i2c_devices\n");
1919
1920 /* Run the array and install devices as appropriate */
1921 for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) {
1922 if (apq8064_i2c_devices[i].machs & mach_mask)
1923 i2c_register_board_info(apq8064_i2c_devices[i].bus,
1924 apq8064_i2c_devices[i].info,
1925 apq8064_i2c_devices[i].len);
1926 }
Kevin Chand07220e2012-02-13 15:52:22 -08001927#ifdef CONFIG_MSM_CAMERA
1928 if (apq8064_camera_i2c_devices.machs & mach_mask)
1929 i2c_register_board_info(apq8064_camera_i2c_devices.bus,
1930 apq8064_camera_i2c_devices.info,
1931 apq8064_camera_i2c_devices.len);
1932#endif
Jing Lin417fa452012-02-05 14:31:06 -08001933}
1934
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001935static void __init apq8064_common_init(void)
1936{
1937 if (socinfo_init() < 0)
1938 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06001939 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
1940 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
David Collins2782b5c2012-02-06 10:02:42 -08001941 regulator_suppress_info_printing();
1942 platform_device_register(&apq8064_device_rpm_regulator);
Stephen Boyd4d0d2582012-02-10 14:49:40 -08001943 if (msm_xo_init())
1944 pr_err("Failed to initialize XO votes\n");
Tianyi Gou41515e22011-09-01 19:37:43 -07001945 apq8064_clock_init();
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08001946 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06001947 apq8064_i2c_init();
Jing Lin417fa452012-02-05 14:31:06 -08001948 register_i2c_devices();
Kenneth Heitke36920d32011-07-20 16:44:30 -06001949
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001950 apq8064_device_qup_spi_gsbi5.dev.platform_data =
1951 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08001952 apq8064_init_pmic();
Hemant Kumar94e7da22012-02-03 16:52:29 -08001953 if (machine_is_apq8064_liquid())
1954 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001955 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Manu Gautam91223e02011-11-08 15:27:22 +05301956 apq8064_ehci_host_init();
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001957 apq8064_init_buses();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001958 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Hemant Kumarf1ca9192012-02-07 18:59:33 -08001959 if (machine_is_apq8064_mtp()) {
1960 apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
1961 device_initialize(&apq8064_device_hsic_host.dev);
1962 }
Jay Chokshie8741282012-01-25 15:22:55 -08001963 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05301964 apq8064_init_mmc();
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08001965
1966 if (machine_is_apq8064_mtp()) {
1967 mdm_8064_device.dev.platform_data = &mdm_platform_data;
1968 platform_device_register(&mdm_8064_device);
1969 }
1970 platform_device_register(&apq8064_slim_ctrl);
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001971 slim_register_board_info(apq8064_slim_devices,
1972 ARRAY_SIZE(apq8064_slim_devices));
Praveen Chidambaram78499012011-11-01 17:15:17 -06001973 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Mahesh Sivasubramaniancbce1ec2012-01-24 10:32:44 -07001974 acpuclk_init(&acpuclk_8064_soc_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06001975 msm_spm_l2_init(msm_spm_l2_data);
1976 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
1977 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
1978 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
1979 msm_pm_data);
1980 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001981}
1982
Huaibin Yang4a084e32011-12-15 15:25:52 -08001983static void __init apq8064_allocate_memory_regions(void)
1984{
1985 apq8064_allocate_fb_region();
1986}
1987
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001988static void __init apq8064_sim_init(void)
1989{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001990 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
1991 &msm8064_device_watchdog.dev.platform_data;
1992
1993 wdog_pdata->bark_time = 15000;
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001994 msm_tsens_early_init(&apq_tsens_pdata);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001995 apq8064_common_init();
Joel King4e7ad222011-08-17 15:47:38 -07001996 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
1997}
1998
1999static void __init apq8064_rumi3_init(void)
2000{
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002001 msm_tsens_early_init(&apq_tsens_pdata);
Joel King4e7ad222011-08-17 15:47:38 -07002002 apq8064_common_init();
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002003 ethernet_init();
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002004 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002005 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Huaibin Yang4a084e32011-12-15 15:25:52 -08002006 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07002007 apq8064_init_gpu();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002008}
2009
Joel King82b7e3f2012-01-05 10:03:27 -08002010static void __init apq8064_cdp_init(void)
2011{
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002012 msm_tsens_early_init(&apq_tsens_pdata);
Joel King82b7e3f2012-01-05 10:03:27 -08002013 apq8064_common_init();
2014 ethernet_init();
2015 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
2016 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002017 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07002018 apq8064_init_gpu();
Matt Wagantall1875d322012-02-22 16:11:33 -08002019 platform_add_devices(apq8064_fs_devices, apq8064_num_fs_devices);
Kevin Chand07220e2012-02-13 15:52:22 -08002020 apq8064_init_cam();
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302021
2022 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
2023 platform_device_register(&cdp_kp_pdev);
2024
2025 if (machine_is_apq8064_mtp())
2026 platform_device_register(&mtp_kp_pdev);
Joel King82b7e3f2012-01-05 10:03:27 -08002027}
2028
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002029MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
2030 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002031 .reserve = apq8064_reserve,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002032 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302033 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002034 .timer = &msm_timer,
2035 .init_machine = apq8064_sim_init,
2036MACHINE_END
2037
Joel King4e7ad222011-08-17 15:47:38 -07002038MACHINE_START(APQ8064_RUMI3, "QCT APQ8064 RUMI3")
2039 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002040 .reserve = apq8064_reserve,
Joel King4e7ad222011-08-17 15:47:38 -07002041 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302042 .handle_irq = gic_handle_irq,
Joel King4e7ad222011-08-17 15:47:38 -07002043 .timer = &msm_timer,
2044 .init_machine = apq8064_rumi3_init,
Huaibin Yang4a084e32011-12-15 15:25:52 -08002045 .init_early = apq8064_allocate_memory_regions,
Joel King4e7ad222011-08-17 15:47:38 -07002046MACHINE_END
2047
Joel King82b7e3f2012-01-05 10:03:27 -08002048MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
2049 .map_io = apq8064_map_io,
2050 .reserve = apq8064_reserve,
2051 .init_irq = apq8064_init_irq,
2052 .handle_irq = gic_handle_irq,
2053 .timer = &msm_timer,
2054 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002055 .init_early = apq8064_allocate_memory_regions,
Joel King82b7e3f2012-01-05 10:03:27 -08002056MACHINE_END
2057
2058MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
2059 .map_io = apq8064_map_io,
2060 .reserve = apq8064_reserve,
2061 .init_irq = apq8064_init_irq,
2062 .handle_irq = gic_handle_irq,
2063 .timer = &msm_timer,
2064 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002065 .init_early = apq8064_allocate_memory_regions,
Joel King82b7e3f2012-01-05 10:03:27 -08002066MACHINE_END
2067
2068MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
2069 .map_io = apq8064_map_io,
2070 .reserve = apq8064_reserve,
2071 .init_irq = apq8064_init_irq,
2072 .handle_irq = gic_handle_irq,
2073 .timer = &msm_timer,
2074 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002075 .init_early = apq8064_allocate_memory_regions,
Joel King82b7e3f2012-01-05 10:03:27 -08002076MACHINE_END
2077
Joel King11ca8202012-02-13 16:19:03 -08002078MACHINE_START(MPQ8064_HRD, "QCT MPQ8064 HRD")
2079 .map_io = apq8064_map_io,
2080 .reserve = apq8064_reserve,
2081 .init_irq = apq8064_init_irq,
2082 .handle_irq = gic_handle_irq,
2083 .timer = &msm_timer,
2084 .init_machine = apq8064_cdp_init,
2085MACHINE_END
2086
2087MACHINE_START(MPQ8064_DTV, "QCT MPQ8064 DTV")
2088 .map_io = apq8064_map_io,
2089 .reserve = apq8064_reserve,
2090 .init_irq = apq8064_init_irq,
2091 .handle_irq = gic_handle_irq,
2092 .timer = &msm_timer,
2093 .init_machine = apq8064_cdp_init,
2094MACHINE_END
2095