blob: 8e7fb1a387e2002b62788baeeb8d167266e597f6 [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>
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -080019#include <linux/mfd/wcd9310/core.h>
20#include <linux/mfd/wcd9310/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 */
502static struct tabla_pdata apq8064_tabla_platform_data = {
503 .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,
509 .num_irqs = NR_TABLA_IRQS,
510 .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,
520 }
521};
522
523static struct slim_device apq8064_slim_tabla = {
524 .name = "tabla-slim",
525 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
526 .dev = {
527 .platform_data = &apq8064_tabla_platform_data,
528 },
529};
530
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800531static struct tabla_pdata apq8064_tabla20_platform_data = {
532 .slimbus_slave_device = {
533 .name = "tabla-slave",
534 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
535 },
536 .irq = MSM_GPIO_TO_INT(42),
537 .irq_base = TABLA_INTERRUPT_BASE,
538 .num_irqs = NR_TABLA_IRQS,
539 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
540 .micbias = {
541 .ldoh_v = TABLA_LDOH_2P85_V,
542 .cfilt1_mv = 1800,
543 .cfilt2_mv = 1800,
544 .cfilt3_mv = 1800,
545 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
546 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
547 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
548 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
549 }
550};
551
552static struct slim_device apq8064_slim_tabla20 = {
553 .name = "tabla2x-slim",
554 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
555 .dev = {
556 .platform_data = &apq8064_tabla20_platform_data,
557 },
558};
559
Amy Maloche70090f992012-02-16 16:35:26 -0800560#define HAP_SHIFT_LVL_OE_GPIO PM8921_MPP_PM_TO_SYS(8)
561#define ISA1200_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
562#define ISA1200_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
563#define ISA1200_HAP_CLK PM8921_GPIO_PM_TO_SYS(44)
564
565static int isa1200_power(int on)
566{
567 gpio_set_value_cansleep(ISA1200_HAP_CLK, !!on);
568
569 return 0;
570}
571
572static int isa1200_dev_setup(bool enable)
573{
574 int rc = 0;
575
576 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_1, enable);
577 if (rc) {
578 pr_err("%s: unable to write aux clock register(%d)\n",
579 __func__, rc);
580 return rc;
581 }
582
583 if (!enable)
584 goto free_gpio;
585
586 rc = gpio_request(ISA1200_HAP_CLK, "haptics_clk");
587 if (rc) {
588 pr_err("%s: unable to request gpio %d config(%d)\n",
589 __func__, ISA1200_HAP_CLK, rc);
590 return rc;
591 }
592
593 rc = gpio_direction_output(ISA1200_HAP_CLK, 0);
594 if (rc) {
595 pr_err("%s: unable to set direction\n", __func__);
596 goto free_gpio;
597 }
598
599 return 0;
600
601free_gpio:
602 gpio_free(ISA1200_HAP_CLK);
603 return rc;
604}
605
606static struct isa1200_regulator isa1200_reg_data[] = {
607 {
608 .name = "vddp",
609 .min_uV = ISA_I2C_VTG_MIN_UV,
610 .max_uV = ISA_I2C_VTG_MAX_UV,
611 .load_uA = ISA_I2C_CURR_UA,
612 },
613};
614
615static struct isa1200_platform_data isa1200_1_pdata = {
616 .name = "vibrator",
617 .dev_setup = isa1200_dev_setup,
618 .power_on = isa1200_power,
619 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
620 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
621 .max_timeout = 15000,
622 .mode_ctrl = PWM_GEN_MODE,
623 .pwm_fd = {
624 .pwm_div = 256,
625 },
626 .is_erm = false,
627 .smart_en = true,
628 .ext_clk_en = true,
629 .chip_en = 1,
630 .regulator_info = isa1200_reg_data,
631 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
632};
633
634static struct i2c_board_info isa1200_board_info[] __initdata = {
635 {
636 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
637 .platform_data = &isa1200_1_pdata,
638 },
639};
Jing Lin21ed4de2012-02-05 15:53:28 -0800640/* configuration data for mxt1386e using V2.1 firmware */
641static const u8 mxt1386e_config_data_v2_1[] = {
642 /* T6 Object */
643 0, 0, 0, 0, 0, 0,
644 /* T38 Object */
645 14, 0, 0, 24, 1, 12, 0, 0, 0, 0,
646 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
647 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
648 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
649 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
650 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
651 0, 0, 0, 0,
652 /* T7 Object */
653 100, 16, 50,
654 /* T8 Object */
655 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
656 /* T9 Object */
657 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
658 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
659 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
660 10, 5, 0, 0, 0,
661 /* T18 Object */
662 0, 0,
663 /* T24 Object */
664 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
665 0, 0, 0, 0, 0, 0, 0, 0, 0,
666 /* T25 Object */
667 3, 0, 60, 115, 156, 99,
668 /* T27 Object */
669 0, 0, 0, 0, 0, 0, 0,
670 /* T40 Object */
671 0, 0, 0, 0, 0,
672 /* T42 Object */
673 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
674 /* T43 Object */
675 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
676 16,
677 /* T46 Object */
678 64, 0, 20, 20, 0, 0, 0, 0, 0,
679 /* T47 Object */
680 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
681 /* T48 Object */
682 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
683 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
684 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
685 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
686 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
687 0, 0, 0, 0,
688 /* T56 Object */
689 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
690 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
691 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
692 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
693 2, 99, 33, 0, 149, 24, 193, 255, 255, 255,
694 255,
695};
696
697#define MXT_TS_GPIO_IRQ 6
698#define MXT_TS_PWR_EN_GPIO PM8921_GPIO_PM_TO_SYS(23)
699#define MXT_TS_RESET_GPIO 33
700
701static struct mxt_config_info mxt_config_array[] = {
702 {
703 .config = mxt1386e_config_data_v2_1,
704 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
705 .family_id = 0xA0,
706 .variant_id = 0x7,
707 .version = 0x21,
708 .build = 0xAA,
709 },
710};
711
712static struct mxt_platform_data mxt_platform_data = {
713 .config_array = mxt_config_array,
714 .config_array_size = ARRAY_SIZE(mxt_config_array),
715 .x_size = 1365,
716 .y_size = 767,
717 .irqflags = IRQF_TRIGGER_FALLING,
718 .i2c_pull_up = true,
719 .reset_gpio = MXT_TS_RESET_GPIO,
720 .irq_gpio = MXT_TS_GPIO_IRQ,
721};
722
723static struct i2c_board_info mxt_device_info[] __initdata = {
724 {
725 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
726 .platform_data = &mxt_platform_data,
727 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
728 },
729};
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -0800730#define CYTTSP_TS_GPIO_IRQ 6
731#define CYTTSP_TS_GPIO_RESOUT 7
732#define CYTTSP_TS_GPIO_SLEEP 33
733
734static ssize_t tma340_vkeys_show(struct kobject *kobj,
735 struct kobj_attribute *attr, char *buf)
736{
737 return snprintf(buf, 200,
738 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
739 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
740 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
741 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
742 "\n");
743}
744
745static struct kobj_attribute tma340_vkeys_attr = {
746 .attr = {
747 .mode = S_IRUGO,
748 },
749 .show = &tma340_vkeys_show,
750};
751
752static struct attribute *tma340_properties_attrs[] = {
753 &tma340_vkeys_attr.attr,
754 NULL
755};
756
757static struct attribute_group tma340_properties_attr_group = {
758 .attrs = tma340_properties_attrs,
759};
760
761static int cyttsp_platform_init(struct i2c_client *client)
762{
763 int rc = 0;
764 static struct kobject *tma340_properties_kobj;
765
766 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
767 tma340_properties_kobj = kobject_create_and_add("board_properties",
768 NULL);
769 if (tma340_properties_kobj)
770 rc = sysfs_create_group(tma340_properties_kobj,
771 &tma340_properties_attr_group);
772 if (!tma340_properties_kobj || rc)
773 pr_err("%s: failed to create board_properties\n",
774 __func__);
775
776 return 0;
777}
778
779static struct cyttsp_regulator cyttsp_regulator_data[] = {
780 {
781 .name = "vdd",
782 .min_uV = CY_TMA300_VTG_MIN_UV,
783 .max_uV = CY_TMA300_VTG_MAX_UV,
784 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
785 .lpm_load_uA = CY_TMA300_CURR_24HZ_UA,
786 },
787 {
788 .name = "vcc_i2c",
789 .min_uV = CY_I2C_VTG_MIN_UV,
790 .max_uV = CY_I2C_VTG_MAX_UV,
791 .hpm_load_uA = CY_I2C_CURR_UA,
792 .lpm_load_uA = CY_I2C_CURR_UA,
793 },
794};
795
796static struct cyttsp_platform_data cyttsp_pdata = {
797 .panel_maxx = 634,
798 .panel_maxy = 1166,
799 .disp_maxx = 599,
800 .disp_maxy = 1023,
801 .disp_minx = 0,
802 .disp_miny = 0,
803 .flags = 0x01,
804 .gen = CY_GEN3,
805 .use_st = CY_USE_ST,
806 .use_mt = CY_USE_MT,
807 .use_hndshk = CY_SEND_HNDSHK,
808 .use_trk_id = CY_USE_TRACKING_ID,
809 .use_sleep = CY_USE_DEEP_SLEEP_SEL,
810 .use_gestures = CY_USE_GESTURES,
811 .fw_fname = "cyttsp_8064_mtp.hex",
812 /* change act_intrvl to customize the Active power state
813 * scanning/processing refresh interval for Operating mode
814 */
815 .act_intrvl = CY_ACT_INTRVL_DFLT,
816 /* change tch_tmout to customize the touch timeout for the
817 * Active power state for Operating mode
818 */
819 .tch_tmout = CY_TCH_TMOUT_DFLT,
820 /* change lp_intrvl to customize the Low Power power state
821 * scanning/processing refresh interval for Operating mode
822 */
823 .lp_intrvl = CY_LP_INTRVL_DFLT,
824 .sleep_gpio = CYTTSP_TS_GPIO_SLEEP,
825 .resout_gpio = CYTTSP_TS_GPIO_RESOUT,
826 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
827 .regulator_info = cyttsp_regulator_data,
828 .num_regulators = ARRAY_SIZE(cyttsp_regulator_data),
829 .init = cyttsp_platform_init,
830 .correct_fw_ver = 17,
831};
832
833static struct i2c_board_info cyttsp_info[] __initdata = {
834 {
835 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
836 .platform_data = &cyttsp_pdata,
837 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
838 },
839};
Jing Lin21ed4de2012-02-05 15:53:28 -0800840
Ankit Verma6b7e2ba2012-01-26 15:48:54 -0800841#define MSM_WCNSS_PHYS 0x03000000
842#define MSM_WCNSS_SIZE 0x280000
843
844static struct resource resources_wcnss_wlan[] = {
845 {
846 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
847 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
848 .name = "wcnss_wlanrx_irq",
849 .flags = IORESOURCE_IRQ,
850 },
851 {
852 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
853 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
854 .name = "wcnss_wlantx_irq",
855 .flags = IORESOURCE_IRQ,
856 },
857 {
858 .start = MSM_WCNSS_PHYS,
859 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
860 .name = "wcnss_mmio",
861 .flags = IORESOURCE_MEM,
862 },
863 {
864 .start = 64,
865 .end = 68,
866 .name = "wcnss_gpios_5wire",
867 .flags = IORESOURCE_IO,
868 },
869};
870
871static struct qcom_wcnss_opts qcom_wcnss_pdata = {
872 .has_48mhz_xo = 1,
873};
874
875static struct platform_device msm_device_wcnss_wlan = {
876 .name = "wcnss_wlan",
877 .id = 0,
878 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
879 .resource = resources_wcnss_wlan,
880 .dev = {.platform_data = &qcom_wcnss_pdata},
881};
882
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700883#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
884 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
885 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
886 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
887
888#define QCE_SIZE 0x10000
889#define QCE_0_BASE 0x11000000
890
891#define QCE_HW_KEY_SUPPORT 0
892#define QCE_SHA_HMAC_SUPPORT 1
893#define QCE_SHARE_CE_RESOURCE 3
894#define QCE_CE_SHARED 0
895
896static struct resource qcrypto_resources[] = {
897 [0] = {
898 .start = QCE_0_BASE,
899 .end = QCE_0_BASE + QCE_SIZE - 1,
900 .flags = IORESOURCE_MEM,
901 },
902 [1] = {
903 .name = "crypto_channels",
904 .start = DMOV8064_CE_IN_CHAN,
905 .end = DMOV8064_CE_OUT_CHAN,
906 .flags = IORESOURCE_DMA,
907 },
908 [2] = {
909 .name = "crypto_crci_in",
910 .start = DMOV8064_CE_IN_CRCI,
911 .end = DMOV8064_CE_IN_CRCI,
912 .flags = IORESOURCE_DMA,
913 },
914 [3] = {
915 .name = "crypto_crci_out",
916 .start = DMOV8064_CE_OUT_CRCI,
917 .end = DMOV8064_CE_OUT_CRCI,
918 .flags = IORESOURCE_DMA,
919 },
920};
921
922static struct resource qcedev_resources[] = {
923 [0] = {
924 .start = QCE_0_BASE,
925 .end = QCE_0_BASE + QCE_SIZE - 1,
926 .flags = IORESOURCE_MEM,
927 },
928 [1] = {
929 .name = "crypto_channels",
930 .start = DMOV8064_CE_IN_CHAN,
931 .end = DMOV8064_CE_OUT_CHAN,
932 .flags = IORESOURCE_DMA,
933 },
934 [2] = {
935 .name = "crypto_crci_in",
936 .start = DMOV8064_CE_IN_CRCI,
937 .end = DMOV8064_CE_IN_CRCI,
938 .flags = IORESOURCE_DMA,
939 },
940 [3] = {
941 .name = "crypto_crci_out",
942 .start = DMOV8064_CE_OUT_CRCI,
943 .end = DMOV8064_CE_OUT_CRCI,
944 .flags = IORESOURCE_DMA,
945 },
946};
947
948#endif
949
950#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
951 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
952
953static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
954 .ce_shared = QCE_CE_SHARED,
955 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
956 .hw_key_support = QCE_HW_KEY_SUPPORT,
957 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800958 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700959};
960
961static struct platform_device qcrypto_device = {
962 .name = "qcrypto",
963 .id = 0,
964 .num_resources = ARRAY_SIZE(qcrypto_resources),
965 .resource = qcrypto_resources,
966 .dev = {
967 .coherent_dma_mask = DMA_BIT_MASK(32),
968 .platform_data = &qcrypto_ce_hw_suppport,
969 },
970};
971#endif
972
973#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
974 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
975
976static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
977 .ce_shared = QCE_CE_SHARED,
978 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
979 .hw_key_support = QCE_HW_KEY_SUPPORT,
980 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800981 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700982};
983
984static struct platform_device qcedev_device = {
985 .name = "qce",
986 .id = 0,
987 .num_resources = ARRAY_SIZE(qcedev_resources),
988 .resource = qcedev_resources,
989 .dev = {
990 .coherent_dma_mask = DMA_BIT_MASK(32),
991 .platform_data = &qcedev_ce_hw_suppport,
992 },
993};
994#endif
995
Joel Kingdacbc822012-01-25 13:30:57 -0800996static struct mdm_platform_data mdm_platform_data = {
997 .mdm_version = "3.0",
998 .ramdump_delay_ms = 2000,
Hemant Kumara945b472012-01-25 15:08:06 -0800999 .peripheral_platform_device = &apq8064_device_hsic_host,
Joel Kingdacbc822012-01-25 13:30:57 -08001000};
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001001
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001002static struct tsens_platform_data apq_tsens_pdata = {
1003 .tsens_factor = 1000,
1004 .hw_type = APQ_8064,
1005 .tsens_num_sensor = 11,
1006 .slope = {1176, 1176, 1154, 1176, 1111,
1007 1132, 1132, 1199, 1132, 1199, 1132},
1008};
1009
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001010#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001011static void __init apq8064_map_io(void)
1012{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001013 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001014 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001015 if (socinfo_init() < 0)
1016 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001017}
1018
1019static void __init apq8064_init_irq(void)
1020{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001021 struct msm_mpm_device_data *data = NULL;
1022
1023#ifdef CONFIG_MSM_MPM
1024 data = &apq8064_mpm_dev_data;
1025#endif
1026
1027 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001028 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1029 (void *)MSM_QGIC_CPU_BASE);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001030}
1031
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001032static struct platform_device msm8064_device_saw_regulator_core0 = {
1033 .name = "saw-regulator",
1034 .id = 0,
1035 .dev = {
1036 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
1037 },
1038};
1039
1040static struct platform_device msm8064_device_saw_regulator_core1 = {
1041 .name = "saw-regulator",
1042 .id = 1,
1043 .dev = {
1044 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
1045 },
1046};
1047
1048static struct platform_device msm8064_device_saw_regulator_core2 = {
1049 .name = "saw-regulator",
1050 .id = 2,
1051 .dev = {
1052 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
1053 },
1054};
1055
1056static struct platform_device msm8064_device_saw_regulator_core3 = {
1057 .name = "saw-regulator",
1058 .id = 3,
1059 .dev = {
1060 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001061
1062 },
1063};
1064
1065static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
1066 {
1067 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1068 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1069 true,
1070 100, 8000, 100000, 1,
1071 },
1072
1073 {
1074 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1075 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1076 true,
1077 2000, 6000, 60100000, 3000,
1078 },
1079
1080 {
1081 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1082 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1083 false,
1084 4200, 5000, 60350000, 3500,
1085 },
1086
1087 {
1088 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1089 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
1090 false,
1091 6300, 4500, 65350000, 4800,
1092 },
1093
1094 {
1095 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1096 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1097 false,
1098 11700, 2500, 67850000, 5500,
1099 },
1100
1101 {
1102 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1103 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1104 false,
1105 13800, 2000, 71850000, 6800,
1106 },
1107
1108 {
1109 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1110 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1111 false,
1112 29700, 500, 75850000, 8800,
1113 },
1114
1115 {
1116 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1117 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1118 false,
1119 29700, 0, 76350000, 9800,
1120 },
1121};
1122
1123static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1124 .mode = MSM_PM_BOOT_CONFIG_TZ,
1125};
1126
1127static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
1128 .levels = &msm_rpmrs_levels[0],
1129 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
1130 .vdd_mem_levels = {
1131 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
1132 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
1133 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
1134 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
1135 },
1136 .vdd_dig_levels = {
1137 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
1138 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
1139 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
1140 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
1141 },
1142 .vdd_mask = 0x7FFFFF,
1143 .rpmrs_target_id = {
1144 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
1145 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
1146 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
1147 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
1148 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
1149 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
1150 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
1151 },
1152};
1153
1154static struct msm_cpuidle_state msm_cstates[] __initdata = {
1155 {0, 0, "C0", "WFI",
1156 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1157
1158 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1159 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1160
1161 {0, 2, "C2", "POWER_COLLAPSE",
1162 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
1163
1164 {1, 0, "C0", "WFI",
1165 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1166
1167 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1168 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1169
1170 {2, 0, "C0", "WFI",
1171 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1172
1173 {2, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1174 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1175
1176 {3, 0, "C0", "WFI",
1177 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1178
1179 {3, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1180 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1181};
1182
1183static struct msm_pm_platform_data msm_pm_data[] = {
1184 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1185 .idle_supported = 1,
1186 .suspend_supported = 1,
1187 .idle_enabled = 0,
1188 .suspend_enabled = 0,
1189 },
1190
1191 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1192 .idle_supported = 1,
1193 .suspend_supported = 1,
1194 .idle_enabled = 0,
1195 .suspend_enabled = 0,
1196 },
1197
1198 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1199 .idle_supported = 1,
1200 .suspend_supported = 1,
1201 .idle_enabled = 1,
1202 .suspend_enabled = 1,
1203 },
1204
1205 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1206 .idle_supported = 0,
1207 .suspend_supported = 1,
1208 .idle_enabled = 0,
1209 .suspend_enabled = 0,
1210 },
1211
1212 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1213 .idle_supported = 1,
1214 .suspend_supported = 1,
1215 .idle_enabled = 0,
1216 .suspend_enabled = 0,
1217 },
1218
1219 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1220 .idle_supported = 1,
1221 .suspend_supported = 0,
1222 .idle_enabled = 1,
1223 .suspend_enabled = 0,
1224 },
1225
1226 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1227 .idle_supported = 0,
1228 .suspend_supported = 1,
1229 .idle_enabled = 0,
1230 .suspend_enabled = 0,
1231 },
1232
1233 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1234 .idle_supported = 1,
1235 .suspend_supported = 1,
1236 .idle_enabled = 0,
1237 .suspend_enabled = 0,
1238 },
1239
1240 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1241 .idle_supported = 1,
1242 .suspend_supported = 0,
1243 .idle_enabled = 1,
1244 .suspend_enabled = 0,
1245 },
1246
1247 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1248 .idle_supported = 0,
1249 .suspend_supported = 1,
1250 .idle_enabled = 0,
1251 .suspend_enabled = 0,
1252 },
1253
1254 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1255 .idle_supported = 1,
1256 .suspend_supported = 1,
1257 .idle_enabled = 0,
1258 .suspend_enabled = 0,
1259 },
1260
1261 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1262 .idle_supported = 1,
1263 .suspend_supported = 0,
1264 .idle_enabled = 1,
1265 .suspend_enabled = 0,
1266 },
1267};
1268
1269static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1270 0x03, 0x0f,
1271};
1272
1273static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1274 0x00, 0x24, 0x54, 0x10,
1275 0x09, 0x03, 0x01,
1276 0x10, 0x54, 0x30, 0x0C,
1277 0x24, 0x30, 0x0f,
1278};
1279
1280static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1281 0x00, 0x24, 0x54, 0x10,
1282 0x09, 0x07, 0x01, 0x0B,
1283 0x10, 0x54, 0x30, 0x0C,
1284 0x24, 0x30, 0x0f,
1285};
1286
1287static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1288 [0] = {
1289 .mode = MSM_SPM_MODE_CLOCK_GATING,
1290 .notify_rpm = false,
1291 .cmd = spm_wfi_cmd_sequence,
1292 },
1293 [1] = {
1294 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1295 .notify_rpm = false,
1296 .cmd = spm_power_collapse_without_rpm,
1297 },
1298 [2] = {
1299 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1300 .notify_rpm = true,
1301 .cmd = spm_power_collapse_with_rpm,
1302 },
1303};
1304
1305static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1306 0x00, 0x20, 0x03, 0x20,
1307 0x00, 0x0f,
1308};
1309
1310static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1311 0x00, 0x20, 0x34, 0x64,
1312 0x48, 0x07, 0x48, 0x20,
1313 0x50, 0x64, 0x04, 0x34,
1314 0x50, 0x0f,
1315};
1316static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1317 0x00, 0x10, 0x34, 0x64,
1318 0x48, 0x07, 0x48, 0x10,
1319 0x50, 0x64, 0x04, 0x34,
1320 0x50, 0x0F,
1321};
1322
1323static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1324 [0] = {
1325 .mode = MSM_SPM_L2_MODE_RETENTION,
1326 .notify_rpm = false,
1327 .cmd = l2_spm_wfi_cmd_sequence,
1328 },
1329 [1] = {
1330 .mode = MSM_SPM_L2_MODE_GDHS,
1331 .notify_rpm = true,
1332 .cmd = l2_spm_gdhs_cmd_sequence,
1333 },
1334 [2] = {
1335 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1336 .notify_rpm = true,
1337 .cmd = l2_spm_power_off_cmd_sequence,
1338 },
1339};
1340
1341
1342static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1343 [0] = {
1344 .reg_base_addr = MSM_SAW_L2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001345 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
1346 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1347 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1348 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1349 .modes = msm_spm_l2_seq_list,
1350 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1351 },
1352};
1353
1354static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1355 [0] = {
1356 .reg_base_addr = MSM_SAW0_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001357 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001358#if defined(CONFIG_MSM_AVS_HW)
1359 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1360 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1361#endif
1362 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1363 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1364 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1365 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1366 .vctl_timeout_us = 50,
1367 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1368 .modes = msm_spm_seq_list,
1369 },
1370 [1] = {
1371 .reg_base_addr = MSM_SAW1_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001372 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001373#if defined(CONFIG_MSM_AVS_HW)
1374 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1375 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1376#endif
1377 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1378 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1379 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1380 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1381 .vctl_timeout_us = 50,
1382 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1383 .modes = msm_spm_seq_list,
1384 },
1385 [2] = {
1386 .reg_base_addr = MSM_SAW2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001387 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001388#if defined(CONFIG_MSM_AVS_HW)
1389 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1390 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1391#endif
1392 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1393 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1394 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1395 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1396 .vctl_timeout_us = 50,
1397 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1398 .modes = msm_spm_seq_list,
1399 },
1400 [3] = {
1401 .reg_base_addr = MSM_SAW3_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001402 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001403#if defined(CONFIG_MSM_AVS_HW)
1404 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1405 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1406#endif
1407 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1408 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1409 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1410 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1411 .vctl_timeout_us = 50,
1412 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1413 .modes = msm_spm_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001414 },
1415};
1416
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001417static void __init apq8064_init_buses(void)
1418{
1419 msm_bus_rpm_set_mt_mask();
1420 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
1421 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
1422 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
1423 msm_bus_8064_apps_fabric.dev.platform_data =
1424 &msm_bus_8064_apps_fabric_pdata;
1425 msm_bus_8064_sys_fabric.dev.platform_data =
1426 &msm_bus_8064_sys_fabric_pdata;
1427 msm_bus_8064_mm_fabric.dev.platform_data =
1428 &msm_bus_8064_mm_fabric_pdata;
1429 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
1430 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
1431}
1432
David Collinsf0d00732012-01-25 15:46:50 -08001433static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
1434 .name = GPIO_REGULATOR_DEV_NAME,
1435 .id = PM8921_MPP_PM_TO_SYS(7),
1436 .dev = {
1437 .platform_data
1438 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
1439 },
1440};
1441
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08001442static struct platform_device apq8064_device_ext_mpp8_vreg __devinitdata = {
1443 .name = GPIO_REGULATOR_DEV_NAME,
1444 .id = PM8921_MPP_PM_TO_SYS(8),
1445 .dev = {
1446 .platform_data
1447 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_MPP8],
1448 },
1449};
1450
David Collinsf0d00732012-01-25 15:46:50 -08001451static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
1452 .name = GPIO_REGULATOR_DEV_NAME,
1453 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
1454 .dev = {
1455 .platform_data =
1456 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
1457 },
1458};
1459
David Collins390fc332012-02-07 14:38:16 -08001460static struct platform_device apq8064_device_ext_ts_sw_vreg __devinitdata = {
1461 .name = GPIO_REGULATOR_DEV_NAME,
1462 .id = PM8921_GPIO_PM_TO_SYS(23),
1463 .dev = {
1464 .platform_data
1465 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_TS_SW],
1466 },
1467};
1468
David Collins2782b5c2012-02-06 10:02:42 -08001469static struct platform_device apq8064_device_rpm_regulator __devinitdata = {
1470 .name = "rpm-regulator",
1471 .id = -1,
1472 .dev = {
1473 .platform_data = &apq8064_rpm_regulator_pdata,
1474 },
1475};
1476
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001477static struct platform_device *common_devices[] __initdata = {
Jin Hong01f2dbb2011-11-03 22:13:51 -07001478 &apq8064_device_dmov,
David Keitel3c40fc52012-02-09 17:53:52 -08001479 &apq8064_device_qup_i2c_gsbi1,
Jing Lin04601f92012-02-05 15:36:07 -08001480 &apq8064_device_qup_i2c_gsbi3,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001481 &apq8064_device_qup_i2c_gsbi4,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001482 &apq8064_device_qup_spi_gsbi5,
David Collinsf0d00732012-01-25 15:46:50 -08001483 &apq8064_device_ext_5v_vreg,
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08001484 &apq8064_device_ext_mpp8_vreg,
David Collinsf0d00732012-01-25 15:46:50 -08001485 &apq8064_device_ext_3p3v_vreg,
David Collins390fc332012-02-07 14:38:16 -08001486 &apq8064_device_ext_ts_sw_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07001487 &apq8064_device_ssbi_pmic1,
1488 &apq8064_device_ssbi_pmic2,
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001489 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07001490 &apq8064_device_otg,
1491 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08001492 &apq8064_device_hsusb_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07001493 &android_usb_device,
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001494 &msm_device_wcnss_wlan,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001495#ifdef CONFIG_ANDROID_PMEM
1496#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -07001497 &android_pmem_device,
1498 &android_pmem_adsp_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001499#endif
Kevin Chan13be4e22011-10-20 11:30:32 -07001500 &android_pmem_audio_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001501#endif
1502#ifdef CONFIG_ION_MSM
1503 &ion_dev,
1504#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001505 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001506 &msm8064_device_saw_regulator_core0,
1507 &msm8064_device_saw_regulator_core1,
1508 &msm8064_device_saw_regulator_core2,
1509 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001510#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1511 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1512 &qcrypto_device,
1513#endif
1514
1515#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1516 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1517 &qcedev_device,
1518#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07001519
1520#ifdef CONFIG_HW_RANDOM_MSM
1521 &apq8064_device_rng,
1522#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08001523 &apq_pcm,
1524 &apq_pcm_routing,
1525 &apq_cpudai0,
1526 &apq_cpudai1,
1527 &apq_cpudai_hdmi_rx,
1528 &apq_cpudai_bt_rx,
1529 &apq_cpudai_bt_tx,
1530 &apq_cpudai_fm_rx,
1531 &apq_cpudai_fm_tx,
1532 &apq_cpu_fe,
1533 &apq_stub_codec,
1534 &apq_voice,
1535 &apq_voip,
1536 &apq_lpa_pcm,
1537 &apq_pcm_hostless,
1538 &apq_cpudai_afe_01_rx,
1539 &apq_cpudai_afe_01_tx,
1540 &apq_cpudai_afe_02_rx,
1541 &apq_cpudai_afe_02_tx,
1542 &apq_pcm_afe,
1543 &apq_cpudai_auxpcm_rx,
1544 &apq_cpudai_auxpcm_tx,
Neema Shetty8427c262012-02-16 11:23:43 -08001545 &apq_cpudai_stub,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001546 &apq8064_rpm_device,
1547 &apq8064_rpm_log_device,
1548 &apq8064_rpm_stat_device,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001549 &msm_bus_8064_apps_fabric,
1550 &msm_bus_8064_sys_fabric,
1551 &msm_bus_8064_mm_fabric,
1552 &msm_bus_8064_sys_fpb,
1553 &msm_bus_8064_cpss_fpb,
Mohan Kumar Gubbihalli Lachma Naik7f72edd2012-02-06 17:26:47 -08001554 &apq8064_msm_device_vidc,
Matt Wagantalled832652012-02-02 19:23:17 -08001555 &msm_8960_riva,
Matt Wagantallb94b9a52012-02-02 21:59:54 -08001556 &msm_8960_q6_lpass,
Matt Wagantall292aace2012-01-26 19:12:34 -08001557 &msm_gss,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001558};
1559
Joel King4e7ad222011-08-17 15:47:38 -07001560static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001561 &apq8064_device_uart_gsbi3,
Yan He06913ce2011-08-26 16:33:46 -07001562 &msm_device_sps_apq8064,
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001563};
1564
1565static struct platform_device *rumi3_devices[] __initdata = {
1566 &apq8064_device_uart_gsbi1,
Yan He435ed612011-11-23 17:34:59 -08001567 &msm_device_sps_apq8064,
Huaibin Yang4a084e32011-12-15 15:25:52 -08001568#ifdef CONFIG_MSM_ROTATOR
1569 &msm_rotator_device,
1570#endif
Joel King4e7ad222011-08-17 15:47:38 -07001571};
1572
Joel King82b7e3f2012-01-05 10:03:27 -08001573static struct platform_device *cdp_devices[] __initdata = {
1574 &apq8064_device_uart_gsbi1,
Jin Hong4bbbfba2012-02-02 21:48:07 -08001575 &apq8064_device_uart_gsbi7,
Joel King82b7e3f2012-01-05 10:03:27 -08001576 &msm_device_sps_apq8064,
1577};
1578
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001579static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08001580 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001581};
1582
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001583#define KS8851_IRQ_GPIO 43
1584
1585static struct spi_board_info spi_board_info[] __initdata = {
1586 {
1587 .modalias = "ks8851",
1588 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1589 .max_speed_hz = 19200000,
1590 .bus_num = 0,
1591 .chip_select = 2,
1592 .mode = SPI_MODE_0,
1593 },
1594};
1595
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001596static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001597 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001598 .bus_num = 1,
1599 .slim_slave = &apq8064_slim_tabla,
1600 },
1601 {
1602 .bus_num = 1,
1603 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001604 },
1605 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001606};
1607
David Keitel3c40fc52012-02-09 17:53:52 -08001608static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi1_pdata = {
1609 .clk_freq = 100000,
1610 .src_clk_rate = 24000000,
1611};
1612
Jing Lin04601f92012-02-05 15:36:07 -08001613static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi3_pdata = {
1614 .clk_freq = 100000,
1615 .src_clk_rate = 24000000,
1616};
1617
Kenneth Heitke748593a2011-07-15 15:45:11 -06001618static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
1619 .clk_freq = 100000,
1620 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001621};
1622
David Keitel3c40fc52012-02-09 17:53:52 -08001623#define GSBI_DUAL_MODE_CODE 0x60
1624#define MSM_GSBI1_PHYS 0x12440000
Kenneth Heitke748593a2011-07-15 15:45:11 -06001625static void __init apq8064_i2c_init(void)
1626{
David Keitel3c40fc52012-02-09 17:53:52 -08001627 void __iomem *gsbi_mem;
1628
1629 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
1630 &apq8064_i2c_qup_gsbi1_pdata;
1631 gsbi_mem = ioremap_nocache(MSM_GSBI1_PHYS, 4);
1632 writel_relaxed(GSBI_DUAL_MODE_CODE, gsbi_mem);
1633 /* Ensure protocol code is written before proceeding */
1634 wmb();
1635 iounmap(gsbi_mem);
1636 apq8064_i2c_qup_gsbi1_pdata.use_gsbi_shared_mode = 1;
Jing Lin04601f92012-02-05 15:36:07 -08001637 apq8064_device_qup_i2c_gsbi3.dev.platform_data =
1638 &apq8064_i2c_qup_gsbi3_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06001639 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
1640 &apq8064_i2c_qup_gsbi4_pdata;
1641}
1642
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08001643#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001644static int ethernet_init(void)
1645{
1646 int ret;
1647 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
1648 if (ret) {
1649 pr_err("ks8851 gpio_request failed: %d\n", ret);
1650 goto fail;
1651 }
1652
1653 return 0;
1654fail:
1655 return ret;
1656}
1657#else
1658static int ethernet_init(void)
1659{
1660 return 0;
1661}
1662#endif
1663
Mohan Pallaka474b94b2012-01-25 12:59:58 +05301664#define GPIO_KEY_HOME PM8921_GPIO_PM_TO_SYS(27)
1665#define GPIO_KEY_VOLUME_UP PM8921_GPIO_PM_TO_SYS(35)
1666#define GPIO_KEY_VOLUME_DOWN PM8921_GPIO_PM_TO_SYS(38)
1667#define GPIO_KEY_CAM_FOCUS PM8921_GPIO_PM_TO_SYS(3)
1668#define GPIO_KEY_CAM_SNAP PM8921_GPIO_PM_TO_SYS(4)
1669#define GPIO_KEY_ROTATION 46
1670
1671static struct gpio_keys_button cdp_keys[] = {
1672 {
1673 .code = KEY_HOME,
1674 .gpio = GPIO_KEY_HOME,
1675 .desc = "home_key",
1676 .active_low = 1,
1677 .type = EV_KEY,
1678 .wakeup = 1,
1679 .debounce_interval = 15,
1680 },
1681 {
1682 .code = KEY_VOLUMEUP,
1683 .gpio = GPIO_KEY_VOLUME_UP,
1684 .desc = "volume_up_key",
1685 .active_low = 1,
1686 .type = EV_KEY,
1687 .wakeup = 1,
1688 .debounce_interval = 15,
1689 },
1690 {
1691 .code = KEY_VOLUMEDOWN,
1692 .gpio = GPIO_KEY_VOLUME_DOWN,
1693 .desc = "volume_down_key",
1694 .active_low = 1,
1695 .type = EV_KEY,
1696 .wakeup = 1,
1697 .debounce_interval = 15,
1698 },
1699 {
1700 .code = SW_ROTATE_LOCK,
1701 .gpio = GPIO_KEY_ROTATION,
1702 .desc = "rotate_key",
1703 .active_low = 1,
1704 .type = EV_SW,
1705 .debounce_interval = 15,
1706 },
1707};
1708
1709static struct gpio_keys_platform_data cdp_keys_data = {
1710 .buttons = cdp_keys,
1711 .nbuttons = ARRAY_SIZE(cdp_keys),
1712};
1713
1714static struct platform_device cdp_kp_pdev = {
1715 .name = "gpio-keys",
1716 .id = -1,
1717 .dev = {
1718 .platform_data = &cdp_keys_data,
1719 },
1720};
1721
1722static struct gpio_keys_button mtp_keys[] = {
1723 {
1724 .code = KEY_CAMERA_FOCUS,
1725 .gpio = GPIO_KEY_CAM_FOCUS,
1726 .desc = "cam_focus_key",
1727 .active_low = 1,
1728 .type = EV_KEY,
1729 .wakeup = 1,
1730 .debounce_interval = 15,
1731 },
1732 {
1733 .code = KEY_VOLUMEUP,
1734 .gpio = GPIO_KEY_VOLUME_UP,
1735 .desc = "volume_up_key",
1736 .active_low = 1,
1737 .type = EV_KEY,
1738 .wakeup = 1,
1739 .debounce_interval = 15,
1740 },
1741 {
1742 .code = KEY_VOLUMEDOWN,
1743 .gpio = GPIO_KEY_VOLUME_DOWN,
1744 .desc = "volume_down_key",
1745 .active_low = 1,
1746 .type = EV_KEY,
1747 .wakeup = 1,
1748 .debounce_interval = 15,
1749 },
1750 {
1751 .code = KEY_CAMERA_SNAPSHOT,
1752 .gpio = GPIO_KEY_CAM_SNAP,
1753 .desc = "cam_snap_key",
1754 .active_low = 1,
1755 .type = EV_KEY,
1756 .debounce_interval = 15,
1757 },
1758};
1759
1760static struct gpio_keys_platform_data mtp_keys_data = {
1761 .buttons = mtp_keys,
1762 .nbuttons = ARRAY_SIZE(mtp_keys),
1763};
1764
1765static struct platform_device mtp_kp_pdev = {
1766 .name = "gpio-keys",
1767 .id = -1,
1768 .dev = {
1769 .platform_data = &mtp_keys_data,
1770 },
1771};
1772
1773
Tianyi Gou41515e22011-09-01 19:37:43 -07001774static void __init apq8064_clock_init(void)
1775{
Tianyi Gouacb588d2012-01-27 18:24:05 -08001776 if (machine_is_apq8064_rumi3())
Tianyi Gou41515e22011-09-01 19:37:43 -07001777 msm_clock_init(&apq8064_dummy_clock_init_data);
Tianyi Gouacb588d2012-01-27 18:24:05 -08001778 else
1779 msm_clock_init(&apq8064_clock_init_data);
Tianyi Gou41515e22011-09-01 19:37:43 -07001780}
1781
Jing Lin417fa452012-02-05 14:31:06 -08001782#define I2C_SURF 1
1783#define I2C_FFA (1 << 1)
1784#define I2C_RUMI (1 << 2)
1785#define I2C_SIM (1 << 3)
1786#define I2C_LIQUID (1 << 4)
1787
1788struct i2c_registry {
1789 u8 machs;
1790 int bus;
1791 struct i2c_board_info *info;
1792 int len;
1793};
1794
1795static struct i2c_registry apq8064_i2c_devices[] __initdata = {
Jing Lin21ed4de2012-02-05 15:53:28 -08001796 {
1797 I2C_SURF | I2C_LIQUID,
1798 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
1799 mxt_device_info,
1800 ARRAY_SIZE(mxt_device_info),
1801 },
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001802 {
1803 I2C_FFA,
1804 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
1805 cyttsp_info,
1806 ARRAY_SIZE(cyttsp_info),
1807 },
Amy Maloche70090f992012-02-16 16:35:26 -08001808 {
1809 I2C_FFA | I2C_LIQUID,
1810 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
1811 isa1200_board_info,
1812 ARRAY_SIZE(isa1200_board_info),
1813 },
Jing Lin417fa452012-02-05 14:31:06 -08001814};
1815
1816static void __init register_i2c_devices(void)
1817{
1818 u8 mach_mask = 0;
1819 int i;
1820
Kevin Chand07220e2012-02-13 15:52:22 -08001821#ifdef CONFIG_MSM_CAMERA
1822 struct i2c_registry apq8064_camera_i2c_devices = {
1823 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_RUMI,
1824 APQ_8064_GSBI4_QUP_I2C_BUS_ID,
1825 apq8064_camera_board_info.board_info,
1826 apq8064_camera_board_info.num_i2c_board_info,
1827 };
1828#endif
Jing Lin417fa452012-02-05 14:31:06 -08001829 /* Build the matching 'supported_machs' bitmask */
1830 if (machine_is_apq8064_cdp())
1831 mach_mask = I2C_SURF;
1832 else if (machine_is_apq8064_mtp())
1833 mach_mask = I2C_FFA;
1834 else if (machine_is_apq8064_liquid())
1835 mach_mask = I2C_LIQUID;
1836 else if (machine_is_apq8064_rumi3())
1837 mach_mask = I2C_RUMI;
1838 else if (machine_is_apq8064_sim())
1839 mach_mask = I2C_SIM;
1840 else
1841 pr_err("unmatched machine ID in register_i2c_devices\n");
1842
1843 /* Run the array and install devices as appropriate */
1844 for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) {
1845 if (apq8064_i2c_devices[i].machs & mach_mask)
1846 i2c_register_board_info(apq8064_i2c_devices[i].bus,
1847 apq8064_i2c_devices[i].info,
1848 apq8064_i2c_devices[i].len);
1849 }
Kevin Chand07220e2012-02-13 15:52:22 -08001850#ifdef CONFIG_MSM_CAMERA
1851 if (apq8064_camera_i2c_devices.machs & mach_mask)
1852 i2c_register_board_info(apq8064_camera_i2c_devices.bus,
1853 apq8064_camera_i2c_devices.info,
1854 apq8064_camera_i2c_devices.len);
1855#endif
Jing Lin417fa452012-02-05 14:31:06 -08001856}
1857
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001858static void __init apq8064_common_init(void)
1859{
1860 if (socinfo_init() < 0)
1861 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06001862 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
1863 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
David Collins2782b5c2012-02-06 10:02:42 -08001864 regulator_suppress_info_printing();
1865 platform_device_register(&apq8064_device_rpm_regulator);
Tianyi Gou41515e22011-09-01 19:37:43 -07001866 apq8064_clock_init();
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08001867 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06001868 apq8064_i2c_init();
Jing Lin417fa452012-02-05 14:31:06 -08001869 register_i2c_devices();
Kenneth Heitke36920d32011-07-20 16:44:30 -06001870
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001871 apq8064_device_qup_spi_gsbi5.dev.platform_data =
1872 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08001873 apq8064_init_pmic();
Hemant Kumar94e7da22012-02-03 16:52:29 -08001874 if (machine_is_apq8064_liquid())
1875 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001876 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Manu Gautam91223e02011-11-08 15:27:22 +05301877 apq8064_ehci_host_init();
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001878 apq8064_init_buses();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001879 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Hemant Kumarf1ca9192012-02-07 18:59:33 -08001880 if (machine_is_apq8064_mtp()) {
1881 apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
1882 device_initialize(&apq8064_device_hsic_host.dev);
1883 }
Jay Chokshie8741282012-01-25 15:22:55 -08001884 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05301885 apq8064_init_mmc();
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08001886
1887 if (machine_is_apq8064_mtp()) {
1888 mdm_8064_device.dev.platform_data = &mdm_platform_data;
1889 platform_device_register(&mdm_8064_device);
1890 }
1891 platform_device_register(&apq8064_slim_ctrl);
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001892 slim_register_board_info(apq8064_slim_devices,
1893 ARRAY_SIZE(apq8064_slim_devices));
Praveen Chidambaram78499012011-11-01 17:15:17 -06001894 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Mahesh Sivasubramaniancbce1ec2012-01-24 10:32:44 -07001895 acpuclk_init(&acpuclk_8064_soc_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06001896 msm_spm_l2_init(msm_spm_l2_data);
1897 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
1898 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
1899 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
1900 msm_pm_data);
1901 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001902}
1903
Huaibin Yang4a084e32011-12-15 15:25:52 -08001904static void __init apq8064_allocate_memory_regions(void)
1905{
1906 apq8064_allocate_fb_region();
1907}
1908
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001909static void __init apq8064_sim_init(void)
1910{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001911 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
1912 &msm8064_device_watchdog.dev.platform_data;
1913
1914 wdog_pdata->bark_time = 15000;
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001915 msm_tsens_early_init(&apq_tsens_pdata);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001916 apq8064_common_init();
Joel King4e7ad222011-08-17 15:47:38 -07001917 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
1918}
1919
1920static void __init apq8064_rumi3_init(void)
1921{
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001922 msm_tsens_early_init(&apq_tsens_pdata);
Joel King4e7ad222011-08-17 15:47:38 -07001923 apq8064_common_init();
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001924 ethernet_init();
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001925 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001926 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Huaibin Yang4a084e32011-12-15 15:25:52 -08001927 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07001928 apq8064_init_gpu();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001929}
1930
Joel King82b7e3f2012-01-05 10:03:27 -08001931static void __init apq8064_cdp_init(void)
1932{
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001933 msm_tsens_early_init(&apq_tsens_pdata);
Joel King82b7e3f2012-01-05 10:03:27 -08001934 apq8064_common_init();
1935 ethernet_init();
1936 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
1937 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08001938 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07001939 apq8064_init_gpu();
Matt Wagantall1875d322012-02-22 16:11:33 -08001940 platform_add_devices(apq8064_fs_devices, apq8064_num_fs_devices);
Kevin Chand07220e2012-02-13 15:52:22 -08001941 apq8064_init_cam();
Mohan Pallaka474b94b2012-01-25 12:59:58 +05301942
1943 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
1944 platform_device_register(&cdp_kp_pdev);
1945
1946 if (machine_is_apq8064_mtp())
1947 platform_device_register(&mtp_kp_pdev);
Joel King82b7e3f2012-01-05 10:03:27 -08001948}
1949
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001950MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
1951 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07001952 .reserve = apq8064_reserve,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001953 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05301954 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001955 .timer = &msm_timer,
1956 .init_machine = apq8064_sim_init,
1957MACHINE_END
1958
Joel King4e7ad222011-08-17 15:47:38 -07001959MACHINE_START(APQ8064_RUMI3, "QCT APQ8064 RUMI3")
1960 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07001961 .reserve = apq8064_reserve,
Joel King4e7ad222011-08-17 15:47:38 -07001962 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05301963 .handle_irq = gic_handle_irq,
Joel King4e7ad222011-08-17 15:47:38 -07001964 .timer = &msm_timer,
1965 .init_machine = apq8064_rumi3_init,
Huaibin Yang4a084e32011-12-15 15:25:52 -08001966 .init_early = apq8064_allocate_memory_regions,
Joel King4e7ad222011-08-17 15:47:38 -07001967MACHINE_END
1968
Joel King82b7e3f2012-01-05 10:03:27 -08001969MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
1970 .map_io = apq8064_map_io,
1971 .reserve = apq8064_reserve,
1972 .init_irq = apq8064_init_irq,
1973 .handle_irq = gic_handle_irq,
1974 .timer = &msm_timer,
1975 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08001976 .init_early = apq8064_allocate_memory_regions,
Joel King82b7e3f2012-01-05 10:03:27 -08001977MACHINE_END
1978
1979MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
1980 .map_io = apq8064_map_io,
1981 .reserve = apq8064_reserve,
1982 .init_irq = apq8064_init_irq,
1983 .handle_irq = gic_handle_irq,
1984 .timer = &msm_timer,
1985 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08001986 .init_early = apq8064_allocate_memory_regions,
Joel King82b7e3f2012-01-05 10:03:27 -08001987MACHINE_END
1988
1989MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
1990 .map_io = apq8064_map_io,
1991 .reserve = apq8064_reserve,
1992 .init_irq = apq8064_init_irq,
1993 .handle_irq = gic_handle_irq,
1994 .timer = &msm_timer,
1995 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08001996 .init_early = apq8064_allocate_memory_regions,
Joel King82b7e3f2012-01-05 10:03:27 -08001997MACHINE_END
1998
Joel King11ca8202012-02-13 16:19:03 -08001999MACHINE_START(MPQ8064_HRD, "QCT MPQ8064 HRD")
2000 .map_io = apq8064_map_io,
2001 .reserve = apq8064_reserve,
2002 .init_irq = apq8064_init_irq,
2003 .handle_irq = gic_handle_irq,
2004 .timer = &msm_timer,
2005 .init_machine = apq8064_cdp_init,
2006MACHINE_END
2007
2008MACHINE_START(MPQ8064_DTV, "QCT MPQ8064 DTV")
2009 .map_io = apq8064_map_io,
2010 .reserve = apq8064_reserve,
2011 .init_irq = apq8064_init_irq,
2012 .handle_irq = gic_handle_irq,
2013 .timer = &msm_timer,
2014 .init_machine = apq8064_cdp_init,
2015MACHINE_END
2016