blob: 38482624284aad5ef6d42852d87edc14b1eacdd4 [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>
Joel King4ebccc62011-07-22 09:43:22 -070061
Jeff Ohlstein7e668552011-10-06 16:17:25 -070062#include "msm_watchdog.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080063#include "board-8064.h"
Vikram Mulukutlabc2e9572011-11-04 03:41:38 -070064#include "acpuclock.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060065#include "spm.h"
66#include "mpm.h"
67#include "rpm_resources.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080068#include "pm.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060069#include "pm-boot.h"
Rajesh Sastrulaaee8af32012-01-20 11:46:31 -080070#include "devices-msm8x60.h"
Jay Chokshiea67c622011-07-29 17:12:26 -070071
Olav Haugan7c6aa742012-01-16 16:47:37 -080072#define MSM_PMEM_ADSP_SIZE 0x7800000
Ben Romberger3ffcd812011-12-08 19:12:10 -080073#define MSM_PMEM_AUDIO_SIZE 0x2B4000
Olav Haugan7c6aa742012-01-16 16:47:37 -080074#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
75#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
76#else
77#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
78#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070079
Olav Haugan7c6aa742012-01-16 16:47:37 -080080#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Olav Hauganedcf6832012-01-24 08:35:41 -080081#define MSM_PMEM_KERNEL_EBI1_SIZE 0x280000
Olav Haugan7c6aa742012-01-16 16:47:37 -080082#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Haugand3d29682012-01-19 10:57:07 -080083#define MSM_ION_MM_FW_SIZE 0x200000 /* (2MB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -080084#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Haugan3a9bd232012-02-15 14:23:27 -080085#define MSM_ION_QSECOM_SIZE 0x300000 /* (3MB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -080086#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan2c43fac2012-01-19 11:06:37 -080087#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
88#define MSM_ION_HEAP_NUM 8
Olav Haugan7c6aa742012-01-16 16:47:37 -080089#else
90#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
91#define MSM_ION_HEAP_NUM 1
92#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070093
Olav Haugan7c6aa742012-01-16 16:47:37 -080094#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
95static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
96static int __init pmem_kernel_ebi1_size_setup(char *p)
Kevin Chan13be4e22011-10-20 11:30:32 -070097{
Olav Haugan7c6aa742012-01-16 16:47:37 -080098 pmem_kernel_ebi1_size = memparse(p, NULL);
99 return 0;
Kevin Chan13be4e22011-10-20 11:30:32 -0700100}
Olav Haugan7c6aa742012-01-16 16:47:37 -0800101early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
102#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700103
Olav Haugan7c6aa742012-01-16 16:47:37 -0800104#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -0700105static unsigned pmem_size = MSM_PMEM_SIZE;
106static int __init pmem_size_setup(char *p)
107{
108 pmem_size = memparse(p, NULL);
109 return 0;
110}
111early_param("pmem_size", pmem_size_setup);
112
113static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
114
115static int __init pmem_adsp_size_setup(char *p)
116{
117 pmem_adsp_size = memparse(p, NULL);
118 return 0;
119}
120early_param("pmem_adsp_size", pmem_adsp_size_setup);
121
122static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
123
124static int __init pmem_audio_size_setup(char *p)
125{
126 pmem_audio_size = memparse(p, NULL);
127 return 0;
128}
129early_param("pmem_audio_size", pmem_audio_size_setup);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800130#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700131
Olav Haugan7c6aa742012-01-16 16:47:37 -0800132#ifdef CONFIG_ANDROID_PMEM
133#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700134static struct android_pmem_platform_data android_pmem_pdata = {
135 .name = "pmem",
136 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
137 .cached = 1,
138 .memory_type = MEMTYPE_EBI1,
139};
140
141static struct platform_device android_pmem_device = {
142 .name = "android_pmem",
143 .id = 0,
144 .dev = {.platform_data = &android_pmem_pdata},
145};
146
147static struct android_pmem_platform_data android_pmem_adsp_pdata = {
148 .name = "pmem_adsp",
149 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
150 .cached = 0,
151 .memory_type = MEMTYPE_EBI1,
152};
Kevin Chan13be4e22011-10-20 11:30:32 -0700153static struct platform_device android_pmem_adsp_device = {
154 .name = "android_pmem",
155 .id = 2,
156 .dev = { .platform_data = &android_pmem_adsp_pdata },
157};
Olav Haugan7c6aa742012-01-16 16:47:37 -0800158#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700159
160static struct android_pmem_platform_data android_pmem_audio_pdata = {
161 .name = "pmem_audio",
162 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
163 .cached = 0,
164 .memory_type = MEMTYPE_EBI1,
165};
166
167static struct platform_device android_pmem_audio_device = {
168 .name = "android_pmem",
169 .id = 4,
170 .dev = { .platform_data = &android_pmem_audio_pdata },
171};
Olav Haugan7c6aa742012-01-16 16:47:37 -0800172#endif
173
174static struct memtype_reserve apq8064_reserve_table[] __initdata = {
175 [MEMTYPE_SMI] = {
176 },
177 [MEMTYPE_EBI0] = {
178 .flags = MEMTYPE_FLAGS_1M_ALIGN,
179 },
180 [MEMTYPE_EBI1] = {
181 .flags = MEMTYPE_FLAGS_1M_ALIGN,
182 },
183};
Kevin Chan13be4e22011-10-20 11:30:32 -0700184
185static void __init size_pmem_devices(void)
186{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800187#ifdef CONFIG_ANDROID_PMEM
188#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700189 android_pmem_adsp_pdata.size = pmem_adsp_size;
190 android_pmem_pdata.size = pmem_size;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800191#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700192 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800193#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700194}
195
196static void __init reserve_memory_for(struct android_pmem_platform_data *p)
197{
198 apq8064_reserve_table[p->memory_type].size += p->size;
199}
200
Kevin Chan13be4e22011-10-20 11:30:32 -0700201static void __init reserve_pmem_memory(void)
202{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800203#ifdef CONFIG_ANDROID_PMEM
204#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700205 reserve_memory_for(&android_pmem_adsp_pdata);
206 reserve_memory_for(&android_pmem_pdata);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800207#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700208 reserve_memory_for(&android_pmem_audio_pdata);
209 apq8064_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800210#endif
211}
212
213static int apq8064_paddr_to_memtype(unsigned int paddr)
214{
215 return MEMTYPE_EBI1;
216}
217
218#ifdef CONFIG_ION_MSM
219#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
220static struct ion_cp_heap_pdata cp_mm_ion_pdata = {
221 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugand3d29682012-01-19 10:57:07 -0800222 .align = PAGE_SIZE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800223};
224
225static struct ion_cp_heap_pdata cp_mfc_ion_pdata = {
226 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugand3d29682012-01-19 10:57:07 -0800227 .align = PAGE_SIZE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800228};
229
230static struct ion_co_heap_pdata co_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800231 .adjacent_mem_id = INVALID_HEAP_ID,
232 .align = PAGE_SIZE,
233};
234
235static struct ion_co_heap_pdata fw_co_ion_pdata = {
236 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
237 .align = SZ_128K,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800238};
239#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800240
241/**
242 * These heaps are listed in the order they will be allocated. Due to
243 * video hardware restrictions and content protection the FW heap has to
244 * be allocated adjacent (below) the MM heap and the MFC heap has to be
245 * allocated after the MM heap to ensure MFC heap is not more than 256MB
246 * away from the base address of the FW heap.
247 * However, the order of FW heap and MM heap doesn't matter since these
248 * two heaps are taken care of by separate code to ensure they are adjacent
249 * to each other.
250 * Don't swap the order unless you know what you are doing!
251 */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800252static struct ion_platform_data ion_pdata = {
253 .nr = MSM_ION_HEAP_NUM,
254 .heaps = {
255 {
256 .id = ION_SYSTEM_HEAP_ID,
257 .type = ION_HEAP_TYPE_SYSTEM,
258 .name = ION_VMALLOC_HEAP_NAME,
259 },
260#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
261 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800262 .id = ION_CP_MM_HEAP_ID,
263 .type = ION_HEAP_TYPE_CP,
264 .name = ION_MM_HEAP_NAME,
265 .size = MSM_ION_MM_SIZE,
266 .memory_type = ION_EBI_TYPE,
267 .extra_data = (void *) &cp_mm_ion_pdata,
268 },
269 {
Olav Haugand3d29682012-01-19 10:57:07 -0800270 .id = ION_MM_FIRMWARE_HEAP_ID,
271 .type = ION_HEAP_TYPE_CARVEOUT,
272 .name = ION_MM_FIRMWARE_HEAP_NAME,
273 .size = MSM_ION_MM_FW_SIZE,
274 .memory_type = ION_EBI_TYPE,
275 .extra_data = (void *) &fw_co_ion_pdata,
276 },
277 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800278 .id = ION_CP_MFC_HEAP_ID,
279 .type = ION_HEAP_TYPE_CP,
280 .name = ION_MFC_HEAP_NAME,
281 .size = MSM_ION_MFC_SIZE,
282 .memory_type = ION_EBI_TYPE,
283 .extra_data = (void *) &cp_mfc_ion_pdata,
284 },
285 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800286 .id = ION_SF_HEAP_ID,
287 .type = ION_HEAP_TYPE_CARVEOUT,
288 .name = ION_SF_HEAP_NAME,
289 .size = MSM_ION_SF_SIZE,
290 .memory_type = ION_EBI_TYPE,
291 .extra_data = (void *) &co_ion_pdata,
292 },
293 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800294 .id = ION_IOMMU_HEAP_ID,
295 .type = ION_HEAP_TYPE_IOMMU,
296 .name = ION_IOMMU_HEAP_NAME,
297 },
Olav Hauganf45e2142012-01-19 11:01:01 -0800298 {
299 .id = ION_QSECOM_HEAP_ID,
300 .type = ION_HEAP_TYPE_CARVEOUT,
301 .name = ION_QSECOM_HEAP_NAME,
302 .size = MSM_ION_QSECOM_SIZE,
303 .memory_type = ION_EBI_TYPE,
304 .extra_data = (void *) &co_ion_pdata,
305 },
Olav Haugan2c43fac2012-01-19 11:06:37 -0800306 {
307 .id = ION_AUDIO_HEAP_ID,
308 .type = ION_HEAP_TYPE_CARVEOUT,
309 .name = ION_AUDIO_HEAP_NAME,
310 .size = MSM_ION_AUDIO_SIZE,
311 .memory_type = ION_EBI_TYPE,
312 .extra_data = (void *) &co_ion_pdata,
313 },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800314#endif
315 }
316};
317
318static struct platform_device ion_dev = {
319 .name = "ion-msm",
320 .id = 1,
321 .dev = { .platform_data = &ion_pdata },
322};
323#endif
324
325static void reserve_ion_memory(void)
326{
327#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
328 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_SIZE;
Olav Haugand3d29682012-01-19 10:57:07 -0800329 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_FW_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800330 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_SF_SIZE;
331 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MFC_SIZE;
Olav Hauganf45e2142012-01-19 11:01:01 -0800332 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_QSECOM_SIZE;
Olav Haugan2c43fac2012-01-19 11:06:37 -0800333 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_AUDIO_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800334#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700335}
336
Huaibin Yang4a084e32011-12-15 15:25:52 -0800337static void __init reserve_mdp_memory(void)
338{
339 apq8064_mdp_writeback(apq8064_reserve_table);
340}
341
Kevin Chan13be4e22011-10-20 11:30:32 -0700342static void __init apq8064_calculate_reserve_sizes(void)
343{
344 size_pmem_devices();
345 reserve_pmem_memory();
Olav Haugan7c6aa742012-01-16 16:47:37 -0800346 reserve_ion_memory();
Huaibin Yang4a084e32011-12-15 15:25:52 -0800347 reserve_mdp_memory();
Kevin Chan13be4e22011-10-20 11:30:32 -0700348}
349
350static struct reserve_info apq8064_reserve_info __initdata = {
351 .memtype_reserve_table = apq8064_reserve_table,
352 .calculate_reserve_sizes = apq8064_calculate_reserve_sizes,
353 .paddr_to_memtype = apq8064_paddr_to_memtype,
354};
355
356static int apq8064_memory_bank_size(void)
357{
358 return 1<<29;
359}
360
361static void __init locate_unstable_memory(void)
362{
363 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
364 unsigned long bank_size;
365 unsigned long low, high;
366
367 bank_size = apq8064_memory_bank_size();
368 low = meminfo.bank[0].start;
369 high = mb->start + mb->size;
Olav Haugand76e3a82012-01-16 16:55:07 -0800370
371 /* Check if 32 bit overflow occured */
372 if (high < mb->start)
373 high = ~0UL;
374
Kevin Chan13be4e22011-10-20 11:30:32 -0700375 low &= ~(bank_size - 1);
376
377 if (high - low <= bank_size)
378 return;
Jack Cheung46bfffa2012-01-19 15:26:24 -0800379 apq8064_reserve_info.low_unstable_address = mb->start -
380 MIN_MEMORY_BLOCK_SIZE + mb->size;
381 apq8064_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
382
Kevin Chan13be4e22011-10-20 11:30:32 -0700383 apq8064_reserve_info.bank_size = bank_size;
384 pr_info("low unstable address %lx max size %lx bank size %lx\n",
385 apq8064_reserve_info.low_unstable_address,
386 apq8064_reserve_info.max_unstable_size,
387 apq8064_reserve_info.bank_size);
388}
389
390static void __init apq8064_reserve(void)
391{
392 reserve_info = &apq8064_reserve_info;
393 locate_unstable_memory();
394 msm_reserve();
395}
396
Hemant Kumara945b472012-01-25 15:08:06 -0800397#ifdef CONFIG_USB_EHCI_MSM_HSIC
398static struct msm_hsic_host_platform_data msm_hsic_pdata = {
399 .strobe = 88,
400 .data = 89,
401};
402#else
403static struct msm_hsic_host_platform_data msm_hsic_pdata;
404#endif
405
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800406#define PID_MAGIC_ID 0x71432909
407#define SERIAL_NUM_MAGIC_ID 0x61945374
408#define SERIAL_NUMBER_LENGTH 127
409#define DLOAD_USB_BASE_ADD 0x2A03F0C8
410
411struct magic_num_struct {
412 uint32_t pid;
413 uint32_t serial_num;
414};
415
416struct dload_struct {
417 uint32_t reserved1;
418 uint32_t reserved2;
419 uint32_t reserved3;
420 uint16_t reserved4;
421 uint16_t pid;
422 char serial_number[SERIAL_NUMBER_LENGTH];
423 uint16_t reserved5;
424 struct magic_num_struct magic_struct;
425};
426
427static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
428{
429 struct dload_struct __iomem *dload = 0;
430
431 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
432 if (!dload) {
433 pr_err("%s: cannot remap I/O memory region: %08x\n",
434 __func__, DLOAD_USB_BASE_ADD);
435 return -ENXIO;
436 }
437
438 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
439 __func__, dload, pid, snum);
440 /* update pid */
441 dload->magic_struct.pid = PID_MAGIC_ID;
442 dload->pid = pid;
443
444 /* update serial number */
445 dload->magic_struct.serial_num = 0;
446 if (!snum) {
447 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
448 goto out;
449 }
450
451 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
452 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
453out:
454 iounmap(dload);
455 return 0;
456}
457
458static struct android_usb_platform_data android_usb_pdata = {
459 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
460};
461
Hemant Kumar4933b072011-10-17 23:43:11 -0700462static struct platform_device android_usb_device = {
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800463 .name = "android_usb",
464 .id = -1,
465 .dev = {
466 .platform_data = &android_usb_pdata,
467 },
Hemant Kumar4933b072011-10-17 23:43:11 -0700468};
469
470static struct msm_otg_platform_data msm_otg_pdata = {
Hemant Kumard86c4882012-01-24 19:39:37 -0800471 .mode = USB_OTG,
472 .otg_control = OTG_PMIC_CONTROL,
Hemant Kumar4933b072011-10-17 23:43:11 -0700473 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Hemant Kumard86c4882012-01-24 19:39:37 -0800474 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
475 .power_budget = 750,
Hemant Kumar4933b072011-10-17 23:43:11 -0700476};
477
Manu Gautam91223e02011-11-08 15:27:22 +0530478static struct msm_usb_host_platform_data msm_ehci_host_pdata = {
479 .power_budget = 500,
480};
481
482static void __init apq8064_ehci_host_init(void)
483{
484 if (machine_is_apq8064_liquid()) {
485 apq8064_device_ehci_host3.dev.platform_data =
486 &msm_ehci_host_pdata;
487 platform_device_register(&apq8064_device_ehci_host3);
488 }
489}
490
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800491#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
492
493/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
494 * 4 micbiases are used to power various analog and digital
495 * microphones operating at 1800 mV. Technically, all micbiases
496 * can source from single cfilter since all microphones operate
497 * at the same voltage level. The arrangement below is to make
498 * sure all cfilters are exercised. LDO_H regulator ouput level
499 * does not need to be as high as 2.85V. It is choosen for
500 * microphone sensitivity purpose.
501 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530502static struct wcd9xxx_pdata apq8064_tabla_platform_data = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800503 .slimbus_slave_device = {
504 .name = "tabla-slave",
505 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
506 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800507 .irq = MSM_GPIO_TO_INT(42),
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800508 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530509 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800510 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
511 .micbias = {
512 .ldoh_v = TABLA_LDOH_2P85_V,
513 .cfilt1_mv = 1800,
514 .cfilt2_mv = 1800,
515 .cfilt3_mv = 1800,
516 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
517 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
518 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
519 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530520 },
521 .regulator = {
522 {
523 .name = "CDC_VDD_CP",
524 .min_uV = 1800000,
525 .max_uV = 1800000,
526 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
527 },
528 {
529 .name = "CDC_VDDA_RX",
530 .min_uV = 1800000,
531 .max_uV = 1800000,
532 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
533 },
534 {
535 .name = "CDC_VDDA_TX",
536 .min_uV = 1800000,
537 .max_uV = 1800000,
538 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
539 },
540 {
541 .name = "VDDIO_CDC",
542 .min_uV = 1800000,
543 .max_uV = 1800000,
544 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
545 },
546 {
547 .name = "VDDD_CDC_D",
548 .min_uV = 1225000,
549 .max_uV = 1225000,
550 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
551 },
552 {
553 .name = "CDC_VDDA_A_1P2V",
554 .min_uV = 1225000,
555 .max_uV = 1225000,
556 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
557 },
558 },
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800559};
560
561static struct slim_device apq8064_slim_tabla = {
562 .name = "tabla-slim",
563 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
564 .dev = {
565 .platform_data = &apq8064_tabla_platform_data,
566 },
567};
568
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530569static struct wcd9xxx_pdata apq8064_tabla20_platform_data = {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800570 .slimbus_slave_device = {
571 .name = "tabla-slave",
572 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
573 },
574 .irq = MSM_GPIO_TO_INT(42),
575 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530576 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800577 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
578 .micbias = {
579 .ldoh_v = TABLA_LDOH_2P85_V,
580 .cfilt1_mv = 1800,
581 .cfilt2_mv = 1800,
582 .cfilt3_mv = 1800,
583 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
584 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
585 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
586 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530587 },
588 .regulator = {
589 {
590 .name = "CDC_VDD_CP",
591 .min_uV = 1800000,
592 .max_uV = 1800000,
593 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
594 },
595 {
596 .name = "CDC_VDDA_RX",
597 .min_uV = 1800000,
598 .max_uV = 1800000,
599 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
600 },
601 {
602 .name = "CDC_VDDA_TX",
603 .min_uV = 1800000,
604 .max_uV = 1800000,
605 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
606 },
607 {
608 .name = "VDDIO_CDC",
609 .min_uV = 1800000,
610 .max_uV = 1800000,
611 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
612 },
613 {
614 .name = "VDDD_CDC_D",
615 .min_uV = 1225000,
616 .max_uV = 1225000,
617 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
618 },
619 {
620 .name = "CDC_VDDA_A_1P2V",
621 .min_uV = 1225000,
622 .max_uV = 1225000,
623 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
624 },
625 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800626};
627
628static struct slim_device apq8064_slim_tabla20 = {
629 .name = "tabla2x-slim",
630 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
631 .dev = {
632 .platform_data = &apq8064_tabla20_platform_data,
633 },
634};
635
Amy Maloche70090f992012-02-16 16:35:26 -0800636#define HAP_SHIFT_LVL_OE_GPIO PM8921_MPP_PM_TO_SYS(8)
637#define ISA1200_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
638#define ISA1200_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
639#define ISA1200_HAP_CLK PM8921_GPIO_PM_TO_SYS(44)
640
641static int isa1200_power(int on)
642{
643 gpio_set_value_cansleep(ISA1200_HAP_CLK, !!on);
644
645 return 0;
646}
647
648static int isa1200_dev_setup(bool enable)
649{
650 int rc = 0;
651
652 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_1, enable);
653 if (rc) {
654 pr_err("%s: unable to write aux clock register(%d)\n",
655 __func__, rc);
656 return rc;
657 }
658
659 if (!enable)
660 goto free_gpio;
661
662 rc = gpio_request(ISA1200_HAP_CLK, "haptics_clk");
663 if (rc) {
664 pr_err("%s: unable to request gpio %d config(%d)\n",
665 __func__, ISA1200_HAP_CLK, rc);
666 return rc;
667 }
668
669 rc = gpio_direction_output(ISA1200_HAP_CLK, 0);
670 if (rc) {
671 pr_err("%s: unable to set direction\n", __func__);
672 goto free_gpio;
673 }
674
675 return 0;
676
677free_gpio:
678 gpio_free(ISA1200_HAP_CLK);
679 return rc;
680}
681
682static struct isa1200_regulator isa1200_reg_data[] = {
683 {
684 .name = "vddp",
685 .min_uV = ISA_I2C_VTG_MIN_UV,
686 .max_uV = ISA_I2C_VTG_MAX_UV,
687 .load_uA = ISA_I2C_CURR_UA,
688 },
689};
690
691static struct isa1200_platform_data isa1200_1_pdata = {
692 .name = "vibrator",
693 .dev_setup = isa1200_dev_setup,
694 .power_on = isa1200_power,
695 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
696 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
697 .max_timeout = 15000,
698 .mode_ctrl = PWM_GEN_MODE,
699 .pwm_fd = {
700 .pwm_div = 256,
701 },
702 .is_erm = false,
703 .smart_en = true,
704 .ext_clk_en = true,
705 .chip_en = 1,
706 .regulator_info = isa1200_reg_data,
707 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
708};
709
710static struct i2c_board_info isa1200_board_info[] __initdata = {
711 {
712 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
713 .platform_data = &isa1200_1_pdata,
714 },
715};
Jing Lin21ed4de2012-02-05 15:53:28 -0800716/* configuration data for mxt1386e using V2.1 firmware */
717static const u8 mxt1386e_config_data_v2_1[] = {
718 /* T6 Object */
719 0, 0, 0, 0, 0, 0,
720 /* T38 Object */
Jing Linf1208fd2012-02-23 11:15:42 -0800721 14, 1, 0, 22, 2, 12, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800722 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
723 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,
728 /* T7 Object */
Jing Linf1208fd2012-02-23 11:15:42 -0800729 100, 10, 50,
Jing Lin21ed4de2012-02-05 15:53:28 -0800730 /* T8 Object */
Jing Linf1208fd2012-02-23 11:15:42 -0800731 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800732 /* T9 Object */
733 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
734 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
Jing Linf1208fd2012-02-23 11:15:42 -0800735 85, 5, 0, 5, 9, 5, 12, 35, 70, 40,
736 20, 5, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800737 /* T18 Object */
738 0, 0,
739 /* T24 Object */
740 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
741 0, 0, 0, 0, 0, 0, 0, 0, 0,
742 /* T25 Object */
743 3, 0, 60, 115, 156, 99,
744 /* T27 Object */
745 0, 0, 0, 0, 0, 0, 0,
746 /* T40 Object */
747 0, 0, 0, 0, 0,
748 /* T42 Object */
749 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
750 /* T43 Object */
751 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
752 16,
753 /* T46 Object */
Jing Linf1208fd2012-02-23 11:15:42 -0800754 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800755 /* T47 Object */
756 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
757 /* T48 Object */
758 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -0800759 32, 40, 0, 10, 10, 0, 0, 100, 10, 90,
760 0, 0, 0, 0, 0, 0, 0, 10, 1, 10,
761 52, 10, 12, 0, 33, 0, 1, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800762 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
763 0, 0, 0, 0,
764 /* T56 Object */
765 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
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,
Jing Linf1208fd2012-02-23 11:15:42 -0800769 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
770 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800771};
772
773#define MXT_TS_GPIO_IRQ 6
774#define MXT_TS_PWR_EN_GPIO PM8921_GPIO_PM_TO_SYS(23)
775#define MXT_TS_RESET_GPIO 33
776
777static struct mxt_config_info mxt_config_array[] = {
778 {
779 .config = mxt1386e_config_data_v2_1,
780 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
781 .family_id = 0xA0,
782 .variant_id = 0x7,
783 .version = 0x21,
784 .build = 0xAA,
785 },
786};
787
788static struct mxt_platform_data mxt_platform_data = {
789 .config_array = mxt_config_array,
790 .config_array_size = ARRAY_SIZE(mxt_config_array),
791 .x_size = 1365,
792 .y_size = 767,
793 .irqflags = IRQF_TRIGGER_FALLING,
794 .i2c_pull_up = true,
795 .reset_gpio = MXT_TS_RESET_GPIO,
796 .irq_gpio = MXT_TS_GPIO_IRQ,
797};
798
799static struct i2c_board_info mxt_device_info[] __initdata = {
800 {
801 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
802 .platform_data = &mxt_platform_data,
803 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
804 },
805};
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -0800806#define CYTTSP_TS_GPIO_IRQ 6
807#define CYTTSP_TS_GPIO_RESOUT 7
808#define CYTTSP_TS_GPIO_SLEEP 33
809
810static ssize_t tma340_vkeys_show(struct kobject *kobj,
811 struct kobj_attribute *attr, char *buf)
812{
813 return snprintf(buf, 200,
814 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
815 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
816 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
817 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
818 "\n");
819}
820
821static struct kobj_attribute tma340_vkeys_attr = {
822 .attr = {
823 .mode = S_IRUGO,
824 },
825 .show = &tma340_vkeys_show,
826};
827
828static struct attribute *tma340_properties_attrs[] = {
829 &tma340_vkeys_attr.attr,
830 NULL
831};
832
833static struct attribute_group tma340_properties_attr_group = {
834 .attrs = tma340_properties_attrs,
835};
836
837static int cyttsp_platform_init(struct i2c_client *client)
838{
839 int rc = 0;
840 static struct kobject *tma340_properties_kobj;
841
842 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
843 tma340_properties_kobj = kobject_create_and_add("board_properties",
844 NULL);
845 if (tma340_properties_kobj)
846 rc = sysfs_create_group(tma340_properties_kobj,
847 &tma340_properties_attr_group);
848 if (!tma340_properties_kobj || rc)
849 pr_err("%s: failed to create board_properties\n",
850 __func__);
851
852 return 0;
853}
854
855static struct cyttsp_regulator cyttsp_regulator_data[] = {
856 {
857 .name = "vdd",
858 .min_uV = CY_TMA300_VTG_MIN_UV,
859 .max_uV = CY_TMA300_VTG_MAX_UV,
860 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
861 .lpm_load_uA = CY_TMA300_CURR_24HZ_UA,
862 },
863 {
864 .name = "vcc_i2c",
865 .min_uV = CY_I2C_VTG_MIN_UV,
866 .max_uV = CY_I2C_VTG_MAX_UV,
867 .hpm_load_uA = CY_I2C_CURR_UA,
868 .lpm_load_uA = CY_I2C_CURR_UA,
869 },
870};
871
872static struct cyttsp_platform_data cyttsp_pdata = {
873 .panel_maxx = 634,
874 .panel_maxy = 1166,
875 .disp_maxx = 599,
876 .disp_maxy = 1023,
877 .disp_minx = 0,
878 .disp_miny = 0,
879 .flags = 0x01,
880 .gen = CY_GEN3,
881 .use_st = CY_USE_ST,
882 .use_mt = CY_USE_MT,
883 .use_hndshk = CY_SEND_HNDSHK,
884 .use_trk_id = CY_USE_TRACKING_ID,
885 .use_sleep = CY_USE_DEEP_SLEEP_SEL,
886 .use_gestures = CY_USE_GESTURES,
887 .fw_fname = "cyttsp_8064_mtp.hex",
888 /* change act_intrvl to customize the Active power state
889 * scanning/processing refresh interval for Operating mode
890 */
891 .act_intrvl = CY_ACT_INTRVL_DFLT,
892 /* change tch_tmout to customize the touch timeout for the
893 * Active power state for Operating mode
894 */
895 .tch_tmout = CY_TCH_TMOUT_DFLT,
896 /* change lp_intrvl to customize the Low Power power state
897 * scanning/processing refresh interval for Operating mode
898 */
899 .lp_intrvl = CY_LP_INTRVL_DFLT,
900 .sleep_gpio = CYTTSP_TS_GPIO_SLEEP,
901 .resout_gpio = CYTTSP_TS_GPIO_RESOUT,
902 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
903 .regulator_info = cyttsp_regulator_data,
904 .num_regulators = ARRAY_SIZE(cyttsp_regulator_data),
905 .init = cyttsp_platform_init,
906 .correct_fw_ver = 17,
907};
908
909static struct i2c_board_info cyttsp_info[] __initdata = {
910 {
911 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
912 .platform_data = &cyttsp_pdata,
913 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
914 },
915};
Jing Lin21ed4de2012-02-05 15:53:28 -0800916
Ankit Verma6b7e2ba2012-01-26 15:48:54 -0800917#define MSM_WCNSS_PHYS 0x03000000
918#define MSM_WCNSS_SIZE 0x280000
919
920static struct resource resources_wcnss_wlan[] = {
921 {
922 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
923 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
924 .name = "wcnss_wlanrx_irq",
925 .flags = IORESOURCE_IRQ,
926 },
927 {
928 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
929 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
930 .name = "wcnss_wlantx_irq",
931 .flags = IORESOURCE_IRQ,
932 },
933 {
934 .start = MSM_WCNSS_PHYS,
935 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
936 .name = "wcnss_mmio",
937 .flags = IORESOURCE_MEM,
938 },
939 {
940 .start = 64,
941 .end = 68,
942 .name = "wcnss_gpios_5wire",
943 .flags = IORESOURCE_IO,
944 },
945};
946
947static struct qcom_wcnss_opts qcom_wcnss_pdata = {
948 .has_48mhz_xo = 1,
949};
950
951static struct platform_device msm_device_wcnss_wlan = {
952 .name = "wcnss_wlan",
953 .id = 0,
954 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
955 .resource = resources_wcnss_wlan,
956 .dev = {.platform_data = &qcom_wcnss_pdata},
957};
958
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700959#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
960 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
961 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
962 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
963
964#define QCE_SIZE 0x10000
965#define QCE_0_BASE 0x11000000
966
967#define QCE_HW_KEY_SUPPORT 0
968#define QCE_SHA_HMAC_SUPPORT 1
969#define QCE_SHARE_CE_RESOURCE 3
970#define QCE_CE_SHARED 0
971
972static struct resource qcrypto_resources[] = {
973 [0] = {
974 .start = QCE_0_BASE,
975 .end = QCE_0_BASE + QCE_SIZE - 1,
976 .flags = IORESOURCE_MEM,
977 },
978 [1] = {
979 .name = "crypto_channels",
980 .start = DMOV8064_CE_IN_CHAN,
981 .end = DMOV8064_CE_OUT_CHAN,
982 .flags = IORESOURCE_DMA,
983 },
984 [2] = {
985 .name = "crypto_crci_in",
986 .start = DMOV8064_CE_IN_CRCI,
987 .end = DMOV8064_CE_IN_CRCI,
988 .flags = IORESOURCE_DMA,
989 },
990 [3] = {
991 .name = "crypto_crci_out",
992 .start = DMOV8064_CE_OUT_CRCI,
993 .end = DMOV8064_CE_OUT_CRCI,
994 .flags = IORESOURCE_DMA,
995 },
996};
997
998static struct resource qcedev_resources[] = {
999 [0] = {
1000 .start = QCE_0_BASE,
1001 .end = QCE_0_BASE + QCE_SIZE - 1,
1002 .flags = IORESOURCE_MEM,
1003 },
1004 [1] = {
1005 .name = "crypto_channels",
1006 .start = DMOV8064_CE_IN_CHAN,
1007 .end = DMOV8064_CE_OUT_CHAN,
1008 .flags = IORESOURCE_DMA,
1009 },
1010 [2] = {
1011 .name = "crypto_crci_in",
1012 .start = DMOV8064_CE_IN_CRCI,
1013 .end = DMOV8064_CE_IN_CRCI,
1014 .flags = IORESOURCE_DMA,
1015 },
1016 [3] = {
1017 .name = "crypto_crci_out",
1018 .start = DMOV8064_CE_OUT_CRCI,
1019 .end = DMOV8064_CE_OUT_CRCI,
1020 .flags = IORESOURCE_DMA,
1021 },
1022};
1023
1024#endif
1025
1026#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1027 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1028
1029static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1030 .ce_shared = QCE_CE_SHARED,
1031 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1032 .hw_key_support = QCE_HW_KEY_SUPPORT,
1033 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001034 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001035};
1036
1037static struct platform_device qcrypto_device = {
1038 .name = "qcrypto",
1039 .id = 0,
1040 .num_resources = ARRAY_SIZE(qcrypto_resources),
1041 .resource = qcrypto_resources,
1042 .dev = {
1043 .coherent_dma_mask = DMA_BIT_MASK(32),
1044 .platform_data = &qcrypto_ce_hw_suppport,
1045 },
1046};
1047#endif
1048
1049#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1050 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1051
1052static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1053 .ce_shared = QCE_CE_SHARED,
1054 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1055 .hw_key_support = QCE_HW_KEY_SUPPORT,
1056 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001057 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001058};
1059
1060static struct platform_device qcedev_device = {
1061 .name = "qce",
1062 .id = 0,
1063 .num_resources = ARRAY_SIZE(qcedev_resources),
1064 .resource = qcedev_resources,
1065 .dev = {
1066 .coherent_dma_mask = DMA_BIT_MASK(32),
1067 .platform_data = &qcedev_ce_hw_suppport,
1068 },
1069};
1070#endif
1071
Joel Kingdacbc822012-01-25 13:30:57 -08001072static struct mdm_platform_data mdm_platform_data = {
1073 .mdm_version = "3.0",
1074 .ramdump_delay_ms = 2000,
Hemant Kumara945b472012-01-25 15:08:06 -08001075 .peripheral_platform_device = &apq8064_device_hsic_host,
Joel Kingdacbc822012-01-25 13:30:57 -08001076};
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001077
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001078static struct tsens_platform_data apq_tsens_pdata = {
1079 .tsens_factor = 1000,
1080 .hw_type = APQ_8064,
1081 .tsens_num_sensor = 11,
1082 .slope = {1176, 1176, 1154, 1176, 1111,
1083 1132, 1132, 1199, 1132, 1199, 1132},
1084};
1085
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001086#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001087static void __init apq8064_map_io(void)
1088{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001089 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001090 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001091 if (socinfo_init() < 0)
1092 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001093}
1094
1095static void __init apq8064_init_irq(void)
1096{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001097 struct msm_mpm_device_data *data = NULL;
1098
1099#ifdef CONFIG_MSM_MPM
1100 data = &apq8064_mpm_dev_data;
1101#endif
1102
1103 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001104 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1105 (void *)MSM_QGIC_CPU_BASE);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001106}
1107
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001108static struct platform_device msm8064_device_saw_regulator_core0 = {
1109 .name = "saw-regulator",
1110 .id = 0,
1111 .dev = {
1112 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
1113 },
1114};
1115
1116static struct platform_device msm8064_device_saw_regulator_core1 = {
1117 .name = "saw-regulator",
1118 .id = 1,
1119 .dev = {
1120 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
1121 },
1122};
1123
1124static struct platform_device msm8064_device_saw_regulator_core2 = {
1125 .name = "saw-regulator",
1126 .id = 2,
1127 .dev = {
1128 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
1129 },
1130};
1131
1132static struct platform_device msm8064_device_saw_regulator_core3 = {
1133 .name = "saw-regulator",
1134 .id = 3,
1135 .dev = {
1136 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001137
1138 },
1139};
1140
1141static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
1142 {
1143 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1144 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1145 true,
1146 100, 8000, 100000, 1,
1147 },
1148
1149 {
1150 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1151 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1152 true,
1153 2000, 6000, 60100000, 3000,
1154 },
1155
1156 {
1157 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1158 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1159 false,
1160 4200, 5000, 60350000, 3500,
1161 },
1162
1163 {
1164 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1165 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
1166 false,
1167 6300, 4500, 65350000, 4800,
1168 },
1169
1170 {
1171 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1172 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1173 false,
1174 11700, 2500, 67850000, 5500,
1175 },
1176
1177 {
1178 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1179 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1180 false,
1181 13800, 2000, 71850000, 6800,
1182 },
1183
1184 {
1185 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1186 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1187 false,
1188 29700, 500, 75850000, 8800,
1189 },
1190
1191 {
1192 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1193 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1194 false,
1195 29700, 0, 76350000, 9800,
1196 },
1197};
1198
1199static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1200 .mode = MSM_PM_BOOT_CONFIG_TZ,
1201};
1202
1203static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
1204 .levels = &msm_rpmrs_levels[0],
1205 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
1206 .vdd_mem_levels = {
1207 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
1208 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
1209 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
1210 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
1211 },
1212 .vdd_dig_levels = {
1213 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
1214 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
1215 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
1216 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
1217 },
1218 .vdd_mask = 0x7FFFFF,
1219 .rpmrs_target_id = {
1220 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
1221 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
1222 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
1223 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
1224 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
1225 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
1226 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
1227 },
1228};
1229
1230static struct msm_cpuidle_state msm_cstates[] __initdata = {
1231 {0, 0, "C0", "WFI",
1232 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1233
1234 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1235 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1236
1237 {0, 2, "C2", "POWER_COLLAPSE",
1238 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
1239
1240 {1, 0, "C0", "WFI",
1241 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1242
1243 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1244 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1245
1246 {2, 0, "C0", "WFI",
1247 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1248
1249 {2, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1250 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1251
1252 {3, 0, "C0", "WFI",
1253 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1254
1255 {3, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1256 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1257};
1258
1259static struct msm_pm_platform_data msm_pm_data[] = {
1260 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1261 .idle_supported = 1,
1262 .suspend_supported = 1,
1263 .idle_enabled = 0,
1264 .suspend_enabled = 0,
1265 },
1266
1267 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1268 .idle_supported = 1,
1269 .suspend_supported = 1,
1270 .idle_enabled = 0,
1271 .suspend_enabled = 0,
1272 },
1273
1274 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1275 .idle_supported = 1,
1276 .suspend_supported = 1,
1277 .idle_enabled = 1,
1278 .suspend_enabled = 1,
1279 },
1280
1281 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1282 .idle_supported = 0,
1283 .suspend_supported = 1,
1284 .idle_enabled = 0,
1285 .suspend_enabled = 0,
1286 },
1287
1288 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1289 .idle_supported = 1,
1290 .suspend_supported = 1,
1291 .idle_enabled = 0,
1292 .suspend_enabled = 0,
1293 },
1294
1295 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1296 .idle_supported = 1,
1297 .suspend_supported = 0,
1298 .idle_enabled = 1,
1299 .suspend_enabled = 0,
1300 },
1301
1302 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1303 .idle_supported = 0,
1304 .suspend_supported = 1,
1305 .idle_enabled = 0,
1306 .suspend_enabled = 0,
1307 },
1308
1309 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1310 .idle_supported = 1,
1311 .suspend_supported = 1,
1312 .idle_enabled = 0,
1313 .suspend_enabled = 0,
1314 },
1315
1316 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1317 .idle_supported = 1,
1318 .suspend_supported = 0,
1319 .idle_enabled = 1,
1320 .suspend_enabled = 0,
1321 },
1322
1323 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1324 .idle_supported = 0,
1325 .suspend_supported = 1,
1326 .idle_enabled = 0,
1327 .suspend_enabled = 0,
1328 },
1329
1330 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1331 .idle_supported = 1,
1332 .suspend_supported = 1,
1333 .idle_enabled = 0,
1334 .suspend_enabled = 0,
1335 },
1336
1337 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1338 .idle_supported = 1,
1339 .suspend_supported = 0,
1340 .idle_enabled = 1,
1341 .suspend_enabled = 0,
1342 },
1343};
1344
1345static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1346 0x03, 0x0f,
1347};
1348
1349static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1350 0x00, 0x24, 0x54, 0x10,
1351 0x09, 0x03, 0x01,
1352 0x10, 0x54, 0x30, 0x0C,
1353 0x24, 0x30, 0x0f,
1354};
1355
1356static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1357 0x00, 0x24, 0x54, 0x10,
1358 0x09, 0x07, 0x01, 0x0B,
1359 0x10, 0x54, 0x30, 0x0C,
1360 0x24, 0x30, 0x0f,
1361};
1362
1363static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1364 [0] = {
1365 .mode = MSM_SPM_MODE_CLOCK_GATING,
1366 .notify_rpm = false,
1367 .cmd = spm_wfi_cmd_sequence,
1368 },
1369 [1] = {
1370 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1371 .notify_rpm = false,
1372 .cmd = spm_power_collapse_without_rpm,
1373 },
1374 [2] = {
1375 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1376 .notify_rpm = true,
1377 .cmd = spm_power_collapse_with_rpm,
1378 },
1379};
1380
1381static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1382 0x00, 0x20, 0x03, 0x20,
1383 0x00, 0x0f,
1384};
1385
1386static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1387 0x00, 0x20, 0x34, 0x64,
1388 0x48, 0x07, 0x48, 0x20,
1389 0x50, 0x64, 0x04, 0x34,
1390 0x50, 0x0f,
1391};
1392static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1393 0x00, 0x10, 0x34, 0x64,
1394 0x48, 0x07, 0x48, 0x10,
1395 0x50, 0x64, 0x04, 0x34,
1396 0x50, 0x0F,
1397};
1398
1399static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1400 [0] = {
1401 .mode = MSM_SPM_L2_MODE_RETENTION,
1402 .notify_rpm = false,
1403 .cmd = l2_spm_wfi_cmd_sequence,
1404 },
1405 [1] = {
1406 .mode = MSM_SPM_L2_MODE_GDHS,
1407 .notify_rpm = true,
1408 .cmd = l2_spm_gdhs_cmd_sequence,
1409 },
1410 [2] = {
1411 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1412 .notify_rpm = true,
1413 .cmd = l2_spm_power_off_cmd_sequence,
1414 },
1415};
1416
1417
1418static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1419 [0] = {
1420 .reg_base_addr = MSM_SAW_L2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001421 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
1422 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1423 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1424 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1425 .modes = msm_spm_l2_seq_list,
1426 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1427 },
1428};
1429
1430static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1431 [0] = {
1432 .reg_base_addr = MSM_SAW0_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001433 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001434#if defined(CONFIG_MSM_AVS_HW)
1435 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1436 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1437#endif
1438 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1439 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1440 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1441 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1442 .vctl_timeout_us = 50,
1443 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1444 .modes = msm_spm_seq_list,
1445 },
1446 [1] = {
1447 .reg_base_addr = MSM_SAW1_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001448 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001449#if defined(CONFIG_MSM_AVS_HW)
1450 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1451 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1452#endif
1453 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1454 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1455 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1456 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1457 .vctl_timeout_us = 50,
1458 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1459 .modes = msm_spm_seq_list,
1460 },
1461 [2] = {
1462 .reg_base_addr = MSM_SAW2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001463 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001464#if defined(CONFIG_MSM_AVS_HW)
1465 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1466 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1467#endif
1468 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1469 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1470 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1471 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1472 .vctl_timeout_us = 50,
1473 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1474 .modes = msm_spm_seq_list,
1475 },
1476 [3] = {
1477 .reg_base_addr = MSM_SAW3_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001478 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001479#if defined(CONFIG_MSM_AVS_HW)
1480 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1481 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1482#endif
1483 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1484 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1485 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1486 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1487 .vctl_timeout_us = 50,
1488 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1489 .modes = msm_spm_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001490 },
1491};
1492
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001493static void __init apq8064_init_buses(void)
1494{
1495 msm_bus_rpm_set_mt_mask();
1496 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
1497 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
1498 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
1499 msm_bus_8064_apps_fabric.dev.platform_data =
1500 &msm_bus_8064_apps_fabric_pdata;
1501 msm_bus_8064_sys_fabric.dev.platform_data =
1502 &msm_bus_8064_sys_fabric_pdata;
1503 msm_bus_8064_mm_fabric.dev.platform_data =
1504 &msm_bus_8064_mm_fabric_pdata;
1505 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
1506 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
1507}
1508
David Collinsf0d00732012-01-25 15:46:50 -08001509static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
1510 .name = GPIO_REGULATOR_DEV_NAME,
1511 .id = PM8921_MPP_PM_TO_SYS(7),
1512 .dev = {
1513 .platform_data
1514 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
1515 },
1516};
1517
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08001518static struct platform_device apq8064_device_ext_mpp8_vreg __devinitdata = {
1519 .name = GPIO_REGULATOR_DEV_NAME,
1520 .id = PM8921_MPP_PM_TO_SYS(8),
1521 .dev = {
1522 .platform_data
1523 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_MPP8],
1524 },
1525};
1526
David Collinsf0d00732012-01-25 15:46:50 -08001527static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
1528 .name = GPIO_REGULATOR_DEV_NAME,
1529 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
1530 .dev = {
1531 .platform_data =
1532 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
1533 },
1534};
1535
David Collins390fc332012-02-07 14:38:16 -08001536static struct platform_device apq8064_device_ext_ts_sw_vreg __devinitdata = {
1537 .name = GPIO_REGULATOR_DEV_NAME,
1538 .id = PM8921_GPIO_PM_TO_SYS(23),
1539 .dev = {
1540 .platform_data
1541 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_TS_SW],
1542 },
1543};
1544
David Collins2782b5c2012-02-06 10:02:42 -08001545static struct platform_device apq8064_device_rpm_regulator __devinitdata = {
1546 .name = "rpm-regulator",
1547 .id = -1,
1548 .dev = {
1549 .platform_data = &apq8064_rpm_regulator_pdata,
1550 },
1551};
1552
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001553static struct platform_device *common_devices[] __initdata = {
Jin Hong01f2dbb2011-11-03 22:13:51 -07001554 &apq8064_device_dmov,
David Keitel3c40fc52012-02-09 17:53:52 -08001555 &apq8064_device_qup_i2c_gsbi1,
Jing Lin04601f92012-02-05 15:36:07 -08001556 &apq8064_device_qup_i2c_gsbi3,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001557 &apq8064_device_qup_i2c_gsbi4,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001558 &apq8064_device_qup_spi_gsbi5,
David Collinsf0d00732012-01-25 15:46:50 -08001559 &apq8064_device_ext_5v_vreg,
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08001560 &apq8064_device_ext_mpp8_vreg,
David Collinsf0d00732012-01-25 15:46:50 -08001561 &apq8064_device_ext_3p3v_vreg,
David Collins390fc332012-02-07 14:38:16 -08001562 &apq8064_device_ext_ts_sw_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07001563 &apq8064_device_ssbi_pmic1,
1564 &apq8064_device_ssbi_pmic2,
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001565 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07001566 &apq8064_device_otg,
1567 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08001568 &apq8064_device_hsusb_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07001569 &android_usb_device,
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001570 &msm_device_wcnss_wlan,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001571#ifdef CONFIG_ANDROID_PMEM
1572#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -07001573 &android_pmem_device,
1574 &android_pmem_adsp_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001575#endif
Kevin Chan13be4e22011-10-20 11:30:32 -07001576 &android_pmem_audio_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001577#endif
1578#ifdef CONFIG_ION_MSM
1579 &ion_dev,
1580#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001581 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001582 &msm8064_device_saw_regulator_core0,
1583 &msm8064_device_saw_regulator_core1,
1584 &msm8064_device_saw_regulator_core2,
1585 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001586#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1587 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1588 &qcrypto_device,
1589#endif
1590
1591#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1592 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1593 &qcedev_device,
1594#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07001595
1596#ifdef CONFIG_HW_RANDOM_MSM
1597 &apq8064_device_rng,
1598#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08001599 &apq_pcm,
1600 &apq_pcm_routing,
1601 &apq_cpudai0,
1602 &apq_cpudai1,
1603 &apq_cpudai_hdmi_rx,
1604 &apq_cpudai_bt_rx,
1605 &apq_cpudai_bt_tx,
1606 &apq_cpudai_fm_rx,
1607 &apq_cpudai_fm_tx,
1608 &apq_cpu_fe,
1609 &apq_stub_codec,
1610 &apq_voice,
1611 &apq_voip,
1612 &apq_lpa_pcm,
1613 &apq_pcm_hostless,
1614 &apq_cpudai_afe_01_rx,
1615 &apq_cpudai_afe_01_tx,
1616 &apq_cpudai_afe_02_rx,
1617 &apq_cpudai_afe_02_tx,
1618 &apq_pcm_afe,
1619 &apq_cpudai_auxpcm_rx,
1620 &apq_cpudai_auxpcm_tx,
Neema Shetty8427c262012-02-16 11:23:43 -08001621 &apq_cpudai_stub,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001622 &apq8064_rpm_device,
1623 &apq8064_rpm_log_device,
1624 &apq8064_rpm_stat_device,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001625 &msm_bus_8064_apps_fabric,
1626 &msm_bus_8064_sys_fabric,
1627 &msm_bus_8064_mm_fabric,
1628 &msm_bus_8064_sys_fpb,
1629 &msm_bus_8064_cpss_fpb,
Mohan Kumar Gubbihalli Lachma Naik7f72edd2012-02-06 17:26:47 -08001630 &apq8064_msm_device_vidc,
Matt Wagantalled832652012-02-02 19:23:17 -08001631 &msm_8960_riva,
Matt Wagantallb94b9a52012-02-02 21:59:54 -08001632 &msm_8960_q6_lpass,
Matt Wagantall292aace2012-01-26 19:12:34 -08001633 &msm_gss,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001634};
1635
Joel King4e7ad222011-08-17 15:47:38 -07001636static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001637 &apq8064_device_uart_gsbi3,
Yan He06913ce2011-08-26 16:33:46 -07001638 &msm_device_sps_apq8064,
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001639};
1640
1641static struct platform_device *rumi3_devices[] __initdata = {
1642 &apq8064_device_uart_gsbi1,
Yan He435ed612011-11-23 17:34:59 -08001643 &msm_device_sps_apq8064,
Huaibin Yang4a084e32011-12-15 15:25:52 -08001644#ifdef CONFIG_MSM_ROTATOR
1645 &msm_rotator_device,
1646#endif
Joel King4e7ad222011-08-17 15:47:38 -07001647};
1648
Joel King82b7e3f2012-01-05 10:03:27 -08001649static struct platform_device *cdp_devices[] __initdata = {
1650 &apq8064_device_uart_gsbi1,
Jin Hong4bbbfba2012-02-02 21:48:07 -08001651 &apq8064_device_uart_gsbi7,
Joel King82b7e3f2012-01-05 10:03:27 -08001652 &msm_device_sps_apq8064,
1653};
1654
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001655static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08001656 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001657};
1658
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001659#define KS8851_IRQ_GPIO 43
1660
1661static struct spi_board_info spi_board_info[] __initdata = {
1662 {
1663 .modalias = "ks8851",
1664 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1665 .max_speed_hz = 19200000,
1666 .bus_num = 0,
1667 .chip_select = 2,
1668 .mode = SPI_MODE_0,
1669 },
1670};
1671
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001672static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001673 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001674 .bus_num = 1,
1675 .slim_slave = &apq8064_slim_tabla,
1676 },
1677 {
1678 .bus_num = 1,
1679 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001680 },
1681 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001682};
1683
David Keitel3c40fc52012-02-09 17:53:52 -08001684static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi1_pdata = {
1685 .clk_freq = 100000,
1686 .src_clk_rate = 24000000,
1687};
1688
Jing Lin04601f92012-02-05 15:36:07 -08001689static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi3_pdata = {
1690 .clk_freq = 100000,
1691 .src_clk_rate = 24000000,
1692};
1693
Kenneth Heitke748593a2011-07-15 15:45:11 -06001694static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
1695 .clk_freq = 100000,
1696 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001697};
1698
David Keitel3c40fc52012-02-09 17:53:52 -08001699#define GSBI_DUAL_MODE_CODE 0x60
1700#define MSM_GSBI1_PHYS 0x12440000
Kenneth Heitke748593a2011-07-15 15:45:11 -06001701static void __init apq8064_i2c_init(void)
1702{
David Keitel3c40fc52012-02-09 17:53:52 -08001703 void __iomem *gsbi_mem;
1704
1705 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
1706 &apq8064_i2c_qup_gsbi1_pdata;
1707 gsbi_mem = ioremap_nocache(MSM_GSBI1_PHYS, 4);
1708 writel_relaxed(GSBI_DUAL_MODE_CODE, gsbi_mem);
1709 /* Ensure protocol code is written before proceeding */
1710 wmb();
1711 iounmap(gsbi_mem);
1712 apq8064_i2c_qup_gsbi1_pdata.use_gsbi_shared_mode = 1;
Jing Lin04601f92012-02-05 15:36:07 -08001713 apq8064_device_qup_i2c_gsbi3.dev.platform_data =
1714 &apq8064_i2c_qup_gsbi3_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06001715 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
1716 &apq8064_i2c_qup_gsbi4_pdata;
1717}
1718
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08001719#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001720static int ethernet_init(void)
1721{
1722 int ret;
1723 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
1724 if (ret) {
1725 pr_err("ks8851 gpio_request failed: %d\n", ret);
1726 goto fail;
1727 }
1728
1729 return 0;
1730fail:
1731 return ret;
1732}
1733#else
1734static int ethernet_init(void)
1735{
1736 return 0;
1737}
1738#endif
1739
Mohan Pallaka474b94b2012-01-25 12:59:58 +05301740#define GPIO_KEY_HOME PM8921_GPIO_PM_TO_SYS(27)
1741#define GPIO_KEY_VOLUME_UP PM8921_GPIO_PM_TO_SYS(35)
1742#define GPIO_KEY_VOLUME_DOWN PM8921_GPIO_PM_TO_SYS(38)
1743#define GPIO_KEY_CAM_FOCUS PM8921_GPIO_PM_TO_SYS(3)
1744#define GPIO_KEY_CAM_SNAP PM8921_GPIO_PM_TO_SYS(4)
1745#define GPIO_KEY_ROTATION 46
1746
1747static struct gpio_keys_button cdp_keys[] = {
1748 {
1749 .code = KEY_HOME,
1750 .gpio = GPIO_KEY_HOME,
1751 .desc = "home_key",
1752 .active_low = 1,
1753 .type = EV_KEY,
1754 .wakeup = 1,
1755 .debounce_interval = 15,
1756 },
1757 {
1758 .code = KEY_VOLUMEUP,
1759 .gpio = GPIO_KEY_VOLUME_UP,
1760 .desc = "volume_up_key",
1761 .active_low = 1,
1762 .type = EV_KEY,
1763 .wakeup = 1,
1764 .debounce_interval = 15,
1765 },
1766 {
1767 .code = KEY_VOLUMEDOWN,
1768 .gpio = GPIO_KEY_VOLUME_DOWN,
1769 .desc = "volume_down_key",
1770 .active_low = 1,
1771 .type = EV_KEY,
1772 .wakeup = 1,
1773 .debounce_interval = 15,
1774 },
1775 {
1776 .code = SW_ROTATE_LOCK,
1777 .gpio = GPIO_KEY_ROTATION,
1778 .desc = "rotate_key",
1779 .active_low = 1,
1780 .type = EV_SW,
1781 .debounce_interval = 15,
1782 },
1783};
1784
1785static struct gpio_keys_platform_data cdp_keys_data = {
1786 .buttons = cdp_keys,
1787 .nbuttons = ARRAY_SIZE(cdp_keys),
1788};
1789
1790static struct platform_device cdp_kp_pdev = {
1791 .name = "gpio-keys",
1792 .id = -1,
1793 .dev = {
1794 .platform_data = &cdp_keys_data,
1795 },
1796};
1797
1798static struct gpio_keys_button mtp_keys[] = {
1799 {
1800 .code = KEY_CAMERA_FOCUS,
1801 .gpio = GPIO_KEY_CAM_FOCUS,
1802 .desc = "cam_focus_key",
1803 .active_low = 1,
1804 .type = EV_KEY,
1805 .wakeup = 1,
1806 .debounce_interval = 15,
1807 },
1808 {
1809 .code = KEY_VOLUMEUP,
1810 .gpio = GPIO_KEY_VOLUME_UP,
1811 .desc = "volume_up_key",
1812 .active_low = 1,
1813 .type = EV_KEY,
1814 .wakeup = 1,
1815 .debounce_interval = 15,
1816 },
1817 {
1818 .code = KEY_VOLUMEDOWN,
1819 .gpio = GPIO_KEY_VOLUME_DOWN,
1820 .desc = "volume_down_key",
1821 .active_low = 1,
1822 .type = EV_KEY,
1823 .wakeup = 1,
1824 .debounce_interval = 15,
1825 },
1826 {
1827 .code = KEY_CAMERA_SNAPSHOT,
1828 .gpio = GPIO_KEY_CAM_SNAP,
1829 .desc = "cam_snap_key",
1830 .active_low = 1,
1831 .type = EV_KEY,
1832 .debounce_interval = 15,
1833 },
1834};
1835
1836static struct gpio_keys_platform_data mtp_keys_data = {
1837 .buttons = mtp_keys,
1838 .nbuttons = ARRAY_SIZE(mtp_keys),
1839};
1840
1841static struct platform_device mtp_kp_pdev = {
1842 .name = "gpio-keys",
1843 .id = -1,
1844 .dev = {
1845 .platform_data = &mtp_keys_data,
1846 },
1847};
1848
1849
Tianyi Gou41515e22011-09-01 19:37:43 -07001850static void __init apq8064_clock_init(void)
1851{
Tianyi Gouacb588d2012-01-27 18:24:05 -08001852 if (machine_is_apq8064_rumi3())
Tianyi Gou41515e22011-09-01 19:37:43 -07001853 msm_clock_init(&apq8064_dummy_clock_init_data);
Tianyi Gouacb588d2012-01-27 18:24:05 -08001854 else
1855 msm_clock_init(&apq8064_clock_init_data);
Tianyi Gou41515e22011-09-01 19:37:43 -07001856}
1857
Jing Lin417fa452012-02-05 14:31:06 -08001858#define I2C_SURF 1
1859#define I2C_FFA (1 << 1)
1860#define I2C_RUMI (1 << 2)
1861#define I2C_SIM (1 << 3)
1862#define I2C_LIQUID (1 << 4)
1863
1864struct i2c_registry {
1865 u8 machs;
1866 int bus;
1867 struct i2c_board_info *info;
1868 int len;
1869};
1870
1871static struct i2c_registry apq8064_i2c_devices[] __initdata = {
Jing Lin21ed4de2012-02-05 15:53:28 -08001872 {
1873 I2C_SURF | I2C_LIQUID,
1874 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
1875 mxt_device_info,
1876 ARRAY_SIZE(mxt_device_info),
1877 },
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001878 {
1879 I2C_FFA,
1880 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
1881 cyttsp_info,
1882 ARRAY_SIZE(cyttsp_info),
1883 },
Amy Maloche70090f992012-02-16 16:35:26 -08001884 {
1885 I2C_FFA | I2C_LIQUID,
1886 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
1887 isa1200_board_info,
1888 ARRAY_SIZE(isa1200_board_info),
1889 },
Jing Lin417fa452012-02-05 14:31:06 -08001890};
1891
1892static void __init register_i2c_devices(void)
1893{
1894 u8 mach_mask = 0;
1895 int i;
1896
Kevin Chand07220e2012-02-13 15:52:22 -08001897#ifdef CONFIG_MSM_CAMERA
1898 struct i2c_registry apq8064_camera_i2c_devices = {
1899 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_RUMI,
1900 APQ_8064_GSBI4_QUP_I2C_BUS_ID,
1901 apq8064_camera_board_info.board_info,
1902 apq8064_camera_board_info.num_i2c_board_info,
1903 };
1904#endif
Jing Lin417fa452012-02-05 14:31:06 -08001905 /* Build the matching 'supported_machs' bitmask */
1906 if (machine_is_apq8064_cdp())
1907 mach_mask = I2C_SURF;
1908 else if (machine_is_apq8064_mtp())
1909 mach_mask = I2C_FFA;
1910 else if (machine_is_apq8064_liquid())
1911 mach_mask = I2C_LIQUID;
1912 else if (machine_is_apq8064_rumi3())
1913 mach_mask = I2C_RUMI;
1914 else if (machine_is_apq8064_sim())
1915 mach_mask = I2C_SIM;
1916 else
1917 pr_err("unmatched machine ID in register_i2c_devices\n");
1918
1919 /* Run the array and install devices as appropriate */
1920 for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) {
1921 if (apq8064_i2c_devices[i].machs & mach_mask)
1922 i2c_register_board_info(apq8064_i2c_devices[i].bus,
1923 apq8064_i2c_devices[i].info,
1924 apq8064_i2c_devices[i].len);
1925 }
Kevin Chand07220e2012-02-13 15:52:22 -08001926#ifdef CONFIG_MSM_CAMERA
1927 if (apq8064_camera_i2c_devices.machs & mach_mask)
1928 i2c_register_board_info(apq8064_camera_i2c_devices.bus,
1929 apq8064_camera_i2c_devices.info,
1930 apq8064_camera_i2c_devices.len);
1931#endif
Jing Lin417fa452012-02-05 14:31:06 -08001932}
1933
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001934static void __init apq8064_common_init(void)
1935{
1936 if (socinfo_init() < 0)
1937 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06001938 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
1939 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
David Collins2782b5c2012-02-06 10:02:42 -08001940 regulator_suppress_info_printing();
1941 platform_device_register(&apq8064_device_rpm_regulator);
Tianyi Gou41515e22011-09-01 19:37:43 -07001942 apq8064_clock_init();
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08001943 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06001944 apq8064_i2c_init();
Jing Lin417fa452012-02-05 14:31:06 -08001945 register_i2c_devices();
Kenneth Heitke36920d32011-07-20 16:44:30 -06001946
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001947 apq8064_device_qup_spi_gsbi5.dev.platform_data =
1948 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08001949 apq8064_init_pmic();
Hemant Kumar94e7da22012-02-03 16:52:29 -08001950 if (machine_is_apq8064_liquid())
1951 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001952 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Manu Gautam91223e02011-11-08 15:27:22 +05301953 apq8064_ehci_host_init();
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001954 apq8064_init_buses();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001955 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Hemant Kumarf1ca9192012-02-07 18:59:33 -08001956 if (machine_is_apq8064_mtp()) {
1957 apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
1958 device_initialize(&apq8064_device_hsic_host.dev);
1959 }
Jay Chokshie8741282012-01-25 15:22:55 -08001960 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05301961 apq8064_init_mmc();
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08001962
1963 if (machine_is_apq8064_mtp()) {
1964 mdm_8064_device.dev.platform_data = &mdm_platform_data;
1965 platform_device_register(&mdm_8064_device);
1966 }
1967 platform_device_register(&apq8064_slim_ctrl);
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001968 slim_register_board_info(apq8064_slim_devices,
1969 ARRAY_SIZE(apq8064_slim_devices));
Praveen Chidambaram78499012011-11-01 17:15:17 -06001970 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Mahesh Sivasubramaniancbce1ec2012-01-24 10:32:44 -07001971 acpuclk_init(&acpuclk_8064_soc_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06001972 msm_spm_l2_init(msm_spm_l2_data);
1973 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
1974 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
1975 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
1976 msm_pm_data);
1977 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001978}
1979
Huaibin Yang4a084e32011-12-15 15:25:52 -08001980static void __init apq8064_allocate_memory_regions(void)
1981{
1982 apq8064_allocate_fb_region();
1983}
1984
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001985static void __init apq8064_sim_init(void)
1986{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001987 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
1988 &msm8064_device_watchdog.dev.platform_data;
1989
1990 wdog_pdata->bark_time = 15000;
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001991 msm_tsens_early_init(&apq_tsens_pdata);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001992 apq8064_common_init();
Joel King4e7ad222011-08-17 15:47:38 -07001993 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
1994}
1995
1996static void __init apq8064_rumi3_init(void)
1997{
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001998 msm_tsens_early_init(&apq_tsens_pdata);
Joel King4e7ad222011-08-17 15:47:38 -07001999 apq8064_common_init();
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002000 ethernet_init();
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002001 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002002 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Huaibin Yang4a084e32011-12-15 15:25:52 -08002003 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07002004 apq8064_init_gpu();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002005}
2006
Joel King82b7e3f2012-01-05 10:03:27 -08002007static void __init apq8064_cdp_init(void)
2008{
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002009 msm_tsens_early_init(&apq_tsens_pdata);
Joel King82b7e3f2012-01-05 10:03:27 -08002010 apq8064_common_init();
2011 ethernet_init();
2012 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
2013 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002014 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07002015 apq8064_init_gpu();
Matt Wagantall1875d322012-02-22 16:11:33 -08002016 platform_add_devices(apq8064_fs_devices, apq8064_num_fs_devices);
Kevin Chand07220e2012-02-13 15:52:22 -08002017 apq8064_init_cam();
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302018
2019 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
2020 platform_device_register(&cdp_kp_pdev);
2021
2022 if (machine_is_apq8064_mtp())
2023 platform_device_register(&mtp_kp_pdev);
Joel King82b7e3f2012-01-05 10:03:27 -08002024}
2025
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002026MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
2027 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002028 .reserve = apq8064_reserve,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002029 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302030 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002031 .timer = &msm_timer,
2032 .init_machine = apq8064_sim_init,
2033MACHINE_END
2034
Joel King4e7ad222011-08-17 15:47:38 -07002035MACHINE_START(APQ8064_RUMI3, "QCT APQ8064 RUMI3")
2036 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002037 .reserve = apq8064_reserve,
Joel King4e7ad222011-08-17 15:47:38 -07002038 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302039 .handle_irq = gic_handle_irq,
Joel King4e7ad222011-08-17 15:47:38 -07002040 .timer = &msm_timer,
2041 .init_machine = apq8064_rumi3_init,
Huaibin Yang4a084e32011-12-15 15:25:52 -08002042 .init_early = apq8064_allocate_memory_regions,
Joel King4e7ad222011-08-17 15:47:38 -07002043MACHINE_END
2044
Joel King82b7e3f2012-01-05 10:03:27 -08002045MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
2046 .map_io = apq8064_map_io,
2047 .reserve = apq8064_reserve,
2048 .init_irq = apq8064_init_irq,
2049 .handle_irq = gic_handle_irq,
2050 .timer = &msm_timer,
2051 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002052 .init_early = apq8064_allocate_memory_regions,
Joel King82b7e3f2012-01-05 10:03:27 -08002053MACHINE_END
2054
2055MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
2056 .map_io = apq8064_map_io,
2057 .reserve = apq8064_reserve,
2058 .init_irq = apq8064_init_irq,
2059 .handle_irq = gic_handle_irq,
2060 .timer = &msm_timer,
2061 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002062 .init_early = apq8064_allocate_memory_regions,
Joel King82b7e3f2012-01-05 10:03:27 -08002063MACHINE_END
2064
2065MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
2066 .map_io = apq8064_map_io,
2067 .reserve = apq8064_reserve,
2068 .init_irq = apq8064_init_irq,
2069 .handle_irq = gic_handle_irq,
2070 .timer = &msm_timer,
2071 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002072 .init_early = apq8064_allocate_memory_regions,
Joel King82b7e3f2012-01-05 10:03:27 -08002073MACHINE_END
2074
Joel King11ca8202012-02-13 16:19:03 -08002075MACHINE_START(MPQ8064_HRD, "QCT MPQ8064 HRD")
2076 .map_io = apq8064_map_io,
2077 .reserve = apq8064_reserve,
2078 .init_irq = apq8064_init_irq,
2079 .handle_irq = gic_handle_irq,
2080 .timer = &msm_timer,
2081 .init_machine = apq8064_cdp_init,
2082MACHINE_END
2083
2084MACHINE_START(MPQ8064_DTV, "QCT MPQ8064 DTV")
2085 .map_io = apq8064_map_io,
2086 .reserve = apq8064_reserve,
2087 .init_irq = apq8064_init_irq,
2088 .handle_irq = gic_handle_irq,
2089 .timer = &msm_timer,
2090 .init_machine = apq8064_cdp_init,
2091MACHINE_END
2092