blob: 359befe2e4399c889ed317523b7db24cbde968f1 [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
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800478#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
479
480/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
481 * 4 micbiases are used to power various analog and digital
482 * microphones operating at 1800 mV. Technically, all micbiases
483 * can source from single cfilter since all microphones operate
484 * at the same voltage level. The arrangement below is to make
485 * sure all cfilters are exercised. LDO_H regulator ouput level
486 * does not need to be as high as 2.85V. It is choosen for
487 * microphone sensitivity purpose.
488 */
489static struct tabla_pdata apq8064_tabla_platform_data = {
490 .slimbus_slave_device = {
491 .name = "tabla-slave",
492 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
493 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800494 .irq = MSM_GPIO_TO_INT(42),
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800495 .irq_base = TABLA_INTERRUPT_BASE,
496 .num_irqs = NR_TABLA_IRQS,
497 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
498 .micbias = {
499 .ldoh_v = TABLA_LDOH_2P85_V,
500 .cfilt1_mv = 1800,
501 .cfilt2_mv = 1800,
502 .cfilt3_mv = 1800,
503 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
504 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
505 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
506 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
507 }
508};
509
510static struct slim_device apq8064_slim_tabla = {
511 .name = "tabla-slim",
512 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
513 .dev = {
514 .platform_data = &apq8064_tabla_platform_data,
515 },
516};
517
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800518static struct tabla_pdata apq8064_tabla20_platform_data = {
519 .slimbus_slave_device = {
520 .name = "tabla-slave",
521 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
522 },
523 .irq = MSM_GPIO_TO_INT(42),
524 .irq_base = TABLA_INTERRUPT_BASE,
525 .num_irqs = NR_TABLA_IRQS,
526 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
527 .micbias = {
528 .ldoh_v = TABLA_LDOH_2P85_V,
529 .cfilt1_mv = 1800,
530 .cfilt2_mv = 1800,
531 .cfilt3_mv = 1800,
532 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
533 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
534 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
535 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
536 }
537};
538
539static struct slim_device apq8064_slim_tabla20 = {
540 .name = "tabla2x-slim",
541 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
542 .dev = {
543 .platform_data = &apq8064_tabla20_platform_data,
544 },
545};
546
Amy Maloche70090f992012-02-16 16:35:26 -0800547#define HAP_SHIFT_LVL_OE_GPIO PM8921_MPP_PM_TO_SYS(8)
548#define ISA1200_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
549#define ISA1200_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
550#define ISA1200_HAP_CLK PM8921_GPIO_PM_TO_SYS(44)
551
552static int isa1200_power(int on)
553{
554 gpio_set_value_cansleep(ISA1200_HAP_CLK, !!on);
555
556 return 0;
557}
558
559static int isa1200_dev_setup(bool enable)
560{
561 int rc = 0;
562
563 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_1, enable);
564 if (rc) {
565 pr_err("%s: unable to write aux clock register(%d)\n",
566 __func__, rc);
567 return rc;
568 }
569
570 if (!enable)
571 goto free_gpio;
572
573 rc = gpio_request(ISA1200_HAP_CLK, "haptics_clk");
574 if (rc) {
575 pr_err("%s: unable to request gpio %d config(%d)\n",
576 __func__, ISA1200_HAP_CLK, rc);
577 return rc;
578 }
579
580 rc = gpio_direction_output(ISA1200_HAP_CLK, 0);
581 if (rc) {
582 pr_err("%s: unable to set direction\n", __func__);
583 goto free_gpio;
584 }
585
586 return 0;
587
588free_gpio:
589 gpio_free(ISA1200_HAP_CLK);
590 return rc;
591}
592
593static struct isa1200_regulator isa1200_reg_data[] = {
594 {
595 .name = "vddp",
596 .min_uV = ISA_I2C_VTG_MIN_UV,
597 .max_uV = ISA_I2C_VTG_MAX_UV,
598 .load_uA = ISA_I2C_CURR_UA,
599 },
600};
601
602static struct isa1200_platform_data isa1200_1_pdata = {
603 .name = "vibrator",
604 .dev_setup = isa1200_dev_setup,
605 .power_on = isa1200_power,
606 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
607 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
608 .max_timeout = 15000,
609 .mode_ctrl = PWM_GEN_MODE,
610 .pwm_fd = {
611 .pwm_div = 256,
612 },
613 .is_erm = false,
614 .smart_en = true,
615 .ext_clk_en = true,
616 .chip_en = 1,
617 .regulator_info = isa1200_reg_data,
618 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
619};
620
621static struct i2c_board_info isa1200_board_info[] __initdata = {
622 {
623 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
624 .platform_data = &isa1200_1_pdata,
625 },
626};
Jing Lin21ed4de2012-02-05 15:53:28 -0800627/* configuration data for mxt1386e using V2.1 firmware */
628static const u8 mxt1386e_config_data_v2_1[] = {
629 /* T6 Object */
630 0, 0, 0, 0, 0, 0,
631 /* T38 Object */
632 14, 0, 0, 24, 1, 12, 0, 0, 0, 0,
633 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
634 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
635 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
636 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
637 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
638 0, 0, 0, 0,
639 /* T7 Object */
640 100, 16, 50,
641 /* T8 Object */
642 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
643 /* T9 Object */
644 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
645 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
646 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
647 10, 5, 0, 0, 0,
648 /* T18 Object */
649 0, 0,
650 /* T24 Object */
651 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
652 0, 0, 0, 0, 0, 0, 0, 0, 0,
653 /* T25 Object */
654 3, 0, 60, 115, 156, 99,
655 /* T27 Object */
656 0, 0, 0, 0, 0, 0, 0,
657 /* T40 Object */
658 0, 0, 0, 0, 0,
659 /* T42 Object */
660 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
661 /* T43 Object */
662 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
663 16,
664 /* T46 Object */
665 64, 0, 20, 20, 0, 0, 0, 0, 0,
666 /* T47 Object */
667 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
668 /* T48 Object */
669 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
670 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
671 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
672 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
673 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
674 0, 0, 0, 0,
675 /* T56 Object */
676 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
677 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
678 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
679 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
680 2, 99, 33, 0, 149, 24, 193, 255, 255, 255,
681 255,
682};
683
684#define MXT_TS_GPIO_IRQ 6
685#define MXT_TS_PWR_EN_GPIO PM8921_GPIO_PM_TO_SYS(23)
686#define MXT_TS_RESET_GPIO 33
687
688static struct mxt_config_info mxt_config_array[] = {
689 {
690 .config = mxt1386e_config_data_v2_1,
691 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
692 .family_id = 0xA0,
693 .variant_id = 0x7,
694 .version = 0x21,
695 .build = 0xAA,
696 },
697};
698
699static struct mxt_platform_data mxt_platform_data = {
700 .config_array = mxt_config_array,
701 .config_array_size = ARRAY_SIZE(mxt_config_array),
702 .x_size = 1365,
703 .y_size = 767,
704 .irqflags = IRQF_TRIGGER_FALLING,
705 .i2c_pull_up = true,
706 .reset_gpio = MXT_TS_RESET_GPIO,
707 .irq_gpio = MXT_TS_GPIO_IRQ,
708};
709
710static struct i2c_board_info mxt_device_info[] __initdata = {
711 {
712 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
713 .platform_data = &mxt_platform_data,
714 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
715 },
716};
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -0800717#define CYTTSP_TS_GPIO_IRQ 6
718#define CYTTSP_TS_GPIO_RESOUT 7
719#define CYTTSP_TS_GPIO_SLEEP 33
720
721static ssize_t tma340_vkeys_show(struct kobject *kobj,
722 struct kobj_attribute *attr, char *buf)
723{
724 return snprintf(buf, 200,
725 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
726 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
727 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
728 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
729 "\n");
730}
731
732static struct kobj_attribute tma340_vkeys_attr = {
733 .attr = {
734 .mode = S_IRUGO,
735 },
736 .show = &tma340_vkeys_show,
737};
738
739static struct attribute *tma340_properties_attrs[] = {
740 &tma340_vkeys_attr.attr,
741 NULL
742};
743
744static struct attribute_group tma340_properties_attr_group = {
745 .attrs = tma340_properties_attrs,
746};
747
748static int cyttsp_platform_init(struct i2c_client *client)
749{
750 int rc = 0;
751 static struct kobject *tma340_properties_kobj;
752
753 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
754 tma340_properties_kobj = kobject_create_and_add("board_properties",
755 NULL);
756 if (tma340_properties_kobj)
757 rc = sysfs_create_group(tma340_properties_kobj,
758 &tma340_properties_attr_group);
759 if (!tma340_properties_kobj || rc)
760 pr_err("%s: failed to create board_properties\n",
761 __func__);
762
763 return 0;
764}
765
766static struct cyttsp_regulator cyttsp_regulator_data[] = {
767 {
768 .name = "vdd",
769 .min_uV = CY_TMA300_VTG_MIN_UV,
770 .max_uV = CY_TMA300_VTG_MAX_UV,
771 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
772 .lpm_load_uA = CY_TMA300_CURR_24HZ_UA,
773 },
774 {
775 .name = "vcc_i2c",
776 .min_uV = CY_I2C_VTG_MIN_UV,
777 .max_uV = CY_I2C_VTG_MAX_UV,
778 .hpm_load_uA = CY_I2C_CURR_UA,
779 .lpm_load_uA = CY_I2C_CURR_UA,
780 },
781};
782
783static struct cyttsp_platform_data cyttsp_pdata = {
784 .panel_maxx = 634,
785 .panel_maxy = 1166,
786 .disp_maxx = 599,
787 .disp_maxy = 1023,
788 .disp_minx = 0,
789 .disp_miny = 0,
790 .flags = 0x01,
791 .gen = CY_GEN3,
792 .use_st = CY_USE_ST,
793 .use_mt = CY_USE_MT,
794 .use_hndshk = CY_SEND_HNDSHK,
795 .use_trk_id = CY_USE_TRACKING_ID,
796 .use_sleep = CY_USE_DEEP_SLEEP_SEL,
797 .use_gestures = CY_USE_GESTURES,
798 .fw_fname = "cyttsp_8064_mtp.hex",
799 /* change act_intrvl to customize the Active power state
800 * scanning/processing refresh interval for Operating mode
801 */
802 .act_intrvl = CY_ACT_INTRVL_DFLT,
803 /* change tch_tmout to customize the touch timeout for the
804 * Active power state for Operating mode
805 */
806 .tch_tmout = CY_TCH_TMOUT_DFLT,
807 /* change lp_intrvl to customize the Low Power power state
808 * scanning/processing refresh interval for Operating mode
809 */
810 .lp_intrvl = CY_LP_INTRVL_DFLT,
811 .sleep_gpio = CYTTSP_TS_GPIO_SLEEP,
812 .resout_gpio = CYTTSP_TS_GPIO_RESOUT,
813 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
814 .regulator_info = cyttsp_regulator_data,
815 .num_regulators = ARRAY_SIZE(cyttsp_regulator_data),
816 .init = cyttsp_platform_init,
817 .correct_fw_ver = 17,
818};
819
820static struct i2c_board_info cyttsp_info[] __initdata = {
821 {
822 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
823 .platform_data = &cyttsp_pdata,
824 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
825 },
826};
Jing Lin21ed4de2012-02-05 15:53:28 -0800827
Ankit Verma6b7e2ba2012-01-26 15:48:54 -0800828#define MSM_WCNSS_PHYS 0x03000000
829#define MSM_WCNSS_SIZE 0x280000
830
831static struct resource resources_wcnss_wlan[] = {
832 {
833 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
834 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
835 .name = "wcnss_wlanrx_irq",
836 .flags = IORESOURCE_IRQ,
837 },
838 {
839 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
840 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
841 .name = "wcnss_wlantx_irq",
842 .flags = IORESOURCE_IRQ,
843 },
844 {
845 .start = MSM_WCNSS_PHYS,
846 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
847 .name = "wcnss_mmio",
848 .flags = IORESOURCE_MEM,
849 },
850 {
851 .start = 64,
852 .end = 68,
853 .name = "wcnss_gpios_5wire",
854 .flags = IORESOURCE_IO,
855 },
856};
857
858static struct qcom_wcnss_opts qcom_wcnss_pdata = {
859 .has_48mhz_xo = 1,
860};
861
862static struct platform_device msm_device_wcnss_wlan = {
863 .name = "wcnss_wlan",
864 .id = 0,
865 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
866 .resource = resources_wcnss_wlan,
867 .dev = {.platform_data = &qcom_wcnss_pdata},
868};
869
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700870#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
871 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
872 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
873 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
874
875#define QCE_SIZE 0x10000
876#define QCE_0_BASE 0x11000000
877
878#define QCE_HW_KEY_SUPPORT 0
879#define QCE_SHA_HMAC_SUPPORT 1
880#define QCE_SHARE_CE_RESOURCE 3
881#define QCE_CE_SHARED 0
882
883static struct resource qcrypto_resources[] = {
884 [0] = {
885 .start = QCE_0_BASE,
886 .end = QCE_0_BASE + QCE_SIZE - 1,
887 .flags = IORESOURCE_MEM,
888 },
889 [1] = {
890 .name = "crypto_channels",
891 .start = DMOV8064_CE_IN_CHAN,
892 .end = DMOV8064_CE_OUT_CHAN,
893 .flags = IORESOURCE_DMA,
894 },
895 [2] = {
896 .name = "crypto_crci_in",
897 .start = DMOV8064_CE_IN_CRCI,
898 .end = DMOV8064_CE_IN_CRCI,
899 .flags = IORESOURCE_DMA,
900 },
901 [3] = {
902 .name = "crypto_crci_out",
903 .start = DMOV8064_CE_OUT_CRCI,
904 .end = DMOV8064_CE_OUT_CRCI,
905 .flags = IORESOURCE_DMA,
906 },
907};
908
909static struct resource qcedev_resources[] = {
910 [0] = {
911 .start = QCE_0_BASE,
912 .end = QCE_0_BASE + QCE_SIZE - 1,
913 .flags = IORESOURCE_MEM,
914 },
915 [1] = {
916 .name = "crypto_channels",
917 .start = DMOV8064_CE_IN_CHAN,
918 .end = DMOV8064_CE_OUT_CHAN,
919 .flags = IORESOURCE_DMA,
920 },
921 [2] = {
922 .name = "crypto_crci_in",
923 .start = DMOV8064_CE_IN_CRCI,
924 .end = DMOV8064_CE_IN_CRCI,
925 .flags = IORESOURCE_DMA,
926 },
927 [3] = {
928 .name = "crypto_crci_out",
929 .start = DMOV8064_CE_OUT_CRCI,
930 .end = DMOV8064_CE_OUT_CRCI,
931 .flags = IORESOURCE_DMA,
932 },
933};
934
935#endif
936
937#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
938 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
939
940static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
941 .ce_shared = QCE_CE_SHARED,
942 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
943 .hw_key_support = QCE_HW_KEY_SUPPORT,
944 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800945 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700946};
947
948static struct platform_device qcrypto_device = {
949 .name = "qcrypto",
950 .id = 0,
951 .num_resources = ARRAY_SIZE(qcrypto_resources),
952 .resource = qcrypto_resources,
953 .dev = {
954 .coherent_dma_mask = DMA_BIT_MASK(32),
955 .platform_data = &qcrypto_ce_hw_suppport,
956 },
957};
958#endif
959
960#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
961 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
962
963static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
964 .ce_shared = QCE_CE_SHARED,
965 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
966 .hw_key_support = QCE_HW_KEY_SUPPORT,
967 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800968 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700969};
970
971static struct platform_device qcedev_device = {
972 .name = "qce",
973 .id = 0,
974 .num_resources = ARRAY_SIZE(qcedev_resources),
975 .resource = qcedev_resources,
976 .dev = {
977 .coherent_dma_mask = DMA_BIT_MASK(32),
978 .platform_data = &qcedev_ce_hw_suppport,
979 },
980};
981#endif
982
Joel Kingdacbc822012-01-25 13:30:57 -0800983static struct mdm_platform_data mdm_platform_data = {
984 .mdm_version = "3.0",
985 .ramdump_delay_ms = 2000,
Hemant Kumara945b472012-01-25 15:08:06 -0800986 .peripheral_platform_device = &apq8064_device_hsic_host,
Joel Kingdacbc822012-01-25 13:30:57 -0800987};
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700988
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -0800989static struct tsens_platform_data apq_tsens_pdata = {
990 .tsens_factor = 1000,
991 .hw_type = APQ_8064,
992 .tsens_num_sensor = 11,
993 .slope = {1176, 1176, 1154, 1176, 1111,
994 1132, 1132, 1199, 1132, 1199, 1132},
995};
996
Jeff Hugo0c0f5e92011-09-28 13:55:45 -0600997#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700998static void __init apq8064_map_io(void)
999{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001000 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001001 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001002 if (socinfo_init() < 0)
1003 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001004}
1005
1006static void __init apq8064_init_irq(void)
1007{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001008 struct msm_mpm_device_data *data = NULL;
1009
1010#ifdef CONFIG_MSM_MPM
1011 data = &apq8064_mpm_dev_data;
1012#endif
1013
1014 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001015 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1016 (void *)MSM_QGIC_CPU_BASE);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001017}
1018
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001019static struct platform_device msm8064_device_saw_regulator_core0 = {
1020 .name = "saw-regulator",
1021 .id = 0,
1022 .dev = {
1023 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
1024 },
1025};
1026
1027static struct platform_device msm8064_device_saw_regulator_core1 = {
1028 .name = "saw-regulator",
1029 .id = 1,
1030 .dev = {
1031 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
1032 },
1033};
1034
1035static struct platform_device msm8064_device_saw_regulator_core2 = {
1036 .name = "saw-regulator",
1037 .id = 2,
1038 .dev = {
1039 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
1040 },
1041};
1042
1043static struct platform_device msm8064_device_saw_regulator_core3 = {
1044 .name = "saw-regulator",
1045 .id = 3,
1046 .dev = {
1047 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001048
1049 },
1050};
1051
1052static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
1053 {
1054 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1055 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1056 true,
1057 100, 8000, 100000, 1,
1058 },
1059
1060 {
1061 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1062 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1063 true,
1064 2000, 6000, 60100000, 3000,
1065 },
1066
1067 {
1068 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1069 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1070 false,
1071 4200, 5000, 60350000, 3500,
1072 },
1073
1074 {
1075 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1076 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
1077 false,
1078 6300, 4500, 65350000, 4800,
1079 },
1080
1081 {
1082 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1083 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1084 false,
1085 11700, 2500, 67850000, 5500,
1086 },
1087
1088 {
1089 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1090 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1091 false,
1092 13800, 2000, 71850000, 6800,
1093 },
1094
1095 {
1096 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1097 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1098 false,
1099 29700, 500, 75850000, 8800,
1100 },
1101
1102 {
1103 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1104 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1105 false,
1106 29700, 0, 76350000, 9800,
1107 },
1108};
1109
1110static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1111 .mode = MSM_PM_BOOT_CONFIG_TZ,
1112};
1113
1114static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
1115 .levels = &msm_rpmrs_levels[0],
1116 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
1117 .vdd_mem_levels = {
1118 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
1119 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
1120 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
1121 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
1122 },
1123 .vdd_dig_levels = {
1124 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
1125 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
1126 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
1127 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
1128 },
1129 .vdd_mask = 0x7FFFFF,
1130 .rpmrs_target_id = {
1131 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
1132 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
1133 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
1134 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
1135 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
1136 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
1137 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
1138 },
1139};
1140
1141static struct msm_cpuidle_state msm_cstates[] __initdata = {
1142 {0, 0, "C0", "WFI",
1143 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1144
1145 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1146 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1147
1148 {0, 2, "C2", "POWER_COLLAPSE",
1149 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
1150
1151 {1, 0, "C0", "WFI",
1152 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1153
1154 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1155 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1156
1157 {2, 0, "C0", "WFI",
1158 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1159
1160 {2, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1161 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1162
1163 {3, 0, "C0", "WFI",
1164 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1165
1166 {3, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1167 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1168};
1169
1170static struct msm_pm_platform_data msm_pm_data[] = {
1171 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1172 .idle_supported = 1,
1173 .suspend_supported = 1,
1174 .idle_enabled = 0,
1175 .suspend_enabled = 0,
1176 },
1177
1178 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1179 .idle_supported = 1,
1180 .suspend_supported = 1,
1181 .idle_enabled = 0,
1182 .suspend_enabled = 0,
1183 },
1184
1185 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1186 .idle_supported = 1,
1187 .suspend_supported = 1,
1188 .idle_enabled = 1,
1189 .suspend_enabled = 1,
1190 },
1191
1192 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1193 .idle_supported = 0,
1194 .suspend_supported = 1,
1195 .idle_enabled = 0,
1196 .suspend_enabled = 0,
1197 },
1198
1199 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1200 .idle_supported = 1,
1201 .suspend_supported = 1,
1202 .idle_enabled = 0,
1203 .suspend_enabled = 0,
1204 },
1205
1206 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1207 .idle_supported = 1,
1208 .suspend_supported = 0,
1209 .idle_enabled = 1,
1210 .suspend_enabled = 0,
1211 },
1212
1213 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1214 .idle_supported = 0,
1215 .suspend_supported = 1,
1216 .idle_enabled = 0,
1217 .suspend_enabled = 0,
1218 },
1219
1220 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1221 .idle_supported = 1,
1222 .suspend_supported = 1,
1223 .idle_enabled = 0,
1224 .suspend_enabled = 0,
1225 },
1226
1227 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1228 .idle_supported = 1,
1229 .suspend_supported = 0,
1230 .idle_enabled = 1,
1231 .suspend_enabled = 0,
1232 },
1233
1234 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1235 .idle_supported = 0,
1236 .suspend_supported = 1,
1237 .idle_enabled = 0,
1238 .suspend_enabled = 0,
1239 },
1240
1241 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1242 .idle_supported = 1,
1243 .suspend_supported = 1,
1244 .idle_enabled = 0,
1245 .suspend_enabled = 0,
1246 },
1247
1248 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1249 .idle_supported = 1,
1250 .suspend_supported = 0,
1251 .idle_enabled = 1,
1252 .suspend_enabled = 0,
1253 },
1254};
1255
1256static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1257 0x03, 0x0f,
1258};
1259
1260static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1261 0x00, 0x24, 0x54, 0x10,
1262 0x09, 0x03, 0x01,
1263 0x10, 0x54, 0x30, 0x0C,
1264 0x24, 0x30, 0x0f,
1265};
1266
1267static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1268 0x00, 0x24, 0x54, 0x10,
1269 0x09, 0x07, 0x01, 0x0B,
1270 0x10, 0x54, 0x30, 0x0C,
1271 0x24, 0x30, 0x0f,
1272};
1273
1274static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1275 [0] = {
1276 .mode = MSM_SPM_MODE_CLOCK_GATING,
1277 .notify_rpm = false,
1278 .cmd = spm_wfi_cmd_sequence,
1279 },
1280 [1] = {
1281 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1282 .notify_rpm = false,
1283 .cmd = spm_power_collapse_without_rpm,
1284 },
1285 [2] = {
1286 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1287 .notify_rpm = true,
1288 .cmd = spm_power_collapse_with_rpm,
1289 },
1290};
1291
1292static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1293 0x00, 0x20, 0x03, 0x20,
1294 0x00, 0x0f,
1295};
1296
1297static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1298 0x00, 0x20, 0x34, 0x64,
1299 0x48, 0x07, 0x48, 0x20,
1300 0x50, 0x64, 0x04, 0x34,
1301 0x50, 0x0f,
1302};
1303static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1304 0x00, 0x10, 0x34, 0x64,
1305 0x48, 0x07, 0x48, 0x10,
1306 0x50, 0x64, 0x04, 0x34,
1307 0x50, 0x0F,
1308};
1309
1310static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1311 [0] = {
1312 .mode = MSM_SPM_L2_MODE_RETENTION,
1313 .notify_rpm = false,
1314 .cmd = l2_spm_wfi_cmd_sequence,
1315 },
1316 [1] = {
1317 .mode = MSM_SPM_L2_MODE_GDHS,
1318 .notify_rpm = true,
1319 .cmd = l2_spm_gdhs_cmd_sequence,
1320 },
1321 [2] = {
1322 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1323 .notify_rpm = true,
1324 .cmd = l2_spm_power_off_cmd_sequence,
1325 },
1326};
1327
1328
1329static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1330 [0] = {
1331 .reg_base_addr = MSM_SAW_L2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001332 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
1333 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1334 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1335 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1336 .modes = msm_spm_l2_seq_list,
1337 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1338 },
1339};
1340
1341static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1342 [0] = {
1343 .reg_base_addr = MSM_SAW0_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001344 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001345#if defined(CONFIG_MSM_AVS_HW)
1346 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1347 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1348#endif
1349 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1350 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1351 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1352 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1353 .vctl_timeout_us = 50,
1354 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1355 .modes = msm_spm_seq_list,
1356 },
1357 [1] = {
1358 .reg_base_addr = MSM_SAW1_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001359 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001360#if defined(CONFIG_MSM_AVS_HW)
1361 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1362 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1363#endif
1364 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1365 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1366 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1367 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1368 .vctl_timeout_us = 50,
1369 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1370 .modes = msm_spm_seq_list,
1371 },
1372 [2] = {
1373 .reg_base_addr = MSM_SAW2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001374 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001375#if defined(CONFIG_MSM_AVS_HW)
1376 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1377 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1378#endif
1379 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1380 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1381 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1382 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1383 .vctl_timeout_us = 50,
1384 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1385 .modes = msm_spm_seq_list,
1386 },
1387 [3] = {
1388 .reg_base_addr = MSM_SAW3_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001389 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001390#if defined(CONFIG_MSM_AVS_HW)
1391 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1392 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1393#endif
1394 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1395 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1396 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1397 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1398 .vctl_timeout_us = 50,
1399 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1400 .modes = msm_spm_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001401 },
1402};
1403
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001404static void __init apq8064_init_buses(void)
1405{
1406 msm_bus_rpm_set_mt_mask();
1407 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
1408 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
1409 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
1410 msm_bus_8064_apps_fabric.dev.platform_data =
1411 &msm_bus_8064_apps_fabric_pdata;
1412 msm_bus_8064_sys_fabric.dev.platform_data =
1413 &msm_bus_8064_sys_fabric_pdata;
1414 msm_bus_8064_mm_fabric.dev.platform_data =
1415 &msm_bus_8064_mm_fabric_pdata;
1416 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
1417 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
1418}
1419
David Collinsf0d00732012-01-25 15:46:50 -08001420static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
1421 .name = GPIO_REGULATOR_DEV_NAME,
1422 .id = PM8921_MPP_PM_TO_SYS(7),
1423 .dev = {
1424 .platform_data
1425 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
1426 },
1427};
1428
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08001429static struct platform_device apq8064_device_ext_mpp8_vreg __devinitdata = {
1430 .name = GPIO_REGULATOR_DEV_NAME,
1431 .id = PM8921_MPP_PM_TO_SYS(8),
1432 .dev = {
1433 .platform_data
1434 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_MPP8],
1435 },
1436};
1437
David Collinsf0d00732012-01-25 15:46:50 -08001438static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
1439 .name = GPIO_REGULATOR_DEV_NAME,
1440 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
1441 .dev = {
1442 .platform_data =
1443 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
1444 },
1445};
1446
David Collins390fc332012-02-07 14:38:16 -08001447static struct platform_device apq8064_device_ext_ts_sw_vreg __devinitdata = {
1448 .name = GPIO_REGULATOR_DEV_NAME,
1449 .id = PM8921_GPIO_PM_TO_SYS(23),
1450 .dev = {
1451 .platform_data
1452 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_TS_SW],
1453 },
1454};
1455
David Collins2782b5c2012-02-06 10:02:42 -08001456static struct platform_device apq8064_device_rpm_regulator __devinitdata = {
1457 .name = "rpm-regulator",
1458 .id = -1,
1459 .dev = {
1460 .platform_data = &apq8064_rpm_regulator_pdata,
1461 },
1462};
1463
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001464static struct platform_device *common_devices[] __initdata = {
Jin Hong01f2dbb2011-11-03 22:13:51 -07001465 &apq8064_device_dmov,
David Keitel3c40fc52012-02-09 17:53:52 -08001466 &apq8064_device_qup_i2c_gsbi1,
Jing Lin04601f92012-02-05 15:36:07 -08001467 &apq8064_device_qup_i2c_gsbi3,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001468 &apq8064_device_qup_i2c_gsbi4,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001469 &apq8064_device_qup_spi_gsbi5,
David Collinsf0d00732012-01-25 15:46:50 -08001470 &apq8064_device_ext_5v_vreg,
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08001471 &apq8064_device_ext_mpp8_vreg,
David Collinsf0d00732012-01-25 15:46:50 -08001472 &apq8064_device_ext_3p3v_vreg,
David Collins390fc332012-02-07 14:38:16 -08001473 &apq8064_device_ext_ts_sw_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07001474 &apq8064_device_ssbi_pmic1,
1475 &apq8064_device_ssbi_pmic2,
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001476 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07001477 &apq8064_device_otg,
1478 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08001479 &apq8064_device_hsusb_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07001480 &android_usb_device,
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001481 &msm_device_wcnss_wlan,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001482#ifdef CONFIG_ANDROID_PMEM
1483#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -07001484 &android_pmem_device,
1485 &android_pmem_adsp_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001486#endif
Kevin Chan13be4e22011-10-20 11:30:32 -07001487 &android_pmem_audio_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001488#endif
1489#ifdef CONFIG_ION_MSM
1490 &ion_dev,
1491#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001492 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001493 &msm8064_device_saw_regulator_core0,
1494 &msm8064_device_saw_regulator_core1,
1495 &msm8064_device_saw_regulator_core2,
1496 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001497#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1498 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1499 &qcrypto_device,
1500#endif
1501
1502#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1503 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1504 &qcedev_device,
1505#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07001506
1507#ifdef CONFIG_HW_RANDOM_MSM
1508 &apq8064_device_rng,
1509#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08001510 &apq_pcm,
1511 &apq_pcm_routing,
1512 &apq_cpudai0,
1513 &apq_cpudai1,
1514 &apq_cpudai_hdmi_rx,
1515 &apq_cpudai_bt_rx,
1516 &apq_cpudai_bt_tx,
1517 &apq_cpudai_fm_rx,
1518 &apq_cpudai_fm_tx,
1519 &apq_cpu_fe,
1520 &apq_stub_codec,
1521 &apq_voice,
1522 &apq_voip,
1523 &apq_lpa_pcm,
1524 &apq_pcm_hostless,
1525 &apq_cpudai_afe_01_rx,
1526 &apq_cpudai_afe_01_tx,
1527 &apq_cpudai_afe_02_rx,
1528 &apq_cpudai_afe_02_tx,
1529 &apq_pcm_afe,
1530 &apq_cpudai_auxpcm_rx,
1531 &apq_cpudai_auxpcm_tx,
Neema Shetty8427c262012-02-16 11:23:43 -08001532 &apq_cpudai_stub,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001533 &apq8064_rpm_device,
1534 &apq8064_rpm_log_device,
1535 &apq8064_rpm_stat_device,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001536 &msm_bus_8064_apps_fabric,
1537 &msm_bus_8064_sys_fabric,
1538 &msm_bus_8064_mm_fabric,
1539 &msm_bus_8064_sys_fpb,
1540 &msm_bus_8064_cpss_fpb,
Mohan Kumar Gubbihalli Lachma Naik7f72edd2012-02-06 17:26:47 -08001541 &apq8064_msm_device_vidc,
Matt Wagantalled832652012-02-02 19:23:17 -08001542 &msm_8960_riva,
Matt Wagantallb94b9a52012-02-02 21:59:54 -08001543 &msm_8960_q6_lpass,
Matt Wagantall292aace2012-01-26 19:12:34 -08001544 &msm_gss,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001545};
1546
Joel King4e7ad222011-08-17 15:47:38 -07001547static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001548 &apq8064_device_uart_gsbi3,
Yan He06913ce2011-08-26 16:33:46 -07001549 &msm_device_sps_apq8064,
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001550};
1551
1552static struct platform_device *rumi3_devices[] __initdata = {
1553 &apq8064_device_uart_gsbi1,
Yan He435ed612011-11-23 17:34:59 -08001554 &msm_device_sps_apq8064,
Huaibin Yang4a084e32011-12-15 15:25:52 -08001555#ifdef CONFIG_MSM_ROTATOR
1556 &msm_rotator_device,
1557#endif
Joel King4e7ad222011-08-17 15:47:38 -07001558};
1559
Joel King82b7e3f2012-01-05 10:03:27 -08001560static struct platform_device *cdp_devices[] __initdata = {
1561 &apq8064_device_uart_gsbi1,
Jin Hong4bbbfba2012-02-02 21:48:07 -08001562 &apq8064_device_uart_gsbi7,
Joel King82b7e3f2012-01-05 10:03:27 -08001563 &msm_device_sps_apq8064,
1564};
1565
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001566static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08001567 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001568};
1569
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001570#define KS8851_IRQ_GPIO 43
1571
1572static struct spi_board_info spi_board_info[] __initdata = {
1573 {
1574 .modalias = "ks8851",
1575 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1576 .max_speed_hz = 19200000,
1577 .bus_num = 0,
1578 .chip_select = 2,
1579 .mode = SPI_MODE_0,
1580 },
1581};
1582
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001583static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001584 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001585 .bus_num = 1,
1586 .slim_slave = &apq8064_slim_tabla,
1587 },
1588 {
1589 .bus_num = 1,
1590 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001591 },
1592 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001593};
1594
David Keitel3c40fc52012-02-09 17:53:52 -08001595static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi1_pdata = {
1596 .clk_freq = 100000,
1597 .src_clk_rate = 24000000,
1598};
1599
Jing Lin04601f92012-02-05 15:36:07 -08001600static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi3_pdata = {
1601 .clk_freq = 100000,
1602 .src_clk_rate = 24000000,
1603};
1604
Kenneth Heitke748593a2011-07-15 15:45:11 -06001605static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
1606 .clk_freq = 100000,
1607 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001608};
1609
David Keitel3c40fc52012-02-09 17:53:52 -08001610#define GSBI_DUAL_MODE_CODE 0x60
1611#define MSM_GSBI1_PHYS 0x12440000
Kenneth Heitke748593a2011-07-15 15:45:11 -06001612static void __init apq8064_i2c_init(void)
1613{
David Keitel3c40fc52012-02-09 17:53:52 -08001614 void __iomem *gsbi_mem;
1615
1616 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
1617 &apq8064_i2c_qup_gsbi1_pdata;
1618 gsbi_mem = ioremap_nocache(MSM_GSBI1_PHYS, 4);
1619 writel_relaxed(GSBI_DUAL_MODE_CODE, gsbi_mem);
1620 /* Ensure protocol code is written before proceeding */
1621 wmb();
1622 iounmap(gsbi_mem);
1623 apq8064_i2c_qup_gsbi1_pdata.use_gsbi_shared_mode = 1;
Jing Lin04601f92012-02-05 15:36:07 -08001624 apq8064_device_qup_i2c_gsbi3.dev.platform_data =
1625 &apq8064_i2c_qup_gsbi3_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06001626 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
1627 &apq8064_i2c_qup_gsbi4_pdata;
1628}
1629
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08001630#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001631static int ethernet_init(void)
1632{
1633 int ret;
1634 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
1635 if (ret) {
1636 pr_err("ks8851 gpio_request failed: %d\n", ret);
1637 goto fail;
1638 }
1639
1640 return 0;
1641fail:
1642 return ret;
1643}
1644#else
1645static int ethernet_init(void)
1646{
1647 return 0;
1648}
1649#endif
1650
Mohan Pallaka474b94b2012-01-25 12:59:58 +05301651#define GPIO_KEY_HOME PM8921_GPIO_PM_TO_SYS(27)
1652#define GPIO_KEY_VOLUME_UP PM8921_GPIO_PM_TO_SYS(35)
1653#define GPIO_KEY_VOLUME_DOWN PM8921_GPIO_PM_TO_SYS(38)
1654#define GPIO_KEY_CAM_FOCUS PM8921_GPIO_PM_TO_SYS(3)
1655#define GPIO_KEY_CAM_SNAP PM8921_GPIO_PM_TO_SYS(4)
1656#define GPIO_KEY_ROTATION 46
1657
1658static struct gpio_keys_button cdp_keys[] = {
1659 {
1660 .code = KEY_HOME,
1661 .gpio = GPIO_KEY_HOME,
1662 .desc = "home_key",
1663 .active_low = 1,
1664 .type = EV_KEY,
1665 .wakeup = 1,
1666 .debounce_interval = 15,
1667 },
1668 {
1669 .code = KEY_VOLUMEUP,
1670 .gpio = GPIO_KEY_VOLUME_UP,
1671 .desc = "volume_up_key",
1672 .active_low = 1,
1673 .type = EV_KEY,
1674 .wakeup = 1,
1675 .debounce_interval = 15,
1676 },
1677 {
1678 .code = KEY_VOLUMEDOWN,
1679 .gpio = GPIO_KEY_VOLUME_DOWN,
1680 .desc = "volume_down_key",
1681 .active_low = 1,
1682 .type = EV_KEY,
1683 .wakeup = 1,
1684 .debounce_interval = 15,
1685 },
1686 {
1687 .code = SW_ROTATE_LOCK,
1688 .gpio = GPIO_KEY_ROTATION,
1689 .desc = "rotate_key",
1690 .active_low = 1,
1691 .type = EV_SW,
1692 .debounce_interval = 15,
1693 },
1694};
1695
1696static struct gpio_keys_platform_data cdp_keys_data = {
1697 .buttons = cdp_keys,
1698 .nbuttons = ARRAY_SIZE(cdp_keys),
1699};
1700
1701static struct platform_device cdp_kp_pdev = {
1702 .name = "gpio-keys",
1703 .id = -1,
1704 .dev = {
1705 .platform_data = &cdp_keys_data,
1706 },
1707};
1708
1709static struct gpio_keys_button mtp_keys[] = {
1710 {
1711 .code = KEY_CAMERA_FOCUS,
1712 .gpio = GPIO_KEY_CAM_FOCUS,
1713 .desc = "cam_focus_key",
1714 .active_low = 1,
1715 .type = EV_KEY,
1716 .wakeup = 1,
1717 .debounce_interval = 15,
1718 },
1719 {
1720 .code = KEY_VOLUMEUP,
1721 .gpio = GPIO_KEY_VOLUME_UP,
1722 .desc = "volume_up_key",
1723 .active_low = 1,
1724 .type = EV_KEY,
1725 .wakeup = 1,
1726 .debounce_interval = 15,
1727 },
1728 {
1729 .code = KEY_VOLUMEDOWN,
1730 .gpio = GPIO_KEY_VOLUME_DOWN,
1731 .desc = "volume_down_key",
1732 .active_low = 1,
1733 .type = EV_KEY,
1734 .wakeup = 1,
1735 .debounce_interval = 15,
1736 },
1737 {
1738 .code = KEY_CAMERA_SNAPSHOT,
1739 .gpio = GPIO_KEY_CAM_SNAP,
1740 .desc = "cam_snap_key",
1741 .active_low = 1,
1742 .type = EV_KEY,
1743 .debounce_interval = 15,
1744 },
1745};
1746
1747static struct gpio_keys_platform_data mtp_keys_data = {
1748 .buttons = mtp_keys,
1749 .nbuttons = ARRAY_SIZE(mtp_keys),
1750};
1751
1752static struct platform_device mtp_kp_pdev = {
1753 .name = "gpio-keys",
1754 .id = -1,
1755 .dev = {
1756 .platform_data = &mtp_keys_data,
1757 },
1758};
1759
1760
Tianyi Gou41515e22011-09-01 19:37:43 -07001761static void __init apq8064_clock_init(void)
1762{
Tianyi Gouacb588d2012-01-27 18:24:05 -08001763 if (machine_is_apq8064_rumi3())
Tianyi Gou41515e22011-09-01 19:37:43 -07001764 msm_clock_init(&apq8064_dummy_clock_init_data);
Tianyi Gouacb588d2012-01-27 18:24:05 -08001765 else
1766 msm_clock_init(&apq8064_clock_init_data);
Tianyi Gou41515e22011-09-01 19:37:43 -07001767}
1768
Jing Lin417fa452012-02-05 14:31:06 -08001769#define I2C_SURF 1
1770#define I2C_FFA (1 << 1)
1771#define I2C_RUMI (1 << 2)
1772#define I2C_SIM (1 << 3)
1773#define I2C_LIQUID (1 << 4)
1774
1775struct i2c_registry {
1776 u8 machs;
1777 int bus;
1778 struct i2c_board_info *info;
1779 int len;
1780};
1781
1782static struct i2c_registry apq8064_i2c_devices[] __initdata = {
Jing Lin21ed4de2012-02-05 15:53:28 -08001783 {
1784 I2C_SURF | I2C_LIQUID,
1785 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
1786 mxt_device_info,
1787 ARRAY_SIZE(mxt_device_info),
1788 },
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001789 {
1790 I2C_FFA,
1791 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
1792 cyttsp_info,
1793 ARRAY_SIZE(cyttsp_info),
1794 },
Amy Maloche70090f992012-02-16 16:35:26 -08001795 {
1796 I2C_FFA | I2C_LIQUID,
1797 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
1798 isa1200_board_info,
1799 ARRAY_SIZE(isa1200_board_info),
1800 },
Jing Lin417fa452012-02-05 14:31:06 -08001801};
1802
1803static void __init register_i2c_devices(void)
1804{
1805 u8 mach_mask = 0;
1806 int i;
1807
Kevin Chand07220e2012-02-13 15:52:22 -08001808#ifdef CONFIG_MSM_CAMERA
1809 struct i2c_registry apq8064_camera_i2c_devices = {
1810 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_RUMI,
1811 APQ_8064_GSBI4_QUP_I2C_BUS_ID,
1812 apq8064_camera_board_info.board_info,
1813 apq8064_camera_board_info.num_i2c_board_info,
1814 };
1815#endif
Jing Lin417fa452012-02-05 14:31:06 -08001816 /* Build the matching 'supported_machs' bitmask */
1817 if (machine_is_apq8064_cdp())
1818 mach_mask = I2C_SURF;
1819 else if (machine_is_apq8064_mtp())
1820 mach_mask = I2C_FFA;
1821 else if (machine_is_apq8064_liquid())
1822 mach_mask = I2C_LIQUID;
1823 else if (machine_is_apq8064_rumi3())
1824 mach_mask = I2C_RUMI;
1825 else if (machine_is_apq8064_sim())
1826 mach_mask = I2C_SIM;
1827 else
1828 pr_err("unmatched machine ID in register_i2c_devices\n");
1829
1830 /* Run the array and install devices as appropriate */
1831 for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) {
1832 if (apq8064_i2c_devices[i].machs & mach_mask)
1833 i2c_register_board_info(apq8064_i2c_devices[i].bus,
1834 apq8064_i2c_devices[i].info,
1835 apq8064_i2c_devices[i].len);
1836 }
Kevin Chand07220e2012-02-13 15:52:22 -08001837#ifdef CONFIG_MSM_CAMERA
1838 if (apq8064_camera_i2c_devices.machs & mach_mask)
1839 i2c_register_board_info(apq8064_camera_i2c_devices.bus,
1840 apq8064_camera_i2c_devices.info,
1841 apq8064_camera_i2c_devices.len);
1842#endif
Jing Lin417fa452012-02-05 14:31:06 -08001843}
1844
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001845static void __init apq8064_common_init(void)
1846{
1847 if (socinfo_init() < 0)
1848 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06001849 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
1850 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
David Collins2782b5c2012-02-06 10:02:42 -08001851 regulator_suppress_info_printing();
1852 platform_device_register(&apq8064_device_rpm_regulator);
Tianyi Gou41515e22011-09-01 19:37:43 -07001853 apq8064_clock_init();
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08001854 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06001855 apq8064_i2c_init();
Jing Lin417fa452012-02-05 14:31:06 -08001856 register_i2c_devices();
Kenneth Heitke36920d32011-07-20 16:44:30 -06001857
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001858 apq8064_device_qup_spi_gsbi5.dev.platform_data =
1859 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08001860 apq8064_init_pmic();
Hemant Kumar94e7da22012-02-03 16:52:29 -08001861 if (machine_is_apq8064_liquid())
1862 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001863 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001864 apq8064_init_buses();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001865 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Hemant Kumarf1ca9192012-02-07 18:59:33 -08001866 if (machine_is_apq8064_mtp()) {
1867 apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
1868 device_initialize(&apq8064_device_hsic_host.dev);
1869 }
Jay Chokshie8741282012-01-25 15:22:55 -08001870 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05301871 apq8064_init_mmc();
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08001872
1873 if (machine_is_apq8064_mtp()) {
1874 mdm_8064_device.dev.platform_data = &mdm_platform_data;
1875 platform_device_register(&mdm_8064_device);
1876 }
1877 platform_device_register(&apq8064_slim_ctrl);
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001878 slim_register_board_info(apq8064_slim_devices,
1879 ARRAY_SIZE(apq8064_slim_devices));
Praveen Chidambaram78499012011-11-01 17:15:17 -06001880 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Mahesh Sivasubramaniancbce1ec2012-01-24 10:32:44 -07001881 acpuclk_init(&acpuclk_8064_soc_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06001882 msm_spm_l2_init(msm_spm_l2_data);
1883 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
1884 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
1885 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
1886 msm_pm_data);
1887 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001888}
1889
Huaibin Yang4a084e32011-12-15 15:25:52 -08001890static void __init apq8064_allocate_memory_regions(void)
1891{
1892 apq8064_allocate_fb_region();
1893}
1894
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001895static void __init apq8064_sim_init(void)
1896{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001897 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
1898 &msm8064_device_watchdog.dev.platform_data;
1899
1900 wdog_pdata->bark_time = 15000;
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001901 msm_tsens_early_init(&apq_tsens_pdata);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001902 apq8064_common_init();
Joel King4e7ad222011-08-17 15:47:38 -07001903 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
1904}
1905
1906static void __init apq8064_rumi3_init(void)
1907{
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001908 msm_tsens_early_init(&apq_tsens_pdata);
Joel King4e7ad222011-08-17 15:47:38 -07001909 apq8064_common_init();
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001910 ethernet_init();
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001911 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001912 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Huaibin Yang4a084e32011-12-15 15:25:52 -08001913 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07001914 apq8064_init_gpu();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001915}
1916
Joel King82b7e3f2012-01-05 10:03:27 -08001917static void __init apq8064_cdp_init(void)
1918{
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001919 msm_tsens_early_init(&apq_tsens_pdata);
Joel King82b7e3f2012-01-05 10:03:27 -08001920 apq8064_common_init();
1921 ethernet_init();
1922 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
1923 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08001924 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07001925 apq8064_init_gpu();
Matt Wagantallef3cfe542012-02-04 19:01:08 -08001926 platform_add_devices(msm_footswitch_devices,
1927 msm_num_footswitch_devices);
Kevin Chand07220e2012-02-13 15:52:22 -08001928 apq8064_init_cam();
Mohan Pallaka474b94b2012-01-25 12:59:58 +05301929
1930 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
1931 platform_device_register(&cdp_kp_pdev);
1932
1933 if (machine_is_apq8064_mtp())
1934 platform_device_register(&mtp_kp_pdev);
Joel King82b7e3f2012-01-05 10:03:27 -08001935}
1936
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001937MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
1938 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07001939 .reserve = apq8064_reserve,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001940 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05301941 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001942 .timer = &msm_timer,
1943 .init_machine = apq8064_sim_init,
1944MACHINE_END
1945
Joel King4e7ad222011-08-17 15:47:38 -07001946MACHINE_START(APQ8064_RUMI3, "QCT APQ8064 RUMI3")
1947 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07001948 .reserve = apq8064_reserve,
Joel King4e7ad222011-08-17 15:47:38 -07001949 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05301950 .handle_irq = gic_handle_irq,
Joel King4e7ad222011-08-17 15:47:38 -07001951 .timer = &msm_timer,
1952 .init_machine = apq8064_rumi3_init,
Huaibin Yang4a084e32011-12-15 15:25:52 -08001953 .init_early = apq8064_allocate_memory_regions,
Joel King4e7ad222011-08-17 15:47:38 -07001954MACHINE_END
1955
Joel King82b7e3f2012-01-05 10:03:27 -08001956MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
1957 .map_io = apq8064_map_io,
1958 .reserve = apq8064_reserve,
1959 .init_irq = apq8064_init_irq,
1960 .handle_irq = gic_handle_irq,
1961 .timer = &msm_timer,
1962 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08001963 .init_early = apq8064_allocate_memory_regions,
Joel King82b7e3f2012-01-05 10:03:27 -08001964MACHINE_END
1965
1966MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
1967 .map_io = apq8064_map_io,
1968 .reserve = apq8064_reserve,
1969 .init_irq = apq8064_init_irq,
1970 .handle_irq = gic_handle_irq,
1971 .timer = &msm_timer,
1972 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08001973 .init_early = apq8064_allocate_memory_regions,
Joel King82b7e3f2012-01-05 10:03:27 -08001974MACHINE_END
1975
1976MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
1977 .map_io = apq8064_map_io,
1978 .reserve = apq8064_reserve,
1979 .init_irq = apq8064_init_irq,
1980 .handle_irq = gic_handle_irq,
1981 .timer = &msm_timer,
1982 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08001983 .init_early = apq8064_allocate_memory_regions,
Joel King82b7e3f2012-01-05 10:03:27 -08001984MACHINE_END
1985
Joel King11ca8202012-02-13 16:19:03 -08001986MACHINE_START(MPQ8064_HRD, "QCT MPQ8064 HRD")
1987 .map_io = apq8064_map_io,
1988 .reserve = apq8064_reserve,
1989 .init_irq = apq8064_init_irq,
1990 .handle_irq = gic_handle_irq,
1991 .timer = &msm_timer,
1992 .init_machine = apq8064_cdp_init,
1993MACHINE_END
1994
1995MACHINE_START(MPQ8064_DTV, "QCT MPQ8064 DTV")
1996 .map_io = apq8064_map_io,
1997 .reserve = apq8064_reserve,
1998 .init_irq = apq8064_init_irq,
1999 .handle_irq = gic_handle_irq,
2000 .timer = &msm_timer,
2001 .init_machine = apq8064_cdp_init,
2002MACHINE_END
2003