blob: 061966c78b51f5afd60d2e79bc882bf89a386060 [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
435static void __init apq8064_reserve(void)
436{
437 reserve_info = &apq8064_reserve_info;
438 locate_unstable_memory();
439 msm_reserve();
440}
441
Hemant Kumara945b472012-01-25 15:08:06 -0800442#ifdef CONFIG_USB_EHCI_MSM_HSIC
443static struct msm_hsic_host_platform_data msm_hsic_pdata = {
444 .strobe = 88,
445 .data = 89,
446};
447#else
448static struct msm_hsic_host_platform_data msm_hsic_pdata;
449#endif
450
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800451#define PID_MAGIC_ID 0x71432909
452#define SERIAL_NUM_MAGIC_ID 0x61945374
453#define SERIAL_NUMBER_LENGTH 127
454#define DLOAD_USB_BASE_ADD 0x2A03F0C8
455
456struct magic_num_struct {
457 uint32_t pid;
458 uint32_t serial_num;
459};
460
461struct dload_struct {
462 uint32_t reserved1;
463 uint32_t reserved2;
464 uint32_t reserved3;
465 uint16_t reserved4;
466 uint16_t pid;
467 char serial_number[SERIAL_NUMBER_LENGTH];
468 uint16_t reserved5;
469 struct magic_num_struct magic_struct;
470};
471
472static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
473{
474 struct dload_struct __iomem *dload = 0;
475
476 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
477 if (!dload) {
478 pr_err("%s: cannot remap I/O memory region: %08x\n",
479 __func__, DLOAD_USB_BASE_ADD);
480 return -ENXIO;
481 }
482
483 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
484 __func__, dload, pid, snum);
485 /* update pid */
486 dload->magic_struct.pid = PID_MAGIC_ID;
487 dload->pid = pid;
488
489 /* update serial number */
490 dload->magic_struct.serial_num = 0;
491 if (!snum) {
492 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
493 goto out;
494 }
495
496 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
497 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
498out:
499 iounmap(dload);
500 return 0;
501}
502
503static struct android_usb_platform_data android_usb_pdata = {
504 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
505};
506
Hemant Kumar4933b072011-10-17 23:43:11 -0700507static struct platform_device android_usb_device = {
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800508 .name = "android_usb",
509 .id = -1,
510 .dev = {
511 .platform_data = &android_usb_pdata,
512 },
Hemant Kumar4933b072011-10-17 23:43:11 -0700513};
514
Hemant Kumar7620eed2012-02-26 09:08:43 -0800515/* Bandwidth requests (zero) if no vote placed */
516static struct msm_bus_vectors usb_init_vectors[] = {
517 {
518 .src = MSM_BUS_MASTER_SPS,
519 .dst = MSM_BUS_SLAVE_EBI_CH0,
520 .ab = 0,
521 .ib = 0,
522 },
523};
524
525/* Bus bandwidth requests in Bytes/sec */
526static struct msm_bus_vectors usb_max_vectors[] = {
527 {
528 .src = MSM_BUS_MASTER_SPS,
529 .dst = MSM_BUS_SLAVE_EBI_CH0,
530 .ab = 60000000, /* At least 480Mbps on bus. */
531 .ib = 960000000, /* MAX bursts rate */
532 },
533};
534
535static struct msm_bus_paths usb_bus_scale_usecases[] = {
536 {
537 ARRAY_SIZE(usb_init_vectors),
538 usb_init_vectors,
539 },
540 {
541 ARRAY_SIZE(usb_max_vectors),
542 usb_max_vectors,
543 },
544};
545
546static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
547 usb_bus_scale_usecases,
548 ARRAY_SIZE(usb_bus_scale_usecases),
549 .name = "usb",
550};
551
Hemant Kumar4933b072011-10-17 23:43:11 -0700552static struct msm_otg_platform_data msm_otg_pdata = {
Hemant Kumard86c4882012-01-24 19:39:37 -0800553 .mode = USB_OTG,
554 .otg_control = OTG_PMIC_CONTROL,
Hemant Kumar4933b072011-10-17 23:43:11 -0700555 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Hemant Kumard86c4882012-01-24 19:39:37 -0800556 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
557 .power_budget = 750,
Hemant Kumar7620eed2012-02-26 09:08:43 -0800558 .bus_scale_table = &usb_bus_scale_pdata,
Hemant Kumar4933b072011-10-17 23:43:11 -0700559};
560
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800561static struct msm_usb_host_platform_data msm_ehci_host_pdata3 = {
Manu Gautam91223e02011-11-08 15:27:22 +0530562 .power_budget = 500,
563};
564
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800565#ifdef CONFIG_USB_EHCI_MSM_HOST4
566static struct msm_usb_host_platform_data msm_ehci_host_pdata4;
567#endif
568
Manu Gautam91223e02011-11-08 15:27:22 +0530569static void __init apq8064_ehci_host_init(void)
570{
571 if (machine_is_apq8064_liquid()) {
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800572 msm_ehci_host_pdata3.dock_connect_irq =
Hemant Kumar56925352012-02-13 16:59:52 -0800573 PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9);
574
Manu Gautam91223e02011-11-08 15:27:22 +0530575 apq8064_device_ehci_host3.dev.platform_data =
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800576 &msm_ehci_host_pdata3;
Manu Gautam91223e02011-11-08 15:27:22 +0530577 platform_device_register(&apq8064_device_ehci_host3);
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800578
579#ifdef CONFIG_USB_EHCI_MSM_HOST4
580 apq8064_device_ehci_host4.dev.platform_data =
581 &msm_ehci_host_pdata4;
582 platform_device_register(&apq8064_device_ehci_host4);
583#endif
Manu Gautam91223e02011-11-08 15:27:22 +0530584 }
585}
586
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800587#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
588
589/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
590 * 4 micbiases are used to power various analog and digital
591 * microphones operating at 1800 mV. Technically, all micbiases
592 * can source from single cfilter since all microphones operate
593 * at the same voltage level. The arrangement below is to make
594 * sure all cfilters are exercised. LDO_H regulator ouput level
595 * does not need to be as high as 2.85V. It is choosen for
596 * microphone sensitivity purpose.
597 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530598static struct wcd9xxx_pdata apq8064_tabla_platform_data = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800599 .slimbus_slave_device = {
600 .name = "tabla-slave",
601 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
602 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800603 .irq = MSM_GPIO_TO_INT(42),
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800604 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530605 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800606 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
607 .micbias = {
608 .ldoh_v = TABLA_LDOH_2P85_V,
609 .cfilt1_mv = 1800,
610 .cfilt2_mv = 1800,
611 .cfilt3_mv = 1800,
612 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
613 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
614 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
615 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530616 },
617 .regulator = {
618 {
619 .name = "CDC_VDD_CP",
620 .min_uV = 1800000,
621 .max_uV = 1800000,
622 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
623 },
624 {
625 .name = "CDC_VDDA_RX",
626 .min_uV = 1800000,
627 .max_uV = 1800000,
628 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
629 },
630 {
631 .name = "CDC_VDDA_TX",
632 .min_uV = 1800000,
633 .max_uV = 1800000,
634 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
635 },
636 {
637 .name = "VDDIO_CDC",
638 .min_uV = 1800000,
639 .max_uV = 1800000,
640 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
641 },
642 {
643 .name = "VDDD_CDC_D",
644 .min_uV = 1225000,
645 .max_uV = 1225000,
646 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
647 },
648 {
649 .name = "CDC_VDDA_A_1P2V",
650 .min_uV = 1225000,
651 .max_uV = 1225000,
652 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
653 },
654 },
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800655};
656
657static struct slim_device apq8064_slim_tabla = {
658 .name = "tabla-slim",
659 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
660 .dev = {
661 .platform_data = &apq8064_tabla_platform_data,
662 },
663};
664
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530665static struct wcd9xxx_pdata apq8064_tabla20_platform_data = {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800666 .slimbus_slave_device = {
667 .name = "tabla-slave",
668 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
669 },
670 .irq = MSM_GPIO_TO_INT(42),
671 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530672 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800673 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
674 .micbias = {
675 .ldoh_v = TABLA_LDOH_2P85_V,
676 .cfilt1_mv = 1800,
677 .cfilt2_mv = 1800,
678 .cfilt3_mv = 1800,
679 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
680 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
681 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
682 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530683 },
684 .regulator = {
685 {
686 .name = "CDC_VDD_CP",
687 .min_uV = 1800000,
688 .max_uV = 1800000,
689 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
690 },
691 {
692 .name = "CDC_VDDA_RX",
693 .min_uV = 1800000,
694 .max_uV = 1800000,
695 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
696 },
697 {
698 .name = "CDC_VDDA_TX",
699 .min_uV = 1800000,
700 .max_uV = 1800000,
701 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
702 },
703 {
704 .name = "VDDIO_CDC",
705 .min_uV = 1800000,
706 .max_uV = 1800000,
707 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
708 },
709 {
710 .name = "VDDD_CDC_D",
711 .min_uV = 1225000,
712 .max_uV = 1225000,
713 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
714 },
715 {
716 .name = "CDC_VDDA_A_1P2V",
717 .min_uV = 1225000,
718 .max_uV = 1225000,
719 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
720 },
721 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800722};
723
724static struct slim_device apq8064_slim_tabla20 = {
725 .name = "tabla2x-slim",
726 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
727 .dev = {
728 .platform_data = &apq8064_tabla20_platform_data,
729 },
730};
731
Amy Maloche70090f992012-02-16 16:35:26 -0800732#define HAP_SHIFT_LVL_OE_GPIO PM8921_MPP_PM_TO_SYS(8)
733#define ISA1200_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
734#define ISA1200_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
735#define ISA1200_HAP_CLK PM8921_GPIO_PM_TO_SYS(44)
736
737static int isa1200_power(int on)
738{
739 gpio_set_value_cansleep(ISA1200_HAP_CLK, !!on);
740
741 return 0;
742}
743
744static int isa1200_dev_setup(bool enable)
745{
746 int rc = 0;
747
748 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_1, enable);
749 if (rc) {
750 pr_err("%s: unable to write aux clock register(%d)\n",
751 __func__, rc);
752 return rc;
753 }
754
755 if (!enable)
756 goto free_gpio;
757
758 rc = gpio_request(ISA1200_HAP_CLK, "haptics_clk");
759 if (rc) {
760 pr_err("%s: unable to request gpio %d config(%d)\n",
761 __func__, ISA1200_HAP_CLK, rc);
762 return rc;
763 }
764
765 rc = gpio_direction_output(ISA1200_HAP_CLK, 0);
766 if (rc) {
767 pr_err("%s: unable to set direction\n", __func__);
768 goto free_gpio;
769 }
770
771 return 0;
772
773free_gpio:
774 gpio_free(ISA1200_HAP_CLK);
775 return rc;
776}
777
778static struct isa1200_regulator isa1200_reg_data[] = {
779 {
780 .name = "vddp",
781 .min_uV = ISA_I2C_VTG_MIN_UV,
782 .max_uV = ISA_I2C_VTG_MAX_UV,
783 .load_uA = ISA_I2C_CURR_UA,
784 },
785};
786
787static struct isa1200_platform_data isa1200_1_pdata = {
788 .name = "vibrator",
789 .dev_setup = isa1200_dev_setup,
790 .power_on = isa1200_power,
791 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
792 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
793 .max_timeout = 15000,
794 .mode_ctrl = PWM_GEN_MODE,
795 .pwm_fd = {
796 .pwm_div = 256,
797 },
798 .is_erm = false,
799 .smart_en = true,
800 .ext_clk_en = true,
801 .chip_en = 1,
802 .regulator_info = isa1200_reg_data,
803 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
804};
805
806static struct i2c_board_info isa1200_board_info[] __initdata = {
807 {
808 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
809 .platform_data = &isa1200_1_pdata,
810 },
811};
Jing Lin21ed4de2012-02-05 15:53:28 -0800812/* configuration data for mxt1386e using V2.1 firmware */
813static const u8 mxt1386e_config_data_v2_1[] = {
814 /* T6 Object */
815 0, 0, 0, 0, 0, 0,
816 /* T38 Object */
Jing Linf1208fd2012-02-23 11:15:42 -0800817 14, 1, 0, 22, 2, 12, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800818 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
819 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
820 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
821 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
822 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
823 0, 0, 0, 0,
824 /* T7 Object */
Jing Linf1208fd2012-02-23 11:15:42 -0800825 100, 10, 50,
Jing Lin21ed4de2012-02-05 15:53:28 -0800826 /* T8 Object */
Jing Linf1208fd2012-02-23 11:15:42 -0800827 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800828 /* T9 Object */
829 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
830 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
Jing Linf1208fd2012-02-23 11:15:42 -0800831 85, 5, 0, 5, 9, 5, 12, 35, 70, 40,
832 20, 5, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800833 /* T18 Object */
834 0, 0,
835 /* T24 Object */
836 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
837 0, 0, 0, 0, 0, 0, 0, 0, 0,
838 /* T25 Object */
839 3, 0, 60, 115, 156, 99,
840 /* T27 Object */
841 0, 0, 0, 0, 0, 0, 0,
842 /* T40 Object */
843 0, 0, 0, 0, 0,
844 /* T42 Object */
845 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
846 /* T43 Object */
847 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
848 16,
849 /* T46 Object */
Jing Linf1208fd2012-02-23 11:15:42 -0800850 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800851 /* T47 Object */
852 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
853 /* T48 Object */
854 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -0800855 32, 40, 0, 10, 10, 0, 0, 100, 10, 90,
856 0, 0, 0, 0, 0, 0, 0, 10, 1, 10,
857 52, 10, 12, 0, 33, 0, 1, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800858 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
859 0, 0, 0, 0,
860 /* T56 Object */
861 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
862 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
863 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
864 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -0800865 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
866 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800867};
868
869#define MXT_TS_GPIO_IRQ 6
870#define MXT_TS_PWR_EN_GPIO PM8921_GPIO_PM_TO_SYS(23)
871#define MXT_TS_RESET_GPIO 33
872
873static struct mxt_config_info mxt_config_array[] = {
874 {
875 .config = mxt1386e_config_data_v2_1,
876 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
877 .family_id = 0xA0,
878 .variant_id = 0x7,
879 .version = 0x21,
880 .build = 0xAA,
881 },
882};
883
884static struct mxt_platform_data mxt_platform_data = {
885 .config_array = mxt_config_array,
886 .config_array_size = ARRAY_SIZE(mxt_config_array),
887 .x_size = 1365,
888 .y_size = 767,
889 .irqflags = IRQF_TRIGGER_FALLING,
890 .i2c_pull_up = true,
891 .reset_gpio = MXT_TS_RESET_GPIO,
892 .irq_gpio = MXT_TS_GPIO_IRQ,
893};
894
895static struct i2c_board_info mxt_device_info[] __initdata = {
896 {
897 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
898 .platform_data = &mxt_platform_data,
899 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
900 },
901};
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -0800902#define CYTTSP_TS_GPIO_IRQ 6
903#define CYTTSP_TS_GPIO_RESOUT 7
904#define CYTTSP_TS_GPIO_SLEEP 33
905
906static ssize_t tma340_vkeys_show(struct kobject *kobj,
907 struct kobj_attribute *attr, char *buf)
908{
909 return snprintf(buf, 200,
910 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
911 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
912 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
913 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
914 "\n");
915}
916
917static struct kobj_attribute tma340_vkeys_attr = {
918 .attr = {
919 .mode = S_IRUGO,
920 },
921 .show = &tma340_vkeys_show,
922};
923
924static struct attribute *tma340_properties_attrs[] = {
925 &tma340_vkeys_attr.attr,
926 NULL
927};
928
929static struct attribute_group tma340_properties_attr_group = {
930 .attrs = tma340_properties_attrs,
931};
932
933static int cyttsp_platform_init(struct i2c_client *client)
934{
935 int rc = 0;
936 static struct kobject *tma340_properties_kobj;
937
938 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
939 tma340_properties_kobj = kobject_create_and_add("board_properties",
940 NULL);
941 if (tma340_properties_kobj)
942 rc = sysfs_create_group(tma340_properties_kobj,
943 &tma340_properties_attr_group);
944 if (!tma340_properties_kobj || rc)
945 pr_err("%s: failed to create board_properties\n",
946 __func__);
947
948 return 0;
949}
950
951static struct cyttsp_regulator cyttsp_regulator_data[] = {
952 {
953 .name = "vdd",
954 .min_uV = CY_TMA300_VTG_MIN_UV,
955 .max_uV = CY_TMA300_VTG_MAX_UV,
956 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
957 .lpm_load_uA = CY_TMA300_CURR_24HZ_UA,
958 },
959 {
960 .name = "vcc_i2c",
961 .min_uV = CY_I2C_VTG_MIN_UV,
962 .max_uV = CY_I2C_VTG_MAX_UV,
963 .hpm_load_uA = CY_I2C_CURR_UA,
964 .lpm_load_uA = CY_I2C_CURR_UA,
965 },
966};
967
968static struct cyttsp_platform_data cyttsp_pdata = {
969 .panel_maxx = 634,
970 .panel_maxy = 1166,
971 .disp_maxx = 599,
972 .disp_maxy = 1023,
973 .disp_minx = 0,
974 .disp_miny = 0,
975 .flags = 0x01,
976 .gen = CY_GEN3,
977 .use_st = CY_USE_ST,
978 .use_mt = CY_USE_MT,
979 .use_hndshk = CY_SEND_HNDSHK,
980 .use_trk_id = CY_USE_TRACKING_ID,
981 .use_sleep = CY_USE_DEEP_SLEEP_SEL,
982 .use_gestures = CY_USE_GESTURES,
983 .fw_fname = "cyttsp_8064_mtp.hex",
984 /* change act_intrvl to customize the Active power state
985 * scanning/processing refresh interval for Operating mode
986 */
987 .act_intrvl = CY_ACT_INTRVL_DFLT,
988 /* change tch_tmout to customize the touch timeout for the
989 * Active power state for Operating mode
990 */
991 .tch_tmout = CY_TCH_TMOUT_DFLT,
992 /* change lp_intrvl to customize the Low Power power state
993 * scanning/processing refresh interval for Operating mode
994 */
995 .lp_intrvl = CY_LP_INTRVL_DFLT,
996 .sleep_gpio = CYTTSP_TS_GPIO_SLEEP,
997 .resout_gpio = CYTTSP_TS_GPIO_RESOUT,
998 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
999 .regulator_info = cyttsp_regulator_data,
1000 .num_regulators = ARRAY_SIZE(cyttsp_regulator_data),
1001 .init = cyttsp_platform_init,
1002 .correct_fw_ver = 17,
1003};
1004
1005static struct i2c_board_info cyttsp_info[] __initdata = {
1006 {
1007 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1008 .platform_data = &cyttsp_pdata,
1009 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1010 },
1011};
Jing Lin21ed4de2012-02-05 15:53:28 -08001012
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001013#define MSM_WCNSS_PHYS 0x03000000
1014#define MSM_WCNSS_SIZE 0x280000
1015
1016static struct resource resources_wcnss_wlan[] = {
1017 {
1018 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1019 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1020 .name = "wcnss_wlanrx_irq",
1021 .flags = IORESOURCE_IRQ,
1022 },
1023 {
1024 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1025 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1026 .name = "wcnss_wlantx_irq",
1027 .flags = IORESOURCE_IRQ,
1028 },
1029 {
1030 .start = MSM_WCNSS_PHYS,
1031 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1032 .name = "wcnss_mmio",
1033 .flags = IORESOURCE_MEM,
1034 },
1035 {
1036 .start = 64,
1037 .end = 68,
1038 .name = "wcnss_gpios_5wire",
1039 .flags = IORESOURCE_IO,
1040 },
1041};
1042
1043static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1044 .has_48mhz_xo = 1,
1045};
1046
1047static struct platform_device msm_device_wcnss_wlan = {
1048 .name = "wcnss_wlan",
1049 .id = 0,
1050 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1051 .resource = resources_wcnss_wlan,
1052 .dev = {.platform_data = &qcom_wcnss_pdata},
1053};
1054
Ankit Vermab7c26e62012-02-28 15:04:15 -08001055static struct platform_device msm_device_iris_fm __devinitdata = {
1056 .name = "iris_fm",
1057 .id = -1,
1058};
1059
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001060#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1061 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1062 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1063 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1064
1065#define QCE_SIZE 0x10000
1066#define QCE_0_BASE 0x11000000
1067
1068#define QCE_HW_KEY_SUPPORT 0
1069#define QCE_SHA_HMAC_SUPPORT 1
1070#define QCE_SHARE_CE_RESOURCE 3
1071#define QCE_CE_SHARED 0
1072
1073static struct resource qcrypto_resources[] = {
1074 [0] = {
1075 .start = QCE_0_BASE,
1076 .end = QCE_0_BASE + QCE_SIZE - 1,
1077 .flags = IORESOURCE_MEM,
1078 },
1079 [1] = {
1080 .name = "crypto_channels",
1081 .start = DMOV8064_CE_IN_CHAN,
1082 .end = DMOV8064_CE_OUT_CHAN,
1083 .flags = IORESOURCE_DMA,
1084 },
1085 [2] = {
1086 .name = "crypto_crci_in",
1087 .start = DMOV8064_CE_IN_CRCI,
1088 .end = DMOV8064_CE_IN_CRCI,
1089 .flags = IORESOURCE_DMA,
1090 },
1091 [3] = {
1092 .name = "crypto_crci_out",
1093 .start = DMOV8064_CE_OUT_CRCI,
1094 .end = DMOV8064_CE_OUT_CRCI,
1095 .flags = IORESOURCE_DMA,
1096 },
1097};
1098
1099static struct resource qcedev_resources[] = {
1100 [0] = {
1101 .start = QCE_0_BASE,
1102 .end = QCE_0_BASE + QCE_SIZE - 1,
1103 .flags = IORESOURCE_MEM,
1104 },
1105 [1] = {
1106 .name = "crypto_channels",
1107 .start = DMOV8064_CE_IN_CHAN,
1108 .end = DMOV8064_CE_OUT_CHAN,
1109 .flags = IORESOURCE_DMA,
1110 },
1111 [2] = {
1112 .name = "crypto_crci_in",
1113 .start = DMOV8064_CE_IN_CRCI,
1114 .end = DMOV8064_CE_IN_CRCI,
1115 .flags = IORESOURCE_DMA,
1116 },
1117 [3] = {
1118 .name = "crypto_crci_out",
1119 .start = DMOV8064_CE_OUT_CRCI,
1120 .end = DMOV8064_CE_OUT_CRCI,
1121 .flags = IORESOURCE_DMA,
1122 },
1123};
1124
1125#endif
1126
1127#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1128 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1129
1130static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1131 .ce_shared = QCE_CE_SHARED,
1132 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1133 .hw_key_support = QCE_HW_KEY_SUPPORT,
1134 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001135 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001136};
1137
1138static struct platform_device qcrypto_device = {
1139 .name = "qcrypto",
1140 .id = 0,
1141 .num_resources = ARRAY_SIZE(qcrypto_resources),
1142 .resource = qcrypto_resources,
1143 .dev = {
1144 .coherent_dma_mask = DMA_BIT_MASK(32),
1145 .platform_data = &qcrypto_ce_hw_suppport,
1146 },
1147};
1148#endif
1149
1150#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1151 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1152
1153static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1154 .ce_shared = QCE_CE_SHARED,
1155 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1156 .hw_key_support = QCE_HW_KEY_SUPPORT,
1157 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001158 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001159};
1160
1161static struct platform_device qcedev_device = {
1162 .name = "qce",
1163 .id = 0,
1164 .num_resources = ARRAY_SIZE(qcedev_resources),
1165 .resource = qcedev_resources,
1166 .dev = {
1167 .coherent_dma_mask = DMA_BIT_MASK(32),
1168 .platform_data = &qcedev_ce_hw_suppport,
1169 },
1170};
1171#endif
1172
Joel Kingdacbc822012-01-25 13:30:57 -08001173static struct mdm_platform_data mdm_platform_data = {
1174 .mdm_version = "3.0",
1175 .ramdump_delay_ms = 2000,
Hemant Kumara945b472012-01-25 15:08:06 -08001176 .peripheral_platform_device = &apq8064_device_hsic_host,
Joel Kingdacbc822012-01-25 13:30:57 -08001177};
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001178
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001179static struct tsens_platform_data apq_tsens_pdata = {
1180 .tsens_factor = 1000,
1181 .hw_type = APQ_8064,
1182 .tsens_num_sensor = 11,
1183 .slope = {1176, 1176, 1154, 1176, 1111,
1184 1132, 1132, 1199, 1132, 1199, 1132},
1185};
1186
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001187#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001188static void __init apq8064_map_io(void)
1189{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001190 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001191 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001192 if (socinfo_init() < 0)
1193 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001194}
1195
1196static void __init apq8064_init_irq(void)
1197{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001198 struct msm_mpm_device_data *data = NULL;
1199
1200#ifdef CONFIG_MSM_MPM
1201 data = &apq8064_mpm_dev_data;
1202#endif
1203
1204 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001205 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1206 (void *)MSM_QGIC_CPU_BASE);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001207}
1208
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001209static struct platform_device msm8064_device_saw_regulator_core0 = {
1210 .name = "saw-regulator",
1211 .id = 0,
1212 .dev = {
1213 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
1214 },
1215};
1216
1217static struct platform_device msm8064_device_saw_regulator_core1 = {
1218 .name = "saw-regulator",
1219 .id = 1,
1220 .dev = {
1221 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
1222 },
1223};
1224
1225static struct platform_device msm8064_device_saw_regulator_core2 = {
1226 .name = "saw-regulator",
1227 .id = 2,
1228 .dev = {
1229 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
1230 },
1231};
1232
1233static struct platform_device msm8064_device_saw_regulator_core3 = {
1234 .name = "saw-regulator",
1235 .id = 3,
1236 .dev = {
1237 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001238
1239 },
1240};
1241
Oluwafemi Adeyemif5a31422012-03-08 16:58:45 -08001242static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001243 {
1244 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1245 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1246 true,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001247 100, 650, 801, 200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001248 },
1249
1250 {
1251 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1252 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1253 true,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001254 2000, 200, 576000, 2000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001255 },
1256
1257 {
1258 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1259 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1260 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001261 8500, 51, 1122000, 8500,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001262 },
1263
1264 {
1265 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1266 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
1267 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001268 9000, 51, 1130300, 9000,
1269 },
1270 {
1271 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1272 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
1273 false,
1274 10000, 51, 1130300, 10000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001275 },
1276
1277 {
1278 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1279 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1280 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001281 12000, 14, 2205900, 12000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001282 },
1283
1284 {
1285 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1286 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1287 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001288 18000, 12, 2364250, 18000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001289 },
1290
1291 {
1292 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1293 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1294 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001295 23500, 10, 2667000, 23500,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001296 },
1297
1298 {
1299 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1300 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1301 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001302 29700, 5, 2867000, 30000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001303 },
1304};
1305
Oluwafemi Adeyemif5a31422012-03-08 16:58:45 -08001306uint32_t apq8064_rpm_get_swfi_latency(void)
1307{
1308 int i;
1309
1310 for (i = 0; i < ARRAY_SIZE(msm_rpmrs_levels); i++) {
1311 if (msm_rpmrs_levels[i].sleep_mode ==
1312 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)
1313 return msm_rpmrs_levels[i].latency_us;
1314 }
1315
1316 return 0;
1317}
1318
Praveen Chidambaram78499012011-11-01 17:15:17 -06001319static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1320 .mode = MSM_PM_BOOT_CONFIG_TZ,
1321};
1322
1323static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
1324 .levels = &msm_rpmrs_levels[0],
1325 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
1326 .vdd_mem_levels = {
1327 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
1328 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
1329 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
1330 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
1331 },
1332 .vdd_dig_levels = {
1333 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
1334 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
1335 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
1336 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
1337 },
1338 .vdd_mask = 0x7FFFFF,
1339 .rpmrs_target_id = {
1340 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
1341 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
1342 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
1343 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
1344 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
1345 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
1346 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
1347 },
1348};
1349
1350static struct msm_cpuidle_state msm_cstates[] __initdata = {
1351 {0, 0, "C0", "WFI",
1352 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1353
1354 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1355 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1356
1357 {0, 2, "C2", "POWER_COLLAPSE",
1358 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
1359
1360 {1, 0, "C0", "WFI",
1361 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1362
1363 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1364 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1365
1366 {2, 0, "C0", "WFI",
1367 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1368
1369 {2, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1370 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1371
1372 {3, 0, "C0", "WFI",
1373 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1374
1375 {3, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1376 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1377};
1378
1379static struct msm_pm_platform_data msm_pm_data[] = {
1380 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1381 .idle_supported = 1,
1382 .suspend_supported = 1,
1383 .idle_enabled = 0,
1384 .suspend_enabled = 0,
1385 },
1386
1387 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1388 .idle_supported = 1,
1389 .suspend_supported = 1,
1390 .idle_enabled = 0,
1391 .suspend_enabled = 0,
1392 },
1393
1394 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1395 .idle_supported = 1,
1396 .suspend_supported = 1,
1397 .idle_enabled = 1,
1398 .suspend_enabled = 1,
1399 },
1400
1401 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1402 .idle_supported = 0,
1403 .suspend_supported = 1,
1404 .idle_enabled = 0,
1405 .suspend_enabled = 0,
1406 },
1407
1408 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1409 .idle_supported = 1,
1410 .suspend_supported = 1,
1411 .idle_enabled = 0,
1412 .suspend_enabled = 0,
1413 },
1414
1415 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1416 .idle_supported = 1,
1417 .suspend_supported = 0,
1418 .idle_enabled = 1,
1419 .suspend_enabled = 0,
1420 },
1421
1422 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1423 .idle_supported = 0,
1424 .suspend_supported = 1,
1425 .idle_enabled = 0,
1426 .suspend_enabled = 0,
1427 },
1428
1429 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1430 .idle_supported = 1,
1431 .suspend_supported = 1,
1432 .idle_enabled = 0,
1433 .suspend_enabled = 0,
1434 },
1435
1436 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1437 .idle_supported = 1,
1438 .suspend_supported = 0,
1439 .idle_enabled = 1,
1440 .suspend_enabled = 0,
1441 },
1442
1443 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1444 .idle_supported = 0,
1445 .suspend_supported = 1,
1446 .idle_enabled = 0,
1447 .suspend_enabled = 0,
1448 },
1449
1450 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1451 .idle_supported = 1,
1452 .suspend_supported = 1,
1453 .idle_enabled = 0,
1454 .suspend_enabled = 0,
1455 },
1456
1457 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1458 .idle_supported = 1,
1459 .suspend_supported = 0,
1460 .idle_enabled = 1,
1461 .suspend_enabled = 0,
1462 },
1463};
1464
1465static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1466 0x03, 0x0f,
1467};
1468
1469static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1470 0x00, 0x24, 0x54, 0x10,
1471 0x09, 0x03, 0x01,
1472 0x10, 0x54, 0x30, 0x0C,
1473 0x24, 0x30, 0x0f,
1474};
1475
1476static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1477 0x00, 0x24, 0x54, 0x10,
1478 0x09, 0x07, 0x01, 0x0B,
1479 0x10, 0x54, 0x30, 0x0C,
1480 0x24, 0x30, 0x0f,
1481};
1482
1483static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1484 [0] = {
1485 .mode = MSM_SPM_MODE_CLOCK_GATING,
1486 .notify_rpm = false,
1487 .cmd = spm_wfi_cmd_sequence,
1488 },
1489 [1] = {
1490 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1491 .notify_rpm = false,
1492 .cmd = spm_power_collapse_without_rpm,
1493 },
1494 [2] = {
1495 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1496 .notify_rpm = true,
1497 .cmd = spm_power_collapse_with_rpm,
1498 },
1499};
1500
1501static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1502 0x00, 0x20, 0x03, 0x20,
1503 0x00, 0x0f,
1504};
1505
1506static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1507 0x00, 0x20, 0x34, 0x64,
1508 0x48, 0x07, 0x48, 0x20,
1509 0x50, 0x64, 0x04, 0x34,
1510 0x50, 0x0f,
1511};
1512static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1513 0x00, 0x10, 0x34, 0x64,
1514 0x48, 0x07, 0x48, 0x10,
1515 0x50, 0x64, 0x04, 0x34,
1516 0x50, 0x0F,
1517};
1518
1519static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1520 [0] = {
1521 .mode = MSM_SPM_L2_MODE_RETENTION,
1522 .notify_rpm = false,
1523 .cmd = l2_spm_wfi_cmd_sequence,
1524 },
1525 [1] = {
1526 .mode = MSM_SPM_L2_MODE_GDHS,
1527 .notify_rpm = true,
1528 .cmd = l2_spm_gdhs_cmd_sequence,
1529 },
1530 [2] = {
1531 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1532 .notify_rpm = true,
1533 .cmd = l2_spm_power_off_cmd_sequence,
1534 },
1535};
1536
1537
1538static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1539 [0] = {
1540 .reg_base_addr = MSM_SAW_L2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001541 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001542 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001543 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1544 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1545 .modes = msm_spm_l2_seq_list,
1546 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1547 },
1548};
1549
1550static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1551 [0] = {
1552 .reg_base_addr = MSM_SAW0_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001553 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001554#if defined(CONFIG_MSM_AVS_HW)
1555 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1556 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1557#endif
1558 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001559 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001560 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1561 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1562 .vctl_timeout_us = 50,
1563 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1564 .modes = msm_spm_seq_list,
1565 },
1566 [1] = {
1567 .reg_base_addr = MSM_SAW1_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001568 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001569#if defined(CONFIG_MSM_AVS_HW)
1570 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1571 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1572#endif
1573 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001574 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001575 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1576 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1577 .vctl_timeout_us = 50,
1578 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1579 .modes = msm_spm_seq_list,
1580 },
1581 [2] = {
1582 .reg_base_addr = MSM_SAW2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001583 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001584#if defined(CONFIG_MSM_AVS_HW)
1585 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1586 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1587#endif
1588 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001589 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001590 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1591 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1592 .vctl_timeout_us = 50,
1593 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1594 .modes = msm_spm_seq_list,
1595 },
1596 [3] = {
1597 .reg_base_addr = MSM_SAW3_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001598 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001599#if defined(CONFIG_MSM_AVS_HW)
1600 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1601 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1602#endif
1603 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001604 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001605 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1606 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1607 .vctl_timeout_us = 50,
1608 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1609 .modes = msm_spm_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001610 },
1611};
1612
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001613static void __init apq8064_init_buses(void)
1614{
1615 msm_bus_rpm_set_mt_mask();
1616 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
1617 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
1618 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
1619 msm_bus_8064_apps_fabric.dev.platform_data =
1620 &msm_bus_8064_apps_fabric_pdata;
1621 msm_bus_8064_sys_fabric.dev.platform_data =
1622 &msm_bus_8064_sys_fabric_pdata;
1623 msm_bus_8064_mm_fabric.dev.platform_data =
1624 &msm_bus_8064_mm_fabric_pdata;
1625 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
1626 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
1627}
1628
David Collinsf0d00732012-01-25 15:46:50 -08001629static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
1630 .name = GPIO_REGULATOR_DEV_NAME,
1631 .id = PM8921_MPP_PM_TO_SYS(7),
1632 .dev = {
1633 .platform_data
1634 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
1635 },
1636};
1637
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08001638static struct platform_device apq8064_device_ext_mpp8_vreg __devinitdata = {
1639 .name = GPIO_REGULATOR_DEV_NAME,
1640 .id = PM8921_MPP_PM_TO_SYS(8),
1641 .dev = {
1642 .platform_data
1643 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_MPP8],
1644 },
1645};
1646
David Collinsf0d00732012-01-25 15:46:50 -08001647static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
1648 .name = GPIO_REGULATOR_DEV_NAME,
1649 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
1650 .dev = {
1651 .platform_data =
1652 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
1653 },
1654};
1655
David Collins390fc332012-02-07 14:38:16 -08001656static struct platform_device apq8064_device_ext_ts_sw_vreg __devinitdata = {
1657 .name = GPIO_REGULATOR_DEV_NAME,
1658 .id = PM8921_GPIO_PM_TO_SYS(23),
1659 .dev = {
1660 .platform_data
1661 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_TS_SW],
1662 },
1663};
1664
David Collins2782b5c2012-02-06 10:02:42 -08001665static struct platform_device apq8064_device_rpm_regulator __devinitdata = {
1666 .name = "rpm-regulator",
1667 .id = -1,
1668 .dev = {
1669 .platform_data = &apq8064_rpm_regulator_pdata,
1670 },
1671};
1672
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001673static struct platform_device *common_devices[] __initdata = {
Jin Hong01f2dbb2011-11-03 22:13:51 -07001674 &apq8064_device_dmov,
David Keitel3c40fc52012-02-09 17:53:52 -08001675 &apq8064_device_qup_i2c_gsbi1,
Jing Lin04601f92012-02-05 15:36:07 -08001676 &apq8064_device_qup_i2c_gsbi3,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001677 &apq8064_device_qup_i2c_gsbi4,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001678 &apq8064_device_qup_spi_gsbi5,
David Collinsf0d00732012-01-25 15:46:50 -08001679 &apq8064_device_ext_5v_vreg,
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08001680 &apq8064_device_ext_mpp8_vreg,
David Collinsf0d00732012-01-25 15:46:50 -08001681 &apq8064_device_ext_3p3v_vreg,
David Collins390fc332012-02-07 14:38:16 -08001682 &apq8064_device_ext_ts_sw_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07001683 &apq8064_device_ssbi_pmic1,
1684 &apq8064_device_ssbi_pmic2,
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001685 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07001686 &apq8064_device_otg,
1687 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08001688 &apq8064_device_hsusb_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07001689 &android_usb_device,
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001690 &msm_device_wcnss_wlan,
Ankit Vermab7c26e62012-02-28 15:04:15 -08001691 &msm_device_iris_fm,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001692#ifdef CONFIG_ANDROID_PMEM
1693#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -07001694 &android_pmem_device,
1695 &android_pmem_adsp_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001696#endif
Kevin Chan13be4e22011-10-20 11:30:32 -07001697 &android_pmem_audio_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001698#endif
1699#ifdef CONFIG_ION_MSM
1700 &ion_dev,
1701#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001702 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001703 &msm8064_device_saw_regulator_core0,
1704 &msm8064_device_saw_regulator_core1,
1705 &msm8064_device_saw_regulator_core2,
1706 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001707#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1708 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1709 &qcrypto_device,
1710#endif
1711
1712#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1713 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1714 &qcedev_device,
1715#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07001716
1717#ifdef CONFIG_HW_RANDOM_MSM
1718 &apq8064_device_rng,
1719#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08001720 &apq_pcm,
1721 &apq_pcm_routing,
1722 &apq_cpudai0,
1723 &apq_cpudai1,
1724 &apq_cpudai_hdmi_rx,
1725 &apq_cpudai_bt_rx,
1726 &apq_cpudai_bt_tx,
1727 &apq_cpudai_fm_rx,
1728 &apq_cpudai_fm_tx,
1729 &apq_cpu_fe,
1730 &apq_stub_codec,
1731 &apq_voice,
1732 &apq_voip,
1733 &apq_lpa_pcm,
1734 &apq_pcm_hostless,
1735 &apq_cpudai_afe_01_rx,
1736 &apq_cpudai_afe_01_tx,
1737 &apq_cpudai_afe_02_rx,
1738 &apq_cpudai_afe_02_tx,
1739 &apq_pcm_afe,
1740 &apq_cpudai_auxpcm_rx,
1741 &apq_cpudai_auxpcm_tx,
Neema Shetty8427c262012-02-16 11:23:43 -08001742 &apq_cpudai_stub,
Neema Shetty3c9d2862012-03-11 01:25:32 -08001743 &apq_cpudai_slimbus_1_rx,
1744 &apq_cpudai_slimbus_1_tx,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001745 &apq8064_rpm_device,
1746 &apq8064_rpm_log_device,
1747 &apq8064_rpm_stat_device,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001748 &msm_bus_8064_apps_fabric,
1749 &msm_bus_8064_sys_fabric,
1750 &msm_bus_8064_mm_fabric,
1751 &msm_bus_8064_sys_fpb,
1752 &msm_bus_8064_cpss_fpb,
Mohan Kumar Gubbihalli Lachma Naik7f72edd2012-02-06 17:26:47 -08001753 &apq8064_msm_device_vidc,
Matt Wagantalled832652012-02-02 19:23:17 -08001754 &msm_8960_riva,
Matt Wagantallb94b9a52012-02-02 21:59:54 -08001755 &msm_8960_q6_lpass,
Matt Wagantall292aace2012-01-26 19:12:34 -08001756 &msm_gss,
Laura Abbott350c8362012-02-28 14:46:52 -08001757#ifdef CONFIG_MSM_RTB
1758 &msm_rtb_device,
1759#endif
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001760};
1761
Joel King4e7ad222011-08-17 15:47:38 -07001762static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001763 &apq8064_device_uart_gsbi3,
Yan He06913ce2011-08-26 16:33:46 -07001764 &msm_device_sps_apq8064,
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001765};
1766
1767static struct platform_device *rumi3_devices[] __initdata = {
1768 &apq8064_device_uart_gsbi1,
Yan He435ed612011-11-23 17:34:59 -08001769 &msm_device_sps_apq8064,
Huaibin Yang4a084e32011-12-15 15:25:52 -08001770#ifdef CONFIG_MSM_ROTATOR
1771 &msm_rotator_device,
1772#endif
Joel King4e7ad222011-08-17 15:47:38 -07001773};
1774
Joel King82b7e3f2012-01-05 10:03:27 -08001775static struct platform_device *cdp_devices[] __initdata = {
1776 &apq8064_device_uart_gsbi1,
Jin Hong4bbbfba2012-02-02 21:48:07 -08001777 &apq8064_device_uart_gsbi7,
Joel King82b7e3f2012-01-05 10:03:27 -08001778 &msm_device_sps_apq8064,
Aravind Venkateswaran4ca27532012-02-16 14:27:05 -08001779#ifdef CONFIG_MSM_ROTATOR
1780 &msm_rotator_device,
1781#endif
Joel King82b7e3f2012-01-05 10:03:27 -08001782};
1783
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001784static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08001785 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001786};
1787
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001788#define KS8851_IRQ_GPIO 43
1789
1790static struct spi_board_info spi_board_info[] __initdata = {
1791 {
1792 .modalias = "ks8851",
1793 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1794 .max_speed_hz = 19200000,
1795 .bus_num = 0,
1796 .chip_select = 2,
1797 .mode = SPI_MODE_0,
1798 },
1799};
1800
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001801static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001802 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001803 .bus_num = 1,
1804 .slim_slave = &apq8064_slim_tabla,
1805 },
1806 {
1807 .bus_num = 1,
1808 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001809 },
1810 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001811};
1812
David Keitel3c40fc52012-02-09 17:53:52 -08001813static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi1_pdata = {
1814 .clk_freq = 100000,
1815 .src_clk_rate = 24000000,
1816};
1817
Jing Lin04601f92012-02-05 15:36:07 -08001818static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi3_pdata = {
1819 .clk_freq = 100000,
1820 .src_clk_rate = 24000000,
1821};
1822
Kenneth Heitke748593a2011-07-15 15:45:11 -06001823static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
1824 .clk_freq = 100000,
1825 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001826};
1827
David Keitel3c40fc52012-02-09 17:53:52 -08001828#define GSBI_DUAL_MODE_CODE 0x60
1829#define MSM_GSBI1_PHYS 0x12440000
Kenneth Heitke748593a2011-07-15 15:45:11 -06001830static void __init apq8064_i2c_init(void)
1831{
David Keitel3c40fc52012-02-09 17:53:52 -08001832 void __iomem *gsbi_mem;
1833
1834 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
1835 &apq8064_i2c_qup_gsbi1_pdata;
1836 gsbi_mem = ioremap_nocache(MSM_GSBI1_PHYS, 4);
1837 writel_relaxed(GSBI_DUAL_MODE_CODE, gsbi_mem);
1838 /* Ensure protocol code is written before proceeding */
1839 wmb();
1840 iounmap(gsbi_mem);
1841 apq8064_i2c_qup_gsbi1_pdata.use_gsbi_shared_mode = 1;
Jing Lin04601f92012-02-05 15:36:07 -08001842 apq8064_device_qup_i2c_gsbi3.dev.platform_data =
1843 &apq8064_i2c_qup_gsbi3_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06001844 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
1845 &apq8064_i2c_qup_gsbi4_pdata;
1846}
1847
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08001848#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001849static int ethernet_init(void)
1850{
1851 int ret;
1852 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
1853 if (ret) {
1854 pr_err("ks8851 gpio_request failed: %d\n", ret);
1855 goto fail;
1856 }
1857
1858 return 0;
1859fail:
1860 return ret;
1861}
1862#else
1863static int ethernet_init(void)
1864{
1865 return 0;
1866}
1867#endif
1868
Mohan Pallaka474b94b2012-01-25 12:59:58 +05301869#define GPIO_KEY_HOME PM8921_GPIO_PM_TO_SYS(27)
1870#define GPIO_KEY_VOLUME_UP PM8921_GPIO_PM_TO_SYS(35)
1871#define GPIO_KEY_VOLUME_DOWN PM8921_GPIO_PM_TO_SYS(38)
1872#define GPIO_KEY_CAM_FOCUS PM8921_GPIO_PM_TO_SYS(3)
1873#define GPIO_KEY_CAM_SNAP PM8921_GPIO_PM_TO_SYS(4)
Jing Lin3f8f8422012-03-05 09:32:11 -08001874#define GPIO_KEY_ROTATION PM8921_GPIO_PM_TO_SYS(42)
Mohan Pallaka474b94b2012-01-25 12:59:58 +05301875
1876static struct gpio_keys_button cdp_keys[] = {
1877 {
1878 .code = KEY_HOME,
1879 .gpio = GPIO_KEY_HOME,
1880 .desc = "home_key",
1881 .active_low = 1,
1882 .type = EV_KEY,
1883 .wakeup = 1,
1884 .debounce_interval = 15,
1885 },
1886 {
1887 .code = KEY_VOLUMEUP,
1888 .gpio = GPIO_KEY_VOLUME_UP,
1889 .desc = "volume_up_key",
1890 .active_low = 1,
1891 .type = EV_KEY,
1892 .wakeup = 1,
1893 .debounce_interval = 15,
1894 },
1895 {
1896 .code = KEY_VOLUMEDOWN,
1897 .gpio = GPIO_KEY_VOLUME_DOWN,
1898 .desc = "volume_down_key",
1899 .active_low = 1,
1900 .type = EV_KEY,
1901 .wakeup = 1,
1902 .debounce_interval = 15,
1903 },
1904 {
1905 .code = SW_ROTATE_LOCK,
1906 .gpio = GPIO_KEY_ROTATION,
1907 .desc = "rotate_key",
1908 .active_low = 1,
1909 .type = EV_SW,
1910 .debounce_interval = 15,
1911 },
1912};
1913
1914static struct gpio_keys_platform_data cdp_keys_data = {
1915 .buttons = cdp_keys,
1916 .nbuttons = ARRAY_SIZE(cdp_keys),
1917};
1918
1919static struct platform_device cdp_kp_pdev = {
1920 .name = "gpio-keys",
1921 .id = -1,
1922 .dev = {
1923 .platform_data = &cdp_keys_data,
1924 },
1925};
1926
1927static struct gpio_keys_button mtp_keys[] = {
1928 {
1929 .code = KEY_CAMERA_FOCUS,
1930 .gpio = GPIO_KEY_CAM_FOCUS,
1931 .desc = "cam_focus_key",
1932 .active_low = 1,
1933 .type = EV_KEY,
1934 .wakeup = 1,
1935 .debounce_interval = 15,
1936 },
1937 {
1938 .code = KEY_VOLUMEUP,
1939 .gpio = GPIO_KEY_VOLUME_UP,
1940 .desc = "volume_up_key",
1941 .active_low = 1,
1942 .type = EV_KEY,
1943 .wakeup = 1,
1944 .debounce_interval = 15,
1945 },
1946 {
1947 .code = KEY_VOLUMEDOWN,
1948 .gpio = GPIO_KEY_VOLUME_DOWN,
1949 .desc = "volume_down_key",
1950 .active_low = 1,
1951 .type = EV_KEY,
1952 .wakeup = 1,
1953 .debounce_interval = 15,
1954 },
1955 {
1956 .code = KEY_CAMERA_SNAPSHOT,
1957 .gpio = GPIO_KEY_CAM_SNAP,
1958 .desc = "cam_snap_key",
1959 .active_low = 1,
1960 .type = EV_KEY,
1961 .debounce_interval = 15,
1962 },
1963};
1964
1965static struct gpio_keys_platform_data mtp_keys_data = {
1966 .buttons = mtp_keys,
1967 .nbuttons = ARRAY_SIZE(mtp_keys),
1968};
1969
1970static struct platform_device mtp_kp_pdev = {
1971 .name = "gpio-keys",
1972 .id = -1,
1973 .dev = {
1974 .platform_data = &mtp_keys_data,
1975 },
1976};
1977
Jin Hongd3024e62012-02-09 16:13:32 -08001978/* Sensors DSPS platform data */
1979#define DSPS_PIL_GENERIC_NAME "dsps"
1980static void __init apq8064_init_dsps(void)
1981{
1982 struct msm_dsps_platform_data *pdata =
1983 msm_dsps_device_8064.dev.platform_data;
1984 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
1985 pdata->gpios = NULL;
1986 pdata->gpios_num = 0;
1987
1988 platform_device_register(&msm_dsps_device_8064);
1989}
Mohan Pallaka474b94b2012-01-25 12:59:58 +05301990
Tianyi Gou41515e22011-09-01 19:37:43 -07001991static void __init apq8064_clock_init(void)
1992{
Tianyi Gouacb588d2012-01-27 18:24:05 -08001993 if (machine_is_apq8064_rumi3())
Tianyi Gou41515e22011-09-01 19:37:43 -07001994 msm_clock_init(&apq8064_dummy_clock_init_data);
Tianyi Gouacb588d2012-01-27 18:24:05 -08001995 else
1996 msm_clock_init(&apq8064_clock_init_data);
Tianyi Gou41515e22011-09-01 19:37:43 -07001997}
1998
Jing Lin417fa452012-02-05 14:31:06 -08001999#define I2C_SURF 1
2000#define I2C_FFA (1 << 1)
2001#define I2C_RUMI (1 << 2)
2002#define I2C_SIM (1 << 3)
2003#define I2C_LIQUID (1 << 4)
2004
2005struct i2c_registry {
2006 u8 machs;
2007 int bus;
2008 struct i2c_board_info *info;
2009 int len;
2010};
2011
2012static struct i2c_registry apq8064_i2c_devices[] __initdata = {
Jing Lin21ed4de2012-02-05 15:53:28 -08002013 {
2014 I2C_SURF | I2C_LIQUID,
2015 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
2016 mxt_device_info,
2017 ARRAY_SIZE(mxt_device_info),
2018 },
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08002019 {
2020 I2C_FFA,
2021 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
2022 cyttsp_info,
2023 ARRAY_SIZE(cyttsp_info),
2024 },
Amy Maloche70090f992012-02-16 16:35:26 -08002025 {
2026 I2C_FFA | I2C_LIQUID,
2027 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
2028 isa1200_board_info,
2029 ARRAY_SIZE(isa1200_board_info),
2030 },
Jing Lin417fa452012-02-05 14:31:06 -08002031};
2032
2033static void __init register_i2c_devices(void)
2034{
2035 u8 mach_mask = 0;
2036 int i;
2037
Kevin Chand07220e2012-02-13 15:52:22 -08002038#ifdef CONFIG_MSM_CAMERA
2039 struct i2c_registry apq8064_camera_i2c_devices = {
2040 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_RUMI,
2041 APQ_8064_GSBI4_QUP_I2C_BUS_ID,
2042 apq8064_camera_board_info.board_info,
2043 apq8064_camera_board_info.num_i2c_board_info,
2044 };
2045#endif
Jing Lin417fa452012-02-05 14:31:06 -08002046 /* Build the matching 'supported_machs' bitmask */
2047 if (machine_is_apq8064_cdp())
2048 mach_mask = I2C_SURF;
2049 else if (machine_is_apq8064_mtp())
2050 mach_mask = I2C_FFA;
2051 else if (machine_is_apq8064_liquid())
2052 mach_mask = I2C_LIQUID;
2053 else if (machine_is_apq8064_rumi3())
2054 mach_mask = I2C_RUMI;
2055 else if (machine_is_apq8064_sim())
2056 mach_mask = I2C_SIM;
2057 else
2058 pr_err("unmatched machine ID in register_i2c_devices\n");
2059
2060 /* Run the array and install devices as appropriate */
2061 for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) {
2062 if (apq8064_i2c_devices[i].machs & mach_mask)
2063 i2c_register_board_info(apq8064_i2c_devices[i].bus,
2064 apq8064_i2c_devices[i].info,
2065 apq8064_i2c_devices[i].len);
2066 }
Kevin Chand07220e2012-02-13 15:52:22 -08002067#ifdef CONFIG_MSM_CAMERA
2068 if (apq8064_camera_i2c_devices.machs & mach_mask)
2069 i2c_register_board_info(apq8064_camera_i2c_devices.bus,
2070 apq8064_camera_i2c_devices.info,
2071 apq8064_camera_i2c_devices.len);
2072#endif
Jing Lin417fa452012-02-05 14:31:06 -08002073}
2074
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002075static void __init apq8064_common_init(void)
2076{
2077 if (socinfo_init() < 0)
2078 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06002079 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
2080 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
David Collins2782b5c2012-02-06 10:02:42 -08002081 regulator_suppress_info_printing();
2082 platform_device_register(&apq8064_device_rpm_regulator);
Stephen Boyd4d0d2582012-02-10 14:49:40 -08002083 if (msm_xo_init())
2084 pr_err("Failed to initialize XO votes\n");
Tianyi Gou41515e22011-09-01 19:37:43 -07002085 apq8064_clock_init();
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08002086 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06002087 apq8064_i2c_init();
Jing Lin417fa452012-02-05 14:31:06 -08002088 register_i2c_devices();
Kenneth Heitke36920d32011-07-20 16:44:30 -06002089
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002090 apq8064_device_qup_spi_gsbi5.dev.platform_data =
2091 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08002092 apq8064_init_pmic();
Hemant Kumar94e7da22012-02-03 16:52:29 -08002093 if (machine_is_apq8064_liquid())
2094 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002095 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Manu Gautam91223e02011-11-08 15:27:22 +05302096 apq8064_ehci_host_init();
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002097 apq8064_init_buses();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002098 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Hemant Kumarf1ca9192012-02-07 18:59:33 -08002099 if (machine_is_apq8064_mtp()) {
2100 apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
2101 device_initialize(&apq8064_device_hsic_host.dev);
2102 }
Jay Chokshie8741282012-01-25 15:22:55 -08002103 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05302104 apq8064_init_mmc();
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08002105
2106 if (machine_is_apq8064_mtp()) {
2107 mdm_8064_device.dev.platform_data = &mdm_platform_data;
2108 platform_device_register(&mdm_8064_device);
2109 }
2110 platform_device_register(&apq8064_slim_ctrl);
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002111 slim_register_board_info(apq8064_slim_devices,
2112 ARRAY_SIZE(apq8064_slim_devices));
Jin Hongd3024e62012-02-09 16:13:32 -08002113 apq8064_init_dsps();
Praveen Chidambaram78499012011-11-01 17:15:17 -06002114 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Mahesh Sivasubramaniancbce1ec2012-01-24 10:32:44 -07002115 acpuclk_init(&acpuclk_8064_soc_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002116 msm_spm_l2_init(msm_spm_l2_data);
2117 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2118 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2119 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2120 msm_pm_data);
2121 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002122}
2123
Huaibin Yang4a084e32011-12-15 15:25:52 -08002124static void __init apq8064_allocate_memory_regions(void)
2125{
2126 apq8064_allocate_fb_region();
2127}
2128
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002129static void __init apq8064_sim_init(void)
2130{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002131 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
2132 &msm8064_device_watchdog.dev.platform_data;
2133
2134 wdog_pdata->bark_time = 15000;
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002135 msm_tsens_early_init(&apq_tsens_pdata);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002136 apq8064_common_init();
Joel King4e7ad222011-08-17 15:47:38 -07002137 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
2138}
2139
2140static void __init apq8064_rumi3_init(void)
2141{
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002142 msm_tsens_early_init(&apq_tsens_pdata);
Joel King4e7ad222011-08-17 15:47:38 -07002143 apq8064_common_init();
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002144 ethernet_init();
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002145 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002146 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Huaibin Yang4a084e32011-12-15 15:25:52 -08002147 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07002148 apq8064_init_gpu();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002149}
2150
Joel King82b7e3f2012-01-05 10:03:27 -08002151static void __init apq8064_cdp_init(void)
2152{
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002153 msm_tsens_early_init(&apq_tsens_pdata);
Joel King82b7e3f2012-01-05 10:03:27 -08002154 apq8064_common_init();
2155 ethernet_init();
2156 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
2157 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002158 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07002159 apq8064_init_gpu();
Matt Wagantall1875d322012-02-22 16:11:33 -08002160 platform_add_devices(apq8064_fs_devices, apq8064_num_fs_devices);
Kevin Chand07220e2012-02-13 15:52:22 -08002161 apq8064_init_cam();
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302162
2163 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
2164 platform_device_register(&cdp_kp_pdev);
2165
2166 if (machine_is_apq8064_mtp())
2167 platform_device_register(&mtp_kp_pdev);
Joel King82b7e3f2012-01-05 10:03:27 -08002168}
2169
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002170MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
2171 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002172 .reserve = apq8064_reserve,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002173 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302174 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002175 .timer = &msm_timer,
2176 .init_machine = apq8064_sim_init,
2177MACHINE_END
2178
Joel King4e7ad222011-08-17 15:47:38 -07002179MACHINE_START(APQ8064_RUMI3, "QCT APQ8064 RUMI3")
2180 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002181 .reserve = apq8064_reserve,
Joel King4e7ad222011-08-17 15:47:38 -07002182 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302183 .handle_irq = gic_handle_irq,
Joel King4e7ad222011-08-17 15:47:38 -07002184 .timer = &msm_timer,
2185 .init_machine = apq8064_rumi3_init,
Huaibin Yang4a084e32011-12-15 15:25:52 -08002186 .init_early = apq8064_allocate_memory_regions,
Joel King4e7ad222011-08-17 15:47:38 -07002187MACHINE_END
2188
Joel King82b7e3f2012-01-05 10:03:27 -08002189MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
2190 .map_io = apq8064_map_io,
2191 .reserve = apq8064_reserve,
2192 .init_irq = apq8064_init_irq,
2193 .handle_irq = gic_handle_irq,
2194 .timer = &msm_timer,
2195 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002196 .init_early = apq8064_allocate_memory_regions,
Joel King82b7e3f2012-01-05 10:03:27 -08002197MACHINE_END
2198
2199MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
2200 .map_io = apq8064_map_io,
2201 .reserve = apq8064_reserve,
2202 .init_irq = apq8064_init_irq,
2203 .handle_irq = gic_handle_irq,
2204 .timer = &msm_timer,
2205 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002206 .init_early = apq8064_allocate_memory_regions,
Joel King82b7e3f2012-01-05 10:03:27 -08002207MACHINE_END
2208
2209MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
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
Joel King11ca8202012-02-13 16:19:03 -08002219MACHINE_START(MPQ8064_HRD, "QCT MPQ8064 HRD")
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,
2226MACHINE_END
2227
2228MACHINE_START(MPQ8064_DTV, "QCT MPQ8064 DTV")
2229 .map_io = apq8064_map_io,
2230 .reserve = apq8064_reserve,
2231 .init_irq = apq8064_init_irq,
2232 .handle_irq = gic_handle_irq,
2233 .timer = &msm_timer,
2234 .init_machine = apq8064_cdp_init,
2235MACHINE_END
2236