blob: 6e6ecac337b3452f67e784bff4f979fd4a564ffa [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
Siddartha Mohanadoss9c658982012-02-28 15:11:48 -080096#define GPIO_EXPANDER_IRQ_BASE (PM8821_IRQ_BASE + PM8821_NR_IRQS)
97#define GPIO_EXPANDER_GPIO_BASE (PM8821_MPP_BASE + PM8821_NR_MPPS)
98#define GPIO_EPM_EXPANDER_BASE GPIO_EXPANDER_GPIO_BASE
99
100enum {
101 SX150X_EPM,
102};
103
Olav Haugan7c6aa742012-01-16 16:47:37 -0800104#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
105static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
106static int __init pmem_kernel_ebi1_size_setup(char *p)
Kevin Chan13be4e22011-10-20 11:30:32 -0700107{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800108 pmem_kernel_ebi1_size = memparse(p, NULL);
109 return 0;
Kevin Chan13be4e22011-10-20 11:30:32 -0700110}
Olav Haugan7c6aa742012-01-16 16:47:37 -0800111early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
112#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700113
Olav Haugan7c6aa742012-01-16 16:47:37 -0800114#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -0700115static unsigned pmem_size = MSM_PMEM_SIZE;
116static int __init pmem_size_setup(char *p)
117{
118 pmem_size = memparse(p, NULL);
119 return 0;
120}
121early_param("pmem_size", pmem_size_setup);
122
123static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
124
125static int __init pmem_adsp_size_setup(char *p)
126{
127 pmem_adsp_size = memparse(p, NULL);
128 return 0;
129}
130early_param("pmem_adsp_size", pmem_adsp_size_setup);
131
132static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
133
134static int __init pmem_audio_size_setup(char *p)
135{
136 pmem_audio_size = memparse(p, NULL);
137 return 0;
138}
139early_param("pmem_audio_size", pmem_audio_size_setup);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800140#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700141
Olav Haugan7c6aa742012-01-16 16:47:37 -0800142#ifdef CONFIG_ANDROID_PMEM
143#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700144static struct android_pmem_platform_data android_pmem_pdata = {
145 .name = "pmem",
146 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
147 .cached = 1,
148 .memory_type = MEMTYPE_EBI1,
149};
150
151static struct platform_device android_pmem_device = {
152 .name = "android_pmem",
153 .id = 0,
154 .dev = {.platform_data = &android_pmem_pdata},
155};
156
157static struct android_pmem_platform_data android_pmem_adsp_pdata = {
158 .name = "pmem_adsp",
159 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
160 .cached = 0,
161 .memory_type = MEMTYPE_EBI1,
162};
Kevin Chan13be4e22011-10-20 11:30:32 -0700163static struct platform_device android_pmem_adsp_device = {
164 .name = "android_pmem",
165 .id = 2,
166 .dev = { .platform_data = &android_pmem_adsp_pdata },
167};
Olav Haugan7c6aa742012-01-16 16:47:37 -0800168#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700169
170static struct android_pmem_platform_data android_pmem_audio_pdata = {
171 .name = "pmem_audio",
172 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
173 .cached = 0,
174 .memory_type = MEMTYPE_EBI1,
175};
176
177static struct platform_device android_pmem_audio_device = {
178 .name = "android_pmem",
179 .id = 4,
180 .dev = { .platform_data = &android_pmem_audio_pdata },
181};
Olav Haugan7c6aa742012-01-16 16:47:37 -0800182#endif
183
184static struct memtype_reserve apq8064_reserve_table[] __initdata = {
185 [MEMTYPE_SMI] = {
186 },
187 [MEMTYPE_EBI0] = {
188 .flags = MEMTYPE_FLAGS_1M_ALIGN,
189 },
190 [MEMTYPE_EBI1] = {
191 .flags = MEMTYPE_FLAGS_1M_ALIGN,
192 },
193};
Kevin Chan13be4e22011-10-20 11:30:32 -0700194
195static void __init size_pmem_devices(void)
196{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800197#ifdef CONFIG_ANDROID_PMEM
198#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700199 android_pmem_adsp_pdata.size = pmem_adsp_size;
200 android_pmem_pdata.size = pmem_size;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800201#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700202 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800203#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700204}
205
206static void __init reserve_memory_for(struct android_pmem_platform_data *p)
207{
208 apq8064_reserve_table[p->memory_type].size += p->size;
209}
210
Kevin Chan13be4e22011-10-20 11:30:32 -0700211static void __init reserve_pmem_memory(void)
212{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800213#ifdef CONFIG_ANDROID_PMEM
214#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700215 reserve_memory_for(&android_pmem_adsp_pdata);
216 reserve_memory_for(&android_pmem_pdata);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800217#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700218 reserve_memory_for(&android_pmem_audio_pdata);
219 apq8064_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800220#endif
221}
222
223static int apq8064_paddr_to_memtype(unsigned int paddr)
224{
225 return MEMTYPE_EBI1;
226}
227
228#ifdef CONFIG_ION_MSM
229#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
230static struct ion_cp_heap_pdata cp_mm_ion_pdata = {
231 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugand3d29682012-01-19 10:57:07 -0800232 .align = PAGE_SIZE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800233};
234
235static struct ion_cp_heap_pdata cp_mfc_ion_pdata = {
236 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugand3d29682012-01-19 10:57:07 -0800237 .align = PAGE_SIZE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800238};
239
240static struct ion_co_heap_pdata co_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800241 .adjacent_mem_id = INVALID_HEAP_ID,
242 .align = PAGE_SIZE,
243};
244
245static struct ion_co_heap_pdata fw_co_ion_pdata = {
246 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
247 .align = SZ_128K,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800248};
249#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800250
251/**
252 * These heaps are listed in the order they will be allocated. Due to
253 * video hardware restrictions and content protection the FW heap has to
254 * be allocated adjacent (below) the MM heap and the MFC heap has to be
255 * allocated after the MM heap to ensure MFC heap is not more than 256MB
256 * away from the base address of the FW heap.
257 * However, the order of FW heap and MM heap doesn't matter since these
258 * two heaps are taken care of by separate code to ensure they are adjacent
259 * to each other.
260 * Don't swap the order unless you know what you are doing!
261 */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800262static struct ion_platform_data ion_pdata = {
263 .nr = MSM_ION_HEAP_NUM,
264 .heaps = {
265 {
266 .id = ION_SYSTEM_HEAP_ID,
267 .type = ION_HEAP_TYPE_SYSTEM,
268 .name = ION_VMALLOC_HEAP_NAME,
269 },
270#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
271 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800272 .id = ION_CP_MM_HEAP_ID,
273 .type = ION_HEAP_TYPE_CP,
274 .name = ION_MM_HEAP_NAME,
275 .size = MSM_ION_MM_SIZE,
276 .memory_type = ION_EBI_TYPE,
277 .extra_data = (void *) &cp_mm_ion_pdata,
278 },
279 {
Olav Haugand3d29682012-01-19 10:57:07 -0800280 .id = ION_MM_FIRMWARE_HEAP_ID,
281 .type = ION_HEAP_TYPE_CARVEOUT,
282 .name = ION_MM_FIRMWARE_HEAP_NAME,
283 .size = MSM_ION_MM_FW_SIZE,
284 .memory_type = ION_EBI_TYPE,
285 .extra_data = (void *) &fw_co_ion_pdata,
286 },
287 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800288 .id = ION_CP_MFC_HEAP_ID,
289 .type = ION_HEAP_TYPE_CP,
290 .name = ION_MFC_HEAP_NAME,
291 .size = MSM_ION_MFC_SIZE,
292 .memory_type = ION_EBI_TYPE,
293 .extra_data = (void *) &cp_mfc_ion_pdata,
294 },
295 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800296 .id = ION_SF_HEAP_ID,
297 .type = ION_HEAP_TYPE_CARVEOUT,
298 .name = ION_SF_HEAP_NAME,
299 .size = MSM_ION_SF_SIZE,
300 .memory_type = ION_EBI_TYPE,
301 .extra_data = (void *) &co_ion_pdata,
302 },
303 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800304 .id = ION_IOMMU_HEAP_ID,
305 .type = ION_HEAP_TYPE_IOMMU,
306 .name = ION_IOMMU_HEAP_NAME,
307 },
Olav Hauganf45e2142012-01-19 11:01:01 -0800308 {
309 .id = ION_QSECOM_HEAP_ID,
310 .type = ION_HEAP_TYPE_CARVEOUT,
311 .name = ION_QSECOM_HEAP_NAME,
312 .size = MSM_ION_QSECOM_SIZE,
313 .memory_type = ION_EBI_TYPE,
314 .extra_data = (void *) &co_ion_pdata,
315 },
Olav Haugan2c43fac2012-01-19 11:06:37 -0800316 {
317 .id = ION_AUDIO_HEAP_ID,
318 .type = ION_HEAP_TYPE_CARVEOUT,
319 .name = ION_AUDIO_HEAP_NAME,
320 .size = MSM_ION_AUDIO_SIZE,
321 .memory_type = ION_EBI_TYPE,
322 .extra_data = (void *) &co_ion_pdata,
323 },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800324#endif
325 }
326};
327
328static struct platform_device ion_dev = {
329 .name = "ion-msm",
330 .id = 1,
331 .dev = { .platform_data = &ion_pdata },
332};
333#endif
334
335static void reserve_ion_memory(void)
336{
337#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
338 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_SIZE;
Olav Haugand3d29682012-01-19 10:57:07 -0800339 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_FW_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800340 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_SF_SIZE;
341 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MFC_SIZE;
Olav Hauganf45e2142012-01-19 11:01:01 -0800342 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_QSECOM_SIZE;
Olav Haugan2c43fac2012-01-19 11:06:37 -0800343 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_AUDIO_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800344#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700345}
346
Huaibin Yang4a084e32011-12-15 15:25:52 -0800347static void __init reserve_mdp_memory(void)
348{
349 apq8064_mdp_writeback(apq8064_reserve_table);
350}
351
Kevin Chan13be4e22011-10-20 11:30:32 -0700352static void __init apq8064_calculate_reserve_sizes(void)
353{
354 size_pmem_devices();
355 reserve_pmem_memory();
Olav Haugan7c6aa742012-01-16 16:47:37 -0800356 reserve_ion_memory();
Huaibin Yang4a084e32011-12-15 15:25:52 -0800357 reserve_mdp_memory();
Kevin Chan13be4e22011-10-20 11:30:32 -0700358}
359
360static struct reserve_info apq8064_reserve_info __initdata = {
361 .memtype_reserve_table = apq8064_reserve_table,
362 .calculate_reserve_sizes = apq8064_calculate_reserve_sizes,
363 .paddr_to_memtype = apq8064_paddr_to_memtype,
364};
365
366static int apq8064_memory_bank_size(void)
367{
368 return 1<<29;
369}
370
371static void __init locate_unstable_memory(void)
372{
373 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
374 unsigned long bank_size;
375 unsigned long low, high;
376
377 bank_size = apq8064_memory_bank_size();
378 low = meminfo.bank[0].start;
379 high = mb->start + mb->size;
Olav Haugand76e3a82012-01-16 16:55:07 -0800380
381 /* Check if 32 bit overflow occured */
382 if (high < mb->start)
383 high = ~0UL;
384
Kevin Chan13be4e22011-10-20 11:30:32 -0700385 low &= ~(bank_size - 1);
386
387 if (high - low <= bank_size)
388 return;
Jack Cheung46bfffa2012-01-19 15:26:24 -0800389 apq8064_reserve_info.low_unstable_address = mb->start -
390 MIN_MEMORY_BLOCK_SIZE + mb->size;
391 apq8064_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
392
Kevin Chan13be4e22011-10-20 11:30:32 -0700393 apq8064_reserve_info.bank_size = bank_size;
394 pr_info("low unstable address %lx max size %lx bank size %lx\n",
395 apq8064_reserve_info.low_unstable_address,
396 apq8064_reserve_info.max_unstable_size,
397 apq8064_reserve_info.bank_size);
398}
399
400static void __init apq8064_reserve(void)
401{
402 reserve_info = &apq8064_reserve_info;
403 locate_unstable_memory();
404 msm_reserve();
405}
406
Hemant Kumara945b472012-01-25 15:08:06 -0800407#ifdef CONFIG_USB_EHCI_MSM_HSIC
408static struct msm_hsic_host_platform_data msm_hsic_pdata = {
409 .strobe = 88,
410 .data = 89,
411};
412#else
413static struct msm_hsic_host_platform_data msm_hsic_pdata;
414#endif
415
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800416#define PID_MAGIC_ID 0x71432909
417#define SERIAL_NUM_MAGIC_ID 0x61945374
418#define SERIAL_NUMBER_LENGTH 127
419#define DLOAD_USB_BASE_ADD 0x2A03F0C8
420
421struct magic_num_struct {
422 uint32_t pid;
423 uint32_t serial_num;
424};
425
426struct dload_struct {
427 uint32_t reserved1;
428 uint32_t reserved2;
429 uint32_t reserved3;
430 uint16_t reserved4;
431 uint16_t pid;
432 char serial_number[SERIAL_NUMBER_LENGTH];
433 uint16_t reserved5;
434 struct magic_num_struct magic_struct;
435};
436
437static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
438{
439 struct dload_struct __iomem *dload = 0;
440
441 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
442 if (!dload) {
443 pr_err("%s: cannot remap I/O memory region: %08x\n",
444 __func__, DLOAD_USB_BASE_ADD);
445 return -ENXIO;
446 }
447
448 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
449 __func__, dload, pid, snum);
450 /* update pid */
451 dload->magic_struct.pid = PID_MAGIC_ID;
452 dload->pid = pid;
453
454 /* update serial number */
455 dload->magic_struct.serial_num = 0;
456 if (!snum) {
457 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
458 goto out;
459 }
460
461 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
462 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
463out:
464 iounmap(dload);
465 return 0;
466}
467
468static struct android_usb_platform_data android_usb_pdata = {
469 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
470};
471
Hemant Kumar4933b072011-10-17 23:43:11 -0700472static struct platform_device android_usb_device = {
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800473 .name = "android_usb",
474 .id = -1,
475 .dev = {
476 .platform_data = &android_usb_pdata,
477 },
Hemant Kumar4933b072011-10-17 23:43:11 -0700478};
479
Hemant Kumar7620eed2012-02-26 09:08:43 -0800480/* Bandwidth requests (zero) if no vote placed */
481static struct msm_bus_vectors usb_init_vectors[] = {
482 {
483 .src = MSM_BUS_MASTER_SPS,
484 .dst = MSM_BUS_SLAVE_EBI_CH0,
485 .ab = 0,
486 .ib = 0,
487 },
488};
489
490/* Bus bandwidth requests in Bytes/sec */
491static struct msm_bus_vectors usb_max_vectors[] = {
492 {
493 .src = MSM_BUS_MASTER_SPS,
494 .dst = MSM_BUS_SLAVE_EBI_CH0,
495 .ab = 60000000, /* At least 480Mbps on bus. */
496 .ib = 960000000, /* MAX bursts rate */
497 },
498};
499
500static struct msm_bus_paths usb_bus_scale_usecases[] = {
501 {
502 ARRAY_SIZE(usb_init_vectors),
503 usb_init_vectors,
504 },
505 {
506 ARRAY_SIZE(usb_max_vectors),
507 usb_max_vectors,
508 },
509};
510
511static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
512 usb_bus_scale_usecases,
513 ARRAY_SIZE(usb_bus_scale_usecases),
514 .name = "usb",
515};
516
Hemant Kumar4933b072011-10-17 23:43:11 -0700517static struct msm_otg_platform_data msm_otg_pdata = {
Hemant Kumard86c4882012-01-24 19:39:37 -0800518 .mode = USB_OTG,
519 .otg_control = OTG_PMIC_CONTROL,
Hemant Kumar4933b072011-10-17 23:43:11 -0700520 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Hemant Kumard86c4882012-01-24 19:39:37 -0800521 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
522 .power_budget = 750,
Hemant Kumar7620eed2012-02-26 09:08:43 -0800523 .bus_scale_table = &usb_bus_scale_pdata,
Hemant Kumar4933b072011-10-17 23:43:11 -0700524};
525
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800526static struct msm_usb_host_platform_data msm_ehci_host_pdata3 = {
Manu Gautam91223e02011-11-08 15:27:22 +0530527 .power_budget = 500,
528};
529
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800530#ifdef CONFIG_USB_EHCI_MSM_HOST4
531static struct msm_usb_host_platform_data msm_ehci_host_pdata4;
532#endif
533
Manu Gautam91223e02011-11-08 15:27:22 +0530534static void __init apq8064_ehci_host_init(void)
535{
536 if (machine_is_apq8064_liquid()) {
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800537 msm_ehci_host_pdata3.dock_connect_irq =
Hemant Kumar56925352012-02-13 16:59:52 -0800538 PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9);
539
Manu Gautam91223e02011-11-08 15:27:22 +0530540 apq8064_device_ehci_host3.dev.platform_data =
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800541 &msm_ehci_host_pdata3;
Manu Gautam91223e02011-11-08 15:27:22 +0530542 platform_device_register(&apq8064_device_ehci_host3);
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800543
544#ifdef CONFIG_USB_EHCI_MSM_HOST4
545 apq8064_device_ehci_host4.dev.platform_data =
546 &msm_ehci_host_pdata4;
547 platform_device_register(&apq8064_device_ehci_host4);
548#endif
Manu Gautam91223e02011-11-08 15:27:22 +0530549 }
550}
551
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800552#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
553
554/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
555 * 4 micbiases are used to power various analog and digital
556 * microphones operating at 1800 mV. Technically, all micbiases
557 * can source from single cfilter since all microphones operate
558 * at the same voltage level. The arrangement below is to make
559 * sure all cfilters are exercised. LDO_H regulator ouput level
560 * does not need to be as high as 2.85V. It is choosen for
561 * microphone sensitivity purpose.
562 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530563static struct wcd9xxx_pdata apq8064_tabla_platform_data = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800564 .slimbus_slave_device = {
565 .name = "tabla-slave",
566 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
567 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800568 .irq = MSM_GPIO_TO_INT(42),
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800569 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530570 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800571 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
572 .micbias = {
573 .ldoh_v = TABLA_LDOH_2P85_V,
574 .cfilt1_mv = 1800,
575 .cfilt2_mv = 1800,
576 .cfilt3_mv = 1800,
577 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
578 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
579 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
580 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530581 },
582 .regulator = {
583 {
584 .name = "CDC_VDD_CP",
585 .min_uV = 1800000,
586 .max_uV = 1800000,
587 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
588 },
589 {
590 .name = "CDC_VDDA_RX",
591 .min_uV = 1800000,
592 .max_uV = 1800000,
593 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
594 },
595 {
596 .name = "CDC_VDDA_TX",
597 .min_uV = 1800000,
598 .max_uV = 1800000,
599 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
600 },
601 {
602 .name = "VDDIO_CDC",
603 .min_uV = 1800000,
604 .max_uV = 1800000,
605 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
606 },
607 {
608 .name = "VDDD_CDC_D",
609 .min_uV = 1225000,
610 .max_uV = 1225000,
611 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
612 },
613 {
614 .name = "CDC_VDDA_A_1P2V",
615 .min_uV = 1225000,
616 .max_uV = 1225000,
617 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
618 },
619 },
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800620};
621
622static struct slim_device apq8064_slim_tabla = {
623 .name = "tabla-slim",
624 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
625 .dev = {
626 .platform_data = &apq8064_tabla_platform_data,
627 },
628};
629
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530630static struct wcd9xxx_pdata apq8064_tabla20_platform_data = {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800631 .slimbus_slave_device = {
632 .name = "tabla-slave",
633 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
634 },
635 .irq = MSM_GPIO_TO_INT(42),
636 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530637 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800638 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
639 .micbias = {
640 .ldoh_v = TABLA_LDOH_2P85_V,
641 .cfilt1_mv = 1800,
642 .cfilt2_mv = 1800,
643 .cfilt3_mv = 1800,
644 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
645 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
646 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
647 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530648 },
649 .regulator = {
650 {
651 .name = "CDC_VDD_CP",
652 .min_uV = 1800000,
653 .max_uV = 1800000,
654 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
655 },
656 {
657 .name = "CDC_VDDA_RX",
658 .min_uV = 1800000,
659 .max_uV = 1800000,
660 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
661 },
662 {
663 .name = "CDC_VDDA_TX",
664 .min_uV = 1800000,
665 .max_uV = 1800000,
666 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
667 },
668 {
669 .name = "VDDIO_CDC",
670 .min_uV = 1800000,
671 .max_uV = 1800000,
672 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
673 },
674 {
675 .name = "VDDD_CDC_D",
676 .min_uV = 1225000,
677 .max_uV = 1225000,
678 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
679 },
680 {
681 .name = "CDC_VDDA_A_1P2V",
682 .min_uV = 1225000,
683 .max_uV = 1225000,
684 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
685 },
686 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800687};
688
689static struct slim_device apq8064_slim_tabla20 = {
690 .name = "tabla2x-slim",
691 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
692 .dev = {
693 .platform_data = &apq8064_tabla20_platform_data,
694 },
695};
696
Amy Maloche70090f992012-02-16 16:35:26 -0800697#define HAP_SHIFT_LVL_OE_GPIO PM8921_MPP_PM_TO_SYS(8)
698#define ISA1200_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
699#define ISA1200_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
700#define ISA1200_HAP_CLK PM8921_GPIO_PM_TO_SYS(44)
701
702static int isa1200_power(int on)
703{
704 gpio_set_value_cansleep(ISA1200_HAP_CLK, !!on);
705
706 return 0;
707}
708
709static int isa1200_dev_setup(bool enable)
710{
711 int rc = 0;
712
713 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_1, enable);
714 if (rc) {
715 pr_err("%s: unable to write aux clock register(%d)\n",
716 __func__, rc);
717 return rc;
718 }
719
720 if (!enable)
721 goto free_gpio;
722
723 rc = gpio_request(ISA1200_HAP_CLK, "haptics_clk");
724 if (rc) {
725 pr_err("%s: unable to request gpio %d config(%d)\n",
726 __func__, ISA1200_HAP_CLK, rc);
727 return rc;
728 }
729
730 rc = gpio_direction_output(ISA1200_HAP_CLK, 0);
731 if (rc) {
732 pr_err("%s: unable to set direction\n", __func__);
733 goto free_gpio;
734 }
735
736 return 0;
737
738free_gpio:
739 gpio_free(ISA1200_HAP_CLK);
740 return rc;
741}
742
743static struct isa1200_regulator isa1200_reg_data[] = {
744 {
745 .name = "vddp",
746 .min_uV = ISA_I2C_VTG_MIN_UV,
747 .max_uV = ISA_I2C_VTG_MAX_UV,
748 .load_uA = ISA_I2C_CURR_UA,
749 },
750};
751
752static struct isa1200_platform_data isa1200_1_pdata = {
753 .name = "vibrator",
754 .dev_setup = isa1200_dev_setup,
755 .power_on = isa1200_power,
756 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
757 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
758 .max_timeout = 15000,
759 .mode_ctrl = PWM_GEN_MODE,
760 .pwm_fd = {
761 .pwm_div = 256,
762 },
763 .is_erm = false,
764 .smart_en = true,
765 .ext_clk_en = true,
766 .chip_en = 1,
767 .regulator_info = isa1200_reg_data,
768 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
769};
770
771static struct i2c_board_info isa1200_board_info[] __initdata = {
772 {
773 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
774 .platform_data = &isa1200_1_pdata,
775 },
776};
Jing Lin21ed4de2012-02-05 15:53:28 -0800777/* configuration data for mxt1386e using V2.1 firmware */
778static const u8 mxt1386e_config_data_v2_1[] = {
779 /* T6 Object */
780 0, 0, 0, 0, 0, 0,
781 /* T38 Object */
Jing Linf1208fd2012-02-23 11:15:42 -0800782 14, 1, 0, 22, 2, 12, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800783 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
784 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
785 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
786 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
787 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
788 0, 0, 0, 0,
789 /* T7 Object */
Jing Linf1208fd2012-02-23 11:15:42 -0800790 100, 10, 50,
Jing Lin21ed4de2012-02-05 15:53:28 -0800791 /* T8 Object */
Jing Linf1208fd2012-02-23 11:15:42 -0800792 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800793 /* T9 Object */
794 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
795 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
Jing Linf1208fd2012-02-23 11:15:42 -0800796 85, 5, 0, 5, 9, 5, 12, 35, 70, 40,
797 20, 5, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800798 /* T18 Object */
799 0, 0,
800 /* T24 Object */
801 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
802 0, 0, 0, 0, 0, 0, 0, 0, 0,
803 /* T25 Object */
804 3, 0, 60, 115, 156, 99,
805 /* T27 Object */
806 0, 0, 0, 0, 0, 0, 0,
807 /* T40 Object */
808 0, 0, 0, 0, 0,
809 /* T42 Object */
810 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
811 /* T43 Object */
812 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
813 16,
814 /* T46 Object */
Jing Linf1208fd2012-02-23 11:15:42 -0800815 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800816 /* T47 Object */
817 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
818 /* T48 Object */
819 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -0800820 32, 40, 0, 10, 10, 0, 0, 100, 10, 90,
821 0, 0, 0, 0, 0, 0, 0, 10, 1, 10,
822 52, 10, 12, 0, 33, 0, 1, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800823 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
824 0, 0, 0, 0,
825 /* T56 Object */
826 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
827 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
828 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
829 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -0800830 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
831 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800832};
833
834#define MXT_TS_GPIO_IRQ 6
835#define MXT_TS_PWR_EN_GPIO PM8921_GPIO_PM_TO_SYS(23)
836#define MXT_TS_RESET_GPIO 33
837
838static struct mxt_config_info mxt_config_array[] = {
839 {
840 .config = mxt1386e_config_data_v2_1,
841 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
842 .family_id = 0xA0,
843 .variant_id = 0x7,
844 .version = 0x21,
845 .build = 0xAA,
846 },
847};
848
849static struct mxt_platform_data mxt_platform_data = {
850 .config_array = mxt_config_array,
851 .config_array_size = ARRAY_SIZE(mxt_config_array),
852 .x_size = 1365,
853 .y_size = 767,
854 .irqflags = IRQF_TRIGGER_FALLING,
855 .i2c_pull_up = true,
856 .reset_gpio = MXT_TS_RESET_GPIO,
857 .irq_gpio = MXT_TS_GPIO_IRQ,
858};
859
860static struct i2c_board_info mxt_device_info[] __initdata = {
861 {
862 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
863 .platform_data = &mxt_platform_data,
864 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
865 },
866};
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -0800867#define CYTTSP_TS_GPIO_IRQ 6
868#define CYTTSP_TS_GPIO_RESOUT 7
869#define CYTTSP_TS_GPIO_SLEEP 33
870
871static ssize_t tma340_vkeys_show(struct kobject *kobj,
872 struct kobj_attribute *attr, char *buf)
873{
874 return snprintf(buf, 200,
875 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
876 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
877 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
878 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
879 "\n");
880}
881
882static struct kobj_attribute tma340_vkeys_attr = {
883 .attr = {
884 .mode = S_IRUGO,
885 },
886 .show = &tma340_vkeys_show,
887};
888
889static struct attribute *tma340_properties_attrs[] = {
890 &tma340_vkeys_attr.attr,
891 NULL
892};
893
894static struct attribute_group tma340_properties_attr_group = {
895 .attrs = tma340_properties_attrs,
896};
897
898static int cyttsp_platform_init(struct i2c_client *client)
899{
900 int rc = 0;
901 static struct kobject *tma340_properties_kobj;
902
903 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
904 tma340_properties_kobj = kobject_create_and_add("board_properties",
905 NULL);
906 if (tma340_properties_kobj)
907 rc = sysfs_create_group(tma340_properties_kobj,
908 &tma340_properties_attr_group);
909 if (!tma340_properties_kobj || rc)
910 pr_err("%s: failed to create board_properties\n",
911 __func__);
912
913 return 0;
914}
915
916static struct cyttsp_regulator cyttsp_regulator_data[] = {
917 {
918 .name = "vdd",
919 .min_uV = CY_TMA300_VTG_MIN_UV,
920 .max_uV = CY_TMA300_VTG_MAX_UV,
921 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
922 .lpm_load_uA = CY_TMA300_CURR_24HZ_UA,
923 },
924 {
925 .name = "vcc_i2c",
926 .min_uV = CY_I2C_VTG_MIN_UV,
927 .max_uV = CY_I2C_VTG_MAX_UV,
928 .hpm_load_uA = CY_I2C_CURR_UA,
929 .lpm_load_uA = CY_I2C_CURR_UA,
930 },
931};
932
933static struct cyttsp_platform_data cyttsp_pdata = {
934 .panel_maxx = 634,
935 .panel_maxy = 1166,
936 .disp_maxx = 599,
937 .disp_maxy = 1023,
938 .disp_minx = 0,
939 .disp_miny = 0,
940 .flags = 0x01,
941 .gen = CY_GEN3,
942 .use_st = CY_USE_ST,
943 .use_mt = CY_USE_MT,
944 .use_hndshk = CY_SEND_HNDSHK,
945 .use_trk_id = CY_USE_TRACKING_ID,
946 .use_sleep = CY_USE_DEEP_SLEEP_SEL,
947 .use_gestures = CY_USE_GESTURES,
948 .fw_fname = "cyttsp_8064_mtp.hex",
949 /* change act_intrvl to customize the Active power state
950 * scanning/processing refresh interval for Operating mode
951 */
952 .act_intrvl = CY_ACT_INTRVL_DFLT,
953 /* change tch_tmout to customize the touch timeout for the
954 * Active power state for Operating mode
955 */
956 .tch_tmout = CY_TCH_TMOUT_DFLT,
957 /* change lp_intrvl to customize the Low Power power state
958 * scanning/processing refresh interval for Operating mode
959 */
960 .lp_intrvl = CY_LP_INTRVL_DFLT,
961 .sleep_gpio = CYTTSP_TS_GPIO_SLEEP,
962 .resout_gpio = CYTTSP_TS_GPIO_RESOUT,
963 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
964 .regulator_info = cyttsp_regulator_data,
965 .num_regulators = ARRAY_SIZE(cyttsp_regulator_data),
966 .init = cyttsp_platform_init,
967 .correct_fw_ver = 17,
968};
969
970static struct i2c_board_info cyttsp_info[] __initdata = {
971 {
972 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
973 .platform_data = &cyttsp_pdata,
974 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
975 },
976};
Jing Lin21ed4de2012-02-05 15:53:28 -0800977
Ankit Verma6b7e2ba2012-01-26 15:48:54 -0800978#define MSM_WCNSS_PHYS 0x03000000
979#define MSM_WCNSS_SIZE 0x280000
980
981static struct resource resources_wcnss_wlan[] = {
982 {
983 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
984 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
985 .name = "wcnss_wlanrx_irq",
986 .flags = IORESOURCE_IRQ,
987 },
988 {
989 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
990 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
991 .name = "wcnss_wlantx_irq",
992 .flags = IORESOURCE_IRQ,
993 },
994 {
995 .start = MSM_WCNSS_PHYS,
996 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
997 .name = "wcnss_mmio",
998 .flags = IORESOURCE_MEM,
999 },
1000 {
1001 .start = 64,
1002 .end = 68,
1003 .name = "wcnss_gpios_5wire",
1004 .flags = IORESOURCE_IO,
1005 },
1006};
1007
1008static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1009 .has_48mhz_xo = 1,
1010};
1011
1012static struct platform_device msm_device_wcnss_wlan = {
1013 .name = "wcnss_wlan",
1014 .id = 0,
1015 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1016 .resource = resources_wcnss_wlan,
1017 .dev = {.platform_data = &qcom_wcnss_pdata},
1018};
1019
Ankit Vermab7c26e62012-02-28 15:04:15 -08001020static struct platform_device msm_device_iris_fm __devinitdata = {
1021 .name = "iris_fm",
1022 .id = -1,
1023};
1024
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001025#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1026 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1027 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1028 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1029
1030#define QCE_SIZE 0x10000
1031#define QCE_0_BASE 0x11000000
1032
1033#define QCE_HW_KEY_SUPPORT 0
1034#define QCE_SHA_HMAC_SUPPORT 1
1035#define QCE_SHARE_CE_RESOURCE 3
1036#define QCE_CE_SHARED 0
1037
1038static struct resource qcrypto_resources[] = {
1039 [0] = {
1040 .start = QCE_0_BASE,
1041 .end = QCE_0_BASE + QCE_SIZE - 1,
1042 .flags = IORESOURCE_MEM,
1043 },
1044 [1] = {
1045 .name = "crypto_channels",
1046 .start = DMOV8064_CE_IN_CHAN,
1047 .end = DMOV8064_CE_OUT_CHAN,
1048 .flags = IORESOURCE_DMA,
1049 },
1050 [2] = {
1051 .name = "crypto_crci_in",
1052 .start = DMOV8064_CE_IN_CRCI,
1053 .end = DMOV8064_CE_IN_CRCI,
1054 .flags = IORESOURCE_DMA,
1055 },
1056 [3] = {
1057 .name = "crypto_crci_out",
1058 .start = DMOV8064_CE_OUT_CRCI,
1059 .end = DMOV8064_CE_OUT_CRCI,
1060 .flags = IORESOURCE_DMA,
1061 },
1062};
1063
1064static struct resource qcedev_resources[] = {
1065 [0] = {
1066 .start = QCE_0_BASE,
1067 .end = QCE_0_BASE + QCE_SIZE - 1,
1068 .flags = IORESOURCE_MEM,
1069 },
1070 [1] = {
1071 .name = "crypto_channels",
1072 .start = DMOV8064_CE_IN_CHAN,
1073 .end = DMOV8064_CE_OUT_CHAN,
1074 .flags = IORESOURCE_DMA,
1075 },
1076 [2] = {
1077 .name = "crypto_crci_in",
1078 .start = DMOV8064_CE_IN_CRCI,
1079 .end = DMOV8064_CE_IN_CRCI,
1080 .flags = IORESOURCE_DMA,
1081 },
1082 [3] = {
1083 .name = "crypto_crci_out",
1084 .start = DMOV8064_CE_OUT_CRCI,
1085 .end = DMOV8064_CE_OUT_CRCI,
1086 .flags = IORESOURCE_DMA,
1087 },
1088};
1089
1090#endif
1091
1092#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1093 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1094
1095static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1096 .ce_shared = QCE_CE_SHARED,
1097 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1098 .hw_key_support = QCE_HW_KEY_SUPPORT,
1099 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001100 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001101};
1102
1103static struct platform_device qcrypto_device = {
1104 .name = "qcrypto",
1105 .id = 0,
1106 .num_resources = ARRAY_SIZE(qcrypto_resources),
1107 .resource = qcrypto_resources,
1108 .dev = {
1109 .coherent_dma_mask = DMA_BIT_MASK(32),
1110 .platform_data = &qcrypto_ce_hw_suppport,
1111 },
1112};
1113#endif
1114
1115#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1116 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1117
1118static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1119 .ce_shared = QCE_CE_SHARED,
1120 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1121 .hw_key_support = QCE_HW_KEY_SUPPORT,
1122 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001123 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001124};
1125
1126static struct platform_device qcedev_device = {
1127 .name = "qce",
1128 .id = 0,
1129 .num_resources = ARRAY_SIZE(qcedev_resources),
1130 .resource = qcedev_resources,
1131 .dev = {
1132 .coherent_dma_mask = DMA_BIT_MASK(32),
1133 .platform_data = &qcedev_ce_hw_suppport,
1134 },
1135};
1136#endif
1137
Joel Kingdacbc822012-01-25 13:30:57 -08001138static struct mdm_platform_data mdm_platform_data = {
1139 .mdm_version = "3.0",
1140 .ramdump_delay_ms = 2000,
Hemant Kumara945b472012-01-25 15:08:06 -08001141 .peripheral_platform_device = &apq8064_device_hsic_host,
Joel Kingdacbc822012-01-25 13:30:57 -08001142};
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001143
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001144static struct tsens_platform_data apq_tsens_pdata = {
1145 .tsens_factor = 1000,
1146 .hw_type = APQ_8064,
1147 .tsens_num_sensor = 11,
1148 .slope = {1176, 1176, 1154, 1176, 1111,
1149 1132, 1132, 1199, 1132, 1199, 1132},
1150};
1151
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001152#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001153static void __init apq8064_map_io(void)
1154{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001155 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001156 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001157 if (socinfo_init() < 0)
1158 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001159}
1160
1161static void __init apq8064_init_irq(void)
1162{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001163 struct msm_mpm_device_data *data = NULL;
1164
1165#ifdef CONFIG_MSM_MPM
1166 data = &apq8064_mpm_dev_data;
1167#endif
1168
1169 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001170 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1171 (void *)MSM_QGIC_CPU_BASE);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001172}
1173
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001174static struct platform_device msm8064_device_saw_regulator_core0 = {
1175 .name = "saw-regulator",
1176 .id = 0,
1177 .dev = {
1178 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
1179 },
1180};
1181
1182static struct platform_device msm8064_device_saw_regulator_core1 = {
1183 .name = "saw-regulator",
1184 .id = 1,
1185 .dev = {
1186 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
1187 },
1188};
1189
1190static struct platform_device msm8064_device_saw_regulator_core2 = {
1191 .name = "saw-regulator",
1192 .id = 2,
1193 .dev = {
1194 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
1195 },
1196};
1197
1198static struct platform_device msm8064_device_saw_regulator_core3 = {
1199 .name = "saw-regulator",
1200 .id = 3,
1201 .dev = {
1202 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001203
1204 },
1205};
1206
Oluwafemi Adeyemif5a31422012-03-08 16:58:45 -08001207static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001208 {
1209 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1210 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1211 true,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001212 100, 650, 801, 200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001213 },
1214
1215 {
1216 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1217 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1218 true,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001219 2000, 200, 576000, 2000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001220 },
1221
1222 {
1223 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1224 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1225 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001226 8500, 51, 1122000, 8500,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001227 },
1228
1229 {
1230 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1231 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
1232 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001233 9000, 51, 1130300, 9000,
1234 },
1235 {
1236 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1237 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
1238 false,
1239 10000, 51, 1130300, 10000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001240 },
1241
1242 {
1243 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1244 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1245 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001246 12000, 14, 2205900, 12000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001247 },
1248
1249 {
1250 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1251 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1252 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001253 18000, 12, 2364250, 18000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001254 },
1255
1256 {
1257 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1258 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1259 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001260 23500, 10, 2667000, 23500,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001261 },
1262
1263 {
1264 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1265 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1266 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001267 29700, 5, 2867000, 30000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001268 },
1269};
1270
Oluwafemi Adeyemif5a31422012-03-08 16:58:45 -08001271uint32_t apq8064_rpm_get_swfi_latency(void)
1272{
1273 int i;
1274
1275 for (i = 0; i < ARRAY_SIZE(msm_rpmrs_levels); i++) {
1276 if (msm_rpmrs_levels[i].sleep_mode ==
1277 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)
1278 return msm_rpmrs_levels[i].latency_us;
1279 }
1280
1281 return 0;
1282}
1283
Praveen Chidambaram78499012011-11-01 17:15:17 -06001284static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1285 .mode = MSM_PM_BOOT_CONFIG_TZ,
1286};
1287
1288static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
1289 .levels = &msm_rpmrs_levels[0],
1290 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
1291 .vdd_mem_levels = {
1292 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
1293 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
1294 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
1295 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
1296 },
1297 .vdd_dig_levels = {
1298 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
1299 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
1300 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
1301 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
1302 },
1303 .vdd_mask = 0x7FFFFF,
1304 .rpmrs_target_id = {
1305 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
1306 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
1307 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
1308 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
1309 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
1310 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
1311 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
1312 },
1313};
1314
1315static struct msm_cpuidle_state msm_cstates[] __initdata = {
1316 {0, 0, "C0", "WFI",
1317 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1318
1319 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1320 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1321
1322 {0, 2, "C2", "POWER_COLLAPSE",
1323 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
1324
1325 {1, 0, "C0", "WFI",
1326 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1327
1328 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1329 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1330
1331 {2, 0, "C0", "WFI",
1332 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1333
1334 {2, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1335 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1336
1337 {3, 0, "C0", "WFI",
1338 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1339
1340 {3, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1341 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1342};
1343
1344static struct msm_pm_platform_data msm_pm_data[] = {
1345 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1346 .idle_supported = 1,
1347 .suspend_supported = 1,
1348 .idle_enabled = 0,
1349 .suspend_enabled = 0,
1350 },
1351
1352 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1353 .idle_supported = 1,
1354 .suspend_supported = 1,
1355 .idle_enabled = 0,
1356 .suspend_enabled = 0,
1357 },
1358
1359 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1360 .idle_supported = 1,
1361 .suspend_supported = 1,
1362 .idle_enabled = 1,
1363 .suspend_enabled = 1,
1364 },
1365
1366 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1367 .idle_supported = 0,
1368 .suspend_supported = 1,
1369 .idle_enabled = 0,
1370 .suspend_enabled = 0,
1371 },
1372
1373 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1374 .idle_supported = 1,
1375 .suspend_supported = 1,
1376 .idle_enabled = 0,
1377 .suspend_enabled = 0,
1378 },
1379
1380 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1381 .idle_supported = 1,
1382 .suspend_supported = 0,
1383 .idle_enabled = 1,
1384 .suspend_enabled = 0,
1385 },
1386
1387 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1388 .idle_supported = 0,
1389 .suspend_supported = 1,
1390 .idle_enabled = 0,
1391 .suspend_enabled = 0,
1392 },
1393
1394 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1395 .idle_supported = 1,
1396 .suspend_supported = 1,
1397 .idle_enabled = 0,
1398 .suspend_enabled = 0,
1399 },
1400
1401 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1402 .idle_supported = 1,
1403 .suspend_supported = 0,
1404 .idle_enabled = 1,
1405 .suspend_enabled = 0,
1406 },
1407
1408 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1409 .idle_supported = 0,
1410 .suspend_supported = 1,
1411 .idle_enabled = 0,
1412 .suspend_enabled = 0,
1413 },
1414
1415 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1416 .idle_supported = 1,
1417 .suspend_supported = 1,
1418 .idle_enabled = 0,
1419 .suspend_enabled = 0,
1420 },
1421
1422 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1423 .idle_supported = 1,
1424 .suspend_supported = 0,
1425 .idle_enabled = 1,
1426 .suspend_enabled = 0,
1427 },
1428};
1429
1430static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1431 0x03, 0x0f,
1432};
1433
1434static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1435 0x00, 0x24, 0x54, 0x10,
1436 0x09, 0x03, 0x01,
1437 0x10, 0x54, 0x30, 0x0C,
1438 0x24, 0x30, 0x0f,
1439};
1440
1441static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1442 0x00, 0x24, 0x54, 0x10,
1443 0x09, 0x07, 0x01, 0x0B,
1444 0x10, 0x54, 0x30, 0x0C,
1445 0x24, 0x30, 0x0f,
1446};
1447
1448static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1449 [0] = {
1450 .mode = MSM_SPM_MODE_CLOCK_GATING,
1451 .notify_rpm = false,
1452 .cmd = spm_wfi_cmd_sequence,
1453 },
1454 [1] = {
1455 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1456 .notify_rpm = false,
1457 .cmd = spm_power_collapse_without_rpm,
1458 },
1459 [2] = {
1460 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1461 .notify_rpm = true,
1462 .cmd = spm_power_collapse_with_rpm,
1463 },
1464};
1465
1466static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1467 0x00, 0x20, 0x03, 0x20,
1468 0x00, 0x0f,
1469};
1470
1471static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1472 0x00, 0x20, 0x34, 0x64,
1473 0x48, 0x07, 0x48, 0x20,
1474 0x50, 0x64, 0x04, 0x34,
1475 0x50, 0x0f,
1476};
1477static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1478 0x00, 0x10, 0x34, 0x64,
1479 0x48, 0x07, 0x48, 0x10,
1480 0x50, 0x64, 0x04, 0x34,
1481 0x50, 0x0F,
1482};
1483
1484static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1485 [0] = {
1486 .mode = MSM_SPM_L2_MODE_RETENTION,
1487 .notify_rpm = false,
1488 .cmd = l2_spm_wfi_cmd_sequence,
1489 },
1490 [1] = {
1491 .mode = MSM_SPM_L2_MODE_GDHS,
1492 .notify_rpm = true,
1493 .cmd = l2_spm_gdhs_cmd_sequence,
1494 },
1495 [2] = {
1496 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1497 .notify_rpm = true,
1498 .cmd = l2_spm_power_off_cmd_sequence,
1499 },
1500};
1501
1502
1503static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1504 [0] = {
1505 .reg_base_addr = MSM_SAW_L2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001506 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001507 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001508 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1509 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1510 .modes = msm_spm_l2_seq_list,
1511 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1512 },
1513};
1514
1515static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1516 [0] = {
1517 .reg_base_addr = MSM_SAW0_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001518 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001519#if defined(CONFIG_MSM_AVS_HW)
1520 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1521 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1522#endif
1523 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001524 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001525 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1526 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1527 .vctl_timeout_us = 50,
1528 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1529 .modes = msm_spm_seq_list,
1530 },
1531 [1] = {
1532 .reg_base_addr = MSM_SAW1_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001533 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001534#if defined(CONFIG_MSM_AVS_HW)
1535 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1536 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1537#endif
1538 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001539 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001540 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1541 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1542 .vctl_timeout_us = 50,
1543 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1544 .modes = msm_spm_seq_list,
1545 },
1546 [2] = {
1547 .reg_base_addr = MSM_SAW2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001548 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001549#if defined(CONFIG_MSM_AVS_HW)
1550 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1551 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1552#endif
1553 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001554 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001555 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1556 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1557 .vctl_timeout_us = 50,
1558 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1559 .modes = msm_spm_seq_list,
1560 },
1561 [3] = {
1562 .reg_base_addr = MSM_SAW3_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001563 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001564#if defined(CONFIG_MSM_AVS_HW)
1565 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1566 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1567#endif
1568 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001569 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001570 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1571 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1572 .vctl_timeout_us = 50,
1573 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1574 .modes = msm_spm_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001575 },
1576};
1577
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001578static void __init apq8064_init_buses(void)
1579{
1580 msm_bus_rpm_set_mt_mask();
1581 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
1582 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
1583 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
1584 msm_bus_8064_apps_fabric.dev.platform_data =
1585 &msm_bus_8064_apps_fabric_pdata;
1586 msm_bus_8064_sys_fabric.dev.platform_data =
1587 &msm_bus_8064_sys_fabric_pdata;
1588 msm_bus_8064_mm_fabric.dev.platform_data =
1589 &msm_bus_8064_mm_fabric_pdata;
1590 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
1591 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
1592}
1593
David Collinsf0d00732012-01-25 15:46:50 -08001594static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
1595 .name = GPIO_REGULATOR_DEV_NAME,
1596 .id = PM8921_MPP_PM_TO_SYS(7),
1597 .dev = {
1598 .platform_data
1599 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
1600 },
1601};
1602
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08001603static struct platform_device apq8064_device_ext_mpp8_vreg __devinitdata = {
1604 .name = GPIO_REGULATOR_DEV_NAME,
1605 .id = PM8921_MPP_PM_TO_SYS(8),
1606 .dev = {
1607 .platform_data
1608 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_MPP8],
1609 },
1610};
1611
David Collinsf0d00732012-01-25 15:46:50 -08001612static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
1613 .name = GPIO_REGULATOR_DEV_NAME,
1614 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
1615 .dev = {
1616 .platform_data =
1617 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
1618 },
1619};
1620
David Collins390fc332012-02-07 14:38:16 -08001621static struct platform_device apq8064_device_ext_ts_sw_vreg __devinitdata = {
1622 .name = GPIO_REGULATOR_DEV_NAME,
1623 .id = PM8921_GPIO_PM_TO_SYS(23),
1624 .dev = {
1625 .platform_data
1626 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_TS_SW],
1627 },
1628};
1629
David Collins2782b5c2012-02-06 10:02:42 -08001630static struct platform_device apq8064_device_rpm_regulator __devinitdata = {
1631 .name = "rpm-regulator",
1632 .id = -1,
1633 .dev = {
1634 .platform_data = &apq8064_rpm_regulator_pdata,
1635 },
1636};
1637
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001638static struct platform_device *common_devices[] __initdata = {
Jin Hong01f2dbb2011-11-03 22:13:51 -07001639 &apq8064_device_dmov,
David Keitel3c40fc52012-02-09 17:53:52 -08001640 &apq8064_device_qup_i2c_gsbi1,
Jing Lin04601f92012-02-05 15:36:07 -08001641 &apq8064_device_qup_i2c_gsbi3,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001642 &apq8064_device_qup_i2c_gsbi4,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001643 &apq8064_device_qup_spi_gsbi5,
David Collinsf0d00732012-01-25 15:46:50 -08001644 &apq8064_device_ext_5v_vreg,
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08001645 &apq8064_device_ext_mpp8_vreg,
David Collinsf0d00732012-01-25 15:46:50 -08001646 &apq8064_device_ext_3p3v_vreg,
David Collins390fc332012-02-07 14:38:16 -08001647 &apq8064_device_ext_ts_sw_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07001648 &apq8064_device_ssbi_pmic1,
1649 &apq8064_device_ssbi_pmic2,
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001650 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07001651 &apq8064_device_otg,
1652 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08001653 &apq8064_device_hsusb_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07001654 &android_usb_device,
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001655 &msm_device_wcnss_wlan,
Ankit Vermab7c26e62012-02-28 15:04:15 -08001656 &msm_device_iris_fm,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001657#ifdef CONFIG_ANDROID_PMEM
1658#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -07001659 &android_pmem_device,
1660 &android_pmem_adsp_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001661#endif
Kevin Chan13be4e22011-10-20 11:30:32 -07001662 &android_pmem_audio_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001663#endif
1664#ifdef CONFIG_ION_MSM
1665 &ion_dev,
1666#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001667 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001668 &msm8064_device_saw_regulator_core0,
1669 &msm8064_device_saw_regulator_core1,
1670 &msm8064_device_saw_regulator_core2,
1671 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001672#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1673 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1674 &qcrypto_device,
1675#endif
1676
1677#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1678 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1679 &qcedev_device,
1680#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07001681
1682#ifdef CONFIG_HW_RANDOM_MSM
1683 &apq8064_device_rng,
1684#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08001685 &apq_pcm,
1686 &apq_pcm_routing,
1687 &apq_cpudai0,
1688 &apq_cpudai1,
1689 &apq_cpudai_hdmi_rx,
1690 &apq_cpudai_bt_rx,
1691 &apq_cpudai_bt_tx,
1692 &apq_cpudai_fm_rx,
1693 &apq_cpudai_fm_tx,
1694 &apq_cpu_fe,
1695 &apq_stub_codec,
1696 &apq_voice,
1697 &apq_voip,
1698 &apq_lpa_pcm,
1699 &apq_pcm_hostless,
1700 &apq_cpudai_afe_01_rx,
1701 &apq_cpudai_afe_01_tx,
1702 &apq_cpudai_afe_02_rx,
1703 &apq_cpudai_afe_02_tx,
1704 &apq_pcm_afe,
1705 &apq_cpudai_auxpcm_rx,
1706 &apq_cpudai_auxpcm_tx,
Neema Shetty8427c262012-02-16 11:23:43 -08001707 &apq_cpudai_stub,
Neema Shetty3c9d2862012-03-11 01:25:32 -08001708 &apq_cpudai_slimbus_1_rx,
1709 &apq_cpudai_slimbus_1_tx,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001710 &apq8064_rpm_device,
1711 &apq8064_rpm_log_device,
1712 &apq8064_rpm_stat_device,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001713 &msm_bus_8064_apps_fabric,
1714 &msm_bus_8064_sys_fabric,
1715 &msm_bus_8064_mm_fabric,
1716 &msm_bus_8064_sys_fpb,
1717 &msm_bus_8064_cpss_fpb,
Mohan Kumar Gubbihalli Lachma Naik7f72edd2012-02-06 17:26:47 -08001718 &apq8064_msm_device_vidc,
Matt Wagantalled832652012-02-02 19:23:17 -08001719 &msm_8960_riva,
Matt Wagantallb94b9a52012-02-02 21:59:54 -08001720 &msm_8960_q6_lpass,
Matt Wagantall292aace2012-01-26 19:12:34 -08001721 &msm_gss,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001722};
1723
Joel King4e7ad222011-08-17 15:47:38 -07001724static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001725 &apq8064_device_uart_gsbi3,
Yan He06913ce2011-08-26 16:33:46 -07001726 &msm_device_sps_apq8064,
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001727};
1728
1729static struct platform_device *rumi3_devices[] __initdata = {
1730 &apq8064_device_uart_gsbi1,
Yan He435ed612011-11-23 17:34:59 -08001731 &msm_device_sps_apq8064,
Huaibin Yang4a084e32011-12-15 15:25:52 -08001732#ifdef CONFIG_MSM_ROTATOR
1733 &msm_rotator_device,
1734#endif
Joel King4e7ad222011-08-17 15:47:38 -07001735};
1736
Joel King82b7e3f2012-01-05 10:03:27 -08001737static struct platform_device *cdp_devices[] __initdata = {
1738 &apq8064_device_uart_gsbi1,
Jin Hong4bbbfba2012-02-02 21:48:07 -08001739 &apq8064_device_uart_gsbi7,
Joel King82b7e3f2012-01-05 10:03:27 -08001740 &msm_device_sps_apq8064,
Aravind Venkateswaran4ca27532012-02-16 14:27:05 -08001741#ifdef CONFIG_MSM_ROTATOR
1742 &msm_rotator_device,
1743#endif
Joel King82b7e3f2012-01-05 10:03:27 -08001744};
1745
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001746static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08001747 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001748};
1749
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001750#define KS8851_IRQ_GPIO 43
1751
1752static struct spi_board_info spi_board_info[] __initdata = {
1753 {
1754 .modalias = "ks8851",
1755 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1756 .max_speed_hz = 19200000,
1757 .bus_num = 0,
1758 .chip_select = 2,
1759 .mode = SPI_MODE_0,
1760 },
1761};
1762
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001763static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001764 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001765 .bus_num = 1,
1766 .slim_slave = &apq8064_slim_tabla,
1767 },
1768 {
1769 .bus_num = 1,
1770 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001771 },
1772 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001773};
1774
David Keitel3c40fc52012-02-09 17:53:52 -08001775static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi1_pdata = {
1776 .clk_freq = 100000,
1777 .src_clk_rate = 24000000,
1778};
1779
Jing Lin04601f92012-02-05 15:36:07 -08001780static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi3_pdata = {
1781 .clk_freq = 100000,
1782 .src_clk_rate = 24000000,
1783};
1784
Kenneth Heitke748593a2011-07-15 15:45:11 -06001785static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
1786 .clk_freq = 100000,
1787 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001788};
1789
David Keitel3c40fc52012-02-09 17:53:52 -08001790#define GSBI_DUAL_MODE_CODE 0x60
1791#define MSM_GSBI1_PHYS 0x12440000
Kenneth Heitke748593a2011-07-15 15:45:11 -06001792static void __init apq8064_i2c_init(void)
1793{
David Keitel3c40fc52012-02-09 17:53:52 -08001794 void __iomem *gsbi_mem;
1795
1796 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
1797 &apq8064_i2c_qup_gsbi1_pdata;
1798 gsbi_mem = ioremap_nocache(MSM_GSBI1_PHYS, 4);
1799 writel_relaxed(GSBI_DUAL_MODE_CODE, gsbi_mem);
1800 /* Ensure protocol code is written before proceeding */
1801 wmb();
1802 iounmap(gsbi_mem);
1803 apq8064_i2c_qup_gsbi1_pdata.use_gsbi_shared_mode = 1;
Jing Lin04601f92012-02-05 15:36:07 -08001804 apq8064_device_qup_i2c_gsbi3.dev.platform_data =
1805 &apq8064_i2c_qup_gsbi3_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06001806 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
1807 &apq8064_i2c_qup_gsbi4_pdata;
1808}
1809
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08001810#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001811static int ethernet_init(void)
1812{
1813 int ret;
1814 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
1815 if (ret) {
1816 pr_err("ks8851 gpio_request failed: %d\n", ret);
1817 goto fail;
1818 }
1819
1820 return 0;
1821fail:
1822 return ret;
1823}
1824#else
1825static int ethernet_init(void)
1826{
1827 return 0;
1828}
1829#endif
1830
Mohan Pallaka474b94b2012-01-25 12:59:58 +05301831#define GPIO_KEY_HOME PM8921_GPIO_PM_TO_SYS(27)
1832#define GPIO_KEY_VOLUME_UP PM8921_GPIO_PM_TO_SYS(35)
1833#define GPIO_KEY_VOLUME_DOWN PM8921_GPIO_PM_TO_SYS(38)
1834#define GPIO_KEY_CAM_FOCUS PM8921_GPIO_PM_TO_SYS(3)
1835#define GPIO_KEY_CAM_SNAP PM8921_GPIO_PM_TO_SYS(4)
Jing Lin3f8f8422012-03-05 09:32:11 -08001836#define GPIO_KEY_ROTATION PM8921_GPIO_PM_TO_SYS(42)
Mohan Pallaka474b94b2012-01-25 12:59:58 +05301837
1838static struct gpio_keys_button cdp_keys[] = {
1839 {
1840 .code = KEY_HOME,
1841 .gpio = GPIO_KEY_HOME,
1842 .desc = "home_key",
1843 .active_low = 1,
1844 .type = EV_KEY,
1845 .wakeup = 1,
1846 .debounce_interval = 15,
1847 },
1848 {
1849 .code = KEY_VOLUMEUP,
1850 .gpio = GPIO_KEY_VOLUME_UP,
1851 .desc = "volume_up_key",
1852 .active_low = 1,
1853 .type = EV_KEY,
1854 .wakeup = 1,
1855 .debounce_interval = 15,
1856 },
1857 {
1858 .code = KEY_VOLUMEDOWN,
1859 .gpio = GPIO_KEY_VOLUME_DOWN,
1860 .desc = "volume_down_key",
1861 .active_low = 1,
1862 .type = EV_KEY,
1863 .wakeup = 1,
1864 .debounce_interval = 15,
1865 },
1866 {
1867 .code = SW_ROTATE_LOCK,
1868 .gpio = GPIO_KEY_ROTATION,
1869 .desc = "rotate_key",
1870 .active_low = 1,
1871 .type = EV_SW,
1872 .debounce_interval = 15,
1873 },
1874};
1875
1876static struct gpio_keys_platform_data cdp_keys_data = {
1877 .buttons = cdp_keys,
1878 .nbuttons = ARRAY_SIZE(cdp_keys),
1879};
1880
1881static struct platform_device cdp_kp_pdev = {
1882 .name = "gpio-keys",
1883 .id = -1,
1884 .dev = {
1885 .platform_data = &cdp_keys_data,
1886 },
1887};
1888
1889static struct gpio_keys_button mtp_keys[] = {
1890 {
1891 .code = KEY_CAMERA_FOCUS,
1892 .gpio = GPIO_KEY_CAM_FOCUS,
1893 .desc = "cam_focus_key",
1894 .active_low = 1,
1895 .type = EV_KEY,
1896 .wakeup = 1,
1897 .debounce_interval = 15,
1898 },
1899 {
1900 .code = KEY_VOLUMEUP,
1901 .gpio = GPIO_KEY_VOLUME_UP,
1902 .desc = "volume_up_key",
1903 .active_low = 1,
1904 .type = EV_KEY,
1905 .wakeup = 1,
1906 .debounce_interval = 15,
1907 },
1908 {
1909 .code = KEY_VOLUMEDOWN,
1910 .gpio = GPIO_KEY_VOLUME_DOWN,
1911 .desc = "volume_down_key",
1912 .active_low = 1,
1913 .type = EV_KEY,
1914 .wakeup = 1,
1915 .debounce_interval = 15,
1916 },
1917 {
1918 .code = KEY_CAMERA_SNAPSHOT,
1919 .gpio = GPIO_KEY_CAM_SNAP,
1920 .desc = "cam_snap_key",
1921 .active_low = 1,
1922 .type = EV_KEY,
1923 .debounce_interval = 15,
1924 },
1925};
1926
1927static struct gpio_keys_platform_data mtp_keys_data = {
1928 .buttons = mtp_keys,
1929 .nbuttons = ARRAY_SIZE(mtp_keys),
1930};
1931
1932static struct platform_device mtp_kp_pdev = {
1933 .name = "gpio-keys",
1934 .id = -1,
1935 .dev = {
1936 .platform_data = &mtp_keys_data,
1937 },
1938};
1939
Jin Hongd3024e62012-02-09 16:13:32 -08001940/* Sensors DSPS platform data */
1941#define DSPS_PIL_GENERIC_NAME "dsps"
1942static void __init apq8064_init_dsps(void)
1943{
1944 struct msm_dsps_platform_data *pdata =
1945 msm_dsps_device_8064.dev.platform_data;
1946 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
1947 pdata->gpios = NULL;
1948 pdata->gpios_num = 0;
1949
1950 platform_device_register(&msm_dsps_device_8064);
1951}
Mohan Pallaka474b94b2012-01-25 12:59:58 +05301952
Tianyi Gou41515e22011-09-01 19:37:43 -07001953static void __init apq8064_clock_init(void)
1954{
Tianyi Gouacb588d2012-01-27 18:24:05 -08001955 if (machine_is_apq8064_rumi3())
Tianyi Gou41515e22011-09-01 19:37:43 -07001956 msm_clock_init(&apq8064_dummy_clock_init_data);
Tianyi Gouacb588d2012-01-27 18:24:05 -08001957 else
1958 msm_clock_init(&apq8064_clock_init_data);
Tianyi Gou41515e22011-09-01 19:37:43 -07001959}
1960
Jing Lin417fa452012-02-05 14:31:06 -08001961#define I2C_SURF 1
1962#define I2C_FFA (1 << 1)
1963#define I2C_RUMI (1 << 2)
1964#define I2C_SIM (1 << 3)
1965#define I2C_LIQUID (1 << 4)
1966
1967struct i2c_registry {
1968 u8 machs;
1969 int bus;
1970 struct i2c_board_info *info;
1971 int len;
1972};
1973
1974static struct i2c_registry apq8064_i2c_devices[] __initdata = {
Jing Lin21ed4de2012-02-05 15:53:28 -08001975 {
1976 I2C_SURF | I2C_LIQUID,
1977 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
1978 mxt_device_info,
1979 ARRAY_SIZE(mxt_device_info),
1980 },
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001981 {
1982 I2C_FFA,
1983 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
1984 cyttsp_info,
1985 ARRAY_SIZE(cyttsp_info),
1986 },
Amy Maloche70090f992012-02-16 16:35:26 -08001987 {
1988 I2C_FFA | I2C_LIQUID,
1989 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
1990 isa1200_board_info,
1991 ARRAY_SIZE(isa1200_board_info),
1992 },
Jing Lin417fa452012-02-05 14:31:06 -08001993};
1994
1995static void __init register_i2c_devices(void)
1996{
1997 u8 mach_mask = 0;
1998 int i;
1999
Kevin Chand07220e2012-02-13 15:52:22 -08002000#ifdef CONFIG_MSM_CAMERA
2001 struct i2c_registry apq8064_camera_i2c_devices = {
2002 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_RUMI,
2003 APQ_8064_GSBI4_QUP_I2C_BUS_ID,
2004 apq8064_camera_board_info.board_info,
2005 apq8064_camera_board_info.num_i2c_board_info,
2006 };
2007#endif
Jing Lin417fa452012-02-05 14:31:06 -08002008 /* Build the matching 'supported_machs' bitmask */
2009 if (machine_is_apq8064_cdp())
2010 mach_mask = I2C_SURF;
2011 else if (machine_is_apq8064_mtp())
2012 mach_mask = I2C_FFA;
2013 else if (machine_is_apq8064_liquid())
2014 mach_mask = I2C_LIQUID;
2015 else if (machine_is_apq8064_rumi3())
2016 mach_mask = I2C_RUMI;
2017 else if (machine_is_apq8064_sim())
2018 mach_mask = I2C_SIM;
2019 else
2020 pr_err("unmatched machine ID in register_i2c_devices\n");
2021
2022 /* Run the array and install devices as appropriate */
2023 for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) {
2024 if (apq8064_i2c_devices[i].machs & mach_mask)
2025 i2c_register_board_info(apq8064_i2c_devices[i].bus,
2026 apq8064_i2c_devices[i].info,
2027 apq8064_i2c_devices[i].len);
2028 }
Kevin Chand07220e2012-02-13 15:52:22 -08002029#ifdef CONFIG_MSM_CAMERA
2030 if (apq8064_camera_i2c_devices.machs & mach_mask)
2031 i2c_register_board_info(apq8064_camera_i2c_devices.bus,
2032 apq8064_camera_i2c_devices.info,
2033 apq8064_camera_i2c_devices.len);
2034#endif
Jing Lin417fa452012-02-05 14:31:06 -08002035}
2036
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002037static void __init apq8064_common_init(void)
2038{
2039 if (socinfo_init() < 0)
2040 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06002041 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
2042 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
David Collins2782b5c2012-02-06 10:02:42 -08002043 regulator_suppress_info_printing();
2044 platform_device_register(&apq8064_device_rpm_regulator);
Stephen Boyd4d0d2582012-02-10 14:49:40 -08002045 if (msm_xo_init())
2046 pr_err("Failed to initialize XO votes\n");
Tianyi Gou41515e22011-09-01 19:37:43 -07002047 apq8064_clock_init();
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08002048 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06002049 apq8064_i2c_init();
Jing Lin417fa452012-02-05 14:31:06 -08002050 register_i2c_devices();
Kenneth Heitke36920d32011-07-20 16:44:30 -06002051
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002052 apq8064_device_qup_spi_gsbi5.dev.platform_data =
2053 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08002054 apq8064_init_pmic();
Hemant Kumar94e7da22012-02-03 16:52:29 -08002055 if (machine_is_apq8064_liquid())
2056 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002057 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Manu Gautam91223e02011-11-08 15:27:22 +05302058 apq8064_ehci_host_init();
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002059 apq8064_init_buses();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002060 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Hemant Kumarf1ca9192012-02-07 18:59:33 -08002061 if (machine_is_apq8064_mtp()) {
2062 apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
2063 device_initialize(&apq8064_device_hsic_host.dev);
2064 }
Jay Chokshie8741282012-01-25 15:22:55 -08002065 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05302066 apq8064_init_mmc();
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08002067
2068 if (machine_is_apq8064_mtp()) {
2069 mdm_8064_device.dev.platform_data = &mdm_platform_data;
2070 platform_device_register(&mdm_8064_device);
2071 }
2072 platform_device_register(&apq8064_slim_ctrl);
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002073 slim_register_board_info(apq8064_slim_devices,
2074 ARRAY_SIZE(apq8064_slim_devices));
Jin Hongd3024e62012-02-09 16:13:32 -08002075 apq8064_init_dsps();
Praveen Chidambaram78499012011-11-01 17:15:17 -06002076 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Mahesh Sivasubramaniancbce1ec2012-01-24 10:32:44 -07002077 acpuclk_init(&acpuclk_8064_soc_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002078 msm_spm_l2_init(msm_spm_l2_data);
2079 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2080 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2081 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2082 msm_pm_data);
2083 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002084}
2085
Huaibin Yang4a084e32011-12-15 15:25:52 -08002086static void __init apq8064_allocate_memory_regions(void)
2087{
2088 apq8064_allocate_fb_region();
2089}
2090
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002091static void __init apq8064_sim_init(void)
2092{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002093 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
2094 &msm8064_device_watchdog.dev.platform_data;
2095
2096 wdog_pdata->bark_time = 15000;
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002097 msm_tsens_early_init(&apq_tsens_pdata);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002098 apq8064_common_init();
Joel King4e7ad222011-08-17 15:47:38 -07002099 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
2100}
2101
2102static void __init apq8064_rumi3_init(void)
2103{
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002104 msm_tsens_early_init(&apq_tsens_pdata);
Joel King4e7ad222011-08-17 15:47:38 -07002105 apq8064_common_init();
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002106 ethernet_init();
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002107 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002108 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Huaibin Yang4a084e32011-12-15 15:25:52 -08002109 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07002110 apq8064_init_gpu();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002111}
2112
Joel King82b7e3f2012-01-05 10:03:27 -08002113static void __init apq8064_cdp_init(void)
2114{
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002115 msm_tsens_early_init(&apq_tsens_pdata);
Joel King82b7e3f2012-01-05 10:03:27 -08002116 apq8064_common_init();
2117 ethernet_init();
2118 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
2119 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002120 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07002121 apq8064_init_gpu();
Matt Wagantall1875d322012-02-22 16:11:33 -08002122 platform_add_devices(apq8064_fs_devices, apq8064_num_fs_devices);
Kevin Chand07220e2012-02-13 15:52:22 -08002123 apq8064_init_cam();
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302124
2125 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
2126 platform_device_register(&cdp_kp_pdev);
2127
2128 if (machine_is_apq8064_mtp())
2129 platform_device_register(&mtp_kp_pdev);
Joel King82b7e3f2012-01-05 10:03:27 -08002130}
2131
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002132MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
2133 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002134 .reserve = apq8064_reserve,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002135 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302136 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002137 .timer = &msm_timer,
2138 .init_machine = apq8064_sim_init,
2139MACHINE_END
2140
Joel King4e7ad222011-08-17 15:47:38 -07002141MACHINE_START(APQ8064_RUMI3, "QCT APQ8064 RUMI3")
2142 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002143 .reserve = apq8064_reserve,
Joel King4e7ad222011-08-17 15:47:38 -07002144 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302145 .handle_irq = gic_handle_irq,
Joel King4e7ad222011-08-17 15:47:38 -07002146 .timer = &msm_timer,
2147 .init_machine = apq8064_rumi3_init,
Huaibin Yang4a084e32011-12-15 15:25:52 -08002148 .init_early = apq8064_allocate_memory_regions,
Joel King4e7ad222011-08-17 15:47:38 -07002149MACHINE_END
2150
Joel King82b7e3f2012-01-05 10:03:27 -08002151MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
2152 .map_io = apq8064_map_io,
2153 .reserve = apq8064_reserve,
2154 .init_irq = apq8064_init_irq,
2155 .handle_irq = gic_handle_irq,
2156 .timer = &msm_timer,
2157 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002158 .init_early = apq8064_allocate_memory_regions,
Joel King82b7e3f2012-01-05 10:03:27 -08002159MACHINE_END
2160
2161MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
2162 .map_io = apq8064_map_io,
2163 .reserve = apq8064_reserve,
2164 .init_irq = apq8064_init_irq,
2165 .handle_irq = gic_handle_irq,
2166 .timer = &msm_timer,
2167 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002168 .init_early = apq8064_allocate_memory_regions,
Joel King82b7e3f2012-01-05 10:03:27 -08002169MACHINE_END
2170
2171MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
2172 .map_io = apq8064_map_io,
2173 .reserve = apq8064_reserve,
2174 .init_irq = apq8064_init_irq,
2175 .handle_irq = gic_handle_irq,
2176 .timer = &msm_timer,
2177 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002178 .init_early = apq8064_allocate_memory_regions,
Joel King82b7e3f2012-01-05 10:03:27 -08002179MACHINE_END
2180
Joel King11ca8202012-02-13 16:19:03 -08002181MACHINE_START(MPQ8064_HRD, "QCT MPQ8064 HRD")
2182 .map_io = apq8064_map_io,
2183 .reserve = apq8064_reserve,
2184 .init_irq = apq8064_init_irq,
2185 .handle_irq = gic_handle_irq,
2186 .timer = &msm_timer,
2187 .init_machine = apq8064_cdp_init,
2188MACHINE_END
2189
2190MACHINE_START(MPQ8064_DTV, "QCT MPQ8064 DTV")
2191 .map_io = apq8064_map_io,
2192 .reserve = apq8064_reserve,
2193 .init_irq = apq8064_init_irq,
2194 .handle_irq = gic_handle_irq,
2195 .timer = &msm_timer,
2196 .init_machine = apq8064_cdp_init,
2197MACHINE_END
2198