blob: f7677f4f6824a46eee89b7fd50f8de356261c614 [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>
Laura Abbott350c8362012-02-28 14:46:52 -080063#include <mach/msm_rtb.h>
Joel King4ebccc62011-07-22 09:43:22 -070064
Jeff Ohlstein7e668552011-10-06 16:17:25 -070065#include "msm_watchdog.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080066#include "board-8064.h"
Vikram Mulukutlabc2e9572011-11-04 03:41:38 -070067#include "acpuclock.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060068#include "spm.h"
69#include "mpm.h"
70#include "rpm_resources.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080071#include "pm.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060072#include "pm-boot.h"
Rajesh Sastrulaaee8af32012-01-20 11:46:31 -080073#include "devices-msm8x60.h"
Jay Chokshiea67c622011-07-29 17:12:26 -070074
Olav Haugan7c6aa742012-01-16 16:47:37 -080075#define MSM_PMEM_ADSP_SIZE 0x7800000
Ben Romberger3ffcd812011-12-08 19:12:10 -080076#define MSM_PMEM_AUDIO_SIZE 0x2B4000
Olav Haugan7c6aa742012-01-16 16:47:37 -080077#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
78#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
79#else
Chetan Kalyan72aac4f2012-02-23 14:56:54 -080080#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Olav Haugan7c6aa742012-01-16 16:47:37 -080081#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070082
Olav Haugan7c6aa742012-01-16 16:47:37 -080083#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Olav Hauganedcf6832012-01-24 08:35:41 -080084#define MSM_PMEM_KERNEL_EBI1_SIZE 0x280000
Olav Haugan7c6aa742012-01-16 16:47:37 -080085#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Haugand3d29682012-01-19 10:57:07 -080086#define MSM_ION_MM_FW_SIZE 0x200000 /* (2MB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -080087#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Haugan3a9bd232012-02-15 14:23:27 -080088#define MSM_ION_QSECOM_SIZE 0x300000 /* (3MB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -080089#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan2c43fac2012-01-19 11:06:37 -080090#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
91#define MSM_ION_HEAP_NUM 8
Olav Haugan7c6aa742012-01-16 16:47:37 -080092#else
93#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
94#define MSM_ION_HEAP_NUM 1
95#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070096
Siddartha Mohanadoss9c658982012-02-28 15:11:48 -080097#define GPIO_EXPANDER_IRQ_BASE (PM8821_IRQ_BASE + PM8821_NR_IRQS)
98#define GPIO_EXPANDER_GPIO_BASE (PM8821_MPP_BASE + PM8821_NR_MPPS)
99#define GPIO_EPM_EXPANDER_BASE GPIO_EXPANDER_GPIO_BASE
100
101enum {
102 SX150X_EPM,
103};
104
Olav Haugan7c6aa742012-01-16 16:47:37 -0800105#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
106static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
107static int __init pmem_kernel_ebi1_size_setup(char *p)
Kevin Chan13be4e22011-10-20 11:30:32 -0700108{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800109 pmem_kernel_ebi1_size = memparse(p, NULL);
110 return 0;
Kevin Chan13be4e22011-10-20 11:30:32 -0700111}
Olav Haugan7c6aa742012-01-16 16:47:37 -0800112early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
113#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700114
Olav Haugan7c6aa742012-01-16 16:47:37 -0800115#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -0700116static unsigned pmem_size = MSM_PMEM_SIZE;
117static int __init pmem_size_setup(char *p)
118{
119 pmem_size = memparse(p, NULL);
120 return 0;
121}
122early_param("pmem_size", pmem_size_setup);
123
124static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
125
126static int __init pmem_adsp_size_setup(char *p)
127{
128 pmem_adsp_size = memparse(p, NULL);
129 return 0;
130}
131early_param("pmem_adsp_size", pmem_adsp_size_setup);
132
133static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
134
135static int __init pmem_audio_size_setup(char *p)
136{
137 pmem_audio_size = memparse(p, NULL);
138 return 0;
139}
140early_param("pmem_audio_size", pmem_audio_size_setup);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800141#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700142
Olav Haugan7c6aa742012-01-16 16:47:37 -0800143#ifdef CONFIG_ANDROID_PMEM
144#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700145static struct android_pmem_platform_data android_pmem_pdata = {
146 .name = "pmem",
147 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
148 .cached = 1,
149 .memory_type = MEMTYPE_EBI1,
150};
151
152static struct platform_device android_pmem_device = {
153 .name = "android_pmem",
154 .id = 0,
155 .dev = {.platform_data = &android_pmem_pdata},
156};
157
158static struct android_pmem_platform_data android_pmem_adsp_pdata = {
159 .name = "pmem_adsp",
160 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
161 .cached = 0,
162 .memory_type = MEMTYPE_EBI1,
163};
Kevin Chan13be4e22011-10-20 11:30:32 -0700164static struct platform_device android_pmem_adsp_device = {
165 .name = "android_pmem",
166 .id = 2,
167 .dev = { .platform_data = &android_pmem_adsp_pdata },
168};
Olav Haugan7c6aa742012-01-16 16:47:37 -0800169#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700170
171static struct android_pmem_platform_data android_pmem_audio_pdata = {
172 .name = "pmem_audio",
173 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
174 .cached = 0,
175 .memory_type = MEMTYPE_EBI1,
176};
177
178static struct platform_device android_pmem_audio_device = {
179 .name = "android_pmem",
180 .id = 4,
181 .dev = { .platform_data = &android_pmem_audio_pdata },
182};
Olav Haugan7c6aa742012-01-16 16:47:37 -0800183#endif
184
185static struct memtype_reserve apq8064_reserve_table[] __initdata = {
186 [MEMTYPE_SMI] = {
187 },
188 [MEMTYPE_EBI0] = {
189 .flags = MEMTYPE_FLAGS_1M_ALIGN,
190 },
191 [MEMTYPE_EBI1] = {
192 .flags = MEMTYPE_FLAGS_1M_ALIGN,
193 },
194};
Kevin Chan13be4e22011-10-20 11:30:32 -0700195
Laura Abbott350c8362012-02-28 14:46:52 -0800196#if defined(CONFIG_MSM_RTB)
197static struct msm_rtb_platform_data msm_rtb_pdata = {
198 .size = SZ_1M,
199};
200
201static int __init msm_rtb_set_buffer_size(char *p)
202{
203 int s;
204
205 s = memparse(p, NULL);
206 msm_rtb_pdata.size = ALIGN(s, SZ_4K);
207 return 0;
208}
209early_param("msm_rtb_size", msm_rtb_set_buffer_size);
210
211
212static struct platform_device msm_rtb_device = {
213 .name = "msm_rtb",
214 .id = -1,
215 .dev = {
216 .platform_data = &msm_rtb_pdata,
217 },
218};
219#endif
220
221static void __init reserve_rtb_memory(void)
222{
223#if defined(CONFIG_MSM_RTB)
224 apq8064_reserve_table[MEMTYPE_EBI1].size += msm_rtb_pdata.size;
225#endif
226}
227
228
Kevin Chan13be4e22011-10-20 11:30:32 -0700229static void __init size_pmem_devices(void)
230{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800231#ifdef CONFIG_ANDROID_PMEM
232#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700233 android_pmem_adsp_pdata.size = pmem_adsp_size;
234 android_pmem_pdata.size = pmem_size;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800235#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700236 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800237#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700238}
239
240static void __init reserve_memory_for(struct android_pmem_platform_data *p)
241{
242 apq8064_reserve_table[p->memory_type].size += p->size;
243}
244
Kevin Chan13be4e22011-10-20 11:30:32 -0700245static void __init reserve_pmem_memory(void)
246{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800247#ifdef CONFIG_ANDROID_PMEM
248#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700249 reserve_memory_for(&android_pmem_adsp_pdata);
250 reserve_memory_for(&android_pmem_pdata);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800251#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700252 reserve_memory_for(&android_pmem_audio_pdata);
253 apq8064_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800254#endif
255}
256
257static int apq8064_paddr_to_memtype(unsigned int paddr)
258{
259 return MEMTYPE_EBI1;
260}
261
262#ifdef CONFIG_ION_MSM
263#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
264static struct ion_cp_heap_pdata cp_mm_ion_pdata = {
265 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugand3d29682012-01-19 10:57:07 -0800266 .align = PAGE_SIZE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800267};
268
269static struct ion_cp_heap_pdata cp_mfc_ion_pdata = {
270 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugand3d29682012-01-19 10:57:07 -0800271 .align = PAGE_SIZE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800272};
273
274static struct ion_co_heap_pdata co_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800275 .adjacent_mem_id = INVALID_HEAP_ID,
276 .align = PAGE_SIZE,
277};
278
279static struct ion_co_heap_pdata fw_co_ion_pdata = {
280 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
281 .align = SZ_128K,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800282};
283#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800284
285/**
286 * These heaps are listed in the order they will be allocated. Due to
287 * video hardware restrictions and content protection the FW heap has to
288 * be allocated adjacent (below) the MM heap and the MFC heap has to be
289 * allocated after the MM heap to ensure MFC heap is not more than 256MB
290 * away from the base address of the FW heap.
291 * However, the order of FW heap and MM heap doesn't matter since these
292 * two heaps are taken care of by separate code to ensure they are adjacent
293 * to each other.
294 * Don't swap the order unless you know what you are doing!
295 */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800296static struct ion_platform_data ion_pdata = {
297 .nr = MSM_ION_HEAP_NUM,
298 .heaps = {
299 {
300 .id = ION_SYSTEM_HEAP_ID,
301 .type = ION_HEAP_TYPE_SYSTEM,
302 .name = ION_VMALLOC_HEAP_NAME,
303 },
304#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
305 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800306 .id = ION_CP_MM_HEAP_ID,
307 .type = ION_HEAP_TYPE_CP,
308 .name = ION_MM_HEAP_NAME,
309 .size = MSM_ION_MM_SIZE,
310 .memory_type = ION_EBI_TYPE,
311 .extra_data = (void *) &cp_mm_ion_pdata,
312 },
313 {
Olav Haugand3d29682012-01-19 10:57:07 -0800314 .id = ION_MM_FIRMWARE_HEAP_ID,
315 .type = ION_HEAP_TYPE_CARVEOUT,
316 .name = ION_MM_FIRMWARE_HEAP_NAME,
317 .size = MSM_ION_MM_FW_SIZE,
318 .memory_type = ION_EBI_TYPE,
319 .extra_data = (void *) &fw_co_ion_pdata,
320 },
321 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800322 .id = ION_CP_MFC_HEAP_ID,
323 .type = ION_HEAP_TYPE_CP,
324 .name = ION_MFC_HEAP_NAME,
325 .size = MSM_ION_MFC_SIZE,
326 .memory_type = ION_EBI_TYPE,
327 .extra_data = (void *) &cp_mfc_ion_pdata,
328 },
329 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800330 .id = ION_SF_HEAP_ID,
331 .type = ION_HEAP_TYPE_CARVEOUT,
332 .name = ION_SF_HEAP_NAME,
333 .size = MSM_ION_SF_SIZE,
334 .memory_type = ION_EBI_TYPE,
335 .extra_data = (void *) &co_ion_pdata,
336 },
337 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800338 .id = ION_IOMMU_HEAP_ID,
339 .type = ION_HEAP_TYPE_IOMMU,
340 .name = ION_IOMMU_HEAP_NAME,
341 },
Olav Hauganf45e2142012-01-19 11:01:01 -0800342 {
343 .id = ION_QSECOM_HEAP_ID,
344 .type = ION_HEAP_TYPE_CARVEOUT,
345 .name = ION_QSECOM_HEAP_NAME,
346 .size = MSM_ION_QSECOM_SIZE,
347 .memory_type = ION_EBI_TYPE,
348 .extra_data = (void *) &co_ion_pdata,
349 },
Olav Haugan2c43fac2012-01-19 11:06:37 -0800350 {
351 .id = ION_AUDIO_HEAP_ID,
352 .type = ION_HEAP_TYPE_CARVEOUT,
353 .name = ION_AUDIO_HEAP_NAME,
354 .size = MSM_ION_AUDIO_SIZE,
355 .memory_type = ION_EBI_TYPE,
356 .extra_data = (void *) &co_ion_pdata,
357 },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800358#endif
359 }
360};
361
362static struct platform_device ion_dev = {
363 .name = "ion-msm",
364 .id = 1,
365 .dev = { .platform_data = &ion_pdata },
366};
367#endif
368
369static void reserve_ion_memory(void)
370{
371#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
372 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_SIZE;
Olav Haugand3d29682012-01-19 10:57:07 -0800373 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_FW_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800374 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_SF_SIZE;
375 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MFC_SIZE;
Olav Hauganf45e2142012-01-19 11:01:01 -0800376 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_QSECOM_SIZE;
Olav Haugan2c43fac2012-01-19 11:06:37 -0800377 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_AUDIO_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800378#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700379}
380
Huaibin Yang4a084e32011-12-15 15:25:52 -0800381static void __init reserve_mdp_memory(void)
382{
383 apq8064_mdp_writeback(apq8064_reserve_table);
384}
385
Kevin Chan13be4e22011-10-20 11:30:32 -0700386static void __init apq8064_calculate_reserve_sizes(void)
387{
388 size_pmem_devices();
389 reserve_pmem_memory();
Olav Haugan7c6aa742012-01-16 16:47:37 -0800390 reserve_ion_memory();
Huaibin Yang4a084e32011-12-15 15:25:52 -0800391 reserve_mdp_memory();
Laura Abbott350c8362012-02-28 14:46:52 -0800392 reserve_rtb_memory();
Kevin Chan13be4e22011-10-20 11:30:32 -0700393}
394
395static struct reserve_info apq8064_reserve_info __initdata = {
396 .memtype_reserve_table = apq8064_reserve_table,
397 .calculate_reserve_sizes = apq8064_calculate_reserve_sizes,
398 .paddr_to_memtype = apq8064_paddr_to_memtype,
399};
400
401static int apq8064_memory_bank_size(void)
402{
403 return 1<<29;
404}
405
406static void __init locate_unstable_memory(void)
407{
408 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
409 unsigned long bank_size;
410 unsigned long low, high;
411
412 bank_size = apq8064_memory_bank_size();
413 low = meminfo.bank[0].start;
414 high = mb->start + mb->size;
Olav Haugand76e3a82012-01-16 16:55:07 -0800415
416 /* Check if 32 bit overflow occured */
417 if (high < mb->start)
418 high = ~0UL;
419
Kevin Chan13be4e22011-10-20 11:30:32 -0700420 low &= ~(bank_size - 1);
421
422 if (high - low <= bank_size)
423 return;
Jack Cheung46bfffa2012-01-19 15:26:24 -0800424 apq8064_reserve_info.low_unstable_address = mb->start -
425 MIN_MEMORY_BLOCK_SIZE + mb->size;
426 apq8064_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
427
Kevin Chan13be4e22011-10-20 11:30:32 -0700428 apq8064_reserve_info.bank_size = bank_size;
429 pr_info("low unstable address %lx max size %lx bank size %lx\n",
430 apq8064_reserve_info.low_unstable_address,
431 apq8064_reserve_info.max_unstable_size,
432 apq8064_reserve_info.bank_size);
433}
434
Aravind Venkateswaran8ac7f412012-03-16 17:57:30 -0700435static char prim_panel_name[PANEL_NAME_MAX_LEN];
436static char ext_panel_name[PANEL_NAME_MAX_LEN];
437static int __init prim_display_setup(char *param)
438{
439 if (strnlen(param, PANEL_NAME_MAX_LEN))
440 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
441 return 0;
442}
443early_param("prim_display", prim_display_setup);
444
445static int __init ext_display_setup(char *param)
446{
447 if (strnlen(param, PANEL_NAME_MAX_LEN))
448 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
449 return 0;
450}
451early_param("ext_display", ext_display_setup);
452
Kevin Chan13be4e22011-10-20 11:30:32 -0700453static void __init apq8064_reserve(void)
454{
Aravind Venkateswaran8ac7f412012-03-16 17:57:30 -0700455 apq8064_set_display_params(prim_panel_name, ext_panel_name);
Kevin Chan13be4e22011-10-20 11:30:32 -0700456 reserve_info = &apq8064_reserve_info;
457 locate_unstable_memory();
458 msm_reserve();
459}
460
Hemant Kumara945b472012-01-25 15:08:06 -0800461#ifdef CONFIG_USB_EHCI_MSM_HSIC
462static struct msm_hsic_host_platform_data msm_hsic_pdata = {
463 .strobe = 88,
464 .data = 89,
465};
466#else
467static struct msm_hsic_host_platform_data msm_hsic_pdata;
468#endif
469
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800470#define PID_MAGIC_ID 0x71432909
471#define SERIAL_NUM_MAGIC_ID 0x61945374
472#define SERIAL_NUMBER_LENGTH 127
473#define DLOAD_USB_BASE_ADD 0x2A03F0C8
474
475struct magic_num_struct {
476 uint32_t pid;
477 uint32_t serial_num;
478};
479
480struct dload_struct {
481 uint32_t reserved1;
482 uint32_t reserved2;
483 uint32_t reserved3;
484 uint16_t reserved4;
485 uint16_t pid;
486 char serial_number[SERIAL_NUMBER_LENGTH];
487 uint16_t reserved5;
488 struct magic_num_struct magic_struct;
489};
490
491static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
492{
493 struct dload_struct __iomem *dload = 0;
494
495 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
496 if (!dload) {
497 pr_err("%s: cannot remap I/O memory region: %08x\n",
498 __func__, DLOAD_USB_BASE_ADD);
499 return -ENXIO;
500 }
501
502 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
503 __func__, dload, pid, snum);
504 /* update pid */
505 dload->magic_struct.pid = PID_MAGIC_ID;
506 dload->pid = pid;
507
508 /* update serial number */
509 dload->magic_struct.serial_num = 0;
510 if (!snum) {
511 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
512 goto out;
513 }
514
515 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
516 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
517out:
518 iounmap(dload);
519 return 0;
520}
521
522static struct android_usb_platform_data android_usb_pdata = {
523 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
524};
525
Hemant Kumar4933b072011-10-17 23:43:11 -0700526static struct platform_device android_usb_device = {
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800527 .name = "android_usb",
528 .id = -1,
529 .dev = {
530 .platform_data = &android_usb_pdata,
531 },
Hemant Kumar4933b072011-10-17 23:43:11 -0700532};
533
Hemant Kumar7620eed2012-02-26 09:08:43 -0800534/* Bandwidth requests (zero) if no vote placed */
535static struct msm_bus_vectors usb_init_vectors[] = {
536 {
537 .src = MSM_BUS_MASTER_SPS,
538 .dst = MSM_BUS_SLAVE_EBI_CH0,
539 .ab = 0,
540 .ib = 0,
541 },
542};
543
544/* Bus bandwidth requests in Bytes/sec */
545static struct msm_bus_vectors usb_max_vectors[] = {
546 {
547 .src = MSM_BUS_MASTER_SPS,
548 .dst = MSM_BUS_SLAVE_EBI_CH0,
549 .ab = 60000000, /* At least 480Mbps on bus. */
550 .ib = 960000000, /* MAX bursts rate */
551 },
552};
553
554static struct msm_bus_paths usb_bus_scale_usecases[] = {
555 {
556 ARRAY_SIZE(usb_init_vectors),
557 usb_init_vectors,
558 },
559 {
560 ARRAY_SIZE(usb_max_vectors),
561 usb_max_vectors,
562 },
563};
564
565static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
566 usb_bus_scale_usecases,
567 ARRAY_SIZE(usb_bus_scale_usecases),
568 .name = "usb",
569};
570
Hemant Kumar4933b072011-10-17 23:43:11 -0700571static struct msm_otg_platform_data msm_otg_pdata = {
Hemant Kumard86c4882012-01-24 19:39:37 -0800572 .mode = USB_OTG,
573 .otg_control = OTG_PMIC_CONTROL,
Hemant Kumar4933b072011-10-17 23:43:11 -0700574 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Hemant Kumard86c4882012-01-24 19:39:37 -0800575 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
576 .power_budget = 750,
Hemant Kumar7620eed2012-02-26 09:08:43 -0800577 .bus_scale_table = &usb_bus_scale_pdata,
Hemant Kumar4933b072011-10-17 23:43:11 -0700578};
579
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800580static struct msm_usb_host_platform_data msm_ehci_host_pdata3 = {
Manu Gautam91223e02011-11-08 15:27:22 +0530581 .power_budget = 500,
582};
583
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800584#ifdef CONFIG_USB_EHCI_MSM_HOST4
585static struct msm_usb_host_platform_data msm_ehci_host_pdata4;
586#endif
587
Manu Gautam91223e02011-11-08 15:27:22 +0530588static void __init apq8064_ehci_host_init(void)
589{
590 if (machine_is_apq8064_liquid()) {
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800591 msm_ehci_host_pdata3.dock_connect_irq =
Hemant Kumar56925352012-02-13 16:59:52 -0800592 PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9);
593
Manu Gautam91223e02011-11-08 15:27:22 +0530594 apq8064_device_ehci_host3.dev.platform_data =
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800595 &msm_ehci_host_pdata3;
Manu Gautam91223e02011-11-08 15:27:22 +0530596 platform_device_register(&apq8064_device_ehci_host3);
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800597
598#ifdef CONFIG_USB_EHCI_MSM_HOST4
599 apq8064_device_ehci_host4.dev.platform_data =
600 &msm_ehci_host_pdata4;
601 platform_device_register(&apq8064_device_ehci_host4);
602#endif
Manu Gautam91223e02011-11-08 15:27:22 +0530603 }
604}
605
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800606#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
607
608/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
609 * 4 micbiases are used to power various analog and digital
610 * microphones operating at 1800 mV. Technically, all micbiases
611 * can source from single cfilter since all microphones operate
612 * at the same voltage level. The arrangement below is to make
613 * sure all cfilters are exercised. LDO_H regulator ouput level
614 * does not need to be as high as 2.85V. It is choosen for
615 * microphone sensitivity purpose.
616 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530617static struct wcd9xxx_pdata apq8064_tabla_platform_data = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800618 .slimbus_slave_device = {
619 .name = "tabla-slave",
620 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
621 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800622 .irq = MSM_GPIO_TO_INT(42),
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800623 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530624 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800625 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
626 .micbias = {
627 .ldoh_v = TABLA_LDOH_2P85_V,
628 .cfilt1_mv = 1800,
629 .cfilt2_mv = 1800,
630 .cfilt3_mv = 1800,
631 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
632 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
633 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
634 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530635 },
636 .regulator = {
637 {
638 .name = "CDC_VDD_CP",
639 .min_uV = 1800000,
640 .max_uV = 1800000,
641 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
642 },
643 {
644 .name = "CDC_VDDA_RX",
645 .min_uV = 1800000,
646 .max_uV = 1800000,
647 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
648 },
649 {
650 .name = "CDC_VDDA_TX",
651 .min_uV = 1800000,
652 .max_uV = 1800000,
653 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
654 },
655 {
656 .name = "VDDIO_CDC",
657 .min_uV = 1800000,
658 .max_uV = 1800000,
659 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
660 },
661 {
662 .name = "VDDD_CDC_D",
663 .min_uV = 1225000,
664 .max_uV = 1225000,
665 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
666 },
667 {
668 .name = "CDC_VDDA_A_1P2V",
669 .min_uV = 1225000,
670 .max_uV = 1225000,
671 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
672 },
673 },
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800674};
675
676static struct slim_device apq8064_slim_tabla = {
677 .name = "tabla-slim",
678 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
679 .dev = {
680 .platform_data = &apq8064_tabla_platform_data,
681 },
682};
683
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530684static struct wcd9xxx_pdata apq8064_tabla20_platform_data = {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800685 .slimbus_slave_device = {
686 .name = "tabla-slave",
687 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
688 },
689 .irq = MSM_GPIO_TO_INT(42),
690 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530691 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800692 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
693 .micbias = {
694 .ldoh_v = TABLA_LDOH_2P85_V,
695 .cfilt1_mv = 1800,
696 .cfilt2_mv = 1800,
697 .cfilt3_mv = 1800,
698 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
699 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
700 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
701 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530702 },
703 .regulator = {
704 {
705 .name = "CDC_VDD_CP",
706 .min_uV = 1800000,
707 .max_uV = 1800000,
708 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
709 },
710 {
711 .name = "CDC_VDDA_RX",
712 .min_uV = 1800000,
713 .max_uV = 1800000,
714 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
715 },
716 {
717 .name = "CDC_VDDA_TX",
718 .min_uV = 1800000,
719 .max_uV = 1800000,
720 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
721 },
722 {
723 .name = "VDDIO_CDC",
724 .min_uV = 1800000,
725 .max_uV = 1800000,
726 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
727 },
728 {
729 .name = "VDDD_CDC_D",
730 .min_uV = 1225000,
731 .max_uV = 1225000,
732 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
733 },
734 {
735 .name = "CDC_VDDA_A_1P2V",
736 .min_uV = 1225000,
737 .max_uV = 1225000,
738 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
739 },
740 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800741};
742
743static struct slim_device apq8064_slim_tabla20 = {
744 .name = "tabla2x-slim",
745 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
746 .dev = {
747 .platform_data = &apq8064_tabla20_platform_data,
748 },
749};
750
Amy Maloche70090f992012-02-16 16:35:26 -0800751#define HAP_SHIFT_LVL_OE_GPIO PM8921_MPP_PM_TO_SYS(8)
752#define ISA1200_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
753#define ISA1200_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
754#define ISA1200_HAP_CLK PM8921_GPIO_PM_TO_SYS(44)
755
756static int isa1200_power(int on)
757{
758 gpio_set_value_cansleep(ISA1200_HAP_CLK, !!on);
759
760 return 0;
761}
762
763static int isa1200_dev_setup(bool enable)
764{
765 int rc = 0;
766
767 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_1, enable);
768 if (rc) {
769 pr_err("%s: unable to write aux clock register(%d)\n",
770 __func__, rc);
771 return rc;
772 }
773
774 if (!enable)
775 goto free_gpio;
776
777 rc = gpio_request(ISA1200_HAP_CLK, "haptics_clk");
778 if (rc) {
779 pr_err("%s: unable to request gpio %d config(%d)\n",
780 __func__, ISA1200_HAP_CLK, rc);
781 return rc;
782 }
783
784 rc = gpio_direction_output(ISA1200_HAP_CLK, 0);
785 if (rc) {
786 pr_err("%s: unable to set direction\n", __func__);
787 goto free_gpio;
788 }
789
790 return 0;
791
792free_gpio:
793 gpio_free(ISA1200_HAP_CLK);
794 return rc;
795}
796
797static struct isa1200_regulator isa1200_reg_data[] = {
798 {
799 .name = "vddp",
800 .min_uV = ISA_I2C_VTG_MIN_UV,
801 .max_uV = ISA_I2C_VTG_MAX_UV,
802 .load_uA = ISA_I2C_CURR_UA,
803 },
804};
805
806static struct isa1200_platform_data isa1200_1_pdata = {
807 .name = "vibrator",
808 .dev_setup = isa1200_dev_setup,
809 .power_on = isa1200_power,
810 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
811 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
812 .max_timeout = 15000,
813 .mode_ctrl = PWM_GEN_MODE,
814 .pwm_fd = {
815 .pwm_div = 256,
816 },
817 .is_erm = false,
818 .smart_en = true,
819 .ext_clk_en = true,
820 .chip_en = 1,
821 .regulator_info = isa1200_reg_data,
822 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
823};
824
825static struct i2c_board_info isa1200_board_info[] __initdata = {
826 {
827 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
828 .platform_data = &isa1200_1_pdata,
829 },
830};
Jing Lin21ed4de2012-02-05 15:53:28 -0800831/* configuration data for mxt1386e using V2.1 firmware */
832static const u8 mxt1386e_config_data_v2_1[] = {
833 /* T6 Object */
834 0, 0, 0, 0, 0, 0,
835 /* T38 Object */
Jing Linf1208fd2012-02-23 11:15:42 -0800836 14, 1, 0, 22, 2, 12, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800837 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
838 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
839 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
840 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
841 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
842 0, 0, 0, 0,
843 /* T7 Object */
Jing Linf1208fd2012-02-23 11:15:42 -0800844 100, 10, 50,
Jing Lin21ed4de2012-02-05 15:53:28 -0800845 /* T8 Object */
Jing Linf1208fd2012-02-23 11:15:42 -0800846 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800847 /* T9 Object */
848 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
849 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
Jing Linf1208fd2012-02-23 11:15:42 -0800850 85, 5, 0, 5, 9, 5, 12, 35, 70, 40,
851 20, 5, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800852 /* T18 Object */
853 0, 0,
854 /* T24 Object */
855 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
856 0, 0, 0, 0, 0, 0, 0, 0, 0,
857 /* T25 Object */
858 3, 0, 60, 115, 156, 99,
859 /* T27 Object */
860 0, 0, 0, 0, 0, 0, 0,
861 /* T40 Object */
862 0, 0, 0, 0, 0,
863 /* T42 Object */
864 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
865 /* T43 Object */
866 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
867 16,
868 /* T46 Object */
Jing Linf1208fd2012-02-23 11:15:42 -0800869 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800870 /* T47 Object */
871 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
872 /* T48 Object */
873 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -0800874 32, 40, 0, 10, 10, 0, 0, 100, 10, 90,
875 0, 0, 0, 0, 0, 0, 0, 10, 1, 10,
876 52, 10, 12, 0, 33, 0, 1, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800877 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
878 0, 0, 0, 0,
879 /* T56 Object */
880 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
881 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
882 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
883 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -0800884 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
885 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800886};
887
888#define MXT_TS_GPIO_IRQ 6
889#define MXT_TS_PWR_EN_GPIO PM8921_GPIO_PM_TO_SYS(23)
890#define MXT_TS_RESET_GPIO 33
891
892static struct mxt_config_info mxt_config_array[] = {
893 {
894 .config = mxt1386e_config_data_v2_1,
895 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
896 .family_id = 0xA0,
897 .variant_id = 0x7,
898 .version = 0x21,
899 .build = 0xAA,
900 },
901};
902
903static struct mxt_platform_data mxt_platform_data = {
904 .config_array = mxt_config_array,
905 .config_array_size = ARRAY_SIZE(mxt_config_array),
906 .x_size = 1365,
907 .y_size = 767,
908 .irqflags = IRQF_TRIGGER_FALLING,
909 .i2c_pull_up = true,
910 .reset_gpio = MXT_TS_RESET_GPIO,
911 .irq_gpio = MXT_TS_GPIO_IRQ,
912};
913
914static struct i2c_board_info mxt_device_info[] __initdata = {
915 {
916 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
917 .platform_data = &mxt_platform_data,
918 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
919 },
920};
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -0800921#define CYTTSP_TS_GPIO_IRQ 6
922#define CYTTSP_TS_GPIO_RESOUT 7
923#define CYTTSP_TS_GPIO_SLEEP 33
924
925static ssize_t tma340_vkeys_show(struct kobject *kobj,
926 struct kobj_attribute *attr, char *buf)
927{
928 return snprintf(buf, 200,
929 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
930 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
931 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
932 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
933 "\n");
934}
935
936static struct kobj_attribute tma340_vkeys_attr = {
937 .attr = {
938 .mode = S_IRUGO,
939 },
940 .show = &tma340_vkeys_show,
941};
942
943static struct attribute *tma340_properties_attrs[] = {
944 &tma340_vkeys_attr.attr,
945 NULL
946};
947
948static struct attribute_group tma340_properties_attr_group = {
949 .attrs = tma340_properties_attrs,
950};
951
952static int cyttsp_platform_init(struct i2c_client *client)
953{
954 int rc = 0;
955 static struct kobject *tma340_properties_kobj;
956
957 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
958 tma340_properties_kobj = kobject_create_and_add("board_properties",
959 NULL);
960 if (tma340_properties_kobj)
961 rc = sysfs_create_group(tma340_properties_kobj,
962 &tma340_properties_attr_group);
963 if (!tma340_properties_kobj || rc)
964 pr_err("%s: failed to create board_properties\n",
965 __func__);
966
967 return 0;
968}
969
970static struct cyttsp_regulator cyttsp_regulator_data[] = {
971 {
972 .name = "vdd",
973 .min_uV = CY_TMA300_VTG_MIN_UV,
974 .max_uV = CY_TMA300_VTG_MAX_UV,
975 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
976 .lpm_load_uA = CY_TMA300_CURR_24HZ_UA,
977 },
978 {
979 .name = "vcc_i2c",
980 .min_uV = CY_I2C_VTG_MIN_UV,
981 .max_uV = CY_I2C_VTG_MAX_UV,
982 .hpm_load_uA = CY_I2C_CURR_UA,
983 .lpm_load_uA = CY_I2C_CURR_UA,
984 },
985};
986
987static struct cyttsp_platform_data cyttsp_pdata = {
988 .panel_maxx = 634,
989 .panel_maxy = 1166,
990 .disp_maxx = 599,
991 .disp_maxy = 1023,
992 .disp_minx = 0,
993 .disp_miny = 0,
994 .flags = 0x01,
995 .gen = CY_GEN3,
996 .use_st = CY_USE_ST,
997 .use_mt = CY_USE_MT,
998 .use_hndshk = CY_SEND_HNDSHK,
999 .use_trk_id = CY_USE_TRACKING_ID,
1000 .use_sleep = CY_USE_DEEP_SLEEP_SEL,
1001 .use_gestures = CY_USE_GESTURES,
1002 .fw_fname = "cyttsp_8064_mtp.hex",
1003 /* change act_intrvl to customize the Active power state
1004 * scanning/processing refresh interval for Operating mode
1005 */
1006 .act_intrvl = CY_ACT_INTRVL_DFLT,
1007 /* change tch_tmout to customize the touch timeout for the
1008 * Active power state for Operating mode
1009 */
1010 .tch_tmout = CY_TCH_TMOUT_DFLT,
1011 /* change lp_intrvl to customize the Low Power power state
1012 * scanning/processing refresh interval for Operating mode
1013 */
1014 .lp_intrvl = CY_LP_INTRVL_DFLT,
1015 .sleep_gpio = CYTTSP_TS_GPIO_SLEEP,
1016 .resout_gpio = CYTTSP_TS_GPIO_RESOUT,
1017 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1018 .regulator_info = cyttsp_regulator_data,
1019 .num_regulators = ARRAY_SIZE(cyttsp_regulator_data),
1020 .init = cyttsp_platform_init,
1021 .correct_fw_ver = 17,
1022};
1023
1024static struct i2c_board_info cyttsp_info[] __initdata = {
1025 {
1026 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1027 .platform_data = &cyttsp_pdata,
1028 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1029 },
1030};
Jing Lin21ed4de2012-02-05 15:53:28 -08001031
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001032#define MSM_WCNSS_PHYS 0x03000000
1033#define MSM_WCNSS_SIZE 0x280000
1034
1035static struct resource resources_wcnss_wlan[] = {
1036 {
1037 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1038 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1039 .name = "wcnss_wlanrx_irq",
1040 .flags = IORESOURCE_IRQ,
1041 },
1042 {
1043 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1044 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1045 .name = "wcnss_wlantx_irq",
1046 .flags = IORESOURCE_IRQ,
1047 },
1048 {
1049 .start = MSM_WCNSS_PHYS,
1050 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1051 .name = "wcnss_mmio",
1052 .flags = IORESOURCE_MEM,
1053 },
1054 {
1055 .start = 64,
1056 .end = 68,
1057 .name = "wcnss_gpios_5wire",
1058 .flags = IORESOURCE_IO,
1059 },
1060};
1061
1062static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1063 .has_48mhz_xo = 1,
1064};
1065
1066static struct platform_device msm_device_wcnss_wlan = {
1067 .name = "wcnss_wlan",
1068 .id = 0,
1069 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1070 .resource = resources_wcnss_wlan,
1071 .dev = {.platform_data = &qcom_wcnss_pdata},
1072};
1073
Ankit Vermab7c26e62012-02-28 15:04:15 -08001074static struct platform_device msm_device_iris_fm __devinitdata = {
1075 .name = "iris_fm",
1076 .id = -1,
1077};
1078
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001079#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1080 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1081 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1082 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1083
1084#define QCE_SIZE 0x10000
1085#define QCE_0_BASE 0x11000000
1086
1087#define QCE_HW_KEY_SUPPORT 0
1088#define QCE_SHA_HMAC_SUPPORT 1
1089#define QCE_SHARE_CE_RESOURCE 3
1090#define QCE_CE_SHARED 0
1091
1092static struct resource qcrypto_resources[] = {
1093 [0] = {
1094 .start = QCE_0_BASE,
1095 .end = QCE_0_BASE + QCE_SIZE - 1,
1096 .flags = IORESOURCE_MEM,
1097 },
1098 [1] = {
1099 .name = "crypto_channels",
1100 .start = DMOV8064_CE_IN_CHAN,
1101 .end = DMOV8064_CE_OUT_CHAN,
1102 .flags = IORESOURCE_DMA,
1103 },
1104 [2] = {
1105 .name = "crypto_crci_in",
1106 .start = DMOV8064_CE_IN_CRCI,
1107 .end = DMOV8064_CE_IN_CRCI,
1108 .flags = IORESOURCE_DMA,
1109 },
1110 [3] = {
1111 .name = "crypto_crci_out",
1112 .start = DMOV8064_CE_OUT_CRCI,
1113 .end = DMOV8064_CE_OUT_CRCI,
1114 .flags = IORESOURCE_DMA,
1115 },
1116};
1117
1118static struct resource qcedev_resources[] = {
1119 [0] = {
1120 .start = QCE_0_BASE,
1121 .end = QCE_0_BASE + QCE_SIZE - 1,
1122 .flags = IORESOURCE_MEM,
1123 },
1124 [1] = {
1125 .name = "crypto_channels",
1126 .start = DMOV8064_CE_IN_CHAN,
1127 .end = DMOV8064_CE_OUT_CHAN,
1128 .flags = IORESOURCE_DMA,
1129 },
1130 [2] = {
1131 .name = "crypto_crci_in",
1132 .start = DMOV8064_CE_IN_CRCI,
1133 .end = DMOV8064_CE_IN_CRCI,
1134 .flags = IORESOURCE_DMA,
1135 },
1136 [3] = {
1137 .name = "crypto_crci_out",
1138 .start = DMOV8064_CE_OUT_CRCI,
1139 .end = DMOV8064_CE_OUT_CRCI,
1140 .flags = IORESOURCE_DMA,
1141 },
1142};
1143
1144#endif
1145
1146#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1147 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1148
1149static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1150 .ce_shared = QCE_CE_SHARED,
1151 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1152 .hw_key_support = QCE_HW_KEY_SUPPORT,
1153 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001154 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001155};
1156
1157static struct platform_device qcrypto_device = {
1158 .name = "qcrypto",
1159 .id = 0,
1160 .num_resources = ARRAY_SIZE(qcrypto_resources),
1161 .resource = qcrypto_resources,
1162 .dev = {
1163 .coherent_dma_mask = DMA_BIT_MASK(32),
1164 .platform_data = &qcrypto_ce_hw_suppport,
1165 },
1166};
1167#endif
1168
1169#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1170 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1171
1172static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1173 .ce_shared = QCE_CE_SHARED,
1174 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1175 .hw_key_support = QCE_HW_KEY_SUPPORT,
1176 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001177 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001178};
1179
1180static struct platform_device qcedev_device = {
1181 .name = "qce",
1182 .id = 0,
1183 .num_resources = ARRAY_SIZE(qcedev_resources),
1184 .resource = qcedev_resources,
1185 .dev = {
1186 .coherent_dma_mask = DMA_BIT_MASK(32),
1187 .platform_data = &qcedev_ce_hw_suppport,
1188 },
1189};
1190#endif
1191
Joel Kingdacbc822012-01-25 13:30:57 -08001192static struct mdm_platform_data mdm_platform_data = {
1193 .mdm_version = "3.0",
1194 .ramdump_delay_ms = 2000,
Hemant Kumara945b472012-01-25 15:08:06 -08001195 .peripheral_platform_device = &apq8064_device_hsic_host,
Joel Kingdacbc822012-01-25 13:30:57 -08001196};
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001197
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001198static struct tsens_platform_data apq_tsens_pdata = {
1199 .tsens_factor = 1000,
1200 .hw_type = APQ_8064,
1201 .tsens_num_sensor = 11,
1202 .slope = {1176, 1176, 1154, 1176, 1111,
1203 1132, 1132, 1199, 1132, 1199, 1132},
1204};
1205
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001206#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001207static void __init apq8064_map_io(void)
1208{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001209 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001210 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001211 if (socinfo_init() < 0)
1212 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001213}
1214
1215static void __init apq8064_init_irq(void)
1216{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001217 struct msm_mpm_device_data *data = NULL;
1218
1219#ifdef CONFIG_MSM_MPM
1220 data = &apq8064_mpm_dev_data;
1221#endif
1222
1223 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001224 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1225 (void *)MSM_QGIC_CPU_BASE);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001226}
1227
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001228static struct platform_device msm8064_device_saw_regulator_core0 = {
1229 .name = "saw-regulator",
1230 .id = 0,
1231 .dev = {
1232 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
1233 },
1234};
1235
1236static struct platform_device msm8064_device_saw_regulator_core1 = {
1237 .name = "saw-regulator",
1238 .id = 1,
1239 .dev = {
1240 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
1241 },
1242};
1243
1244static struct platform_device msm8064_device_saw_regulator_core2 = {
1245 .name = "saw-regulator",
1246 .id = 2,
1247 .dev = {
1248 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
1249 },
1250};
1251
1252static struct platform_device msm8064_device_saw_regulator_core3 = {
1253 .name = "saw-regulator",
1254 .id = 3,
1255 .dev = {
1256 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001257
1258 },
1259};
1260
Oluwafemi Adeyemif5a31422012-03-08 16:58:45 -08001261static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001262 {
1263 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1264 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1265 true,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001266 100, 650, 801, 200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001267 },
1268
1269 {
1270 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1271 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1272 true,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001273 2000, 200, 576000, 2000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001274 },
1275
1276 {
1277 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1278 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1279 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001280 8500, 51, 1122000, 8500,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001281 },
1282
1283 {
1284 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1285 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
1286 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001287 9000, 51, 1130300, 9000,
1288 },
1289 {
1290 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1291 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
1292 false,
1293 10000, 51, 1130300, 10000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001294 },
1295
1296 {
1297 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1298 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1299 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001300 12000, 14, 2205900, 12000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001301 },
1302
1303 {
1304 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1305 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1306 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001307 18000, 12, 2364250, 18000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001308 },
1309
1310 {
1311 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1312 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1313 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001314 23500, 10, 2667000, 23500,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001315 },
1316
1317 {
1318 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1319 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1320 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001321 29700, 5, 2867000, 30000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001322 },
1323};
1324
Oluwafemi Adeyemif5a31422012-03-08 16:58:45 -08001325uint32_t apq8064_rpm_get_swfi_latency(void)
1326{
1327 int i;
1328
1329 for (i = 0; i < ARRAY_SIZE(msm_rpmrs_levels); i++) {
1330 if (msm_rpmrs_levels[i].sleep_mode ==
1331 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)
1332 return msm_rpmrs_levels[i].latency_us;
1333 }
1334
1335 return 0;
1336}
1337
Praveen Chidambaram78499012011-11-01 17:15:17 -06001338static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1339 .mode = MSM_PM_BOOT_CONFIG_TZ,
1340};
1341
1342static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
1343 .levels = &msm_rpmrs_levels[0],
1344 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
1345 .vdd_mem_levels = {
1346 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
1347 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
1348 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
1349 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
1350 },
1351 .vdd_dig_levels = {
1352 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
1353 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
1354 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
1355 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
1356 },
1357 .vdd_mask = 0x7FFFFF,
1358 .rpmrs_target_id = {
1359 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
1360 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
1361 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
1362 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
1363 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
1364 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
1365 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
1366 },
1367};
1368
1369static struct msm_cpuidle_state msm_cstates[] __initdata = {
1370 {0, 0, "C0", "WFI",
1371 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1372
1373 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1374 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1375
1376 {0, 2, "C2", "POWER_COLLAPSE",
1377 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
1378
1379 {1, 0, "C0", "WFI",
1380 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1381
1382 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1383 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1384
1385 {2, 0, "C0", "WFI",
1386 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1387
1388 {2, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1389 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1390
1391 {3, 0, "C0", "WFI",
1392 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1393
1394 {3, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1395 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1396};
1397
1398static struct msm_pm_platform_data msm_pm_data[] = {
1399 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1400 .idle_supported = 1,
1401 .suspend_supported = 1,
1402 .idle_enabled = 0,
1403 .suspend_enabled = 0,
1404 },
1405
1406 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1407 .idle_supported = 1,
1408 .suspend_supported = 1,
1409 .idle_enabled = 0,
1410 .suspend_enabled = 0,
1411 },
1412
1413 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1414 .idle_supported = 1,
1415 .suspend_supported = 1,
1416 .idle_enabled = 1,
1417 .suspend_enabled = 1,
1418 },
1419
1420 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1421 .idle_supported = 0,
1422 .suspend_supported = 1,
1423 .idle_enabled = 0,
1424 .suspend_enabled = 0,
1425 },
1426
1427 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1428 .idle_supported = 1,
1429 .suspend_supported = 1,
1430 .idle_enabled = 0,
1431 .suspend_enabled = 0,
1432 },
1433
1434 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1435 .idle_supported = 1,
1436 .suspend_supported = 0,
1437 .idle_enabled = 1,
1438 .suspend_enabled = 0,
1439 },
1440
1441 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1442 .idle_supported = 0,
1443 .suspend_supported = 1,
1444 .idle_enabled = 0,
1445 .suspend_enabled = 0,
1446 },
1447
1448 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1449 .idle_supported = 1,
1450 .suspend_supported = 1,
1451 .idle_enabled = 0,
1452 .suspend_enabled = 0,
1453 },
1454
1455 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1456 .idle_supported = 1,
1457 .suspend_supported = 0,
1458 .idle_enabled = 1,
1459 .suspend_enabled = 0,
1460 },
1461
1462 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1463 .idle_supported = 0,
1464 .suspend_supported = 1,
1465 .idle_enabled = 0,
1466 .suspend_enabled = 0,
1467 },
1468
1469 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1470 .idle_supported = 1,
1471 .suspend_supported = 1,
1472 .idle_enabled = 0,
1473 .suspend_enabled = 0,
1474 },
1475
1476 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1477 .idle_supported = 1,
1478 .suspend_supported = 0,
1479 .idle_enabled = 1,
1480 .suspend_enabled = 0,
1481 },
1482};
1483
1484static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1485 0x03, 0x0f,
1486};
1487
1488static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1489 0x00, 0x24, 0x54, 0x10,
1490 0x09, 0x03, 0x01,
1491 0x10, 0x54, 0x30, 0x0C,
1492 0x24, 0x30, 0x0f,
1493};
1494
1495static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1496 0x00, 0x24, 0x54, 0x10,
1497 0x09, 0x07, 0x01, 0x0B,
1498 0x10, 0x54, 0x30, 0x0C,
1499 0x24, 0x30, 0x0f,
1500};
1501
1502static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1503 [0] = {
1504 .mode = MSM_SPM_MODE_CLOCK_GATING,
1505 .notify_rpm = false,
1506 .cmd = spm_wfi_cmd_sequence,
1507 },
1508 [1] = {
1509 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1510 .notify_rpm = false,
1511 .cmd = spm_power_collapse_without_rpm,
1512 },
1513 [2] = {
1514 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1515 .notify_rpm = true,
1516 .cmd = spm_power_collapse_with_rpm,
1517 },
1518};
1519
1520static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1521 0x00, 0x20, 0x03, 0x20,
1522 0x00, 0x0f,
1523};
1524
1525static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1526 0x00, 0x20, 0x34, 0x64,
1527 0x48, 0x07, 0x48, 0x20,
1528 0x50, 0x64, 0x04, 0x34,
1529 0x50, 0x0f,
1530};
1531static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1532 0x00, 0x10, 0x34, 0x64,
1533 0x48, 0x07, 0x48, 0x10,
1534 0x50, 0x64, 0x04, 0x34,
1535 0x50, 0x0F,
1536};
1537
1538static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1539 [0] = {
1540 .mode = MSM_SPM_L2_MODE_RETENTION,
1541 .notify_rpm = false,
1542 .cmd = l2_spm_wfi_cmd_sequence,
1543 },
1544 [1] = {
1545 .mode = MSM_SPM_L2_MODE_GDHS,
1546 .notify_rpm = true,
1547 .cmd = l2_spm_gdhs_cmd_sequence,
1548 },
1549 [2] = {
1550 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1551 .notify_rpm = true,
1552 .cmd = l2_spm_power_off_cmd_sequence,
1553 },
1554};
1555
1556
1557static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1558 [0] = {
1559 .reg_base_addr = MSM_SAW_L2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001560 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
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] = 0x00A000AE,
1563 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1564 .modes = msm_spm_l2_seq_list,
1565 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1566 },
1567};
1568
1569static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1570 [0] = {
1571 .reg_base_addr = MSM_SAW0_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001572 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001573#if defined(CONFIG_MSM_AVS_HW)
1574 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1575 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1576#endif
1577 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001578 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001579 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1580 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1581 .vctl_timeout_us = 50,
1582 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1583 .modes = msm_spm_seq_list,
1584 },
1585 [1] = {
1586 .reg_base_addr = MSM_SAW1_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001587 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001588#if defined(CONFIG_MSM_AVS_HW)
1589 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1590 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1591#endif
1592 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001593 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001594 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1595 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1596 .vctl_timeout_us = 50,
1597 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1598 .modes = msm_spm_seq_list,
1599 },
1600 [2] = {
1601 .reg_base_addr = MSM_SAW2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001602 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001603#if defined(CONFIG_MSM_AVS_HW)
1604 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1605 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1606#endif
1607 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001608 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001609 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1610 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1611 .vctl_timeout_us = 50,
1612 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1613 .modes = msm_spm_seq_list,
1614 },
1615 [3] = {
1616 .reg_base_addr = MSM_SAW3_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001617 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001618#if defined(CONFIG_MSM_AVS_HW)
1619 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1620 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1621#endif
1622 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001623 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001624 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1625 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1626 .vctl_timeout_us = 50,
1627 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1628 .modes = msm_spm_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001629 },
1630};
1631
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001632static void __init apq8064_init_buses(void)
1633{
1634 msm_bus_rpm_set_mt_mask();
1635 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
1636 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
1637 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
1638 msm_bus_8064_apps_fabric.dev.platform_data =
1639 &msm_bus_8064_apps_fabric_pdata;
1640 msm_bus_8064_sys_fabric.dev.platform_data =
1641 &msm_bus_8064_sys_fabric_pdata;
1642 msm_bus_8064_mm_fabric.dev.platform_data =
1643 &msm_bus_8064_mm_fabric_pdata;
1644 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
1645 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
1646}
1647
David Collinsf0d00732012-01-25 15:46:50 -08001648static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
1649 .name = GPIO_REGULATOR_DEV_NAME,
1650 .id = PM8921_MPP_PM_TO_SYS(7),
1651 .dev = {
1652 .platform_data
1653 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
1654 },
1655};
1656
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08001657static struct platform_device apq8064_device_ext_mpp8_vreg __devinitdata = {
1658 .name = GPIO_REGULATOR_DEV_NAME,
1659 .id = PM8921_MPP_PM_TO_SYS(8),
1660 .dev = {
1661 .platform_data
1662 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_MPP8],
1663 },
1664};
1665
David Collinsf0d00732012-01-25 15:46:50 -08001666static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
1667 .name = GPIO_REGULATOR_DEV_NAME,
1668 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
1669 .dev = {
1670 .platform_data =
1671 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
1672 },
1673};
1674
David Collins390fc332012-02-07 14:38:16 -08001675static struct platform_device apq8064_device_ext_ts_sw_vreg __devinitdata = {
1676 .name = GPIO_REGULATOR_DEV_NAME,
1677 .id = PM8921_GPIO_PM_TO_SYS(23),
1678 .dev = {
1679 .platform_data
1680 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_TS_SW],
1681 },
1682};
1683
David Collins2782b5c2012-02-06 10:02:42 -08001684static struct platform_device apq8064_device_rpm_regulator __devinitdata = {
1685 .name = "rpm-regulator",
1686 .id = -1,
1687 .dev = {
1688 .platform_data = &apq8064_rpm_regulator_pdata,
1689 },
1690};
1691
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001692static struct platform_device *common_devices[] __initdata = {
Jin Hong01f2dbb2011-11-03 22:13:51 -07001693 &apq8064_device_dmov,
David Keitel3c40fc52012-02-09 17:53:52 -08001694 &apq8064_device_qup_i2c_gsbi1,
Jing Lin04601f92012-02-05 15:36:07 -08001695 &apq8064_device_qup_i2c_gsbi3,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001696 &apq8064_device_qup_i2c_gsbi4,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001697 &apq8064_device_qup_spi_gsbi5,
David Collinsf0d00732012-01-25 15:46:50 -08001698 &apq8064_device_ext_5v_vreg,
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08001699 &apq8064_device_ext_mpp8_vreg,
David Collinsf0d00732012-01-25 15:46:50 -08001700 &apq8064_device_ext_3p3v_vreg,
David Collins390fc332012-02-07 14:38:16 -08001701 &apq8064_device_ext_ts_sw_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07001702 &apq8064_device_ssbi_pmic1,
1703 &apq8064_device_ssbi_pmic2,
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001704 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07001705 &apq8064_device_otg,
1706 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08001707 &apq8064_device_hsusb_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07001708 &android_usb_device,
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001709 &msm_device_wcnss_wlan,
Ankit Vermab7c26e62012-02-28 15:04:15 -08001710 &msm_device_iris_fm,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001711#ifdef CONFIG_ANDROID_PMEM
1712#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -07001713 &android_pmem_device,
1714 &android_pmem_adsp_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001715#endif
Kevin Chan13be4e22011-10-20 11:30:32 -07001716 &android_pmem_audio_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001717#endif
1718#ifdef CONFIG_ION_MSM
1719 &ion_dev,
1720#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001721 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001722 &msm8064_device_saw_regulator_core0,
1723 &msm8064_device_saw_regulator_core1,
1724 &msm8064_device_saw_regulator_core2,
1725 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001726#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1727 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1728 &qcrypto_device,
1729#endif
1730
1731#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1732 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1733 &qcedev_device,
1734#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07001735
1736#ifdef CONFIG_HW_RANDOM_MSM
1737 &apq8064_device_rng,
1738#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08001739 &apq_pcm,
1740 &apq_pcm_routing,
1741 &apq_cpudai0,
1742 &apq_cpudai1,
1743 &apq_cpudai_hdmi_rx,
1744 &apq_cpudai_bt_rx,
1745 &apq_cpudai_bt_tx,
1746 &apq_cpudai_fm_rx,
1747 &apq_cpudai_fm_tx,
1748 &apq_cpu_fe,
1749 &apq_stub_codec,
1750 &apq_voice,
1751 &apq_voip,
1752 &apq_lpa_pcm,
1753 &apq_pcm_hostless,
1754 &apq_cpudai_afe_01_rx,
1755 &apq_cpudai_afe_01_tx,
1756 &apq_cpudai_afe_02_rx,
1757 &apq_cpudai_afe_02_tx,
1758 &apq_pcm_afe,
1759 &apq_cpudai_auxpcm_rx,
1760 &apq_cpudai_auxpcm_tx,
Neema Shetty8427c262012-02-16 11:23:43 -08001761 &apq_cpudai_stub,
Neema Shetty3c9d2862012-03-11 01:25:32 -08001762 &apq_cpudai_slimbus_1_rx,
1763 &apq_cpudai_slimbus_1_tx,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001764 &apq8064_rpm_device,
1765 &apq8064_rpm_log_device,
1766 &apq8064_rpm_stat_device,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001767 &msm_bus_8064_apps_fabric,
1768 &msm_bus_8064_sys_fabric,
1769 &msm_bus_8064_mm_fabric,
1770 &msm_bus_8064_sys_fpb,
1771 &msm_bus_8064_cpss_fpb,
Mohan Kumar Gubbihalli Lachma Naik7f72edd2012-02-06 17:26:47 -08001772 &apq8064_msm_device_vidc,
Matt Wagantalled832652012-02-02 19:23:17 -08001773 &msm_8960_riva,
Matt Wagantallb94b9a52012-02-02 21:59:54 -08001774 &msm_8960_q6_lpass,
Matt Wagantall292aace2012-01-26 19:12:34 -08001775 &msm_gss,
Laura Abbott350c8362012-02-28 14:46:52 -08001776#ifdef CONFIG_MSM_RTB
1777 &msm_rtb_device,
1778#endif
Praveen Chidambaram8ea3dcd2011-12-07 14:46:31 -07001779 &apq8064_cpu_idle_device,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001780};
1781
Joel King4e7ad222011-08-17 15:47:38 -07001782static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001783 &apq8064_device_uart_gsbi3,
Yan He06913ce2011-08-26 16:33:46 -07001784 &msm_device_sps_apq8064,
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001785};
1786
1787static struct platform_device *rumi3_devices[] __initdata = {
1788 &apq8064_device_uart_gsbi1,
Yan He435ed612011-11-23 17:34:59 -08001789 &msm_device_sps_apq8064,
Huaibin Yang4a084e32011-12-15 15:25:52 -08001790#ifdef CONFIG_MSM_ROTATOR
1791 &msm_rotator_device,
1792#endif
Joel King4e7ad222011-08-17 15:47:38 -07001793};
1794
Joel King82b7e3f2012-01-05 10:03:27 -08001795static struct platform_device *cdp_devices[] __initdata = {
1796 &apq8064_device_uart_gsbi1,
Jin Hong4bbbfba2012-02-02 21:48:07 -08001797 &apq8064_device_uart_gsbi7,
Joel King82b7e3f2012-01-05 10:03:27 -08001798 &msm_device_sps_apq8064,
Aravind Venkateswaran4ca27532012-02-16 14:27:05 -08001799#ifdef CONFIG_MSM_ROTATOR
1800 &msm_rotator_device,
1801#endif
Joel King82b7e3f2012-01-05 10:03:27 -08001802};
1803
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001804static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08001805 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001806};
1807
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001808#define KS8851_IRQ_GPIO 43
1809
1810static struct spi_board_info spi_board_info[] __initdata = {
1811 {
1812 .modalias = "ks8851",
1813 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1814 .max_speed_hz = 19200000,
1815 .bus_num = 0,
1816 .chip_select = 2,
1817 .mode = SPI_MODE_0,
1818 },
1819};
1820
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001821static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001822 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001823 .bus_num = 1,
1824 .slim_slave = &apq8064_slim_tabla,
1825 },
1826 {
1827 .bus_num = 1,
1828 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001829 },
1830 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001831};
1832
David Keitel3c40fc52012-02-09 17:53:52 -08001833static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi1_pdata = {
1834 .clk_freq = 100000,
1835 .src_clk_rate = 24000000,
1836};
1837
Jing Lin04601f92012-02-05 15:36:07 -08001838static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi3_pdata = {
1839 .clk_freq = 100000,
1840 .src_clk_rate = 24000000,
1841};
1842
Kenneth Heitke748593a2011-07-15 15:45:11 -06001843static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
1844 .clk_freq = 100000,
1845 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001846};
1847
David Keitel3c40fc52012-02-09 17:53:52 -08001848#define GSBI_DUAL_MODE_CODE 0x60
1849#define MSM_GSBI1_PHYS 0x12440000
Kenneth Heitke748593a2011-07-15 15:45:11 -06001850static void __init apq8064_i2c_init(void)
1851{
David Keitel3c40fc52012-02-09 17:53:52 -08001852 void __iomem *gsbi_mem;
1853
1854 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
1855 &apq8064_i2c_qup_gsbi1_pdata;
1856 gsbi_mem = ioremap_nocache(MSM_GSBI1_PHYS, 4);
1857 writel_relaxed(GSBI_DUAL_MODE_CODE, gsbi_mem);
1858 /* Ensure protocol code is written before proceeding */
1859 wmb();
1860 iounmap(gsbi_mem);
1861 apq8064_i2c_qup_gsbi1_pdata.use_gsbi_shared_mode = 1;
Jing Lin04601f92012-02-05 15:36:07 -08001862 apq8064_device_qup_i2c_gsbi3.dev.platform_data =
1863 &apq8064_i2c_qup_gsbi3_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06001864 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
1865 &apq8064_i2c_qup_gsbi4_pdata;
1866}
1867
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08001868#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001869static int ethernet_init(void)
1870{
1871 int ret;
1872 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
1873 if (ret) {
1874 pr_err("ks8851 gpio_request failed: %d\n", ret);
1875 goto fail;
1876 }
1877
1878 return 0;
1879fail:
1880 return ret;
1881}
1882#else
1883static int ethernet_init(void)
1884{
1885 return 0;
1886}
1887#endif
1888
Mohan Pallaka474b94b2012-01-25 12:59:58 +05301889#define GPIO_KEY_HOME PM8921_GPIO_PM_TO_SYS(27)
1890#define GPIO_KEY_VOLUME_UP PM8921_GPIO_PM_TO_SYS(35)
1891#define GPIO_KEY_VOLUME_DOWN PM8921_GPIO_PM_TO_SYS(38)
1892#define GPIO_KEY_CAM_FOCUS PM8921_GPIO_PM_TO_SYS(3)
1893#define GPIO_KEY_CAM_SNAP PM8921_GPIO_PM_TO_SYS(4)
Jing Lin3f8f8422012-03-05 09:32:11 -08001894#define GPIO_KEY_ROTATION PM8921_GPIO_PM_TO_SYS(42)
Mohan Pallaka474b94b2012-01-25 12:59:58 +05301895
1896static struct gpio_keys_button cdp_keys[] = {
1897 {
1898 .code = KEY_HOME,
1899 .gpio = GPIO_KEY_HOME,
1900 .desc = "home_key",
1901 .active_low = 1,
1902 .type = EV_KEY,
1903 .wakeup = 1,
1904 .debounce_interval = 15,
1905 },
1906 {
1907 .code = KEY_VOLUMEUP,
1908 .gpio = GPIO_KEY_VOLUME_UP,
1909 .desc = "volume_up_key",
1910 .active_low = 1,
1911 .type = EV_KEY,
1912 .wakeup = 1,
1913 .debounce_interval = 15,
1914 },
1915 {
1916 .code = KEY_VOLUMEDOWN,
1917 .gpio = GPIO_KEY_VOLUME_DOWN,
1918 .desc = "volume_down_key",
1919 .active_low = 1,
1920 .type = EV_KEY,
1921 .wakeup = 1,
1922 .debounce_interval = 15,
1923 },
1924 {
1925 .code = SW_ROTATE_LOCK,
1926 .gpio = GPIO_KEY_ROTATION,
1927 .desc = "rotate_key",
1928 .active_low = 1,
1929 .type = EV_SW,
1930 .debounce_interval = 15,
1931 },
1932};
1933
1934static struct gpio_keys_platform_data cdp_keys_data = {
1935 .buttons = cdp_keys,
1936 .nbuttons = ARRAY_SIZE(cdp_keys),
1937};
1938
1939static struct platform_device cdp_kp_pdev = {
1940 .name = "gpio-keys",
1941 .id = -1,
1942 .dev = {
1943 .platform_data = &cdp_keys_data,
1944 },
1945};
1946
1947static struct gpio_keys_button mtp_keys[] = {
1948 {
1949 .code = KEY_CAMERA_FOCUS,
1950 .gpio = GPIO_KEY_CAM_FOCUS,
1951 .desc = "cam_focus_key",
1952 .active_low = 1,
1953 .type = EV_KEY,
1954 .wakeup = 1,
1955 .debounce_interval = 15,
1956 },
1957 {
1958 .code = KEY_VOLUMEUP,
1959 .gpio = GPIO_KEY_VOLUME_UP,
1960 .desc = "volume_up_key",
1961 .active_low = 1,
1962 .type = EV_KEY,
1963 .wakeup = 1,
1964 .debounce_interval = 15,
1965 },
1966 {
1967 .code = KEY_VOLUMEDOWN,
1968 .gpio = GPIO_KEY_VOLUME_DOWN,
1969 .desc = "volume_down_key",
1970 .active_low = 1,
1971 .type = EV_KEY,
1972 .wakeup = 1,
1973 .debounce_interval = 15,
1974 },
1975 {
1976 .code = KEY_CAMERA_SNAPSHOT,
1977 .gpio = GPIO_KEY_CAM_SNAP,
1978 .desc = "cam_snap_key",
1979 .active_low = 1,
1980 .type = EV_KEY,
1981 .debounce_interval = 15,
1982 },
1983};
1984
1985static struct gpio_keys_platform_data mtp_keys_data = {
1986 .buttons = mtp_keys,
1987 .nbuttons = ARRAY_SIZE(mtp_keys),
1988};
1989
1990static struct platform_device mtp_kp_pdev = {
1991 .name = "gpio-keys",
1992 .id = -1,
1993 .dev = {
1994 .platform_data = &mtp_keys_data,
1995 },
1996};
1997
Jin Hongd3024e62012-02-09 16:13:32 -08001998/* Sensors DSPS platform data */
1999#define DSPS_PIL_GENERIC_NAME "dsps"
2000static void __init apq8064_init_dsps(void)
2001{
2002 struct msm_dsps_platform_data *pdata =
2003 msm_dsps_device_8064.dev.platform_data;
2004 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
2005 pdata->gpios = NULL;
2006 pdata->gpios_num = 0;
2007
2008 platform_device_register(&msm_dsps_device_8064);
2009}
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302010
Tianyi Gou41515e22011-09-01 19:37:43 -07002011static void __init apq8064_clock_init(void)
2012{
Tianyi Gouacb588d2012-01-27 18:24:05 -08002013 if (machine_is_apq8064_rumi3())
Tianyi Gou41515e22011-09-01 19:37:43 -07002014 msm_clock_init(&apq8064_dummy_clock_init_data);
Tianyi Gouacb588d2012-01-27 18:24:05 -08002015 else
2016 msm_clock_init(&apq8064_clock_init_data);
Tianyi Gou41515e22011-09-01 19:37:43 -07002017}
2018
Jing Lin417fa452012-02-05 14:31:06 -08002019#define I2C_SURF 1
2020#define I2C_FFA (1 << 1)
2021#define I2C_RUMI (1 << 2)
2022#define I2C_SIM (1 << 3)
2023#define I2C_LIQUID (1 << 4)
2024
2025struct i2c_registry {
2026 u8 machs;
2027 int bus;
2028 struct i2c_board_info *info;
2029 int len;
2030};
2031
2032static struct i2c_registry apq8064_i2c_devices[] __initdata = {
Jing Lin21ed4de2012-02-05 15:53:28 -08002033 {
2034 I2C_SURF | I2C_LIQUID,
2035 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
2036 mxt_device_info,
2037 ARRAY_SIZE(mxt_device_info),
2038 },
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08002039 {
2040 I2C_FFA,
2041 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
2042 cyttsp_info,
2043 ARRAY_SIZE(cyttsp_info),
2044 },
Amy Maloche70090f992012-02-16 16:35:26 -08002045 {
2046 I2C_FFA | I2C_LIQUID,
2047 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
2048 isa1200_board_info,
2049 ARRAY_SIZE(isa1200_board_info),
2050 },
Jing Lin417fa452012-02-05 14:31:06 -08002051};
2052
2053static void __init register_i2c_devices(void)
2054{
2055 u8 mach_mask = 0;
2056 int i;
2057
Kevin Chand07220e2012-02-13 15:52:22 -08002058#ifdef CONFIG_MSM_CAMERA
2059 struct i2c_registry apq8064_camera_i2c_devices = {
2060 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_RUMI,
2061 APQ_8064_GSBI4_QUP_I2C_BUS_ID,
2062 apq8064_camera_board_info.board_info,
2063 apq8064_camera_board_info.num_i2c_board_info,
2064 };
2065#endif
Jing Lin417fa452012-02-05 14:31:06 -08002066 /* Build the matching 'supported_machs' bitmask */
2067 if (machine_is_apq8064_cdp())
2068 mach_mask = I2C_SURF;
2069 else if (machine_is_apq8064_mtp())
2070 mach_mask = I2C_FFA;
2071 else if (machine_is_apq8064_liquid())
2072 mach_mask = I2C_LIQUID;
2073 else if (machine_is_apq8064_rumi3())
2074 mach_mask = I2C_RUMI;
2075 else if (machine_is_apq8064_sim())
2076 mach_mask = I2C_SIM;
2077 else
2078 pr_err("unmatched machine ID in register_i2c_devices\n");
2079
2080 /* Run the array and install devices as appropriate */
2081 for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) {
2082 if (apq8064_i2c_devices[i].machs & mach_mask)
2083 i2c_register_board_info(apq8064_i2c_devices[i].bus,
2084 apq8064_i2c_devices[i].info,
2085 apq8064_i2c_devices[i].len);
2086 }
Kevin Chand07220e2012-02-13 15:52:22 -08002087#ifdef CONFIG_MSM_CAMERA
2088 if (apq8064_camera_i2c_devices.machs & mach_mask)
2089 i2c_register_board_info(apq8064_camera_i2c_devices.bus,
2090 apq8064_camera_i2c_devices.info,
2091 apq8064_camera_i2c_devices.len);
2092#endif
Jing Lin417fa452012-02-05 14:31:06 -08002093}
2094
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002095static void __init apq8064_common_init(void)
2096{
2097 if (socinfo_init() < 0)
2098 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06002099 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
2100 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
David Collins2782b5c2012-02-06 10:02:42 -08002101 regulator_suppress_info_printing();
2102 platform_device_register(&apq8064_device_rpm_regulator);
Stephen Boyd4d0d2582012-02-10 14:49:40 -08002103 if (msm_xo_init())
2104 pr_err("Failed to initialize XO votes\n");
Tianyi Gou41515e22011-09-01 19:37:43 -07002105 apq8064_clock_init();
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08002106 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06002107 apq8064_i2c_init();
Jing Lin417fa452012-02-05 14:31:06 -08002108 register_i2c_devices();
Kenneth Heitke36920d32011-07-20 16:44:30 -06002109
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002110 apq8064_device_qup_spi_gsbi5.dev.platform_data =
2111 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08002112 apq8064_init_pmic();
Hemant Kumar94e7da22012-02-03 16:52:29 -08002113 if (machine_is_apq8064_liquid())
2114 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002115 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Manu Gautam91223e02011-11-08 15:27:22 +05302116 apq8064_ehci_host_init();
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002117 apq8064_init_buses();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002118 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Hemant Kumarf1ca9192012-02-07 18:59:33 -08002119 if (machine_is_apq8064_mtp()) {
2120 apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
2121 device_initialize(&apq8064_device_hsic_host.dev);
2122 }
Jay Chokshie8741282012-01-25 15:22:55 -08002123 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05302124 apq8064_init_mmc();
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08002125
2126 if (machine_is_apq8064_mtp()) {
2127 mdm_8064_device.dev.platform_data = &mdm_platform_data;
2128 platform_device_register(&mdm_8064_device);
2129 }
2130 platform_device_register(&apq8064_slim_ctrl);
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002131 slim_register_board_info(apq8064_slim_devices,
2132 ARRAY_SIZE(apq8064_slim_devices));
Jin Hongd3024e62012-02-09 16:13:32 -08002133 apq8064_init_dsps();
Praveen Chidambaram78499012011-11-01 17:15:17 -06002134 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Mahesh Sivasubramaniancbce1ec2012-01-24 10:32:44 -07002135 acpuclk_init(&acpuclk_8064_soc_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002136 msm_spm_l2_init(msm_spm_l2_data);
2137 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2138 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2139 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2140 msm_pm_data);
2141 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002142}
2143
Huaibin Yang4a084e32011-12-15 15:25:52 -08002144static void __init apq8064_allocate_memory_regions(void)
2145{
2146 apq8064_allocate_fb_region();
2147}
2148
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002149static void __init apq8064_sim_init(void)
2150{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002151 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
2152 &msm8064_device_watchdog.dev.platform_data;
2153
2154 wdog_pdata->bark_time = 15000;
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002155 msm_tsens_early_init(&apq_tsens_pdata);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002156 apq8064_common_init();
Joel King4e7ad222011-08-17 15:47:38 -07002157 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
2158}
2159
2160static void __init apq8064_rumi3_init(void)
2161{
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002162 msm_tsens_early_init(&apq_tsens_pdata);
Joel King4e7ad222011-08-17 15:47:38 -07002163 apq8064_common_init();
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002164 ethernet_init();
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002165 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002166 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Huaibin Yang4a084e32011-12-15 15:25:52 -08002167 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07002168 apq8064_init_gpu();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002169}
2170
Joel King82b7e3f2012-01-05 10:03:27 -08002171static void __init apq8064_cdp_init(void)
2172{
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002173 msm_tsens_early_init(&apq_tsens_pdata);
Joel King82b7e3f2012-01-05 10:03:27 -08002174 apq8064_common_init();
2175 ethernet_init();
2176 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
2177 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002178 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07002179 apq8064_init_gpu();
Matt Wagantall1875d322012-02-22 16:11:33 -08002180 platform_add_devices(apq8064_fs_devices, apq8064_num_fs_devices);
Kevin Chand07220e2012-02-13 15:52:22 -08002181 apq8064_init_cam();
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302182
2183 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
2184 platform_device_register(&cdp_kp_pdev);
2185
2186 if (machine_is_apq8064_mtp())
2187 platform_device_register(&mtp_kp_pdev);
Joel King82b7e3f2012-01-05 10:03:27 -08002188}
2189
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002190MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
2191 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002192 .reserve = apq8064_reserve,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002193 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302194 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002195 .timer = &msm_timer,
2196 .init_machine = apq8064_sim_init,
2197MACHINE_END
2198
Joel King4e7ad222011-08-17 15:47:38 -07002199MACHINE_START(APQ8064_RUMI3, "QCT APQ8064 RUMI3")
2200 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002201 .reserve = apq8064_reserve,
Joel King4e7ad222011-08-17 15:47:38 -07002202 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302203 .handle_irq = gic_handle_irq,
Joel King4e7ad222011-08-17 15:47:38 -07002204 .timer = &msm_timer,
2205 .init_machine = apq8064_rumi3_init,
Huaibin Yang4a084e32011-12-15 15:25:52 -08002206 .init_early = apq8064_allocate_memory_regions,
Joel King4e7ad222011-08-17 15:47:38 -07002207MACHINE_END
2208
Joel King82b7e3f2012-01-05 10:03:27 -08002209MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
2210 .map_io = apq8064_map_io,
2211 .reserve = apq8064_reserve,
2212 .init_irq = apq8064_init_irq,
2213 .handle_irq = gic_handle_irq,
2214 .timer = &msm_timer,
2215 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002216 .init_early = apq8064_allocate_memory_regions,
Joel King82b7e3f2012-01-05 10:03:27 -08002217MACHINE_END
2218
2219MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
2220 .map_io = apq8064_map_io,
2221 .reserve = apq8064_reserve,
2222 .init_irq = apq8064_init_irq,
2223 .handle_irq = gic_handle_irq,
2224 .timer = &msm_timer,
2225 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002226 .init_early = apq8064_allocate_memory_regions,
Joel King82b7e3f2012-01-05 10:03:27 -08002227MACHINE_END
2228
2229MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
2230 .map_io = apq8064_map_io,
2231 .reserve = apq8064_reserve,
2232 .init_irq = apq8064_init_irq,
2233 .handle_irq = gic_handle_irq,
2234 .timer = &msm_timer,
2235 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002236 .init_early = apq8064_allocate_memory_regions,
Joel King82b7e3f2012-01-05 10:03:27 -08002237MACHINE_END
2238
Joel King11ca8202012-02-13 16:19:03 -08002239MACHINE_START(MPQ8064_HRD, "QCT MPQ8064 HRD")
2240 .map_io = apq8064_map_io,
2241 .reserve = apq8064_reserve,
2242 .init_irq = apq8064_init_irq,
2243 .handle_irq = gic_handle_irq,
2244 .timer = &msm_timer,
2245 .init_machine = apq8064_cdp_init,
2246MACHINE_END
2247
2248MACHINE_START(MPQ8064_DTV, "QCT MPQ8064 DTV")
2249 .map_io = apq8064_map_io,
2250 .reserve = apq8064_reserve,
2251 .init_irq = apq8064_init_irq,
2252 .handle_irq = gic_handle_irq,
2253 .timer = &msm_timer,
2254 .init_machine = apq8064_cdp_init,
2255MACHINE_END
2256