blob: 2c8f14766997bdea35016d00f82de19dd21ea3cb [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>
Kenneth Heitke36920d32011-07-20 16:44:30 -060021#include <linux/msm_ssbi.h>
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -070022#include <linux/spi/spi.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070023#include <linux/dma-mapping.h>
24#include <linux/platform_data/qcom_crypto_device.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080025#include <linux/ion.h>
Jack Cheung46bfffa2012-01-19 15:26:24 -080026#include <linux/memory.h>
Jing Lin21ed4de2012-02-05 15:53:28 -080027#include <linux/i2c/atmel_mxt_ts.h>
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -080028#include <linux/cyttsp.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070029#include <asm/mach-types.h>
30#include <asm/mach/arch.h>
31#include <asm/hardware/gic.h>
Sahitya Tummala3586ed92011-08-03 09:13:23 +053032#include <asm/mach/mmc.h>
Ankit Verma6b7e2ba2012-01-26 15:48:54 -080033#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070034
35#include <mach/board.h>
36#include <mach/msm_iomap.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080037#include <mach/ion.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070038#include <linux/usb/msm_hsusb.h>
39#include <linux/usb/android.h>
40#include <mach/socinfo.h>
Harini Jayaramanc4c58692011-07-19 14:50:10 -060041#include <mach/msm_spi.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070042#include "timer.h"
43#include "devices.h"
Joel King4ebccc62011-07-22 09:43:22 -070044#include <mach/gpio.h>
45#include <mach/gpiomux.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060046#include <mach/rpm.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080047#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -070048#include <linux/android_pmem.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080049#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070050#include <mach/msm_memtypes.h>
51#include <linux/bootmem.h>
52#include <asm/setup.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070053#include <mach/dma.h>
Gagan Mac8a7a5d32011-11-11 16:43:06 -070054#include <mach/msm_bus_board.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060055#include <mach/cpuidle.h>
Joel Kingdacbc822012-01-25 13:30:57 -080056#include <mach/mdm2.h>
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -080057#include <linux/msm_tsens.h>
Joel King4ebccc62011-07-22 09:43:22 -070058
Jeff Ohlstein7e668552011-10-06 16:17:25 -070059#include "msm_watchdog.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080060#include "board-8064.h"
Vikram Mulukutlabc2e9572011-11-04 03:41:38 -070061#include "acpuclock.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060062#include "spm.h"
63#include "mpm.h"
64#include "rpm_resources.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080065#include "pm.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060066#include "pm-boot.h"
Rajesh Sastrulaaee8af32012-01-20 11:46:31 -080067#include "devices-msm8x60.h"
Jay Chokshiea67c622011-07-29 17:12:26 -070068
Olav Haugan7c6aa742012-01-16 16:47:37 -080069#define MSM_PMEM_ADSP_SIZE 0x7800000
Ben Romberger3ffcd812011-12-08 19:12:10 -080070#define MSM_PMEM_AUDIO_SIZE 0x2B4000
Olav Haugan7c6aa742012-01-16 16:47:37 -080071#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
72#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
73#else
74#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
75#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070076
Olav Haugan7c6aa742012-01-16 16:47:37 -080077#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Olav Hauganedcf6832012-01-24 08:35:41 -080078#define MSM_PMEM_KERNEL_EBI1_SIZE 0x280000
Olav Haugan7c6aa742012-01-16 16:47:37 -080079#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Haugand3d29682012-01-19 10:57:07 -080080#define MSM_ION_MM_FW_SIZE 0x200000 /* (2MB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -080081#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Hauganf45e2142012-01-19 11:01:01 -080082#define MSM_ION_QSECOM_SIZE 0x100000 /* (1MB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -080083#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan2c43fac2012-01-19 11:06:37 -080084#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
85#define MSM_ION_HEAP_NUM 8
Olav Haugan7c6aa742012-01-16 16:47:37 -080086#else
87#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
88#define MSM_ION_HEAP_NUM 1
89#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070090
Olav Haugan7c6aa742012-01-16 16:47:37 -080091#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
92static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
93static int __init pmem_kernel_ebi1_size_setup(char *p)
Kevin Chan13be4e22011-10-20 11:30:32 -070094{
Olav Haugan7c6aa742012-01-16 16:47:37 -080095 pmem_kernel_ebi1_size = memparse(p, NULL);
96 return 0;
Kevin Chan13be4e22011-10-20 11:30:32 -070097}
Olav Haugan7c6aa742012-01-16 16:47:37 -080098early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
99#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700100
Olav Haugan7c6aa742012-01-16 16:47:37 -0800101#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -0700102static unsigned pmem_size = MSM_PMEM_SIZE;
103static int __init pmem_size_setup(char *p)
104{
105 pmem_size = memparse(p, NULL);
106 return 0;
107}
108early_param("pmem_size", pmem_size_setup);
109
110static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
111
112static int __init pmem_adsp_size_setup(char *p)
113{
114 pmem_adsp_size = memparse(p, NULL);
115 return 0;
116}
117early_param("pmem_adsp_size", pmem_adsp_size_setup);
118
119static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
120
121static int __init pmem_audio_size_setup(char *p)
122{
123 pmem_audio_size = memparse(p, NULL);
124 return 0;
125}
126early_param("pmem_audio_size", pmem_audio_size_setup);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800127#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700128
Olav Haugan7c6aa742012-01-16 16:47:37 -0800129#ifdef CONFIG_ANDROID_PMEM
130#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700131static struct android_pmem_platform_data android_pmem_pdata = {
132 .name = "pmem",
133 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
134 .cached = 1,
135 .memory_type = MEMTYPE_EBI1,
136};
137
138static struct platform_device android_pmem_device = {
139 .name = "android_pmem",
140 .id = 0,
141 .dev = {.platform_data = &android_pmem_pdata},
142};
143
144static struct android_pmem_platform_data android_pmem_adsp_pdata = {
145 .name = "pmem_adsp",
146 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
147 .cached = 0,
148 .memory_type = MEMTYPE_EBI1,
149};
Kevin Chan13be4e22011-10-20 11:30:32 -0700150static struct platform_device android_pmem_adsp_device = {
151 .name = "android_pmem",
152 .id = 2,
153 .dev = { .platform_data = &android_pmem_adsp_pdata },
154};
Olav Haugan7c6aa742012-01-16 16:47:37 -0800155#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700156
157static struct android_pmem_platform_data android_pmem_audio_pdata = {
158 .name = "pmem_audio",
159 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
160 .cached = 0,
161 .memory_type = MEMTYPE_EBI1,
162};
163
164static struct platform_device android_pmem_audio_device = {
165 .name = "android_pmem",
166 .id = 4,
167 .dev = { .platform_data = &android_pmem_audio_pdata },
168};
Olav Haugan7c6aa742012-01-16 16:47:37 -0800169#endif
170
171static struct memtype_reserve apq8064_reserve_table[] __initdata = {
172 [MEMTYPE_SMI] = {
173 },
174 [MEMTYPE_EBI0] = {
175 .flags = MEMTYPE_FLAGS_1M_ALIGN,
176 },
177 [MEMTYPE_EBI1] = {
178 .flags = MEMTYPE_FLAGS_1M_ALIGN,
179 },
180};
Kevin Chan13be4e22011-10-20 11:30:32 -0700181
182static void __init size_pmem_devices(void)
183{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800184#ifdef CONFIG_ANDROID_PMEM
185#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700186 android_pmem_adsp_pdata.size = pmem_adsp_size;
187 android_pmem_pdata.size = pmem_size;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800188#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700189 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800190#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700191}
192
193static void __init reserve_memory_for(struct android_pmem_platform_data *p)
194{
195 apq8064_reserve_table[p->memory_type].size += p->size;
196}
197
Kevin Chan13be4e22011-10-20 11:30:32 -0700198static void __init reserve_pmem_memory(void)
199{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800200#ifdef CONFIG_ANDROID_PMEM
201#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700202 reserve_memory_for(&android_pmem_adsp_pdata);
203 reserve_memory_for(&android_pmem_pdata);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800204#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700205 reserve_memory_for(&android_pmem_audio_pdata);
206 apq8064_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800207#endif
208}
209
210static int apq8064_paddr_to_memtype(unsigned int paddr)
211{
212 return MEMTYPE_EBI1;
213}
214
215#ifdef CONFIG_ION_MSM
216#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
217static struct ion_cp_heap_pdata cp_mm_ion_pdata = {
218 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugand3d29682012-01-19 10:57:07 -0800219 .align = PAGE_SIZE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800220};
221
222static struct ion_cp_heap_pdata cp_mfc_ion_pdata = {
223 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugand3d29682012-01-19 10:57:07 -0800224 .align = PAGE_SIZE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800225};
226
227static struct ion_co_heap_pdata co_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800228 .adjacent_mem_id = INVALID_HEAP_ID,
229 .align = PAGE_SIZE,
230};
231
232static struct ion_co_heap_pdata fw_co_ion_pdata = {
233 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
234 .align = SZ_128K,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800235};
236#endif
237static struct ion_platform_data ion_pdata = {
238 .nr = MSM_ION_HEAP_NUM,
239 .heaps = {
240 {
241 .id = ION_SYSTEM_HEAP_ID,
242 .type = ION_HEAP_TYPE_SYSTEM,
243 .name = ION_VMALLOC_HEAP_NAME,
244 },
245#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
246 {
247 .id = ION_SF_HEAP_ID,
248 .type = ION_HEAP_TYPE_CARVEOUT,
249 .name = ION_SF_HEAP_NAME,
250 .size = MSM_ION_SF_SIZE,
251 .memory_type = ION_EBI_TYPE,
252 .extra_data = (void *) &co_ion_pdata,
253 },
254 {
255 .id = ION_CP_MM_HEAP_ID,
256 .type = ION_HEAP_TYPE_CP,
257 .name = ION_MM_HEAP_NAME,
258 .size = MSM_ION_MM_SIZE,
259 .memory_type = ION_EBI_TYPE,
260 .extra_data = (void *) &cp_mm_ion_pdata,
261 },
262 {
Olav Haugand3d29682012-01-19 10:57:07 -0800263 .id = ION_MM_FIRMWARE_HEAP_ID,
264 .type = ION_HEAP_TYPE_CARVEOUT,
265 .name = ION_MM_FIRMWARE_HEAP_NAME,
266 .size = MSM_ION_MM_FW_SIZE,
267 .memory_type = ION_EBI_TYPE,
268 .extra_data = (void *) &fw_co_ion_pdata,
269 },
270 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800271 .id = ION_CP_MFC_HEAP_ID,
272 .type = ION_HEAP_TYPE_CP,
273 .name = ION_MFC_HEAP_NAME,
274 .size = MSM_ION_MFC_SIZE,
275 .memory_type = ION_EBI_TYPE,
276 .extra_data = (void *) &cp_mfc_ion_pdata,
277 },
278 {
279 .id = ION_IOMMU_HEAP_ID,
280 .type = ION_HEAP_TYPE_IOMMU,
281 .name = ION_IOMMU_HEAP_NAME,
282 },
Olav Hauganf45e2142012-01-19 11:01:01 -0800283 {
284 .id = ION_QSECOM_HEAP_ID,
285 .type = ION_HEAP_TYPE_CARVEOUT,
286 .name = ION_QSECOM_HEAP_NAME,
287 .size = MSM_ION_QSECOM_SIZE,
288 .memory_type = ION_EBI_TYPE,
289 .extra_data = (void *) &co_ion_pdata,
290 },
Olav Haugan2c43fac2012-01-19 11:06:37 -0800291 {
292 .id = ION_AUDIO_HEAP_ID,
293 .type = ION_HEAP_TYPE_CARVEOUT,
294 .name = ION_AUDIO_HEAP_NAME,
295 .size = MSM_ION_AUDIO_SIZE,
296 .memory_type = ION_EBI_TYPE,
297 .extra_data = (void *) &co_ion_pdata,
298 },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800299#endif
300 }
301};
302
303static struct platform_device ion_dev = {
304 .name = "ion-msm",
305 .id = 1,
306 .dev = { .platform_data = &ion_pdata },
307};
308#endif
309
310static void reserve_ion_memory(void)
311{
312#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
313 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_SIZE;
Olav Haugand3d29682012-01-19 10:57:07 -0800314 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_FW_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800315 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_SF_SIZE;
316 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MFC_SIZE;
Olav Hauganf45e2142012-01-19 11:01:01 -0800317 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_QSECOM_SIZE;
Olav Haugan2c43fac2012-01-19 11:06:37 -0800318 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_AUDIO_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800319#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700320}
321
Huaibin Yang4a084e32011-12-15 15:25:52 -0800322static void __init reserve_mdp_memory(void)
323{
324 apq8064_mdp_writeback(apq8064_reserve_table);
325}
326
Kevin Chan13be4e22011-10-20 11:30:32 -0700327static void __init apq8064_calculate_reserve_sizes(void)
328{
329 size_pmem_devices();
330 reserve_pmem_memory();
Olav Haugan7c6aa742012-01-16 16:47:37 -0800331 reserve_ion_memory();
Huaibin Yang4a084e32011-12-15 15:25:52 -0800332 reserve_mdp_memory();
Kevin Chan13be4e22011-10-20 11:30:32 -0700333}
334
335static struct reserve_info apq8064_reserve_info __initdata = {
336 .memtype_reserve_table = apq8064_reserve_table,
337 .calculate_reserve_sizes = apq8064_calculate_reserve_sizes,
338 .paddr_to_memtype = apq8064_paddr_to_memtype,
339};
340
341static int apq8064_memory_bank_size(void)
342{
343 return 1<<29;
344}
345
346static void __init locate_unstable_memory(void)
347{
348 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
349 unsigned long bank_size;
350 unsigned long low, high;
351
352 bank_size = apq8064_memory_bank_size();
353 low = meminfo.bank[0].start;
354 high = mb->start + mb->size;
Olav Haugand76e3a82012-01-16 16:55:07 -0800355
356 /* Check if 32 bit overflow occured */
357 if (high < mb->start)
358 high = ~0UL;
359
Kevin Chan13be4e22011-10-20 11:30:32 -0700360 low &= ~(bank_size - 1);
361
362 if (high - low <= bank_size)
363 return;
Jack Cheung46bfffa2012-01-19 15:26:24 -0800364 apq8064_reserve_info.low_unstable_address = mb->start -
365 MIN_MEMORY_BLOCK_SIZE + mb->size;
366 apq8064_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
367
Kevin Chan13be4e22011-10-20 11:30:32 -0700368 apq8064_reserve_info.bank_size = bank_size;
369 pr_info("low unstable address %lx max size %lx bank size %lx\n",
370 apq8064_reserve_info.low_unstable_address,
371 apq8064_reserve_info.max_unstable_size,
372 apq8064_reserve_info.bank_size);
373}
374
375static void __init apq8064_reserve(void)
376{
377 reserve_info = &apq8064_reserve_info;
378 locate_unstable_memory();
379 msm_reserve();
380}
381
Hemant Kumara945b472012-01-25 15:08:06 -0800382#ifdef CONFIG_USB_EHCI_MSM_HSIC
383static struct msm_hsic_host_platform_data msm_hsic_pdata = {
384 .strobe = 88,
385 .data = 89,
386};
387#else
388static struct msm_hsic_host_platform_data msm_hsic_pdata;
389#endif
390
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800391#define PID_MAGIC_ID 0x71432909
392#define SERIAL_NUM_MAGIC_ID 0x61945374
393#define SERIAL_NUMBER_LENGTH 127
394#define DLOAD_USB_BASE_ADD 0x2A03F0C8
395
396struct magic_num_struct {
397 uint32_t pid;
398 uint32_t serial_num;
399};
400
401struct dload_struct {
402 uint32_t reserved1;
403 uint32_t reserved2;
404 uint32_t reserved3;
405 uint16_t reserved4;
406 uint16_t pid;
407 char serial_number[SERIAL_NUMBER_LENGTH];
408 uint16_t reserved5;
409 struct magic_num_struct magic_struct;
410};
411
412static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
413{
414 struct dload_struct __iomem *dload = 0;
415
416 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
417 if (!dload) {
418 pr_err("%s: cannot remap I/O memory region: %08x\n",
419 __func__, DLOAD_USB_BASE_ADD);
420 return -ENXIO;
421 }
422
423 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
424 __func__, dload, pid, snum);
425 /* update pid */
426 dload->magic_struct.pid = PID_MAGIC_ID;
427 dload->pid = pid;
428
429 /* update serial number */
430 dload->magic_struct.serial_num = 0;
431 if (!snum) {
432 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
433 goto out;
434 }
435
436 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
437 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
438out:
439 iounmap(dload);
440 return 0;
441}
442
443static struct android_usb_platform_data android_usb_pdata = {
444 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
445};
446
Hemant Kumar4933b072011-10-17 23:43:11 -0700447static struct platform_device android_usb_device = {
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800448 .name = "android_usb",
449 .id = -1,
450 .dev = {
451 .platform_data = &android_usb_pdata,
452 },
Hemant Kumar4933b072011-10-17 23:43:11 -0700453};
454
455static struct msm_otg_platform_data msm_otg_pdata = {
Hemant Kumard86c4882012-01-24 19:39:37 -0800456 .mode = USB_OTG,
457 .otg_control = OTG_PMIC_CONTROL,
Hemant Kumar4933b072011-10-17 23:43:11 -0700458 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Hemant Kumard86c4882012-01-24 19:39:37 -0800459 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
460 .power_budget = 750,
Hemant Kumar4933b072011-10-17 23:43:11 -0700461};
462
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800463#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
464
465/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
466 * 4 micbiases are used to power various analog and digital
467 * microphones operating at 1800 mV. Technically, all micbiases
468 * can source from single cfilter since all microphones operate
469 * at the same voltage level. The arrangement below is to make
470 * sure all cfilters are exercised. LDO_H regulator ouput level
471 * does not need to be as high as 2.85V. It is choosen for
472 * microphone sensitivity purpose.
473 */
474static struct tabla_pdata apq8064_tabla_platform_data = {
475 .slimbus_slave_device = {
476 .name = "tabla-slave",
477 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
478 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800479 .irq = MSM_GPIO_TO_INT(42),
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800480 .irq_base = TABLA_INTERRUPT_BASE,
481 .num_irqs = NR_TABLA_IRQS,
482 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
483 .micbias = {
484 .ldoh_v = TABLA_LDOH_2P85_V,
485 .cfilt1_mv = 1800,
486 .cfilt2_mv = 1800,
487 .cfilt3_mv = 1800,
488 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
489 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
490 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
491 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
492 }
493};
494
495static struct slim_device apq8064_slim_tabla = {
496 .name = "tabla-slim",
497 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
498 .dev = {
499 .platform_data = &apq8064_tabla_platform_data,
500 },
501};
502
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800503static struct tabla_pdata apq8064_tabla20_platform_data = {
504 .slimbus_slave_device = {
505 .name = "tabla-slave",
506 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
507 },
508 .irq = MSM_GPIO_TO_INT(42),
509 .irq_base = TABLA_INTERRUPT_BASE,
510 .num_irqs = NR_TABLA_IRQS,
511 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
512 .micbias = {
513 .ldoh_v = TABLA_LDOH_2P85_V,
514 .cfilt1_mv = 1800,
515 .cfilt2_mv = 1800,
516 .cfilt3_mv = 1800,
517 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
518 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
519 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
520 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
521 }
522};
523
524static struct slim_device apq8064_slim_tabla20 = {
525 .name = "tabla2x-slim",
526 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
527 .dev = {
528 .platform_data = &apq8064_tabla20_platform_data,
529 },
530};
531
Jing Lin21ed4de2012-02-05 15:53:28 -0800532/* configuration data for mxt1386e using V2.1 firmware */
533static const u8 mxt1386e_config_data_v2_1[] = {
534 /* T6 Object */
535 0, 0, 0, 0, 0, 0,
536 /* T38 Object */
537 14, 0, 0, 24, 1, 12, 0, 0, 0, 0,
538 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
539 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
540 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
541 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
542 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
543 0, 0, 0, 0,
544 /* T7 Object */
545 100, 16, 50,
546 /* T8 Object */
547 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
548 /* T9 Object */
549 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
550 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
551 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
552 10, 5, 0, 0, 0,
553 /* T18 Object */
554 0, 0,
555 /* T24 Object */
556 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
557 0, 0, 0, 0, 0, 0, 0, 0, 0,
558 /* T25 Object */
559 3, 0, 60, 115, 156, 99,
560 /* T27 Object */
561 0, 0, 0, 0, 0, 0, 0,
562 /* T40 Object */
563 0, 0, 0, 0, 0,
564 /* T42 Object */
565 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
566 /* T43 Object */
567 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
568 16,
569 /* T46 Object */
570 64, 0, 20, 20, 0, 0, 0, 0, 0,
571 /* T47 Object */
572 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
573 /* T48 Object */
574 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
575 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
576 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
577 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
578 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
579 0, 0, 0, 0,
580 /* T56 Object */
581 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
582 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
583 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
584 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
585 2, 99, 33, 0, 149, 24, 193, 255, 255, 255,
586 255,
587};
588
589#define MXT_TS_GPIO_IRQ 6
590#define MXT_TS_PWR_EN_GPIO PM8921_GPIO_PM_TO_SYS(23)
591#define MXT_TS_RESET_GPIO 33
592
593static struct mxt_config_info mxt_config_array[] = {
594 {
595 .config = mxt1386e_config_data_v2_1,
596 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
597 .family_id = 0xA0,
598 .variant_id = 0x7,
599 .version = 0x21,
600 .build = 0xAA,
601 },
602};
603
604static struct mxt_platform_data mxt_platform_data = {
605 .config_array = mxt_config_array,
606 .config_array_size = ARRAY_SIZE(mxt_config_array),
607 .x_size = 1365,
608 .y_size = 767,
609 .irqflags = IRQF_TRIGGER_FALLING,
610 .i2c_pull_up = true,
611 .reset_gpio = MXT_TS_RESET_GPIO,
612 .irq_gpio = MXT_TS_GPIO_IRQ,
613};
614
615static struct i2c_board_info mxt_device_info[] __initdata = {
616 {
617 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
618 .platform_data = &mxt_platform_data,
619 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
620 },
621};
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -0800622#define CYTTSP_TS_GPIO_IRQ 6
623#define CYTTSP_TS_GPIO_RESOUT 7
624#define CYTTSP_TS_GPIO_SLEEP 33
625
626static ssize_t tma340_vkeys_show(struct kobject *kobj,
627 struct kobj_attribute *attr, char *buf)
628{
629 return snprintf(buf, 200,
630 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
631 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
632 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
633 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
634 "\n");
635}
636
637static struct kobj_attribute tma340_vkeys_attr = {
638 .attr = {
639 .mode = S_IRUGO,
640 },
641 .show = &tma340_vkeys_show,
642};
643
644static struct attribute *tma340_properties_attrs[] = {
645 &tma340_vkeys_attr.attr,
646 NULL
647};
648
649static struct attribute_group tma340_properties_attr_group = {
650 .attrs = tma340_properties_attrs,
651};
652
653static int cyttsp_platform_init(struct i2c_client *client)
654{
655 int rc = 0;
656 static struct kobject *tma340_properties_kobj;
657
658 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
659 tma340_properties_kobj = kobject_create_and_add("board_properties",
660 NULL);
661 if (tma340_properties_kobj)
662 rc = sysfs_create_group(tma340_properties_kobj,
663 &tma340_properties_attr_group);
664 if (!tma340_properties_kobj || rc)
665 pr_err("%s: failed to create board_properties\n",
666 __func__);
667
668 return 0;
669}
670
671static struct cyttsp_regulator cyttsp_regulator_data[] = {
672 {
673 .name = "vdd",
674 .min_uV = CY_TMA300_VTG_MIN_UV,
675 .max_uV = CY_TMA300_VTG_MAX_UV,
676 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
677 .lpm_load_uA = CY_TMA300_CURR_24HZ_UA,
678 },
679 {
680 .name = "vcc_i2c",
681 .min_uV = CY_I2C_VTG_MIN_UV,
682 .max_uV = CY_I2C_VTG_MAX_UV,
683 .hpm_load_uA = CY_I2C_CURR_UA,
684 .lpm_load_uA = CY_I2C_CURR_UA,
685 },
686};
687
688static struct cyttsp_platform_data cyttsp_pdata = {
689 .panel_maxx = 634,
690 .panel_maxy = 1166,
691 .disp_maxx = 599,
692 .disp_maxy = 1023,
693 .disp_minx = 0,
694 .disp_miny = 0,
695 .flags = 0x01,
696 .gen = CY_GEN3,
697 .use_st = CY_USE_ST,
698 .use_mt = CY_USE_MT,
699 .use_hndshk = CY_SEND_HNDSHK,
700 .use_trk_id = CY_USE_TRACKING_ID,
701 .use_sleep = CY_USE_DEEP_SLEEP_SEL,
702 .use_gestures = CY_USE_GESTURES,
703 .fw_fname = "cyttsp_8064_mtp.hex",
704 /* change act_intrvl to customize the Active power state
705 * scanning/processing refresh interval for Operating mode
706 */
707 .act_intrvl = CY_ACT_INTRVL_DFLT,
708 /* change tch_tmout to customize the touch timeout for the
709 * Active power state for Operating mode
710 */
711 .tch_tmout = CY_TCH_TMOUT_DFLT,
712 /* change lp_intrvl to customize the Low Power power state
713 * scanning/processing refresh interval for Operating mode
714 */
715 .lp_intrvl = CY_LP_INTRVL_DFLT,
716 .sleep_gpio = CYTTSP_TS_GPIO_SLEEP,
717 .resout_gpio = CYTTSP_TS_GPIO_RESOUT,
718 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
719 .regulator_info = cyttsp_regulator_data,
720 .num_regulators = ARRAY_SIZE(cyttsp_regulator_data),
721 .init = cyttsp_platform_init,
722 .correct_fw_ver = 17,
723};
724
725static struct i2c_board_info cyttsp_info[] __initdata = {
726 {
727 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
728 .platform_data = &cyttsp_pdata,
729 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
730 },
731};
Jing Lin21ed4de2012-02-05 15:53:28 -0800732
Ankit Verma6b7e2ba2012-01-26 15:48:54 -0800733#define MSM_WCNSS_PHYS 0x03000000
734#define MSM_WCNSS_SIZE 0x280000
735
736static struct resource resources_wcnss_wlan[] = {
737 {
738 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
739 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
740 .name = "wcnss_wlanrx_irq",
741 .flags = IORESOURCE_IRQ,
742 },
743 {
744 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
745 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
746 .name = "wcnss_wlantx_irq",
747 .flags = IORESOURCE_IRQ,
748 },
749 {
750 .start = MSM_WCNSS_PHYS,
751 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
752 .name = "wcnss_mmio",
753 .flags = IORESOURCE_MEM,
754 },
755 {
756 .start = 64,
757 .end = 68,
758 .name = "wcnss_gpios_5wire",
759 .flags = IORESOURCE_IO,
760 },
761};
762
763static struct qcom_wcnss_opts qcom_wcnss_pdata = {
764 .has_48mhz_xo = 1,
765};
766
767static struct platform_device msm_device_wcnss_wlan = {
768 .name = "wcnss_wlan",
769 .id = 0,
770 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
771 .resource = resources_wcnss_wlan,
772 .dev = {.platform_data = &qcom_wcnss_pdata},
773};
774
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700775#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
776 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
777 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
778 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
779
780#define QCE_SIZE 0x10000
781#define QCE_0_BASE 0x11000000
782
783#define QCE_HW_KEY_SUPPORT 0
784#define QCE_SHA_HMAC_SUPPORT 1
785#define QCE_SHARE_CE_RESOURCE 3
786#define QCE_CE_SHARED 0
787
788static struct resource qcrypto_resources[] = {
789 [0] = {
790 .start = QCE_0_BASE,
791 .end = QCE_0_BASE + QCE_SIZE - 1,
792 .flags = IORESOURCE_MEM,
793 },
794 [1] = {
795 .name = "crypto_channels",
796 .start = DMOV8064_CE_IN_CHAN,
797 .end = DMOV8064_CE_OUT_CHAN,
798 .flags = IORESOURCE_DMA,
799 },
800 [2] = {
801 .name = "crypto_crci_in",
802 .start = DMOV8064_CE_IN_CRCI,
803 .end = DMOV8064_CE_IN_CRCI,
804 .flags = IORESOURCE_DMA,
805 },
806 [3] = {
807 .name = "crypto_crci_out",
808 .start = DMOV8064_CE_OUT_CRCI,
809 .end = DMOV8064_CE_OUT_CRCI,
810 .flags = IORESOURCE_DMA,
811 },
812};
813
814static struct resource qcedev_resources[] = {
815 [0] = {
816 .start = QCE_0_BASE,
817 .end = QCE_0_BASE + QCE_SIZE - 1,
818 .flags = IORESOURCE_MEM,
819 },
820 [1] = {
821 .name = "crypto_channels",
822 .start = DMOV8064_CE_IN_CHAN,
823 .end = DMOV8064_CE_OUT_CHAN,
824 .flags = IORESOURCE_DMA,
825 },
826 [2] = {
827 .name = "crypto_crci_in",
828 .start = DMOV8064_CE_IN_CRCI,
829 .end = DMOV8064_CE_IN_CRCI,
830 .flags = IORESOURCE_DMA,
831 },
832 [3] = {
833 .name = "crypto_crci_out",
834 .start = DMOV8064_CE_OUT_CRCI,
835 .end = DMOV8064_CE_OUT_CRCI,
836 .flags = IORESOURCE_DMA,
837 },
838};
839
840#endif
841
842#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
843 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
844
845static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
846 .ce_shared = QCE_CE_SHARED,
847 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
848 .hw_key_support = QCE_HW_KEY_SUPPORT,
849 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800850 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700851};
852
853static struct platform_device qcrypto_device = {
854 .name = "qcrypto",
855 .id = 0,
856 .num_resources = ARRAY_SIZE(qcrypto_resources),
857 .resource = qcrypto_resources,
858 .dev = {
859 .coherent_dma_mask = DMA_BIT_MASK(32),
860 .platform_data = &qcrypto_ce_hw_suppport,
861 },
862};
863#endif
864
865#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
866 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
867
868static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
869 .ce_shared = QCE_CE_SHARED,
870 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
871 .hw_key_support = QCE_HW_KEY_SUPPORT,
872 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800873 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700874};
875
876static struct platform_device qcedev_device = {
877 .name = "qce",
878 .id = 0,
879 .num_resources = ARRAY_SIZE(qcedev_resources),
880 .resource = qcedev_resources,
881 .dev = {
882 .coherent_dma_mask = DMA_BIT_MASK(32),
883 .platform_data = &qcedev_ce_hw_suppport,
884 },
885};
886#endif
887
Joel Kingdacbc822012-01-25 13:30:57 -0800888static struct mdm_platform_data mdm_platform_data = {
889 .mdm_version = "3.0",
890 .ramdump_delay_ms = 2000,
Hemant Kumara945b472012-01-25 15:08:06 -0800891 .peripheral_platform_device = &apq8064_device_hsic_host,
Joel Kingdacbc822012-01-25 13:30:57 -0800892};
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700893
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -0800894static struct tsens_platform_data apq_tsens_pdata = {
895 .tsens_factor = 1000,
896 .hw_type = APQ_8064,
897 .tsens_num_sensor = 11,
898 .slope = {1176, 1176, 1154, 1176, 1111,
899 1132, 1132, 1199, 1132, 1199, 1132},
900};
901
Jeff Hugo0c0f5e92011-09-28 13:55:45 -0600902#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700903static void __init apq8064_map_io(void)
904{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -0600905 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700906 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -0700907 if (socinfo_init() < 0)
908 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700909}
910
911static void __init apq8064_init_irq(void)
912{
Praveen Chidambaram78499012011-11-01 17:15:17 -0600913 struct msm_mpm_device_data *data = NULL;
914
915#ifdef CONFIG_MSM_MPM
916 data = &apq8064_mpm_dev_data;
917#endif
918
919 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700920 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
921 (void *)MSM_QGIC_CPU_BASE);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700922}
923
Jay Chokshi7805b5a2011-11-07 15:55:30 -0800924static struct platform_device msm8064_device_saw_regulator_core0 = {
925 .name = "saw-regulator",
926 .id = 0,
927 .dev = {
928 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
929 },
930};
931
932static struct platform_device msm8064_device_saw_regulator_core1 = {
933 .name = "saw-regulator",
934 .id = 1,
935 .dev = {
936 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
937 },
938};
939
940static struct platform_device msm8064_device_saw_regulator_core2 = {
941 .name = "saw-regulator",
942 .id = 2,
943 .dev = {
944 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
945 },
946};
947
948static struct platform_device msm8064_device_saw_regulator_core3 = {
949 .name = "saw-regulator",
950 .id = 3,
951 .dev = {
952 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -0600953
954 },
955};
956
957static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
958 {
959 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
960 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
961 true,
962 100, 8000, 100000, 1,
963 },
964
965 {
966 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
967 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
968 true,
969 2000, 6000, 60100000, 3000,
970 },
971
972 {
973 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
974 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
975 false,
976 4200, 5000, 60350000, 3500,
977 },
978
979 {
980 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
981 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
982 false,
983 6300, 4500, 65350000, 4800,
984 },
985
986 {
987 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
988 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
989 false,
990 11700, 2500, 67850000, 5500,
991 },
992
993 {
994 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
995 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
996 false,
997 13800, 2000, 71850000, 6800,
998 },
999
1000 {
1001 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1002 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1003 false,
1004 29700, 500, 75850000, 8800,
1005 },
1006
1007 {
1008 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1009 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1010 false,
1011 29700, 0, 76350000, 9800,
1012 },
1013};
1014
1015static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1016 .mode = MSM_PM_BOOT_CONFIG_TZ,
1017};
1018
1019static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
1020 .levels = &msm_rpmrs_levels[0],
1021 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
1022 .vdd_mem_levels = {
1023 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
1024 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
1025 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
1026 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
1027 },
1028 .vdd_dig_levels = {
1029 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
1030 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
1031 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
1032 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
1033 },
1034 .vdd_mask = 0x7FFFFF,
1035 .rpmrs_target_id = {
1036 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
1037 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
1038 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
1039 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
1040 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
1041 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
1042 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
1043 },
1044};
1045
1046static struct msm_cpuidle_state msm_cstates[] __initdata = {
1047 {0, 0, "C0", "WFI",
1048 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1049
1050 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1051 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1052
1053 {0, 2, "C2", "POWER_COLLAPSE",
1054 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
1055
1056 {1, 0, "C0", "WFI",
1057 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1058
1059 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1060 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1061
1062 {2, 0, "C0", "WFI",
1063 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1064
1065 {2, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1066 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1067
1068 {3, 0, "C0", "WFI",
1069 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1070
1071 {3, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1072 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1073};
1074
1075static struct msm_pm_platform_data msm_pm_data[] = {
1076 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1077 .idle_supported = 1,
1078 .suspend_supported = 1,
1079 .idle_enabled = 0,
1080 .suspend_enabled = 0,
1081 },
1082
1083 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1084 .idle_supported = 1,
1085 .suspend_supported = 1,
1086 .idle_enabled = 0,
1087 .suspend_enabled = 0,
1088 },
1089
1090 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1091 .idle_supported = 1,
1092 .suspend_supported = 1,
1093 .idle_enabled = 1,
1094 .suspend_enabled = 1,
1095 },
1096
1097 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1098 .idle_supported = 0,
1099 .suspend_supported = 1,
1100 .idle_enabled = 0,
1101 .suspend_enabled = 0,
1102 },
1103
1104 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1105 .idle_supported = 1,
1106 .suspend_supported = 1,
1107 .idle_enabled = 0,
1108 .suspend_enabled = 0,
1109 },
1110
1111 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1112 .idle_supported = 1,
1113 .suspend_supported = 0,
1114 .idle_enabled = 1,
1115 .suspend_enabled = 0,
1116 },
1117
1118 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1119 .idle_supported = 0,
1120 .suspend_supported = 1,
1121 .idle_enabled = 0,
1122 .suspend_enabled = 0,
1123 },
1124
1125 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1126 .idle_supported = 1,
1127 .suspend_supported = 1,
1128 .idle_enabled = 0,
1129 .suspend_enabled = 0,
1130 },
1131
1132 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1133 .idle_supported = 1,
1134 .suspend_supported = 0,
1135 .idle_enabled = 1,
1136 .suspend_enabled = 0,
1137 },
1138
1139 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1140 .idle_supported = 0,
1141 .suspend_supported = 1,
1142 .idle_enabled = 0,
1143 .suspend_enabled = 0,
1144 },
1145
1146 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1147 .idle_supported = 1,
1148 .suspend_supported = 1,
1149 .idle_enabled = 0,
1150 .suspend_enabled = 0,
1151 },
1152
1153 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1154 .idle_supported = 1,
1155 .suspend_supported = 0,
1156 .idle_enabled = 1,
1157 .suspend_enabled = 0,
1158 },
1159};
1160
1161static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1162 0x03, 0x0f,
1163};
1164
1165static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1166 0x00, 0x24, 0x54, 0x10,
1167 0x09, 0x03, 0x01,
1168 0x10, 0x54, 0x30, 0x0C,
1169 0x24, 0x30, 0x0f,
1170};
1171
1172static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1173 0x00, 0x24, 0x54, 0x10,
1174 0x09, 0x07, 0x01, 0x0B,
1175 0x10, 0x54, 0x30, 0x0C,
1176 0x24, 0x30, 0x0f,
1177};
1178
1179static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1180 [0] = {
1181 .mode = MSM_SPM_MODE_CLOCK_GATING,
1182 .notify_rpm = false,
1183 .cmd = spm_wfi_cmd_sequence,
1184 },
1185 [1] = {
1186 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1187 .notify_rpm = false,
1188 .cmd = spm_power_collapse_without_rpm,
1189 },
1190 [2] = {
1191 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1192 .notify_rpm = true,
1193 .cmd = spm_power_collapse_with_rpm,
1194 },
1195};
1196
1197static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1198 0x00, 0x20, 0x03, 0x20,
1199 0x00, 0x0f,
1200};
1201
1202static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1203 0x00, 0x20, 0x34, 0x64,
1204 0x48, 0x07, 0x48, 0x20,
1205 0x50, 0x64, 0x04, 0x34,
1206 0x50, 0x0f,
1207};
1208static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1209 0x00, 0x10, 0x34, 0x64,
1210 0x48, 0x07, 0x48, 0x10,
1211 0x50, 0x64, 0x04, 0x34,
1212 0x50, 0x0F,
1213};
1214
1215static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1216 [0] = {
1217 .mode = MSM_SPM_L2_MODE_RETENTION,
1218 .notify_rpm = false,
1219 .cmd = l2_spm_wfi_cmd_sequence,
1220 },
1221 [1] = {
1222 .mode = MSM_SPM_L2_MODE_GDHS,
1223 .notify_rpm = true,
1224 .cmd = l2_spm_gdhs_cmd_sequence,
1225 },
1226 [2] = {
1227 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1228 .notify_rpm = true,
1229 .cmd = l2_spm_power_off_cmd_sequence,
1230 },
1231};
1232
1233
1234static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1235 [0] = {
1236 .reg_base_addr = MSM_SAW_L2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001237 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
1238 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1239 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1240 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1241 .modes = msm_spm_l2_seq_list,
1242 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1243 },
1244};
1245
1246static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1247 [0] = {
1248 .reg_base_addr = MSM_SAW0_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001249 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001250#if defined(CONFIG_MSM_AVS_HW)
1251 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1252 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1253#endif
1254 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1255 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1256 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1257 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1258 .vctl_timeout_us = 50,
1259 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1260 .modes = msm_spm_seq_list,
1261 },
1262 [1] = {
1263 .reg_base_addr = MSM_SAW1_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001264 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001265#if defined(CONFIG_MSM_AVS_HW)
1266 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1267 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1268#endif
1269 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1270 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1271 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1272 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1273 .vctl_timeout_us = 50,
1274 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1275 .modes = msm_spm_seq_list,
1276 },
1277 [2] = {
1278 .reg_base_addr = MSM_SAW2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001279 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001280#if defined(CONFIG_MSM_AVS_HW)
1281 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1282 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1283#endif
1284 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1285 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1286 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1287 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1288 .vctl_timeout_us = 50,
1289 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1290 .modes = msm_spm_seq_list,
1291 },
1292 [3] = {
1293 .reg_base_addr = MSM_SAW3_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001294 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001295#if defined(CONFIG_MSM_AVS_HW)
1296 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1297 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1298#endif
1299 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1300 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1301 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1302 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1303 .vctl_timeout_us = 50,
1304 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1305 .modes = msm_spm_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001306 },
1307};
1308
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001309static void __init apq8064_init_buses(void)
1310{
1311 msm_bus_rpm_set_mt_mask();
1312 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
1313 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
1314 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
1315 msm_bus_8064_apps_fabric.dev.platform_data =
1316 &msm_bus_8064_apps_fabric_pdata;
1317 msm_bus_8064_sys_fabric.dev.platform_data =
1318 &msm_bus_8064_sys_fabric_pdata;
1319 msm_bus_8064_mm_fabric.dev.platform_data =
1320 &msm_bus_8064_mm_fabric_pdata;
1321 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
1322 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
1323}
1324
David Collinsf0d00732012-01-25 15:46:50 -08001325static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
1326 .name = GPIO_REGULATOR_DEV_NAME,
1327 .id = PM8921_MPP_PM_TO_SYS(7),
1328 .dev = {
1329 .platform_data
1330 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
1331 },
1332};
1333
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08001334static struct platform_device apq8064_device_ext_mpp8_vreg __devinitdata = {
1335 .name = GPIO_REGULATOR_DEV_NAME,
1336 .id = PM8921_MPP_PM_TO_SYS(8),
1337 .dev = {
1338 .platform_data
1339 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_MPP8],
1340 },
1341};
1342
David Collinsf0d00732012-01-25 15:46:50 -08001343static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
1344 .name = GPIO_REGULATOR_DEV_NAME,
1345 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
1346 .dev = {
1347 .platform_data =
1348 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
1349 },
1350};
1351
David Collins390fc332012-02-07 14:38:16 -08001352static struct platform_device apq8064_device_ext_ts_sw_vreg __devinitdata = {
1353 .name = GPIO_REGULATOR_DEV_NAME,
1354 .id = PM8921_GPIO_PM_TO_SYS(23),
1355 .dev = {
1356 .platform_data
1357 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_TS_SW],
1358 },
1359};
1360
David Collins2782b5c2012-02-06 10:02:42 -08001361static struct platform_device apq8064_device_rpm_regulator __devinitdata = {
1362 .name = "rpm-regulator",
1363 .id = -1,
1364 .dev = {
1365 .platform_data = &apq8064_rpm_regulator_pdata,
1366 },
1367};
1368
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001369static struct platform_device *common_devices[] __initdata = {
Jin Hong01f2dbb2011-11-03 22:13:51 -07001370 &apq8064_device_dmov,
Jing Lin04601f92012-02-05 15:36:07 -08001371 &apq8064_device_qup_i2c_gsbi3,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001372 &apq8064_device_qup_i2c_gsbi4,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001373 &apq8064_device_qup_spi_gsbi5,
David Collinsf0d00732012-01-25 15:46:50 -08001374 &apq8064_device_ext_5v_vreg,
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08001375 &apq8064_device_ext_mpp8_vreg,
David Collinsf0d00732012-01-25 15:46:50 -08001376 &apq8064_device_ext_3p3v_vreg,
David Collins390fc332012-02-07 14:38:16 -08001377 &apq8064_device_ext_ts_sw_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07001378 &apq8064_device_ssbi_pmic1,
1379 &apq8064_device_ssbi_pmic2,
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001380 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07001381 &apq8064_device_otg,
1382 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08001383 &apq8064_device_hsusb_host,
Hemant Kumara945b472012-01-25 15:08:06 -08001384 &apq8064_device_hsic_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07001385 &android_usb_device,
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001386 &msm_device_wcnss_wlan,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001387#ifdef CONFIG_ANDROID_PMEM
1388#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -07001389 &android_pmem_device,
1390 &android_pmem_adsp_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001391#endif
Kevin Chan13be4e22011-10-20 11:30:32 -07001392 &android_pmem_audio_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001393#endif
1394#ifdef CONFIG_ION_MSM
1395 &ion_dev,
1396#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001397 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001398 &msm8064_device_saw_regulator_core0,
1399 &msm8064_device_saw_regulator_core1,
1400 &msm8064_device_saw_regulator_core2,
1401 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001402#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1403 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1404 &qcrypto_device,
1405#endif
1406
1407#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1408 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1409 &qcedev_device,
1410#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07001411
1412#ifdef CONFIG_HW_RANDOM_MSM
1413 &apq8064_device_rng,
1414#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08001415 &apq_pcm,
1416 &apq_pcm_routing,
1417 &apq_cpudai0,
1418 &apq_cpudai1,
1419 &apq_cpudai_hdmi_rx,
1420 &apq_cpudai_bt_rx,
1421 &apq_cpudai_bt_tx,
1422 &apq_cpudai_fm_rx,
1423 &apq_cpudai_fm_tx,
1424 &apq_cpu_fe,
1425 &apq_stub_codec,
1426 &apq_voice,
1427 &apq_voip,
1428 &apq_lpa_pcm,
1429 &apq_pcm_hostless,
1430 &apq_cpudai_afe_01_rx,
1431 &apq_cpudai_afe_01_tx,
1432 &apq_cpudai_afe_02_rx,
1433 &apq_cpudai_afe_02_tx,
1434 &apq_pcm_afe,
1435 &apq_cpudai_auxpcm_rx,
1436 &apq_cpudai_auxpcm_tx,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001437 &apq8064_rpm_device,
1438 &apq8064_rpm_log_device,
1439 &apq8064_rpm_stat_device,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001440 &msm_bus_8064_apps_fabric,
1441 &msm_bus_8064_sys_fabric,
1442 &msm_bus_8064_mm_fabric,
1443 &msm_bus_8064_sys_fpb,
1444 &msm_bus_8064_cpss_fpb,
Mohan Kumar Gubbihalli Lachma Naik7f72edd2012-02-06 17:26:47 -08001445 &apq8064_msm_device_vidc,
Matt Wagantalled832652012-02-02 19:23:17 -08001446 &msm_8960_riva,
Matt Wagantallb94b9a52012-02-02 21:59:54 -08001447 &msm_8960_q6_lpass,
Matt Wagantall292aace2012-01-26 19:12:34 -08001448 &msm_gss,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001449};
1450
Joel King4e7ad222011-08-17 15:47:38 -07001451static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001452 &apq8064_device_uart_gsbi3,
Yan He06913ce2011-08-26 16:33:46 -07001453 &msm_device_sps_apq8064,
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001454};
1455
1456static struct platform_device *rumi3_devices[] __initdata = {
1457 &apq8064_device_uart_gsbi1,
Yan He435ed612011-11-23 17:34:59 -08001458 &msm_device_sps_apq8064,
Huaibin Yang4a084e32011-12-15 15:25:52 -08001459#ifdef CONFIG_MSM_ROTATOR
1460 &msm_rotator_device,
1461#endif
Joel King4e7ad222011-08-17 15:47:38 -07001462};
1463
Joel King82b7e3f2012-01-05 10:03:27 -08001464static struct platform_device *cdp_devices[] __initdata = {
1465 &apq8064_device_uart_gsbi1,
Jin Hong4bbbfba2012-02-02 21:48:07 -08001466 &apq8064_device_uart_gsbi7,
Joel King82b7e3f2012-01-05 10:03:27 -08001467 &msm_device_sps_apq8064,
1468};
1469
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001470static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08001471 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001472};
1473
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001474#define KS8851_IRQ_GPIO 43
1475
1476static struct spi_board_info spi_board_info[] __initdata = {
1477 {
1478 .modalias = "ks8851",
1479 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1480 .max_speed_hz = 19200000,
1481 .bus_num = 0,
1482 .chip_select = 2,
1483 .mode = SPI_MODE_0,
1484 },
1485};
1486
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001487static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001488 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001489 .bus_num = 1,
1490 .slim_slave = &apq8064_slim_tabla,
1491 },
1492 {
1493 .bus_num = 1,
1494 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001495 },
1496 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001497};
1498
Jing Lin04601f92012-02-05 15:36:07 -08001499static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi3_pdata = {
1500 .clk_freq = 100000,
1501 .src_clk_rate = 24000000,
1502};
1503
Kenneth Heitke748593a2011-07-15 15:45:11 -06001504static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
1505 .clk_freq = 100000,
1506 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001507};
1508
1509static void __init apq8064_i2c_init(void)
1510{
Jing Lin04601f92012-02-05 15:36:07 -08001511 apq8064_device_qup_i2c_gsbi3.dev.platform_data =
1512 &apq8064_i2c_qup_gsbi3_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06001513 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
1514 &apq8064_i2c_qup_gsbi4_pdata;
1515}
1516
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08001517#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001518static int ethernet_init(void)
1519{
1520 int ret;
1521 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
1522 if (ret) {
1523 pr_err("ks8851 gpio_request failed: %d\n", ret);
1524 goto fail;
1525 }
1526
1527 return 0;
1528fail:
1529 return ret;
1530}
1531#else
1532static int ethernet_init(void)
1533{
1534 return 0;
1535}
1536#endif
1537
Tianyi Gou41515e22011-09-01 19:37:43 -07001538static void __init apq8064_clock_init(void)
1539{
Tianyi Gouacb588d2012-01-27 18:24:05 -08001540 if (machine_is_apq8064_rumi3())
Tianyi Gou41515e22011-09-01 19:37:43 -07001541 msm_clock_init(&apq8064_dummy_clock_init_data);
Tianyi Gouacb588d2012-01-27 18:24:05 -08001542 else
1543 msm_clock_init(&apq8064_clock_init_data);
Tianyi Gou41515e22011-09-01 19:37:43 -07001544}
1545
Jing Lin417fa452012-02-05 14:31:06 -08001546#define I2C_SURF 1
1547#define I2C_FFA (1 << 1)
1548#define I2C_RUMI (1 << 2)
1549#define I2C_SIM (1 << 3)
1550#define I2C_LIQUID (1 << 4)
1551
1552struct i2c_registry {
1553 u8 machs;
1554 int bus;
1555 struct i2c_board_info *info;
1556 int len;
1557};
1558
1559static struct i2c_registry apq8064_i2c_devices[] __initdata = {
Jing Lin21ed4de2012-02-05 15:53:28 -08001560 {
1561 I2C_SURF | I2C_LIQUID,
1562 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
1563 mxt_device_info,
1564 ARRAY_SIZE(mxt_device_info),
1565 },
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001566 {
1567 I2C_FFA,
1568 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
1569 cyttsp_info,
1570 ARRAY_SIZE(cyttsp_info),
1571 },
Jing Lin417fa452012-02-05 14:31:06 -08001572};
1573
1574static void __init register_i2c_devices(void)
1575{
1576 u8 mach_mask = 0;
1577 int i;
1578
Kevin Chand07220e2012-02-13 15:52:22 -08001579#ifdef CONFIG_MSM_CAMERA
1580 struct i2c_registry apq8064_camera_i2c_devices = {
1581 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_RUMI,
1582 APQ_8064_GSBI4_QUP_I2C_BUS_ID,
1583 apq8064_camera_board_info.board_info,
1584 apq8064_camera_board_info.num_i2c_board_info,
1585 };
1586#endif
Jing Lin417fa452012-02-05 14:31:06 -08001587 /* Build the matching 'supported_machs' bitmask */
1588 if (machine_is_apq8064_cdp())
1589 mach_mask = I2C_SURF;
1590 else if (machine_is_apq8064_mtp())
1591 mach_mask = I2C_FFA;
1592 else if (machine_is_apq8064_liquid())
1593 mach_mask = I2C_LIQUID;
1594 else if (machine_is_apq8064_rumi3())
1595 mach_mask = I2C_RUMI;
1596 else if (machine_is_apq8064_sim())
1597 mach_mask = I2C_SIM;
1598 else
1599 pr_err("unmatched machine ID in register_i2c_devices\n");
1600
1601 /* Run the array and install devices as appropriate */
1602 for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) {
1603 if (apq8064_i2c_devices[i].machs & mach_mask)
1604 i2c_register_board_info(apq8064_i2c_devices[i].bus,
1605 apq8064_i2c_devices[i].info,
1606 apq8064_i2c_devices[i].len);
1607 }
Kevin Chand07220e2012-02-13 15:52:22 -08001608#ifdef CONFIG_MSM_CAMERA
1609 if (apq8064_camera_i2c_devices.machs & mach_mask)
1610 i2c_register_board_info(apq8064_camera_i2c_devices.bus,
1611 apq8064_camera_i2c_devices.info,
1612 apq8064_camera_i2c_devices.len);
1613#endif
Jing Lin417fa452012-02-05 14:31:06 -08001614}
1615
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001616static void __init apq8064_common_init(void)
1617{
1618 if (socinfo_init() < 0)
1619 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06001620 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
1621 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
David Collins2782b5c2012-02-06 10:02:42 -08001622 regulator_suppress_info_printing();
1623 platform_device_register(&apq8064_device_rpm_regulator);
Tianyi Gou41515e22011-09-01 19:37:43 -07001624 apq8064_clock_init();
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08001625 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06001626 apq8064_i2c_init();
Jing Lin417fa452012-02-05 14:31:06 -08001627 register_i2c_devices();
Kenneth Heitke36920d32011-07-20 16:44:30 -06001628
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001629 apq8064_device_qup_spi_gsbi5.dev.platform_data =
1630 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08001631 apq8064_init_pmic();
Hemant Kumar94e7da22012-02-03 16:52:29 -08001632 if (machine_is_apq8064_liquid())
1633 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001634 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Hemant Kumara945b472012-01-25 15:08:06 -08001635 apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001636 apq8064_init_buses();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001637 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Jay Chokshie8741282012-01-25 15:22:55 -08001638 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05301639 apq8064_init_mmc();
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08001640
1641 if (machine_is_apq8064_mtp()) {
1642 mdm_8064_device.dev.platform_data = &mdm_platform_data;
1643 platform_device_register(&mdm_8064_device);
1644 }
1645 platform_device_register(&apq8064_slim_ctrl);
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001646 slim_register_board_info(apq8064_slim_devices,
1647 ARRAY_SIZE(apq8064_slim_devices));
Praveen Chidambaram78499012011-11-01 17:15:17 -06001648 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Mahesh Sivasubramaniancbce1ec2012-01-24 10:32:44 -07001649 acpuclk_init(&acpuclk_8064_soc_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06001650 msm_spm_l2_init(msm_spm_l2_data);
1651 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
1652 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
1653 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
1654 msm_pm_data);
1655 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001656}
1657
Huaibin Yang4a084e32011-12-15 15:25:52 -08001658static void __init apq8064_allocate_memory_regions(void)
1659{
1660 apq8064_allocate_fb_region();
1661}
1662
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001663static void __init apq8064_sim_init(void)
1664{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001665 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
1666 &msm8064_device_watchdog.dev.platform_data;
1667
1668 wdog_pdata->bark_time = 15000;
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001669 msm_tsens_early_init(&apq_tsens_pdata);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001670 apq8064_common_init();
Joel King4e7ad222011-08-17 15:47:38 -07001671 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
1672}
1673
1674static void __init apq8064_rumi3_init(void)
1675{
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001676 msm_tsens_early_init(&apq_tsens_pdata);
Joel King4e7ad222011-08-17 15:47:38 -07001677 apq8064_common_init();
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001678 ethernet_init();
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001679 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001680 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Huaibin Yang4a084e32011-12-15 15:25:52 -08001681 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07001682 apq8064_init_gpu();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001683}
1684
Joel King82b7e3f2012-01-05 10:03:27 -08001685static void __init apq8064_cdp_init(void)
1686{
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001687 msm_tsens_early_init(&apq_tsens_pdata);
Joel King82b7e3f2012-01-05 10:03:27 -08001688 apq8064_common_init();
1689 ethernet_init();
1690 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
1691 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08001692 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07001693 apq8064_init_gpu();
Matt Wagantallef3cfe542012-02-04 19:01:08 -08001694 platform_add_devices(msm_footswitch_devices,
1695 msm_num_footswitch_devices);
Kevin Chand07220e2012-02-13 15:52:22 -08001696 apq8064_init_cam();
Joel King82b7e3f2012-01-05 10:03:27 -08001697}
1698
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001699MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
1700 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07001701 .reserve = apq8064_reserve,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001702 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05301703 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001704 .timer = &msm_timer,
1705 .init_machine = apq8064_sim_init,
1706MACHINE_END
1707
Joel King4e7ad222011-08-17 15:47:38 -07001708MACHINE_START(APQ8064_RUMI3, "QCT APQ8064 RUMI3")
1709 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07001710 .reserve = apq8064_reserve,
Joel King4e7ad222011-08-17 15:47:38 -07001711 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05301712 .handle_irq = gic_handle_irq,
Joel King4e7ad222011-08-17 15:47:38 -07001713 .timer = &msm_timer,
1714 .init_machine = apq8064_rumi3_init,
Huaibin Yang4a084e32011-12-15 15:25:52 -08001715 .init_early = apq8064_allocate_memory_regions,
Joel King4e7ad222011-08-17 15:47:38 -07001716MACHINE_END
1717
Joel King82b7e3f2012-01-05 10:03:27 -08001718MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
1719 .map_io = apq8064_map_io,
1720 .reserve = apq8064_reserve,
1721 .init_irq = apq8064_init_irq,
1722 .handle_irq = gic_handle_irq,
1723 .timer = &msm_timer,
1724 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08001725 .init_early = apq8064_allocate_memory_regions,
Joel King82b7e3f2012-01-05 10:03:27 -08001726MACHINE_END
1727
1728MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
1729 .map_io = apq8064_map_io,
1730 .reserve = apq8064_reserve,
1731 .init_irq = apq8064_init_irq,
1732 .handle_irq = gic_handle_irq,
1733 .timer = &msm_timer,
1734 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08001735 .init_early = apq8064_allocate_memory_regions,
Joel King82b7e3f2012-01-05 10:03:27 -08001736MACHINE_END
1737
1738MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
1739 .map_io = apq8064_map_io,
1740 .reserve = apq8064_reserve,
1741 .init_irq = apq8064_init_irq,
1742 .handle_irq = gic_handle_irq,
1743 .timer = &msm_timer,
1744 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08001745 .init_early = apq8064_allocate_memory_regions,
Joel King82b7e3f2012-01-05 10:03:27 -08001746MACHINE_END
1747