blob: 4b7c05d5d38e059a36bbde00b6b471a55f5a3d78 [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>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070033
34#include <mach/board.h>
35#include <mach/msm_iomap.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080036#include <mach/ion.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070037#include <linux/usb/msm_hsusb.h>
38#include <linux/usb/android.h>
39#include <mach/socinfo.h>
Harini Jayaramanc4c58692011-07-19 14:50:10 -060040#include <mach/msm_spi.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070041#include "timer.h"
42#include "devices.h"
Joel King4ebccc62011-07-22 09:43:22 -070043#include <mach/gpio.h>
44#include <mach/gpiomux.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060045#include <mach/rpm.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080046#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -070047#include <linux/android_pmem.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080048#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070049#include <mach/msm_memtypes.h>
50#include <linux/bootmem.h>
51#include <asm/setup.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070052#include <mach/dma.h>
Gagan Mac8a7a5d32011-11-11 16:43:06 -070053#include <mach/msm_bus_board.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060054#include <mach/cpuidle.h>
Joel Kingdacbc822012-01-25 13:30:57 -080055#include <mach/mdm2.h>
Joel King4ebccc62011-07-22 09:43:22 -070056
Jeff Ohlstein7e668552011-10-06 16:17:25 -070057#include "msm_watchdog.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080058#include "board-8064.h"
Vikram Mulukutlabc2e9572011-11-04 03:41:38 -070059#include "acpuclock.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060060#include "spm.h"
61#include "mpm.h"
62#include "rpm_resources.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080063#include "pm.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060064#include "pm-boot.h"
Rajesh Sastrulaaee8af32012-01-20 11:46:31 -080065#include "devices-msm8x60.h"
Jay Chokshiea67c622011-07-29 17:12:26 -070066
Olav Haugan7c6aa742012-01-16 16:47:37 -080067#define MSM_PMEM_ADSP_SIZE 0x7800000
Ben Romberger3ffcd812011-12-08 19:12:10 -080068#define MSM_PMEM_AUDIO_SIZE 0x2B4000
Olav Haugan7c6aa742012-01-16 16:47:37 -080069#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
70#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
71#else
72#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
73#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070074
Olav Haugan7c6aa742012-01-16 16:47:37 -080075#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Olav Hauganedcf6832012-01-24 08:35:41 -080076#define MSM_PMEM_KERNEL_EBI1_SIZE 0x280000
Olav Haugan7c6aa742012-01-16 16:47:37 -080077#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Haugand3d29682012-01-19 10:57:07 -080078#define MSM_ION_MM_FW_SIZE 0x200000 /* (2MB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -080079#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Hauganf45e2142012-01-19 11:01:01 -080080#define MSM_ION_QSECOM_SIZE 0x100000 /* (1MB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -080081#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan2c43fac2012-01-19 11:06:37 -080082#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
83#define MSM_ION_HEAP_NUM 8
Olav Haugan7c6aa742012-01-16 16:47:37 -080084#else
85#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
86#define MSM_ION_HEAP_NUM 1
87#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070088
Olav Haugan7c6aa742012-01-16 16:47:37 -080089#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
90static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
91static int __init pmem_kernel_ebi1_size_setup(char *p)
Kevin Chan13be4e22011-10-20 11:30:32 -070092{
Olav Haugan7c6aa742012-01-16 16:47:37 -080093 pmem_kernel_ebi1_size = memparse(p, NULL);
94 return 0;
Kevin Chan13be4e22011-10-20 11:30:32 -070095}
Olav Haugan7c6aa742012-01-16 16:47:37 -080096early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
97#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070098
Olav Haugan7c6aa742012-01-16 16:47:37 -080099#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -0700100static unsigned pmem_size = MSM_PMEM_SIZE;
101static int __init pmem_size_setup(char *p)
102{
103 pmem_size = memparse(p, NULL);
104 return 0;
105}
106early_param("pmem_size", pmem_size_setup);
107
108static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
109
110static int __init pmem_adsp_size_setup(char *p)
111{
112 pmem_adsp_size = memparse(p, NULL);
113 return 0;
114}
115early_param("pmem_adsp_size", pmem_adsp_size_setup);
116
117static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
118
119static int __init pmem_audio_size_setup(char *p)
120{
121 pmem_audio_size = memparse(p, NULL);
122 return 0;
123}
124early_param("pmem_audio_size", pmem_audio_size_setup);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800125#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700126
Olav Haugan7c6aa742012-01-16 16:47:37 -0800127#ifdef CONFIG_ANDROID_PMEM
128#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700129static struct android_pmem_platform_data android_pmem_pdata = {
130 .name = "pmem",
131 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
132 .cached = 1,
133 .memory_type = MEMTYPE_EBI1,
134};
135
136static struct platform_device android_pmem_device = {
137 .name = "android_pmem",
138 .id = 0,
139 .dev = {.platform_data = &android_pmem_pdata},
140};
141
142static struct android_pmem_platform_data android_pmem_adsp_pdata = {
143 .name = "pmem_adsp",
144 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
145 .cached = 0,
146 .memory_type = MEMTYPE_EBI1,
147};
Kevin Chan13be4e22011-10-20 11:30:32 -0700148static struct platform_device android_pmem_adsp_device = {
149 .name = "android_pmem",
150 .id = 2,
151 .dev = { .platform_data = &android_pmem_adsp_pdata },
152};
Olav Haugan7c6aa742012-01-16 16:47:37 -0800153#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700154
155static struct android_pmem_platform_data android_pmem_audio_pdata = {
156 .name = "pmem_audio",
157 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
158 .cached = 0,
159 .memory_type = MEMTYPE_EBI1,
160};
161
162static struct platform_device android_pmem_audio_device = {
163 .name = "android_pmem",
164 .id = 4,
165 .dev = { .platform_data = &android_pmem_audio_pdata },
166};
Olav Haugan7c6aa742012-01-16 16:47:37 -0800167#endif
168
169static struct memtype_reserve apq8064_reserve_table[] __initdata = {
170 [MEMTYPE_SMI] = {
171 },
172 [MEMTYPE_EBI0] = {
173 .flags = MEMTYPE_FLAGS_1M_ALIGN,
174 },
175 [MEMTYPE_EBI1] = {
176 .flags = MEMTYPE_FLAGS_1M_ALIGN,
177 },
178};
Kevin Chan13be4e22011-10-20 11:30:32 -0700179
180static void __init size_pmem_devices(void)
181{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800182#ifdef CONFIG_ANDROID_PMEM
183#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700184 android_pmem_adsp_pdata.size = pmem_adsp_size;
185 android_pmem_pdata.size = pmem_size;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800186#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700187 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800188#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700189}
190
191static void __init reserve_memory_for(struct android_pmem_platform_data *p)
192{
193 apq8064_reserve_table[p->memory_type].size += p->size;
194}
195
Kevin Chan13be4e22011-10-20 11:30:32 -0700196static void __init reserve_pmem_memory(void)
197{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800198#ifdef CONFIG_ANDROID_PMEM
199#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700200 reserve_memory_for(&android_pmem_adsp_pdata);
201 reserve_memory_for(&android_pmem_pdata);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800202#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700203 reserve_memory_for(&android_pmem_audio_pdata);
204 apq8064_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800205#endif
206}
207
208static int apq8064_paddr_to_memtype(unsigned int paddr)
209{
210 return MEMTYPE_EBI1;
211}
212
213#ifdef CONFIG_ION_MSM
214#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
215static struct ion_cp_heap_pdata cp_mm_ion_pdata = {
216 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugand3d29682012-01-19 10:57:07 -0800217 .align = PAGE_SIZE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800218};
219
220static struct ion_cp_heap_pdata cp_mfc_ion_pdata = {
221 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugand3d29682012-01-19 10:57:07 -0800222 .align = PAGE_SIZE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800223};
224
225static struct ion_co_heap_pdata co_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800226 .adjacent_mem_id = INVALID_HEAP_ID,
227 .align = PAGE_SIZE,
228};
229
230static struct ion_co_heap_pdata fw_co_ion_pdata = {
231 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
232 .align = SZ_128K,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800233};
234#endif
235static struct ion_platform_data ion_pdata = {
236 .nr = MSM_ION_HEAP_NUM,
237 .heaps = {
238 {
239 .id = ION_SYSTEM_HEAP_ID,
240 .type = ION_HEAP_TYPE_SYSTEM,
241 .name = ION_VMALLOC_HEAP_NAME,
242 },
243#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
244 {
245 .id = ION_SF_HEAP_ID,
246 .type = ION_HEAP_TYPE_CARVEOUT,
247 .name = ION_SF_HEAP_NAME,
248 .size = MSM_ION_SF_SIZE,
249 .memory_type = ION_EBI_TYPE,
250 .extra_data = (void *) &co_ion_pdata,
251 },
252 {
253 .id = ION_CP_MM_HEAP_ID,
254 .type = ION_HEAP_TYPE_CP,
255 .name = ION_MM_HEAP_NAME,
256 .size = MSM_ION_MM_SIZE,
257 .memory_type = ION_EBI_TYPE,
258 .extra_data = (void *) &cp_mm_ion_pdata,
259 },
260 {
Olav Haugand3d29682012-01-19 10:57:07 -0800261 .id = ION_MM_FIRMWARE_HEAP_ID,
262 .type = ION_HEAP_TYPE_CARVEOUT,
263 .name = ION_MM_FIRMWARE_HEAP_NAME,
264 .size = MSM_ION_MM_FW_SIZE,
265 .memory_type = ION_EBI_TYPE,
266 .extra_data = (void *) &fw_co_ion_pdata,
267 },
268 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800269 .id = ION_CP_MFC_HEAP_ID,
270 .type = ION_HEAP_TYPE_CP,
271 .name = ION_MFC_HEAP_NAME,
272 .size = MSM_ION_MFC_SIZE,
273 .memory_type = ION_EBI_TYPE,
274 .extra_data = (void *) &cp_mfc_ion_pdata,
275 },
276 {
277 .id = ION_IOMMU_HEAP_ID,
278 .type = ION_HEAP_TYPE_IOMMU,
279 .name = ION_IOMMU_HEAP_NAME,
280 },
Olav Hauganf45e2142012-01-19 11:01:01 -0800281 {
282 .id = ION_QSECOM_HEAP_ID,
283 .type = ION_HEAP_TYPE_CARVEOUT,
284 .name = ION_QSECOM_HEAP_NAME,
285 .size = MSM_ION_QSECOM_SIZE,
286 .memory_type = ION_EBI_TYPE,
287 .extra_data = (void *) &co_ion_pdata,
288 },
Olav Haugan2c43fac2012-01-19 11:06:37 -0800289 {
290 .id = ION_AUDIO_HEAP_ID,
291 .type = ION_HEAP_TYPE_CARVEOUT,
292 .name = ION_AUDIO_HEAP_NAME,
293 .size = MSM_ION_AUDIO_SIZE,
294 .memory_type = ION_EBI_TYPE,
295 .extra_data = (void *) &co_ion_pdata,
296 },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800297#endif
298 }
299};
300
301static struct platform_device ion_dev = {
302 .name = "ion-msm",
303 .id = 1,
304 .dev = { .platform_data = &ion_pdata },
305};
306#endif
307
308static void reserve_ion_memory(void)
309{
310#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
311 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_SIZE;
Olav Haugand3d29682012-01-19 10:57:07 -0800312 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_FW_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800313 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_SF_SIZE;
314 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MFC_SIZE;
Olav Hauganf45e2142012-01-19 11:01:01 -0800315 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_QSECOM_SIZE;
Olav Haugan2c43fac2012-01-19 11:06:37 -0800316 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_AUDIO_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800317#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700318}
319
Huaibin Yang4a084e32011-12-15 15:25:52 -0800320static void __init reserve_mdp_memory(void)
321{
322 apq8064_mdp_writeback(apq8064_reserve_table);
323}
324
Kevin Chan13be4e22011-10-20 11:30:32 -0700325static void __init apq8064_calculate_reserve_sizes(void)
326{
327 size_pmem_devices();
328 reserve_pmem_memory();
Olav Haugan7c6aa742012-01-16 16:47:37 -0800329 reserve_ion_memory();
Huaibin Yang4a084e32011-12-15 15:25:52 -0800330 reserve_mdp_memory();
Kevin Chan13be4e22011-10-20 11:30:32 -0700331}
332
333static struct reserve_info apq8064_reserve_info __initdata = {
334 .memtype_reserve_table = apq8064_reserve_table,
335 .calculate_reserve_sizes = apq8064_calculate_reserve_sizes,
336 .paddr_to_memtype = apq8064_paddr_to_memtype,
337};
338
339static int apq8064_memory_bank_size(void)
340{
341 return 1<<29;
342}
343
344static void __init locate_unstable_memory(void)
345{
346 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
347 unsigned long bank_size;
348 unsigned long low, high;
349
350 bank_size = apq8064_memory_bank_size();
351 low = meminfo.bank[0].start;
352 high = mb->start + mb->size;
Olav Haugand76e3a82012-01-16 16:55:07 -0800353
354 /* Check if 32 bit overflow occured */
355 if (high < mb->start)
356 high = ~0UL;
357
Kevin Chan13be4e22011-10-20 11:30:32 -0700358 low &= ~(bank_size - 1);
359
360 if (high - low <= bank_size)
361 return;
Jack Cheung46bfffa2012-01-19 15:26:24 -0800362 apq8064_reserve_info.low_unstable_address = mb->start -
363 MIN_MEMORY_BLOCK_SIZE + mb->size;
364 apq8064_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
365
Kevin Chan13be4e22011-10-20 11:30:32 -0700366 apq8064_reserve_info.bank_size = bank_size;
367 pr_info("low unstable address %lx max size %lx bank size %lx\n",
368 apq8064_reserve_info.low_unstable_address,
369 apq8064_reserve_info.max_unstable_size,
370 apq8064_reserve_info.bank_size);
371}
372
373static void __init apq8064_reserve(void)
374{
375 reserve_info = &apq8064_reserve_info;
376 locate_unstable_memory();
377 msm_reserve();
378}
379
Hemant Kumara945b472012-01-25 15:08:06 -0800380#ifdef CONFIG_USB_EHCI_MSM_HSIC
381static struct msm_hsic_host_platform_data msm_hsic_pdata = {
382 .strobe = 88,
383 .data = 89,
384};
385#else
386static struct msm_hsic_host_platform_data msm_hsic_pdata;
387#endif
388
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800389#define PID_MAGIC_ID 0x71432909
390#define SERIAL_NUM_MAGIC_ID 0x61945374
391#define SERIAL_NUMBER_LENGTH 127
392#define DLOAD_USB_BASE_ADD 0x2A03F0C8
393
394struct magic_num_struct {
395 uint32_t pid;
396 uint32_t serial_num;
397};
398
399struct dload_struct {
400 uint32_t reserved1;
401 uint32_t reserved2;
402 uint32_t reserved3;
403 uint16_t reserved4;
404 uint16_t pid;
405 char serial_number[SERIAL_NUMBER_LENGTH];
406 uint16_t reserved5;
407 struct magic_num_struct magic_struct;
408};
409
410static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
411{
412 struct dload_struct __iomem *dload = 0;
413
414 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
415 if (!dload) {
416 pr_err("%s: cannot remap I/O memory region: %08x\n",
417 __func__, DLOAD_USB_BASE_ADD);
418 return -ENXIO;
419 }
420
421 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
422 __func__, dload, pid, snum);
423 /* update pid */
424 dload->magic_struct.pid = PID_MAGIC_ID;
425 dload->pid = pid;
426
427 /* update serial number */
428 dload->magic_struct.serial_num = 0;
429 if (!snum) {
430 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
431 goto out;
432 }
433
434 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
435 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
436out:
437 iounmap(dload);
438 return 0;
439}
440
441static struct android_usb_platform_data android_usb_pdata = {
442 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
443};
444
Hemant Kumar4933b072011-10-17 23:43:11 -0700445static struct platform_device android_usb_device = {
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800446 .name = "android_usb",
447 .id = -1,
448 .dev = {
449 .platform_data = &android_usb_pdata,
450 },
Hemant Kumar4933b072011-10-17 23:43:11 -0700451};
452
453static struct msm_otg_platform_data msm_otg_pdata = {
Hemant Kumard86c4882012-01-24 19:39:37 -0800454 .mode = USB_OTG,
455 .otg_control = OTG_PMIC_CONTROL,
Hemant Kumar4933b072011-10-17 23:43:11 -0700456 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Hemant Kumard86c4882012-01-24 19:39:37 -0800457 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
458 .power_budget = 750,
Hemant Kumar4933b072011-10-17 23:43:11 -0700459};
460
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800461#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
462
463/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
464 * 4 micbiases are used to power various analog and digital
465 * microphones operating at 1800 mV. Technically, all micbiases
466 * can source from single cfilter since all microphones operate
467 * at the same voltage level. The arrangement below is to make
468 * sure all cfilters are exercised. LDO_H regulator ouput level
469 * does not need to be as high as 2.85V. It is choosen for
470 * microphone sensitivity purpose.
471 */
472static struct tabla_pdata apq8064_tabla_platform_data = {
473 .slimbus_slave_device = {
474 .name = "tabla-slave",
475 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
476 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800477 .irq = MSM_GPIO_TO_INT(42),
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800478 .irq_base = TABLA_INTERRUPT_BASE,
479 .num_irqs = NR_TABLA_IRQS,
480 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
481 .micbias = {
482 .ldoh_v = TABLA_LDOH_2P85_V,
483 .cfilt1_mv = 1800,
484 .cfilt2_mv = 1800,
485 .cfilt3_mv = 1800,
486 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
487 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
488 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
489 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
490 }
491};
492
493static struct slim_device apq8064_slim_tabla = {
494 .name = "tabla-slim",
495 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
496 .dev = {
497 .platform_data = &apq8064_tabla_platform_data,
498 },
499};
500
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800501static struct tabla_pdata apq8064_tabla20_platform_data = {
502 .slimbus_slave_device = {
503 .name = "tabla-slave",
504 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
505 },
506 .irq = MSM_GPIO_TO_INT(42),
507 .irq_base = TABLA_INTERRUPT_BASE,
508 .num_irqs = NR_TABLA_IRQS,
509 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
510 .micbias = {
511 .ldoh_v = TABLA_LDOH_2P85_V,
512 .cfilt1_mv = 1800,
513 .cfilt2_mv = 1800,
514 .cfilt3_mv = 1800,
515 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
516 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
517 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
518 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
519 }
520};
521
522static struct slim_device apq8064_slim_tabla20 = {
523 .name = "tabla2x-slim",
524 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
525 .dev = {
526 .platform_data = &apq8064_tabla20_platform_data,
527 },
528};
529
Jing Lin21ed4de2012-02-05 15:53:28 -0800530/* configuration data for mxt1386e using V2.1 firmware */
531static const u8 mxt1386e_config_data_v2_1[] = {
532 /* T6 Object */
533 0, 0, 0, 0, 0, 0,
534 /* T38 Object */
535 14, 0, 0, 24, 1, 12, 0, 0, 0, 0,
536 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
537 0, 0, 0, 0, 0, 0, 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,
542 /* T7 Object */
543 100, 16, 50,
544 /* T8 Object */
545 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
546 /* T9 Object */
547 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
548 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
549 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
550 10, 5, 0, 0, 0,
551 /* T18 Object */
552 0, 0,
553 /* T24 Object */
554 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
555 0, 0, 0, 0, 0, 0, 0, 0, 0,
556 /* T25 Object */
557 3, 0, 60, 115, 156, 99,
558 /* T27 Object */
559 0, 0, 0, 0, 0, 0, 0,
560 /* T40 Object */
561 0, 0, 0, 0, 0,
562 /* T42 Object */
563 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
564 /* T43 Object */
565 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
566 16,
567 /* T46 Object */
568 64, 0, 20, 20, 0, 0, 0, 0, 0,
569 /* T47 Object */
570 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
571 /* T48 Object */
572 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
573 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
574 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
575 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
576 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
577 0, 0, 0, 0,
578 /* T56 Object */
579 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
580 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
581 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
582 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
583 2, 99, 33, 0, 149, 24, 193, 255, 255, 255,
584 255,
585};
586
587#define MXT_TS_GPIO_IRQ 6
588#define MXT_TS_PWR_EN_GPIO PM8921_GPIO_PM_TO_SYS(23)
589#define MXT_TS_RESET_GPIO 33
590
591static struct mxt_config_info mxt_config_array[] = {
592 {
593 .config = mxt1386e_config_data_v2_1,
594 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
595 .family_id = 0xA0,
596 .variant_id = 0x7,
597 .version = 0x21,
598 .build = 0xAA,
599 },
600};
601
602static struct mxt_platform_data mxt_platform_data = {
603 .config_array = mxt_config_array,
604 .config_array_size = ARRAY_SIZE(mxt_config_array),
605 .x_size = 1365,
606 .y_size = 767,
607 .irqflags = IRQF_TRIGGER_FALLING,
608 .i2c_pull_up = true,
609 .reset_gpio = MXT_TS_RESET_GPIO,
610 .irq_gpio = MXT_TS_GPIO_IRQ,
611};
612
613static struct i2c_board_info mxt_device_info[] __initdata = {
614 {
615 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
616 .platform_data = &mxt_platform_data,
617 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
618 },
619};
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -0800620#define CYTTSP_TS_GPIO_IRQ 6
621#define CYTTSP_TS_GPIO_RESOUT 7
622#define CYTTSP_TS_GPIO_SLEEP 33
623
624static ssize_t tma340_vkeys_show(struct kobject *kobj,
625 struct kobj_attribute *attr, char *buf)
626{
627 return snprintf(buf, 200,
628 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
629 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
630 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
631 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
632 "\n");
633}
634
635static struct kobj_attribute tma340_vkeys_attr = {
636 .attr = {
637 .mode = S_IRUGO,
638 },
639 .show = &tma340_vkeys_show,
640};
641
642static struct attribute *tma340_properties_attrs[] = {
643 &tma340_vkeys_attr.attr,
644 NULL
645};
646
647static struct attribute_group tma340_properties_attr_group = {
648 .attrs = tma340_properties_attrs,
649};
650
651static int cyttsp_platform_init(struct i2c_client *client)
652{
653 int rc = 0;
654 static struct kobject *tma340_properties_kobj;
655
656 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
657 tma340_properties_kobj = kobject_create_and_add("board_properties",
658 NULL);
659 if (tma340_properties_kobj)
660 rc = sysfs_create_group(tma340_properties_kobj,
661 &tma340_properties_attr_group);
662 if (!tma340_properties_kobj || rc)
663 pr_err("%s: failed to create board_properties\n",
664 __func__);
665
666 return 0;
667}
668
669static struct cyttsp_regulator cyttsp_regulator_data[] = {
670 {
671 .name = "vdd",
672 .min_uV = CY_TMA300_VTG_MIN_UV,
673 .max_uV = CY_TMA300_VTG_MAX_UV,
674 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
675 .lpm_load_uA = CY_TMA300_CURR_24HZ_UA,
676 },
677 {
678 .name = "vcc_i2c",
679 .min_uV = CY_I2C_VTG_MIN_UV,
680 .max_uV = CY_I2C_VTG_MAX_UV,
681 .hpm_load_uA = CY_I2C_CURR_UA,
682 .lpm_load_uA = CY_I2C_CURR_UA,
683 },
684};
685
686static struct cyttsp_platform_data cyttsp_pdata = {
687 .panel_maxx = 634,
688 .panel_maxy = 1166,
689 .disp_maxx = 599,
690 .disp_maxy = 1023,
691 .disp_minx = 0,
692 .disp_miny = 0,
693 .flags = 0x01,
694 .gen = CY_GEN3,
695 .use_st = CY_USE_ST,
696 .use_mt = CY_USE_MT,
697 .use_hndshk = CY_SEND_HNDSHK,
698 .use_trk_id = CY_USE_TRACKING_ID,
699 .use_sleep = CY_USE_DEEP_SLEEP_SEL,
700 .use_gestures = CY_USE_GESTURES,
701 .fw_fname = "cyttsp_8064_mtp.hex",
702 /* change act_intrvl to customize the Active power state
703 * scanning/processing refresh interval for Operating mode
704 */
705 .act_intrvl = CY_ACT_INTRVL_DFLT,
706 /* change tch_tmout to customize the touch timeout for the
707 * Active power state for Operating mode
708 */
709 .tch_tmout = CY_TCH_TMOUT_DFLT,
710 /* change lp_intrvl to customize the Low Power power state
711 * scanning/processing refresh interval for Operating mode
712 */
713 .lp_intrvl = CY_LP_INTRVL_DFLT,
714 .sleep_gpio = CYTTSP_TS_GPIO_SLEEP,
715 .resout_gpio = CYTTSP_TS_GPIO_RESOUT,
716 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
717 .regulator_info = cyttsp_regulator_data,
718 .num_regulators = ARRAY_SIZE(cyttsp_regulator_data),
719 .init = cyttsp_platform_init,
720 .correct_fw_ver = 17,
721};
722
723static struct i2c_board_info cyttsp_info[] __initdata = {
724 {
725 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
726 .platform_data = &cyttsp_pdata,
727 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
728 },
729};
Jing Lin21ed4de2012-02-05 15:53:28 -0800730
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700731#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
732 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
733 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
734 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
735
736#define QCE_SIZE 0x10000
737#define QCE_0_BASE 0x11000000
738
739#define QCE_HW_KEY_SUPPORT 0
740#define QCE_SHA_HMAC_SUPPORT 1
741#define QCE_SHARE_CE_RESOURCE 3
742#define QCE_CE_SHARED 0
743
744static struct resource qcrypto_resources[] = {
745 [0] = {
746 .start = QCE_0_BASE,
747 .end = QCE_0_BASE + QCE_SIZE - 1,
748 .flags = IORESOURCE_MEM,
749 },
750 [1] = {
751 .name = "crypto_channels",
752 .start = DMOV8064_CE_IN_CHAN,
753 .end = DMOV8064_CE_OUT_CHAN,
754 .flags = IORESOURCE_DMA,
755 },
756 [2] = {
757 .name = "crypto_crci_in",
758 .start = DMOV8064_CE_IN_CRCI,
759 .end = DMOV8064_CE_IN_CRCI,
760 .flags = IORESOURCE_DMA,
761 },
762 [3] = {
763 .name = "crypto_crci_out",
764 .start = DMOV8064_CE_OUT_CRCI,
765 .end = DMOV8064_CE_OUT_CRCI,
766 .flags = IORESOURCE_DMA,
767 },
768};
769
770static struct resource qcedev_resources[] = {
771 [0] = {
772 .start = QCE_0_BASE,
773 .end = QCE_0_BASE + QCE_SIZE - 1,
774 .flags = IORESOURCE_MEM,
775 },
776 [1] = {
777 .name = "crypto_channels",
778 .start = DMOV8064_CE_IN_CHAN,
779 .end = DMOV8064_CE_OUT_CHAN,
780 .flags = IORESOURCE_DMA,
781 },
782 [2] = {
783 .name = "crypto_crci_in",
784 .start = DMOV8064_CE_IN_CRCI,
785 .end = DMOV8064_CE_IN_CRCI,
786 .flags = IORESOURCE_DMA,
787 },
788 [3] = {
789 .name = "crypto_crci_out",
790 .start = DMOV8064_CE_OUT_CRCI,
791 .end = DMOV8064_CE_OUT_CRCI,
792 .flags = IORESOURCE_DMA,
793 },
794};
795
796#endif
797
798#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
799 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
800
801static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
802 .ce_shared = QCE_CE_SHARED,
803 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
804 .hw_key_support = QCE_HW_KEY_SUPPORT,
805 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800806 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700807};
808
809static struct platform_device qcrypto_device = {
810 .name = "qcrypto",
811 .id = 0,
812 .num_resources = ARRAY_SIZE(qcrypto_resources),
813 .resource = qcrypto_resources,
814 .dev = {
815 .coherent_dma_mask = DMA_BIT_MASK(32),
816 .platform_data = &qcrypto_ce_hw_suppport,
817 },
818};
819#endif
820
821#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
822 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
823
824static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
825 .ce_shared = QCE_CE_SHARED,
826 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
827 .hw_key_support = QCE_HW_KEY_SUPPORT,
828 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800829 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700830};
831
832static struct platform_device qcedev_device = {
833 .name = "qce",
834 .id = 0,
835 .num_resources = ARRAY_SIZE(qcedev_resources),
836 .resource = qcedev_resources,
837 .dev = {
838 .coherent_dma_mask = DMA_BIT_MASK(32),
839 .platform_data = &qcedev_ce_hw_suppport,
840 },
841};
842#endif
843
Joel Kingdacbc822012-01-25 13:30:57 -0800844static struct mdm_platform_data mdm_platform_data = {
845 .mdm_version = "3.0",
846 .ramdump_delay_ms = 2000,
Hemant Kumara945b472012-01-25 15:08:06 -0800847 .peripheral_platform_device = &apq8064_device_hsic_host,
Joel Kingdacbc822012-01-25 13:30:57 -0800848};
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700849
Jeff Hugo0c0f5e92011-09-28 13:55:45 -0600850#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700851static void __init apq8064_map_io(void)
852{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -0600853 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700854 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -0700855 if (socinfo_init() < 0)
856 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700857}
858
859static void __init apq8064_init_irq(void)
860{
Praveen Chidambaram78499012011-11-01 17:15:17 -0600861 struct msm_mpm_device_data *data = NULL;
862
863#ifdef CONFIG_MSM_MPM
864 data = &apq8064_mpm_dev_data;
865#endif
866
867 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700868 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
869 (void *)MSM_QGIC_CPU_BASE);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700870}
871
Jay Chokshi7805b5a2011-11-07 15:55:30 -0800872static struct platform_device msm8064_device_saw_regulator_core0 = {
873 .name = "saw-regulator",
874 .id = 0,
875 .dev = {
876 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
877 },
878};
879
880static struct platform_device msm8064_device_saw_regulator_core1 = {
881 .name = "saw-regulator",
882 .id = 1,
883 .dev = {
884 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
885 },
886};
887
888static struct platform_device msm8064_device_saw_regulator_core2 = {
889 .name = "saw-regulator",
890 .id = 2,
891 .dev = {
892 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
893 },
894};
895
896static struct platform_device msm8064_device_saw_regulator_core3 = {
897 .name = "saw-regulator",
898 .id = 3,
899 .dev = {
900 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -0600901
902 },
903};
904
905static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
906 {
907 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
908 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
909 true,
910 100, 8000, 100000, 1,
911 },
912
913 {
914 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
915 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
916 true,
917 2000, 6000, 60100000, 3000,
918 },
919
920 {
921 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
922 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
923 false,
924 4200, 5000, 60350000, 3500,
925 },
926
927 {
928 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
929 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
930 false,
931 6300, 4500, 65350000, 4800,
932 },
933
934 {
935 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
936 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
937 false,
938 11700, 2500, 67850000, 5500,
939 },
940
941 {
942 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
943 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
944 false,
945 13800, 2000, 71850000, 6800,
946 },
947
948 {
949 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
950 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
951 false,
952 29700, 500, 75850000, 8800,
953 },
954
955 {
956 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
957 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
958 false,
959 29700, 0, 76350000, 9800,
960 },
961};
962
963static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
964 .mode = MSM_PM_BOOT_CONFIG_TZ,
965};
966
967static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
968 .levels = &msm_rpmrs_levels[0],
969 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
970 .vdd_mem_levels = {
971 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
972 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
973 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
974 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
975 },
976 .vdd_dig_levels = {
977 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
978 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
979 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
980 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
981 },
982 .vdd_mask = 0x7FFFFF,
983 .rpmrs_target_id = {
984 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
985 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
986 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
987 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
988 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
989 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
990 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
991 },
992};
993
994static struct msm_cpuidle_state msm_cstates[] __initdata = {
995 {0, 0, "C0", "WFI",
996 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
997
998 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
999 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1000
1001 {0, 2, "C2", "POWER_COLLAPSE",
1002 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
1003
1004 {1, 0, "C0", "WFI",
1005 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1006
1007 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1008 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1009
1010 {2, 0, "C0", "WFI",
1011 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1012
1013 {2, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1014 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1015
1016 {3, 0, "C0", "WFI",
1017 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1018
1019 {3, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1020 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1021};
1022
1023static struct msm_pm_platform_data msm_pm_data[] = {
1024 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1025 .idle_supported = 1,
1026 .suspend_supported = 1,
1027 .idle_enabled = 0,
1028 .suspend_enabled = 0,
1029 },
1030
1031 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1032 .idle_supported = 1,
1033 .suspend_supported = 1,
1034 .idle_enabled = 0,
1035 .suspend_enabled = 0,
1036 },
1037
1038 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1039 .idle_supported = 1,
1040 .suspend_supported = 1,
1041 .idle_enabled = 1,
1042 .suspend_enabled = 1,
1043 },
1044
1045 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1046 .idle_supported = 0,
1047 .suspend_supported = 1,
1048 .idle_enabled = 0,
1049 .suspend_enabled = 0,
1050 },
1051
1052 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1053 .idle_supported = 1,
1054 .suspend_supported = 1,
1055 .idle_enabled = 0,
1056 .suspend_enabled = 0,
1057 },
1058
1059 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1060 .idle_supported = 1,
1061 .suspend_supported = 0,
1062 .idle_enabled = 1,
1063 .suspend_enabled = 0,
1064 },
1065
1066 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1067 .idle_supported = 0,
1068 .suspend_supported = 1,
1069 .idle_enabled = 0,
1070 .suspend_enabled = 0,
1071 },
1072
1073 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1074 .idle_supported = 1,
1075 .suspend_supported = 1,
1076 .idle_enabled = 0,
1077 .suspend_enabled = 0,
1078 },
1079
1080 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1081 .idle_supported = 1,
1082 .suspend_supported = 0,
1083 .idle_enabled = 1,
1084 .suspend_enabled = 0,
1085 },
1086
1087 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1088 .idle_supported = 0,
1089 .suspend_supported = 1,
1090 .idle_enabled = 0,
1091 .suspend_enabled = 0,
1092 },
1093
1094 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1095 .idle_supported = 1,
1096 .suspend_supported = 1,
1097 .idle_enabled = 0,
1098 .suspend_enabled = 0,
1099 },
1100
1101 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1102 .idle_supported = 1,
1103 .suspend_supported = 0,
1104 .idle_enabled = 1,
1105 .suspend_enabled = 0,
1106 },
1107};
1108
1109static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1110 0x03, 0x0f,
1111};
1112
1113static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1114 0x00, 0x24, 0x54, 0x10,
1115 0x09, 0x03, 0x01,
1116 0x10, 0x54, 0x30, 0x0C,
1117 0x24, 0x30, 0x0f,
1118};
1119
1120static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1121 0x00, 0x24, 0x54, 0x10,
1122 0x09, 0x07, 0x01, 0x0B,
1123 0x10, 0x54, 0x30, 0x0C,
1124 0x24, 0x30, 0x0f,
1125};
1126
1127static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1128 [0] = {
1129 .mode = MSM_SPM_MODE_CLOCK_GATING,
1130 .notify_rpm = false,
1131 .cmd = spm_wfi_cmd_sequence,
1132 },
1133 [1] = {
1134 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1135 .notify_rpm = false,
1136 .cmd = spm_power_collapse_without_rpm,
1137 },
1138 [2] = {
1139 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1140 .notify_rpm = true,
1141 .cmd = spm_power_collapse_with_rpm,
1142 },
1143};
1144
1145static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1146 0x00, 0x20, 0x03, 0x20,
1147 0x00, 0x0f,
1148};
1149
1150static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1151 0x00, 0x20, 0x34, 0x64,
1152 0x48, 0x07, 0x48, 0x20,
1153 0x50, 0x64, 0x04, 0x34,
1154 0x50, 0x0f,
1155};
1156static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1157 0x00, 0x10, 0x34, 0x64,
1158 0x48, 0x07, 0x48, 0x10,
1159 0x50, 0x64, 0x04, 0x34,
1160 0x50, 0x0F,
1161};
1162
1163static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1164 [0] = {
1165 .mode = MSM_SPM_L2_MODE_RETENTION,
1166 .notify_rpm = false,
1167 .cmd = l2_spm_wfi_cmd_sequence,
1168 },
1169 [1] = {
1170 .mode = MSM_SPM_L2_MODE_GDHS,
1171 .notify_rpm = true,
1172 .cmd = l2_spm_gdhs_cmd_sequence,
1173 },
1174 [2] = {
1175 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1176 .notify_rpm = true,
1177 .cmd = l2_spm_power_off_cmd_sequence,
1178 },
1179};
1180
1181
1182static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1183 [0] = {
1184 .reg_base_addr = MSM_SAW_L2_BASE,
1185 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1186 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
1187 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1188 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1189 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1190 .modes = msm_spm_l2_seq_list,
1191 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1192 },
1193};
1194
1195static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1196 [0] = {
1197 .reg_base_addr = MSM_SAW0_BASE,
1198 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1199 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
1200 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
1201#if defined(CONFIG_MSM_AVS_HW)
1202 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1203 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1204#endif
1205 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1206 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1207 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1208 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1209 .vctl_timeout_us = 50,
1210 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1211 .modes = msm_spm_seq_list,
1212 },
1213 [1] = {
1214 .reg_base_addr = MSM_SAW1_BASE,
1215 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1216 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
1217 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
1218#if defined(CONFIG_MSM_AVS_HW)
1219 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1220 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1221#endif
1222 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1223 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1224 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1225 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1226 .vctl_timeout_us = 50,
1227 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1228 .modes = msm_spm_seq_list,
1229 },
1230 [2] = {
1231 .reg_base_addr = MSM_SAW2_BASE,
1232 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1233 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
1234 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
1235#if defined(CONFIG_MSM_AVS_HW)
1236 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1237 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1238#endif
1239 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1240 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1241 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1242 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1243 .vctl_timeout_us = 50,
1244 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1245 .modes = msm_spm_seq_list,
1246 },
1247 [3] = {
1248 .reg_base_addr = MSM_SAW3_BASE,
1249 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1250 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
1251 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
1252#if defined(CONFIG_MSM_AVS_HW)
1253 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1254 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1255#endif
1256 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1257 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1258 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1259 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1260 .vctl_timeout_us = 50,
1261 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1262 .modes = msm_spm_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001263 },
1264};
1265
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001266static void __init apq8064_init_buses(void)
1267{
1268 msm_bus_rpm_set_mt_mask();
1269 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
1270 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
1271 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
1272 msm_bus_8064_apps_fabric.dev.platform_data =
1273 &msm_bus_8064_apps_fabric_pdata;
1274 msm_bus_8064_sys_fabric.dev.platform_data =
1275 &msm_bus_8064_sys_fabric_pdata;
1276 msm_bus_8064_mm_fabric.dev.platform_data =
1277 &msm_bus_8064_mm_fabric_pdata;
1278 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
1279 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
1280}
1281
David Collinsf0d00732012-01-25 15:46:50 -08001282static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
1283 .name = GPIO_REGULATOR_DEV_NAME,
1284 .id = PM8921_MPP_PM_TO_SYS(7),
1285 .dev = {
1286 .platform_data
1287 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
1288 },
1289};
1290
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08001291static struct platform_device apq8064_device_ext_mpp8_vreg __devinitdata = {
1292 .name = GPIO_REGULATOR_DEV_NAME,
1293 .id = PM8921_MPP_PM_TO_SYS(8),
1294 .dev = {
1295 .platform_data
1296 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_MPP8],
1297 },
1298};
1299
David Collinsf0d00732012-01-25 15:46:50 -08001300static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
1301 .name = GPIO_REGULATOR_DEV_NAME,
1302 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
1303 .dev = {
1304 .platform_data =
1305 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
1306 },
1307};
1308
David Collins390fc332012-02-07 14:38:16 -08001309static struct platform_device apq8064_device_ext_ts_sw_vreg __devinitdata = {
1310 .name = GPIO_REGULATOR_DEV_NAME,
1311 .id = PM8921_GPIO_PM_TO_SYS(23),
1312 .dev = {
1313 .platform_data
1314 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_TS_SW],
1315 },
1316};
1317
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001318static struct platform_device *common_devices[] __initdata = {
Jin Hong01f2dbb2011-11-03 22:13:51 -07001319 &apq8064_device_dmov,
Jing Lin04601f92012-02-05 15:36:07 -08001320 &apq8064_device_qup_i2c_gsbi3,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001321 &apq8064_device_qup_i2c_gsbi4,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001322 &apq8064_device_qup_spi_gsbi5,
David Collinsf0d00732012-01-25 15:46:50 -08001323 &apq8064_device_ext_5v_vreg,
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08001324 &apq8064_device_ext_mpp8_vreg,
David Collinsf0d00732012-01-25 15:46:50 -08001325 &apq8064_device_ext_3p3v_vreg,
David Collins390fc332012-02-07 14:38:16 -08001326 &apq8064_device_ext_ts_sw_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07001327 &apq8064_device_ssbi_pmic1,
1328 &apq8064_device_ssbi_pmic2,
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001329 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07001330 &apq8064_device_otg,
1331 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08001332 &apq8064_device_hsusb_host,
Hemant Kumara945b472012-01-25 15:08:06 -08001333 &apq8064_device_hsic_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07001334 &android_usb_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001335#ifdef CONFIG_ANDROID_PMEM
1336#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -07001337 &android_pmem_device,
1338 &android_pmem_adsp_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001339#endif
Kevin Chan13be4e22011-10-20 11:30:32 -07001340 &android_pmem_audio_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001341#endif
1342#ifdef CONFIG_ION_MSM
1343 &ion_dev,
1344#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001345 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001346 &msm8064_device_saw_regulator_core0,
1347 &msm8064_device_saw_regulator_core1,
1348 &msm8064_device_saw_regulator_core2,
1349 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001350#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1351 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1352 &qcrypto_device,
1353#endif
1354
1355#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1356 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1357 &qcedev_device,
1358#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07001359
1360#ifdef CONFIG_HW_RANDOM_MSM
1361 &apq8064_device_rng,
1362#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08001363 &apq_pcm,
1364 &apq_pcm_routing,
1365 &apq_cpudai0,
1366 &apq_cpudai1,
1367 &apq_cpudai_hdmi_rx,
1368 &apq_cpudai_bt_rx,
1369 &apq_cpudai_bt_tx,
1370 &apq_cpudai_fm_rx,
1371 &apq_cpudai_fm_tx,
1372 &apq_cpu_fe,
1373 &apq_stub_codec,
1374 &apq_voice,
1375 &apq_voip,
1376 &apq_lpa_pcm,
1377 &apq_pcm_hostless,
1378 &apq_cpudai_afe_01_rx,
1379 &apq_cpudai_afe_01_tx,
1380 &apq_cpudai_afe_02_rx,
1381 &apq_cpudai_afe_02_tx,
1382 &apq_pcm_afe,
1383 &apq_cpudai_auxpcm_rx,
1384 &apq_cpudai_auxpcm_tx,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001385 &apq8064_rpm_device,
1386 &apq8064_rpm_log_device,
1387 &apq8064_rpm_stat_device,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001388 &msm_bus_8064_apps_fabric,
1389 &msm_bus_8064_sys_fabric,
1390 &msm_bus_8064_mm_fabric,
1391 &msm_bus_8064_sys_fpb,
1392 &msm_bus_8064_cpss_fpb,
Rajesh Sastrulaaee8af32012-01-20 11:46:31 -08001393 &msm_device_vidc,
Matt Wagantalled832652012-02-02 19:23:17 -08001394 &msm_8960_riva,
Matt Wagantallb94b9a52012-02-02 21:59:54 -08001395 &msm_8960_q6_lpass,
Matt Wagantall292aace2012-01-26 19:12:34 -08001396 &msm_gss,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001397};
1398
Joel King4e7ad222011-08-17 15:47:38 -07001399static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001400 &apq8064_device_uart_gsbi3,
Yan He06913ce2011-08-26 16:33:46 -07001401 &msm_device_sps_apq8064,
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001402};
1403
1404static struct platform_device *rumi3_devices[] __initdata = {
1405 &apq8064_device_uart_gsbi1,
Yan He435ed612011-11-23 17:34:59 -08001406 &msm_device_sps_apq8064,
Huaibin Yang4a084e32011-12-15 15:25:52 -08001407#ifdef CONFIG_MSM_ROTATOR
1408 &msm_rotator_device,
1409#endif
Joel King4e7ad222011-08-17 15:47:38 -07001410};
1411
Joel King82b7e3f2012-01-05 10:03:27 -08001412static struct platform_device *cdp_devices[] __initdata = {
1413 &apq8064_device_uart_gsbi1,
Jin Hong4bbbfba2012-02-02 21:48:07 -08001414 &apq8064_device_uart_gsbi7,
Joel King82b7e3f2012-01-05 10:03:27 -08001415 &msm_device_sps_apq8064,
1416};
1417
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001418static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08001419 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001420};
1421
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001422#define KS8851_IRQ_GPIO 43
1423
1424static struct spi_board_info spi_board_info[] __initdata = {
1425 {
1426 .modalias = "ks8851",
1427 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1428 .max_speed_hz = 19200000,
1429 .bus_num = 0,
1430 .chip_select = 2,
1431 .mode = SPI_MODE_0,
1432 },
1433};
1434
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001435static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001436 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001437 .bus_num = 1,
1438 .slim_slave = &apq8064_slim_tabla,
1439 },
1440 {
1441 .bus_num = 1,
1442 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001443 },
1444 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001445};
1446
Jing Lin04601f92012-02-05 15:36:07 -08001447static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi3_pdata = {
1448 .clk_freq = 100000,
1449 .src_clk_rate = 24000000,
1450};
1451
Kenneth Heitke748593a2011-07-15 15:45:11 -06001452static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
1453 .clk_freq = 100000,
1454 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001455};
1456
1457static void __init apq8064_i2c_init(void)
1458{
Jing Lin04601f92012-02-05 15:36:07 -08001459 apq8064_device_qup_i2c_gsbi3.dev.platform_data =
1460 &apq8064_i2c_qup_gsbi3_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06001461 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
1462 &apq8064_i2c_qup_gsbi4_pdata;
1463}
1464
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08001465#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001466static int ethernet_init(void)
1467{
1468 int ret;
1469 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
1470 if (ret) {
1471 pr_err("ks8851 gpio_request failed: %d\n", ret);
1472 goto fail;
1473 }
1474
1475 return 0;
1476fail:
1477 return ret;
1478}
1479#else
1480static int ethernet_init(void)
1481{
1482 return 0;
1483}
1484#endif
1485
Tianyi Gou41515e22011-09-01 19:37:43 -07001486static void __init apq8064_clock_init(void)
1487{
Tianyi Gouacb588d2012-01-27 18:24:05 -08001488 if (machine_is_apq8064_rumi3())
Tianyi Gou41515e22011-09-01 19:37:43 -07001489 msm_clock_init(&apq8064_dummy_clock_init_data);
Tianyi Gouacb588d2012-01-27 18:24:05 -08001490 else
1491 msm_clock_init(&apq8064_clock_init_data);
Tianyi Gou41515e22011-09-01 19:37:43 -07001492}
1493
Jing Lin417fa452012-02-05 14:31:06 -08001494#define I2C_SURF 1
1495#define I2C_FFA (1 << 1)
1496#define I2C_RUMI (1 << 2)
1497#define I2C_SIM (1 << 3)
1498#define I2C_LIQUID (1 << 4)
1499
1500struct i2c_registry {
1501 u8 machs;
1502 int bus;
1503 struct i2c_board_info *info;
1504 int len;
1505};
1506
1507static struct i2c_registry apq8064_i2c_devices[] __initdata = {
Jing Lin21ed4de2012-02-05 15:53:28 -08001508 {
1509 I2C_SURF | I2C_LIQUID,
1510 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
1511 mxt_device_info,
1512 ARRAY_SIZE(mxt_device_info),
1513 },
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001514 {
1515 I2C_FFA,
1516 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
1517 cyttsp_info,
1518 ARRAY_SIZE(cyttsp_info),
1519 },
Jing Lin417fa452012-02-05 14:31:06 -08001520};
1521
1522static void __init register_i2c_devices(void)
1523{
1524 u8 mach_mask = 0;
1525 int i;
1526
1527 /* Build the matching 'supported_machs' bitmask */
1528 if (machine_is_apq8064_cdp())
1529 mach_mask = I2C_SURF;
1530 else if (machine_is_apq8064_mtp())
1531 mach_mask = I2C_FFA;
1532 else if (machine_is_apq8064_liquid())
1533 mach_mask = I2C_LIQUID;
1534 else if (machine_is_apq8064_rumi3())
1535 mach_mask = I2C_RUMI;
1536 else if (machine_is_apq8064_sim())
1537 mach_mask = I2C_SIM;
1538 else
1539 pr_err("unmatched machine ID in register_i2c_devices\n");
1540
1541 /* Run the array and install devices as appropriate */
1542 for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) {
1543 if (apq8064_i2c_devices[i].machs & mach_mask)
1544 i2c_register_board_info(apq8064_i2c_devices[i].bus,
1545 apq8064_i2c_devices[i].info,
1546 apq8064_i2c_devices[i].len);
1547 }
1548}
1549
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001550static void __init apq8064_common_init(void)
1551{
1552 if (socinfo_init() < 0)
1553 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06001554 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
1555 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Tianyi Gou41515e22011-09-01 19:37:43 -07001556 apq8064_clock_init();
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08001557 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06001558 apq8064_i2c_init();
Jing Lin417fa452012-02-05 14:31:06 -08001559 register_i2c_devices();
Kenneth Heitke36920d32011-07-20 16:44:30 -06001560
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001561 apq8064_device_qup_spi_gsbi5.dev.platform_data =
1562 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08001563 apq8064_init_pmic();
Hemant Kumar94e7da22012-02-03 16:52:29 -08001564 if (machine_is_apq8064_liquid())
1565 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001566 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Hemant Kumara945b472012-01-25 15:08:06 -08001567 apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001568 apq8064_init_buses();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001569 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Jay Chokshie8741282012-01-25 15:22:55 -08001570 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05301571 apq8064_init_mmc();
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08001572
1573 if (machine_is_apq8064_mtp()) {
1574 mdm_8064_device.dev.platform_data = &mdm_platform_data;
1575 platform_device_register(&mdm_8064_device);
1576 }
1577 platform_device_register(&apq8064_slim_ctrl);
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001578 slim_register_board_info(apq8064_slim_devices,
1579 ARRAY_SIZE(apq8064_slim_devices));
Praveen Chidambaram78499012011-11-01 17:15:17 -06001580 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Mahesh Sivasubramaniancbce1ec2012-01-24 10:32:44 -07001581 acpuclk_init(&acpuclk_8064_soc_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06001582 msm_spm_l2_init(msm_spm_l2_data);
1583 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
1584 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
1585 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
1586 msm_pm_data);
1587 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001588}
1589
Huaibin Yang4a084e32011-12-15 15:25:52 -08001590static void __init apq8064_allocate_memory_regions(void)
1591{
1592 apq8064_allocate_fb_region();
1593}
1594
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001595static void __init apq8064_sim_init(void)
1596{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001597 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
1598 &msm8064_device_watchdog.dev.platform_data;
1599
1600 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001601 apq8064_common_init();
Joel King4e7ad222011-08-17 15:47:38 -07001602 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
1603}
1604
1605static void __init apq8064_rumi3_init(void)
1606{
1607 apq8064_common_init();
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001608 ethernet_init();
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001609 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001610 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Huaibin Yang4a084e32011-12-15 15:25:52 -08001611 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07001612 apq8064_init_gpu();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001613}
1614
Joel King82b7e3f2012-01-05 10:03:27 -08001615static void __init apq8064_cdp_init(void)
1616{
1617 apq8064_common_init();
1618 ethernet_init();
1619 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
1620 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Jordan Crouseb3115fe2012-02-01 22:11:12 -07001621 apq8064_init_gpu();
Matt Wagantallef3cfe542012-02-04 19:01:08 -08001622 platform_add_devices(msm_footswitch_devices,
1623 msm_num_footswitch_devices);
Joel King82b7e3f2012-01-05 10:03:27 -08001624}
1625
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001626MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
1627 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07001628 .reserve = apq8064_reserve,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001629 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05301630 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001631 .timer = &msm_timer,
1632 .init_machine = apq8064_sim_init,
1633MACHINE_END
1634
Joel King4e7ad222011-08-17 15:47:38 -07001635MACHINE_START(APQ8064_RUMI3, "QCT APQ8064 RUMI3")
1636 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07001637 .reserve = apq8064_reserve,
Joel King4e7ad222011-08-17 15:47:38 -07001638 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05301639 .handle_irq = gic_handle_irq,
Joel King4e7ad222011-08-17 15:47:38 -07001640 .timer = &msm_timer,
1641 .init_machine = apq8064_rumi3_init,
Huaibin Yang4a084e32011-12-15 15:25:52 -08001642 .init_early = apq8064_allocate_memory_regions,
Joel King4e7ad222011-08-17 15:47:38 -07001643MACHINE_END
1644
Joel King82b7e3f2012-01-05 10:03:27 -08001645MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
1646 .map_io = apq8064_map_io,
1647 .reserve = apq8064_reserve,
1648 .init_irq = apq8064_init_irq,
1649 .handle_irq = gic_handle_irq,
1650 .timer = &msm_timer,
1651 .init_machine = apq8064_cdp_init,
1652MACHINE_END
1653
1654MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
1655 .map_io = apq8064_map_io,
1656 .reserve = apq8064_reserve,
1657 .init_irq = apq8064_init_irq,
1658 .handle_irq = gic_handle_irq,
1659 .timer = &msm_timer,
1660 .init_machine = apq8064_cdp_init,
1661MACHINE_END
1662
1663MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
1664 .map_io = apq8064_map_io,
1665 .reserve = apq8064_reserve,
1666 .init_irq = apq8064_init_irq,
1667 .handle_irq = gic_handle_irq,
1668 .timer = &msm_timer,
1669 .init_machine = apq8064_cdp_init,
1670MACHINE_END
1671