blob: f66c8a7e08d4ac24b22843ff63208aca6d1768a2 [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>
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +053019#include <linux/mfd/wcd9xxx/core.h>
20#include <linux/mfd/wcd9xxx/pdata.h>
Amy Maloche70090f992012-02-16 16:35:26 -080021#include <linux/mfd/pm8xxx/misc.h>
Kenneth Heitke36920d32011-07-20 16:44:30 -060022#include <linux/msm_ssbi.h>
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -070023#include <linux/spi/spi.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070024#include <linux/dma-mapping.h>
25#include <linux/platform_data/qcom_crypto_device.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080026#include <linux/ion.h>
Jack Cheung46bfffa2012-01-19 15:26:24 -080027#include <linux/memory.h>
Jing Lin21ed4de2012-02-05 15:53:28 -080028#include <linux/i2c/atmel_mxt_ts.h>
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -080029#include <linux/cyttsp.h>
Amy Maloche70090f992012-02-16 16:35:26 -080030#include <linux/i2c/isa1200.h>
Mohan Pallaka474b94b2012-01-25 12:59:58 +053031#include <linux/gpio_keys.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070032#include <asm/mach-types.h>
33#include <asm/mach/arch.h>
34#include <asm/hardware/gic.h>
Sahitya Tummala3586ed92011-08-03 09:13:23 +053035#include <asm/mach/mmc.h>
Ankit Verma6b7e2ba2012-01-26 15:48:54 -080036#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070037
38#include <mach/board.h>
39#include <mach/msm_iomap.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080040#include <mach/ion.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070041#include <linux/usb/msm_hsusb.h>
42#include <linux/usb/android.h>
43#include <mach/socinfo.h>
Harini Jayaramanc4c58692011-07-19 14:50:10 -060044#include <mach/msm_spi.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070045#include "timer.h"
46#include "devices.h"
Joel King4ebccc62011-07-22 09:43:22 -070047#include <mach/gpio.h>
48#include <mach/gpiomux.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060049#include <mach/rpm.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080050#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -070051#include <linux/android_pmem.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080052#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070053#include <mach/msm_memtypes.h>
54#include <linux/bootmem.h>
55#include <asm/setup.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070056#include <mach/dma.h>
Jin Hongd3024e62012-02-09 16:13:32 -080057#include <mach/msm_dsps.h>
Gagan Mac8a7a5d32011-11-11 16:43:06 -070058#include <mach/msm_bus_board.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060059#include <mach/cpuidle.h>
Joel Kingdacbc822012-01-25 13:30:57 -080060#include <mach/mdm2.h>
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -080061#include <linux/msm_tsens.h>
Stephen Boyd4d0d2582012-02-10 14:49:40 -080062#include <mach/msm_xo.h>
Joel King4ebccc62011-07-22 09:43:22 -070063
Jeff Ohlstein7e668552011-10-06 16:17:25 -070064#include "msm_watchdog.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080065#include "board-8064.h"
Vikram Mulukutlabc2e9572011-11-04 03:41:38 -070066#include "acpuclock.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060067#include "spm.h"
68#include "mpm.h"
69#include "rpm_resources.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080070#include "pm.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060071#include "pm-boot.h"
Rajesh Sastrulaaee8af32012-01-20 11:46:31 -080072#include "devices-msm8x60.h"
Jay Chokshiea67c622011-07-29 17:12:26 -070073
Olav Haugan7c6aa742012-01-16 16:47:37 -080074#define MSM_PMEM_ADSP_SIZE 0x7800000
Ben Romberger3ffcd812011-12-08 19:12:10 -080075#define MSM_PMEM_AUDIO_SIZE 0x2B4000
Olav Haugan7c6aa742012-01-16 16:47:37 -080076#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
77#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
78#else
Chetan Kalyan72aac4f2012-02-23 14:56:54 -080079#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Olav Haugan7c6aa742012-01-16 16:47:37 -080080#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070081
Olav Haugan7c6aa742012-01-16 16:47:37 -080082#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Olav Hauganedcf6832012-01-24 08:35:41 -080083#define MSM_PMEM_KERNEL_EBI1_SIZE 0x280000
Olav Haugan7c6aa742012-01-16 16:47:37 -080084#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Haugand3d29682012-01-19 10:57:07 -080085#define MSM_ION_MM_FW_SIZE 0x200000 /* (2MB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -080086#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Haugan3a9bd232012-02-15 14:23:27 -080087#define MSM_ION_QSECOM_SIZE 0x300000 /* (3MB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -080088#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan2c43fac2012-01-19 11:06:37 -080089#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
90#define MSM_ION_HEAP_NUM 8
Olav Haugan7c6aa742012-01-16 16:47:37 -080091#else
92#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
93#define MSM_ION_HEAP_NUM 1
94#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070095
Olav Haugan7c6aa742012-01-16 16:47:37 -080096#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
97static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
98static int __init pmem_kernel_ebi1_size_setup(char *p)
Kevin Chan13be4e22011-10-20 11:30:32 -070099{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800100 pmem_kernel_ebi1_size = memparse(p, NULL);
101 return 0;
Kevin Chan13be4e22011-10-20 11:30:32 -0700102}
Olav Haugan7c6aa742012-01-16 16:47:37 -0800103early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
104#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700105
Olav Haugan7c6aa742012-01-16 16:47:37 -0800106#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -0700107static unsigned pmem_size = MSM_PMEM_SIZE;
108static int __init pmem_size_setup(char *p)
109{
110 pmem_size = memparse(p, NULL);
111 return 0;
112}
113early_param("pmem_size", pmem_size_setup);
114
115static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
116
117static int __init pmem_adsp_size_setup(char *p)
118{
119 pmem_adsp_size = memparse(p, NULL);
120 return 0;
121}
122early_param("pmem_adsp_size", pmem_adsp_size_setup);
123
124static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
125
126static int __init pmem_audio_size_setup(char *p)
127{
128 pmem_audio_size = memparse(p, NULL);
129 return 0;
130}
131early_param("pmem_audio_size", pmem_audio_size_setup);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800132#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700133
Olav Haugan7c6aa742012-01-16 16:47:37 -0800134#ifdef CONFIG_ANDROID_PMEM
135#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700136static struct android_pmem_platform_data android_pmem_pdata = {
137 .name = "pmem",
138 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
139 .cached = 1,
140 .memory_type = MEMTYPE_EBI1,
141};
142
143static struct platform_device android_pmem_device = {
144 .name = "android_pmem",
145 .id = 0,
146 .dev = {.platform_data = &android_pmem_pdata},
147};
148
149static struct android_pmem_platform_data android_pmem_adsp_pdata = {
150 .name = "pmem_adsp",
151 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
152 .cached = 0,
153 .memory_type = MEMTYPE_EBI1,
154};
Kevin Chan13be4e22011-10-20 11:30:32 -0700155static struct platform_device android_pmem_adsp_device = {
156 .name = "android_pmem",
157 .id = 2,
158 .dev = { .platform_data = &android_pmem_adsp_pdata },
159};
Olav Haugan7c6aa742012-01-16 16:47:37 -0800160#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700161
162static struct android_pmem_platform_data android_pmem_audio_pdata = {
163 .name = "pmem_audio",
164 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
165 .cached = 0,
166 .memory_type = MEMTYPE_EBI1,
167};
168
169static struct platform_device android_pmem_audio_device = {
170 .name = "android_pmem",
171 .id = 4,
172 .dev = { .platform_data = &android_pmem_audio_pdata },
173};
Olav Haugan7c6aa742012-01-16 16:47:37 -0800174#endif
175
176static struct memtype_reserve apq8064_reserve_table[] __initdata = {
177 [MEMTYPE_SMI] = {
178 },
179 [MEMTYPE_EBI0] = {
180 .flags = MEMTYPE_FLAGS_1M_ALIGN,
181 },
182 [MEMTYPE_EBI1] = {
183 .flags = MEMTYPE_FLAGS_1M_ALIGN,
184 },
185};
Kevin Chan13be4e22011-10-20 11:30:32 -0700186
187static void __init size_pmem_devices(void)
188{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800189#ifdef CONFIG_ANDROID_PMEM
190#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700191 android_pmem_adsp_pdata.size = pmem_adsp_size;
192 android_pmem_pdata.size = pmem_size;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800193#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700194 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800195#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700196}
197
198static void __init reserve_memory_for(struct android_pmem_platform_data *p)
199{
200 apq8064_reserve_table[p->memory_type].size += p->size;
201}
202
Kevin Chan13be4e22011-10-20 11:30:32 -0700203static void __init reserve_pmem_memory(void)
204{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800205#ifdef CONFIG_ANDROID_PMEM
206#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700207 reserve_memory_for(&android_pmem_adsp_pdata);
208 reserve_memory_for(&android_pmem_pdata);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800209#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700210 reserve_memory_for(&android_pmem_audio_pdata);
211 apq8064_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800212#endif
213}
214
215static int apq8064_paddr_to_memtype(unsigned int paddr)
216{
217 return MEMTYPE_EBI1;
218}
219
220#ifdef CONFIG_ION_MSM
221#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
222static struct ion_cp_heap_pdata cp_mm_ion_pdata = {
223 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugand3d29682012-01-19 10:57:07 -0800224 .align = PAGE_SIZE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800225};
226
227static struct ion_cp_heap_pdata cp_mfc_ion_pdata = {
228 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugand3d29682012-01-19 10:57:07 -0800229 .align = PAGE_SIZE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800230};
231
232static struct ion_co_heap_pdata co_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800233 .adjacent_mem_id = INVALID_HEAP_ID,
234 .align = PAGE_SIZE,
235};
236
237static struct ion_co_heap_pdata fw_co_ion_pdata = {
238 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
239 .align = SZ_128K,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800240};
241#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800242
243/**
244 * These heaps are listed in the order they will be allocated. Due to
245 * video hardware restrictions and content protection the FW heap has to
246 * be allocated adjacent (below) the MM heap and the MFC heap has to be
247 * allocated after the MM heap to ensure MFC heap is not more than 256MB
248 * away from the base address of the FW heap.
249 * However, the order of FW heap and MM heap doesn't matter since these
250 * two heaps are taken care of by separate code to ensure they are adjacent
251 * to each other.
252 * Don't swap the order unless you know what you are doing!
253 */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800254static struct ion_platform_data ion_pdata = {
255 .nr = MSM_ION_HEAP_NUM,
256 .heaps = {
257 {
258 .id = ION_SYSTEM_HEAP_ID,
259 .type = ION_HEAP_TYPE_SYSTEM,
260 .name = ION_VMALLOC_HEAP_NAME,
261 },
262#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
263 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800264 .id = ION_CP_MM_HEAP_ID,
265 .type = ION_HEAP_TYPE_CP,
266 .name = ION_MM_HEAP_NAME,
267 .size = MSM_ION_MM_SIZE,
268 .memory_type = ION_EBI_TYPE,
269 .extra_data = (void *) &cp_mm_ion_pdata,
270 },
271 {
Olav Haugand3d29682012-01-19 10:57:07 -0800272 .id = ION_MM_FIRMWARE_HEAP_ID,
273 .type = ION_HEAP_TYPE_CARVEOUT,
274 .name = ION_MM_FIRMWARE_HEAP_NAME,
275 .size = MSM_ION_MM_FW_SIZE,
276 .memory_type = ION_EBI_TYPE,
277 .extra_data = (void *) &fw_co_ion_pdata,
278 },
279 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800280 .id = ION_CP_MFC_HEAP_ID,
281 .type = ION_HEAP_TYPE_CP,
282 .name = ION_MFC_HEAP_NAME,
283 .size = MSM_ION_MFC_SIZE,
284 .memory_type = ION_EBI_TYPE,
285 .extra_data = (void *) &cp_mfc_ion_pdata,
286 },
287 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800288 .id = ION_SF_HEAP_ID,
289 .type = ION_HEAP_TYPE_CARVEOUT,
290 .name = ION_SF_HEAP_NAME,
291 .size = MSM_ION_SF_SIZE,
292 .memory_type = ION_EBI_TYPE,
293 .extra_data = (void *) &co_ion_pdata,
294 },
295 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800296 .id = ION_IOMMU_HEAP_ID,
297 .type = ION_HEAP_TYPE_IOMMU,
298 .name = ION_IOMMU_HEAP_NAME,
299 },
Olav Hauganf45e2142012-01-19 11:01:01 -0800300 {
301 .id = ION_QSECOM_HEAP_ID,
302 .type = ION_HEAP_TYPE_CARVEOUT,
303 .name = ION_QSECOM_HEAP_NAME,
304 .size = MSM_ION_QSECOM_SIZE,
305 .memory_type = ION_EBI_TYPE,
306 .extra_data = (void *) &co_ion_pdata,
307 },
Olav Haugan2c43fac2012-01-19 11:06:37 -0800308 {
309 .id = ION_AUDIO_HEAP_ID,
310 .type = ION_HEAP_TYPE_CARVEOUT,
311 .name = ION_AUDIO_HEAP_NAME,
312 .size = MSM_ION_AUDIO_SIZE,
313 .memory_type = ION_EBI_TYPE,
314 .extra_data = (void *) &co_ion_pdata,
315 },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800316#endif
317 }
318};
319
320static struct platform_device ion_dev = {
321 .name = "ion-msm",
322 .id = 1,
323 .dev = { .platform_data = &ion_pdata },
324};
325#endif
326
327static void reserve_ion_memory(void)
328{
329#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
330 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_SIZE;
Olav Haugand3d29682012-01-19 10:57:07 -0800331 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_FW_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800332 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_SF_SIZE;
333 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MFC_SIZE;
Olav Hauganf45e2142012-01-19 11:01:01 -0800334 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_QSECOM_SIZE;
Olav Haugan2c43fac2012-01-19 11:06:37 -0800335 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_AUDIO_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800336#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700337}
338
Huaibin Yang4a084e32011-12-15 15:25:52 -0800339static void __init reserve_mdp_memory(void)
340{
341 apq8064_mdp_writeback(apq8064_reserve_table);
342}
343
Kevin Chan13be4e22011-10-20 11:30:32 -0700344static void __init apq8064_calculate_reserve_sizes(void)
345{
346 size_pmem_devices();
347 reserve_pmem_memory();
Olav Haugan7c6aa742012-01-16 16:47:37 -0800348 reserve_ion_memory();
Huaibin Yang4a084e32011-12-15 15:25:52 -0800349 reserve_mdp_memory();
Kevin Chan13be4e22011-10-20 11:30:32 -0700350}
351
352static struct reserve_info apq8064_reserve_info __initdata = {
353 .memtype_reserve_table = apq8064_reserve_table,
354 .calculate_reserve_sizes = apq8064_calculate_reserve_sizes,
355 .paddr_to_memtype = apq8064_paddr_to_memtype,
356};
357
358static int apq8064_memory_bank_size(void)
359{
360 return 1<<29;
361}
362
363static void __init locate_unstable_memory(void)
364{
365 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
366 unsigned long bank_size;
367 unsigned long low, high;
368
369 bank_size = apq8064_memory_bank_size();
370 low = meminfo.bank[0].start;
371 high = mb->start + mb->size;
Olav Haugand76e3a82012-01-16 16:55:07 -0800372
373 /* Check if 32 bit overflow occured */
374 if (high < mb->start)
375 high = ~0UL;
376
Kevin Chan13be4e22011-10-20 11:30:32 -0700377 low &= ~(bank_size - 1);
378
379 if (high - low <= bank_size)
380 return;
Jack Cheung46bfffa2012-01-19 15:26:24 -0800381 apq8064_reserve_info.low_unstable_address = mb->start -
382 MIN_MEMORY_BLOCK_SIZE + mb->size;
383 apq8064_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
384
Kevin Chan13be4e22011-10-20 11:30:32 -0700385 apq8064_reserve_info.bank_size = bank_size;
386 pr_info("low unstable address %lx max size %lx bank size %lx\n",
387 apq8064_reserve_info.low_unstable_address,
388 apq8064_reserve_info.max_unstable_size,
389 apq8064_reserve_info.bank_size);
390}
391
392static void __init apq8064_reserve(void)
393{
394 reserve_info = &apq8064_reserve_info;
395 locate_unstable_memory();
396 msm_reserve();
397}
398
Hemant Kumara945b472012-01-25 15:08:06 -0800399#ifdef CONFIG_USB_EHCI_MSM_HSIC
400static struct msm_hsic_host_platform_data msm_hsic_pdata = {
401 .strobe = 88,
402 .data = 89,
403};
404#else
405static struct msm_hsic_host_platform_data msm_hsic_pdata;
406#endif
407
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800408#define PID_MAGIC_ID 0x71432909
409#define SERIAL_NUM_MAGIC_ID 0x61945374
410#define SERIAL_NUMBER_LENGTH 127
411#define DLOAD_USB_BASE_ADD 0x2A03F0C8
412
413struct magic_num_struct {
414 uint32_t pid;
415 uint32_t serial_num;
416};
417
418struct dload_struct {
419 uint32_t reserved1;
420 uint32_t reserved2;
421 uint32_t reserved3;
422 uint16_t reserved4;
423 uint16_t pid;
424 char serial_number[SERIAL_NUMBER_LENGTH];
425 uint16_t reserved5;
426 struct magic_num_struct magic_struct;
427};
428
429static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
430{
431 struct dload_struct __iomem *dload = 0;
432
433 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
434 if (!dload) {
435 pr_err("%s: cannot remap I/O memory region: %08x\n",
436 __func__, DLOAD_USB_BASE_ADD);
437 return -ENXIO;
438 }
439
440 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
441 __func__, dload, pid, snum);
442 /* update pid */
443 dload->magic_struct.pid = PID_MAGIC_ID;
444 dload->pid = pid;
445
446 /* update serial number */
447 dload->magic_struct.serial_num = 0;
448 if (!snum) {
449 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
450 goto out;
451 }
452
453 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
454 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
455out:
456 iounmap(dload);
457 return 0;
458}
459
460static struct android_usb_platform_data android_usb_pdata = {
461 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
462};
463
Hemant Kumar4933b072011-10-17 23:43:11 -0700464static struct platform_device android_usb_device = {
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800465 .name = "android_usb",
466 .id = -1,
467 .dev = {
468 .platform_data = &android_usb_pdata,
469 },
Hemant Kumar4933b072011-10-17 23:43:11 -0700470};
471
Hemant Kumar7620eed2012-02-26 09:08:43 -0800472/* Bandwidth requests (zero) if no vote placed */
473static struct msm_bus_vectors usb_init_vectors[] = {
474 {
475 .src = MSM_BUS_MASTER_SPS,
476 .dst = MSM_BUS_SLAVE_EBI_CH0,
477 .ab = 0,
478 .ib = 0,
479 },
480};
481
482/* Bus bandwidth requests in Bytes/sec */
483static struct msm_bus_vectors usb_max_vectors[] = {
484 {
485 .src = MSM_BUS_MASTER_SPS,
486 .dst = MSM_BUS_SLAVE_EBI_CH0,
487 .ab = 60000000, /* At least 480Mbps on bus. */
488 .ib = 960000000, /* MAX bursts rate */
489 },
490};
491
492static struct msm_bus_paths usb_bus_scale_usecases[] = {
493 {
494 ARRAY_SIZE(usb_init_vectors),
495 usb_init_vectors,
496 },
497 {
498 ARRAY_SIZE(usb_max_vectors),
499 usb_max_vectors,
500 },
501};
502
503static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
504 usb_bus_scale_usecases,
505 ARRAY_SIZE(usb_bus_scale_usecases),
506 .name = "usb",
507};
508
Hemant Kumar4933b072011-10-17 23:43:11 -0700509static struct msm_otg_platform_data msm_otg_pdata = {
Hemant Kumard86c4882012-01-24 19:39:37 -0800510 .mode = USB_OTG,
511 .otg_control = OTG_PMIC_CONTROL,
Hemant Kumar4933b072011-10-17 23:43:11 -0700512 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Hemant Kumard86c4882012-01-24 19:39:37 -0800513 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
514 .power_budget = 750,
Hemant Kumar7620eed2012-02-26 09:08:43 -0800515 .bus_scale_table = &usb_bus_scale_pdata,
Hemant Kumar4933b072011-10-17 23:43:11 -0700516};
517
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800518static struct msm_usb_host_platform_data msm_ehci_host_pdata3 = {
Manu Gautam91223e02011-11-08 15:27:22 +0530519 .power_budget = 500,
520};
521
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800522#ifdef CONFIG_USB_EHCI_MSM_HOST4
523static struct msm_usb_host_platform_data msm_ehci_host_pdata4;
524#endif
525
Manu Gautam91223e02011-11-08 15:27:22 +0530526static void __init apq8064_ehci_host_init(void)
527{
528 if (machine_is_apq8064_liquid()) {
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800529 msm_ehci_host_pdata3.dock_connect_irq =
Hemant Kumar56925352012-02-13 16:59:52 -0800530 PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9);
531
Manu Gautam91223e02011-11-08 15:27:22 +0530532 apq8064_device_ehci_host3.dev.platform_data =
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800533 &msm_ehci_host_pdata3;
Manu Gautam91223e02011-11-08 15:27:22 +0530534 platform_device_register(&apq8064_device_ehci_host3);
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800535
536#ifdef CONFIG_USB_EHCI_MSM_HOST4
537 apq8064_device_ehci_host4.dev.platform_data =
538 &msm_ehci_host_pdata4;
539 platform_device_register(&apq8064_device_ehci_host4);
540#endif
Manu Gautam91223e02011-11-08 15:27:22 +0530541 }
542}
543
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800544#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
545
546/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
547 * 4 micbiases are used to power various analog and digital
548 * microphones operating at 1800 mV. Technically, all micbiases
549 * can source from single cfilter since all microphones operate
550 * at the same voltage level. The arrangement below is to make
551 * sure all cfilters are exercised. LDO_H regulator ouput level
552 * does not need to be as high as 2.85V. It is choosen for
553 * microphone sensitivity purpose.
554 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530555static struct wcd9xxx_pdata apq8064_tabla_platform_data = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800556 .slimbus_slave_device = {
557 .name = "tabla-slave",
558 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
559 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800560 .irq = MSM_GPIO_TO_INT(42),
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800561 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530562 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800563 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
564 .micbias = {
565 .ldoh_v = TABLA_LDOH_2P85_V,
566 .cfilt1_mv = 1800,
567 .cfilt2_mv = 1800,
568 .cfilt3_mv = 1800,
569 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
570 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
571 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
572 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530573 },
574 .regulator = {
575 {
576 .name = "CDC_VDD_CP",
577 .min_uV = 1800000,
578 .max_uV = 1800000,
579 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
580 },
581 {
582 .name = "CDC_VDDA_RX",
583 .min_uV = 1800000,
584 .max_uV = 1800000,
585 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
586 },
587 {
588 .name = "CDC_VDDA_TX",
589 .min_uV = 1800000,
590 .max_uV = 1800000,
591 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
592 },
593 {
594 .name = "VDDIO_CDC",
595 .min_uV = 1800000,
596 .max_uV = 1800000,
597 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
598 },
599 {
600 .name = "VDDD_CDC_D",
601 .min_uV = 1225000,
602 .max_uV = 1225000,
603 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
604 },
605 {
606 .name = "CDC_VDDA_A_1P2V",
607 .min_uV = 1225000,
608 .max_uV = 1225000,
609 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
610 },
611 },
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800612};
613
614static struct slim_device apq8064_slim_tabla = {
615 .name = "tabla-slim",
616 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
617 .dev = {
618 .platform_data = &apq8064_tabla_platform_data,
619 },
620};
621
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530622static struct wcd9xxx_pdata apq8064_tabla20_platform_data = {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800623 .slimbus_slave_device = {
624 .name = "tabla-slave",
625 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
626 },
627 .irq = MSM_GPIO_TO_INT(42),
628 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530629 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800630 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
631 .micbias = {
632 .ldoh_v = TABLA_LDOH_2P85_V,
633 .cfilt1_mv = 1800,
634 .cfilt2_mv = 1800,
635 .cfilt3_mv = 1800,
636 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
637 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
638 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
639 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530640 },
641 .regulator = {
642 {
643 .name = "CDC_VDD_CP",
644 .min_uV = 1800000,
645 .max_uV = 1800000,
646 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
647 },
648 {
649 .name = "CDC_VDDA_RX",
650 .min_uV = 1800000,
651 .max_uV = 1800000,
652 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
653 },
654 {
655 .name = "CDC_VDDA_TX",
656 .min_uV = 1800000,
657 .max_uV = 1800000,
658 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
659 },
660 {
661 .name = "VDDIO_CDC",
662 .min_uV = 1800000,
663 .max_uV = 1800000,
664 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
665 },
666 {
667 .name = "VDDD_CDC_D",
668 .min_uV = 1225000,
669 .max_uV = 1225000,
670 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
671 },
672 {
673 .name = "CDC_VDDA_A_1P2V",
674 .min_uV = 1225000,
675 .max_uV = 1225000,
676 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
677 },
678 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800679};
680
681static struct slim_device apq8064_slim_tabla20 = {
682 .name = "tabla2x-slim",
683 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
684 .dev = {
685 .platform_data = &apq8064_tabla20_platform_data,
686 },
687};
688
Amy Maloche70090f992012-02-16 16:35:26 -0800689#define HAP_SHIFT_LVL_OE_GPIO PM8921_MPP_PM_TO_SYS(8)
690#define ISA1200_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
691#define ISA1200_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
692#define ISA1200_HAP_CLK PM8921_GPIO_PM_TO_SYS(44)
693
694static int isa1200_power(int on)
695{
696 gpio_set_value_cansleep(ISA1200_HAP_CLK, !!on);
697
698 return 0;
699}
700
701static int isa1200_dev_setup(bool enable)
702{
703 int rc = 0;
704
705 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_1, enable);
706 if (rc) {
707 pr_err("%s: unable to write aux clock register(%d)\n",
708 __func__, rc);
709 return rc;
710 }
711
712 if (!enable)
713 goto free_gpio;
714
715 rc = gpio_request(ISA1200_HAP_CLK, "haptics_clk");
716 if (rc) {
717 pr_err("%s: unable to request gpio %d config(%d)\n",
718 __func__, ISA1200_HAP_CLK, rc);
719 return rc;
720 }
721
722 rc = gpio_direction_output(ISA1200_HAP_CLK, 0);
723 if (rc) {
724 pr_err("%s: unable to set direction\n", __func__);
725 goto free_gpio;
726 }
727
728 return 0;
729
730free_gpio:
731 gpio_free(ISA1200_HAP_CLK);
732 return rc;
733}
734
735static struct isa1200_regulator isa1200_reg_data[] = {
736 {
737 .name = "vddp",
738 .min_uV = ISA_I2C_VTG_MIN_UV,
739 .max_uV = ISA_I2C_VTG_MAX_UV,
740 .load_uA = ISA_I2C_CURR_UA,
741 },
742};
743
744static struct isa1200_platform_data isa1200_1_pdata = {
745 .name = "vibrator",
746 .dev_setup = isa1200_dev_setup,
747 .power_on = isa1200_power,
748 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
749 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
750 .max_timeout = 15000,
751 .mode_ctrl = PWM_GEN_MODE,
752 .pwm_fd = {
753 .pwm_div = 256,
754 },
755 .is_erm = false,
756 .smart_en = true,
757 .ext_clk_en = true,
758 .chip_en = 1,
759 .regulator_info = isa1200_reg_data,
760 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
761};
762
763static struct i2c_board_info isa1200_board_info[] __initdata = {
764 {
765 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
766 .platform_data = &isa1200_1_pdata,
767 },
768};
Jing Lin21ed4de2012-02-05 15:53:28 -0800769/* configuration data for mxt1386e using V2.1 firmware */
770static const u8 mxt1386e_config_data_v2_1[] = {
771 /* T6 Object */
772 0, 0, 0, 0, 0, 0,
773 /* T38 Object */
Jing Linf1208fd2012-02-23 11:15:42 -0800774 14, 1, 0, 22, 2, 12, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800775 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
776 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
777 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
778 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
779 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
780 0, 0, 0, 0,
781 /* T7 Object */
Jing Linf1208fd2012-02-23 11:15:42 -0800782 100, 10, 50,
Jing Lin21ed4de2012-02-05 15:53:28 -0800783 /* T8 Object */
Jing Linf1208fd2012-02-23 11:15:42 -0800784 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800785 /* T9 Object */
786 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
787 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
Jing Linf1208fd2012-02-23 11:15:42 -0800788 85, 5, 0, 5, 9, 5, 12, 35, 70, 40,
789 20, 5, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800790 /* T18 Object */
791 0, 0,
792 /* T24 Object */
793 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
794 0, 0, 0, 0, 0, 0, 0, 0, 0,
795 /* T25 Object */
796 3, 0, 60, 115, 156, 99,
797 /* T27 Object */
798 0, 0, 0, 0, 0, 0, 0,
799 /* T40 Object */
800 0, 0, 0, 0, 0,
801 /* T42 Object */
802 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
803 /* T43 Object */
804 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
805 16,
806 /* T46 Object */
Jing Linf1208fd2012-02-23 11:15:42 -0800807 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800808 /* T47 Object */
809 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
810 /* T48 Object */
811 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -0800812 32, 40, 0, 10, 10, 0, 0, 100, 10, 90,
813 0, 0, 0, 0, 0, 0, 0, 10, 1, 10,
814 52, 10, 12, 0, 33, 0, 1, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800815 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
816 0, 0, 0, 0,
817 /* T56 Object */
818 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
819 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
820 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
821 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -0800822 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
823 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800824};
825
826#define MXT_TS_GPIO_IRQ 6
827#define MXT_TS_PWR_EN_GPIO PM8921_GPIO_PM_TO_SYS(23)
828#define MXT_TS_RESET_GPIO 33
829
830static struct mxt_config_info mxt_config_array[] = {
831 {
832 .config = mxt1386e_config_data_v2_1,
833 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
834 .family_id = 0xA0,
835 .variant_id = 0x7,
836 .version = 0x21,
837 .build = 0xAA,
838 },
839};
840
841static struct mxt_platform_data mxt_platform_data = {
842 .config_array = mxt_config_array,
843 .config_array_size = ARRAY_SIZE(mxt_config_array),
844 .x_size = 1365,
845 .y_size = 767,
846 .irqflags = IRQF_TRIGGER_FALLING,
847 .i2c_pull_up = true,
848 .reset_gpio = MXT_TS_RESET_GPIO,
849 .irq_gpio = MXT_TS_GPIO_IRQ,
850};
851
852static struct i2c_board_info mxt_device_info[] __initdata = {
853 {
854 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
855 .platform_data = &mxt_platform_data,
856 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
857 },
858};
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -0800859#define CYTTSP_TS_GPIO_IRQ 6
860#define CYTTSP_TS_GPIO_RESOUT 7
861#define CYTTSP_TS_GPIO_SLEEP 33
862
863static ssize_t tma340_vkeys_show(struct kobject *kobj,
864 struct kobj_attribute *attr, char *buf)
865{
866 return snprintf(buf, 200,
867 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
868 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
869 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
870 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
871 "\n");
872}
873
874static struct kobj_attribute tma340_vkeys_attr = {
875 .attr = {
876 .mode = S_IRUGO,
877 },
878 .show = &tma340_vkeys_show,
879};
880
881static struct attribute *tma340_properties_attrs[] = {
882 &tma340_vkeys_attr.attr,
883 NULL
884};
885
886static struct attribute_group tma340_properties_attr_group = {
887 .attrs = tma340_properties_attrs,
888};
889
890static int cyttsp_platform_init(struct i2c_client *client)
891{
892 int rc = 0;
893 static struct kobject *tma340_properties_kobj;
894
895 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
896 tma340_properties_kobj = kobject_create_and_add("board_properties",
897 NULL);
898 if (tma340_properties_kobj)
899 rc = sysfs_create_group(tma340_properties_kobj,
900 &tma340_properties_attr_group);
901 if (!tma340_properties_kobj || rc)
902 pr_err("%s: failed to create board_properties\n",
903 __func__);
904
905 return 0;
906}
907
908static struct cyttsp_regulator cyttsp_regulator_data[] = {
909 {
910 .name = "vdd",
911 .min_uV = CY_TMA300_VTG_MIN_UV,
912 .max_uV = CY_TMA300_VTG_MAX_UV,
913 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
914 .lpm_load_uA = CY_TMA300_CURR_24HZ_UA,
915 },
916 {
917 .name = "vcc_i2c",
918 .min_uV = CY_I2C_VTG_MIN_UV,
919 .max_uV = CY_I2C_VTG_MAX_UV,
920 .hpm_load_uA = CY_I2C_CURR_UA,
921 .lpm_load_uA = CY_I2C_CURR_UA,
922 },
923};
924
925static struct cyttsp_platform_data cyttsp_pdata = {
926 .panel_maxx = 634,
927 .panel_maxy = 1166,
928 .disp_maxx = 599,
929 .disp_maxy = 1023,
930 .disp_minx = 0,
931 .disp_miny = 0,
932 .flags = 0x01,
933 .gen = CY_GEN3,
934 .use_st = CY_USE_ST,
935 .use_mt = CY_USE_MT,
936 .use_hndshk = CY_SEND_HNDSHK,
937 .use_trk_id = CY_USE_TRACKING_ID,
938 .use_sleep = CY_USE_DEEP_SLEEP_SEL,
939 .use_gestures = CY_USE_GESTURES,
940 .fw_fname = "cyttsp_8064_mtp.hex",
941 /* change act_intrvl to customize the Active power state
942 * scanning/processing refresh interval for Operating mode
943 */
944 .act_intrvl = CY_ACT_INTRVL_DFLT,
945 /* change tch_tmout to customize the touch timeout for the
946 * Active power state for Operating mode
947 */
948 .tch_tmout = CY_TCH_TMOUT_DFLT,
949 /* change lp_intrvl to customize the Low Power power state
950 * scanning/processing refresh interval for Operating mode
951 */
952 .lp_intrvl = CY_LP_INTRVL_DFLT,
953 .sleep_gpio = CYTTSP_TS_GPIO_SLEEP,
954 .resout_gpio = CYTTSP_TS_GPIO_RESOUT,
955 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
956 .regulator_info = cyttsp_regulator_data,
957 .num_regulators = ARRAY_SIZE(cyttsp_regulator_data),
958 .init = cyttsp_platform_init,
959 .correct_fw_ver = 17,
960};
961
962static struct i2c_board_info cyttsp_info[] __initdata = {
963 {
964 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
965 .platform_data = &cyttsp_pdata,
966 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
967 },
968};
Jing Lin21ed4de2012-02-05 15:53:28 -0800969
Ankit Verma6b7e2ba2012-01-26 15:48:54 -0800970#define MSM_WCNSS_PHYS 0x03000000
971#define MSM_WCNSS_SIZE 0x280000
972
973static struct resource resources_wcnss_wlan[] = {
974 {
975 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
976 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
977 .name = "wcnss_wlanrx_irq",
978 .flags = IORESOURCE_IRQ,
979 },
980 {
981 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
982 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
983 .name = "wcnss_wlantx_irq",
984 .flags = IORESOURCE_IRQ,
985 },
986 {
987 .start = MSM_WCNSS_PHYS,
988 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
989 .name = "wcnss_mmio",
990 .flags = IORESOURCE_MEM,
991 },
992 {
993 .start = 64,
994 .end = 68,
995 .name = "wcnss_gpios_5wire",
996 .flags = IORESOURCE_IO,
997 },
998};
999
1000static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1001 .has_48mhz_xo = 1,
1002};
1003
1004static struct platform_device msm_device_wcnss_wlan = {
1005 .name = "wcnss_wlan",
1006 .id = 0,
1007 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1008 .resource = resources_wcnss_wlan,
1009 .dev = {.platform_data = &qcom_wcnss_pdata},
1010};
1011
Ankit Vermab7c26e62012-02-28 15:04:15 -08001012static struct platform_device msm_device_iris_fm __devinitdata = {
1013 .name = "iris_fm",
1014 .id = -1,
1015};
1016
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001017#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1018 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1019 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1020 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1021
1022#define QCE_SIZE 0x10000
1023#define QCE_0_BASE 0x11000000
1024
1025#define QCE_HW_KEY_SUPPORT 0
1026#define QCE_SHA_HMAC_SUPPORT 1
1027#define QCE_SHARE_CE_RESOURCE 3
1028#define QCE_CE_SHARED 0
1029
1030static struct resource qcrypto_resources[] = {
1031 [0] = {
1032 .start = QCE_0_BASE,
1033 .end = QCE_0_BASE + QCE_SIZE - 1,
1034 .flags = IORESOURCE_MEM,
1035 },
1036 [1] = {
1037 .name = "crypto_channels",
1038 .start = DMOV8064_CE_IN_CHAN,
1039 .end = DMOV8064_CE_OUT_CHAN,
1040 .flags = IORESOURCE_DMA,
1041 },
1042 [2] = {
1043 .name = "crypto_crci_in",
1044 .start = DMOV8064_CE_IN_CRCI,
1045 .end = DMOV8064_CE_IN_CRCI,
1046 .flags = IORESOURCE_DMA,
1047 },
1048 [3] = {
1049 .name = "crypto_crci_out",
1050 .start = DMOV8064_CE_OUT_CRCI,
1051 .end = DMOV8064_CE_OUT_CRCI,
1052 .flags = IORESOURCE_DMA,
1053 },
1054};
1055
1056static struct resource qcedev_resources[] = {
1057 [0] = {
1058 .start = QCE_0_BASE,
1059 .end = QCE_0_BASE + QCE_SIZE - 1,
1060 .flags = IORESOURCE_MEM,
1061 },
1062 [1] = {
1063 .name = "crypto_channels",
1064 .start = DMOV8064_CE_IN_CHAN,
1065 .end = DMOV8064_CE_OUT_CHAN,
1066 .flags = IORESOURCE_DMA,
1067 },
1068 [2] = {
1069 .name = "crypto_crci_in",
1070 .start = DMOV8064_CE_IN_CRCI,
1071 .end = DMOV8064_CE_IN_CRCI,
1072 .flags = IORESOURCE_DMA,
1073 },
1074 [3] = {
1075 .name = "crypto_crci_out",
1076 .start = DMOV8064_CE_OUT_CRCI,
1077 .end = DMOV8064_CE_OUT_CRCI,
1078 .flags = IORESOURCE_DMA,
1079 },
1080};
1081
1082#endif
1083
1084#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1085 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1086
1087static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1088 .ce_shared = QCE_CE_SHARED,
1089 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1090 .hw_key_support = QCE_HW_KEY_SUPPORT,
1091 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001092 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001093};
1094
1095static struct platform_device qcrypto_device = {
1096 .name = "qcrypto",
1097 .id = 0,
1098 .num_resources = ARRAY_SIZE(qcrypto_resources),
1099 .resource = qcrypto_resources,
1100 .dev = {
1101 .coherent_dma_mask = DMA_BIT_MASK(32),
1102 .platform_data = &qcrypto_ce_hw_suppport,
1103 },
1104};
1105#endif
1106
1107#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1108 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1109
1110static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1111 .ce_shared = QCE_CE_SHARED,
1112 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1113 .hw_key_support = QCE_HW_KEY_SUPPORT,
1114 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001115 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001116};
1117
1118static struct platform_device qcedev_device = {
1119 .name = "qce",
1120 .id = 0,
1121 .num_resources = ARRAY_SIZE(qcedev_resources),
1122 .resource = qcedev_resources,
1123 .dev = {
1124 .coherent_dma_mask = DMA_BIT_MASK(32),
1125 .platform_data = &qcedev_ce_hw_suppport,
1126 },
1127};
1128#endif
1129
Joel Kingdacbc822012-01-25 13:30:57 -08001130static struct mdm_platform_data mdm_platform_data = {
1131 .mdm_version = "3.0",
1132 .ramdump_delay_ms = 2000,
Hemant Kumara945b472012-01-25 15:08:06 -08001133 .peripheral_platform_device = &apq8064_device_hsic_host,
Joel Kingdacbc822012-01-25 13:30:57 -08001134};
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001135
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001136static struct tsens_platform_data apq_tsens_pdata = {
1137 .tsens_factor = 1000,
1138 .hw_type = APQ_8064,
1139 .tsens_num_sensor = 11,
1140 .slope = {1176, 1176, 1154, 1176, 1111,
1141 1132, 1132, 1199, 1132, 1199, 1132},
1142};
1143
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001144#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001145static void __init apq8064_map_io(void)
1146{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001147 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001148 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001149 if (socinfo_init() < 0)
1150 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001151}
1152
1153static void __init apq8064_init_irq(void)
1154{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001155 struct msm_mpm_device_data *data = NULL;
1156
1157#ifdef CONFIG_MSM_MPM
1158 data = &apq8064_mpm_dev_data;
1159#endif
1160
1161 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001162 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1163 (void *)MSM_QGIC_CPU_BASE);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001164}
1165
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001166static struct platform_device msm8064_device_saw_regulator_core0 = {
1167 .name = "saw-regulator",
1168 .id = 0,
1169 .dev = {
1170 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
1171 },
1172};
1173
1174static struct platform_device msm8064_device_saw_regulator_core1 = {
1175 .name = "saw-regulator",
1176 .id = 1,
1177 .dev = {
1178 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
1179 },
1180};
1181
1182static struct platform_device msm8064_device_saw_regulator_core2 = {
1183 .name = "saw-regulator",
1184 .id = 2,
1185 .dev = {
1186 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
1187 },
1188};
1189
1190static struct platform_device msm8064_device_saw_regulator_core3 = {
1191 .name = "saw-regulator",
1192 .id = 3,
1193 .dev = {
1194 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001195
1196 },
1197};
1198
Oluwafemi Adeyemif5a31422012-03-08 16:58:45 -08001199static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001200 {
1201 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1202 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1203 true,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001204 100, 650, 801, 200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001205 },
1206
1207 {
1208 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1209 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1210 true,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001211 2000, 200, 576000, 2000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001212 },
1213
1214 {
1215 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1216 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1217 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001218 8500, 51, 1122000, 8500,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001219 },
1220
1221 {
1222 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1223 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
1224 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001225 9000, 51, 1130300, 9000,
1226 },
1227 {
1228 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1229 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
1230 false,
1231 10000, 51, 1130300, 10000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001232 },
1233
1234 {
1235 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1236 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1237 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001238 12000, 14, 2205900, 12000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001239 },
1240
1241 {
1242 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1243 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1244 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001245 18000, 12, 2364250, 18000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001246 },
1247
1248 {
1249 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1250 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1251 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001252 23500, 10, 2667000, 23500,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001253 },
1254
1255 {
1256 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1257 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1258 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001259 29700, 5, 2867000, 30000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001260 },
1261};
1262
Oluwafemi Adeyemif5a31422012-03-08 16:58:45 -08001263uint32_t apq8064_rpm_get_swfi_latency(void)
1264{
1265 int i;
1266
1267 for (i = 0; i < ARRAY_SIZE(msm_rpmrs_levels); i++) {
1268 if (msm_rpmrs_levels[i].sleep_mode ==
1269 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)
1270 return msm_rpmrs_levels[i].latency_us;
1271 }
1272
1273 return 0;
1274}
1275
Praveen Chidambaram78499012011-11-01 17:15:17 -06001276static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1277 .mode = MSM_PM_BOOT_CONFIG_TZ,
1278};
1279
1280static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
1281 .levels = &msm_rpmrs_levels[0],
1282 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
1283 .vdd_mem_levels = {
1284 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
1285 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
1286 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
1287 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
1288 },
1289 .vdd_dig_levels = {
1290 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
1291 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
1292 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
1293 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
1294 },
1295 .vdd_mask = 0x7FFFFF,
1296 .rpmrs_target_id = {
1297 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
1298 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
1299 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
1300 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
1301 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
1302 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
1303 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
1304 },
1305};
1306
1307static struct msm_cpuidle_state msm_cstates[] __initdata = {
1308 {0, 0, "C0", "WFI",
1309 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1310
1311 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1312 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1313
1314 {0, 2, "C2", "POWER_COLLAPSE",
1315 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
1316
1317 {1, 0, "C0", "WFI",
1318 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1319
1320 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1321 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1322
1323 {2, 0, "C0", "WFI",
1324 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1325
1326 {2, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1327 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1328
1329 {3, 0, "C0", "WFI",
1330 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1331
1332 {3, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1333 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1334};
1335
1336static struct msm_pm_platform_data msm_pm_data[] = {
1337 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1338 .idle_supported = 1,
1339 .suspend_supported = 1,
1340 .idle_enabled = 0,
1341 .suspend_enabled = 0,
1342 },
1343
1344 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1345 .idle_supported = 1,
1346 .suspend_supported = 1,
1347 .idle_enabled = 0,
1348 .suspend_enabled = 0,
1349 },
1350
1351 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1352 .idle_supported = 1,
1353 .suspend_supported = 1,
1354 .idle_enabled = 1,
1355 .suspend_enabled = 1,
1356 },
1357
1358 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1359 .idle_supported = 0,
1360 .suspend_supported = 1,
1361 .idle_enabled = 0,
1362 .suspend_enabled = 0,
1363 },
1364
1365 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1366 .idle_supported = 1,
1367 .suspend_supported = 1,
1368 .idle_enabled = 0,
1369 .suspend_enabled = 0,
1370 },
1371
1372 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1373 .idle_supported = 1,
1374 .suspend_supported = 0,
1375 .idle_enabled = 1,
1376 .suspend_enabled = 0,
1377 },
1378
1379 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1380 .idle_supported = 0,
1381 .suspend_supported = 1,
1382 .idle_enabled = 0,
1383 .suspend_enabled = 0,
1384 },
1385
1386 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1387 .idle_supported = 1,
1388 .suspend_supported = 1,
1389 .idle_enabled = 0,
1390 .suspend_enabled = 0,
1391 },
1392
1393 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1394 .idle_supported = 1,
1395 .suspend_supported = 0,
1396 .idle_enabled = 1,
1397 .suspend_enabled = 0,
1398 },
1399
1400 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1401 .idle_supported = 0,
1402 .suspend_supported = 1,
1403 .idle_enabled = 0,
1404 .suspend_enabled = 0,
1405 },
1406
1407 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1408 .idle_supported = 1,
1409 .suspend_supported = 1,
1410 .idle_enabled = 0,
1411 .suspend_enabled = 0,
1412 },
1413
1414 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1415 .idle_supported = 1,
1416 .suspend_supported = 0,
1417 .idle_enabled = 1,
1418 .suspend_enabled = 0,
1419 },
1420};
1421
1422static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1423 0x03, 0x0f,
1424};
1425
1426static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1427 0x00, 0x24, 0x54, 0x10,
1428 0x09, 0x03, 0x01,
1429 0x10, 0x54, 0x30, 0x0C,
1430 0x24, 0x30, 0x0f,
1431};
1432
1433static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1434 0x00, 0x24, 0x54, 0x10,
1435 0x09, 0x07, 0x01, 0x0B,
1436 0x10, 0x54, 0x30, 0x0C,
1437 0x24, 0x30, 0x0f,
1438};
1439
1440static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1441 [0] = {
1442 .mode = MSM_SPM_MODE_CLOCK_GATING,
1443 .notify_rpm = false,
1444 .cmd = spm_wfi_cmd_sequence,
1445 },
1446 [1] = {
1447 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1448 .notify_rpm = false,
1449 .cmd = spm_power_collapse_without_rpm,
1450 },
1451 [2] = {
1452 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1453 .notify_rpm = true,
1454 .cmd = spm_power_collapse_with_rpm,
1455 },
1456};
1457
1458static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1459 0x00, 0x20, 0x03, 0x20,
1460 0x00, 0x0f,
1461};
1462
1463static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1464 0x00, 0x20, 0x34, 0x64,
1465 0x48, 0x07, 0x48, 0x20,
1466 0x50, 0x64, 0x04, 0x34,
1467 0x50, 0x0f,
1468};
1469static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1470 0x00, 0x10, 0x34, 0x64,
1471 0x48, 0x07, 0x48, 0x10,
1472 0x50, 0x64, 0x04, 0x34,
1473 0x50, 0x0F,
1474};
1475
1476static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1477 [0] = {
1478 .mode = MSM_SPM_L2_MODE_RETENTION,
1479 .notify_rpm = false,
1480 .cmd = l2_spm_wfi_cmd_sequence,
1481 },
1482 [1] = {
1483 .mode = MSM_SPM_L2_MODE_GDHS,
1484 .notify_rpm = true,
1485 .cmd = l2_spm_gdhs_cmd_sequence,
1486 },
1487 [2] = {
1488 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1489 .notify_rpm = true,
1490 .cmd = l2_spm_power_off_cmd_sequence,
1491 },
1492};
1493
1494
1495static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1496 [0] = {
1497 .reg_base_addr = MSM_SAW_L2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001498 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001499 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001500 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1501 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1502 .modes = msm_spm_l2_seq_list,
1503 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1504 },
1505};
1506
1507static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1508 [0] = {
1509 .reg_base_addr = MSM_SAW0_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001510 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001511#if defined(CONFIG_MSM_AVS_HW)
1512 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1513 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1514#endif
1515 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001516 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001517 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1518 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1519 .vctl_timeout_us = 50,
1520 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1521 .modes = msm_spm_seq_list,
1522 },
1523 [1] = {
1524 .reg_base_addr = MSM_SAW1_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001525 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001526#if defined(CONFIG_MSM_AVS_HW)
1527 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1528 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1529#endif
1530 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001531 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001532 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1533 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1534 .vctl_timeout_us = 50,
1535 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1536 .modes = msm_spm_seq_list,
1537 },
1538 [2] = {
1539 .reg_base_addr = MSM_SAW2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001540 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001541#if defined(CONFIG_MSM_AVS_HW)
1542 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1543 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1544#endif
1545 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001546 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001547 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1548 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1549 .vctl_timeout_us = 50,
1550 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1551 .modes = msm_spm_seq_list,
1552 },
1553 [3] = {
1554 .reg_base_addr = MSM_SAW3_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001555 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001556#if defined(CONFIG_MSM_AVS_HW)
1557 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1558 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1559#endif
1560 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001561 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001562 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1563 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1564 .vctl_timeout_us = 50,
1565 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1566 .modes = msm_spm_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001567 },
1568};
1569
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001570static void __init apq8064_init_buses(void)
1571{
1572 msm_bus_rpm_set_mt_mask();
1573 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
1574 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
1575 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
1576 msm_bus_8064_apps_fabric.dev.platform_data =
1577 &msm_bus_8064_apps_fabric_pdata;
1578 msm_bus_8064_sys_fabric.dev.platform_data =
1579 &msm_bus_8064_sys_fabric_pdata;
1580 msm_bus_8064_mm_fabric.dev.platform_data =
1581 &msm_bus_8064_mm_fabric_pdata;
1582 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
1583 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
1584}
1585
David Collinsf0d00732012-01-25 15:46:50 -08001586static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
1587 .name = GPIO_REGULATOR_DEV_NAME,
1588 .id = PM8921_MPP_PM_TO_SYS(7),
1589 .dev = {
1590 .platform_data
1591 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
1592 },
1593};
1594
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08001595static struct platform_device apq8064_device_ext_mpp8_vreg __devinitdata = {
1596 .name = GPIO_REGULATOR_DEV_NAME,
1597 .id = PM8921_MPP_PM_TO_SYS(8),
1598 .dev = {
1599 .platform_data
1600 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_MPP8],
1601 },
1602};
1603
David Collinsf0d00732012-01-25 15:46:50 -08001604static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
1605 .name = GPIO_REGULATOR_DEV_NAME,
1606 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
1607 .dev = {
1608 .platform_data =
1609 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
1610 },
1611};
1612
David Collins390fc332012-02-07 14:38:16 -08001613static struct platform_device apq8064_device_ext_ts_sw_vreg __devinitdata = {
1614 .name = GPIO_REGULATOR_DEV_NAME,
1615 .id = PM8921_GPIO_PM_TO_SYS(23),
1616 .dev = {
1617 .platform_data
1618 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_TS_SW],
1619 },
1620};
1621
David Collins2782b5c2012-02-06 10:02:42 -08001622static struct platform_device apq8064_device_rpm_regulator __devinitdata = {
1623 .name = "rpm-regulator",
1624 .id = -1,
1625 .dev = {
1626 .platform_data = &apq8064_rpm_regulator_pdata,
1627 },
1628};
1629
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001630static struct platform_device *common_devices[] __initdata = {
Jin Hong01f2dbb2011-11-03 22:13:51 -07001631 &apq8064_device_dmov,
David Keitel3c40fc52012-02-09 17:53:52 -08001632 &apq8064_device_qup_i2c_gsbi1,
Jing Lin04601f92012-02-05 15:36:07 -08001633 &apq8064_device_qup_i2c_gsbi3,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001634 &apq8064_device_qup_i2c_gsbi4,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001635 &apq8064_device_qup_spi_gsbi5,
David Collinsf0d00732012-01-25 15:46:50 -08001636 &apq8064_device_ext_5v_vreg,
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08001637 &apq8064_device_ext_mpp8_vreg,
David Collinsf0d00732012-01-25 15:46:50 -08001638 &apq8064_device_ext_3p3v_vreg,
David Collins390fc332012-02-07 14:38:16 -08001639 &apq8064_device_ext_ts_sw_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07001640 &apq8064_device_ssbi_pmic1,
1641 &apq8064_device_ssbi_pmic2,
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001642 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07001643 &apq8064_device_otg,
1644 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08001645 &apq8064_device_hsusb_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07001646 &android_usb_device,
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001647 &msm_device_wcnss_wlan,
Ankit Vermab7c26e62012-02-28 15:04:15 -08001648 &msm_device_iris_fm,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001649#ifdef CONFIG_ANDROID_PMEM
1650#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -07001651 &android_pmem_device,
1652 &android_pmem_adsp_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001653#endif
Kevin Chan13be4e22011-10-20 11:30:32 -07001654 &android_pmem_audio_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001655#endif
1656#ifdef CONFIG_ION_MSM
1657 &ion_dev,
1658#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001659 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001660 &msm8064_device_saw_regulator_core0,
1661 &msm8064_device_saw_regulator_core1,
1662 &msm8064_device_saw_regulator_core2,
1663 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001664#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1665 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1666 &qcrypto_device,
1667#endif
1668
1669#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1670 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1671 &qcedev_device,
1672#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07001673
1674#ifdef CONFIG_HW_RANDOM_MSM
1675 &apq8064_device_rng,
1676#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08001677 &apq_pcm,
1678 &apq_pcm_routing,
1679 &apq_cpudai0,
1680 &apq_cpudai1,
1681 &apq_cpudai_hdmi_rx,
1682 &apq_cpudai_bt_rx,
1683 &apq_cpudai_bt_tx,
1684 &apq_cpudai_fm_rx,
1685 &apq_cpudai_fm_tx,
1686 &apq_cpu_fe,
1687 &apq_stub_codec,
1688 &apq_voice,
1689 &apq_voip,
1690 &apq_lpa_pcm,
1691 &apq_pcm_hostless,
1692 &apq_cpudai_afe_01_rx,
1693 &apq_cpudai_afe_01_tx,
1694 &apq_cpudai_afe_02_rx,
1695 &apq_cpudai_afe_02_tx,
1696 &apq_pcm_afe,
1697 &apq_cpudai_auxpcm_rx,
1698 &apq_cpudai_auxpcm_tx,
Neema Shetty8427c262012-02-16 11:23:43 -08001699 &apq_cpudai_stub,
Neema Shetty3c9d2862012-03-11 01:25:32 -08001700 &apq_cpudai_slimbus_1_rx,
1701 &apq_cpudai_slimbus_1_tx,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001702 &apq8064_rpm_device,
1703 &apq8064_rpm_log_device,
1704 &apq8064_rpm_stat_device,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001705 &msm_bus_8064_apps_fabric,
1706 &msm_bus_8064_sys_fabric,
1707 &msm_bus_8064_mm_fabric,
1708 &msm_bus_8064_sys_fpb,
1709 &msm_bus_8064_cpss_fpb,
Mohan Kumar Gubbihalli Lachma Naik7f72edd2012-02-06 17:26:47 -08001710 &apq8064_msm_device_vidc,
Matt Wagantalled832652012-02-02 19:23:17 -08001711 &msm_8960_riva,
Matt Wagantallb94b9a52012-02-02 21:59:54 -08001712 &msm_8960_q6_lpass,
Matt Wagantall292aace2012-01-26 19:12:34 -08001713 &msm_gss,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001714};
1715
Joel King4e7ad222011-08-17 15:47:38 -07001716static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001717 &apq8064_device_uart_gsbi3,
Yan He06913ce2011-08-26 16:33:46 -07001718 &msm_device_sps_apq8064,
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001719};
1720
1721static struct platform_device *rumi3_devices[] __initdata = {
1722 &apq8064_device_uart_gsbi1,
Yan He435ed612011-11-23 17:34:59 -08001723 &msm_device_sps_apq8064,
Huaibin Yang4a084e32011-12-15 15:25:52 -08001724#ifdef CONFIG_MSM_ROTATOR
1725 &msm_rotator_device,
1726#endif
Joel King4e7ad222011-08-17 15:47:38 -07001727};
1728
Joel King82b7e3f2012-01-05 10:03:27 -08001729static struct platform_device *cdp_devices[] __initdata = {
1730 &apq8064_device_uart_gsbi1,
Jin Hong4bbbfba2012-02-02 21:48:07 -08001731 &apq8064_device_uart_gsbi7,
Joel King82b7e3f2012-01-05 10:03:27 -08001732 &msm_device_sps_apq8064,
Aravind Venkateswaran4ca27532012-02-16 14:27:05 -08001733#ifdef CONFIG_MSM_ROTATOR
1734 &msm_rotator_device,
1735#endif
Joel King82b7e3f2012-01-05 10:03:27 -08001736};
1737
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001738static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08001739 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001740};
1741
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001742#define KS8851_IRQ_GPIO 43
1743
1744static struct spi_board_info spi_board_info[] __initdata = {
1745 {
1746 .modalias = "ks8851",
1747 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1748 .max_speed_hz = 19200000,
1749 .bus_num = 0,
1750 .chip_select = 2,
1751 .mode = SPI_MODE_0,
1752 },
1753};
1754
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001755static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001756 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001757 .bus_num = 1,
1758 .slim_slave = &apq8064_slim_tabla,
1759 },
1760 {
1761 .bus_num = 1,
1762 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001763 },
1764 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001765};
1766
David Keitel3c40fc52012-02-09 17:53:52 -08001767static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi1_pdata = {
1768 .clk_freq = 100000,
1769 .src_clk_rate = 24000000,
1770};
1771
Jing Lin04601f92012-02-05 15:36:07 -08001772static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi3_pdata = {
1773 .clk_freq = 100000,
1774 .src_clk_rate = 24000000,
1775};
1776
Kenneth Heitke748593a2011-07-15 15:45:11 -06001777static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
1778 .clk_freq = 100000,
1779 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001780};
1781
David Keitel3c40fc52012-02-09 17:53:52 -08001782#define GSBI_DUAL_MODE_CODE 0x60
1783#define MSM_GSBI1_PHYS 0x12440000
Kenneth Heitke748593a2011-07-15 15:45:11 -06001784static void __init apq8064_i2c_init(void)
1785{
David Keitel3c40fc52012-02-09 17:53:52 -08001786 void __iomem *gsbi_mem;
1787
1788 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
1789 &apq8064_i2c_qup_gsbi1_pdata;
1790 gsbi_mem = ioremap_nocache(MSM_GSBI1_PHYS, 4);
1791 writel_relaxed(GSBI_DUAL_MODE_CODE, gsbi_mem);
1792 /* Ensure protocol code is written before proceeding */
1793 wmb();
1794 iounmap(gsbi_mem);
1795 apq8064_i2c_qup_gsbi1_pdata.use_gsbi_shared_mode = 1;
Jing Lin04601f92012-02-05 15:36:07 -08001796 apq8064_device_qup_i2c_gsbi3.dev.platform_data =
1797 &apq8064_i2c_qup_gsbi3_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06001798 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
1799 &apq8064_i2c_qup_gsbi4_pdata;
1800}
1801
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08001802#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001803static int ethernet_init(void)
1804{
1805 int ret;
1806 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
1807 if (ret) {
1808 pr_err("ks8851 gpio_request failed: %d\n", ret);
1809 goto fail;
1810 }
1811
1812 return 0;
1813fail:
1814 return ret;
1815}
1816#else
1817static int ethernet_init(void)
1818{
1819 return 0;
1820}
1821#endif
1822
Mohan Pallaka474b94b2012-01-25 12:59:58 +05301823#define GPIO_KEY_HOME PM8921_GPIO_PM_TO_SYS(27)
1824#define GPIO_KEY_VOLUME_UP PM8921_GPIO_PM_TO_SYS(35)
1825#define GPIO_KEY_VOLUME_DOWN PM8921_GPIO_PM_TO_SYS(38)
1826#define GPIO_KEY_CAM_FOCUS PM8921_GPIO_PM_TO_SYS(3)
1827#define GPIO_KEY_CAM_SNAP PM8921_GPIO_PM_TO_SYS(4)
Jing Lin3f8f8422012-03-05 09:32:11 -08001828#define GPIO_KEY_ROTATION PM8921_GPIO_PM_TO_SYS(42)
Mohan Pallaka474b94b2012-01-25 12:59:58 +05301829
1830static struct gpio_keys_button cdp_keys[] = {
1831 {
1832 .code = KEY_HOME,
1833 .gpio = GPIO_KEY_HOME,
1834 .desc = "home_key",
1835 .active_low = 1,
1836 .type = EV_KEY,
1837 .wakeup = 1,
1838 .debounce_interval = 15,
1839 },
1840 {
1841 .code = KEY_VOLUMEUP,
1842 .gpio = GPIO_KEY_VOLUME_UP,
1843 .desc = "volume_up_key",
1844 .active_low = 1,
1845 .type = EV_KEY,
1846 .wakeup = 1,
1847 .debounce_interval = 15,
1848 },
1849 {
1850 .code = KEY_VOLUMEDOWN,
1851 .gpio = GPIO_KEY_VOLUME_DOWN,
1852 .desc = "volume_down_key",
1853 .active_low = 1,
1854 .type = EV_KEY,
1855 .wakeup = 1,
1856 .debounce_interval = 15,
1857 },
1858 {
1859 .code = SW_ROTATE_LOCK,
1860 .gpio = GPIO_KEY_ROTATION,
1861 .desc = "rotate_key",
1862 .active_low = 1,
1863 .type = EV_SW,
1864 .debounce_interval = 15,
1865 },
1866};
1867
1868static struct gpio_keys_platform_data cdp_keys_data = {
1869 .buttons = cdp_keys,
1870 .nbuttons = ARRAY_SIZE(cdp_keys),
1871};
1872
1873static struct platform_device cdp_kp_pdev = {
1874 .name = "gpio-keys",
1875 .id = -1,
1876 .dev = {
1877 .platform_data = &cdp_keys_data,
1878 },
1879};
1880
1881static struct gpio_keys_button mtp_keys[] = {
1882 {
1883 .code = KEY_CAMERA_FOCUS,
1884 .gpio = GPIO_KEY_CAM_FOCUS,
1885 .desc = "cam_focus_key",
1886 .active_low = 1,
1887 .type = EV_KEY,
1888 .wakeup = 1,
1889 .debounce_interval = 15,
1890 },
1891 {
1892 .code = KEY_VOLUMEUP,
1893 .gpio = GPIO_KEY_VOLUME_UP,
1894 .desc = "volume_up_key",
1895 .active_low = 1,
1896 .type = EV_KEY,
1897 .wakeup = 1,
1898 .debounce_interval = 15,
1899 },
1900 {
1901 .code = KEY_VOLUMEDOWN,
1902 .gpio = GPIO_KEY_VOLUME_DOWN,
1903 .desc = "volume_down_key",
1904 .active_low = 1,
1905 .type = EV_KEY,
1906 .wakeup = 1,
1907 .debounce_interval = 15,
1908 },
1909 {
1910 .code = KEY_CAMERA_SNAPSHOT,
1911 .gpio = GPIO_KEY_CAM_SNAP,
1912 .desc = "cam_snap_key",
1913 .active_low = 1,
1914 .type = EV_KEY,
1915 .debounce_interval = 15,
1916 },
1917};
1918
1919static struct gpio_keys_platform_data mtp_keys_data = {
1920 .buttons = mtp_keys,
1921 .nbuttons = ARRAY_SIZE(mtp_keys),
1922};
1923
1924static struct platform_device mtp_kp_pdev = {
1925 .name = "gpio-keys",
1926 .id = -1,
1927 .dev = {
1928 .platform_data = &mtp_keys_data,
1929 },
1930};
1931
Jin Hongd3024e62012-02-09 16:13:32 -08001932/* Sensors DSPS platform data */
1933#define DSPS_PIL_GENERIC_NAME "dsps"
1934static void __init apq8064_init_dsps(void)
1935{
1936 struct msm_dsps_platform_data *pdata =
1937 msm_dsps_device_8064.dev.platform_data;
1938 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
1939 pdata->gpios = NULL;
1940 pdata->gpios_num = 0;
1941
1942 platform_device_register(&msm_dsps_device_8064);
1943}
Mohan Pallaka474b94b2012-01-25 12:59:58 +05301944
Tianyi Gou41515e22011-09-01 19:37:43 -07001945static void __init apq8064_clock_init(void)
1946{
Tianyi Gouacb588d2012-01-27 18:24:05 -08001947 if (machine_is_apq8064_rumi3())
Tianyi Gou41515e22011-09-01 19:37:43 -07001948 msm_clock_init(&apq8064_dummy_clock_init_data);
Tianyi Gouacb588d2012-01-27 18:24:05 -08001949 else
1950 msm_clock_init(&apq8064_clock_init_data);
Tianyi Gou41515e22011-09-01 19:37:43 -07001951}
1952
Jing Lin417fa452012-02-05 14:31:06 -08001953#define I2C_SURF 1
1954#define I2C_FFA (1 << 1)
1955#define I2C_RUMI (1 << 2)
1956#define I2C_SIM (1 << 3)
1957#define I2C_LIQUID (1 << 4)
1958
1959struct i2c_registry {
1960 u8 machs;
1961 int bus;
1962 struct i2c_board_info *info;
1963 int len;
1964};
1965
1966static struct i2c_registry apq8064_i2c_devices[] __initdata = {
Jing Lin21ed4de2012-02-05 15:53:28 -08001967 {
1968 I2C_SURF | I2C_LIQUID,
1969 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
1970 mxt_device_info,
1971 ARRAY_SIZE(mxt_device_info),
1972 },
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001973 {
1974 I2C_FFA,
1975 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
1976 cyttsp_info,
1977 ARRAY_SIZE(cyttsp_info),
1978 },
Amy Maloche70090f992012-02-16 16:35:26 -08001979 {
1980 I2C_FFA | I2C_LIQUID,
1981 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
1982 isa1200_board_info,
1983 ARRAY_SIZE(isa1200_board_info),
1984 },
Jing Lin417fa452012-02-05 14:31:06 -08001985};
1986
1987static void __init register_i2c_devices(void)
1988{
1989 u8 mach_mask = 0;
1990 int i;
1991
Kevin Chand07220e2012-02-13 15:52:22 -08001992#ifdef CONFIG_MSM_CAMERA
1993 struct i2c_registry apq8064_camera_i2c_devices = {
1994 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_RUMI,
1995 APQ_8064_GSBI4_QUP_I2C_BUS_ID,
1996 apq8064_camera_board_info.board_info,
1997 apq8064_camera_board_info.num_i2c_board_info,
1998 };
1999#endif
Jing Lin417fa452012-02-05 14:31:06 -08002000 /* Build the matching 'supported_machs' bitmask */
2001 if (machine_is_apq8064_cdp())
2002 mach_mask = I2C_SURF;
2003 else if (machine_is_apq8064_mtp())
2004 mach_mask = I2C_FFA;
2005 else if (machine_is_apq8064_liquid())
2006 mach_mask = I2C_LIQUID;
2007 else if (machine_is_apq8064_rumi3())
2008 mach_mask = I2C_RUMI;
2009 else if (machine_is_apq8064_sim())
2010 mach_mask = I2C_SIM;
2011 else
2012 pr_err("unmatched machine ID in register_i2c_devices\n");
2013
2014 /* Run the array and install devices as appropriate */
2015 for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) {
2016 if (apq8064_i2c_devices[i].machs & mach_mask)
2017 i2c_register_board_info(apq8064_i2c_devices[i].bus,
2018 apq8064_i2c_devices[i].info,
2019 apq8064_i2c_devices[i].len);
2020 }
Kevin Chand07220e2012-02-13 15:52:22 -08002021#ifdef CONFIG_MSM_CAMERA
2022 if (apq8064_camera_i2c_devices.machs & mach_mask)
2023 i2c_register_board_info(apq8064_camera_i2c_devices.bus,
2024 apq8064_camera_i2c_devices.info,
2025 apq8064_camera_i2c_devices.len);
2026#endif
Jing Lin417fa452012-02-05 14:31:06 -08002027}
2028
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002029static void __init apq8064_common_init(void)
2030{
2031 if (socinfo_init() < 0)
2032 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06002033 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
2034 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
David Collins2782b5c2012-02-06 10:02:42 -08002035 regulator_suppress_info_printing();
2036 platform_device_register(&apq8064_device_rpm_regulator);
Stephen Boyd4d0d2582012-02-10 14:49:40 -08002037 if (msm_xo_init())
2038 pr_err("Failed to initialize XO votes\n");
Tianyi Gou41515e22011-09-01 19:37:43 -07002039 apq8064_clock_init();
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08002040 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06002041 apq8064_i2c_init();
Jing Lin417fa452012-02-05 14:31:06 -08002042 register_i2c_devices();
Kenneth Heitke36920d32011-07-20 16:44:30 -06002043
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002044 apq8064_device_qup_spi_gsbi5.dev.platform_data =
2045 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08002046 apq8064_init_pmic();
Hemant Kumar94e7da22012-02-03 16:52:29 -08002047 if (machine_is_apq8064_liquid())
2048 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002049 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Manu Gautam91223e02011-11-08 15:27:22 +05302050 apq8064_ehci_host_init();
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002051 apq8064_init_buses();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002052 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Hemant Kumarf1ca9192012-02-07 18:59:33 -08002053 if (machine_is_apq8064_mtp()) {
2054 apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
2055 device_initialize(&apq8064_device_hsic_host.dev);
2056 }
Jay Chokshie8741282012-01-25 15:22:55 -08002057 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05302058 apq8064_init_mmc();
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08002059
2060 if (machine_is_apq8064_mtp()) {
2061 mdm_8064_device.dev.platform_data = &mdm_platform_data;
2062 platform_device_register(&mdm_8064_device);
2063 }
2064 platform_device_register(&apq8064_slim_ctrl);
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002065 slim_register_board_info(apq8064_slim_devices,
2066 ARRAY_SIZE(apq8064_slim_devices));
Jin Hongd3024e62012-02-09 16:13:32 -08002067 apq8064_init_dsps();
Praveen Chidambaram78499012011-11-01 17:15:17 -06002068 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Mahesh Sivasubramaniancbce1ec2012-01-24 10:32:44 -07002069 acpuclk_init(&acpuclk_8064_soc_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002070 msm_spm_l2_init(msm_spm_l2_data);
2071 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2072 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2073 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2074 msm_pm_data);
2075 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002076}
2077
Huaibin Yang4a084e32011-12-15 15:25:52 -08002078static void __init apq8064_allocate_memory_regions(void)
2079{
2080 apq8064_allocate_fb_region();
2081}
2082
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002083static void __init apq8064_sim_init(void)
2084{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002085 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
2086 &msm8064_device_watchdog.dev.platform_data;
2087
2088 wdog_pdata->bark_time = 15000;
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002089 msm_tsens_early_init(&apq_tsens_pdata);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002090 apq8064_common_init();
Joel King4e7ad222011-08-17 15:47:38 -07002091 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
2092}
2093
2094static void __init apq8064_rumi3_init(void)
2095{
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002096 msm_tsens_early_init(&apq_tsens_pdata);
Joel King4e7ad222011-08-17 15:47:38 -07002097 apq8064_common_init();
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002098 ethernet_init();
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002099 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002100 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Huaibin Yang4a084e32011-12-15 15:25:52 -08002101 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07002102 apq8064_init_gpu();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002103}
2104
Joel King82b7e3f2012-01-05 10:03:27 -08002105static void __init apq8064_cdp_init(void)
2106{
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002107 msm_tsens_early_init(&apq_tsens_pdata);
Joel King82b7e3f2012-01-05 10:03:27 -08002108 apq8064_common_init();
2109 ethernet_init();
2110 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
2111 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002112 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07002113 apq8064_init_gpu();
Matt Wagantall1875d322012-02-22 16:11:33 -08002114 platform_add_devices(apq8064_fs_devices, apq8064_num_fs_devices);
Kevin Chand07220e2012-02-13 15:52:22 -08002115 apq8064_init_cam();
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302116
2117 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
2118 platform_device_register(&cdp_kp_pdev);
2119
2120 if (machine_is_apq8064_mtp())
2121 platform_device_register(&mtp_kp_pdev);
Joel King82b7e3f2012-01-05 10:03:27 -08002122}
2123
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002124MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
2125 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002126 .reserve = apq8064_reserve,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002127 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302128 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002129 .timer = &msm_timer,
2130 .init_machine = apq8064_sim_init,
2131MACHINE_END
2132
Joel King4e7ad222011-08-17 15:47:38 -07002133MACHINE_START(APQ8064_RUMI3, "QCT APQ8064 RUMI3")
2134 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002135 .reserve = apq8064_reserve,
Joel King4e7ad222011-08-17 15:47:38 -07002136 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302137 .handle_irq = gic_handle_irq,
Joel King4e7ad222011-08-17 15:47:38 -07002138 .timer = &msm_timer,
2139 .init_machine = apq8064_rumi3_init,
Huaibin Yang4a084e32011-12-15 15:25:52 -08002140 .init_early = apq8064_allocate_memory_regions,
Joel King4e7ad222011-08-17 15:47:38 -07002141MACHINE_END
2142
Joel King82b7e3f2012-01-05 10:03:27 -08002143MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
2144 .map_io = apq8064_map_io,
2145 .reserve = apq8064_reserve,
2146 .init_irq = apq8064_init_irq,
2147 .handle_irq = gic_handle_irq,
2148 .timer = &msm_timer,
2149 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002150 .init_early = apq8064_allocate_memory_regions,
Joel King82b7e3f2012-01-05 10:03:27 -08002151MACHINE_END
2152
2153MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
2154 .map_io = apq8064_map_io,
2155 .reserve = apq8064_reserve,
2156 .init_irq = apq8064_init_irq,
2157 .handle_irq = gic_handle_irq,
2158 .timer = &msm_timer,
2159 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002160 .init_early = apq8064_allocate_memory_regions,
Joel King82b7e3f2012-01-05 10:03:27 -08002161MACHINE_END
2162
2163MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
2164 .map_io = apq8064_map_io,
2165 .reserve = apq8064_reserve,
2166 .init_irq = apq8064_init_irq,
2167 .handle_irq = gic_handle_irq,
2168 .timer = &msm_timer,
2169 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002170 .init_early = apq8064_allocate_memory_regions,
Joel King82b7e3f2012-01-05 10:03:27 -08002171MACHINE_END
2172
Joel King11ca8202012-02-13 16:19:03 -08002173MACHINE_START(MPQ8064_HRD, "QCT MPQ8064 HRD")
2174 .map_io = apq8064_map_io,
2175 .reserve = apq8064_reserve,
2176 .init_irq = apq8064_init_irq,
2177 .handle_irq = gic_handle_irq,
2178 .timer = &msm_timer,
2179 .init_machine = apq8064_cdp_init,
2180MACHINE_END
2181
2182MACHINE_START(MPQ8064_DTV, "QCT MPQ8064 DTV")
2183 .map_io = apq8064_map_io,
2184 .reserve = apq8064_reserve,
2185 .init_irq = apq8064_init_irq,
2186 .handle_irq = gic_handle_irq,
2187 .timer = &msm_timer,
2188 .init_machine = apq8064_cdp_init,
2189MACHINE_END
2190