blob: 0f7f0653c4d64a02c7c0b90bcc1f4c9e0f53a2ba [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>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070028#include <asm/mach-types.h>
29#include <asm/mach/arch.h>
30#include <asm/hardware/gic.h>
Sahitya Tummala3586ed92011-08-03 09:13:23 +053031#include <asm/mach/mmc.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070032
33#include <mach/board.h>
34#include <mach/msm_iomap.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080035#include <mach/ion.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070036#include <linux/usb/msm_hsusb.h>
37#include <linux/usb/android.h>
38#include <mach/socinfo.h>
Harini Jayaramanc4c58692011-07-19 14:50:10 -060039#include <mach/msm_spi.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070040#include "timer.h"
41#include "devices.h"
Joel King4ebccc62011-07-22 09:43:22 -070042#include <mach/gpio.h>
43#include <mach/gpiomux.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060044#include <mach/rpm.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080045#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -070046#include <linux/android_pmem.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080047#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070048#include <mach/msm_memtypes.h>
49#include <linux/bootmem.h>
50#include <asm/setup.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070051#include <mach/dma.h>
Gagan Mac8a7a5d32011-11-11 16:43:06 -070052#include <mach/msm_bus_board.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060053#include <mach/cpuidle.h>
Joel Kingdacbc822012-01-25 13:30:57 -080054#include <mach/mdm2.h>
Joel King4ebccc62011-07-22 09:43:22 -070055
Jeff Ohlstein7e668552011-10-06 16:17:25 -070056#include "msm_watchdog.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080057#include "board-8064.h"
Vikram Mulukutlabc2e9572011-11-04 03:41:38 -070058#include "acpuclock.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060059#include "spm.h"
60#include "mpm.h"
61#include "rpm_resources.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080062#include "pm.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060063#include "pm-boot.h"
Rajesh Sastrulaaee8af32012-01-20 11:46:31 -080064#include "devices-msm8x60.h"
Jay Chokshiea67c622011-07-29 17:12:26 -070065
Olav Haugan7c6aa742012-01-16 16:47:37 -080066#define MSM_PMEM_ADSP_SIZE 0x7800000
Ben Romberger3ffcd812011-12-08 19:12:10 -080067#define MSM_PMEM_AUDIO_SIZE 0x2B4000
Olav Haugan7c6aa742012-01-16 16:47:37 -080068#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
69#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
70#else
71#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
72#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070073
Olav Haugan7c6aa742012-01-16 16:47:37 -080074#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Olav Hauganedcf6832012-01-24 08:35:41 -080075#define MSM_PMEM_KERNEL_EBI1_SIZE 0x280000
Olav Haugan7c6aa742012-01-16 16:47:37 -080076#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Haugand3d29682012-01-19 10:57:07 -080077#define MSM_ION_MM_FW_SIZE 0x200000 /* (2MB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -080078#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Hauganf45e2142012-01-19 11:01:01 -080079#define MSM_ION_QSECOM_SIZE 0x100000 /* (1MB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -080080#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan2c43fac2012-01-19 11:06:37 -080081#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
82#define MSM_ION_HEAP_NUM 8
Olav Haugan7c6aa742012-01-16 16:47:37 -080083#else
84#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
85#define MSM_ION_HEAP_NUM 1
86#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070087
Olav Haugan7c6aa742012-01-16 16:47:37 -080088#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
89static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
90static int __init pmem_kernel_ebi1_size_setup(char *p)
Kevin Chan13be4e22011-10-20 11:30:32 -070091{
Olav Haugan7c6aa742012-01-16 16:47:37 -080092 pmem_kernel_ebi1_size = memparse(p, NULL);
93 return 0;
Kevin Chan13be4e22011-10-20 11:30:32 -070094}
Olav Haugan7c6aa742012-01-16 16:47:37 -080095early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
96#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070097
Olav Haugan7c6aa742012-01-16 16:47:37 -080098#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -070099static unsigned pmem_size = MSM_PMEM_SIZE;
100static int __init pmem_size_setup(char *p)
101{
102 pmem_size = memparse(p, NULL);
103 return 0;
104}
105early_param("pmem_size", pmem_size_setup);
106
107static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
108
109static int __init pmem_adsp_size_setup(char *p)
110{
111 pmem_adsp_size = memparse(p, NULL);
112 return 0;
113}
114early_param("pmem_adsp_size", pmem_adsp_size_setup);
115
116static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
117
118static int __init pmem_audio_size_setup(char *p)
119{
120 pmem_audio_size = memparse(p, NULL);
121 return 0;
122}
123early_param("pmem_audio_size", pmem_audio_size_setup);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800124#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700125
Olav Haugan7c6aa742012-01-16 16:47:37 -0800126#ifdef CONFIG_ANDROID_PMEM
127#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700128static struct android_pmem_platform_data android_pmem_pdata = {
129 .name = "pmem",
130 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
131 .cached = 1,
132 .memory_type = MEMTYPE_EBI1,
133};
134
135static struct platform_device android_pmem_device = {
136 .name = "android_pmem",
137 .id = 0,
138 .dev = {.platform_data = &android_pmem_pdata},
139};
140
141static struct android_pmem_platform_data android_pmem_adsp_pdata = {
142 .name = "pmem_adsp",
143 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
144 .cached = 0,
145 .memory_type = MEMTYPE_EBI1,
146};
Kevin Chan13be4e22011-10-20 11:30:32 -0700147static struct platform_device android_pmem_adsp_device = {
148 .name = "android_pmem",
149 .id = 2,
150 .dev = { .platform_data = &android_pmem_adsp_pdata },
151};
Olav Haugan7c6aa742012-01-16 16:47:37 -0800152#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700153
154static struct android_pmem_platform_data android_pmem_audio_pdata = {
155 .name = "pmem_audio",
156 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
157 .cached = 0,
158 .memory_type = MEMTYPE_EBI1,
159};
160
161static struct platform_device android_pmem_audio_device = {
162 .name = "android_pmem",
163 .id = 4,
164 .dev = { .platform_data = &android_pmem_audio_pdata },
165};
Olav Haugan7c6aa742012-01-16 16:47:37 -0800166#endif
167
168static struct memtype_reserve apq8064_reserve_table[] __initdata = {
169 [MEMTYPE_SMI] = {
170 },
171 [MEMTYPE_EBI0] = {
172 .flags = MEMTYPE_FLAGS_1M_ALIGN,
173 },
174 [MEMTYPE_EBI1] = {
175 .flags = MEMTYPE_FLAGS_1M_ALIGN,
176 },
177};
Kevin Chan13be4e22011-10-20 11:30:32 -0700178
179static void __init size_pmem_devices(void)
180{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800181#ifdef CONFIG_ANDROID_PMEM
182#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700183 android_pmem_adsp_pdata.size = pmem_adsp_size;
184 android_pmem_pdata.size = pmem_size;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800185#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700186 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800187#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700188}
189
190static void __init reserve_memory_for(struct android_pmem_platform_data *p)
191{
192 apq8064_reserve_table[p->memory_type].size += p->size;
193}
194
Kevin Chan13be4e22011-10-20 11:30:32 -0700195static void __init reserve_pmem_memory(void)
196{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800197#ifdef CONFIG_ANDROID_PMEM
198#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700199 reserve_memory_for(&android_pmem_adsp_pdata);
200 reserve_memory_for(&android_pmem_pdata);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800201#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700202 reserve_memory_for(&android_pmem_audio_pdata);
203 apq8064_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800204#endif
205}
206
207static int apq8064_paddr_to_memtype(unsigned int paddr)
208{
209 return MEMTYPE_EBI1;
210}
211
212#ifdef CONFIG_ION_MSM
213#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
214static struct ion_cp_heap_pdata cp_mm_ion_pdata = {
215 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugand3d29682012-01-19 10:57:07 -0800216 .align = PAGE_SIZE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800217};
218
219static struct ion_cp_heap_pdata cp_mfc_ion_pdata = {
220 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugand3d29682012-01-19 10:57:07 -0800221 .align = PAGE_SIZE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800222};
223
224static struct ion_co_heap_pdata co_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800225 .adjacent_mem_id = INVALID_HEAP_ID,
226 .align = PAGE_SIZE,
227};
228
229static struct ion_co_heap_pdata fw_co_ion_pdata = {
230 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
231 .align = SZ_128K,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800232};
233#endif
234static struct ion_platform_data ion_pdata = {
235 .nr = MSM_ION_HEAP_NUM,
236 .heaps = {
237 {
238 .id = ION_SYSTEM_HEAP_ID,
239 .type = ION_HEAP_TYPE_SYSTEM,
240 .name = ION_VMALLOC_HEAP_NAME,
241 },
242#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
243 {
244 .id = ION_SF_HEAP_ID,
245 .type = ION_HEAP_TYPE_CARVEOUT,
246 .name = ION_SF_HEAP_NAME,
247 .size = MSM_ION_SF_SIZE,
248 .memory_type = ION_EBI_TYPE,
249 .extra_data = (void *) &co_ion_pdata,
250 },
251 {
252 .id = ION_CP_MM_HEAP_ID,
253 .type = ION_HEAP_TYPE_CP,
254 .name = ION_MM_HEAP_NAME,
255 .size = MSM_ION_MM_SIZE,
256 .memory_type = ION_EBI_TYPE,
257 .extra_data = (void *) &cp_mm_ion_pdata,
258 },
259 {
Olav Haugand3d29682012-01-19 10:57:07 -0800260 .id = ION_MM_FIRMWARE_HEAP_ID,
261 .type = ION_HEAP_TYPE_CARVEOUT,
262 .name = ION_MM_FIRMWARE_HEAP_NAME,
263 .size = MSM_ION_MM_FW_SIZE,
264 .memory_type = ION_EBI_TYPE,
265 .extra_data = (void *) &fw_co_ion_pdata,
266 },
267 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800268 .id = ION_CP_MFC_HEAP_ID,
269 .type = ION_HEAP_TYPE_CP,
270 .name = ION_MFC_HEAP_NAME,
271 .size = MSM_ION_MFC_SIZE,
272 .memory_type = ION_EBI_TYPE,
273 .extra_data = (void *) &cp_mfc_ion_pdata,
274 },
275 {
276 .id = ION_IOMMU_HEAP_ID,
277 .type = ION_HEAP_TYPE_IOMMU,
278 .name = ION_IOMMU_HEAP_NAME,
279 },
Olav Hauganf45e2142012-01-19 11:01:01 -0800280 {
281 .id = ION_QSECOM_HEAP_ID,
282 .type = ION_HEAP_TYPE_CARVEOUT,
283 .name = ION_QSECOM_HEAP_NAME,
284 .size = MSM_ION_QSECOM_SIZE,
285 .memory_type = ION_EBI_TYPE,
286 .extra_data = (void *) &co_ion_pdata,
287 },
Olav Haugan2c43fac2012-01-19 11:06:37 -0800288 {
289 .id = ION_AUDIO_HEAP_ID,
290 .type = ION_HEAP_TYPE_CARVEOUT,
291 .name = ION_AUDIO_HEAP_NAME,
292 .size = MSM_ION_AUDIO_SIZE,
293 .memory_type = ION_EBI_TYPE,
294 .extra_data = (void *) &co_ion_pdata,
295 },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800296#endif
297 }
298};
299
300static struct platform_device ion_dev = {
301 .name = "ion-msm",
302 .id = 1,
303 .dev = { .platform_data = &ion_pdata },
304};
305#endif
306
307static void reserve_ion_memory(void)
308{
309#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
310 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_SIZE;
Olav Haugand3d29682012-01-19 10:57:07 -0800311 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_FW_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800312 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_SF_SIZE;
313 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MFC_SIZE;
Olav Hauganf45e2142012-01-19 11:01:01 -0800314 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_QSECOM_SIZE;
Olav Haugan2c43fac2012-01-19 11:06:37 -0800315 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_AUDIO_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800316#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700317}
318
Huaibin Yang4a084e32011-12-15 15:25:52 -0800319static void __init reserve_mdp_memory(void)
320{
321 apq8064_mdp_writeback(apq8064_reserve_table);
322}
323
Kevin Chan13be4e22011-10-20 11:30:32 -0700324static void __init apq8064_calculate_reserve_sizes(void)
325{
326 size_pmem_devices();
327 reserve_pmem_memory();
Olav Haugan7c6aa742012-01-16 16:47:37 -0800328 reserve_ion_memory();
Huaibin Yang4a084e32011-12-15 15:25:52 -0800329 reserve_mdp_memory();
Kevin Chan13be4e22011-10-20 11:30:32 -0700330}
331
332static struct reserve_info apq8064_reserve_info __initdata = {
333 .memtype_reserve_table = apq8064_reserve_table,
334 .calculate_reserve_sizes = apq8064_calculate_reserve_sizes,
335 .paddr_to_memtype = apq8064_paddr_to_memtype,
336};
337
338static int apq8064_memory_bank_size(void)
339{
340 return 1<<29;
341}
342
343static void __init locate_unstable_memory(void)
344{
345 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
346 unsigned long bank_size;
347 unsigned long low, high;
348
349 bank_size = apq8064_memory_bank_size();
350 low = meminfo.bank[0].start;
351 high = mb->start + mb->size;
Olav Haugand76e3a82012-01-16 16:55:07 -0800352
353 /* Check if 32 bit overflow occured */
354 if (high < mb->start)
355 high = ~0UL;
356
Kevin Chan13be4e22011-10-20 11:30:32 -0700357 low &= ~(bank_size - 1);
358
359 if (high - low <= bank_size)
360 return;
Jack Cheung46bfffa2012-01-19 15:26:24 -0800361 apq8064_reserve_info.low_unstable_address = mb->start -
362 MIN_MEMORY_BLOCK_SIZE + mb->size;
363 apq8064_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
364
Kevin Chan13be4e22011-10-20 11:30:32 -0700365 apq8064_reserve_info.bank_size = bank_size;
366 pr_info("low unstable address %lx max size %lx bank size %lx\n",
367 apq8064_reserve_info.low_unstable_address,
368 apq8064_reserve_info.max_unstable_size,
369 apq8064_reserve_info.bank_size);
370}
371
372static void __init apq8064_reserve(void)
373{
374 reserve_info = &apq8064_reserve_info;
375 locate_unstable_memory();
376 msm_reserve();
377}
378
Hemant Kumara945b472012-01-25 15:08:06 -0800379#ifdef CONFIG_USB_EHCI_MSM_HSIC
380static struct msm_hsic_host_platform_data msm_hsic_pdata = {
381 .strobe = 88,
382 .data = 89,
383};
384#else
385static struct msm_hsic_host_platform_data msm_hsic_pdata;
386#endif
387
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800388#define PID_MAGIC_ID 0x71432909
389#define SERIAL_NUM_MAGIC_ID 0x61945374
390#define SERIAL_NUMBER_LENGTH 127
391#define DLOAD_USB_BASE_ADD 0x2A03F0C8
392
393struct magic_num_struct {
394 uint32_t pid;
395 uint32_t serial_num;
396};
397
398struct dload_struct {
399 uint32_t reserved1;
400 uint32_t reserved2;
401 uint32_t reserved3;
402 uint16_t reserved4;
403 uint16_t pid;
404 char serial_number[SERIAL_NUMBER_LENGTH];
405 uint16_t reserved5;
406 struct magic_num_struct magic_struct;
407};
408
409static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
410{
411 struct dload_struct __iomem *dload = 0;
412
413 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
414 if (!dload) {
415 pr_err("%s: cannot remap I/O memory region: %08x\n",
416 __func__, DLOAD_USB_BASE_ADD);
417 return -ENXIO;
418 }
419
420 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
421 __func__, dload, pid, snum);
422 /* update pid */
423 dload->magic_struct.pid = PID_MAGIC_ID;
424 dload->pid = pid;
425
426 /* update serial number */
427 dload->magic_struct.serial_num = 0;
428 if (!snum) {
429 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
430 goto out;
431 }
432
433 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
434 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
435out:
436 iounmap(dload);
437 return 0;
438}
439
440static struct android_usb_platform_data android_usb_pdata = {
441 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
442};
443
Hemant Kumar4933b072011-10-17 23:43:11 -0700444static struct platform_device android_usb_device = {
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800445 .name = "android_usb",
446 .id = -1,
447 .dev = {
448 .platform_data = &android_usb_pdata,
449 },
Hemant Kumar4933b072011-10-17 23:43:11 -0700450};
451
452static struct msm_otg_platform_data msm_otg_pdata = {
Hemant Kumard86c4882012-01-24 19:39:37 -0800453 .mode = USB_OTG,
454 .otg_control = OTG_PMIC_CONTROL,
Hemant Kumar4933b072011-10-17 23:43:11 -0700455 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Hemant Kumard86c4882012-01-24 19:39:37 -0800456 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
457 .power_budget = 750,
Hemant Kumar4933b072011-10-17 23:43:11 -0700458};
459
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800460#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
461
462/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
463 * 4 micbiases are used to power various analog and digital
464 * microphones operating at 1800 mV. Technically, all micbiases
465 * can source from single cfilter since all microphones operate
466 * at the same voltage level. The arrangement below is to make
467 * sure all cfilters are exercised. LDO_H regulator ouput level
468 * does not need to be as high as 2.85V. It is choosen for
469 * microphone sensitivity purpose.
470 */
471static struct tabla_pdata apq8064_tabla_platform_data = {
472 .slimbus_slave_device = {
473 .name = "tabla-slave",
474 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
475 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800476 .irq = MSM_GPIO_TO_INT(42),
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800477 .irq_base = TABLA_INTERRUPT_BASE,
478 .num_irqs = NR_TABLA_IRQS,
479 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
480 .micbias = {
481 .ldoh_v = TABLA_LDOH_2P85_V,
482 .cfilt1_mv = 1800,
483 .cfilt2_mv = 1800,
484 .cfilt3_mv = 1800,
485 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
486 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
487 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
488 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
489 }
490};
491
492static struct slim_device apq8064_slim_tabla = {
493 .name = "tabla-slim",
494 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
495 .dev = {
496 .platform_data = &apq8064_tabla_platform_data,
497 },
498};
499
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800500static struct tabla_pdata apq8064_tabla20_platform_data = {
501 .slimbus_slave_device = {
502 .name = "tabla-slave",
503 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
504 },
505 .irq = MSM_GPIO_TO_INT(42),
506 .irq_base = TABLA_INTERRUPT_BASE,
507 .num_irqs = NR_TABLA_IRQS,
508 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
509 .micbias = {
510 .ldoh_v = TABLA_LDOH_2P85_V,
511 .cfilt1_mv = 1800,
512 .cfilt2_mv = 1800,
513 .cfilt3_mv = 1800,
514 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
515 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
516 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
517 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
518 }
519};
520
521static struct slim_device apq8064_slim_tabla20 = {
522 .name = "tabla2x-slim",
523 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
524 .dev = {
525 .platform_data = &apq8064_tabla20_platform_data,
526 },
527};
528
Jing Lin21ed4de2012-02-05 15:53:28 -0800529/* configuration data for mxt1386e using V2.1 firmware */
530static const u8 mxt1386e_config_data_v2_1[] = {
531 /* T6 Object */
532 0, 0, 0, 0, 0, 0,
533 /* T38 Object */
534 14, 0, 0, 24, 1, 12, 0, 0, 0, 0,
535 0, 0, 0, 0, 0, 0, 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,
541 /* T7 Object */
542 100, 16, 50,
543 /* T8 Object */
544 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
545 /* T9 Object */
546 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
547 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
548 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
549 10, 5, 0, 0, 0,
550 /* T18 Object */
551 0, 0,
552 /* T24 Object */
553 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
554 0, 0, 0, 0, 0, 0, 0, 0, 0,
555 /* T25 Object */
556 3, 0, 60, 115, 156, 99,
557 /* T27 Object */
558 0, 0, 0, 0, 0, 0, 0,
559 /* T40 Object */
560 0, 0, 0, 0, 0,
561 /* T42 Object */
562 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
563 /* T43 Object */
564 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
565 16,
566 /* T46 Object */
567 64, 0, 20, 20, 0, 0, 0, 0, 0,
568 /* T47 Object */
569 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
570 /* T48 Object */
571 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
572 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
573 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
574 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
575 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
576 0, 0, 0, 0,
577 /* T56 Object */
578 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
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 2, 99, 33, 0, 149, 24, 193, 255, 255, 255,
583 255,
584};
585
586#define MXT_TS_GPIO_IRQ 6
587#define MXT_TS_PWR_EN_GPIO PM8921_GPIO_PM_TO_SYS(23)
588#define MXT_TS_RESET_GPIO 33
589
590static struct mxt_config_info mxt_config_array[] = {
591 {
592 .config = mxt1386e_config_data_v2_1,
593 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
594 .family_id = 0xA0,
595 .variant_id = 0x7,
596 .version = 0x21,
597 .build = 0xAA,
598 },
599};
600
601static struct mxt_platform_data mxt_platform_data = {
602 .config_array = mxt_config_array,
603 .config_array_size = ARRAY_SIZE(mxt_config_array),
604 .x_size = 1365,
605 .y_size = 767,
606 .irqflags = IRQF_TRIGGER_FALLING,
607 .i2c_pull_up = true,
608 .reset_gpio = MXT_TS_RESET_GPIO,
609 .irq_gpio = MXT_TS_GPIO_IRQ,
610};
611
612static struct i2c_board_info mxt_device_info[] __initdata = {
613 {
614 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
615 .platform_data = &mxt_platform_data,
616 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
617 },
618};
619
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700620#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
621 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
622 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
623 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
624
625#define QCE_SIZE 0x10000
626#define QCE_0_BASE 0x11000000
627
628#define QCE_HW_KEY_SUPPORT 0
629#define QCE_SHA_HMAC_SUPPORT 1
630#define QCE_SHARE_CE_RESOURCE 3
631#define QCE_CE_SHARED 0
632
633static struct resource qcrypto_resources[] = {
634 [0] = {
635 .start = QCE_0_BASE,
636 .end = QCE_0_BASE + QCE_SIZE - 1,
637 .flags = IORESOURCE_MEM,
638 },
639 [1] = {
640 .name = "crypto_channels",
641 .start = DMOV8064_CE_IN_CHAN,
642 .end = DMOV8064_CE_OUT_CHAN,
643 .flags = IORESOURCE_DMA,
644 },
645 [2] = {
646 .name = "crypto_crci_in",
647 .start = DMOV8064_CE_IN_CRCI,
648 .end = DMOV8064_CE_IN_CRCI,
649 .flags = IORESOURCE_DMA,
650 },
651 [3] = {
652 .name = "crypto_crci_out",
653 .start = DMOV8064_CE_OUT_CRCI,
654 .end = DMOV8064_CE_OUT_CRCI,
655 .flags = IORESOURCE_DMA,
656 },
657};
658
659static struct resource qcedev_resources[] = {
660 [0] = {
661 .start = QCE_0_BASE,
662 .end = QCE_0_BASE + QCE_SIZE - 1,
663 .flags = IORESOURCE_MEM,
664 },
665 [1] = {
666 .name = "crypto_channels",
667 .start = DMOV8064_CE_IN_CHAN,
668 .end = DMOV8064_CE_OUT_CHAN,
669 .flags = IORESOURCE_DMA,
670 },
671 [2] = {
672 .name = "crypto_crci_in",
673 .start = DMOV8064_CE_IN_CRCI,
674 .end = DMOV8064_CE_IN_CRCI,
675 .flags = IORESOURCE_DMA,
676 },
677 [3] = {
678 .name = "crypto_crci_out",
679 .start = DMOV8064_CE_OUT_CRCI,
680 .end = DMOV8064_CE_OUT_CRCI,
681 .flags = IORESOURCE_DMA,
682 },
683};
684
685#endif
686
687#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
688 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
689
690static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
691 .ce_shared = QCE_CE_SHARED,
692 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
693 .hw_key_support = QCE_HW_KEY_SUPPORT,
694 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800695 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700696};
697
698static struct platform_device qcrypto_device = {
699 .name = "qcrypto",
700 .id = 0,
701 .num_resources = ARRAY_SIZE(qcrypto_resources),
702 .resource = qcrypto_resources,
703 .dev = {
704 .coherent_dma_mask = DMA_BIT_MASK(32),
705 .platform_data = &qcrypto_ce_hw_suppport,
706 },
707};
708#endif
709
710#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
711 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
712
713static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
714 .ce_shared = QCE_CE_SHARED,
715 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
716 .hw_key_support = QCE_HW_KEY_SUPPORT,
717 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800718 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700719};
720
721static struct platform_device qcedev_device = {
722 .name = "qce",
723 .id = 0,
724 .num_resources = ARRAY_SIZE(qcedev_resources),
725 .resource = qcedev_resources,
726 .dev = {
727 .coherent_dma_mask = DMA_BIT_MASK(32),
728 .platform_data = &qcedev_ce_hw_suppport,
729 },
730};
731#endif
732
Joel Kingdacbc822012-01-25 13:30:57 -0800733static struct mdm_platform_data mdm_platform_data = {
734 .mdm_version = "3.0",
735 .ramdump_delay_ms = 2000,
Hemant Kumara945b472012-01-25 15:08:06 -0800736 .peripheral_platform_device = &apq8064_device_hsic_host,
Joel Kingdacbc822012-01-25 13:30:57 -0800737};
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700738
Jeff Hugo0c0f5e92011-09-28 13:55:45 -0600739#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700740static void __init apq8064_map_io(void)
741{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -0600742 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700743 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -0700744 if (socinfo_init() < 0)
745 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700746}
747
748static void __init apq8064_init_irq(void)
749{
Praveen Chidambaram78499012011-11-01 17:15:17 -0600750 struct msm_mpm_device_data *data = NULL;
751
752#ifdef CONFIG_MSM_MPM
753 data = &apq8064_mpm_dev_data;
754#endif
755
756 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700757 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
758 (void *)MSM_QGIC_CPU_BASE);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700759}
760
Jay Chokshi7805b5a2011-11-07 15:55:30 -0800761static struct platform_device msm8064_device_saw_regulator_core0 = {
762 .name = "saw-regulator",
763 .id = 0,
764 .dev = {
765 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
766 },
767};
768
769static struct platform_device msm8064_device_saw_regulator_core1 = {
770 .name = "saw-regulator",
771 .id = 1,
772 .dev = {
773 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
774 },
775};
776
777static struct platform_device msm8064_device_saw_regulator_core2 = {
778 .name = "saw-regulator",
779 .id = 2,
780 .dev = {
781 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
782 },
783};
784
785static struct platform_device msm8064_device_saw_regulator_core3 = {
786 .name = "saw-regulator",
787 .id = 3,
788 .dev = {
789 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -0600790
791 },
792};
793
794static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
795 {
796 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
797 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
798 true,
799 100, 8000, 100000, 1,
800 },
801
802 {
803 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
804 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
805 true,
806 2000, 6000, 60100000, 3000,
807 },
808
809 {
810 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
811 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
812 false,
813 4200, 5000, 60350000, 3500,
814 },
815
816 {
817 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
818 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
819 false,
820 6300, 4500, 65350000, 4800,
821 },
822
823 {
824 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
825 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
826 false,
827 11700, 2500, 67850000, 5500,
828 },
829
830 {
831 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
832 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
833 false,
834 13800, 2000, 71850000, 6800,
835 },
836
837 {
838 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
839 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
840 false,
841 29700, 500, 75850000, 8800,
842 },
843
844 {
845 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
846 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
847 false,
848 29700, 0, 76350000, 9800,
849 },
850};
851
852static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
853 .mode = MSM_PM_BOOT_CONFIG_TZ,
854};
855
856static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
857 .levels = &msm_rpmrs_levels[0],
858 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
859 .vdd_mem_levels = {
860 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
861 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
862 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
863 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
864 },
865 .vdd_dig_levels = {
866 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
867 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
868 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
869 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
870 },
871 .vdd_mask = 0x7FFFFF,
872 .rpmrs_target_id = {
873 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
874 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
875 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
876 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
877 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
878 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
879 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
880 },
881};
882
883static struct msm_cpuidle_state msm_cstates[] __initdata = {
884 {0, 0, "C0", "WFI",
885 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
886
887 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
888 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
889
890 {0, 2, "C2", "POWER_COLLAPSE",
891 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
892
893 {1, 0, "C0", "WFI",
894 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
895
896 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
897 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
898
899 {2, 0, "C0", "WFI",
900 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
901
902 {2, 1, "C1", "STANDALONE_POWER_COLLAPSE",
903 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
904
905 {3, 0, "C0", "WFI",
906 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
907
908 {3, 1, "C1", "STANDALONE_POWER_COLLAPSE",
909 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
910};
911
912static struct msm_pm_platform_data msm_pm_data[] = {
913 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
914 .idle_supported = 1,
915 .suspend_supported = 1,
916 .idle_enabled = 0,
917 .suspend_enabled = 0,
918 },
919
920 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
921 .idle_supported = 1,
922 .suspend_supported = 1,
923 .idle_enabled = 0,
924 .suspend_enabled = 0,
925 },
926
927 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
928 .idle_supported = 1,
929 .suspend_supported = 1,
930 .idle_enabled = 1,
931 .suspend_enabled = 1,
932 },
933
934 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
935 .idle_supported = 0,
936 .suspend_supported = 1,
937 .idle_enabled = 0,
938 .suspend_enabled = 0,
939 },
940
941 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
942 .idle_supported = 1,
943 .suspend_supported = 1,
944 .idle_enabled = 0,
945 .suspend_enabled = 0,
946 },
947
948 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
949 .idle_supported = 1,
950 .suspend_supported = 0,
951 .idle_enabled = 1,
952 .suspend_enabled = 0,
953 },
954
955 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
956 .idle_supported = 0,
957 .suspend_supported = 1,
958 .idle_enabled = 0,
959 .suspend_enabled = 0,
960 },
961
962 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
963 .idle_supported = 1,
964 .suspend_supported = 1,
965 .idle_enabled = 0,
966 .suspend_enabled = 0,
967 },
968
969 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
970 .idle_supported = 1,
971 .suspend_supported = 0,
972 .idle_enabled = 1,
973 .suspend_enabled = 0,
974 },
975
976 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
977 .idle_supported = 0,
978 .suspend_supported = 1,
979 .idle_enabled = 0,
980 .suspend_enabled = 0,
981 },
982
983 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
984 .idle_supported = 1,
985 .suspend_supported = 1,
986 .idle_enabled = 0,
987 .suspend_enabled = 0,
988 },
989
990 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
991 .idle_supported = 1,
992 .suspend_supported = 0,
993 .idle_enabled = 1,
994 .suspend_enabled = 0,
995 },
996};
997
998static uint8_t spm_wfi_cmd_sequence[] __initdata = {
999 0x03, 0x0f,
1000};
1001
1002static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1003 0x00, 0x24, 0x54, 0x10,
1004 0x09, 0x03, 0x01,
1005 0x10, 0x54, 0x30, 0x0C,
1006 0x24, 0x30, 0x0f,
1007};
1008
1009static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1010 0x00, 0x24, 0x54, 0x10,
1011 0x09, 0x07, 0x01, 0x0B,
1012 0x10, 0x54, 0x30, 0x0C,
1013 0x24, 0x30, 0x0f,
1014};
1015
1016static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1017 [0] = {
1018 .mode = MSM_SPM_MODE_CLOCK_GATING,
1019 .notify_rpm = false,
1020 .cmd = spm_wfi_cmd_sequence,
1021 },
1022 [1] = {
1023 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1024 .notify_rpm = false,
1025 .cmd = spm_power_collapse_without_rpm,
1026 },
1027 [2] = {
1028 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1029 .notify_rpm = true,
1030 .cmd = spm_power_collapse_with_rpm,
1031 },
1032};
1033
1034static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1035 0x00, 0x20, 0x03, 0x20,
1036 0x00, 0x0f,
1037};
1038
1039static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1040 0x00, 0x20, 0x34, 0x64,
1041 0x48, 0x07, 0x48, 0x20,
1042 0x50, 0x64, 0x04, 0x34,
1043 0x50, 0x0f,
1044};
1045static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1046 0x00, 0x10, 0x34, 0x64,
1047 0x48, 0x07, 0x48, 0x10,
1048 0x50, 0x64, 0x04, 0x34,
1049 0x50, 0x0F,
1050};
1051
1052static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1053 [0] = {
1054 .mode = MSM_SPM_L2_MODE_RETENTION,
1055 .notify_rpm = false,
1056 .cmd = l2_spm_wfi_cmd_sequence,
1057 },
1058 [1] = {
1059 .mode = MSM_SPM_L2_MODE_GDHS,
1060 .notify_rpm = true,
1061 .cmd = l2_spm_gdhs_cmd_sequence,
1062 },
1063 [2] = {
1064 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1065 .notify_rpm = true,
1066 .cmd = l2_spm_power_off_cmd_sequence,
1067 },
1068};
1069
1070
1071static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1072 [0] = {
1073 .reg_base_addr = MSM_SAW_L2_BASE,
1074 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1075 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
1076 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1077 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1078 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1079 .modes = msm_spm_l2_seq_list,
1080 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1081 },
1082};
1083
1084static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1085 [0] = {
1086 .reg_base_addr = MSM_SAW0_BASE,
1087 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1088 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
1089 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
1090#if defined(CONFIG_MSM_AVS_HW)
1091 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1092 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1093#endif
1094 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1095 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1096 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1097 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1098 .vctl_timeout_us = 50,
1099 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1100 .modes = msm_spm_seq_list,
1101 },
1102 [1] = {
1103 .reg_base_addr = MSM_SAW1_BASE,
1104 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1105 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
1106 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
1107#if defined(CONFIG_MSM_AVS_HW)
1108 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1109 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1110#endif
1111 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1112 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1113 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1114 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1115 .vctl_timeout_us = 50,
1116 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1117 .modes = msm_spm_seq_list,
1118 },
1119 [2] = {
1120 .reg_base_addr = MSM_SAW2_BASE,
1121 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1122 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
1123 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
1124#if defined(CONFIG_MSM_AVS_HW)
1125 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1126 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1127#endif
1128 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1129 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1130 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1131 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1132 .vctl_timeout_us = 50,
1133 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1134 .modes = msm_spm_seq_list,
1135 },
1136 [3] = {
1137 .reg_base_addr = MSM_SAW3_BASE,
1138 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1139 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
1140 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
1141#if defined(CONFIG_MSM_AVS_HW)
1142 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1143 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1144#endif
1145 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1146 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1147 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1148 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1149 .vctl_timeout_us = 50,
1150 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1151 .modes = msm_spm_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001152 },
1153};
1154
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001155static void __init apq8064_init_buses(void)
1156{
1157 msm_bus_rpm_set_mt_mask();
1158 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
1159 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
1160 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
1161 msm_bus_8064_apps_fabric.dev.platform_data =
1162 &msm_bus_8064_apps_fabric_pdata;
1163 msm_bus_8064_sys_fabric.dev.platform_data =
1164 &msm_bus_8064_sys_fabric_pdata;
1165 msm_bus_8064_mm_fabric.dev.platform_data =
1166 &msm_bus_8064_mm_fabric_pdata;
1167 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
1168 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
1169}
1170
David Collinsf0d00732012-01-25 15:46:50 -08001171static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
1172 .name = GPIO_REGULATOR_DEV_NAME,
1173 .id = PM8921_MPP_PM_TO_SYS(7),
1174 .dev = {
1175 .platform_data
1176 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
1177 },
1178};
1179
1180static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
1181 .name = GPIO_REGULATOR_DEV_NAME,
1182 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
1183 .dev = {
1184 .platform_data =
1185 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
1186 },
1187};
1188
David Collins390fc332012-02-07 14:38:16 -08001189static struct platform_device apq8064_device_ext_ts_sw_vreg __devinitdata = {
1190 .name = GPIO_REGULATOR_DEV_NAME,
1191 .id = PM8921_GPIO_PM_TO_SYS(23),
1192 .dev = {
1193 .platform_data
1194 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_TS_SW],
1195 },
1196};
1197
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001198static struct platform_device *common_devices[] __initdata = {
Jin Hong01f2dbb2011-11-03 22:13:51 -07001199 &apq8064_device_dmov,
Jing Lin04601f92012-02-05 15:36:07 -08001200 &apq8064_device_qup_i2c_gsbi3,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001201 &apq8064_device_qup_i2c_gsbi4,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001202 &apq8064_device_qup_spi_gsbi5,
David Collinsf0d00732012-01-25 15:46:50 -08001203 &apq8064_device_ext_5v_vreg,
1204 &apq8064_device_ext_3p3v_vreg,
David Collins390fc332012-02-07 14:38:16 -08001205 &apq8064_device_ext_ts_sw_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07001206 &apq8064_device_ssbi_pmic1,
1207 &apq8064_device_ssbi_pmic2,
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001208 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07001209 &apq8064_device_otg,
1210 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08001211 &apq8064_device_hsusb_host,
Hemant Kumara945b472012-01-25 15:08:06 -08001212 &apq8064_device_hsic_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07001213 &android_usb_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001214#ifdef CONFIG_ANDROID_PMEM
1215#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -07001216 &android_pmem_device,
1217 &android_pmem_adsp_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001218#endif
Kevin Chan13be4e22011-10-20 11:30:32 -07001219 &android_pmem_audio_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001220#endif
1221#ifdef CONFIG_ION_MSM
1222 &ion_dev,
1223#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001224 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001225 &msm8064_device_saw_regulator_core0,
1226 &msm8064_device_saw_regulator_core1,
1227 &msm8064_device_saw_regulator_core2,
1228 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001229#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1230 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1231 &qcrypto_device,
1232#endif
1233
1234#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1235 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1236 &qcedev_device,
1237#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07001238
1239#ifdef CONFIG_HW_RANDOM_MSM
1240 &apq8064_device_rng,
1241#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08001242 &apq_pcm,
1243 &apq_pcm_routing,
1244 &apq_cpudai0,
1245 &apq_cpudai1,
1246 &apq_cpudai_hdmi_rx,
1247 &apq_cpudai_bt_rx,
1248 &apq_cpudai_bt_tx,
1249 &apq_cpudai_fm_rx,
1250 &apq_cpudai_fm_tx,
1251 &apq_cpu_fe,
1252 &apq_stub_codec,
1253 &apq_voice,
1254 &apq_voip,
1255 &apq_lpa_pcm,
1256 &apq_pcm_hostless,
1257 &apq_cpudai_afe_01_rx,
1258 &apq_cpudai_afe_01_tx,
1259 &apq_cpudai_afe_02_rx,
1260 &apq_cpudai_afe_02_tx,
1261 &apq_pcm_afe,
1262 &apq_cpudai_auxpcm_rx,
1263 &apq_cpudai_auxpcm_tx,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001264 &apq8064_rpm_device,
1265 &apq8064_rpm_log_device,
1266 &apq8064_rpm_stat_device,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001267 &msm_bus_8064_apps_fabric,
1268 &msm_bus_8064_sys_fabric,
1269 &msm_bus_8064_mm_fabric,
1270 &msm_bus_8064_sys_fpb,
1271 &msm_bus_8064_cpss_fpb,
Rajesh Sastrulaaee8af32012-01-20 11:46:31 -08001272 &msm_device_vidc,
Matt Wagantalled832652012-02-02 19:23:17 -08001273 &msm_8960_riva,
Matt Wagantallb94b9a52012-02-02 21:59:54 -08001274 &msm_8960_q6_lpass,
Matt Wagantall292aace2012-01-26 19:12:34 -08001275 &msm_gss,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001276};
1277
Joel King4e7ad222011-08-17 15:47:38 -07001278static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001279 &apq8064_device_uart_gsbi3,
Yan He06913ce2011-08-26 16:33:46 -07001280 &msm_device_sps_apq8064,
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001281};
1282
1283static struct platform_device *rumi3_devices[] __initdata = {
1284 &apq8064_device_uart_gsbi1,
Yan He435ed612011-11-23 17:34:59 -08001285 &msm_device_sps_apq8064,
Huaibin Yang4a084e32011-12-15 15:25:52 -08001286#ifdef CONFIG_MSM_ROTATOR
1287 &msm_rotator_device,
1288#endif
Joel King4e7ad222011-08-17 15:47:38 -07001289};
1290
Joel King82b7e3f2012-01-05 10:03:27 -08001291static struct platform_device *cdp_devices[] __initdata = {
1292 &apq8064_device_uart_gsbi1,
Jin Hong4bbbfba2012-02-02 21:48:07 -08001293 &apq8064_device_uart_gsbi7,
Joel King82b7e3f2012-01-05 10:03:27 -08001294 &msm_device_sps_apq8064,
1295};
1296
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001297static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08001298 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001299};
1300
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001301#define KS8851_IRQ_GPIO 43
1302
1303static struct spi_board_info spi_board_info[] __initdata = {
1304 {
1305 .modalias = "ks8851",
1306 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1307 .max_speed_hz = 19200000,
1308 .bus_num = 0,
1309 .chip_select = 2,
1310 .mode = SPI_MODE_0,
1311 },
1312};
1313
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001314static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001315 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001316 .bus_num = 1,
1317 .slim_slave = &apq8064_slim_tabla,
1318 },
1319 {
1320 .bus_num = 1,
1321 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001322 },
1323 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001324};
1325
Jing Lin04601f92012-02-05 15:36:07 -08001326static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi3_pdata = {
1327 .clk_freq = 100000,
1328 .src_clk_rate = 24000000,
1329};
1330
Kenneth Heitke748593a2011-07-15 15:45:11 -06001331static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
1332 .clk_freq = 100000,
1333 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001334};
1335
1336static void __init apq8064_i2c_init(void)
1337{
Jing Lin04601f92012-02-05 15:36:07 -08001338 apq8064_device_qup_i2c_gsbi3.dev.platform_data =
1339 &apq8064_i2c_qup_gsbi3_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06001340 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
1341 &apq8064_i2c_qup_gsbi4_pdata;
1342}
1343
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08001344#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001345static int ethernet_init(void)
1346{
1347 int ret;
1348 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
1349 if (ret) {
1350 pr_err("ks8851 gpio_request failed: %d\n", ret);
1351 goto fail;
1352 }
1353
1354 return 0;
1355fail:
1356 return ret;
1357}
1358#else
1359static int ethernet_init(void)
1360{
1361 return 0;
1362}
1363#endif
1364
Tianyi Gou41515e22011-09-01 19:37:43 -07001365static void __init apq8064_clock_init(void)
1366{
Tianyi Gouacb588d2012-01-27 18:24:05 -08001367 if (machine_is_apq8064_rumi3())
Tianyi Gou41515e22011-09-01 19:37:43 -07001368 msm_clock_init(&apq8064_dummy_clock_init_data);
Tianyi Gouacb588d2012-01-27 18:24:05 -08001369 else
1370 msm_clock_init(&apq8064_clock_init_data);
Tianyi Gou41515e22011-09-01 19:37:43 -07001371}
1372
Jing Lin417fa452012-02-05 14:31:06 -08001373#define I2C_SURF 1
1374#define I2C_FFA (1 << 1)
1375#define I2C_RUMI (1 << 2)
1376#define I2C_SIM (1 << 3)
1377#define I2C_LIQUID (1 << 4)
1378
1379struct i2c_registry {
1380 u8 machs;
1381 int bus;
1382 struct i2c_board_info *info;
1383 int len;
1384};
1385
1386static struct i2c_registry apq8064_i2c_devices[] __initdata = {
Jing Lin21ed4de2012-02-05 15:53:28 -08001387 {
1388 I2C_SURF | I2C_LIQUID,
1389 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
1390 mxt_device_info,
1391 ARRAY_SIZE(mxt_device_info),
1392 },
Jing Lin417fa452012-02-05 14:31:06 -08001393};
1394
1395static void __init register_i2c_devices(void)
1396{
1397 u8 mach_mask = 0;
1398 int i;
1399
1400 /* Build the matching 'supported_machs' bitmask */
1401 if (machine_is_apq8064_cdp())
1402 mach_mask = I2C_SURF;
1403 else if (machine_is_apq8064_mtp())
1404 mach_mask = I2C_FFA;
1405 else if (machine_is_apq8064_liquid())
1406 mach_mask = I2C_LIQUID;
1407 else if (machine_is_apq8064_rumi3())
1408 mach_mask = I2C_RUMI;
1409 else if (machine_is_apq8064_sim())
1410 mach_mask = I2C_SIM;
1411 else
1412 pr_err("unmatched machine ID in register_i2c_devices\n");
1413
1414 /* Run the array and install devices as appropriate */
1415 for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) {
1416 if (apq8064_i2c_devices[i].machs & mach_mask)
1417 i2c_register_board_info(apq8064_i2c_devices[i].bus,
1418 apq8064_i2c_devices[i].info,
1419 apq8064_i2c_devices[i].len);
1420 }
1421}
1422
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001423static void __init apq8064_common_init(void)
1424{
1425 if (socinfo_init() < 0)
1426 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06001427 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
1428 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Tianyi Gou41515e22011-09-01 19:37:43 -07001429 apq8064_clock_init();
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08001430 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06001431 apq8064_i2c_init();
Jing Lin417fa452012-02-05 14:31:06 -08001432 register_i2c_devices();
Kenneth Heitke36920d32011-07-20 16:44:30 -06001433
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001434 apq8064_device_qup_spi_gsbi5.dev.platform_data =
1435 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08001436 apq8064_init_pmic();
Hemant Kumar94e7da22012-02-03 16:52:29 -08001437 if (machine_is_apq8064_liquid())
1438 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001439 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Hemant Kumara945b472012-01-25 15:08:06 -08001440 apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001441 apq8064_init_buses();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001442 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Jay Chokshie8741282012-01-25 15:22:55 -08001443 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05301444 apq8064_init_mmc();
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08001445
1446 if (machine_is_apq8064_mtp()) {
1447 mdm_8064_device.dev.platform_data = &mdm_platform_data;
1448 platform_device_register(&mdm_8064_device);
1449 }
1450 platform_device_register(&apq8064_slim_ctrl);
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001451 slim_register_board_info(apq8064_slim_devices,
1452 ARRAY_SIZE(apq8064_slim_devices));
Praveen Chidambaram78499012011-11-01 17:15:17 -06001453 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Mahesh Sivasubramaniancbce1ec2012-01-24 10:32:44 -07001454 acpuclk_init(&acpuclk_8064_soc_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06001455 msm_spm_l2_init(msm_spm_l2_data);
1456 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
1457 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
1458 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
1459 msm_pm_data);
1460 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001461}
1462
Huaibin Yang4a084e32011-12-15 15:25:52 -08001463static void __init apq8064_allocate_memory_regions(void)
1464{
1465 apq8064_allocate_fb_region();
1466}
1467
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001468static void __init apq8064_sim_init(void)
1469{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001470 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
1471 &msm8064_device_watchdog.dev.platform_data;
1472
1473 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001474 apq8064_common_init();
Joel King4e7ad222011-08-17 15:47:38 -07001475 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
1476}
1477
1478static void __init apq8064_rumi3_init(void)
1479{
1480 apq8064_common_init();
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001481 ethernet_init();
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001482 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001483 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Huaibin Yang4a084e32011-12-15 15:25:52 -08001484 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07001485 apq8064_init_gpu();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001486}
1487
Joel King82b7e3f2012-01-05 10:03:27 -08001488static void __init apq8064_cdp_init(void)
1489{
1490 apq8064_common_init();
1491 ethernet_init();
1492 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
1493 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Jordan Crouseb3115fe2012-02-01 22:11:12 -07001494 apq8064_init_gpu();
Matt Wagantallef3cfe542012-02-04 19:01:08 -08001495 platform_add_devices(msm_footswitch_devices,
1496 msm_num_footswitch_devices);
Joel King82b7e3f2012-01-05 10:03:27 -08001497}
1498
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001499MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
1500 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07001501 .reserve = apq8064_reserve,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001502 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05301503 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001504 .timer = &msm_timer,
1505 .init_machine = apq8064_sim_init,
1506MACHINE_END
1507
Joel King4e7ad222011-08-17 15:47:38 -07001508MACHINE_START(APQ8064_RUMI3, "QCT APQ8064 RUMI3")
1509 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07001510 .reserve = apq8064_reserve,
Joel King4e7ad222011-08-17 15:47:38 -07001511 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05301512 .handle_irq = gic_handle_irq,
Joel King4e7ad222011-08-17 15:47:38 -07001513 .timer = &msm_timer,
1514 .init_machine = apq8064_rumi3_init,
Huaibin Yang4a084e32011-12-15 15:25:52 -08001515 .init_early = apq8064_allocate_memory_regions,
Joel King4e7ad222011-08-17 15:47:38 -07001516MACHINE_END
1517
Joel King82b7e3f2012-01-05 10:03:27 -08001518MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
1519 .map_io = apq8064_map_io,
1520 .reserve = apq8064_reserve,
1521 .init_irq = apq8064_init_irq,
1522 .handle_irq = gic_handle_irq,
1523 .timer = &msm_timer,
1524 .init_machine = apq8064_cdp_init,
1525MACHINE_END
1526
1527MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
1528 .map_io = apq8064_map_io,
1529 .reserve = apq8064_reserve,
1530 .init_irq = apq8064_init_irq,
1531 .handle_irq = gic_handle_irq,
1532 .timer = &msm_timer,
1533 .init_machine = apq8064_cdp_init,
1534MACHINE_END
1535
1536MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
1537 .map_io = apq8064_map_io,
1538 .reserve = apq8064_reserve,
1539 .init_irq = apq8064_init_irq,
1540 .handle_irq = gic_handle_irq,
1541 .timer = &msm_timer,
1542 .init_machine = apq8064_cdp_init,
1543MACHINE_END
1544