blob: c07f497b5df4998fb891dd5cc3996fc2ac8a458a [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>
Joel King4ebccc62011-07-22 09:43:22 -070057
Jeff Ohlstein7e668552011-10-06 16:17:25 -070058#include "msm_watchdog.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080059#include "board-8064.h"
Vikram Mulukutlabc2e9572011-11-04 03:41:38 -070060#include "acpuclock.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060061#include "spm.h"
62#include "mpm.h"
63#include "rpm_resources.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080064#include "pm.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060065#include "pm-boot.h"
Rajesh Sastrulaaee8af32012-01-20 11:46:31 -080066#include "devices-msm8x60.h"
Jay Chokshiea67c622011-07-29 17:12:26 -070067
Olav Haugan7c6aa742012-01-16 16:47:37 -080068#define MSM_PMEM_ADSP_SIZE 0x7800000
Ben Romberger3ffcd812011-12-08 19:12:10 -080069#define MSM_PMEM_AUDIO_SIZE 0x2B4000
Olav Haugan7c6aa742012-01-16 16:47:37 -080070#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
71#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
72#else
73#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
74#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070075
Olav Haugan7c6aa742012-01-16 16:47:37 -080076#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Olav Hauganedcf6832012-01-24 08:35:41 -080077#define MSM_PMEM_KERNEL_EBI1_SIZE 0x280000
Olav Haugan7c6aa742012-01-16 16:47:37 -080078#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Haugand3d29682012-01-19 10:57:07 -080079#define MSM_ION_MM_FW_SIZE 0x200000 /* (2MB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -080080#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Hauganf45e2142012-01-19 11:01:01 -080081#define MSM_ION_QSECOM_SIZE 0x100000 /* (1MB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -080082#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan2c43fac2012-01-19 11:06:37 -080083#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
84#define MSM_ION_HEAP_NUM 8
Olav Haugan7c6aa742012-01-16 16:47:37 -080085#else
86#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
87#define MSM_ION_HEAP_NUM 1
88#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070089
Olav Haugan7c6aa742012-01-16 16:47:37 -080090#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
91static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
92static int __init pmem_kernel_ebi1_size_setup(char *p)
Kevin Chan13be4e22011-10-20 11:30:32 -070093{
Olav Haugan7c6aa742012-01-16 16:47:37 -080094 pmem_kernel_ebi1_size = memparse(p, NULL);
95 return 0;
Kevin Chan13be4e22011-10-20 11:30:32 -070096}
Olav Haugan7c6aa742012-01-16 16:47:37 -080097early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
98#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070099
Olav Haugan7c6aa742012-01-16 16:47:37 -0800100#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -0700101static unsigned pmem_size = MSM_PMEM_SIZE;
102static int __init pmem_size_setup(char *p)
103{
104 pmem_size = memparse(p, NULL);
105 return 0;
106}
107early_param("pmem_size", pmem_size_setup);
108
109static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
110
111static int __init pmem_adsp_size_setup(char *p)
112{
113 pmem_adsp_size = memparse(p, NULL);
114 return 0;
115}
116early_param("pmem_adsp_size", pmem_adsp_size_setup);
117
118static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
119
120static int __init pmem_audio_size_setup(char *p)
121{
122 pmem_audio_size = memparse(p, NULL);
123 return 0;
124}
125early_param("pmem_audio_size", pmem_audio_size_setup);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800126#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700127
Olav Haugan7c6aa742012-01-16 16:47:37 -0800128#ifdef CONFIG_ANDROID_PMEM
129#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700130static struct android_pmem_platform_data android_pmem_pdata = {
131 .name = "pmem",
132 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
133 .cached = 1,
134 .memory_type = MEMTYPE_EBI1,
135};
136
137static struct platform_device android_pmem_device = {
138 .name = "android_pmem",
139 .id = 0,
140 .dev = {.platform_data = &android_pmem_pdata},
141};
142
143static struct android_pmem_platform_data android_pmem_adsp_pdata = {
144 .name = "pmem_adsp",
145 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
146 .cached = 0,
147 .memory_type = MEMTYPE_EBI1,
148};
Kevin Chan13be4e22011-10-20 11:30:32 -0700149static struct platform_device android_pmem_adsp_device = {
150 .name = "android_pmem",
151 .id = 2,
152 .dev = { .platform_data = &android_pmem_adsp_pdata },
153};
Olav Haugan7c6aa742012-01-16 16:47:37 -0800154#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700155
156static struct android_pmem_platform_data android_pmem_audio_pdata = {
157 .name = "pmem_audio",
158 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
159 .cached = 0,
160 .memory_type = MEMTYPE_EBI1,
161};
162
163static struct platform_device android_pmem_audio_device = {
164 .name = "android_pmem",
165 .id = 4,
166 .dev = { .platform_data = &android_pmem_audio_pdata },
167};
Olav Haugan7c6aa742012-01-16 16:47:37 -0800168#endif
169
170static struct memtype_reserve apq8064_reserve_table[] __initdata = {
171 [MEMTYPE_SMI] = {
172 },
173 [MEMTYPE_EBI0] = {
174 .flags = MEMTYPE_FLAGS_1M_ALIGN,
175 },
176 [MEMTYPE_EBI1] = {
177 .flags = MEMTYPE_FLAGS_1M_ALIGN,
178 },
179};
Kevin Chan13be4e22011-10-20 11:30:32 -0700180
181static void __init size_pmem_devices(void)
182{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800183#ifdef CONFIG_ANDROID_PMEM
184#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700185 android_pmem_adsp_pdata.size = pmem_adsp_size;
186 android_pmem_pdata.size = pmem_size;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800187#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700188 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800189#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700190}
191
192static void __init reserve_memory_for(struct android_pmem_platform_data *p)
193{
194 apq8064_reserve_table[p->memory_type].size += p->size;
195}
196
Kevin Chan13be4e22011-10-20 11:30:32 -0700197static void __init reserve_pmem_memory(void)
198{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800199#ifdef CONFIG_ANDROID_PMEM
200#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700201 reserve_memory_for(&android_pmem_adsp_pdata);
202 reserve_memory_for(&android_pmem_pdata);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800203#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700204 reserve_memory_for(&android_pmem_audio_pdata);
205 apq8064_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800206#endif
207}
208
209static int apq8064_paddr_to_memtype(unsigned int paddr)
210{
211 return MEMTYPE_EBI1;
212}
213
214#ifdef CONFIG_ION_MSM
215#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
216static struct ion_cp_heap_pdata cp_mm_ion_pdata = {
217 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugand3d29682012-01-19 10:57:07 -0800218 .align = PAGE_SIZE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800219};
220
221static struct ion_cp_heap_pdata cp_mfc_ion_pdata = {
222 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugand3d29682012-01-19 10:57:07 -0800223 .align = PAGE_SIZE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800224};
225
226static struct ion_co_heap_pdata co_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800227 .adjacent_mem_id = INVALID_HEAP_ID,
228 .align = PAGE_SIZE,
229};
230
231static struct ion_co_heap_pdata fw_co_ion_pdata = {
232 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
233 .align = SZ_128K,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800234};
235#endif
236static struct ion_platform_data ion_pdata = {
237 .nr = MSM_ION_HEAP_NUM,
238 .heaps = {
239 {
240 .id = ION_SYSTEM_HEAP_ID,
241 .type = ION_HEAP_TYPE_SYSTEM,
242 .name = ION_VMALLOC_HEAP_NAME,
243 },
244#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
245 {
246 .id = ION_SF_HEAP_ID,
247 .type = ION_HEAP_TYPE_CARVEOUT,
248 .name = ION_SF_HEAP_NAME,
249 .size = MSM_ION_SF_SIZE,
250 .memory_type = ION_EBI_TYPE,
251 .extra_data = (void *) &co_ion_pdata,
252 },
253 {
254 .id = ION_CP_MM_HEAP_ID,
255 .type = ION_HEAP_TYPE_CP,
256 .name = ION_MM_HEAP_NAME,
257 .size = MSM_ION_MM_SIZE,
258 .memory_type = ION_EBI_TYPE,
259 .extra_data = (void *) &cp_mm_ion_pdata,
260 },
261 {
Olav Haugand3d29682012-01-19 10:57:07 -0800262 .id = ION_MM_FIRMWARE_HEAP_ID,
263 .type = ION_HEAP_TYPE_CARVEOUT,
264 .name = ION_MM_FIRMWARE_HEAP_NAME,
265 .size = MSM_ION_MM_FW_SIZE,
266 .memory_type = ION_EBI_TYPE,
267 .extra_data = (void *) &fw_co_ion_pdata,
268 },
269 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800270 .id = ION_CP_MFC_HEAP_ID,
271 .type = ION_HEAP_TYPE_CP,
272 .name = ION_MFC_HEAP_NAME,
273 .size = MSM_ION_MFC_SIZE,
274 .memory_type = ION_EBI_TYPE,
275 .extra_data = (void *) &cp_mfc_ion_pdata,
276 },
277 {
278 .id = ION_IOMMU_HEAP_ID,
279 .type = ION_HEAP_TYPE_IOMMU,
280 .name = ION_IOMMU_HEAP_NAME,
281 },
Olav Hauganf45e2142012-01-19 11:01:01 -0800282 {
283 .id = ION_QSECOM_HEAP_ID,
284 .type = ION_HEAP_TYPE_CARVEOUT,
285 .name = ION_QSECOM_HEAP_NAME,
286 .size = MSM_ION_QSECOM_SIZE,
287 .memory_type = ION_EBI_TYPE,
288 .extra_data = (void *) &co_ion_pdata,
289 },
Olav Haugan2c43fac2012-01-19 11:06:37 -0800290 {
291 .id = ION_AUDIO_HEAP_ID,
292 .type = ION_HEAP_TYPE_CARVEOUT,
293 .name = ION_AUDIO_HEAP_NAME,
294 .size = MSM_ION_AUDIO_SIZE,
295 .memory_type = ION_EBI_TYPE,
296 .extra_data = (void *) &co_ion_pdata,
297 },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800298#endif
299 }
300};
301
302static struct platform_device ion_dev = {
303 .name = "ion-msm",
304 .id = 1,
305 .dev = { .platform_data = &ion_pdata },
306};
307#endif
308
309static void reserve_ion_memory(void)
310{
311#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
312 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_SIZE;
Olav Haugand3d29682012-01-19 10:57:07 -0800313 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_FW_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800314 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_SF_SIZE;
315 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MFC_SIZE;
Olav Hauganf45e2142012-01-19 11:01:01 -0800316 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_QSECOM_SIZE;
Olav Haugan2c43fac2012-01-19 11:06:37 -0800317 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_AUDIO_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800318#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700319}
320
Huaibin Yang4a084e32011-12-15 15:25:52 -0800321static void __init reserve_mdp_memory(void)
322{
323 apq8064_mdp_writeback(apq8064_reserve_table);
324}
325
Kevin Chan13be4e22011-10-20 11:30:32 -0700326static void __init apq8064_calculate_reserve_sizes(void)
327{
328 size_pmem_devices();
329 reserve_pmem_memory();
Olav Haugan7c6aa742012-01-16 16:47:37 -0800330 reserve_ion_memory();
Huaibin Yang4a084e32011-12-15 15:25:52 -0800331 reserve_mdp_memory();
Kevin Chan13be4e22011-10-20 11:30:32 -0700332}
333
334static struct reserve_info apq8064_reserve_info __initdata = {
335 .memtype_reserve_table = apq8064_reserve_table,
336 .calculate_reserve_sizes = apq8064_calculate_reserve_sizes,
337 .paddr_to_memtype = apq8064_paddr_to_memtype,
338};
339
340static int apq8064_memory_bank_size(void)
341{
342 return 1<<29;
343}
344
345static void __init locate_unstable_memory(void)
346{
347 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
348 unsigned long bank_size;
349 unsigned long low, high;
350
351 bank_size = apq8064_memory_bank_size();
352 low = meminfo.bank[0].start;
353 high = mb->start + mb->size;
Olav Haugand76e3a82012-01-16 16:55:07 -0800354
355 /* Check if 32 bit overflow occured */
356 if (high < mb->start)
357 high = ~0UL;
358
Kevin Chan13be4e22011-10-20 11:30:32 -0700359 low &= ~(bank_size - 1);
360
361 if (high - low <= bank_size)
362 return;
Jack Cheung46bfffa2012-01-19 15:26:24 -0800363 apq8064_reserve_info.low_unstable_address = mb->start -
364 MIN_MEMORY_BLOCK_SIZE + mb->size;
365 apq8064_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
366
Kevin Chan13be4e22011-10-20 11:30:32 -0700367 apq8064_reserve_info.bank_size = bank_size;
368 pr_info("low unstable address %lx max size %lx bank size %lx\n",
369 apq8064_reserve_info.low_unstable_address,
370 apq8064_reserve_info.max_unstable_size,
371 apq8064_reserve_info.bank_size);
372}
373
374static void __init apq8064_reserve(void)
375{
376 reserve_info = &apq8064_reserve_info;
377 locate_unstable_memory();
378 msm_reserve();
379}
380
Hemant Kumara945b472012-01-25 15:08:06 -0800381#ifdef CONFIG_USB_EHCI_MSM_HSIC
382static struct msm_hsic_host_platform_data msm_hsic_pdata = {
383 .strobe = 88,
384 .data = 89,
385};
386#else
387static struct msm_hsic_host_platform_data msm_hsic_pdata;
388#endif
389
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800390#define PID_MAGIC_ID 0x71432909
391#define SERIAL_NUM_MAGIC_ID 0x61945374
392#define SERIAL_NUMBER_LENGTH 127
393#define DLOAD_USB_BASE_ADD 0x2A03F0C8
394
395struct magic_num_struct {
396 uint32_t pid;
397 uint32_t serial_num;
398};
399
400struct dload_struct {
401 uint32_t reserved1;
402 uint32_t reserved2;
403 uint32_t reserved3;
404 uint16_t reserved4;
405 uint16_t pid;
406 char serial_number[SERIAL_NUMBER_LENGTH];
407 uint16_t reserved5;
408 struct magic_num_struct magic_struct;
409};
410
411static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
412{
413 struct dload_struct __iomem *dload = 0;
414
415 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
416 if (!dload) {
417 pr_err("%s: cannot remap I/O memory region: %08x\n",
418 __func__, DLOAD_USB_BASE_ADD);
419 return -ENXIO;
420 }
421
422 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
423 __func__, dload, pid, snum);
424 /* update pid */
425 dload->magic_struct.pid = PID_MAGIC_ID;
426 dload->pid = pid;
427
428 /* update serial number */
429 dload->magic_struct.serial_num = 0;
430 if (!snum) {
431 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
432 goto out;
433 }
434
435 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
436 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
437out:
438 iounmap(dload);
439 return 0;
440}
441
442static struct android_usb_platform_data android_usb_pdata = {
443 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
444};
445
Hemant Kumar4933b072011-10-17 23:43:11 -0700446static struct platform_device android_usb_device = {
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800447 .name = "android_usb",
448 .id = -1,
449 .dev = {
450 .platform_data = &android_usb_pdata,
451 },
Hemant Kumar4933b072011-10-17 23:43:11 -0700452};
453
454static struct msm_otg_platform_data msm_otg_pdata = {
Hemant Kumard86c4882012-01-24 19:39:37 -0800455 .mode = USB_OTG,
456 .otg_control = OTG_PMIC_CONTROL,
Hemant Kumar4933b072011-10-17 23:43:11 -0700457 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Hemant Kumard86c4882012-01-24 19:39:37 -0800458 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
459 .power_budget = 750,
Hemant Kumar4933b072011-10-17 23:43:11 -0700460};
461
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800462#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
463
464/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
465 * 4 micbiases are used to power various analog and digital
466 * microphones operating at 1800 mV. Technically, all micbiases
467 * can source from single cfilter since all microphones operate
468 * at the same voltage level. The arrangement below is to make
469 * sure all cfilters are exercised. LDO_H regulator ouput level
470 * does not need to be as high as 2.85V. It is choosen for
471 * microphone sensitivity purpose.
472 */
473static struct tabla_pdata apq8064_tabla_platform_data = {
474 .slimbus_slave_device = {
475 .name = "tabla-slave",
476 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
477 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800478 .irq = MSM_GPIO_TO_INT(42),
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800479 .irq_base = TABLA_INTERRUPT_BASE,
480 .num_irqs = NR_TABLA_IRQS,
481 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
482 .micbias = {
483 .ldoh_v = TABLA_LDOH_2P85_V,
484 .cfilt1_mv = 1800,
485 .cfilt2_mv = 1800,
486 .cfilt3_mv = 1800,
487 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
488 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
489 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
490 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
491 }
492};
493
494static struct slim_device apq8064_slim_tabla = {
495 .name = "tabla-slim",
496 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
497 .dev = {
498 .platform_data = &apq8064_tabla_platform_data,
499 },
500};
501
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800502static struct tabla_pdata apq8064_tabla20_platform_data = {
503 .slimbus_slave_device = {
504 .name = "tabla-slave",
505 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
506 },
507 .irq = MSM_GPIO_TO_INT(42),
508 .irq_base = TABLA_INTERRUPT_BASE,
509 .num_irqs = NR_TABLA_IRQS,
510 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
511 .micbias = {
512 .ldoh_v = TABLA_LDOH_2P85_V,
513 .cfilt1_mv = 1800,
514 .cfilt2_mv = 1800,
515 .cfilt3_mv = 1800,
516 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
517 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
518 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
519 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
520 }
521};
522
523static struct slim_device apq8064_slim_tabla20 = {
524 .name = "tabla2x-slim",
525 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
526 .dev = {
527 .platform_data = &apq8064_tabla20_platform_data,
528 },
529};
530
Jing Lin21ed4de2012-02-05 15:53:28 -0800531/* configuration data for mxt1386e using V2.1 firmware */
532static const u8 mxt1386e_config_data_v2_1[] = {
533 /* T6 Object */
534 0, 0, 0, 0, 0, 0,
535 /* T38 Object */
536 14, 0, 0, 24, 1, 12, 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, 0, 0, 0, 0, 0, 0,
542 0, 0, 0, 0,
543 /* T7 Object */
544 100, 16, 50,
545 /* T8 Object */
546 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
547 /* T9 Object */
548 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
549 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
550 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
551 10, 5, 0, 0, 0,
552 /* T18 Object */
553 0, 0,
554 /* T24 Object */
555 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
556 0, 0, 0, 0, 0, 0, 0, 0, 0,
557 /* T25 Object */
558 3, 0, 60, 115, 156, 99,
559 /* T27 Object */
560 0, 0, 0, 0, 0, 0, 0,
561 /* T40 Object */
562 0, 0, 0, 0, 0,
563 /* T42 Object */
564 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
565 /* T43 Object */
566 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
567 16,
568 /* T46 Object */
569 64, 0, 20, 20, 0, 0, 0, 0, 0,
570 /* T47 Object */
571 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
572 /* T48 Object */
573 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
574 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
575 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
576 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
577 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
578 0, 0, 0, 0,
579 /* T56 Object */
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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
584 2, 99, 33, 0, 149, 24, 193, 255, 255, 255,
585 255,
586};
587
588#define MXT_TS_GPIO_IRQ 6
589#define MXT_TS_PWR_EN_GPIO PM8921_GPIO_PM_TO_SYS(23)
590#define MXT_TS_RESET_GPIO 33
591
592static struct mxt_config_info mxt_config_array[] = {
593 {
594 .config = mxt1386e_config_data_v2_1,
595 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
596 .family_id = 0xA0,
597 .variant_id = 0x7,
598 .version = 0x21,
599 .build = 0xAA,
600 },
601};
602
603static struct mxt_platform_data mxt_platform_data = {
604 .config_array = mxt_config_array,
605 .config_array_size = ARRAY_SIZE(mxt_config_array),
606 .x_size = 1365,
607 .y_size = 767,
608 .irqflags = IRQF_TRIGGER_FALLING,
609 .i2c_pull_up = true,
610 .reset_gpio = MXT_TS_RESET_GPIO,
611 .irq_gpio = MXT_TS_GPIO_IRQ,
612};
613
614static struct i2c_board_info mxt_device_info[] __initdata = {
615 {
616 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
617 .platform_data = &mxt_platform_data,
618 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
619 },
620};
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -0800621#define CYTTSP_TS_GPIO_IRQ 6
622#define CYTTSP_TS_GPIO_RESOUT 7
623#define CYTTSP_TS_GPIO_SLEEP 33
624
625static ssize_t tma340_vkeys_show(struct kobject *kobj,
626 struct kobj_attribute *attr, char *buf)
627{
628 return snprintf(buf, 200,
629 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
630 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
631 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
632 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
633 "\n");
634}
635
636static struct kobj_attribute tma340_vkeys_attr = {
637 .attr = {
638 .mode = S_IRUGO,
639 },
640 .show = &tma340_vkeys_show,
641};
642
643static struct attribute *tma340_properties_attrs[] = {
644 &tma340_vkeys_attr.attr,
645 NULL
646};
647
648static struct attribute_group tma340_properties_attr_group = {
649 .attrs = tma340_properties_attrs,
650};
651
652static int cyttsp_platform_init(struct i2c_client *client)
653{
654 int rc = 0;
655 static struct kobject *tma340_properties_kobj;
656
657 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
658 tma340_properties_kobj = kobject_create_and_add("board_properties",
659 NULL);
660 if (tma340_properties_kobj)
661 rc = sysfs_create_group(tma340_properties_kobj,
662 &tma340_properties_attr_group);
663 if (!tma340_properties_kobj || rc)
664 pr_err("%s: failed to create board_properties\n",
665 __func__);
666
667 return 0;
668}
669
670static struct cyttsp_regulator cyttsp_regulator_data[] = {
671 {
672 .name = "vdd",
673 .min_uV = CY_TMA300_VTG_MIN_UV,
674 .max_uV = CY_TMA300_VTG_MAX_UV,
675 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
676 .lpm_load_uA = CY_TMA300_CURR_24HZ_UA,
677 },
678 {
679 .name = "vcc_i2c",
680 .min_uV = CY_I2C_VTG_MIN_UV,
681 .max_uV = CY_I2C_VTG_MAX_UV,
682 .hpm_load_uA = CY_I2C_CURR_UA,
683 .lpm_load_uA = CY_I2C_CURR_UA,
684 },
685};
686
687static struct cyttsp_platform_data cyttsp_pdata = {
688 .panel_maxx = 634,
689 .panel_maxy = 1166,
690 .disp_maxx = 599,
691 .disp_maxy = 1023,
692 .disp_minx = 0,
693 .disp_miny = 0,
694 .flags = 0x01,
695 .gen = CY_GEN3,
696 .use_st = CY_USE_ST,
697 .use_mt = CY_USE_MT,
698 .use_hndshk = CY_SEND_HNDSHK,
699 .use_trk_id = CY_USE_TRACKING_ID,
700 .use_sleep = CY_USE_DEEP_SLEEP_SEL,
701 .use_gestures = CY_USE_GESTURES,
702 .fw_fname = "cyttsp_8064_mtp.hex",
703 /* change act_intrvl to customize the Active power state
704 * scanning/processing refresh interval for Operating mode
705 */
706 .act_intrvl = CY_ACT_INTRVL_DFLT,
707 /* change tch_tmout to customize the touch timeout for the
708 * Active power state for Operating mode
709 */
710 .tch_tmout = CY_TCH_TMOUT_DFLT,
711 /* change lp_intrvl to customize the Low Power power state
712 * scanning/processing refresh interval for Operating mode
713 */
714 .lp_intrvl = CY_LP_INTRVL_DFLT,
715 .sleep_gpio = CYTTSP_TS_GPIO_SLEEP,
716 .resout_gpio = CYTTSP_TS_GPIO_RESOUT,
717 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
718 .regulator_info = cyttsp_regulator_data,
719 .num_regulators = ARRAY_SIZE(cyttsp_regulator_data),
720 .init = cyttsp_platform_init,
721 .correct_fw_ver = 17,
722};
723
724static struct i2c_board_info cyttsp_info[] __initdata = {
725 {
726 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
727 .platform_data = &cyttsp_pdata,
728 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
729 },
730};
Jing Lin21ed4de2012-02-05 15:53:28 -0800731
Ankit Verma6b7e2ba2012-01-26 15:48:54 -0800732#define MSM_WCNSS_PHYS 0x03000000
733#define MSM_WCNSS_SIZE 0x280000
734
735static struct resource resources_wcnss_wlan[] = {
736 {
737 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
738 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
739 .name = "wcnss_wlanrx_irq",
740 .flags = IORESOURCE_IRQ,
741 },
742 {
743 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
744 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
745 .name = "wcnss_wlantx_irq",
746 .flags = IORESOURCE_IRQ,
747 },
748 {
749 .start = MSM_WCNSS_PHYS,
750 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
751 .name = "wcnss_mmio",
752 .flags = IORESOURCE_MEM,
753 },
754 {
755 .start = 64,
756 .end = 68,
757 .name = "wcnss_gpios_5wire",
758 .flags = IORESOURCE_IO,
759 },
760};
761
762static struct qcom_wcnss_opts qcom_wcnss_pdata = {
763 .has_48mhz_xo = 1,
764};
765
766static struct platform_device msm_device_wcnss_wlan = {
767 .name = "wcnss_wlan",
768 .id = 0,
769 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
770 .resource = resources_wcnss_wlan,
771 .dev = {.platform_data = &qcom_wcnss_pdata},
772};
773
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700774#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
775 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
776 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
777 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
778
779#define QCE_SIZE 0x10000
780#define QCE_0_BASE 0x11000000
781
782#define QCE_HW_KEY_SUPPORT 0
783#define QCE_SHA_HMAC_SUPPORT 1
784#define QCE_SHARE_CE_RESOURCE 3
785#define QCE_CE_SHARED 0
786
787static struct resource qcrypto_resources[] = {
788 [0] = {
789 .start = QCE_0_BASE,
790 .end = QCE_0_BASE + QCE_SIZE - 1,
791 .flags = IORESOURCE_MEM,
792 },
793 [1] = {
794 .name = "crypto_channels",
795 .start = DMOV8064_CE_IN_CHAN,
796 .end = DMOV8064_CE_OUT_CHAN,
797 .flags = IORESOURCE_DMA,
798 },
799 [2] = {
800 .name = "crypto_crci_in",
801 .start = DMOV8064_CE_IN_CRCI,
802 .end = DMOV8064_CE_IN_CRCI,
803 .flags = IORESOURCE_DMA,
804 },
805 [3] = {
806 .name = "crypto_crci_out",
807 .start = DMOV8064_CE_OUT_CRCI,
808 .end = DMOV8064_CE_OUT_CRCI,
809 .flags = IORESOURCE_DMA,
810 },
811};
812
813static struct resource qcedev_resources[] = {
814 [0] = {
815 .start = QCE_0_BASE,
816 .end = QCE_0_BASE + QCE_SIZE - 1,
817 .flags = IORESOURCE_MEM,
818 },
819 [1] = {
820 .name = "crypto_channels",
821 .start = DMOV8064_CE_IN_CHAN,
822 .end = DMOV8064_CE_OUT_CHAN,
823 .flags = IORESOURCE_DMA,
824 },
825 [2] = {
826 .name = "crypto_crci_in",
827 .start = DMOV8064_CE_IN_CRCI,
828 .end = DMOV8064_CE_IN_CRCI,
829 .flags = IORESOURCE_DMA,
830 },
831 [3] = {
832 .name = "crypto_crci_out",
833 .start = DMOV8064_CE_OUT_CRCI,
834 .end = DMOV8064_CE_OUT_CRCI,
835 .flags = IORESOURCE_DMA,
836 },
837};
838
839#endif
840
841#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
842 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
843
844static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
845 .ce_shared = QCE_CE_SHARED,
846 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
847 .hw_key_support = QCE_HW_KEY_SUPPORT,
848 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800849 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700850};
851
852static struct platform_device qcrypto_device = {
853 .name = "qcrypto",
854 .id = 0,
855 .num_resources = ARRAY_SIZE(qcrypto_resources),
856 .resource = qcrypto_resources,
857 .dev = {
858 .coherent_dma_mask = DMA_BIT_MASK(32),
859 .platform_data = &qcrypto_ce_hw_suppport,
860 },
861};
862#endif
863
864#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
865 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
866
867static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
868 .ce_shared = QCE_CE_SHARED,
869 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
870 .hw_key_support = QCE_HW_KEY_SUPPORT,
871 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800872 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700873};
874
875static struct platform_device qcedev_device = {
876 .name = "qce",
877 .id = 0,
878 .num_resources = ARRAY_SIZE(qcedev_resources),
879 .resource = qcedev_resources,
880 .dev = {
881 .coherent_dma_mask = DMA_BIT_MASK(32),
882 .platform_data = &qcedev_ce_hw_suppport,
883 },
884};
885#endif
886
Joel Kingdacbc822012-01-25 13:30:57 -0800887static struct mdm_platform_data mdm_platform_data = {
888 .mdm_version = "3.0",
889 .ramdump_delay_ms = 2000,
Hemant Kumara945b472012-01-25 15:08:06 -0800890 .peripheral_platform_device = &apq8064_device_hsic_host,
Joel Kingdacbc822012-01-25 13:30:57 -0800891};
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700892
Jeff Hugo0c0f5e92011-09-28 13:55:45 -0600893#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700894static void __init apq8064_map_io(void)
895{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -0600896 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700897 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -0700898 if (socinfo_init() < 0)
899 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700900}
901
902static void __init apq8064_init_irq(void)
903{
Praveen Chidambaram78499012011-11-01 17:15:17 -0600904 struct msm_mpm_device_data *data = NULL;
905
906#ifdef CONFIG_MSM_MPM
907 data = &apq8064_mpm_dev_data;
908#endif
909
910 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700911 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
912 (void *)MSM_QGIC_CPU_BASE);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700913}
914
Jay Chokshi7805b5a2011-11-07 15:55:30 -0800915static struct platform_device msm8064_device_saw_regulator_core0 = {
916 .name = "saw-regulator",
917 .id = 0,
918 .dev = {
919 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
920 },
921};
922
923static struct platform_device msm8064_device_saw_regulator_core1 = {
924 .name = "saw-regulator",
925 .id = 1,
926 .dev = {
927 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
928 },
929};
930
931static struct platform_device msm8064_device_saw_regulator_core2 = {
932 .name = "saw-regulator",
933 .id = 2,
934 .dev = {
935 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
936 },
937};
938
939static struct platform_device msm8064_device_saw_regulator_core3 = {
940 .name = "saw-regulator",
941 .id = 3,
942 .dev = {
943 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -0600944
945 },
946};
947
948static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
949 {
950 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
951 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
952 true,
953 100, 8000, 100000, 1,
954 },
955
956 {
957 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
958 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
959 true,
960 2000, 6000, 60100000, 3000,
961 },
962
963 {
964 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
965 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
966 false,
967 4200, 5000, 60350000, 3500,
968 },
969
970 {
971 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
972 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
973 false,
974 6300, 4500, 65350000, 4800,
975 },
976
977 {
978 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
979 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
980 false,
981 11700, 2500, 67850000, 5500,
982 },
983
984 {
985 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
986 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
987 false,
988 13800, 2000, 71850000, 6800,
989 },
990
991 {
992 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
993 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
994 false,
995 29700, 500, 75850000, 8800,
996 },
997
998 {
999 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1000 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1001 false,
1002 29700, 0, 76350000, 9800,
1003 },
1004};
1005
1006static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1007 .mode = MSM_PM_BOOT_CONFIG_TZ,
1008};
1009
1010static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
1011 .levels = &msm_rpmrs_levels[0],
1012 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
1013 .vdd_mem_levels = {
1014 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
1015 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
1016 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
1017 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
1018 },
1019 .vdd_dig_levels = {
1020 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
1021 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
1022 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
1023 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
1024 },
1025 .vdd_mask = 0x7FFFFF,
1026 .rpmrs_target_id = {
1027 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
1028 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
1029 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
1030 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
1031 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
1032 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
1033 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
1034 },
1035};
1036
1037static struct msm_cpuidle_state msm_cstates[] __initdata = {
1038 {0, 0, "C0", "WFI",
1039 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1040
1041 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1042 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1043
1044 {0, 2, "C2", "POWER_COLLAPSE",
1045 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
1046
1047 {1, 0, "C0", "WFI",
1048 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1049
1050 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1051 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1052
1053 {2, 0, "C0", "WFI",
1054 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1055
1056 {2, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1057 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1058
1059 {3, 0, "C0", "WFI",
1060 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1061
1062 {3, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1063 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1064};
1065
1066static struct msm_pm_platform_data msm_pm_data[] = {
1067 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1068 .idle_supported = 1,
1069 .suspend_supported = 1,
1070 .idle_enabled = 0,
1071 .suspend_enabled = 0,
1072 },
1073
1074 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1075 .idle_supported = 1,
1076 .suspend_supported = 1,
1077 .idle_enabled = 0,
1078 .suspend_enabled = 0,
1079 },
1080
1081 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1082 .idle_supported = 1,
1083 .suspend_supported = 1,
1084 .idle_enabled = 1,
1085 .suspend_enabled = 1,
1086 },
1087
1088 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1089 .idle_supported = 0,
1090 .suspend_supported = 1,
1091 .idle_enabled = 0,
1092 .suspend_enabled = 0,
1093 },
1094
1095 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1096 .idle_supported = 1,
1097 .suspend_supported = 1,
1098 .idle_enabled = 0,
1099 .suspend_enabled = 0,
1100 },
1101
1102 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1103 .idle_supported = 1,
1104 .suspend_supported = 0,
1105 .idle_enabled = 1,
1106 .suspend_enabled = 0,
1107 },
1108
1109 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1110 .idle_supported = 0,
1111 .suspend_supported = 1,
1112 .idle_enabled = 0,
1113 .suspend_enabled = 0,
1114 },
1115
1116 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1117 .idle_supported = 1,
1118 .suspend_supported = 1,
1119 .idle_enabled = 0,
1120 .suspend_enabled = 0,
1121 },
1122
1123 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1124 .idle_supported = 1,
1125 .suspend_supported = 0,
1126 .idle_enabled = 1,
1127 .suspend_enabled = 0,
1128 },
1129
1130 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1131 .idle_supported = 0,
1132 .suspend_supported = 1,
1133 .idle_enabled = 0,
1134 .suspend_enabled = 0,
1135 },
1136
1137 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1138 .idle_supported = 1,
1139 .suspend_supported = 1,
1140 .idle_enabled = 0,
1141 .suspend_enabled = 0,
1142 },
1143
1144 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1145 .idle_supported = 1,
1146 .suspend_supported = 0,
1147 .idle_enabled = 1,
1148 .suspend_enabled = 0,
1149 },
1150};
1151
1152static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1153 0x03, 0x0f,
1154};
1155
1156static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1157 0x00, 0x24, 0x54, 0x10,
1158 0x09, 0x03, 0x01,
1159 0x10, 0x54, 0x30, 0x0C,
1160 0x24, 0x30, 0x0f,
1161};
1162
1163static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1164 0x00, 0x24, 0x54, 0x10,
1165 0x09, 0x07, 0x01, 0x0B,
1166 0x10, 0x54, 0x30, 0x0C,
1167 0x24, 0x30, 0x0f,
1168};
1169
1170static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1171 [0] = {
1172 .mode = MSM_SPM_MODE_CLOCK_GATING,
1173 .notify_rpm = false,
1174 .cmd = spm_wfi_cmd_sequence,
1175 },
1176 [1] = {
1177 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1178 .notify_rpm = false,
1179 .cmd = spm_power_collapse_without_rpm,
1180 },
1181 [2] = {
1182 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1183 .notify_rpm = true,
1184 .cmd = spm_power_collapse_with_rpm,
1185 },
1186};
1187
1188static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1189 0x00, 0x20, 0x03, 0x20,
1190 0x00, 0x0f,
1191};
1192
1193static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1194 0x00, 0x20, 0x34, 0x64,
1195 0x48, 0x07, 0x48, 0x20,
1196 0x50, 0x64, 0x04, 0x34,
1197 0x50, 0x0f,
1198};
1199static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1200 0x00, 0x10, 0x34, 0x64,
1201 0x48, 0x07, 0x48, 0x10,
1202 0x50, 0x64, 0x04, 0x34,
1203 0x50, 0x0F,
1204};
1205
1206static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1207 [0] = {
1208 .mode = MSM_SPM_L2_MODE_RETENTION,
1209 .notify_rpm = false,
1210 .cmd = l2_spm_wfi_cmd_sequence,
1211 },
1212 [1] = {
1213 .mode = MSM_SPM_L2_MODE_GDHS,
1214 .notify_rpm = true,
1215 .cmd = l2_spm_gdhs_cmd_sequence,
1216 },
1217 [2] = {
1218 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1219 .notify_rpm = true,
1220 .cmd = l2_spm_power_off_cmd_sequence,
1221 },
1222};
1223
1224
1225static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1226 [0] = {
1227 .reg_base_addr = MSM_SAW_L2_BASE,
1228 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1229 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
1230 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1231 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1232 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1233 .modes = msm_spm_l2_seq_list,
1234 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1235 },
1236};
1237
1238static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1239 [0] = {
1240 .reg_base_addr = MSM_SAW0_BASE,
1241 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1242 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
1243 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
1244#if defined(CONFIG_MSM_AVS_HW)
1245 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1246 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1247#endif
1248 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1249 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1250 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1251 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1252 .vctl_timeout_us = 50,
1253 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1254 .modes = msm_spm_seq_list,
1255 },
1256 [1] = {
1257 .reg_base_addr = MSM_SAW1_BASE,
1258 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1259 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
1260 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
1261#if defined(CONFIG_MSM_AVS_HW)
1262 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1263 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1264#endif
1265 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1266 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1267 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1268 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1269 .vctl_timeout_us = 50,
1270 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1271 .modes = msm_spm_seq_list,
1272 },
1273 [2] = {
1274 .reg_base_addr = MSM_SAW2_BASE,
1275 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1276 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
1277 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
1278#if defined(CONFIG_MSM_AVS_HW)
1279 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1280 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1281#endif
1282 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1283 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1284 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1285 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1286 .vctl_timeout_us = 50,
1287 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1288 .modes = msm_spm_seq_list,
1289 },
1290 [3] = {
1291 .reg_base_addr = MSM_SAW3_BASE,
1292 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1293 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
1294 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
1295#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
1579 /* Build the matching 'supported_machs' bitmask */
1580 if (machine_is_apq8064_cdp())
1581 mach_mask = I2C_SURF;
1582 else if (machine_is_apq8064_mtp())
1583 mach_mask = I2C_FFA;
1584 else if (machine_is_apq8064_liquid())
1585 mach_mask = I2C_LIQUID;
1586 else if (machine_is_apq8064_rumi3())
1587 mach_mask = I2C_RUMI;
1588 else if (machine_is_apq8064_sim())
1589 mach_mask = I2C_SIM;
1590 else
1591 pr_err("unmatched machine ID in register_i2c_devices\n");
1592
1593 /* Run the array and install devices as appropriate */
1594 for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) {
1595 if (apq8064_i2c_devices[i].machs & mach_mask)
1596 i2c_register_board_info(apq8064_i2c_devices[i].bus,
1597 apq8064_i2c_devices[i].info,
1598 apq8064_i2c_devices[i].len);
1599 }
1600}
1601
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001602static void __init apq8064_common_init(void)
1603{
1604 if (socinfo_init() < 0)
1605 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06001606 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
1607 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
David Collins2782b5c2012-02-06 10:02:42 -08001608 regulator_suppress_info_printing();
1609 platform_device_register(&apq8064_device_rpm_regulator);
Tianyi Gou41515e22011-09-01 19:37:43 -07001610 apq8064_clock_init();
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08001611 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06001612 apq8064_i2c_init();
Jing Lin417fa452012-02-05 14:31:06 -08001613 register_i2c_devices();
Kenneth Heitke36920d32011-07-20 16:44:30 -06001614
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001615 apq8064_device_qup_spi_gsbi5.dev.platform_data =
1616 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08001617 apq8064_init_pmic();
Hemant Kumar94e7da22012-02-03 16:52:29 -08001618 if (machine_is_apq8064_liquid())
1619 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001620 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Hemant Kumara945b472012-01-25 15:08:06 -08001621 apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001622 apq8064_init_buses();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001623 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Jay Chokshie8741282012-01-25 15:22:55 -08001624 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05301625 apq8064_init_mmc();
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08001626
1627 if (machine_is_apq8064_mtp()) {
1628 mdm_8064_device.dev.platform_data = &mdm_platform_data;
1629 platform_device_register(&mdm_8064_device);
1630 }
1631 platform_device_register(&apq8064_slim_ctrl);
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001632 slim_register_board_info(apq8064_slim_devices,
1633 ARRAY_SIZE(apq8064_slim_devices));
Praveen Chidambaram78499012011-11-01 17:15:17 -06001634 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Mahesh Sivasubramaniancbce1ec2012-01-24 10:32:44 -07001635 acpuclk_init(&acpuclk_8064_soc_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06001636 msm_spm_l2_init(msm_spm_l2_data);
1637 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
1638 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
1639 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
1640 msm_pm_data);
1641 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001642}
1643
Huaibin Yang4a084e32011-12-15 15:25:52 -08001644static void __init apq8064_allocate_memory_regions(void)
1645{
1646 apq8064_allocate_fb_region();
1647}
1648
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001649static void __init apq8064_sim_init(void)
1650{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001651 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
1652 &msm8064_device_watchdog.dev.platform_data;
1653
1654 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001655 apq8064_common_init();
Joel King4e7ad222011-08-17 15:47:38 -07001656 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
1657}
1658
1659static void __init apq8064_rumi3_init(void)
1660{
1661 apq8064_common_init();
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001662 ethernet_init();
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001663 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001664 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Huaibin Yang4a084e32011-12-15 15:25:52 -08001665 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07001666 apq8064_init_gpu();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001667}
1668
Joel King82b7e3f2012-01-05 10:03:27 -08001669static void __init apq8064_cdp_init(void)
1670{
1671 apq8064_common_init();
1672 ethernet_init();
1673 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
1674 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08001675 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07001676 apq8064_init_gpu();
Matt Wagantallef3cfe542012-02-04 19:01:08 -08001677 platform_add_devices(msm_footswitch_devices,
1678 msm_num_footswitch_devices);
Joel King82b7e3f2012-01-05 10:03:27 -08001679}
1680
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001681MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
1682 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07001683 .reserve = apq8064_reserve,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001684 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05301685 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001686 .timer = &msm_timer,
1687 .init_machine = apq8064_sim_init,
1688MACHINE_END
1689
Joel King4e7ad222011-08-17 15:47:38 -07001690MACHINE_START(APQ8064_RUMI3, "QCT APQ8064 RUMI3")
1691 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07001692 .reserve = apq8064_reserve,
Joel King4e7ad222011-08-17 15:47:38 -07001693 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05301694 .handle_irq = gic_handle_irq,
Joel King4e7ad222011-08-17 15:47:38 -07001695 .timer = &msm_timer,
1696 .init_machine = apq8064_rumi3_init,
Huaibin Yang4a084e32011-12-15 15:25:52 -08001697 .init_early = apq8064_allocate_memory_regions,
Joel King4e7ad222011-08-17 15:47:38 -07001698MACHINE_END
1699
Joel King82b7e3f2012-01-05 10:03:27 -08001700MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
1701 .map_io = apq8064_map_io,
1702 .reserve = apq8064_reserve,
1703 .init_irq = apq8064_init_irq,
1704 .handle_irq = gic_handle_irq,
1705 .timer = &msm_timer,
1706 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08001707 .init_early = apq8064_allocate_memory_regions,
Joel King82b7e3f2012-01-05 10:03:27 -08001708MACHINE_END
1709
1710MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
1711 .map_io = apq8064_map_io,
1712 .reserve = apq8064_reserve,
1713 .init_irq = apq8064_init_irq,
1714 .handle_irq = gic_handle_irq,
1715 .timer = &msm_timer,
1716 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08001717 .init_early = apq8064_allocate_memory_regions,
Joel King82b7e3f2012-01-05 10:03:27 -08001718MACHINE_END
1719
1720MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
1721 .map_io = apq8064_map_io,
1722 .reserve = apq8064_reserve,
1723 .init_irq = apq8064_init_irq,
1724 .handle_irq = gic_handle_irq,
1725 .timer = &msm_timer,
1726 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08001727 .init_early = apq8064_allocate_memory_regions,
Joel King82b7e3f2012-01-05 10:03:27 -08001728MACHINE_END
1729