blob: 64b57dfc48f49e6b7ddd23a83891927f6760c237 [file] [log] [blame]
Manu Gautam5143b252012-01-05 19:25:23 -08001/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13#include <linux/kernel.h>
14#include <linux/platform_device.h>
15#include <linux/io.h>
16#include <linux/irq.h>
Kenneth Heitke748593a2011-07-15 15:45:11 -060017#include <linux/i2c.h>
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -060018#include <linux/slimbus/slimbus.h>
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -080019#include <linux/mfd/wcd9310/core.h>
20#include <linux/mfd/wcd9310/pdata.h>
Kenneth Heitke36920d32011-07-20 16:44:30 -060021#include <linux/msm_ssbi.h>
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -070022#include <linux/spi/spi.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070023#include <linux/dma-mapping.h>
24#include <linux/platform_data/qcom_crypto_device.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080025#include <linux/ion.h>
Jack Cheung46bfffa2012-01-19 15:26:24 -080026#include <linux/memory.h>
Jing Lin21ed4de2012-02-05 15:53:28 -080027#include <linux/i2c/atmel_mxt_ts.h>
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -080028#include <linux/cyttsp.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070029#include <asm/mach-types.h>
30#include <asm/mach/arch.h>
31#include <asm/hardware/gic.h>
Sahitya Tummala3586ed92011-08-03 09:13:23 +053032#include <asm/mach/mmc.h>
Ankit Verma6b7e2ba2012-01-26 15:48:54 -080033#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070034
35#include <mach/board.h>
36#include <mach/msm_iomap.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080037#include <mach/ion.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070038#include <linux/usb/msm_hsusb.h>
39#include <linux/usb/android.h>
40#include <mach/socinfo.h>
Harini Jayaramanc4c58692011-07-19 14:50:10 -060041#include <mach/msm_spi.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070042#include "timer.h"
43#include "devices.h"
Joel King4ebccc62011-07-22 09:43:22 -070044#include <mach/gpio.h>
45#include <mach/gpiomux.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060046#include <mach/rpm.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080047#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -070048#include <linux/android_pmem.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080049#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070050#include <mach/msm_memtypes.h>
51#include <linux/bootmem.h>
52#include <asm/setup.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070053#include <mach/dma.h>
Gagan Mac8a7a5d32011-11-11 16:43:06 -070054#include <mach/msm_bus_board.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060055#include <mach/cpuidle.h>
Joel Kingdacbc822012-01-25 13:30:57 -080056#include <mach/mdm2.h>
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -080057#include <linux/msm_tsens.h>
Joel King4ebccc62011-07-22 09:43:22 -070058
Jeff Ohlstein7e668552011-10-06 16:17:25 -070059#include "msm_watchdog.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080060#include "board-8064.h"
Vikram Mulukutlabc2e9572011-11-04 03:41:38 -070061#include "acpuclock.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060062#include "spm.h"
63#include "mpm.h"
64#include "rpm_resources.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080065#include "pm.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060066#include "pm-boot.h"
Rajesh Sastrulaaee8af32012-01-20 11:46:31 -080067#include "devices-msm8x60.h"
Jay Chokshiea67c622011-07-29 17:12:26 -070068
Olav Haugan7c6aa742012-01-16 16:47:37 -080069#define MSM_PMEM_ADSP_SIZE 0x7800000
Ben Romberger3ffcd812011-12-08 19:12:10 -080070#define MSM_PMEM_AUDIO_SIZE 0x2B4000
Olav Haugan7c6aa742012-01-16 16:47:37 -080071#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
72#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
73#else
74#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
75#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070076
Olav Haugan7c6aa742012-01-16 16:47:37 -080077#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Olav Hauganedcf6832012-01-24 08:35:41 -080078#define MSM_PMEM_KERNEL_EBI1_SIZE 0x280000
Olav Haugan7c6aa742012-01-16 16:47:37 -080079#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Haugand3d29682012-01-19 10:57:07 -080080#define MSM_ION_MM_FW_SIZE 0x200000 /* (2MB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -080081#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Hauganf45e2142012-01-19 11:01:01 -080082#define MSM_ION_QSECOM_SIZE 0x100000 /* (1MB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -080083#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan2c43fac2012-01-19 11:06:37 -080084#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
85#define MSM_ION_HEAP_NUM 8
Olav Haugan7c6aa742012-01-16 16:47:37 -080086#else
87#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
88#define MSM_ION_HEAP_NUM 1
89#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070090
Olav Haugan7c6aa742012-01-16 16:47:37 -080091#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
92static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
93static int __init pmem_kernel_ebi1_size_setup(char *p)
Kevin Chan13be4e22011-10-20 11:30:32 -070094{
Olav Haugan7c6aa742012-01-16 16:47:37 -080095 pmem_kernel_ebi1_size = memparse(p, NULL);
96 return 0;
Kevin Chan13be4e22011-10-20 11:30:32 -070097}
Olav Haugan7c6aa742012-01-16 16:47:37 -080098early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
99#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700100
Olav Haugan7c6aa742012-01-16 16:47:37 -0800101#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -0700102static unsigned pmem_size = MSM_PMEM_SIZE;
103static int __init pmem_size_setup(char *p)
104{
105 pmem_size = memparse(p, NULL);
106 return 0;
107}
108early_param("pmem_size", pmem_size_setup);
109
110static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
111
112static int __init pmem_adsp_size_setup(char *p)
113{
114 pmem_adsp_size = memparse(p, NULL);
115 return 0;
116}
117early_param("pmem_adsp_size", pmem_adsp_size_setup);
118
119static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
120
121static int __init pmem_audio_size_setup(char *p)
122{
123 pmem_audio_size = memparse(p, NULL);
124 return 0;
125}
126early_param("pmem_audio_size", pmem_audio_size_setup);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800127#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700128
Olav Haugan7c6aa742012-01-16 16:47:37 -0800129#ifdef CONFIG_ANDROID_PMEM
130#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700131static struct android_pmem_platform_data android_pmem_pdata = {
132 .name = "pmem",
133 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
134 .cached = 1,
135 .memory_type = MEMTYPE_EBI1,
136};
137
138static struct platform_device android_pmem_device = {
139 .name = "android_pmem",
140 .id = 0,
141 .dev = {.platform_data = &android_pmem_pdata},
142};
143
144static struct android_pmem_platform_data android_pmem_adsp_pdata = {
145 .name = "pmem_adsp",
146 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
147 .cached = 0,
148 .memory_type = MEMTYPE_EBI1,
149};
Kevin Chan13be4e22011-10-20 11:30:32 -0700150static struct platform_device android_pmem_adsp_device = {
151 .name = "android_pmem",
152 .id = 2,
153 .dev = { .platform_data = &android_pmem_adsp_pdata },
154};
Olav Haugan7c6aa742012-01-16 16:47:37 -0800155#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700156
157static struct android_pmem_platform_data android_pmem_audio_pdata = {
158 .name = "pmem_audio",
159 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
160 .cached = 0,
161 .memory_type = MEMTYPE_EBI1,
162};
163
164static struct platform_device android_pmem_audio_device = {
165 .name = "android_pmem",
166 .id = 4,
167 .dev = { .platform_data = &android_pmem_audio_pdata },
168};
Olav Haugan7c6aa742012-01-16 16:47:37 -0800169#endif
170
171static struct memtype_reserve apq8064_reserve_table[] __initdata = {
172 [MEMTYPE_SMI] = {
173 },
174 [MEMTYPE_EBI0] = {
175 .flags = MEMTYPE_FLAGS_1M_ALIGN,
176 },
177 [MEMTYPE_EBI1] = {
178 .flags = MEMTYPE_FLAGS_1M_ALIGN,
179 },
180};
Kevin Chan13be4e22011-10-20 11:30:32 -0700181
182static void __init size_pmem_devices(void)
183{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800184#ifdef CONFIG_ANDROID_PMEM
185#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700186 android_pmem_adsp_pdata.size = pmem_adsp_size;
187 android_pmem_pdata.size = pmem_size;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800188#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700189 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800190#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700191}
192
193static void __init reserve_memory_for(struct android_pmem_platform_data *p)
194{
195 apq8064_reserve_table[p->memory_type].size += p->size;
196}
197
Kevin Chan13be4e22011-10-20 11:30:32 -0700198static void __init reserve_pmem_memory(void)
199{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800200#ifdef CONFIG_ANDROID_PMEM
201#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700202 reserve_memory_for(&android_pmem_adsp_pdata);
203 reserve_memory_for(&android_pmem_pdata);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800204#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700205 reserve_memory_for(&android_pmem_audio_pdata);
206 apq8064_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800207#endif
208}
209
210static int apq8064_paddr_to_memtype(unsigned int paddr)
211{
212 return MEMTYPE_EBI1;
213}
214
215#ifdef CONFIG_ION_MSM
216#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
217static struct ion_cp_heap_pdata cp_mm_ion_pdata = {
218 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugand3d29682012-01-19 10:57:07 -0800219 .align = PAGE_SIZE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800220};
221
222static struct ion_cp_heap_pdata cp_mfc_ion_pdata = {
223 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugand3d29682012-01-19 10:57:07 -0800224 .align = PAGE_SIZE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800225};
226
227static struct ion_co_heap_pdata co_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800228 .adjacent_mem_id = INVALID_HEAP_ID,
229 .align = PAGE_SIZE,
230};
231
232static struct ion_co_heap_pdata fw_co_ion_pdata = {
233 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
234 .align = SZ_128K,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800235};
236#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800237
238/**
239 * These heaps are listed in the order they will be allocated. Due to
240 * video hardware restrictions and content protection the FW heap has to
241 * be allocated adjacent (below) the MM heap and the MFC heap has to be
242 * allocated after the MM heap to ensure MFC heap is not more than 256MB
243 * away from the base address of the FW heap.
244 * However, the order of FW heap and MM heap doesn't matter since these
245 * two heaps are taken care of by separate code to ensure they are adjacent
246 * to each other.
247 * Don't swap the order unless you know what you are doing!
248 */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800249static struct ion_platform_data ion_pdata = {
250 .nr = MSM_ION_HEAP_NUM,
251 .heaps = {
252 {
253 .id = ION_SYSTEM_HEAP_ID,
254 .type = ION_HEAP_TYPE_SYSTEM,
255 .name = ION_VMALLOC_HEAP_NAME,
256 },
257#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
258 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800259 .id = ION_CP_MM_HEAP_ID,
260 .type = ION_HEAP_TYPE_CP,
261 .name = ION_MM_HEAP_NAME,
262 .size = MSM_ION_MM_SIZE,
263 .memory_type = ION_EBI_TYPE,
264 .extra_data = (void *) &cp_mm_ion_pdata,
265 },
266 {
Olav Haugand3d29682012-01-19 10:57:07 -0800267 .id = ION_MM_FIRMWARE_HEAP_ID,
268 .type = ION_HEAP_TYPE_CARVEOUT,
269 .name = ION_MM_FIRMWARE_HEAP_NAME,
270 .size = MSM_ION_MM_FW_SIZE,
271 .memory_type = ION_EBI_TYPE,
272 .extra_data = (void *) &fw_co_ion_pdata,
273 },
274 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800275 .id = ION_CP_MFC_HEAP_ID,
276 .type = ION_HEAP_TYPE_CP,
277 .name = ION_MFC_HEAP_NAME,
278 .size = MSM_ION_MFC_SIZE,
279 .memory_type = ION_EBI_TYPE,
280 .extra_data = (void *) &cp_mfc_ion_pdata,
281 },
282 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800283 .id = ION_SF_HEAP_ID,
284 .type = ION_HEAP_TYPE_CARVEOUT,
285 .name = ION_SF_HEAP_NAME,
286 .size = MSM_ION_SF_SIZE,
287 .memory_type = ION_EBI_TYPE,
288 .extra_data = (void *) &co_ion_pdata,
289 },
290 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800291 .id = ION_IOMMU_HEAP_ID,
292 .type = ION_HEAP_TYPE_IOMMU,
293 .name = ION_IOMMU_HEAP_NAME,
294 },
Olav Hauganf45e2142012-01-19 11:01:01 -0800295 {
296 .id = ION_QSECOM_HEAP_ID,
297 .type = ION_HEAP_TYPE_CARVEOUT,
298 .name = ION_QSECOM_HEAP_NAME,
299 .size = MSM_ION_QSECOM_SIZE,
300 .memory_type = ION_EBI_TYPE,
301 .extra_data = (void *) &co_ion_pdata,
302 },
Olav Haugan2c43fac2012-01-19 11:06:37 -0800303 {
304 .id = ION_AUDIO_HEAP_ID,
305 .type = ION_HEAP_TYPE_CARVEOUT,
306 .name = ION_AUDIO_HEAP_NAME,
307 .size = MSM_ION_AUDIO_SIZE,
308 .memory_type = ION_EBI_TYPE,
309 .extra_data = (void *) &co_ion_pdata,
310 },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800311#endif
312 }
313};
314
315static struct platform_device ion_dev = {
316 .name = "ion-msm",
317 .id = 1,
318 .dev = { .platform_data = &ion_pdata },
319};
320#endif
321
322static void reserve_ion_memory(void)
323{
324#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
325 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_SIZE;
Olav Haugand3d29682012-01-19 10:57:07 -0800326 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_FW_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800327 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_SF_SIZE;
328 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MFC_SIZE;
Olav Hauganf45e2142012-01-19 11:01:01 -0800329 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_QSECOM_SIZE;
Olav Haugan2c43fac2012-01-19 11:06:37 -0800330 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_AUDIO_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800331#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700332}
333
Huaibin Yang4a084e32011-12-15 15:25:52 -0800334static void __init reserve_mdp_memory(void)
335{
336 apq8064_mdp_writeback(apq8064_reserve_table);
337}
338
Kevin Chan13be4e22011-10-20 11:30:32 -0700339static void __init apq8064_calculate_reserve_sizes(void)
340{
341 size_pmem_devices();
342 reserve_pmem_memory();
Olav Haugan7c6aa742012-01-16 16:47:37 -0800343 reserve_ion_memory();
Huaibin Yang4a084e32011-12-15 15:25:52 -0800344 reserve_mdp_memory();
Kevin Chan13be4e22011-10-20 11:30:32 -0700345}
346
347static struct reserve_info apq8064_reserve_info __initdata = {
348 .memtype_reserve_table = apq8064_reserve_table,
349 .calculate_reserve_sizes = apq8064_calculate_reserve_sizes,
350 .paddr_to_memtype = apq8064_paddr_to_memtype,
351};
352
353static int apq8064_memory_bank_size(void)
354{
355 return 1<<29;
356}
357
358static void __init locate_unstable_memory(void)
359{
360 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
361 unsigned long bank_size;
362 unsigned long low, high;
363
364 bank_size = apq8064_memory_bank_size();
365 low = meminfo.bank[0].start;
366 high = mb->start + mb->size;
Olav Haugand76e3a82012-01-16 16:55:07 -0800367
368 /* Check if 32 bit overflow occured */
369 if (high < mb->start)
370 high = ~0UL;
371
Kevin Chan13be4e22011-10-20 11:30:32 -0700372 low &= ~(bank_size - 1);
373
374 if (high - low <= bank_size)
375 return;
Jack Cheung46bfffa2012-01-19 15:26:24 -0800376 apq8064_reserve_info.low_unstable_address = mb->start -
377 MIN_MEMORY_BLOCK_SIZE + mb->size;
378 apq8064_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
379
Kevin Chan13be4e22011-10-20 11:30:32 -0700380 apq8064_reserve_info.bank_size = bank_size;
381 pr_info("low unstable address %lx max size %lx bank size %lx\n",
382 apq8064_reserve_info.low_unstable_address,
383 apq8064_reserve_info.max_unstable_size,
384 apq8064_reserve_info.bank_size);
385}
386
387static void __init apq8064_reserve(void)
388{
389 reserve_info = &apq8064_reserve_info;
390 locate_unstable_memory();
391 msm_reserve();
392}
393
Hemant Kumara945b472012-01-25 15:08:06 -0800394#ifdef CONFIG_USB_EHCI_MSM_HSIC
395static struct msm_hsic_host_platform_data msm_hsic_pdata = {
396 .strobe = 88,
397 .data = 89,
398};
399#else
400static struct msm_hsic_host_platform_data msm_hsic_pdata;
401#endif
402
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800403#define PID_MAGIC_ID 0x71432909
404#define SERIAL_NUM_MAGIC_ID 0x61945374
405#define SERIAL_NUMBER_LENGTH 127
406#define DLOAD_USB_BASE_ADD 0x2A03F0C8
407
408struct magic_num_struct {
409 uint32_t pid;
410 uint32_t serial_num;
411};
412
413struct dload_struct {
414 uint32_t reserved1;
415 uint32_t reserved2;
416 uint32_t reserved3;
417 uint16_t reserved4;
418 uint16_t pid;
419 char serial_number[SERIAL_NUMBER_LENGTH];
420 uint16_t reserved5;
421 struct magic_num_struct magic_struct;
422};
423
424static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
425{
426 struct dload_struct __iomem *dload = 0;
427
428 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
429 if (!dload) {
430 pr_err("%s: cannot remap I/O memory region: %08x\n",
431 __func__, DLOAD_USB_BASE_ADD);
432 return -ENXIO;
433 }
434
435 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
436 __func__, dload, pid, snum);
437 /* update pid */
438 dload->magic_struct.pid = PID_MAGIC_ID;
439 dload->pid = pid;
440
441 /* update serial number */
442 dload->magic_struct.serial_num = 0;
443 if (!snum) {
444 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
445 goto out;
446 }
447
448 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
449 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
450out:
451 iounmap(dload);
452 return 0;
453}
454
455static struct android_usb_platform_data android_usb_pdata = {
456 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
457};
458
Hemant Kumar4933b072011-10-17 23:43:11 -0700459static struct platform_device android_usb_device = {
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800460 .name = "android_usb",
461 .id = -1,
462 .dev = {
463 .platform_data = &android_usb_pdata,
464 },
Hemant Kumar4933b072011-10-17 23:43:11 -0700465};
466
467static struct msm_otg_platform_data msm_otg_pdata = {
Hemant Kumard86c4882012-01-24 19:39:37 -0800468 .mode = USB_OTG,
469 .otg_control = OTG_PMIC_CONTROL,
Hemant Kumar4933b072011-10-17 23:43:11 -0700470 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Hemant Kumard86c4882012-01-24 19:39:37 -0800471 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
472 .power_budget = 750,
Hemant Kumar4933b072011-10-17 23:43:11 -0700473};
474
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800475#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
476
477/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
478 * 4 micbiases are used to power various analog and digital
479 * microphones operating at 1800 mV. Technically, all micbiases
480 * can source from single cfilter since all microphones operate
481 * at the same voltage level. The arrangement below is to make
482 * sure all cfilters are exercised. LDO_H regulator ouput level
483 * does not need to be as high as 2.85V. It is choosen for
484 * microphone sensitivity purpose.
485 */
486static struct tabla_pdata apq8064_tabla_platform_data = {
487 .slimbus_slave_device = {
488 .name = "tabla-slave",
489 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
490 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800491 .irq = MSM_GPIO_TO_INT(42),
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800492 .irq_base = TABLA_INTERRUPT_BASE,
493 .num_irqs = NR_TABLA_IRQS,
494 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
495 .micbias = {
496 .ldoh_v = TABLA_LDOH_2P85_V,
497 .cfilt1_mv = 1800,
498 .cfilt2_mv = 1800,
499 .cfilt3_mv = 1800,
500 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
501 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
502 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
503 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
504 }
505};
506
507static struct slim_device apq8064_slim_tabla = {
508 .name = "tabla-slim",
509 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
510 .dev = {
511 .platform_data = &apq8064_tabla_platform_data,
512 },
513};
514
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800515static struct tabla_pdata apq8064_tabla20_platform_data = {
516 .slimbus_slave_device = {
517 .name = "tabla-slave",
518 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
519 },
520 .irq = MSM_GPIO_TO_INT(42),
521 .irq_base = TABLA_INTERRUPT_BASE,
522 .num_irqs = NR_TABLA_IRQS,
523 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
524 .micbias = {
525 .ldoh_v = TABLA_LDOH_2P85_V,
526 .cfilt1_mv = 1800,
527 .cfilt2_mv = 1800,
528 .cfilt3_mv = 1800,
529 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
530 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
531 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
532 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
533 }
534};
535
536static struct slim_device apq8064_slim_tabla20 = {
537 .name = "tabla2x-slim",
538 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
539 .dev = {
540 .platform_data = &apq8064_tabla20_platform_data,
541 },
542};
543
Jing Lin21ed4de2012-02-05 15:53:28 -0800544/* configuration data for mxt1386e using V2.1 firmware */
545static const u8 mxt1386e_config_data_v2_1[] = {
546 /* T6 Object */
547 0, 0, 0, 0, 0, 0,
548 /* T38 Object */
549 14, 0, 0, 24, 1, 12, 0, 0, 0, 0,
550 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
551 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
552 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
553 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
554 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
555 0, 0, 0, 0,
556 /* T7 Object */
557 100, 16, 50,
558 /* T8 Object */
559 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
560 /* T9 Object */
561 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
562 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
563 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
564 10, 5, 0, 0, 0,
565 /* T18 Object */
566 0, 0,
567 /* T24 Object */
568 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
569 0, 0, 0, 0, 0, 0, 0, 0, 0,
570 /* T25 Object */
571 3, 0, 60, 115, 156, 99,
572 /* T27 Object */
573 0, 0, 0, 0, 0, 0, 0,
574 /* T40 Object */
575 0, 0, 0, 0, 0,
576 /* T42 Object */
577 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
578 /* T43 Object */
579 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
580 16,
581 /* T46 Object */
582 64, 0, 20, 20, 0, 0, 0, 0, 0,
583 /* T47 Object */
584 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
585 /* T48 Object */
586 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
587 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
588 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
589 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
590 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
591 0, 0, 0, 0,
592 /* T56 Object */
593 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
594 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
595 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
596 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
597 2, 99, 33, 0, 149, 24, 193, 255, 255, 255,
598 255,
599};
600
601#define MXT_TS_GPIO_IRQ 6
602#define MXT_TS_PWR_EN_GPIO PM8921_GPIO_PM_TO_SYS(23)
603#define MXT_TS_RESET_GPIO 33
604
605static struct mxt_config_info mxt_config_array[] = {
606 {
607 .config = mxt1386e_config_data_v2_1,
608 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
609 .family_id = 0xA0,
610 .variant_id = 0x7,
611 .version = 0x21,
612 .build = 0xAA,
613 },
614};
615
616static struct mxt_platform_data mxt_platform_data = {
617 .config_array = mxt_config_array,
618 .config_array_size = ARRAY_SIZE(mxt_config_array),
619 .x_size = 1365,
620 .y_size = 767,
621 .irqflags = IRQF_TRIGGER_FALLING,
622 .i2c_pull_up = true,
623 .reset_gpio = MXT_TS_RESET_GPIO,
624 .irq_gpio = MXT_TS_GPIO_IRQ,
625};
626
627static struct i2c_board_info mxt_device_info[] __initdata = {
628 {
629 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
630 .platform_data = &mxt_platform_data,
631 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
632 },
633};
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -0800634#define CYTTSP_TS_GPIO_IRQ 6
635#define CYTTSP_TS_GPIO_RESOUT 7
636#define CYTTSP_TS_GPIO_SLEEP 33
637
638static ssize_t tma340_vkeys_show(struct kobject *kobj,
639 struct kobj_attribute *attr, char *buf)
640{
641 return snprintf(buf, 200,
642 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
643 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
644 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
645 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
646 "\n");
647}
648
649static struct kobj_attribute tma340_vkeys_attr = {
650 .attr = {
651 .mode = S_IRUGO,
652 },
653 .show = &tma340_vkeys_show,
654};
655
656static struct attribute *tma340_properties_attrs[] = {
657 &tma340_vkeys_attr.attr,
658 NULL
659};
660
661static struct attribute_group tma340_properties_attr_group = {
662 .attrs = tma340_properties_attrs,
663};
664
665static int cyttsp_platform_init(struct i2c_client *client)
666{
667 int rc = 0;
668 static struct kobject *tma340_properties_kobj;
669
670 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
671 tma340_properties_kobj = kobject_create_and_add("board_properties",
672 NULL);
673 if (tma340_properties_kobj)
674 rc = sysfs_create_group(tma340_properties_kobj,
675 &tma340_properties_attr_group);
676 if (!tma340_properties_kobj || rc)
677 pr_err("%s: failed to create board_properties\n",
678 __func__);
679
680 return 0;
681}
682
683static struct cyttsp_regulator cyttsp_regulator_data[] = {
684 {
685 .name = "vdd",
686 .min_uV = CY_TMA300_VTG_MIN_UV,
687 .max_uV = CY_TMA300_VTG_MAX_UV,
688 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
689 .lpm_load_uA = CY_TMA300_CURR_24HZ_UA,
690 },
691 {
692 .name = "vcc_i2c",
693 .min_uV = CY_I2C_VTG_MIN_UV,
694 .max_uV = CY_I2C_VTG_MAX_UV,
695 .hpm_load_uA = CY_I2C_CURR_UA,
696 .lpm_load_uA = CY_I2C_CURR_UA,
697 },
698};
699
700static struct cyttsp_platform_data cyttsp_pdata = {
701 .panel_maxx = 634,
702 .panel_maxy = 1166,
703 .disp_maxx = 599,
704 .disp_maxy = 1023,
705 .disp_minx = 0,
706 .disp_miny = 0,
707 .flags = 0x01,
708 .gen = CY_GEN3,
709 .use_st = CY_USE_ST,
710 .use_mt = CY_USE_MT,
711 .use_hndshk = CY_SEND_HNDSHK,
712 .use_trk_id = CY_USE_TRACKING_ID,
713 .use_sleep = CY_USE_DEEP_SLEEP_SEL,
714 .use_gestures = CY_USE_GESTURES,
715 .fw_fname = "cyttsp_8064_mtp.hex",
716 /* change act_intrvl to customize the Active power state
717 * scanning/processing refresh interval for Operating mode
718 */
719 .act_intrvl = CY_ACT_INTRVL_DFLT,
720 /* change tch_tmout to customize the touch timeout for the
721 * Active power state for Operating mode
722 */
723 .tch_tmout = CY_TCH_TMOUT_DFLT,
724 /* change lp_intrvl to customize the Low Power power state
725 * scanning/processing refresh interval for Operating mode
726 */
727 .lp_intrvl = CY_LP_INTRVL_DFLT,
728 .sleep_gpio = CYTTSP_TS_GPIO_SLEEP,
729 .resout_gpio = CYTTSP_TS_GPIO_RESOUT,
730 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
731 .regulator_info = cyttsp_regulator_data,
732 .num_regulators = ARRAY_SIZE(cyttsp_regulator_data),
733 .init = cyttsp_platform_init,
734 .correct_fw_ver = 17,
735};
736
737static struct i2c_board_info cyttsp_info[] __initdata = {
738 {
739 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
740 .platform_data = &cyttsp_pdata,
741 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
742 },
743};
Jing Lin21ed4de2012-02-05 15:53:28 -0800744
Ankit Verma6b7e2ba2012-01-26 15:48:54 -0800745#define MSM_WCNSS_PHYS 0x03000000
746#define MSM_WCNSS_SIZE 0x280000
747
748static struct resource resources_wcnss_wlan[] = {
749 {
750 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
751 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
752 .name = "wcnss_wlanrx_irq",
753 .flags = IORESOURCE_IRQ,
754 },
755 {
756 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
757 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
758 .name = "wcnss_wlantx_irq",
759 .flags = IORESOURCE_IRQ,
760 },
761 {
762 .start = MSM_WCNSS_PHYS,
763 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
764 .name = "wcnss_mmio",
765 .flags = IORESOURCE_MEM,
766 },
767 {
768 .start = 64,
769 .end = 68,
770 .name = "wcnss_gpios_5wire",
771 .flags = IORESOURCE_IO,
772 },
773};
774
775static struct qcom_wcnss_opts qcom_wcnss_pdata = {
776 .has_48mhz_xo = 1,
777};
778
779static struct platform_device msm_device_wcnss_wlan = {
780 .name = "wcnss_wlan",
781 .id = 0,
782 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
783 .resource = resources_wcnss_wlan,
784 .dev = {.platform_data = &qcom_wcnss_pdata},
785};
786
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700787#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
788 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
789 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
790 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
791
792#define QCE_SIZE 0x10000
793#define QCE_0_BASE 0x11000000
794
795#define QCE_HW_KEY_SUPPORT 0
796#define QCE_SHA_HMAC_SUPPORT 1
797#define QCE_SHARE_CE_RESOURCE 3
798#define QCE_CE_SHARED 0
799
800static struct resource qcrypto_resources[] = {
801 [0] = {
802 .start = QCE_0_BASE,
803 .end = QCE_0_BASE + QCE_SIZE - 1,
804 .flags = IORESOURCE_MEM,
805 },
806 [1] = {
807 .name = "crypto_channels",
808 .start = DMOV8064_CE_IN_CHAN,
809 .end = DMOV8064_CE_OUT_CHAN,
810 .flags = IORESOURCE_DMA,
811 },
812 [2] = {
813 .name = "crypto_crci_in",
814 .start = DMOV8064_CE_IN_CRCI,
815 .end = DMOV8064_CE_IN_CRCI,
816 .flags = IORESOURCE_DMA,
817 },
818 [3] = {
819 .name = "crypto_crci_out",
820 .start = DMOV8064_CE_OUT_CRCI,
821 .end = DMOV8064_CE_OUT_CRCI,
822 .flags = IORESOURCE_DMA,
823 },
824};
825
826static struct resource qcedev_resources[] = {
827 [0] = {
828 .start = QCE_0_BASE,
829 .end = QCE_0_BASE + QCE_SIZE - 1,
830 .flags = IORESOURCE_MEM,
831 },
832 [1] = {
833 .name = "crypto_channels",
834 .start = DMOV8064_CE_IN_CHAN,
835 .end = DMOV8064_CE_OUT_CHAN,
836 .flags = IORESOURCE_DMA,
837 },
838 [2] = {
839 .name = "crypto_crci_in",
840 .start = DMOV8064_CE_IN_CRCI,
841 .end = DMOV8064_CE_IN_CRCI,
842 .flags = IORESOURCE_DMA,
843 },
844 [3] = {
845 .name = "crypto_crci_out",
846 .start = DMOV8064_CE_OUT_CRCI,
847 .end = DMOV8064_CE_OUT_CRCI,
848 .flags = IORESOURCE_DMA,
849 },
850};
851
852#endif
853
854#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
855 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
856
857static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
858 .ce_shared = QCE_CE_SHARED,
859 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
860 .hw_key_support = QCE_HW_KEY_SUPPORT,
861 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800862 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700863};
864
865static struct platform_device qcrypto_device = {
866 .name = "qcrypto",
867 .id = 0,
868 .num_resources = ARRAY_SIZE(qcrypto_resources),
869 .resource = qcrypto_resources,
870 .dev = {
871 .coherent_dma_mask = DMA_BIT_MASK(32),
872 .platform_data = &qcrypto_ce_hw_suppport,
873 },
874};
875#endif
876
877#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
878 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
879
880static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
881 .ce_shared = QCE_CE_SHARED,
882 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
883 .hw_key_support = QCE_HW_KEY_SUPPORT,
884 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800885 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700886};
887
888static struct platform_device qcedev_device = {
889 .name = "qce",
890 .id = 0,
891 .num_resources = ARRAY_SIZE(qcedev_resources),
892 .resource = qcedev_resources,
893 .dev = {
894 .coherent_dma_mask = DMA_BIT_MASK(32),
895 .platform_data = &qcedev_ce_hw_suppport,
896 },
897};
898#endif
899
Joel Kingdacbc822012-01-25 13:30:57 -0800900static struct mdm_platform_data mdm_platform_data = {
901 .mdm_version = "3.0",
902 .ramdump_delay_ms = 2000,
Hemant Kumara945b472012-01-25 15:08:06 -0800903 .peripheral_platform_device = &apq8064_device_hsic_host,
Joel Kingdacbc822012-01-25 13:30:57 -0800904};
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700905
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -0800906static struct tsens_platform_data apq_tsens_pdata = {
907 .tsens_factor = 1000,
908 .hw_type = APQ_8064,
909 .tsens_num_sensor = 11,
910 .slope = {1176, 1176, 1154, 1176, 1111,
911 1132, 1132, 1199, 1132, 1199, 1132},
912};
913
Jeff Hugo0c0f5e92011-09-28 13:55:45 -0600914#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700915static void __init apq8064_map_io(void)
916{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -0600917 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700918 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -0700919 if (socinfo_init() < 0)
920 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700921}
922
923static void __init apq8064_init_irq(void)
924{
Praveen Chidambaram78499012011-11-01 17:15:17 -0600925 struct msm_mpm_device_data *data = NULL;
926
927#ifdef CONFIG_MSM_MPM
928 data = &apq8064_mpm_dev_data;
929#endif
930
931 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700932 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
933 (void *)MSM_QGIC_CPU_BASE);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700934}
935
Jay Chokshi7805b5a2011-11-07 15:55:30 -0800936static struct platform_device msm8064_device_saw_regulator_core0 = {
937 .name = "saw-regulator",
938 .id = 0,
939 .dev = {
940 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
941 },
942};
943
944static struct platform_device msm8064_device_saw_regulator_core1 = {
945 .name = "saw-regulator",
946 .id = 1,
947 .dev = {
948 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
949 },
950};
951
952static struct platform_device msm8064_device_saw_regulator_core2 = {
953 .name = "saw-regulator",
954 .id = 2,
955 .dev = {
956 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
957 },
958};
959
960static struct platform_device msm8064_device_saw_regulator_core3 = {
961 .name = "saw-regulator",
962 .id = 3,
963 .dev = {
964 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -0600965
966 },
967};
968
969static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
970 {
971 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
972 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
973 true,
974 100, 8000, 100000, 1,
975 },
976
977 {
978 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
979 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
980 true,
981 2000, 6000, 60100000, 3000,
982 },
983
984 {
985 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
986 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
987 false,
988 4200, 5000, 60350000, 3500,
989 },
990
991 {
992 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
993 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
994 false,
995 6300, 4500, 65350000, 4800,
996 },
997
998 {
999 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1000 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1001 false,
1002 11700, 2500, 67850000, 5500,
1003 },
1004
1005 {
1006 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1007 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1008 false,
1009 13800, 2000, 71850000, 6800,
1010 },
1011
1012 {
1013 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1014 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1015 false,
1016 29700, 500, 75850000, 8800,
1017 },
1018
1019 {
1020 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1021 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1022 false,
1023 29700, 0, 76350000, 9800,
1024 },
1025};
1026
1027static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1028 .mode = MSM_PM_BOOT_CONFIG_TZ,
1029};
1030
1031static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
1032 .levels = &msm_rpmrs_levels[0],
1033 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
1034 .vdd_mem_levels = {
1035 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
1036 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
1037 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
1038 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
1039 },
1040 .vdd_dig_levels = {
1041 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
1042 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
1043 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
1044 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
1045 },
1046 .vdd_mask = 0x7FFFFF,
1047 .rpmrs_target_id = {
1048 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
1049 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
1050 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
1051 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
1052 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
1053 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
1054 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
1055 },
1056};
1057
1058static struct msm_cpuidle_state msm_cstates[] __initdata = {
1059 {0, 0, "C0", "WFI",
1060 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1061
1062 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1063 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1064
1065 {0, 2, "C2", "POWER_COLLAPSE",
1066 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
1067
1068 {1, 0, "C0", "WFI",
1069 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1070
1071 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1072 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1073
1074 {2, 0, "C0", "WFI",
1075 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1076
1077 {2, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1078 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1079
1080 {3, 0, "C0", "WFI",
1081 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1082
1083 {3, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1084 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1085};
1086
1087static struct msm_pm_platform_data msm_pm_data[] = {
1088 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1089 .idle_supported = 1,
1090 .suspend_supported = 1,
1091 .idle_enabled = 0,
1092 .suspend_enabled = 0,
1093 },
1094
1095 [MSM_PM_MODE(0, 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(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1103 .idle_supported = 1,
1104 .suspend_supported = 1,
1105 .idle_enabled = 1,
1106 .suspend_enabled = 1,
1107 },
1108
1109 [MSM_PM_MODE(1, 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(1, 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(1, 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(2, 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(2, 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(2, 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 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1152 .idle_supported = 0,
1153 .suspend_supported = 1,
1154 .idle_enabled = 0,
1155 .suspend_enabled = 0,
1156 },
1157
1158 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1159 .idle_supported = 1,
1160 .suspend_supported = 1,
1161 .idle_enabled = 0,
1162 .suspend_enabled = 0,
1163 },
1164
1165 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1166 .idle_supported = 1,
1167 .suspend_supported = 0,
1168 .idle_enabled = 1,
1169 .suspend_enabled = 0,
1170 },
1171};
1172
1173static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1174 0x03, 0x0f,
1175};
1176
1177static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1178 0x00, 0x24, 0x54, 0x10,
1179 0x09, 0x03, 0x01,
1180 0x10, 0x54, 0x30, 0x0C,
1181 0x24, 0x30, 0x0f,
1182};
1183
1184static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1185 0x00, 0x24, 0x54, 0x10,
1186 0x09, 0x07, 0x01, 0x0B,
1187 0x10, 0x54, 0x30, 0x0C,
1188 0x24, 0x30, 0x0f,
1189};
1190
1191static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1192 [0] = {
1193 .mode = MSM_SPM_MODE_CLOCK_GATING,
1194 .notify_rpm = false,
1195 .cmd = spm_wfi_cmd_sequence,
1196 },
1197 [1] = {
1198 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1199 .notify_rpm = false,
1200 .cmd = spm_power_collapse_without_rpm,
1201 },
1202 [2] = {
1203 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1204 .notify_rpm = true,
1205 .cmd = spm_power_collapse_with_rpm,
1206 },
1207};
1208
1209static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1210 0x00, 0x20, 0x03, 0x20,
1211 0x00, 0x0f,
1212};
1213
1214static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1215 0x00, 0x20, 0x34, 0x64,
1216 0x48, 0x07, 0x48, 0x20,
1217 0x50, 0x64, 0x04, 0x34,
1218 0x50, 0x0f,
1219};
1220static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1221 0x00, 0x10, 0x34, 0x64,
1222 0x48, 0x07, 0x48, 0x10,
1223 0x50, 0x64, 0x04, 0x34,
1224 0x50, 0x0F,
1225};
1226
1227static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1228 [0] = {
1229 .mode = MSM_SPM_L2_MODE_RETENTION,
1230 .notify_rpm = false,
1231 .cmd = l2_spm_wfi_cmd_sequence,
1232 },
1233 [1] = {
1234 .mode = MSM_SPM_L2_MODE_GDHS,
1235 .notify_rpm = true,
1236 .cmd = l2_spm_gdhs_cmd_sequence,
1237 },
1238 [2] = {
1239 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1240 .notify_rpm = true,
1241 .cmd = l2_spm_power_off_cmd_sequence,
1242 },
1243};
1244
1245
1246static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1247 [0] = {
1248 .reg_base_addr = MSM_SAW_L2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001249 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
1250 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1251 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1252 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1253 .modes = msm_spm_l2_seq_list,
1254 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1255 },
1256};
1257
1258static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1259 [0] = {
1260 .reg_base_addr = MSM_SAW0_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001261 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001262#if defined(CONFIG_MSM_AVS_HW)
1263 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1264 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1265#endif
1266 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1267 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1268 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1269 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1270 .vctl_timeout_us = 50,
1271 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1272 .modes = msm_spm_seq_list,
1273 },
1274 [1] = {
1275 .reg_base_addr = MSM_SAW1_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001276 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001277#if defined(CONFIG_MSM_AVS_HW)
1278 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1279 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1280#endif
1281 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1282 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1283 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1284 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1285 .vctl_timeout_us = 50,
1286 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1287 .modes = msm_spm_seq_list,
1288 },
1289 [2] = {
1290 .reg_base_addr = MSM_SAW2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001291 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001292#if defined(CONFIG_MSM_AVS_HW)
1293 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1294 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1295#endif
1296 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1297 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1298 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1299 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1300 .vctl_timeout_us = 50,
1301 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1302 .modes = msm_spm_seq_list,
1303 },
1304 [3] = {
1305 .reg_base_addr = MSM_SAW3_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001306 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001307#if defined(CONFIG_MSM_AVS_HW)
1308 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1309 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1310#endif
1311 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1312 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1313 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1314 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1315 .vctl_timeout_us = 50,
1316 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1317 .modes = msm_spm_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001318 },
1319};
1320
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001321static void __init apq8064_init_buses(void)
1322{
1323 msm_bus_rpm_set_mt_mask();
1324 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
1325 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
1326 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
1327 msm_bus_8064_apps_fabric.dev.platform_data =
1328 &msm_bus_8064_apps_fabric_pdata;
1329 msm_bus_8064_sys_fabric.dev.platform_data =
1330 &msm_bus_8064_sys_fabric_pdata;
1331 msm_bus_8064_mm_fabric.dev.platform_data =
1332 &msm_bus_8064_mm_fabric_pdata;
1333 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
1334 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
1335}
1336
David Collinsf0d00732012-01-25 15:46:50 -08001337static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
1338 .name = GPIO_REGULATOR_DEV_NAME,
1339 .id = PM8921_MPP_PM_TO_SYS(7),
1340 .dev = {
1341 .platform_data
1342 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
1343 },
1344};
1345
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08001346static struct platform_device apq8064_device_ext_mpp8_vreg __devinitdata = {
1347 .name = GPIO_REGULATOR_DEV_NAME,
1348 .id = PM8921_MPP_PM_TO_SYS(8),
1349 .dev = {
1350 .platform_data
1351 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_MPP8],
1352 },
1353};
1354
David Collinsf0d00732012-01-25 15:46:50 -08001355static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
1356 .name = GPIO_REGULATOR_DEV_NAME,
1357 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
1358 .dev = {
1359 .platform_data =
1360 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
1361 },
1362};
1363
David Collins390fc332012-02-07 14:38:16 -08001364static struct platform_device apq8064_device_ext_ts_sw_vreg __devinitdata = {
1365 .name = GPIO_REGULATOR_DEV_NAME,
1366 .id = PM8921_GPIO_PM_TO_SYS(23),
1367 .dev = {
1368 .platform_data
1369 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_TS_SW],
1370 },
1371};
1372
David Collins2782b5c2012-02-06 10:02:42 -08001373static struct platform_device apq8064_device_rpm_regulator __devinitdata = {
1374 .name = "rpm-regulator",
1375 .id = -1,
1376 .dev = {
1377 .platform_data = &apq8064_rpm_regulator_pdata,
1378 },
1379};
1380
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001381static struct platform_device *common_devices[] __initdata = {
Jin Hong01f2dbb2011-11-03 22:13:51 -07001382 &apq8064_device_dmov,
Jing Lin04601f92012-02-05 15:36:07 -08001383 &apq8064_device_qup_i2c_gsbi3,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001384 &apq8064_device_qup_i2c_gsbi4,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001385 &apq8064_device_qup_spi_gsbi5,
David Collinsf0d00732012-01-25 15:46:50 -08001386 &apq8064_device_ext_5v_vreg,
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08001387 &apq8064_device_ext_mpp8_vreg,
David Collinsf0d00732012-01-25 15:46:50 -08001388 &apq8064_device_ext_3p3v_vreg,
David Collins390fc332012-02-07 14:38:16 -08001389 &apq8064_device_ext_ts_sw_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07001390 &apq8064_device_ssbi_pmic1,
1391 &apq8064_device_ssbi_pmic2,
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001392 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07001393 &apq8064_device_otg,
1394 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08001395 &apq8064_device_hsusb_host,
Hemant Kumara945b472012-01-25 15:08:06 -08001396 &apq8064_device_hsic_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07001397 &android_usb_device,
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001398 &msm_device_wcnss_wlan,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001399#ifdef CONFIG_ANDROID_PMEM
1400#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -07001401 &android_pmem_device,
1402 &android_pmem_adsp_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001403#endif
Kevin Chan13be4e22011-10-20 11:30:32 -07001404 &android_pmem_audio_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001405#endif
1406#ifdef CONFIG_ION_MSM
1407 &ion_dev,
1408#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001409 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001410 &msm8064_device_saw_regulator_core0,
1411 &msm8064_device_saw_regulator_core1,
1412 &msm8064_device_saw_regulator_core2,
1413 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001414#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1415 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1416 &qcrypto_device,
1417#endif
1418
1419#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1420 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1421 &qcedev_device,
1422#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07001423
1424#ifdef CONFIG_HW_RANDOM_MSM
1425 &apq8064_device_rng,
1426#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08001427 &apq_pcm,
1428 &apq_pcm_routing,
1429 &apq_cpudai0,
1430 &apq_cpudai1,
1431 &apq_cpudai_hdmi_rx,
1432 &apq_cpudai_bt_rx,
1433 &apq_cpudai_bt_tx,
1434 &apq_cpudai_fm_rx,
1435 &apq_cpudai_fm_tx,
1436 &apq_cpu_fe,
1437 &apq_stub_codec,
1438 &apq_voice,
1439 &apq_voip,
1440 &apq_lpa_pcm,
1441 &apq_pcm_hostless,
1442 &apq_cpudai_afe_01_rx,
1443 &apq_cpudai_afe_01_tx,
1444 &apq_cpudai_afe_02_rx,
1445 &apq_cpudai_afe_02_tx,
1446 &apq_pcm_afe,
1447 &apq_cpudai_auxpcm_rx,
1448 &apq_cpudai_auxpcm_tx,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001449 &apq8064_rpm_device,
1450 &apq8064_rpm_log_device,
1451 &apq8064_rpm_stat_device,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001452 &msm_bus_8064_apps_fabric,
1453 &msm_bus_8064_sys_fabric,
1454 &msm_bus_8064_mm_fabric,
1455 &msm_bus_8064_sys_fpb,
1456 &msm_bus_8064_cpss_fpb,
Mohan Kumar Gubbihalli Lachma Naik7f72edd2012-02-06 17:26:47 -08001457 &apq8064_msm_device_vidc,
Matt Wagantalled832652012-02-02 19:23:17 -08001458 &msm_8960_riva,
Matt Wagantallb94b9a52012-02-02 21:59:54 -08001459 &msm_8960_q6_lpass,
Matt Wagantall292aace2012-01-26 19:12:34 -08001460 &msm_gss,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001461};
1462
Joel King4e7ad222011-08-17 15:47:38 -07001463static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001464 &apq8064_device_uart_gsbi3,
Yan He06913ce2011-08-26 16:33:46 -07001465 &msm_device_sps_apq8064,
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001466};
1467
1468static struct platform_device *rumi3_devices[] __initdata = {
1469 &apq8064_device_uart_gsbi1,
Yan He435ed612011-11-23 17:34:59 -08001470 &msm_device_sps_apq8064,
Huaibin Yang4a084e32011-12-15 15:25:52 -08001471#ifdef CONFIG_MSM_ROTATOR
1472 &msm_rotator_device,
1473#endif
Joel King4e7ad222011-08-17 15:47:38 -07001474};
1475
Joel King82b7e3f2012-01-05 10:03:27 -08001476static struct platform_device *cdp_devices[] __initdata = {
1477 &apq8064_device_uart_gsbi1,
Jin Hong4bbbfba2012-02-02 21:48:07 -08001478 &apq8064_device_uart_gsbi7,
Joel King82b7e3f2012-01-05 10:03:27 -08001479 &msm_device_sps_apq8064,
1480};
1481
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001482static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08001483 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001484};
1485
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001486#define KS8851_IRQ_GPIO 43
1487
1488static struct spi_board_info spi_board_info[] __initdata = {
1489 {
1490 .modalias = "ks8851",
1491 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1492 .max_speed_hz = 19200000,
1493 .bus_num = 0,
1494 .chip_select = 2,
1495 .mode = SPI_MODE_0,
1496 },
1497};
1498
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001499static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001500 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001501 .bus_num = 1,
1502 .slim_slave = &apq8064_slim_tabla,
1503 },
1504 {
1505 .bus_num = 1,
1506 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001507 },
1508 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001509};
1510
Jing Lin04601f92012-02-05 15:36:07 -08001511static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi3_pdata = {
1512 .clk_freq = 100000,
1513 .src_clk_rate = 24000000,
1514};
1515
Kenneth Heitke748593a2011-07-15 15:45:11 -06001516static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
1517 .clk_freq = 100000,
1518 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001519};
1520
1521static void __init apq8064_i2c_init(void)
1522{
Jing Lin04601f92012-02-05 15:36:07 -08001523 apq8064_device_qup_i2c_gsbi3.dev.platform_data =
1524 &apq8064_i2c_qup_gsbi3_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06001525 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
1526 &apq8064_i2c_qup_gsbi4_pdata;
1527}
1528
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08001529#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001530static int ethernet_init(void)
1531{
1532 int ret;
1533 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
1534 if (ret) {
1535 pr_err("ks8851 gpio_request failed: %d\n", ret);
1536 goto fail;
1537 }
1538
1539 return 0;
1540fail:
1541 return ret;
1542}
1543#else
1544static int ethernet_init(void)
1545{
1546 return 0;
1547}
1548#endif
1549
Tianyi Gou41515e22011-09-01 19:37:43 -07001550static void __init apq8064_clock_init(void)
1551{
Tianyi Gouacb588d2012-01-27 18:24:05 -08001552 if (machine_is_apq8064_rumi3())
Tianyi Gou41515e22011-09-01 19:37:43 -07001553 msm_clock_init(&apq8064_dummy_clock_init_data);
Tianyi Gouacb588d2012-01-27 18:24:05 -08001554 else
1555 msm_clock_init(&apq8064_clock_init_data);
Tianyi Gou41515e22011-09-01 19:37:43 -07001556}
1557
Jing Lin417fa452012-02-05 14:31:06 -08001558#define I2C_SURF 1
1559#define I2C_FFA (1 << 1)
1560#define I2C_RUMI (1 << 2)
1561#define I2C_SIM (1 << 3)
1562#define I2C_LIQUID (1 << 4)
1563
1564struct i2c_registry {
1565 u8 machs;
1566 int bus;
1567 struct i2c_board_info *info;
1568 int len;
1569};
1570
1571static struct i2c_registry apq8064_i2c_devices[] __initdata = {
Jing Lin21ed4de2012-02-05 15:53:28 -08001572 {
1573 I2C_SURF | I2C_LIQUID,
1574 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
1575 mxt_device_info,
1576 ARRAY_SIZE(mxt_device_info),
1577 },
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001578 {
1579 I2C_FFA,
1580 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
1581 cyttsp_info,
1582 ARRAY_SIZE(cyttsp_info),
1583 },
Jing Lin417fa452012-02-05 14:31:06 -08001584};
1585
1586static void __init register_i2c_devices(void)
1587{
1588 u8 mach_mask = 0;
1589 int i;
1590
Kevin Chand07220e2012-02-13 15:52:22 -08001591#ifdef CONFIG_MSM_CAMERA
1592 struct i2c_registry apq8064_camera_i2c_devices = {
1593 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_RUMI,
1594 APQ_8064_GSBI4_QUP_I2C_BUS_ID,
1595 apq8064_camera_board_info.board_info,
1596 apq8064_camera_board_info.num_i2c_board_info,
1597 };
1598#endif
Jing Lin417fa452012-02-05 14:31:06 -08001599 /* Build the matching 'supported_machs' bitmask */
1600 if (machine_is_apq8064_cdp())
1601 mach_mask = I2C_SURF;
1602 else if (machine_is_apq8064_mtp())
1603 mach_mask = I2C_FFA;
1604 else if (machine_is_apq8064_liquid())
1605 mach_mask = I2C_LIQUID;
1606 else if (machine_is_apq8064_rumi3())
1607 mach_mask = I2C_RUMI;
1608 else if (machine_is_apq8064_sim())
1609 mach_mask = I2C_SIM;
1610 else
1611 pr_err("unmatched machine ID in register_i2c_devices\n");
1612
1613 /* Run the array and install devices as appropriate */
1614 for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) {
1615 if (apq8064_i2c_devices[i].machs & mach_mask)
1616 i2c_register_board_info(apq8064_i2c_devices[i].bus,
1617 apq8064_i2c_devices[i].info,
1618 apq8064_i2c_devices[i].len);
1619 }
Kevin Chand07220e2012-02-13 15:52:22 -08001620#ifdef CONFIG_MSM_CAMERA
1621 if (apq8064_camera_i2c_devices.machs & mach_mask)
1622 i2c_register_board_info(apq8064_camera_i2c_devices.bus,
1623 apq8064_camera_i2c_devices.info,
1624 apq8064_camera_i2c_devices.len);
1625#endif
Jing Lin417fa452012-02-05 14:31:06 -08001626}
1627
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001628static void __init apq8064_common_init(void)
1629{
1630 if (socinfo_init() < 0)
1631 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06001632 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
1633 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
David Collins2782b5c2012-02-06 10:02:42 -08001634 regulator_suppress_info_printing();
1635 platform_device_register(&apq8064_device_rpm_regulator);
Tianyi Gou41515e22011-09-01 19:37:43 -07001636 apq8064_clock_init();
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08001637 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06001638 apq8064_i2c_init();
Jing Lin417fa452012-02-05 14:31:06 -08001639 register_i2c_devices();
Kenneth Heitke36920d32011-07-20 16:44:30 -06001640
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001641 apq8064_device_qup_spi_gsbi5.dev.platform_data =
1642 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08001643 apq8064_init_pmic();
Hemant Kumar94e7da22012-02-03 16:52:29 -08001644 if (machine_is_apq8064_liquid())
1645 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001646 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Hemant Kumara945b472012-01-25 15:08:06 -08001647 apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001648 apq8064_init_buses();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001649 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Jay Chokshie8741282012-01-25 15:22:55 -08001650 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05301651 apq8064_init_mmc();
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08001652
1653 if (machine_is_apq8064_mtp()) {
1654 mdm_8064_device.dev.platform_data = &mdm_platform_data;
1655 platform_device_register(&mdm_8064_device);
1656 }
1657 platform_device_register(&apq8064_slim_ctrl);
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001658 slim_register_board_info(apq8064_slim_devices,
1659 ARRAY_SIZE(apq8064_slim_devices));
Praveen Chidambaram78499012011-11-01 17:15:17 -06001660 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Mahesh Sivasubramaniancbce1ec2012-01-24 10:32:44 -07001661 acpuclk_init(&acpuclk_8064_soc_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06001662 msm_spm_l2_init(msm_spm_l2_data);
1663 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
1664 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
1665 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
1666 msm_pm_data);
1667 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001668}
1669
Huaibin Yang4a084e32011-12-15 15:25:52 -08001670static void __init apq8064_allocate_memory_regions(void)
1671{
1672 apq8064_allocate_fb_region();
1673}
1674
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001675static void __init apq8064_sim_init(void)
1676{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001677 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
1678 &msm8064_device_watchdog.dev.platform_data;
1679
1680 wdog_pdata->bark_time = 15000;
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001681 msm_tsens_early_init(&apq_tsens_pdata);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001682 apq8064_common_init();
Joel King4e7ad222011-08-17 15:47:38 -07001683 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
1684}
1685
1686static void __init apq8064_rumi3_init(void)
1687{
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001688 msm_tsens_early_init(&apq_tsens_pdata);
Joel King4e7ad222011-08-17 15:47:38 -07001689 apq8064_common_init();
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001690 ethernet_init();
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001691 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001692 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Huaibin Yang4a084e32011-12-15 15:25:52 -08001693 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07001694 apq8064_init_gpu();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001695}
1696
Joel King82b7e3f2012-01-05 10:03:27 -08001697static void __init apq8064_cdp_init(void)
1698{
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001699 msm_tsens_early_init(&apq_tsens_pdata);
Joel King82b7e3f2012-01-05 10:03:27 -08001700 apq8064_common_init();
1701 ethernet_init();
1702 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
1703 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08001704 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07001705 apq8064_init_gpu();
Matt Wagantallef3cfe542012-02-04 19:01:08 -08001706 platform_add_devices(msm_footswitch_devices,
1707 msm_num_footswitch_devices);
Kevin Chand07220e2012-02-13 15:52:22 -08001708 apq8064_init_cam();
Joel King82b7e3f2012-01-05 10:03:27 -08001709}
1710
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001711MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
1712 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07001713 .reserve = apq8064_reserve,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001714 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05301715 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001716 .timer = &msm_timer,
1717 .init_machine = apq8064_sim_init,
1718MACHINE_END
1719
Joel King4e7ad222011-08-17 15:47:38 -07001720MACHINE_START(APQ8064_RUMI3, "QCT APQ8064 RUMI3")
1721 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07001722 .reserve = apq8064_reserve,
Joel King4e7ad222011-08-17 15:47:38 -07001723 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05301724 .handle_irq = gic_handle_irq,
Joel King4e7ad222011-08-17 15:47:38 -07001725 .timer = &msm_timer,
1726 .init_machine = apq8064_rumi3_init,
Huaibin Yang4a084e32011-12-15 15:25:52 -08001727 .init_early = apq8064_allocate_memory_regions,
Joel King4e7ad222011-08-17 15:47:38 -07001728MACHINE_END
1729
Joel King82b7e3f2012-01-05 10:03:27 -08001730MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
1731 .map_io = apq8064_map_io,
1732 .reserve = apq8064_reserve,
1733 .init_irq = apq8064_init_irq,
1734 .handle_irq = gic_handle_irq,
1735 .timer = &msm_timer,
1736 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08001737 .init_early = apq8064_allocate_memory_regions,
Joel King82b7e3f2012-01-05 10:03:27 -08001738MACHINE_END
1739
1740MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
1741 .map_io = apq8064_map_io,
1742 .reserve = apq8064_reserve,
1743 .init_irq = apq8064_init_irq,
1744 .handle_irq = gic_handle_irq,
1745 .timer = &msm_timer,
1746 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08001747 .init_early = apq8064_allocate_memory_regions,
Joel King82b7e3f2012-01-05 10:03:27 -08001748MACHINE_END
1749
1750MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
1751 .map_io = apq8064_map_io,
1752 .reserve = apq8064_reserve,
1753 .init_irq = apq8064_init_irq,
1754 .handle_irq = gic_handle_irq,
1755 .timer = &msm_timer,
1756 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08001757 .init_early = apq8064_allocate_memory_regions,
Joel King82b7e3f2012-01-05 10:03:27 -08001758MACHINE_END
1759