blob: bd0aaeeb2d8d8a2170feaadd7f3b8c04857e23cc [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>
David Keitel2f613d92012-02-15 11:29:16 -080018#include <linux/i2c/smb349.h>
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -080019#include <linux/i2c/sx150x.h>
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -060020#include <linux/slimbus/slimbus.h>
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +053021#include <linux/mfd/wcd9xxx/core.h>
22#include <linux/mfd/wcd9xxx/pdata.h>
Amy Maloche70090f992012-02-16 16:35:26 -080023#include <linux/mfd/pm8xxx/misc.h>
Kenneth Heitke36920d32011-07-20 16:44:30 -060024#include <linux/msm_ssbi.h>
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -070025#include <linux/spi/spi.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070026#include <linux/dma-mapping.h>
27#include <linux/platform_data/qcom_crypto_device.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080028#include <linux/ion.h>
Jack Cheung46bfffa2012-01-19 15:26:24 -080029#include <linux/memory.h>
Jing Lin21ed4de2012-02-05 15:53:28 -080030#include <linux/i2c/atmel_mxt_ts.h>
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -080031#include <linux/cyttsp.h>
Amy Maloche70090f992012-02-16 16:35:26 -080032#include <linux/i2c/isa1200.h>
Mohan Pallaka474b94b2012-01-25 12:59:58 +053033#include <linux/gpio_keys.h>
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -080034#include <linux/epm_adc.h>
Jay Chokshie7d8d4f2012-04-04 14:47:57 -070035#include <linux/i2c/sx150x.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070036#include <asm/mach-types.h>
37#include <asm/mach/arch.h>
38#include <asm/hardware/gic.h>
Sahitya Tummala3586ed92011-08-03 09:13:23 +053039#include <asm/mach/mmc.h>
Ankit Verma6b7e2ba2012-01-26 15:48:54 -080040#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070041
42#include <mach/board.h>
43#include <mach/msm_iomap.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080044#include <mach/ion.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070045#include <linux/usb/msm_hsusb.h>
46#include <linux/usb/android.h>
47#include <mach/socinfo.h>
Harini Jayaramanc4c58692011-07-19 14:50:10 -060048#include <mach/msm_spi.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070049#include "timer.h"
50#include "devices.h"
Joel King4ebccc62011-07-22 09:43:22 -070051#include <mach/gpio.h>
52#include <mach/gpiomux.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060053#include <mach/rpm.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080054#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -070055#include <linux/android_pmem.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080056#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070057#include <mach/msm_memtypes.h>
58#include <linux/bootmem.h>
59#include <asm/setup.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070060#include <mach/dma.h>
Jin Hongd3024e62012-02-09 16:13:32 -080061#include <mach/msm_dsps.h>
Gagan Mac8a7a5d32011-11-11 16:43:06 -070062#include <mach/msm_bus_board.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060063#include <mach/cpuidle.h>
Joel Kingdacbc822012-01-25 13:30:57 -080064#include <mach/mdm2.h>
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -080065#include <linux/msm_tsens.h>
Stephen Boyd4d0d2582012-02-10 14:49:40 -080066#include <mach/msm_xo.h>
Laura Abbott350c8362012-02-28 14:46:52 -080067#include <mach/msm_rtb.h>
Joel King4ebccc62011-07-22 09:43:22 -070068
Jeff Ohlstein7e668552011-10-06 16:17:25 -070069#include "msm_watchdog.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080070#include "board-8064.h"
Vikram Mulukutlabc2e9572011-11-04 03:41:38 -070071#include "acpuclock.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060072#include "spm.h"
73#include "mpm.h"
74#include "rpm_resources.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080075#include "pm.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060076#include "pm-boot.h"
Rajesh Sastrulaaee8af32012-01-20 11:46:31 -080077#include "devices-msm8x60.h"
Jay Chokshiea67c622011-07-29 17:12:26 -070078
Olav Haugan7c6aa742012-01-16 16:47:37 -080079#define MSM_PMEM_ADSP_SIZE 0x7800000
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -070080#define MSM_PMEM_AUDIO_SIZE 0x4CF000
Olav Haugan7c6aa742012-01-16 16:47:37 -080081#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
82#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
83#else
Chetan Kalyan72aac4f2012-02-23 14:56:54 -080084#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Olav Haugan7c6aa742012-01-16 16:47:37 -080085#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070086
Olav Haugan7c6aa742012-01-16 16:47:37 -080087#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -070088#define MSM_PMEM_KERNEL_EBI1_SIZE 0x65000
Olav Haugan129992c2012-03-22 09:54:01 -070089#ifdef CONFIG_MSM_IOMMU
90#define MSM_ION_MM_SIZE 0x3800000
91#define MSM_ION_SF_SIZE 0
92#define MSM_ION_HEAP_NUM 7
93#else
Olav Haugan7c6aa742012-01-16 16:47:37 -080094#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Haugan129992c2012-03-22 09:54:01 -070095#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
96#define MSM_ION_HEAP_NUM 8
97#endif
98#define MSM_ION_MM_FW_SIZE 0x200000 /* (2MB) */
Olav Haugan3a9bd232012-02-15 14:23:27 -080099#define MSM_ION_QSECOM_SIZE 0x300000 /* (3MB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800100#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan2c43fac2012-01-19 11:06:37 -0800101#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Olav Haugan7c6aa742012-01-16 16:47:37 -0800102#else
103#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
104#define MSM_ION_HEAP_NUM 1
105#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700106
Olav Haugan7c6aa742012-01-16 16:47:37 -0800107#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
108static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
109static int __init pmem_kernel_ebi1_size_setup(char *p)
Kevin Chan13be4e22011-10-20 11:30:32 -0700110{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800111 pmem_kernel_ebi1_size = memparse(p, NULL);
112 return 0;
Kevin Chan13be4e22011-10-20 11:30:32 -0700113}
Olav Haugan7c6aa742012-01-16 16:47:37 -0800114early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
115#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700116
Olav Haugan7c6aa742012-01-16 16:47:37 -0800117#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -0700118static unsigned pmem_size = MSM_PMEM_SIZE;
119static int __init pmem_size_setup(char *p)
120{
121 pmem_size = memparse(p, NULL);
122 return 0;
123}
124early_param("pmem_size", pmem_size_setup);
125
126static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
127
128static int __init pmem_adsp_size_setup(char *p)
129{
130 pmem_adsp_size = memparse(p, NULL);
131 return 0;
132}
133early_param("pmem_adsp_size", pmem_adsp_size_setup);
134
135static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
136
137static int __init pmem_audio_size_setup(char *p)
138{
139 pmem_audio_size = memparse(p, NULL);
140 return 0;
141}
142early_param("pmem_audio_size", pmem_audio_size_setup);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800143#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700144
Olav Haugan7c6aa742012-01-16 16:47:37 -0800145#ifdef CONFIG_ANDROID_PMEM
146#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700147static struct android_pmem_platform_data android_pmem_pdata = {
148 .name = "pmem",
149 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
150 .cached = 1,
151 .memory_type = MEMTYPE_EBI1,
152};
153
154static struct platform_device android_pmem_device = {
155 .name = "android_pmem",
156 .id = 0,
157 .dev = {.platform_data = &android_pmem_pdata},
158};
159
160static struct android_pmem_platform_data android_pmem_adsp_pdata = {
161 .name = "pmem_adsp",
162 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
163 .cached = 0,
164 .memory_type = MEMTYPE_EBI1,
165};
Kevin Chan13be4e22011-10-20 11:30:32 -0700166static struct platform_device android_pmem_adsp_device = {
167 .name = "android_pmem",
168 .id = 2,
169 .dev = { .platform_data = &android_pmem_adsp_pdata },
170};
171
172static struct android_pmem_platform_data android_pmem_audio_pdata = {
173 .name = "pmem_audio",
174 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
175 .cached = 0,
176 .memory_type = MEMTYPE_EBI1,
177};
178
179static struct platform_device android_pmem_audio_device = {
180 .name = "android_pmem",
181 .id = 4,
182 .dev = { .platform_data = &android_pmem_audio_pdata },
183};
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700184#endif /* CONFIG_MSM_MULTIMEDIA_USE_ION */
185#endif /* CONFIG_ANDROID_PMEM */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800186
187static struct memtype_reserve apq8064_reserve_table[] __initdata = {
188 [MEMTYPE_SMI] = {
189 },
190 [MEMTYPE_EBI0] = {
191 .flags = MEMTYPE_FLAGS_1M_ALIGN,
192 },
193 [MEMTYPE_EBI1] = {
194 .flags = MEMTYPE_FLAGS_1M_ALIGN,
195 },
196};
Kevin Chan13be4e22011-10-20 11:30:32 -0700197
Laura Abbott350c8362012-02-28 14:46:52 -0800198#if defined(CONFIG_MSM_RTB)
199static struct msm_rtb_platform_data msm_rtb_pdata = {
200 .size = SZ_1M,
201};
202
203static int __init msm_rtb_set_buffer_size(char *p)
204{
205 int s;
206
207 s = memparse(p, NULL);
208 msm_rtb_pdata.size = ALIGN(s, SZ_4K);
209 return 0;
210}
211early_param("msm_rtb_size", msm_rtb_set_buffer_size);
212
213
214static struct platform_device msm_rtb_device = {
215 .name = "msm_rtb",
216 .id = -1,
217 .dev = {
218 .platform_data = &msm_rtb_pdata,
219 },
220};
221#endif
222
223static void __init reserve_rtb_memory(void)
224{
225#if defined(CONFIG_MSM_RTB)
226 apq8064_reserve_table[MEMTYPE_EBI1].size += msm_rtb_pdata.size;
227#endif
228}
229
230
Kevin Chan13be4e22011-10-20 11:30:32 -0700231static void __init size_pmem_devices(void)
232{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800233#ifdef CONFIG_ANDROID_PMEM
234#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700235 android_pmem_adsp_pdata.size = pmem_adsp_size;
236 android_pmem_pdata.size = pmem_size;
237 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700238#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
239#endif /*CONFIG_ANDROID_PMEM*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700240}
241
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700242#ifdef CONFIG_ANDROID_PMEM
243#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700244static void __init reserve_memory_for(struct android_pmem_platform_data *p)
245{
246 apq8064_reserve_table[p->memory_type].size += p->size;
247}
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700248#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
249#endif /*CONFIG_ANDROID_PMEM*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700250
Kevin Chan13be4e22011-10-20 11:30:32 -0700251static void __init reserve_pmem_memory(void)
252{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800253#ifdef CONFIG_ANDROID_PMEM
254#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700255 reserve_memory_for(&android_pmem_adsp_pdata);
256 reserve_memory_for(&android_pmem_pdata);
257 reserve_memory_for(&android_pmem_audio_pdata);
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700258#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700259 apq8064_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700260#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -0800261}
262
263static int apq8064_paddr_to_memtype(unsigned int paddr)
264{
265 return MEMTYPE_EBI1;
266}
267
268#ifdef CONFIG_ION_MSM
269#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
270static struct ion_cp_heap_pdata cp_mm_ion_pdata = {
271 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugand3d29682012-01-19 10:57:07 -0800272 .align = PAGE_SIZE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800273};
274
275static struct ion_cp_heap_pdata cp_mfc_ion_pdata = {
276 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugand3d29682012-01-19 10:57:07 -0800277 .align = PAGE_SIZE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800278};
279
280static struct ion_co_heap_pdata co_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800281 .adjacent_mem_id = INVALID_HEAP_ID,
282 .align = PAGE_SIZE,
283};
284
285static struct ion_co_heap_pdata fw_co_ion_pdata = {
286 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
287 .align = SZ_128K,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800288};
289#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800290
291/**
292 * These heaps are listed in the order they will be allocated. Due to
293 * video hardware restrictions and content protection the FW heap has to
294 * be allocated adjacent (below) the MM heap and the MFC heap has to be
295 * allocated after the MM heap to ensure MFC heap is not more than 256MB
296 * away from the base address of the FW heap.
297 * However, the order of FW heap and MM heap doesn't matter since these
298 * two heaps are taken care of by separate code to ensure they are adjacent
299 * to each other.
300 * Don't swap the order unless you know what you are doing!
301 */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800302static struct ion_platform_data ion_pdata = {
303 .nr = MSM_ION_HEAP_NUM,
304 .heaps = {
305 {
306 .id = ION_SYSTEM_HEAP_ID,
307 .type = ION_HEAP_TYPE_SYSTEM,
308 .name = ION_VMALLOC_HEAP_NAME,
309 },
310#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
311 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800312 .id = ION_CP_MM_HEAP_ID,
313 .type = ION_HEAP_TYPE_CP,
314 .name = ION_MM_HEAP_NAME,
315 .size = MSM_ION_MM_SIZE,
316 .memory_type = ION_EBI_TYPE,
317 .extra_data = (void *) &cp_mm_ion_pdata,
318 },
319 {
Olav Haugand3d29682012-01-19 10:57:07 -0800320 .id = ION_MM_FIRMWARE_HEAP_ID,
321 .type = ION_HEAP_TYPE_CARVEOUT,
322 .name = ION_MM_FIRMWARE_HEAP_NAME,
323 .size = MSM_ION_MM_FW_SIZE,
324 .memory_type = ION_EBI_TYPE,
325 .extra_data = (void *) &fw_co_ion_pdata,
326 },
327 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800328 .id = ION_CP_MFC_HEAP_ID,
329 .type = ION_HEAP_TYPE_CP,
330 .name = ION_MFC_HEAP_NAME,
331 .size = MSM_ION_MFC_SIZE,
332 .memory_type = ION_EBI_TYPE,
333 .extra_data = (void *) &cp_mfc_ion_pdata,
334 },
Olav Haugan129992c2012-03-22 09:54:01 -0700335#ifndef CONFIG_MSM_IOMMU
Olav Haugan7c6aa742012-01-16 16:47:37 -0800336 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800337 .id = ION_SF_HEAP_ID,
338 .type = ION_HEAP_TYPE_CARVEOUT,
339 .name = ION_SF_HEAP_NAME,
340 .size = MSM_ION_SF_SIZE,
341 .memory_type = ION_EBI_TYPE,
342 .extra_data = (void *) &co_ion_pdata,
343 },
Olav Haugan129992c2012-03-22 09:54:01 -0700344#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800345 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800346 .id = ION_IOMMU_HEAP_ID,
347 .type = ION_HEAP_TYPE_IOMMU,
348 .name = ION_IOMMU_HEAP_NAME,
349 },
Olav Hauganf45e2142012-01-19 11:01:01 -0800350 {
351 .id = ION_QSECOM_HEAP_ID,
352 .type = ION_HEAP_TYPE_CARVEOUT,
353 .name = ION_QSECOM_HEAP_NAME,
354 .size = MSM_ION_QSECOM_SIZE,
355 .memory_type = ION_EBI_TYPE,
356 .extra_data = (void *) &co_ion_pdata,
357 },
Olav Haugan2c43fac2012-01-19 11:06:37 -0800358 {
359 .id = ION_AUDIO_HEAP_ID,
360 .type = ION_HEAP_TYPE_CARVEOUT,
361 .name = ION_AUDIO_HEAP_NAME,
362 .size = MSM_ION_AUDIO_SIZE,
363 .memory_type = ION_EBI_TYPE,
364 .extra_data = (void *) &co_ion_pdata,
365 },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800366#endif
367 }
368};
369
370static struct platform_device ion_dev = {
371 .name = "ion-msm",
372 .id = 1,
373 .dev = { .platform_data = &ion_pdata },
374};
375#endif
376
377static void reserve_ion_memory(void)
378{
379#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
380 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_SIZE;
Olav Haugand3d29682012-01-19 10:57:07 -0800381 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_FW_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800382 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_SF_SIZE;
383 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MFC_SIZE;
Olav Hauganf45e2142012-01-19 11:01:01 -0800384 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_QSECOM_SIZE;
Olav Haugan2c43fac2012-01-19 11:06:37 -0800385 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_AUDIO_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800386#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700387}
388
Huaibin Yang4a084e32011-12-15 15:25:52 -0800389static void __init reserve_mdp_memory(void)
390{
391 apq8064_mdp_writeback(apq8064_reserve_table);
392}
393
Kevin Chan13be4e22011-10-20 11:30:32 -0700394static void __init apq8064_calculate_reserve_sizes(void)
395{
396 size_pmem_devices();
397 reserve_pmem_memory();
Olav Haugan7c6aa742012-01-16 16:47:37 -0800398 reserve_ion_memory();
Huaibin Yang4a084e32011-12-15 15:25:52 -0800399 reserve_mdp_memory();
Laura Abbott350c8362012-02-28 14:46:52 -0800400 reserve_rtb_memory();
Kevin Chan13be4e22011-10-20 11:30:32 -0700401}
402
403static struct reserve_info apq8064_reserve_info __initdata = {
404 .memtype_reserve_table = apq8064_reserve_table,
405 .calculate_reserve_sizes = apq8064_calculate_reserve_sizes,
406 .paddr_to_memtype = apq8064_paddr_to_memtype,
407};
408
409static int apq8064_memory_bank_size(void)
410{
411 return 1<<29;
412}
413
414static void __init locate_unstable_memory(void)
415{
416 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
417 unsigned long bank_size;
418 unsigned long low, high;
419
420 bank_size = apq8064_memory_bank_size();
421 low = meminfo.bank[0].start;
422 high = mb->start + mb->size;
Olav Haugand76e3a82012-01-16 16:55:07 -0800423
424 /* Check if 32 bit overflow occured */
425 if (high < mb->start)
426 high = ~0UL;
427
Kevin Chan13be4e22011-10-20 11:30:32 -0700428 low &= ~(bank_size - 1);
429
430 if (high - low <= bank_size)
431 return;
Jack Cheung46bfffa2012-01-19 15:26:24 -0800432 apq8064_reserve_info.low_unstable_address = mb->start -
433 MIN_MEMORY_BLOCK_SIZE + mb->size;
434 apq8064_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
435
Kevin Chan13be4e22011-10-20 11:30:32 -0700436 apq8064_reserve_info.bank_size = bank_size;
437 pr_info("low unstable address %lx max size %lx bank size %lx\n",
438 apq8064_reserve_info.low_unstable_address,
439 apq8064_reserve_info.max_unstable_size,
440 apq8064_reserve_info.bank_size);
441}
442
Aravind Venkateswaran8ac7f412012-03-16 17:57:30 -0700443static char prim_panel_name[PANEL_NAME_MAX_LEN];
444static char ext_panel_name[PANEL_NAME_MAX_LEN];
445static int __init prim_display_setup(char *param)
446{
447 if (strnlen(param, PANEL_NAME_MAX_LEN))
448 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
449 return 0;
450}
451early_param("prim_display", prim_display_setup);
452
453static int __init ext_display_setup(char *param)
454{
455 if (strnlen(param, PANEL_NAME_MAX_LEN))
456 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
457 return 0;
458}
459early_param("ext_display", ext_display_setup);
460
Kevin Chan13be4e22011-10-20 11:30:32 -0700461static void __init apq8064_reserve(void)
462{
Aravind Venkateswaran8ac7f412012-03-16 17:57:30 -0700463 apq8064_set_display_params(prim_panel_name, ext_panel_name);
Kevin Chan13be4e22011-10-20 11:30:32 -0700464 msm_reserve();
465}
466
Laura Abbott6988cef2012-03-15 14:27:13 -0700467static void __init place_movable_zone(void)
468{
469 movable_reserved_start = apq8064_reserve_info.low_unstable_address;
470 movable_reserved_size = apq8064_reserve_info.max_unstable_size;
471 pr_info("movable zone start %lx size %lx\n",
472 movable_reserved_start, movable_reserved_size);
473}
474
475static void __init apq8064_early_reserve(void)
476{
477 reserve_info = &apq8064_reserve_info;
478 locate_unstable_memory();
479 place_movable_zone();
480
481}
Hemant Kumara945b472012-01-25 15:08:06 -0800482#ifdef CONFIG_USB_EHCI_MSM_HSIC
Hemant Kumare6275972012-02-29 20:06:21 -0800483/* Bandwidth requests (zero) if no vote placed */
484static struct msm_bus_vectors hsic_init_vectors[] = {
485 {
486 .src = MSM_BUS_MASTER_SPS,
487 .dst = MSM_BUS_SLAVE_EBI_CH0,
488 .ab = 0,
489 .ib = 0,
490 },
491 {
492 .src = MSM_BUS_MASTER_SPS,
493 .dst = MSM_BUS_SLAVE_SPS,
494 .ab = 0,
495 .ib = 0,
496 },
497};
498
499/* Bus bandwidth requests in Bytes/sec */
500static struct msm_bus_vectors hsic_max_vectors[] = {
501 {
502 .src = MSM_BUS_MASTER_SPS,
503 .dst = MSM_BUS_SLAVE_EBI_CH0,
504 .ab = 60000000, /* At least 480Mbps on bus. */
505 .ib = 960000000, /* MAX bursts rate */
506 },
507 {
508 .src = MSM_BUS_MASTER_SPS,
509 .dst = MSM_BUS_SLAVE_SPS,
510 .ab = 0,
511 .ib = 512000000, /*vote for 64Mhz dfab clk rate*/
512 },
513};
514
515static struct msm_bus_paths hsic_bus_scale_usecases[] = {
516 {
517 ARRAY_SIZE(hsic_init_vectors),
518 hsic_init_vectors,
519 },
520 {
521 ARRAY_SIZE(hsic_max_vectors),
522 hsic_max_vectors,
523 },
524};
525
526static struct msm_bus_scale_pdata hsic_bus_scale_pdata = {
527 hsic_bus_scale_usecases,
528 ARRAY_SIZE(hsic_bus_scale_usecases),
529 .name = "hsic",
530};
531
Hemant Kumara945b472012-01-25 15:08:06 -0800532static struct msm_hsic_host_platform_data msm_hsic_pdata = {
Hemant Kumare6275972012-02-29 20:06:21 -0800533 .strobe = 88,
534 .data = 89,
535 .bus_scale_table = &hsic_bus_scale_pdata,
Hemant Kumara945b472012-01-25 15:08:06 -0800536};
537#else
538static struct msm_hsic_host_platform_data msm_hsic_pdata;
539#endif
540
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800541#define PID_MAGIC_ID 0x71432909
542#define SERIAL_NUM_MAGIC_ID 0x61945374
543#define SERIAL_NUMBER_LENGTH 127
544#define DLOAD_USB_BASE_ADD 0x2A03F0C8
545
546struct magic_num_struct {
547 uint32_t pid;
548 uint32_t serial_num;
549};
550
551struct dload_struct {
552 uint32_t reserved1;
553 uint32_t reserved2;
554 uint32_t reserved3;
555 uint16_t reserved4;
556 uint16_t pid;
557 char serial_number[SERIAL_NUMBER_LENGTH];
558 uint16_t reserved5;
559 struct magic_num_struct magic_struct;
560};
561
562static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
563{
564 struct dload_struct __iomem *dload = 0;
565
566 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
567 if (!dload) {
568 pr_err("%s: cannot remap I/O memory region: %08x\n",
569 __func__, DLOAD_USB_BASE_ADD);
570 return -ENXIO;
571 }
572
573 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
574 __func__, dload, pid, snum);
575 /* update pid */
576 dload->magic_struct.pid = PID_MAGIC_ID;
577 dload->pid = pid;
578
579 /* update serial number */
580 dload->magic_struct.serial_num = 0;
581 if (!snum) {
582 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
583 goto out;
584 }
585
586 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
587 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
588out:
589 iounmap(dload);
590 return 0;
591}
592
593static struct android_usb_platform_data android_usb_pdata = {
594 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
595};
596
Hemant Kumar4933b072011-10-17 23:43:11 -0700597static struct platform_device android_usb_device = {
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800598 .name = "android_usb",
599 .id = -1,
600 .dev = {
601 .platform_data = &android_usb_pdata,
602 },
Hemant Kumar4933b072011-10-17 23:43:11 -0700603};
604
Hemant Kumar7620eed2012-02-26 09:08:43 -0800605/* Bandwidth requests (zero) if no vote placed */
606static struct msm_bus_vectors usb_init_vectors[] = {
607 {
608 .src = MSM_BUS_MASTER_SPS,
609 .dst = MSM_BUS_SLAVE_EBI_CH0,
610 .ab = 0,
611 .ib = 0,
612 },
613};
614
615/* Bus bandwidth requests in Bytes/sec */
616static struct msm_bus_vectors usb_max_vectors[] = {
617 {
618 .src = MSM_BUS_MASTER_SPS,
619 .dst = MSM_BUS_SLAVE_EBI_CH0,
620 .ab = 60000000, /* At least 480Mbps on bus. */
621 .ib = 960000000, /* MAX bursts rate */
622 },
623};
624
625static struct msm_bus_paths usb_bus_scale_usecases[] = {
626 {
627 ARRAY_SIZE(usb_init_vectors),
628 usb_init_vectors,
629 },
630 {
631 ARRAY_SIZE(usb_max_vectors),
632 usb_max_vectors,
633 },
634};
635
636static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
637 usb_bus_scale_usecases,
638 ARRAY_SIZE(usb_bus_scale_usecases),
639 .name = "usb",
640};
641
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700642static int phy_init_seq[] = {
643 0x38, 0x81, /* update DC voltage level */
644 0x24, 0x82, /* set pre-emphasis and rise/fall time */
645 -1
646};
647
Hemant Kumar4933b072011-10-17 23:43:11 -0700648static struct msm_otg_platform_data msm_otg_pdata = {
Hemant Kumard86c4882012-01-24 19:39:37 -0800649 .mode = USB_OTG,
650 .otg_control = OTG_PMIC_CONTROL,
Hemant Kumar4933b072011-10-17 23:43:11 -0700651 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Hemant Kumard86c4882012-01-24 19:39:37 -0800652 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
653 .power_budget = 750,
Hemant Kumar7620eed2012-02-26 09:08:43 -0800654 .bus_scale_table = &usb_bus_scale_pdata,
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700655 .phy_init_seq = phy_init_seq,
Hemant Kumar4933b072011-10-17 23:43:11 -0700656};
657
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800658static struct msm_usb_host_platform_data msm_ehci_host_pdata3 = {
Manu Gautam91223e02011-11-08 15:27:22 +0530659 .power_budget = 500,
660};
661
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800662#ifdef CONFIG_USB_EHCI_MSM_HOST4
663static struct msm_usb_host_platform_data msm_ehci_host_pdata4;
664#endif
665
Manu Gautam91223e02011-11-08 15:27:22 +0530666static void __init apq8064_ehci_host_init(void)
667{
668 if (machine_is_apq8064_liquid()) {
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800669 msm_ehci_host_pdata3.dock_connect_irq =
Hemant Kumar56925352012-02-13 16:59:52 -0800670 PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9);
671
Manu Gautam91223e02011-11-08 15:27:22 +0530672 apq8064_device_ehci_host3.dev.platform_data =
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800673 &msm_ehci_host_pdata3;
Manu Gautam91223e02011-11-08 15:27:22 +0530674 platform_device_register(&apq8064_device_ehci_host3);
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800675
676#ifdef CONFIG_USB_EHCI_MSM_HOST4
677 apq8064_device_ehci_host4.dev.platform_data =
678 &msm_ehci_host_pdata4;
679 platform_device_register(&apq8064_device_ehci_host4);
680#endif
Manu Gautam91223e02011-11-08 15:27:22 +0530681 }
682}
683
David Keitel2f613d92012-02-15 11:29:16 -0800684static struct smb349_platform_data smb349_data __initdata = {
685 .en_n_gpio = PM8921_GPIO_PM_TO_SYS(37),
686 .chg_susp_gpio = PM8921_GPIO_PM_TO_SYS(30),
687 .chg_current_ma = 2200,
688};
689
690static struct i2c_board_info smb349_charger_i2c_info[] __initdata = {
691 {
692 I2C_BOARD_INFO(SMB349_NAME, 0x1B),
693 .platform_data = &smb349_data,
694 },
695};
696
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -0800697struct sx150x_platform_data apq8064_sx150x_data[] = {
698 [SX150X_EPM] = {
699 .gpio_base = GPIO_EPM_EXPANDER_BASE,
700 .oscio_is_gpo = false,
701 .io_pullup_ena = 0x0,
702 .io_pulldn_ena = 0x0,
703 .io_open_drain_ena = 0x0,
704 .io_polarity = 0,
705 .irq_summary = -1,
706 },
707};
708
709static struct epm_chan_properties ads_adc_channel_data[] = {
710 {10, 100}, {500, 50}, {1, 1}, {1, 1},
711 {20, 50}, {10, 100}, {1, 1}, {1, 1},
712 {10, 100}, {10, 100}, {100, 100}, {200, 100},
713 {100, 50}, {2000, 50}, {1000, 50}, {200, 50},
714 {200, 100}, {1, 1}, {20, 50}, {500, 50},
715 {50, 50}, {200, 100}, {500, 100}, {20, 50},
716 {200, 50}, {2000, 100}, {1000, 50}, {100, 50},
717 {200, 100}, {500, 50}, {1000, 100}, {200, 50},
718 {1000, 50}, {50, 50}, {100, 50}, {100, 50},
719 {1, 1}, {1, 1}, {20, 100}, {20, 50},
720 {500, 100}, {1000, 100}, {100, 50}, {1000, 50},
721 {100, 50}, {1000, 100}, {100, 50}, {100, 50},
722};
723
724static struct epm_adc_platform_data epm_adc_pdata = {
725 .channel = ads_adc_channel_data,
726 .bus_id = 0x0,
727 .epm_i2c_board_info = {
728 .type = "sx1509q",
729 .addr = 0x3e,
730 .platform_data = &apq8064_sx150x_data[SX150X_EPM],
731 },
732 .gpio_expander_base_addr = GPIO_EPM_EXPANDER_BASE,
733};
734
735static struct platform_device epm_adc_device = {
736 .name = "epm_adc",
737 .id = -1,
738 .dev = {
739 .platform_data = &epm_adc_pdata,
740 },
741};
742
743static void __init apq8064_epm_adc_init(void)
744{
745 epm_adc_pdata.num_channels = 32;
746 epm_adc_pdata.num_adc = 2;
747 epm_adc_pdata.chan_per_adc = 16;
748 epm_adc_pdata.chan_per_mux = 8;
749};
750
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800751/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
752 * 4 micbiases are used to power various analog and digital
753 * microphones operating at 1800 mV. Technically, all micbiases
754 * can source from single cfilter since all microphones operate
755 * at the same voltage level. The arrangement below is to make
756 * sure all cfilters are exercised. LDO_H regulator ouput level
757 * does not need to be as high as 2.85V. It is choosen for
758 * microphone sensitivity purpose.
759 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530760static struct wcd9xxx_pdata apq8064_tabla_platform_data = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800761 .slimbus_slave_device = {
762 .name = "tabla-slave",
763 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
764 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800765 .irq = MSM_GPIO_TO_INT(42),
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800766 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530767 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800768 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
769 .micbias = {
770 .ldoh_v = TABLA_LDOH_2P85_V,
771 .cfilt1_mv = 1800,
772 .cfilt2_mv = 1800,
773 .cfilt3_mv = 1800,
774 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
775 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
776 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
777 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530778 },
779 .regulator = {
780 {
781 .name = "CDC_VDD_CP",
782 .min_uV = 1800000,
783 .max_uV = 1800000,
784 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
785 },
786 {
787 .name = "CDC_VDDA_RX",
788 .min_uV = 1800000,
789 .max_uV = 1800000,
790 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
791 },
792 {
793 .name = "CDC_VDDA_TX",
794 .min_uV = 1800000,
795 .max_uV = 1800000,
796 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
797 },
798 {
799 .name = "VDDIO_CDC",
800 .min_uV = 1800000,
801 .max_uV = 1800000,
802 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
803 },
804 {
805 .name = "VDDD_CDC_D",
806 .min_uV = 1225000,
807 .max_uV = 1225000,
808 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
809 },
810 {
811 .name = "CDC_VDDA_A_1P2V",
812 .min_uV = 1225000,
813 .max_uV = 1225000,
814 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
815 },
816 },
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800817};
818
819static struct slim_device apq8064_slim_tabla = {
820 .name = "tabla-slim",
821 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
822 .dev = {
823 .platform_data = &apq8064_tabla_platform_data,
824 },
825};
826
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530827static struct wcd9xxx_pdata apq8064_tabla20_platform_data = {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800828 .slimbus_slave_device = {
829 .name = "tabla-slave",
830 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
831 },
832 .irq = MSM_GPIO_TO_INT(42),
833 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530834 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800835 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
836 .micbias = {
837 .ldoh_v = TABLA_LDOH_2P85_V,
838 .cfilt1_mv = 1800,
839 .cfilt2_mv = 1800,
840 .cfilt3_mv = 1800,
841 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
842 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
843 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
844 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530845 },
846 .regulator = {
847 {
848 .name = "CDC_VDD_CP",
849 .min_uV = 1800000,
850 .max_uV = 1800000,
851 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
852 },
853 {
854 .name = "CDC_VDDA_RX",
855 .min_uV = 1800000,
856 .max_uV = 1800000,
857 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
858 },
859 {
860 .name = "CDC_VDDA_TX",
861 .min_uV = 1800000,
862 .max_uV = 1800000,
863 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
864 },
865 {
866 .name = "VDDIO_CDC",
867 .min_uV = 1800000,
868 .max_uV = 1800000,
869 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
870 },
871 {
872 .name = "VDDD_CDC_D",
873 .min_uV = 1225000,
874 .max_uV = 1225000,
875 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
876 },
877 {
878 .name = "CDC_VDDA_A_1P2V",
879 .min_uV = 1225000,
880 .max_uV = 1225000,
881 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
882 },
883 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800884};
885
886static struct slim_device apq8064_slim_tabla20 = {
887 .name = "tabla2x-slim",
888 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
889 .dev = {
890 .platform_data = &apq8064_tabla20_platform_data,
891 },
892};
893
Amy Maloche70090f992012-02-16 16:35:26 -0800894#define HAP_SHIFT_LVL_OE_GPIO PM8921_MPP_PM_TO_SYS(8)
895#define ISA1200_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
896#define ISA1200_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
897#define ISA1200_HAP_CLK PM8921_GPIO_PM_TO_SYS(44)
898
899static int isa1200_power(int on)
900{
901 gpio_set_value_cansleep(ISA1200_HAP_CLK, !!on);
902
903 return 0;
904}
905
906static int isa1200_dev_setup(bool enable)
907{
908 int rc = 0;
909
910 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_1, enable);
911 if (rc) {
912 pr_err("%s: unable to write aux clock register(%d)\n",
913 __func__, rc);
914 return rc;
915 }
916
917 if (!enable)
918 goto free_gpio;
919
920 rc = gpio_request(ISA1200_HAP_CLK, "haptics_clk");
921 if (rc) {
922 pr_err("%s: unable to request gpio %d config(%d)\n",
923 __func__, ISA1200_HAP_CLK, rc);
924 return rc;
925 }
926
927 rc = gpio_direction_output(ISA1200_HAP_CLK, 0);
928 if (rc) {
929 pr_err("%s: unable to set direction\n", __func__);
930 goto free_gpio;
931 }
932
933 return 0;
934
935free_gpio:
936 gpio_free(ISA1200_HAP_CLK);
937 return rc;
938}
939
940static struct isa1200_regulator isa1200_reg_data[] = {
941 {
942 .name = "vddp",
943 .min_uV = ISA_I2C_VTG_MIN_UV,
944 .max_uV = ISA_I2C_VTG_MAX_UV,
945 .load_uA = ISA_I2C_CURR_UA,
946 },
947};
948
949static struct isa1200_platform_data isa1200_1_pdata = {
950 .name = "vibrator",
951 .dev_setup = isa1200_dev_setup,
952 .power_on = isa1200_power,
953 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
954 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
955 .max_timeout = 15000,
956 .mode_ctrl = PWM_GEN_MODE,
957 .pwm_fd = {
958 .pwm_div = 256,
959 },
960 .is_erm = false,
961 .smart_en = true,
962 .ext_clk_en = true,
963 .chip_en = 1,
964 .regulator_info = isa1200_reg_data,
965 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
966};
967
968static struct i2c_board_info isa1200_board_info[] __initdata = {
969 {
970 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
971 .platform_data = &isa1200_1_pdata,
972 },
973};
Jing Lin21ed4de2012-02-05 15:53:28 -0800974/* configuration data for mxt1386e using V2.1 firmware */
975static const u8 mxt1386e_config_data_v2_1[] = {
976 /* T6 Object */
977 0, 0, 0, 0, 0, 0,
978 /* T38 Object */
Jing Linf1208fd2012-02-23 11:15:42 -0800979 14, 1, 0, 22, 2, 12, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800980 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
981 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
982 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
983 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
984 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
985 0, 0, 0, 0,
986 /* T7 Object */
Jing Linf1208fd2012-02-23 11:15:42 -0800987 100, 10, 50,
Jing Lin21ed4de2012-02-05 15:53:28 -0800988 /* T8 Object */
Jing Linf1208fd2012-02-23 11:15:42 -0800989 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800990 /* T9 Object */
991 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
992 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
Jing Linf1208fd2012-02-23 11:15:42 -0800993 85, 5, 0, 5, 9, 5, 12, 35, 70, 40,
994 20, 5, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800995 /* T18 Object */
996 0, 0,
997 /* T24 Object */
998 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
999 0, 0, 0, 0, 0, 0, 0, 0, 0,
1000 /* T25 Object */
1001 3, 0, 60, 115, 156, 99,
1002 /* T27 Object */
1003 0, 0, 0, 0, 0, 0, 0,
1004 /* T40 Object */
1005 0, 0, 0, 0, 0,
1006 /* T42 Object */
1007 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
1008 /* T43 Object */
1009 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
1010 16,
1011 /* T46 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001012 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001013 /* T47 Object */
1014 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
1015 /* T48 Object */
1016 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001017 32, 40, 0, 10, 10, 0, 0, 100, 10, 90,
1018 0, 0, 0, 0, 0, 0, 0, 10, 1, 10,
1019 52, 10, 12, 0, 33, 0, 1, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001020 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1021 0, 0, 0, 0,
1022 /* T56 Object */
1023 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1024 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1025 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1026 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001027 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1028 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001029};
1030
1031#define MXT_TS_GPIO_IRQ 6
1032#define MXT_TS_PWR_EN_GPIO PM8921_GPIO_PM_TO_SYS(23)
1033#define MXT_TS_RESET_GPIO 33
1034
1035static struct mxt_config_info mxt_config_array[] = {
1036 {
1037 .config = mxt1386e_config_data_v2_1,
1038 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1039 .family_id = 0xA0,
1040 .variant_id = 0x7,
1041 .version = 0x21,
1042 .build = 0xAA,
Jing Linef4aa9b2012-03-26 12:01:41 -07001043 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
1044 .fw_name = "atmel_8064_liquid_v2_2_AA.hex",
1045 },
1046 {
1047 /* The config data for V2.2.AA is the same as for V2.1.AA */
1048 .config = mxt1386e_config_data_v2_1,
1049 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1050 .family_id = 0xA0,
1051 .variant_id = 0x7,
1052 .version = 0x22,
1053 .build = 0xAA,
1054 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin21ed4de2012-02-05 15:53:28 -08001055 },
1056};
1057
1058static struct mxt_platform_data mxt_platform_data = {
1059 .config_array = mxt_config_array,
1060 .config_array_size = ARRAY_SIZE(mxt_config_array),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08001061 .panel_minx = 0,
1062 .panel_maxx = 1365,
1063 .panel_miny = 0,
1064 .panel_maxy = 767,
1065 .disp_minx = 0,
1066 .disp_maxx = 1365,
1067 .disp_miny = 0,
1068 .disp_maxy = 767,
Jing Lin21ed4de2012-02-05 15:53:28 -08001069 .irqflags = IRQF_TRIGGER_FALLING,
1070 .i2c_pull_up = true,
1071 .reset_gpio = MXT_TS_RESET_GPIO,
1072 .irq_gpio = MXT_TS_GPIO_IRQ,
1073};
1074
1075static struct i2c_board_info mxt_device_info[] __initdata = {
1076 {
1077 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
1078 .platform_data = &mxt_platform_data,
1079 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1080 },
1081};
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001082#define CYTTSP_TS_GPIO_IRQ 6
1083#define CYTTSP_TS_GPIO_RESOUT 7
1084#define CYTTSP_TS_GPIO_SLEEP 33
1085
1086static ssize_t tma340_vkeys_show(struct kobject *kobj,
1087 struct kobj_attribute *attr, char *buf)
1088{
1089 return snprintf(buf, 200,
1090 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1091 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1092 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1093 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1094 "\n");
1095}
1096
1097static struct kobj_attribute tma340_vkeys_attr = {
1098 .attr = {
1099 .mode = S_IRUGO,
1100 },
1101 .show = &tma340_vkeys_show,
1102};
1103
1104static struct attribute *tma340_properties_attrs[] = {
1105 &tma340_vkeys_attr.attr,
1106 NULL
1107};
1108
1109static struct attribute_group tma340_properties_attr_group = {
1110 .attrs = tma340_properties_attrs,
1111};
1112
1113static int cyttsp_platform_init(struct i2c_client *client)
1114{
1115 int rc = 0;
1116 static struct kobject *tma340_properties_kobj;
1117
1118 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1119 tma340_properties_kobj = kobject_create_and_add("board_properties",
1120 NULL);
1121 if (tma340_properties_kobj)
1122 rc = sysfs_create_group(tma340_properties_kobj,
1123 &tma340_properties_attr_group);
1124 if (!tma340_properties_kobj || rc)
1125 pr_err("%s: failed to create board_properties\n",
1126 __func__);
1127
1128 return 0;
1129}
1130
1131static struct cyttsp_regulator cyttsp_regulator_data[] = {
1132 {
1133 .name = "vdd",
1134 .min_uV = CY_TMA300_VTG_MIN_UV,
1135 .max_uV = CY_TMA300_VTG_MAX_UV,
1136 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1137 .lpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1138 },
1139 {
1140 .name = "vcc_i2c",
1141 .min_uV = CY_I2C_VTG_MIN_UV,
1142 .max_uV = CY_I2C_VTG_MAX_UV,
1143 .hpm_load_uA = CY_I2C_CURR_UA,
1144 .lpm_load_uA = CY_I2C_CURR_UA,
1145 },
1146};
1147
1148static struct cyttsp_platform_data cyttsp_pdata = {
1149 .panel_maxx = 634,
1150 .panel_maxy = 1166,
1151 .disp_maxx = 599,
1152 .disp_maxy = 1023,
1153 .disp_minx = 0,
1154 .disp_miny = 0,
1155 .flags = 0x01,
1156 .gen = CY_GEN3,
1157 .use_st = CY_USE_ST,
1158 .use_mt = CY_USE_MT,
1159 .use_hndshk = CY_SEND_HNDSHK,
1160 .use_trk_id = CY_USE_TRACKING_ID,
1161 .use_sleep = CY_USE_DEEP_SLEEP_SEL,
1162 .use_gestures = CY_USE_GESTURES,
1163 .fw_fname = "cyttsp_8064_mtp.hex",
1164 /* change act_intrvl to customize the Active power state
1165 * scanning/processing refresh interval for Operating mode
1166 */
1167 .act_intrvl = CY_ACT_INTRVL_DFLT,
1168 /* change tch_tmout to customize the touch timeout for the
1169 * Active power state for Operating mode
1170 */
1171 .tch_tmout = CY_TCH_TMOUT_DFLT,
1172 /* change lp_intrvl to customize the Low Power power state
1173 * scanning/processing refresh interval for Operating mode
1174 */
1175 .lp_intrvl = CY_LP_INTRVL_DFLT,
1176 .sleep_gpio = CYTTSP_TS_GPIO_SLEEP,
1177 .resout_gpio = CYTTSP_TS_GPIO_RESOUT,
1178 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1179 .regulator_info = cyttsp_regulator_data,
1180 .num_regulators = ARRAY_SIZE(cyttsp_regulator_data),
1181 .init = cyttsp_platform_init,
1182 .correct_fw_ver = 17,
1183};
1184
1185static struct i2c_board_info cyttsp_info[] __initdata = {
1186 {
1187 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1188 .platform_data = &cyttsp_pdata,
1189 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1190 },
1191};
Jing Lin21ed4de2012-02-05 15:53:28 -08001192
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001193#define MSM_WCNSS_PHYS 0x03000000
1194#define MSM_WCNSS_SIZE 0x280000
1195
1196static struct resource resources_wcnss_wlan[] = {
1197 {
1198 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1199 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1200 .name = "wcnss_wlanrx_irq",
1201 .flags = IORESOURCE_IRQ,
1202 },
1203 {
1204 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1205 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1206 .name = "wcnss_wlantx_irq",
1207 .flags = IORESOURCE_IRQ,
1208 },
1209 {
1210 .start = MSM_WCNSS_PHYS,
1211 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1212 .name = "wcnss_mmio",
1213 .flags = IORESOURCE_MEM,
1214 },
1215 {
1216 .start = 64,
1217 .end = 68,
1218 .name = "wcnss_gpios_5wire",
1219 .flags = IORESOURCE_IO,
1220 },
1221};
1222
1223static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1224 .has_48mhz_xo = 1,
1225};
1226
1227static struct platform_device msm_device_wcnss_wlan = {
1228 .name = "wcnss_wlan",
1229 .id = 0,
1230 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1231 .resource = resources_wcnss_wlan,
1232 .dev = {.platform_data = &qcom_wcnss_pdata},
1233};
1234
Ankit Vermab7c26e62012-02-28 15:04:15 -08001235static struct platform_device msm_device_iris_fm __devinitdata = {
1236 .name = "iris_fm",
1237 .id = -1,
1238};
1239
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001240#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1241 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1242 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1243 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1244
1245#define QCE_SIZE 0x10000
1246#define QCE_0_BASE 0x11000000
1247
1248#define QCE_HW_KEY_SUPPORT 0
1249#define QCE_SHA_HMAC_SUPPORT 1
1250#define QCE_SHARE_CE_RESOURCE 3
1251#define QCE_CE_SHARED 0
1252
1253static struct resource qcrypto_resources[] = {
1254 [0] = {
1255 .start = QCE_0_BASE,
1256 .end = QCE_0_BASE + QCE_SIZE - 1,
1257 .flags = IORESOURCE_MEM,
1258 },
1259 [1] = {
1260 .name = "crypto_channels",
1261 .start = DMOV8064_CE_IN_CHAN,
1262 .end = DMOV8064_CE_OUT_CHAN,
1263 .flags = IORESOURCE_DMA,
1264 },
1265 [2] = {
1266 .name = "crypto_crci_in",
1267 .start = DMOV8064_CE_IN_CRCI,
1268 .end = DMOV8064_CE_IN_CRCI,
1269 .flags = IORESOURCE_DMA,
1270 },
1271 [3] = {
1272 .name = "crypto_crci_out",
1273 .start = DMOV8064_CE_OUT_CRCI,
1274 .end = DMOV8064_CE_OUT_CRCI,
1275 .flags = IORESOURCE_DMA,
1276 },
1277};
1278
1279static struct resource qcedev_resources[] = {
1280 [0] = {
1281 .start = QCE_0_BASE,
1282 .end = QCE_0_BASE + QCE_SIZE - 1,
1283 .flags = IORESOURCE_MEM,
1284 },
1285 [1] = {
1286 .name = "crypto_channels",
1287 .start = DMOV8064_CE_IN_CHAN,
1288 .end = DMOV8064_CE_OUT_CHAN,
1289 .flags = IORESOURCE_DMA,
1290 },
1291 [2] = {
1292 .name = "crypto_crci_in",
1293 .start = DMOV8064_CE_IN_CRCI,
1294 .end = DMOV8064_CE_IN_CRCI,
1295 .flags = IORESOURCE_DMA,
1296 },
1297 [3] = {
1298 .name = "crypto_crci_out",
1299 .start = DMOV8064_CE_OUT_CRCI,
1300 .end = DMOV8064_CE_OUT_CRCI,
1301 .flags = IORESOURCE_DMA,
1302 },
1303};
1304
1305#endif
1306
1307#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1308 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1309
1310static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1311 .ce_shared = QCE_CE_SHARED,
1312 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1313 .hw_key_support = QCE_HW_KEY_SUPPORT,
1314 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001315 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001316};
1317
1318static struct platform_device qcrypto_device = {
1319 .name = "qcrypto",
1320 .id = 0,
1321 .num_resources = ARRAY_SIZE(qcrypto_resources),
1322 .resource = qcrypto_resources,
1323 .dev = {
1324 .coherent_dma_mask = DMA_BIT_MASK(32),
1325 .platform_data = &qcrypto_ce_hw_suppport,
1326 },
1327};
1328#endif
1329
1330#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1331 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1332
1333static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1334 .ce_shared = QCE_CE_SHARED,
1335 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1336 .hw_key_support = QCE_HW_KEY_SUPPORT,
1337 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001338 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001339};
1340
1341static struct platform_device qcedev_device = {
1342 .name = "qce",
1343 .id = 0,
1344 .num_resources = ARRAY_SIZE(qcedev_resources),
1345 .resource = qcedev_resources,
1346 .dev = {
1347 .coherent_dma_mask = DMA_BIT_MASK(32),
1348 .platform_data = &qcedev_ce_hw_suppport,
1349 },
1350};
1351#endif
1352
Joel Kingdacbc822012-01-25 13:30:57 -08001353static struct mdm_platform_data mdm_platform_data = {
1354 .mdm_version = "3.0",
1355 .ramdump_delay_ms = 2000,
Hemant Kumara945b472012-01-25 15:08:06 -08001356 .peripheral_platform_device = &apq8064_device_hsic_host,
Joel Kingdacbc822012-01-25 13:30:57 -08001357};
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001358
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001359static struct tsens_platform_data apq_tsens_pdata = {
1360 .tsens_factor = 1000,
1361 .hw_type = APQ_8064,
1362 .tsens_num_sensor = 11,
1363 .slope = {1176, 1176, 1154, 1176, 1111,
1364 1132, 1132, 1199, 1132, 1199, 1132},
1365};
1366
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001367#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001368static void __init apq8064_map_io(void)
1369{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001370 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001371 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001372 if (socinfo_init() < 0)
1373 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001374}
1375
1376static void __init apq8064_init_irq(void)
1377{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001378 struct msm_mpm_device_data *data = NULL;
1379
1380#ifdef CONFIG_MSM_MPM
1381 data = &apq8064_mpm_dev_data;
1382#endif
1383
1384 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001385 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1386 (void *)MSM_QGIC_CPU_BASE);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001387}
1388
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001389static struct platform_device msm8064_device_saw_regulator_core0 = {
1390 .name = "saw-regulator",
1391 .id = 0,
1392 .dev = {
1393 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
1394 },
1395};
1396
1397static struct platform_device msm8064_device_saw_regulator_core1 = {
1398 .name = "saw-regulator",
1399 .id = 1,
1400 .dev = {
1401 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
1402 },
1403};
1404
1405static struct platform_device msm8064_device_saw_regulator_core2 = {
1406 .name = "saw-regulator",
1407 .id = 2,
1408 .dev = {
1409 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
1410 },
1411};
1412
1413static struct platform_device msm8064_device_saw_regulator_core3 = {
1414 .name = "saw-regulator",
1415 .id = 3,
1416 .dev = {
1417 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001418
1419 },
1420};
1421
Oluwafemi Adeyemif5a31422012-03-08 16:58:45 -08001422static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001423 {
1424 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1425 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1426 true,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001427 100, 650, 801, 200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001428 },
1429
1430 {
1431 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1432 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1433 true,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001434 2000, 200, 576000, 2000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001435 },
1436
1437 {
1438 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1439 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1440 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001441 8500, 51, 1122000, 8500,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001442 },
1443
1444 {
1445 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1446 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
1447 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001448 9000, 51, 1130300, 9000,
1449 },
1450 {
1451 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1452 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
1453 false,
1454 10000, 51, 1130300, 10000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001455 },
1456
1457 {
1458 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1459 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1460 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001461 12000, 14, 2205900, 12000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001462 },
1463
1464 {
1465 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1466 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1467 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001468 18000, 12, 2364250, 18000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001469 },
1470
1471 {
1472 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1473 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1474 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001475 23500, 10, 2667000, 23500,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001476 },
1477
1478 {
1479 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1480 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1481 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001482 29700, 5, 2867000, 30000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001483 },
1484};
1485
Oluwafemi Adeyemif5a31422012-03-08 16:58:45 -08001486uint32_t apq8064_rpm_get_swfi_latency(void)
1487{
1488 int i;
1489
1490 for (i = 0; i < ARRAY_SIZE(msm_rpmrs_levels); i++) {
1491 if (msm_rpmrs_levels[i].sleep_mode ==
1492 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)
1493 return msm_rpmrs_levels[i].latency_us;
1494 }
1495
1496 return 0;
1497}
1498
Praveen Chidambaram78499012011-11-01 17:15:17 -06001499static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1500 .mode = MSM_PM_BOOT_CONFIG_TZ,
1501};
1502
1503static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
1504 .levels = &msm_rpmrs_levels[0],
1505 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
1506 .vdd_mem_levels = {
1507 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
1508 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
1509 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
1510 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
1511 },
1512 .vdd_dig_levels = {
1513 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
1514 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
1515 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
1516 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
1517 },
1518 .vdd_mask = 0x7FFFFF,
1519 .rpmrs_target_id = {
1520 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
1521 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
1522 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
1523 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
1524 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
1525 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
1526 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
1527 },
1528};
1529
1530static struct msm_cpuidle_state msm_cstates[] __initdata = {
1531 {0, 0, "C0", "WFI",
1532 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1533
1534 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1535 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1536
1537 {0, 2, "C2", "POWER_COLLAPSE",
1538 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
1539
1540 {1, 0, "C0", "WFI",
1541 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1542
1543 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1544 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1545
1546 {2, 0, "C0", "WFI",
1547 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1548
1549 {2, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1550 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1551
1552 {3, 0, "C0", "WFI",
1553 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1554
1555 {3, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1556 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1557};
1558
1559static struct msm_pm_platform_data msm_pm_data[] = {
1560 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1561 .idle_supported = 1,
1562 .suspend_supported = 1,
1563 .idle_enabled = 0,
1564 .suspend_enabled = 0,
1565 },
1566
1567 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1568 .idle_supported = 1,
1569 .suspend_supported = 1,
1570 .idle_enabled = 0,
1571 .suspend_enabled = 0,
1572 },
1573
1574 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1575 .idle_supported = 1,
1576 .suspend_supported = 1,
1577 .idle_enabled = 1,
1578 .suspend_enabled = 1,
1579 },
1580
1581 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1582 .idle_supported = 0,
1583 .suspend_supported = 1,
1584 .idle_enabled = 0,
1585 .suspend_enabled = 0,
1586 },
1587
1588 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1589 .idle_supported = 1,
1590 .suspend_supported = 1,
1591 .idle_enabled = 0,
1592 .suspend_enabled = 0,
1593 },
1594
1595 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1596 .idle_supported = 1,
1597 .suspend_supported = 0,
1598 .idle_enabled = 1,
1599 .suspend_enabled = 0,
1600 },
1601
1602 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1603 .idle_supported = 0,
1604 .suspend_supported = 1,
1605 .idle_enabled = 0,
1606 .suspend_enabled = 0,
1607 },
1608
1609 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1610 .idle_supported = 1,
1611 .suspend_supported = 1,
1612 .idle_enabled = 0,
1613 .suspend_enabled = 0,
1614 },
1615
1616 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1617 .idle_supported = 1,
1618 .suspend_supported = 0,
1619 .idle_enabled = 1,
1620 .suspend_enabled = 0,
1621 },
1622
1623 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1624 .idle_supported = 0,
1625 .suspend_supported = 1,
1626 .idle_enabled = 0,
1627 .suspend_enabled = 0,
1628 },
1629
1630 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1631 .idle_supported = 1,
1632 .suspend_supported = 1,
1633 .idle_enabled = 0,
1634 .suspend_enabled = 0,
1635 },
1636
1637 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1638 .idle_supported = 1,
1639 .suspend_supported = 0,
1640 .idle_enabled = 1,
1641 .suspend_enabled = 0,
1642 },
1643};
1644
1645static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1646 0x03, 0x0f,
1647};
1648
1649static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1650 0x00, 0x24, 0x54, 0x10,
1651 0x09, 0x03, 0x01,
1652 0x10, 0x54, 0x30, 0x0C,
1653 0x24, 0x30, 0x0f,
1654};
1655
1656static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1657 0x00, 0x24, 0x54, 0x10,
1658 0x09, 0x07, 0x01, 0x0B,
1659 0x10, 0x54, 0x30, 0x0C,
1660 0x24, 0x30, 0x0f,
1661};
1662
1663static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1664 [0] = {
1665 .mode = MSM_SPM_MODE_CLOCK_GATING,
1666 .notify_rpm = false,
1667 .cmd = spm_wfi_cmd_sequence,
1668 },
1669 [1] = {
1670 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1671 .notify_rpm = false,
1672 .cmd = spm_power_collapse_without_rpm,
1673 },
1674 [2] = {
1675 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1676 .notify_rpm = true,
1677 .cmd = spm_power_collapse_with_rpm,
1678 },
1679};
1680
1681static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1682 0x00, 0x20, 0x03, 0x20,
1683 0x00, 0x0f,
1684};
1685
1686static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1687 0x00, 0x20, 0x34, 0x64,
1688 0x48, 0x07, 0x48, 0x20,
1689 0x50, 0x64, 0x04, 0x34,
1690 0x50, 0x0f,
1691};
1692static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1693 0x00, 0x10, 0x34, 0x64,
1694 0x48, 0x07, 0x48, 0x10,
1695 0x50, 0x64, 0x04, 0x34,
1696 0x50, 0x0F,
1697};
1698
1699static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1700 [0] = {
1701 .mode = MSM_SPM_L2_MODE_RETENTION,
1702 .notify_rpm = false,
1703 .cmd = l2_spm_wfi_cmd_sequence,
1704 },
1705 [1] = {
1706 .mode = MSM_SPM_L2_MODE_GDHS,
1707 .notify_rpm = true,
1708 .cmd = l2_spm_gdhs_cmd_sequence,
1709 },
1710 [2] = {
1711 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1712 .notify_rpm = true,
1713 .cmd = l2_spm_power_off_cmd_sequence,
1714 },
1715};
1716
1717
1718static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1719 [0] = {
1720 .reg_base_addr = MSM_SAW_L2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001721 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001722 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001723 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1724 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1725 .modes = msm_spm_l2_seq_list,
1726 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1727 },
1728};
1729
1730static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1731 [0] = {
1732 .reg_base_addr = MSM_SAW0_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001733 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001734#if defined(CONFIG_MSM_AVS_HW)
1735 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1736 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1737#endif
1738 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001739 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001740 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1741 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1742 .vctl_timeout_us = 50,
1743 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1744 .modes = msm_spm_seq_list,
1745 },
1746 [1] = {
1747 .reg_base_addr = MSM_SAW1_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001748 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001749#if defined(CONFIG_MSM_AVS_HW)
1750 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1751 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1752#endif
1753 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001754 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001755 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1756 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1757 .vctl_timeout_us = 50,
1758 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1759 .modes = msm_spm_seq_list,
1760 },
1761 [2] = {
1762 .reg_base_addr = MSM_SAW2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001763 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001764#if defined(CONFIG_MSM_AVS_HW)
1765 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1766 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1767#endif
1768 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001769 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001770 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1771 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1772 .vctl_timeout_us = 50,
1773 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1774 .modes = msm_spm_seq_list,
1775 },
1776 [3] = {
1777 .reg_base_addr = MSM_SAW3_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001778 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001779#if defined(CONFIG_MSM_AVS_HW)
1780 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1781 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1782#endif
1783 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001784 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001785 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1786 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1787 .vctl_timeout_us = 50,
1788 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1789 .modes = msm_spm_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001790 },
1791};
1792
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001793static void __init apq8064_init_buses(void)
1794{
1795 msm_bus_rpm_set_mt_mask();
1796 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
1797 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
1798 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
1799 msm_bus_8064_apps_fabric.dev.platform_data =
1800 &msm_bus_8064_apps_fabric_pdata;
1801 msm_bus_8064_sys_fabric.dev.platform_data =
1802 &msm_bus_8064_sys_fabric_pdata;
1803 msm_bus_8064_mm_fabric.dev.platform_data =
1804 &msm_bus_8064_mm_fabric_pdata;
1805 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
1806 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
1807}
1808
David Collinsf0d00732012-01-25 15:46:50 -08001809static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
1810 .name = GPIO_REGULATOR_DEV_NAME,
1811 .id = PM8921_MPP_PM_TO_SYS(7),
1812 .dev = {
1813 .platform_data
1814 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
1815 },
1816};
1817
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08001818static struct platform_device apq8064_device_ext_mpp8_vreg __devinitdata = {
1819 .name = GPIO_REGULATOR_DEV_NAME,
1820 .id = PM8921_MPP_PM_TO_SYS(8),
1821 .dev = {
1822 .platform_data
1823 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_MPP8],
1824 },
1825};
1826
David Collinsf0d00732012-01-25 15:46:50 -08001827static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
1828 .name = GPIO_REGULATOR_DEV_NAME,
1829 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
1830 .dev = {
1831 .platform_data =
1832 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
1833 },
1834};
1835
David Collins390fc332012-02-07 14:38:16 -08001836static struct platform_device apq8064_device_ext_ts_sw_vreg __devinitdata = {
1837 .name = GPIO_REGULATOR_DEV_NAME,
1838 .id = PM8921_GPIO_PM_TO_SYS(23),
1839 .dev = {
1840 .platform_data
1841 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_TS_SW],
1842 },
1843};
1844
David Collins2782b5c2012-02-06 10:02:42 -08001845static struct platform_device apq8064_device_rpm_regulator __devinitdata = {
1846 .name = "rpm-regulator",
1847 .id = -1,
1848 .dev = {
1849 .platform_data = &apq8064_rpm_regulator_pdata,
1850 },
1851};
1852
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001853static struct platform_device *common_devices[] __initdata = {
Jin Hong01f2dbb2011-11-03 22:13:51 -07001854 &apq8064_device_dmov,
David Keitel3c40fc52012-02-09 17:53:52 -08001855 &apq8064_device_qup_i2c_gsbi1,
Jing Lin04601f92012-02-05 15:36:07 -08001856 &apq8064_device_qup_i2c_gsbi3,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001857 &apq8064_device_qup_i2c_gsbi4,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001858 &apq8064_device_qup_spi_gsbi5,
David Collinsf0d00732012-01-25 15:46:50 -08001859 &apq8064_device_ext_5v_vreg,
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08001860 &apq8064_device_ext_mpp8_vreg,
David Collinsf0d00732012-01-25 15:46:50 -08001861 &apq8064_device_ext_3p3v_vreg,
David Collins390fc332012-02-07 14:38:16 -08001862 &apq8064_device_ext_ts_sw_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07001863 &apq8064_device_ssbi_pmic1,
1864 &apq8064_device_ssbi_pmic2,
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001865 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07001866 &apq8064_device_otg,
1867 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08001868 &apq8064_device_hsusb_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07001869 &android_usb_device,
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001870 &msm_device_wcnss_wlan,
Ankit Vermab7c26e62012-02-28 15:04:15 -08001871 &msm_device_iris_fm,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001872#ifdef CONFIG_ANDROID_PMEM
1873#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -07001874 &android_pmem_device,
1875 &android_pmem_adsp_device,
1876 &android_pmem_audio_device,
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -07001877#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
1878#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -08001879#ifdef CONFIG_ION_MSM
1880 &ion_dev,
1881#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001882 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001883 &msm8064_device_saw_regulator_core0,
1884 &msm8064_device_saw_regulator_core1,
1885 &msm8064_device_saw_regulator_core2,
1886 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001887#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1888 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1889 &qcrypto_device,
1890#endif
1891
1892#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1893 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1894 &qcedev_device,
1895#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07001896
1897#ifdef CONFIG_HW_RANDOM_MSM
1898 &apq8064_device_rng,
1899#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08001900 &apq_pcm,
1901 &apq_pcm_routing,
1902 &apq_cpudai0,
1903 &apq_cpudai1,
1904 &apq_cpudai_hdmi_rx,
1905 &apq_cpudai_bt_rx,
1906 &apq_cpudai_bt_tx,
1907 &apq_cpudai_fm_rx,
1908 &apq_cpudai_fm_tx,
1909 &apq_cpu_fe,
1910 &apq_stub_codec,
1911 &apq_voice,
1912 &apq_voip,
1913 &apq_lpa_pcm,
Krishnankutty Kolathappilly4374e332012-03-18 22:27:30 -07001914 &apq_compr_dsp,
1915 &apq_multi_ch_pcm,
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08001916 &apq_pcm_hostless,
1917 &apq_cpudai_afe_01_rx,
1918 &apq_cpudai_afe_01_tx,
1919 &apq_cpudai_afe_02_rx,
1920 &apq_cpudai_afe_02_tx,
1921 &apq_pcm_afe,
1922 &apq_cpudai_auxpcm_rx,
1923 &apq_cpudai_auxpcm_tx,
Neema Shetty8427c262012-02-16 11:23:43 -08001924 &apq_cpudai_stub,
Neema Shetty3c9d2862012-03-11 01:25:32 -08001925 &apq_cpudai_slimbus_1_rx,
1926 &apq_cpudai_slimbus_1_tx,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001927 &apq8064_rpm_device,
1928 &apq8064_rpm_log_device,
1929 &apq8064_rpm_stat_device,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001930 &msm_bus_8064_apps_fabric,
1931 &msm_bus_8064_sys_fabric,
1932 &msm_bus_8064_mm_fabric,
1933 &msm_bus_8064_sys_fpb,
1934 &msm_bus_8064_cpss_fpb,
Mohan Kumar Gubbihalli Lachma Naik7f72edd2012-02-06 17:26:47 -08001935 &apq8064_msm_device_vidc,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07001936 &msm_pil_dsps,
Matt Wagantalled832652012-02-02 19:23:17 -08001937 &msm_8960_riva,
Matt Wagantallb94b9a52012-02-02 21:59:54 -08001938 &msm_8960_q6_lpass,
Stephen Boyd7b973de2012-03-09 12:26:16 -08001939 &msm_pil_vidc,
Matt Wagantall292aace2012-01-26 19:12:34 -08001940 &msm_gss,
Laura Abbott350c8362012-02-28 14:46:52 -08001941#ifdef CONFIG_MSM_RTB
1942 &msm_rtb_device,
1943#endif
Praveen Chidambaram8ea3dcd2011-12-07 14:46:31 -07001944 &apq8064_cpu_idle_device,
Praveen Chidambaram5c8adf22012-02-23 18:44:37 -07001945 &apq8064_msm_gov_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08001946 &apq8064_device_cache_erp,
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08001947 &epm_adc_device,
Pratik Patel212ab362012-03-16 12:30:07 -07001948 &apq8064_qdss_device,
1949 &msm_etb_device,
1950 &msm_tpiu_device,
1951 &msm_funnel_device,
1952 &apq8064_etm_device,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001953};
1954
Joel King4e7ad222011-08-17 15:47:38 -07001955static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001956 &apq8064_device_uart_gsbi3,
Yan He06913ce2011-08-26 16:33:46 -07001957 &msm_device_sps_apq8064,
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001958};
1959
1960static struct platform_device *rumi3_devices[] __initdata = {
1961 &apq8064_device_uart_gsbi1,
Yan He435ed612011-11-23 17:34:59 -08001962 &msm_device_sps_apq8064,
Huaibin Yang4a084e32011-12-15 15:25:52 -08001963#ifdef CONFIG_MSM_ROTATOR
1964 &msm_rotator_device,
1965#endif
Joel King4e7ad222011-08-17 15:47:38 -07001966};
1967
Joel King82b7e3f2012-01-05 10:03:27 -08001968static struct platform_device *cdp_devices[] __initdata = {
1969 &apq8064_device_uart_gsbi1,
Jin Hong4bbbfba2012-02-02 21:48:07 -08001970 &apq8064_device_uart_gsbi7,
Joel King82b7e3f2012-01-05 10:03:27 -08001971 &msm_device_sps_apq8064,
Aravind Venkateswaran4ca27532012-02-16 14:27:05 -08001972#ifdef CONFIG_MSM_ROTATOR
1973 &msm_rotator_device,
1974#endif
Joel King82b7e3f2012-01-05 10:03:27 -08001975};
1976
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07001977static struct platform_device
1978mpq8064_device_ext_5v_frc_vreg __devinitdata = {
1979 .name = GPIO_REGULATOR_DEV_NAME,
1980 .id = SX150X_GPIO(4, 10),
1981 .dev = {
1982 .platform_data =
1983 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_FRC_5V],
1984 },
1985};
1986
1987static struct platform_device
1988mpq8064_device_ext_1p2_buck_vreg __devinitdata = {
1989 .name = GPIO_REGULATOR_DEV_NAME,
1990 .id = SX150X_GPIO(4, 2),
1991 .dev = {
1992 .platform_data =
1993 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P2V],
1994 },
1995};
1996
1997static struct platform_device
1998mpq8064_device_ext_1p8_buck_vreg __devinitdata = {
1999 .name = GPIO_REGULATOR_DEV_NAME,
2000 .id = SX150X_GPIO(4, 4),
2001 .dev = {
2002 .platform_data =
2003 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P8V],
2004 },
2005};
2006
2007static struct platform_device
2008mpq8064_device_ext_2p2_buck_vreg __devinitdata = {
2009 .name = GPIO_REGULATOR_DEV_NAME,
2010 .id = SX150X_GPIO(4, 14),
2011 .dev = {
2012 .platform_data =
2013 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_2P2V],
2014 },
2015};
2016
2017static struct platform_device
2018mpq8064_device_ext_5v_buck_vreg __devinitdata = {
2019 .name = GPIO_REGULATOR_DEV_NAME,
2020 .id = SX150X_GPIO(4, 3),
2021 .dev = {
2022 .platform_data =
2023 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_5V],
2024 },
2025};
2026
2027static struct platform_device
2028mpq8064_device_ext_3p3v_ldo_vreg __devinitdata = {
2029 .name = GPIO_REGULATOR_DEV_NAME,
2030 .id = SX150X_GPIO(4, 15),
2031 .dev = {
2032 .platform_data =
2033 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_3P3V],
2034 },
2035};
2036
2037static struct platform_device *mpq_devices[] __initdata = {
2038 &msm_device_sps_apq8064,
2039 &mpq8064_device_qup_i2c_gsbi5,
2040#ifdef CONFIG_MSM_ROTATOR
2041 &msm_rotator_device,
2042#endif
2043 &mpq8064_device_ext_5v_frc_vreg,
2044 &mpq8064_device_ext_1p2_buck_vreg,
2045 &mpq8064_device_ext_1p8_buck_vreg,
2046 &mpq8064_device_ext_2p2_buck_vreg,
2047 &mpq8064_device_ext_5v_buck_vreg,
2048 &mpq8064_device_ext_3p3v_ldo_vreg,
2049};
2050
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002051static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002052 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002053};
2054
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002055#define KS8851_IRQ_GPIO 43
2056
2057static struct spi_board_info spi_board_info[] __initdata = {
2058 {
2059 .modalias = "ks8851",
2060 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2061 .max_speed_hz = 19200000,
2062 .bus_num = 0,
2063 .chip_select = 2,
2064 .mode = SPI_MODE_0,
2065 },
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002066 {
2067 .modalias = "epm_adc",
2068 .max_speed_hz = 1100000,
2069 .bus_num = 0,
2070 .chip_select = 3,
2071 .mode = SPI_MODE_0,
2072 },
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002073};
2074
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002075static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002076 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08002077 .bus_num = 1,
2078 .slim_slave = &apq8064_slim_tabla,
2079 },
2080 {
2081 .bus_num = 1,
2082 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002083 },
2084 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002085};
2086
David Keitel3c40fc52012-02-09 17:53:52 -08002087static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi1_pdata = {
2088 .clk_freq = 100000,
2089 .src_clk_rate = 24000000,
2090};
2091
Jing Lin04601f92012-02-05 15:36:07 -08002092static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi3_pdata = {
2093 .clk_freq = 100000,
2094 .src_clk_rate = 24000000,
2095};
2096
Kenneth Heitke748593a2011-07-15 15:45:11 -06002097static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
2098 .clk_freq = 100000,
2099 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002100};
2101
Joel King8f839b92012-04-01 14:37:46 -07002102static struct msm_i2c_platform_data mpq8064_i2c_qup_gsbi5_pdata = {
2103 .clk_freq = 100000,
2104 .src_clk_rate = 24000000,
2105};
2106
David Keitel3c40fc52012-02-09 17:53:52 -08002107#define GSBI_DUAL_MODE_CODE 0x60
2108#define MSM_GSBI1_PHYS 0x12440000
Kenneth Heitke748593a2011-07-15 15:45:11 -06002109static void __init apq8064_i2c_init(void)
2110{
David Keitel3c40fc52012-02-09 17:53:52 -08002111 void __iomem *gsbi_mem;
2112
2113 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2114 &apq8064_i2c_qup_gsbi1_pdata;
2115 gsbi_mem = ioremap_nocache(MSM_GSBI1_PHYS, 4);
2116 writel_relaxed(GSBI_DUAL_MODE_CODE, gsbi_mem);
2117 /* Ensure protocol code is written before proceeding */
2118 wmb();
2119 iounmap(gsbi_mem);
2120 apq8064_i2c_qup_gsbi1_pdata.use_gsbi_shared_mode = 1;
Jing Lin04601f92012-02-05 15:36:07 -08002121 apq8064_device_qup_i2c_gsbi3.dev.platform_data =
2122 &apq8064_i2c_qup_gsbi3_pdata;
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002123 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2124 &apq8064_i2c_qup_gsbi1_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002125 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
2126 &apq8064_i2c_qup_gsbi4_pdata;
Joel King8f839b92012-04-01 14:37:46 -07002127 mpq8064_device_qup_i2c_gsbi5.dev.platform_data =
2128 &mpq8064_i2c_qup_gsbi5_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002129}
2130
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002131#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002132static int ethernet_init(void)
2133{
2134 int ret;
2135 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
2136 if (ret) {
2137 pr_err("ks8851 gpio_request failed: %d\n", ret);
2138 goto fail;
2139 }
2140
2141 return 0;
2142fail:
2143 return ret;
2144}
2145#else
2146static int ethernet_init(void)
2147{
2148 return 0;
2149}
2150#endif
2151
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302152#define GPIO_KEY_HOME PM8921_GPIO_PM_TO_SYS(27)
2153#define GPIO_KEY_VOLUME_UP PM8921_GPIO_PM_TO_SYS(35)
2154#define GPIO_KEY_VOLUME_DOWN PM8921_GPIO_PM_TO_SYS(38)
2155#define GPIO_KEY_CAM_FOCUS PM8921_GPIO_PM_TO_SYS(3)
2156#define GPIO_KEY_CAM_SNAP PM8921_GPIO_PM_TO_SYS(4)
Jing Lin3f8f8422012-03-05 09:32:11 -08002157#define GPIO_KEY_ROTATION PM8921_GPIO_PM_TO_SYS(42)
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302158
2159static struct gpio_keys_button cdp_keys[] = {
2160 {
2161 .code = KEY_HOME,
2162 .gpio = GPIO_KEY_HOME,
2163 .desc = "home_key",
2164 .active_low = 1,
2165 .type = EV_KEY,
2166 .wakeup = 1,
2167 .debounce_interval = 15,
2168 },
2169 {
2170 .code = KEY_VOLUMEUP,
2171 .gpio = GPIO_KEY_VOLUME_UP,
2172 .desc = "volume_up_key",
2173 .active_low = 1,
2174 .type = EV_KEY,
2175 .wakeup = 1,
2176 .debounce_interval = 15,
2177 },
2178 {
2179 .code = KEY_VOLUMEDOWN,
2180 .gpio = GPIO_KEY_VOLUME_DOWN,
2181 .desc = "volume_down_key",
2182 .active_low = 1,
2183 .type = EV_KEY,
2184 .wakeup = 1,
2185 .debounce_interval = 15,
2186 },
2187 {
2188 .code = SW_ROTATE_LOCK,
2189 .gpio = GPIO_KEY_ROTATION,
2190 .desc = "rotate_key",
2191 .active_low = 1,
2192 .type = EV_SW,
2193 .debounce_interval = 15,
2194 },
2195};
2196
2197static struct gpio_keys_platform_data cdp_keys_data = {
2198 .buttons = cdp_keys,
2199 .nbuttons = ARRAY_SIZE(cdp_keys),
2200};
2201
2202static struct platform_device cdp_kp_pdev = {
2203 .name = "gpio-keys",
2204 .id = -1,
2205 .dev = {
2206 .platform_data = &cdp_keys_data,
2207 },
2208};
2209
2210static struct gpio_keys_button mtp_keys[] = {
2211 {
2212 .code = KEY_CAMERA_FOCUS,
2213 .gpio = GPIO_KEY_CAM_FOCUS,
2214 .desc = "cam_focus_key",
2215 .active_low = 1,
2216 .type = EV_KEY,
2217 .wakeup = 1,
2218 .debounce_interval = 15,
2219 },
2220 {
2221 .code = KEY_VOLUMEUP,
2222 .gpio = GPIO_KEY_VOLUME_UP,
2223 .desc = "volume_up_key",
2224 .active_low = 1,
2225 .type = EV_KEY,
2226 .wakeup = 1,
2227 .debounce_interval = 15,
2228 },
2229 {
2230 .code = KEY_VOLUMEDOWN,
2231 .gpio = GPIO_KEY_VOLUME_DOWN,
2232 .desc = "volume_down_key",
2233 .active_low = 1,
2234 .type = EV_KEY,
2235 .wakeup = 1,
2236 .debounce_interval = 15,
2237 },
2238 {
2239 .code = KEY_CAMERA_SNAPSHOT,
2240 .gpio = GPIO_KEY_CAM_SNAP,
2241 .desc = "cam_snap_key",
2242 .active_low = 1,
2243 .type = EV_KEY,
2244 .debounce_interval = 15,
2245 },
2246};
2247
2248static struct gpio_keys_platform_data mtp_keys_data = {
2249 .buttons = mtp_keys,
2250 .nbuttons = ARRAY_SIZE(mtp_keys),
2251};
2252
2253static struct platform_device mtp_kp_pdev = {
2254 .name = "gpio-keys",
2255 .id = -1,
2256 .dev = {
2257 .platform_data = &mtp_keys_data,
2258 },
2259};
2260
Jin Hongd3024e62012-02-09 16:13:32 -08002261/* Sensors DSPS platform data */
2262#define DSPS_PIL_GENERIC_NAME "dsps"
2263static void __init apq8064_init_dsps(void)
2264{
2265 struct msm_dsps_platform_data *pdata =
2266 msm_dsps_device_8064.dev.platform_data;
2267 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
2268 pdata->gpios = NULL;
2269 pdata->gpios_num = 0;
2270
2271 platform_device_register(&msm_dsps_device_8064);
2272}
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302273
Tianyi Gou41515e22011-09-01 19:37:43 -07002274static void __init apq8064_clock_init(void)
2275{
Tianyi Gouacb588d2012-01-27 18:24:05 -08002276 if (machine_is_apq8064_rumi3())
Tianyi Gou41515e22011-09-01 19:37:43 -07002277 msm_clock_init(&apq8064_dummy_clock_init_data);
Tianyi Gouacb588d2012-01-27 18:24:05 -08002278 else
2279 msm_clock_init(&apq8064_clock_init_data);
Tianyi Gou41515e22011-09-01 19:37:43 -07002280}
2281
Jing Lin417fa452012-02-05 14:31:06 -08002282#define I2C_SURF 1
2283#define I2C_FFA (1 << 1)
2284#define I2C_RUMI (1 << 2)
2285#define I2C_SIM (1 << 3)
2286#define I2C_LIQUID (1 << 4)
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002287#define I2C_MPQ_CDP BIT(5)
2288#define I2C_MPQ_HRD BIT(6)
2289#define I2C_MPQ_DTV BIT(7)
Jing Lin417fa452012-02-05 14:31:06 -08002290
2291struct i2c_registry {
2292 u8 machs;
2293 int bus;
2294 struct i2c_board_info *info;
2295 int len;
2296};
2297
2298static struct i2c_registry apq8064_i2c_devices[] __initdata = {
Jing Lin21ed4de2012-02-05 15:53:28 -08002299 {
David Keitel2f613d92012-02-15 11:29:16 -08002300 I2C_LIQUID,
2301 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
2302 smb349_charger_i2c_info,
2303 ARRAY_SIZE(smb349_charger_i2c_info)
2304 },
2305 {
Jing Lin21ed4de2012-02-05 15:53:28 -08002306 I2C_SURF | I2C_LIQUID,
2307 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
2308 mxt_device_info,
2309 ARRAY_SIZE(mxt_device_info),
2310 },
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08002311 {
2312 I2C_FFA,
2313 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
2314 cyttsp_info,
2315 ARRAY_SIZE(cyttsp_info),
2316 },
Amy Maloche70090f992012-02-16 16:35:26 -08002317 {
2318 I2C_FFA | I2C_LIQUID,
2319 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
2320 isa1200_board_info,
2321 ARRAY_SIZE(isa1200_board_info),
2322 },
Jing Lin417fa452012-02-05 14:31:06 -08002323};
2324
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002325struct sx150x_platform_data mpq8064_sx150x_pdata[] = {
2326 [SX150X_EXP1] = {
2327 .gpio_base = SX150X_EXP1_GPIO_BASE,
2328 .oscio_is_gpo = false,
2329 .io_pullup_ena = 0x0,
2330 .io_pulldn_ena = 0x0,
2331 .io_open_drain_ena = 0x0,
2332 .io_polarity = 0,
2333 .irq_summary = -1,
2334 },
2335 [SX150X_EXP2] = {
2336 .gpio_base = SX150X_EXP2_GPIO_BASE,
2337 .oscio_is_gpo = false,
2338 .io_pullup_ena = 0x0,
2339 .io_pulldn_ena = 0x0,
2340 .io_open_drain_ena = 0x0,
2341 .io_polarity = 0,
2342 .irq_summary = -1,
2343 },
2344 [SX150X_EXP3] = {
2345 .gpio_base = SX150X_EXP3_GPIO_BASE,
2346 .oscio_is_gpo = false,
2347 .io_pullup_ena = 0x0,
2348 .io_pulldn_ena = 0x0,
2349 .io_open_drain_ena = 0x0,
2350 .io_polarity = 0,
2351 .irq_summary = -1,
2352 },
2353 [SX150X_EXP4] = {
2354 .gpio_base = SX150X_EXP4_GPIO_BASE,
2355 .oscio_is_gpo = false,
2356 .io_pullup_ena = 0x0,
2357 .io_pulldn_ena = 0x0,
2358 .io_open_drain_ena = 0x0,
2359 .io_polarity = 0,
2360 .irq_summary = -1,
2361 },
2362};
2363
2364static struct i2c_board_info sx150x_gpio_exp_info[] = {
2365 {
2366 I2C_BOARD_INFO("sx1509q", 0x70),
2367 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP1],
2368 },
2369 {
2370 I2C_BOARD_INFO("sx1508q", 0x23),
2371 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP2],
2372 },
2373 {
2374 I2C_BOARD_INFO("sx1508q", 0x22),
2375 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP3],
2376 },
2377 {
2378 I2C_BOARD_INFO("sx1509q", 0x3E),
2379 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP4],
2380 },
2381};
2382
2383#define MPQ8064_I2C_GSBI5_BUS_ID 5
2384
2385static struct i2c_registry mpq8064_i2c_devices[] __initdata = {
2386 {
2387 I2C_MPQ_CDP,
2388 MPQ8064_I2C_GSBI5_BUS_ID,
2389 sx150x_gpio_exp_info,
2390 ARRAY_SIZE(sx150x_gpio_exp_info),
2391 },
2392};
2393
Jing Lin417fa452012-02-05 14:31:06 -08002394static void __init register_i2c_devices(void)
2395{
2396 u8 mach_mask = 0;
2397 int i;
2398
Kevin Chand07220e2012-02-13 15:52:22 -08002399#ifdef CONFIG_MSM_CAMERA
2400 struct i2c_registry apq8064_camera_i2c_devices = {
2401 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_RUMI,
2402 APQ_8064_GSBI4_QUP_I2C_BUS_ID,
2403 apq8064_camera_board_info.board_info,
2404 apq8064_camera_board_info.num_i2c_board_info,
2405 };
2406#endif
Jing Lin417fa452012-02-05 14:31:06 -08002407 /* Build the matching 'supported_machs' bitmask */
2408 if (machine_is_apq8064_cdp())
2409 mach_mask = I2C_SURF;
2410 else if (machine_is_apq8064_mtp())
2411 mach_mask = I2C_FFA;
2412 else if (machine_is_apq8064_liquid())
2413 mach_mask = I2C_LIQUID;
2414 else if (machine_is_apq8064_rumi3())
2415 mach_mask = I2C_RUMI;
2416 else if (machine_is_apq8064_sim())
2417 mach_mask = I2C_SIM;
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002418 else if (PLATFORM_IS_MPQ8064())
2419 mach_mask = I2C_MPQ_CDP;
Jing Lin417fa452012-02-05 14:31:06 -08002420 else
2421 pr_err("unmatched machine ID in register_i2c_devices\n");
2422
2423 /* Run the array and install devices as appropriate */
2424 for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) {
2425 if (apq8064_i2c_devices[i].machs & mach_mask)
2426 i2c_register_board_info(apq8064_i2c_devices[i].bus,
2427 apq8064_i2c_devices[i].info,
2428 apq8064_i2c_devices[i].len);
2429 }
Kevin Chand07220e2012-02-13 15:52:22 -08002430#ifdef CONFIG_MSM_CAMERA
2431 if (apq8064_camera_i2c_devices.machs & mach_mask)
2432 i2c_register_board_info(apq8064_camera_i2c_devices.bus,
2433 apq8064_camera_i2c_devices.info,
2434 apq8064_camera_i2c_devices.len);
2435#endif
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002436
2437 for (i = 0; i < ARRAY_SIZE(mpq8064_i2c_devices); ++i) {
2438 if (mpq8064_i2c_devices[i].machs & mach_mask)
2439 i2c_register_board_info(
2440 mpq8064_i2c_devices[i].bus,
2441 mpq8064_i2c_devices[i].info,
2442 mpq8064_i2c_devices[i].len);
2443 }
Jing Lin417fa452012-02-05 14:31:06 -08002444}
2445
Jay Chokshi994ff122012-03-27 15:43:48 -07002446static void enable_ddr3_regulator(void)
2447{
2448 static struct regulator *ext_ddr3;
2449
2450 /* Use MPP7 output state as a flag for PCDDR3 presence. */
2451 if (gpio_get_value_cansleep(PM8921_MPP_PM_TO_SYS(7)) > 0) {
2452 ext_ddr3 = regulator_get(NULL, "ext_ddr3");
2453 if (IS_ERR(ext_ddr3) || ext_ddr3 == NULL)
2454 pr_err("Could not get MPP7 regulator\n");
2455 else
2456 regulator_enable(ext_ddr3);
2457 }
2458}
2459
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002460static void enable_avc_i2c_bus(void)
2461{
2462 int avc_i2c_en_mpp = PM8921_MPP_PM_TO_SYS(8);
2463 int rc;
2464
2465 rc = gpio_request(avc_i2c_en_mpp, "avc_i2c_en");
2466 if (rc)
2467 pr_err("request for avc_i2c_en mpp failed,"
2468 "rc=%d\n", rc);
2469 else
2470 gpio_set_value_cansleep(avc_i2c_en_mpp, 1);
2471}
2472
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002473static void __init apq8064_common_init(void)
2474{
Joel King8f839b92012-04-01 14:37:46 -07002475 msm_tsens_early_init(&apq_tsens_pdata);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002476 if (socinfo_init() < 0)
2477 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06002478 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
2479 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
David Collins2782b5c2012-02-06 10:02:42 -08002480 regulator_suppress_info_printing();
2481 platform_device_register(&apq8064_device_rpm_regulator);
Stephen Boyd4d0d2582012-02-10 14:49:40 -08002482 if (msm_xo_init())
2483 pr_err("Failed to initialize XO votes\n");
Tianyi Gou41515e22011-09-01 19:37:43 -07002484 apq8064_clock_init();
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08002485 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06002486 apq8064_i2c_init();
Jing Lin417fa452012-02-05 14:31:06 -08002487 register_i2c_devices();
Kenneth Heitke36920d32011-07-20 16:44:30 -06002488
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002489 apq8064_device_qup_spi_gsbi5.dev.platform_data =
2490 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08002491 apq8064_init_pmic();
Hemant Kumar94e7da22012-02-03 16:52:29 -08002492 if (machine_is_apq8064_liquid())
2493 msm_otg_pdata.mhl_enable = true;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07002494
2495 msm_otg_pdata.swfi_latency =
2496 msm_rpmrs_levels[0].latency_us + 1;
2497
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002498 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Manu Gautam91223e02011-11-08 15:27:22 +05302499 apq8064_ehci_host_init();
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002500 apq8064_init_buses();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002501 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Jay Chokshi994ff122012-03-27 15:43:48 -07002502 enable_ddr3_regulator();
Hemant Kumarf1ca9192012-02-07 18:59:33 -08002503 if (machine_is_apq8064_mtp()) {
2504 apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
2505 device_initialize(&apq8064_device_hsic_host.dev);
2506 }
Jay Chokshie8741282012-01-25 15:22:55 -08002507 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05302508 apq8064_init_mmc();
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08002509
2510 if (machine_is_apq8064_mtp()) {
2511 mdm_8064_device.dev.platform_data = &mdm_platform_data;
2512 platform_device_register(&mdm_8064_device);
2513 }
2514 platform_device_register(&apq8064_slim_ctrl);
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002515 slim_register_board_info(apq8064_slim_devices,
2516 ARRAY_SIZE(apq8064_slim_devices));
Jin Hongd3024e62012-02-09 16:13:32 -08002517 apq8064_init_dsps();
Praveen Chidambaram78499012011-11-01 17:15:17 -06002518 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Mahesh Sivasubramaniancbce1ec2012-01-24 10:32:44 -07002519 acpuclk_init(&acpuclk_8064_soc_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002520 msm_spm_l2_init(msm_spm_l2_data);
2521 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2522 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2523 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2524 msm_pm_data);
2525 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002526 apq8064_epm_adc_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002527}
2528
Huaibin Yang4a084e32011-12-15 15:25:52 -08002529static void __init apq8064_allocate_memory_regions(void)
2530{
2531 apq8064_allocate_fb_region();
2532}
2533
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002534static void __init apq8064_sim_init(void)
2535{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002536 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
2537 &msm8064_device_watchdog.dev.platform_data;
2538
2539 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002540 apq8064_common_init();
Joel King4e7ad222011-08-17 15:47:38 -07002541 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
2542}
2543
2544static void __init apq8064_rumi3_init(void)
2545{
2546 apq8064_common_init();
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002547 ethernet_init();
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002548 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002549 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002550}
2551
Joel King82b7e3f2012-01-05 10:03:27 -08002552static void __init apq8064_cdp_init(void)
2553{
2554 apq8064_common_init();
Joel King8f839b92012-04-01 14:37:46 -07002555 if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
2556 machine_is_mpq8064_dtv()) {
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002557 enable_avc_i2c_bus();
Joel King8f839b92012-04-01 14:37:46 -07002558 platform_add_devices(mpq_devices, ARRAY_SIZE(mpq_devices));
2559 } else {
2560 ethernet_init();
2561 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
2562 spi_register_board_info(spi_board_info,
2563 ARRAY_SIZE(spi_board_info));
2564 }
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002565 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07002566 apq8064_init_gpu();
Matt Wagantall1875d322012-02-22 16:11:33 -08002567 platform_add_devices(apq8064_fs_devices, apq8064_num_fs_devices);
Kevin Chand07220e2012-02-13 15:52:22 -08002568 apq8064_init_cam();
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302569
2570 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
2571 platform_device_register(&cdp_kp_pdev);
2572
2573 if (machine_is_apq8064_mtp())
2574 platform_device_register(&mtp_kp_pdev);
Joel King82b7e3f2012-01-05 10:03:27 -08002575}
2576
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002577MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
2578 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002579 .reserve = apq8064_reserve,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002580 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302581 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002582 .timer = &msm_timer,
2583 .init_machine = apq8064_sim_init,
2584MACHINE_END
2585
Joel King4e7ad222011-08-17 15:47:38 -07002586MACHINE_START(APQ8064_RUMI3, "QCT APQ8064 RUMI3")
2587 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002588 .reserve = apq8064_reserve,
Joel King4e7ad222011-08-17 15:47:38 -07002589 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302590 .handle_irq = gic_handle_irq,
Joel King4e7ad222011-08-17 15:47:38 -07002591 .timer = &msm_timer,
2592 .init_machine = apq8064_rumi3_init,
Huaibin Yang4a084e32011-12-15 15:25:52 -08002593 .init_early = apq8064_allocate_memory_regions,
Joel King4e7ad222011-08-17 15:47:38 -07002594MACHINE_END
2595
Joel King82b7e3f2012-01-05 10:03:27 -08002596MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
2597 .map_io = apq8064_map_io,
2598 .reserve = apq8064_reserve,
2599 .init_irq = apq8064_init_irq,
2600 .handle_irq = gic_handle_irq,
2601 .timer = &msm_timer,
2602 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002603 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07002604 .init_very_early = apq8064_early_reserve,
Joel King82b7e3f2012-01-05 10:03:27 -08002605MACHINE_END
2606
2607MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
2608 .map_io = apq8064_map_io,
2609 .reserve = apq8064_reserve,
2610 .init_irq = apq8064_init_irq,
2611 .handle_irq = gic_handle_irq,
2612 .timer = &msm_timer,
2613 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002614 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07002615 .init_very_early = apq8064_early_reserve,
Joel King82b7e3f2012-01-05 10:03:27 -08002616MACHINE_END
2617
2618MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
2619 .map_io = apq8064_map_io,
2620 .reserve = apq8064_reserve,
2621 .init_irq = apq8064_init_irq,
2622 .handle_irq = gic_handle_irq,
2623 .timer = &msm_timer,
2624 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002625 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07002626 .init_very_early = apq8064_early_reserve,
Joel King82b7e3f2012-01-05 10:03:27 -08002627MACHINE_END
2628
Joel King064bbf82012-04-01 13:23:39 -07002629MACHINE_START(MPQ8064_CDP, "QCT MPQ8064 CDP")
2630 .map_io = apq8064_map_io,
2631 .reserve = apq8064_reserve,
2632 .init_irq = apq8064_init_irq,
2633 .handle_irq = gic_handle_irq,
2634 .timer = &msm_timer,
2635 .init_machine = apq8064_cdp_init,
2636 .init_early = apq8064_allocate_memory_regions,
2637 .init_very_early = apq8064_early_reserve,
2638MACHINE_END
2639
Joel King11ca8202012-02-13 16:19:03 -08002640MACHINE_START(MPQ8064_HRD, "QCT MPQ8064 HRD")
2641 .map_io = apq8064_map_io,
2642 .reserve = apq8064_reserve,
2643 .init_irq = apq8064_init_irq,
2644 .handle_irq = gic_handle_irq,
2645 .timer = &msm_timer,
2646 .init_machine = apq8064_cdp_init,
Laura Abbott6988cef2012-03-15 14:27:13 -07002647 .init_very_early = apq8064_early_reserve,
Joel King11ca8202012-02-13 16:19:03 -08002648MACHINE_END
2649
2650MACHINE_START(MPQ8064_DTV, "QCT MPQ8064 DTV")
2651 .map_io = apq8064_map_io,
2652 .reserve = apq8064_reserve,
2653 .init_irq = apq8064_init_irq,
2654 .handle_irq = gic_handle_irq,
2655 .timer = &msm_timer,
2656 .init_machine = apq8064_cdp_init,
Laura Abbott6988cef2012-03-15 14:27:13 -07002657 .init_very_early = apq8064_early_reserve,
Joel King11ca8202012-02-13 16:19:03 -08002658MACHINE_END
2659