blob: ceae29c59b38a2f91b20a2e4054f4d22b6efa147 [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>
Larry Bassel67b921d2012-04-06 10:23:27 -070030#include <linux/memblock.h>
Jing Lin21ed4de2012-02-05 15:53:28 -080031#include <linux/i2c/atmel_mxt_ts.h>
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -080032#include <linux/cyttsp.h>
Amy Maloche70090f992012-02-16 16:35:26 -080033#include <linux/i2c/isa1200.h>
Mohan Pallaka474b94b2012-01-25 12:59:58 +053034#include <linux/gpio_keys.h>
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -080035#include <linux/epm_adc.h>
Jay Chokshie7d8d4f2012-04-04 14:47:57 -070036#include <linux/i2c/sx150x.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070037#include <asm/mach-types.h>
38#include <asm/mach/arch.h>
39#include <asm/hardware/gic.h>
Sahitya Tummala3586ed92011-08-03 09:13:23 +053040#include <asm/mach/mmc.h>
Ankit Verma6b7e2ba2012-01-26 15:48:54 -080041#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070042
43#include <mach/board.h>
44#include <mach/msm_iomap.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080045#include <mach/ion.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070046#include <linux/usb/msm_hsusb.h>
47#include <linux/usb/android.h>
48#include <mach/socinfo.h>
Harini Jayaramanc4c58692011-07-19 14:50:10 -060049#include <mach/msm_spi.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070050#include "timer.h"
51#include "devices.h"
Joel King4ebccc62011-07-22 09:43:22 -070052#include <mach/gpio.h>
53#include <mach/gpiomux.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060054#include <mach/rpm.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080055#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -070056#include <linux/android_pmem.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080057#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070058#include <mach/msm_memtypes.h>
59#include <linux/bootmem.h>
60#include <asm/setup.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070061#include <mach/dma.h>
Jin Hongd3024e62012-02-09 16:13:32 -080062#include <mach/msm_dsps.h>
Gagan Mac8a7a5d32011-11-11 16:43:06 -070063#include <mach/msm_bus_board.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060064#include <mach/cpuidle.h>
Joel Kingdacbc822012-01-25 13:30:57 -080065#include <mach/mdm2.h>
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -080066#include <linux/msm_tsens.h>
Stephen Boyd4d0d2582012-02-10 14:49:40 -080067#include <mach/msm_xo.h>
Laura Abbott350c8362012-02-28 14:46:52 -080068#include <mach/msm_rtb.h>
Santosh Mardieff9a742012-04-09 23:23:39 +053069#include <sound/cs8427.h>
Ravi Kumar V05931a22012-04-04 17:09:37 +053070#include <media/gpio-ir-recv.h>
Larry Bassel67b921d2012-04-06 10:23:27 -070071#include <linux/fmem.h>
Joel King4ebccc62011-07-22 09:43:22 -070072
Jeff Ohlstein7e668552011-10-06 16:17:25 -070073#include "msm_watchdog.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080074#include "board-8064.h"
Vikram Mulukutlabc2e9572011-11-04 03:41:38 -070075#include "acpuclock.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060076#include "spm.h"
Subhash Jadavani909e04f2012-04-12 10:52:50 +053077#include <mach/mpm.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060078#include "rpm_resources.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080079#include "pm.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060080#include "pm-boot.h"
Rajesh Sastrulaaee8af32012-01-20 11:46:31 -080081#include "devices-msm8x60.h"
Hanumant Singh50440d42012-04-23 19:27:16 -070082#include "smd_private.h"
Jay Chokshiea67c622011-07-29 17:12:26 -070083
Olav Haugan7c6aa742012-01-16 16:47:37 -080084#define MSM_PMEM_ADSP_SIZE 0x7800000
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -070085#define MSM_PMEM_AUDIO_SIZE 0x4CF000
Olav Haugan7c6aa742012-01-16 16:47:37 -080086#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
87#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
88#else
Chetan Kalyan72aac4f2012-02-23 14:56:54 -080089#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Olav Haugan7c6aa742012-01-16 16:47:37 -080090#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070091
Olav Haugan7c6aa742012-01-16 16:47:37 -080092#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -070093#define MSM_PMEM_KERNEL_EBI1_SIZE 0x65000
Olav Haugan129992c2012-03-22 09:54:01 -070094#ifdef CONFIG_MSM_IOMMU
95#define MSM_ION_MM_SIZE 0x3800000
96#define MSM_ION_SF_SIZE 0
97#define MSM_ION_HEAP_NUM 7
98#else
Olav Haugan7c6aa742012-01-16 16:47:37 -080099#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Haugan129992c2012-03-22 09:54:01 -0700100#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
101#define MSM_ION_HEAP_NUM 8
102#endif
103#define MSM_ION_MM_FW_SIZE 0x200000 /* (2MB) */
Olav Haugan3a9bd232012-02-15 14:23:27 -0800104#define MSM_ION_QSECOM_SIZE 0x300000 /* (3MB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800105#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan2c43fac2012-01-19 11:06:37 -0800106#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Olav Haugan7c6aa742012-01-16 16:47:37 -0800107#else
108#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
109#define MSM_ION_HEAP_NUM 1
110#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700111
Larry Bassel67b921d2012-04-06 10:23:27 -0700112#define APQ8064_FIXED_AREA_START 0xa0000000
113#define MAX_FIXED_AREA_SIZE 0x10000000
114#define MSM_MM_FW_SIZE 0x200000
115#define APQ8064_FW_START (APQ8064_FIXED_AREA_START - MSM_MM_FW_SIZE)
116
Olav Haugan7c6aa742012-01-16 16:47:37 -0800117#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
118static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
119static int __init pmem_kernel_ebi1_size_setup(char *p)
Kevin Chan13be4e22011-10-20 11:30:32 -0700120{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800121 pmem_kernel_ebi1_size = memparse(p, NULL);
122 return 0;
Kevin Chan13be4e22011-10-20 11:30:32 -0700123}
Olav Haugan7c6aa742012-01-16 16:47:37 -0800124early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
125#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700126
Olav Haugan7c6aa742012-01-16 16:47:37 -0800127#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -0700128static unsigned pmem_size = MSM_PMEM_SIZE;
129static int __init pmem_size_setup(char *p)
130{
131 pmem_size = memparse(p, NULL);
132 return 0;
133}
134early_param("pmem_size", pmem_size_setup);
135
136static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
137
138static int __init pmem_adsp_size_setup(char *p)
139{
140 pmem_adsp_size = memparse(p, NULL);
141 return 0;
142}
143early_param("pmem_adsp_size", pmem_adsp_size_setup);
144
145static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
146
147static int __init pmem_audio_size_setup(char *p)
148{
149 pmem_audio_size = memparse(p, NULL);
150 return 0;
151}
152early_param("pmem_audio_size", pmem_audio_size_setup);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800153#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700154
Olav Haugan7c6aa742012-01-16 16:47:37 -0800155#ifdef CONFIG_ANDROID_PMEM
156#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700157static struct android_pmem_platform_data android_pmem_pdata = {
158 .name = "pmem",
159 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
160 .cached = 1,
161 .memory_type = MEMTYPE_EBI1,
162};
163
Laura Abbottb93525f2012-04-12 09:57:19 -0700164static struct platform_device apq8064_android_pmem_device = {
Kevin Chan13be4e22011-10-20 11:30:32 -0700165 .name = "android_pmem",
166 .id = 0,
167 .dev = {.platform_data = &android_pmem_pdata},
168};
169
170static struct android_pmem_platform_data android_pmem_adsp_pdata = {
171 .name = "pmem_adsp",
172 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
173 .cached = 0,
174 .memory_type = MEMTYPE_EBI1,
175};
Laura Abbottb93525f2012-04-12 09:57:19 -0700176static struct platform_device apq8064_android_pmem_adsp_device = {
Kevin Chan13be4e22011-10-20 11:30:32 -0700177 .name = "android_pmem",
178 .id = 2,
179 .dev = { .platform_data = &android_pmem_adsp_pdata },
180};
181
182static struct android_pmem_platform_data android_pmem_audio_pdata = {
183 .name = "pmem_audio",
184 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
185 .cached = 0,
186 .memory_type = MEMTYPE_EBI1,
187};
188
Laura Abbottb93525f2012-04-12 09:57:19 -0700189static struct platform_device apq8064_android_pmem_audio_device = {
Kevin Chan13be4e22011-10-20 11:30:32 -0700190 .name = "android_pmem",
191 .id = 4,
192 .dev = { .platform_data = &android_pmem_audio_pdata },
193};
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700194#endif /* CONFIG_MSM_MULTIMEDIA_USE_ION */
195#endif /* CONFIG_ANDROID_PMEM */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800196
Larry Bassel67b921d2012-04-06 10:23:27 -0700197struct fmem_platform_data apq8064_fmem_pdata = {
198};
199
Olav Haugan7c6aa742012-01-16 16:47:37 -0800200static struct memtype_reserve apq8064_reserve_table[] __initdata = {
201 [MEMTYPE_SMI] = {
202 },
203 [MEMTYPE_EBI0] = {
204 .flags = MEMTYPE_FLAGS_1M_ALIGN,
205 },
206 [MEMTYPE_EBI1] = {
207 .flags = MEMTYPE_FLAGS_1M_ALIGN,
208 },
209};
Kevin Chan13be4e22011-10-20 11:30:32 -0700210
Laura Abbott350c8362012-02-28 14:46:52 -0800211static void __init reserve_rtb_memory(void)
212{
213#if defined(CONFIG_MSM_RTB)
Laura Abbottb93525f2012-04-12 09:57:19 -0700214 apq8064_reserve_table[MEMTYPE_EBI1].size += apq8064_rtb_pdata.size;
Laura Abbott350c8362012-02-28 14:46:52 -0800215#endif
216}
217
218
Kevin Chan13be4e22011-10-20 11:30:32 -0700219static void __init size_pmem_devices(void)
220{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800221#ifdef CONFIG_ANDROID_PMEM
222#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700223 android_pmem_adsp_pdata.size = pmem_adsp_size;
224 android_pmem_pdata.size = pmem_size;
225 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700226#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
227#endif /*CONFIG_ANDROID_PMEM*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700228}
229
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700230#ifdef CONFIG_ANDROID_PMEM
231#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700232static void __init reserve_memory_for(struct android_pmem_platform_data *p)
233{
234 apq8064_reserve_table[p->memory_type].size += p->size;
235}
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700236#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
237#endif /*CONFIG_ANDROID_PMEM*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700238
Kevin Chan13be4e22011-10-20 11:30:32 -0700239static void __init reserve_pmem_memory(void)
240{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800241#ifdef CONFIG_ANDROID_PMEM
242#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700243 reserve_memory_for(&android_pmem_adsp_pdata);
244 reserve_memory_for(&android_pmem_pdata);
245 reserve_memory_for(&android_pmem_audio_pdata);
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700246#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700247 apq8064_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700248#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -0800249}
250
251static int apq8064_paddr_to_memtype(unsigned int paddr)
252{
253 return MEMTYPE_EBI1;
254}
255
Larry Bassel67b921d2012-04-06 10:23:27 -0700256#define FMEM_ENABLED 1
257
Olav Haugan7c6aa742012-01-16 16:47:37 -0800258#ifdef CONFIG_ION_MSM
259#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -0700260static struct ion_cp_heap_pdata cp_mm_apq8064_ion_pdata = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800261 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugand3d29682012-01-19 10:57:07 -0800262 .align = PAGE_SIZE,
Larry Bassel67b921d2012-04-06 10:23:27 -0700263 .reusable = FMEM_ENABLED,
264 .mem_is_fmem = FMEM_ENABLED,
265 .fixed_position = FIXED_MIDDLE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800266};
267
Laura Abbottb93525f2012-04-12 09:57:19 -0700268static struct ion_cp_heap_pdata cp_mfc_apq8064_ion_pdata = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800269 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugand3d29682012-01-19 10:57:07 -0800270 .align = PAGE_SIZE,
Larry Bassel67b921d2012-04-06 10:23:27 -0700271 .reusable = 0,
272 .mem_is_fmem = FMEM_ENABLED,
273 .fixed_position = FIXED_HIGH,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800274};
275
Laura Abbottb93525f2012-04-12 09:57:19 -0700276static struct ion_co_heap_pdata co_apq8064_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800277 .adjacent_mem_id = INVALID_HEAP_ID,
278 .align = PAGE_SIZE,
Larry Bassel67b921d2012-04-06 10:23:27 -0700279 .mem_is_fmem = 0,
Olav Haugand3d29682012-01-19 10:57:07 -0800280};
281
Laura Abbottb93525f2012-04-12 09:57:19 -0700282static struct ion_co_heap_pdata fw_co_apq8064_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800283 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
284 .align = SZ_128K,
Larry Bassel67b921d2012-04-06 10:23:27 -0700285 .mem_is_fmem = FMEM_ENABLED,
286 .fixed_position = FIXED_LOW,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800287};
288#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800289
290/**
291 * These heaps are listed in the order they will be allocated. Due to
292 * video hardware restrictions and content protection the FW heap has to
293 * be allocated adjacent (below) the MM heap and the MFC heap has to be
294 * allocated after the MM heap to ensure MFC heap is not more than 256MB
295 * away from the base address of the FW heap.
296 * However, the order of FW heap and MM heap doesn't matter since these
297 * two heaps are taken care of by separate code to ensure they are adjacent
298 * to each other.
299 * Don't swap the order unless you know what you are doing!
300 */
Laura Abbottb93525f2012-04-12 09:57:19 -0700301static struct ion_platform_data apq8064_ion_pdata = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800302 .nr = MSM_ION_HEAP_NUM,
303 .heaps = {
304 {
305 .id = ION_SYSTEM_HEAP_ID,
306 .type = ION_HEAP_TYPE_SYSTEM,
307 .name = ION_VMALLOC_HEAP_NAME,
308 },
309#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
310 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800311 .id = ION_CP_MM_HEAP_ID,
312 .type = ION_HEAP_TYPE_CP,
313 .name = ION_MM_HEAP_NAME,
314 .size = MSM_ION_MM_SIZE,
315 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700316 .extra_data = (void *) &cp_mm_apq8064_ion_pdata,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800317 },
318 {
Olav Haugand3d29682012-01-19 10:57:07 -0800319 .id = ION_MM_FIRMWARE_HEAP_ID,
320 .type = ION_HEAP_TYPE_CARVEOUT,
321 .name = ION_MM_FIRMWARE_HEAP_NAME,
322 .size = MSM_ION_MM_FW_SIZE,
323 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700324 .extra_data = (void *) &fw_co_apq8064_ion_pdata,
Olav Haugand3d29682012-01-19 10:57:07 -0800325 },
326 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800327 .id = ION_CP_MFC_HEAP_ID,
328 .type = ION_HEAP_TYPE_CP,
329 .name = ION_MFC_HEAP_NAME,
330 .size = MSM_ION_MFC_SIZE,
331 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700332 .extra_data = (void *) &cp_mfc_apq8064_ion_pdata,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800333 },
Olav Haugan129992c2012-03-22 09:54:01 -0700334#ifndef CONFIG_MSM_IOMMU
Olav Haugan7c6aa742012-01-16 16:47:37 -0800335 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800336 .id = ION_SF_HEAP_ID,
337 .type = ION_HEAP_TYPE_CARVEOUT,
338 .name = ION_SF_HEAP_NAME,
339 .size = MSM_ION_SF_SIZE,
340 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700341 .extra_data = (void *) &co_apq8064_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800342 },
Olav Haugan129992c2012-03-22 09:54:01 -0700343#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800344 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800345 .id = ION_IOMMU_HEAP_ID,
346 .type = ION_HEAP_TYPE_IOMMU,
347 .name = ION_IOMMU_HEAP_NAME,
348 },
Olav Hauganf45e2142012-01-19 11:01:01 -0800349 {
350 .id = ION_QSECOM_HEAP_ID,
351 .type = ION_HEAP_TYPE_CARVEOUT,
352 .name = ION_QSECOM_HEAP_NAME,
353 .size = MSM_ION_QSECOM_SIZE,
354 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700355 .extra_data = (void *) &co_apq8064_ion_pdata,
Olav Hauganf45e2142012-01-19 11:01:01 -0800356 },
Olav Haugan2c43fac2012-01-19 11:06:37 -0800357 {
358 .id = ION_AUDIO_HEAP_ID,
359 .type = ION_HEAP_TYPE_CARVEOUT,
360 .name = ION_AUDIO_HEAP_NAME,
361 .size = MSM_ION_AUDIO_SIZE,
362 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700363 .extra_data = (void *) &co_apq8064_ion_pdata,
Olav Haugan2c43fac2012-01-19 11:06:37 -0800364 },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800365#endif
366 }
367};
368
Laura Abbottb93525f2012-04-12 09:57:19 -0700369static struct platform_device apq8064_ion_dev = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800370 .name = "ion-msm",
371 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700372 .dev = { .platform_data = &apq8064_ion_pdata },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800373};
374#endif
375
Larry Bassel67b921d2012-04-06 10:23:27 -0700376static struct platform_device apq8064_fmem_device = {
377 .name = "fmem",
378 .id = 1,
379 .dev = { .platform_data = &apq8064_fmem_pdata },
380};
381
382static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
383 unsigned long size)
384{
385 apq8064_reserve_table[mem_type].size += size;
386}
387
388static void __init apq8064_reserve_fixed_area(unsigned long fixed_area_size)
389{
390#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
391 int ret;
392
393 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
394 panic("fixed area size is larger than %dM\n",
395 MAX_FIXED_AREA_SIZE >> 20);
396
397 reserve_info->fixed_area_size = fixed_area_size;
398 reserve_info->fixed_area_start = APQ8064_FW_START;
399
400 ret = memblock_remove(reserve_info->fixed_area_start,
401 reserve_info->fixed_area_size);
402 BUG_ON(ret);
403#endif
404}
405
406/**
407 * Reserve memory for ION and calculate amount of reusable memory for fmem.
408 * We only reserve memory for heaps that are not reusable. However, we only
409 * support one reusable heap at the moment so we ignore the reusable flag for
410 * other than the first heap with reusable flag set. Also handle special case
411 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
412 * at a higher address than FW in addition to not more than 256MB away from the
413 * base address of the firmware. This means that if MM is reusable the other
414 * two heaps must be allocated in the same region as FW. This is handled by the
415 * mem_is_fmem flag in the platform data. In addition the MM heap must be
416 * adjacent to the FW heap for content protection purposes.
417 */
Stephen Boyd668d7652012-04-25 11:31:01 -0700418static void __init reserve_ion_memory(void)
Olav Haugan7c6aa742012-01-16 16:47:37 -0800419{
420#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Larry Bassel67b921d2012-04-06 10:23:27 -0700421 unsigned int i;
422 unsigned int reusable_count = 0;
423 unsigned int fixed_size = 0;
424 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
425 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
426
427 apq8064_fmem_pdata.size = 0;
428 apq8064_fmem_pdata.reserved_size_low = 0;
429 apq8064_fmem_pdata.reserved_size_high = 0;
430 fixed_low_size = 0;
431 fixed_middle_size = 0;
432 fixed_high_size = 0;
433
434 /* We only support 1 reusable heap. Check if more than one heap
435 * is specified as reusable and set as non-reusable if found.
436 */
437 for (i = 0; i < apq8064_ion_pdata.nr; ++i) {
438 const struct ion_platform_heap *heap =
439 &(apq8064_ion_pdata.heaps[i]);
440
441 if (heap->type == ION_HEAP_TYPE_CP && heap->extra_data) {
442 struct ion_cp_heap_pdata *data = heap->extra_data;
443
444 reusable_count += (data->reusable) ? 1 : 0;
445
446 if (data->reusable && reusable_count > 1) {
447 pr_err("%s: Too many heaps specified as "
448 "reusable. Heap %s was not configured "
449 "as reusable.\n", __func__, heap->name);
450 data->reusable = 0;
451 }
452 }
453 }
454
455 for (i = 0; i < apq8064_ion_pdata.nr; ++i) {
456 const struct ion_platform_heap *heap =
457 &(apq8064_ion_pdata.heaps[i]);
458
459 if (heap->extra_data) {
460 int fixed_position = NOT_FIXED;
461 int mem_is_fmem = 0;
462
463 switch (heap->type) {
464 case ION_HEAP_TYPE_CP:
465 mem_is_fmem = ((struct ion_cp_heap_pdata *)
466 heap->extra_data)->mem_is_fmem;
467 fixed_position = ((struct ion_cp_heap_pdata *)
468 heap->extra_data)->fixed_position;
469 break;
470 case ION_HEAP_TYPE_CARVEOUT:
471 mem_is_fmem = ((struct ion_co_heap_pdata *)
472 heap->extra_data)->mem_is_fmem;
473 fixed_position = ((struct ion_co_heap_pdata *)
474 heap->extra_data)->fixed_position;
475 break;
476 default:
477 break;
478 }
479
480 if (fixed_position != NOT_FIXED)
481 fixed_size += heap->size;
482 else
483 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
484
485 if (fixed_position == FIXED_LOW)
486 fixed_low_size += heap->size;
487 else if (fixed_position == FIXED_MIDDLE)
488 fixed_middle_size += heap->size;
489 else if (fixed_position == FIXED_HIGH)
490 fixed_high_size += heap->size;
491
492 if (mem_is_fmem)
493 apq8064_fmem_pdata.size += heap->size;
494 }
495 }
496
497 if (!fixed_size)
498 return;
499
500 if (apq8064_fmem_pdata.size) {
501 apq8064_fmem_pdata.reserved_size_low = fixed_low_size;
502 apq8064_fmem_pdata.reserved_size_high = fixed_high_size;
503 }
504
505 /* Since the fixed area may be carved out of lowmem,
506 * make sure the length is a multiple of 1M.
507 */
508 fixed_size = (fixed_size + MSM_MM_FW_SIZE + SECTION_SIZE - 1)
509 & SECTION_MASK;
510 apq8064_reserve_fixed_area(fixed_size);
511
512 fixed_low_start = APQ8064_FIXED_AREA_START;
513 fixed_middle_start = fixed_low_start + fixed_low_size;
514 fixed_high_start = fixed_middle_start + fixed_middle_size;
515
516 for (i = 0; i < apq8064_ion_pdata.nr; ++i) {
517 struct ion_platform_heap *heap = &(apq8064_ion_pdata.heaps[i]);
518
519 if (heap->extra_data) {
520 int fixed_position = NOT_FIXED;
521
522 switch (heap->type) {
523 case ION_HEAP_TYPE_CP:
524 fixed_position = ((struct ion_cp_heap_pdata *)
525 heap->extra_data)->fixed_position;
526 break;
527 case ION_HEAP_TYPE_CARVEOUT:
528 fixed_position = ((struct ion_co_heap_pdata *)
529 heap->extra_data)->fixed_position;
530 break;
531 default:
532 break;
533 }
534
535 switch (fixed_position) {
536 case FIXED_LOW:
537 heap->base = fixed_low_start;
538 break;
539 case FIXED_MIDDLE:
540 heap->base = fixed_middle_start;
541 break;
542 case FIXED_HIGH:
543 heap->base = fixed_high_start;
544 break;
545 default:
546 break;
547 }
548 }
549 }
Olav Haugan7c6aa742012-01-16 16:47:37 -0800550#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700551}
552
Huaibin Yang4a084e32011-12-15 15:25:52 -0800553static void __init reserve_mdp_memory(void)
554{
555 apq8064_mdp_writeback(apq8064_reserve_table);
556}
557
Kevin Chan13be4e22011-10-20 11:30:32 -0700558static void __init apq8064_calculate_reserve_sizes(void)
559{
560 size_pmem_devices();
561 reserve_pmem_memory();
Olav Haugan7c6aa742012-01-16 16:47:37 -0800562 reserve_ion_memory();
Huaibin Yang4a084e32011-12-15 15:25:52 -0800563 reserve_mdp_memory();
Laura Abbott350c8362012-02-28 14:46:52 -0800564 reserve_rtb_memory();
Kevin Chan13be4e22011-10-20 11:30:32 -0700565}
566
567static struct reserve_info apq8064_reserve_info __initdata = {
568 .memtype_reserve_table = apq8064_reserve_table,
569 .calculate_reserve_sizes = apq8064_calculate_reserve_sizes,
Larry Bassel67b921d2012-04-06 10:23:27 -0700570 .reserve_fixed_area = apq8064_reserve_fixed_area,
Kevin Chan13be4e22011-10-20 11:30:32 -0700571 .paddr_to_memtype = apq8064_paddr_to_memtype,
572};
573
574static int apq8064_memory_bank_size(void)
575{
576 return 1<<29;
577}
578
579static void __init locate_unstable_memory(void)
580{
581 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
582 unsigned long bank_size;
583 unsigned long low, high;
584
585 bank_size = apq8064_memory_bank_size();
586 low = meminfo.bank[0].start;
587 high = mb->start + mb->size;
Olav Haugand76e3a82012-01-16 16:55:07 -0800588
589 /* Check if 32 bit overflow occured */
590 if (high < mb->start)
Larry Bassel67b921d2012-04-06 10:23:27 -0700591 high = -PAGE_SIZE;
Olav Haugand76e3a82012-01-16 16:55:07 -0800592
Kevin Chan13be4e22011-10-20 11:30:32 -0700593 low &= ~(bank_size - 1);
594
595 if (high - low <= bank_size)
Larry Bassel67b921d2012-04-06 10:23:27 -0700596 goto no_dmm;
597
598#ifdef CONFIG_ENABLE_DMM
Jack Cheung46bfffa2012-01-19 15:26:24 -0800599 apq8064_reserve_info.low_unstable_address = mb->start -
600 MIN_MEMORY_BLOCK_SIZE + mb->size;
601 apq8064_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
602
Kevin Chan13be4e22011-10-20 11:30:32 -0700603 apq8064_reserve_info.bank_size = bank_size;
604 pr_info("low unstable address %lx max size %lx bank size %lx\n",
605 apq8064_reserve_info.low_unstable_address,
606 apq8064_reserve_info.max_unstable_size,
607 apq8064_reserve_info.bank_size);
Larry Bassel67b921d2012-04-06 10:23:27 -0700608 return;
609#endif
610no_dmm:
611 apq8064_reserve_info.low_unstable_address = high;
612 apq8064_reserve_info.max_unstable_size = 0;
Kevin Chan13be4e22011-10-20 11:30:32 -0700613}
614
Hanumant Singh50440d42012-04-23 19:27:16 -0700615static int apq8064_change_memory_power(u64 start, u64 size,
616 int change_type)
617{
618 return soc_change_memory_power(start, size, change_type);
619}
620
Aravind Venkateswaran8ac7f412012-03-16 17:57:30 -0700621static char prim_panel_name[PANEL_NAME_MAX_LEN];
622static char ext_panel_name[PANEL_NAME_MAX_LEN];
623static int __init prim_display_setup(char *param)
624{
625 if (strnlen(param, PANEL_NAME_MAX_LEN))
626 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
627 return 0;
628}
629early_param("prim_display", prim_display_setup);
630
631static int __init ext_display_setup(char *param)
632{
633 if (strnlen(param, PANEL_NAME_MAX_LEN))
634 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
635 return 0;
636}
637early_param("ext_display", ext_display_setup);
638
Kevin Chan13be4e22011-10-20 11:30:32 -0700639static void __init apq8064_reserve(void)
640{
Aravind Venkateswaran8ac7f412012-03-16 17:57:30 -0700641 apq8064_set_display_params(prim_panel_name, ext_panel_name);
Kevin Chan13be4e22011-10-20 11:30:32 -0700642 msm_reserve();
Larry Bassel67b921d2012-04-06 10:23:27 -0700643 if (apq8064_fmem_pdata.size) {
644#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
645 if (reserve_info->fixed_area_size) {
646 apq8064_fmem_pdata.phys =
647 reserve_info->fixed_area_start + MSM_MM_FW_SIZE;
648 pr_info("mm fw at %lx (fixed) size %x\n",
649 reserve_info->fixed_area_start, MSM_MM_FW_SIZE);
650 pr_info("fmem start %lx (fixed) size %lx\n",
651 apq8064_fmem_pdata.phys,
652 apq8064_fmem_pdata.size);
653 }
654#endif
655 }
Kevin Chan13be4e22011-10-20 11:30:32 -0700656}
657
Laura Abbott6988cef2012-03-15 14:27:13 -0700658static void __init place_movable_zone(void)
659{
Larry Bassel67b921d2012-04-06 10:23:27 -0700660#ifdef CONFIG_ENABLE_DMM
Laura Abbott6988cef2012-03-15 14:27:13 -0700661 movable_reserved_start = apq8064_reserve_info.low_unstable_address;
662 movable_reserved_size = apq8064_reserve_info.max_unstable_size;
663 pr_info("movable zone start %lx size %lx\n",
664 movable_reserved_start, movable_reserved_size);
Larry Bassel67b921d2012-04-06 10:23:27 -0700665#endif
Laura Abbott6988cef2012-03-15 14:27:13 -0700666}
667
668static void __init apq8064_early_reserve(void)
669{
670 reserve_info = &apq8064_reserve_info;
671 locate_unstable_memory();
672 place_movable_zone();
673
674}
Hemant Kumara945b472012-01-25 15:08:06 -0800675#ifdef CONFIG_USB_EHCI_MSM_HSIC
Hemant Kumare6275972012-02-29 20:06:21 -0800676/* Bandwidth requests (zero) if no vote placed */
677static struct msm_bus_vectors hsic_init_vectors[] = {
678 {
679 .src = MSM_BUS_MASTER_SPS,
680 .dst = MSM_BUS_SLAVE_EBI_CH0,
681 .ab = 0,
682 .ib = 0,
683 },
684 {
685 .src = MSM_BUS_MASTER_SPS,
686 .dst = MSM_BUS_SLAVE_SPS,
687 .ab = 0,
688 .ib = 0,
689 },
690};
691
692/* Bus bandwidth requests in Bytes/sec */
693static struct msm_bus_vectors hsic_max_vectors[] = {
694 {
695 .src = MSM_BUS_MASTER_SPS,
696 .dst = MSM_BUS_SLAVE_EBI_CH0,
697 .ab = 60000000, /* At least 480Mbps on bus. */
698 .ib = 960000000, /* MAX bursts rate */
699 },
700 {
701 .src = MSM_BUS_MASTER_SPS,
702 .dst = MSM_BUS_SLAVE_SPS,
703 .ab = 0,
704 .ib = 512000000, /*vote for 64Mhz dfab clk rate*/
705 },
706};
707
708static struct msm_bus_paths hsic_bus_scale_usecases[] = {
709 {
710 ARRAY_SIZE(hsic_init_vectors),
711 hsic_init_vectors,
712 },
713 {
714 ARRAY_SIZE(hsic_max_vectors),
715 hsic_max_vectors,
716 },
717};
718
719static struct msm_bus_scale_pdata hsic_bus_scale_pdata = {
720 hsic_bus_scale_usecases,
721 ARRAY_SIZE(hsic_bus_scale_usecases),
722 .name = "hsic",
723};
724
Hemant Kumara945b472012-01-25 15:08:06 -0800725static struct msm_hsic_host_platform_data msm_hsic_pdata = {
Hemant Kumare6275972012-02-29 20:06:21 -0800726 .strobe = 88,
727 .data = 89,
728 .bus_scale_table = &hsic_bus_scale_pdata,
Hemant Kumara945b472012-01-25 15:08:06 -0800729};
730#else
731static struct msm_hsic_host_platform_data msm_hsic_pdata;
732#endif
733
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800734#define PID_MAGIC_ID 0x71432909
735#define SERIAL_NUM_MAGIC_ID 0x61945374
736#define SERIAL_NUMBER_LENGTH 127
737#define DLOAD_USB_BASE_ADD 0x2A03F0C8
738
739struct magic_num_struct {
740 uint32_t pid;
741 uint32_t serial_num;
742};
743
744struct dload_struct {
745 uint32_t reserved1;
746 uint32_t reserved2;
747 uint32_t reserved3;
748 uint16_t reserved4;
749 uint16_t pid;
750 char serial_number[SERIAL_NUMBER_LENGTH];
751 uint16_t reserved5;
752 struct magic_num_struct magic_struct;
753};
754
755static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
756{
757 struct dload_struct __iomem *dload = 0;
758
759 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
760 if (!dload) {
761 pr_err("%s: cannot remap I/O memory region: %08x\n",
762 __func__, DLOAD_USB_BASE_ADD);
763 return -ENXIO;
764 }
765
766 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
767 __func__, dload, pid, snum);
768 /* update pid */
769 dload->magic_struct.pid = PID_MAGIC_ID;
770 dload->pid = pid;
771
772 /* update serial number */
773 dload->magic_struct.serial_num = 0;
774 if (!snum) {
775 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
776 goto out;
777 }
778
779 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
780 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
781out:
782 iounmap(dload);
783 return 0;
784}
785
786static struct android_usb_platform_data android_usb_pdata = {
787 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
788};
789
Hemant Kumar4933b072011-10-17 23:43:11 -0700790static struct platform_device android_usb_device = {
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800791 .name = "android_usb",
792 .id = -1,
793 .dev = {
794 .platform_data = &android_usb_pdata,
795 },
Hemant Kumar4933b072011-10-17 23:43:11 -0700796};
797
Hemant Kumar7620eed2012-02-26 09:08:43 -0800798/* Bandwidth requests (zero) if no vote placed */
799static struct msm_bus_vectors usb_init_vectors[] = {
800 {
801 .src = MSM_BUS_MASTER_SPS,
802 .dst = MSM_BUS_SLAVE_EBI_CH0,
803 .ab = 0,
804 .ib = 0,
805 },
806};
807
808/* Bus bandwidth requests in Bytes/sec */
809static struct msm_bus_vectors usb_max_vectors[] = {
810 {
811 .src = MSM_BUS_MASTER_SPS,
812 .dst = MSM_BUS_SLAVE_EBI_CH0,
813 .ab = 60000000, /* At least 480Mbps on bus. */
814 .ib = 960000000, /* MAX bursts rate */
815 },
816};
817
818static struct msm_bus_paths usb_bus_scale_usecases[] = {
819 {
820 ARRAY_SIZE(usb_init_vectors),
821 usb_init_vectors,
822 },
823 {
824 ARRAY_SIZE(usb_max_vectors),
825 usb_max_vectors,
826 },
827};
828
829static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
830 usb_bus_scale_usecases,
831 ARRAY_SIZE(usb_bus_scale_usecases),
832 .name = "usb",
833};
834
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700835static int phy_init_seq[] = {
836 0x38, 0x81, /* update DC voltage level */
837 0x24, 0x82, /* set pre-emphasis and rise/fall time */
838 -1
839};
840
Hemant Kumar4933b072011-10-17 23:43:11 -0700841static struct msm_otg_platform_data msm_otg_pdata = {
Hemant Kumard86c4882012-01-24 19:39:37 -0800842 .mode = USB_OTG,
843 .otg_control = OTG_PMIC_CONTROL,
Hemant Kumar4933b072011-10-17 23:43:11 -0700844 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Hemant Kumard86c4882012-01-24 19:39:37 -0800845 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
846 .power_budget = 750,
Hemant Kumar7620eed2012-02-26 09:08:43 -0800847 .bus_scale_table = &usb_bus_scale_pdata,
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700848 .phy_init_seq = phy_init_seq,
Hemant Kumar4933b072011-10-17 23:43:11 -0700849};
850
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800851static struct msm_usb_host_platform_data msm_ehci_host_pdata3 = {
Manu Gautam91223e02011-11-08 15:27:22 +0530852 .power_budget = 500,
853};
854
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800855#ifdef CONFIG_USB_EHCI_MSM_HOST4
856static struct msm_usb_host_platform_data msm_ehci_host_pdata4;
857#endif
858
Manu Gautam91223e02011-11-08 15:27:22 +0530859static void __init apq8064_ehci_host_init(void)
860{
861 if (machine_is_apq8064_liquid()) {
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800862 msm_ehci_host_pdata3.dock_connect_irq =
Hemant Kumar56925352012-02-13 16:59:52 -0800863 PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9);
864
Manu Gautam91223e02011-11-08 15:27:22 +0530865 apq8064_device_ehci_host3.dev.platform_data =
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800866 &msm_ehci_host_pdata3;
Manu Gautam91223e02011-11-08 15:27:22 +0530867 platform_device_register(&apq8064_device_ehci_host3);
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800868
869#ifdef CONFIG_USB_EHCI_MSM_HOST4
870 apq8064_device_ehci_host4.dev.platform_data =
871 &msm_ehci_host_pdata4;
872 platform_device_register(&apq8064_device_ehci_host4);
873#endif
Manu Gautam91223e02011-11-08 15:27:22 +0530874 }
875}
876
David Keitel2f613d92012-02-15 11:29:16 -0800877static struct smb349_platform_data smb349_data __initdata = {
878 .en_n_gpio = PM8921_GPIO_PM_TO_SYS(37),
879 .chg_susp_gpio = PM8921_GPIO_PM_TO_SYS(30),
880 .chg_current_ma = 2200,
881};
882
883static struct i2c_board_info smb349_charger_i2c_info[] __initdata = {
884 {
885 I2C_BOARD_INFO(SMB349_NAME, 0x1B),
886 .platform_data = &smb349_data,
887 },
888};
889
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -0800890struct sx150x_platform_data apq8064_sx150x_data[] = {
891 [SX150X_EPM] = {
892 .gpio_base = GPIO_EPM_EXPANDER_BASE,
893 .oscio_is_gpo = false,
894 .io_pullup_ena = 0x0,
895 .io_pulldn_ena = 0x0,
896 .io_open_drain_ena = 0x0,
897 .io_polarity = 0,
898 .irq_summary = -1,
899 },
900};
901
902static struct epm_chan_properties ads_adc_channel_data[] = {
903 {10, 100}, {500, 50}, {1, 1}, {1, 1},
904 {20, 50}, {10, 100}, {1, 1}, {1, 1},
905 {10, 100}, {10, 100}, {100, 100}, {200, 100},
906 {100, 50}, {2000, 50}, {1000, 50}, {200, 50},
907 {200, 100}, {1, 1}, {20, 50}, {500, 50},
908 {50, 50}, {200, 100}, {500, 100}, {20, 50},
909 {200, 50}, {2000, 100}, {1000, 50}, {100, 50},
910 {200, 100}, {500, 50}, {1000, 100}, {200, 50},
911 {1000, 50}, {50, 50}, {100, 50}, {100, 50},
912 {1, 1}, {1, 1}, {20, 100}, {20, 50},
913 {500, 100}, {1000, 100}, {100, 50}, {1000, 50},
914 {100, 50}, {1000, 100}, {100, 50}, {100, 50},
915};
916
917static struct epm_adc_platform_data epm_adc_pdata = {
918 .channel = ads_adc_channel_data,
919 .bus_id = 0x0,
920 .epm_i2c_board_info = {
921 .type = "sx1509q",
922 .addr = 0x3e,
923 .platform_data = &apq8064_sx150x_data[SX150X_EPM],
924 },
925 .gpio_expander_base_addr = GPIO_EPM_EXPANDER_BASE,
926};
927
928static struct platform_device epm_adc_device = {
929 .name = "epm_adc",
930 .id = -1,
931 .dev = {
932 .platform_data = &epm_adc_pdata,
933 },
934};
935
936static void __init apq8064_epm_adc_init(void)
937{
938 epm_adc_pdata.num_channels = 32;
939 epm_adc_pdata.num_adc = 2;
940 epm_adc_pdata.chan_per_adc = 16;
941 epm_adc_pdata.chan_per_mux = 8;
942};
943
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800944/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
945 * 4 micbiases are used to power various analog and digital
946 * microphones operating at 1800 mV. Technically, all micbiases
947 * can source from single cfilter since all microphones operate
948 * at the same voltage level. The arrangement below is to make
949 * sure all cfilters are exercised. LDO_H regulator ouput level
950 * does not need to be as high as 2.85V. It is choosen for
951 * microphone sensitivity purpose.
952 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530953static struct wcd9xxx_pdata apq8064_tabla_platform_data = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800954 .slimbus_slave_device = {
955 .name = "tabla-slave",
956 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
957 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800958 .irq = MSM_GPIO_TO_INT(42),
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800959 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530960 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800961 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
962 .micbias = {
963 .ldoh_v = TABLA_LDOH_2P85_V,
964 .cfilt1_mv = 1800,
965 .cfilt2_mv = 1800,
966 .cfilt3_mv = 1800,
967 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
968 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
969 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
970 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530971 },
972 .regulator = {
973 {
974 .name = "CDC_VDD_CP",
975 .min_uV = 1800000,
976 .max_uV = 1800000,
977 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
978 },
979 {
980 .name = "CDC_VDDA_RX",
981 .min_uV = 1800000,
982 .max_uV = 1800000,
983 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
984 },
985 {
986 .name = "CDC_VDDA_TX",
987 .min_uV = 1800000,
988 .max_uV = 1800000,
989 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
990 },
991 {
992 .name = "VDDIO_CDC",
993 .min_uV = 1800000,
994 .max_uV = 1800000,
995 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
996 },
997 {
998 .name = "VDDD_CDC_D",
999 .min_uV = 1225000,
1000 .max_uV = 1225000,
1001 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1002 },
1003 {
1004 .name = "CDC_VDDA_A_1P2V",
1005 .min_uV = 1225000,
1006 .max_uV = 1225000,
1007 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1008 },
1009 },
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001010};
1011
1012static struct slim_device apq8064_slim_tabla = {
1013 .name = "tabla-slim",
1014 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
1015 .dev = {
1016 .platform_data = &apq8064_tabla_platform_data,
1017 },
1018};
1019
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301020static struct wcd9xxx_pdata apq8064_tabla20_platform_data = {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001021 .slimbus_slave_device = {
1022 .name = "tabla-slave",
1023 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
1024 },
1025 .irq = MSM_GPIO_TO_INT(42),
1026 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301027 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001028 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
1029 .micbias = {
1030 .ldoh_v = TABLA_LDOH_2P85_V,
1031 .cfilt1_mv = 1800,
1032 .cfilt2_mv = 1800,
1033 .cfilt3_mv = 1800,
1034 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
1035 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
1036 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
1037 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301038 },
1039 .regulator = {
1040 {
1041 .name = "CDC_VDD_CP",
1042 .min_uV = 1800000,
1043 .max_uV = 1800000,
1044 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
1045 },
1046 {
1047 .name = "CDC_VDDA_RX",
1048 .min_uV = 1800000,
1049 .max_uV = 1800000,
1050 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
1051 },
1052 {
1053 .name = "CDC_VDDA_TX",
1054 .min_uV = 1800000,
1055 .max_uV = 1800000,
1056 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
1057 },
1058 {
1059 .name = "VDDIO_CDC",
1060 .min_uV = 1800000,
1061 .max_uV = 1800000,
1062 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1063 },
1064 {
1065 .name = "VDDD_CDC_D",
1066 .min_uV = 1225000,
1067 .max_uV = 1225000,
1068 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1069 },
1070 {
1071 .name = "CDC_VDDA_A_1P2V",
1072 .min_uV = 1225000,
1073 .max_uV = 1225000,
1074 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1075 },
1076 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001077};
1078
1079static struct slim_device apq8064_slim_tabla20 = {
1080 .name = "tabla2x-slim",
1081 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
1082 .dev = {
1083 .platform_data = &apq8064_tabla20_platform_data,
1084 },
1085};
1086
Santosh Mardi695be0d2012-04-10 23:21:12 +05301087/* enable the level shifter for cs8427 to make sure the I2C
1088 * clock is running at 100KHz and voltage levels are at 3.3
1089 * and 5 volts
1090 */
1091static int enable_100KHz_ls(int enable)
1092{
1093 int ret = 0;
1094 if (enable) {
1095 ret = gpio_request(SX150X_GPIO(1, 10),
1096 "cs8427_100KHZ_ENABLE");
1097 if (ret) {
1098 pr_err("%s: Failed to request gpio %d\n", __func__,
1099 SX150X_GPIO(1, 10));
1100 return ret;
1101 }
1102 gpio_direction_output(SX150X_GPIO(1, 10), 1);
1103 } else
1104 gpio_free(SX150X_GPIO(1, 10));
1105 return ret;
1106}
1107
Santosh Mardieff9a742012-04-09 23:23:39 +05301108static struct cs8427_platform_data cs8427_i2c_platform_data = {
1109 .irq = SX150X_GPIO(1, 4),
1110 .reset_gpio = SX150X_GPIO(1, 6),
Santosh Mardi695be0d2012-04-10 23:21:12 +05301111 .enable = enable_100KHz_ls,
Santosh Mardieff9a742012-04-09 23:23:39 +05301112};
1113
1114static struct i2c_board_info cs8427_device_info[] __initdata = {
1115 {
1116 I2C_BOARD_INFO("cs8427", CS8427_ADDR4),
1117 .platform_data = &cs8427_i2c_platform_data,
1118 },
1119};
1120
Amy Maloche70090f992012-02-16 16:35:26 -08001121#define HAP_SHIFT_LVL_OE_GPIO PM8921_MPP_PM_TO_SYS(8)
1122#define ISA1200_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1123#define ISA1200_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
1124#define ISA1200_HAP_CLK PM8921_GPIO_PM_TO_SYS(44)
1125
1126static int isa1200_power(int on)
1127{
Amy Maloche8f973892012-03-26 14:53:13 -07001128 int rc = 0;
1129
Amy Maloche70090f992012-02-16 16:35:26 -08001130 gpio_set_value_cansleep(ISA1200_HAP_CLK, !!on);
1131
Amy Maloche8f973892012-03-26 14:53:13 -07001132 if (on)
1133 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_1, true);
1134 else
1135 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_NONE, true);
1136
1137 if (rc) {
1138 pr_err("%s: unable to write aux clock register(%d)\n",
1139 __func__, rc);
1140 }
1141
1142 return rc;
Amy Maloche70090f992012-02-16 16:35:26 -08001143}
1144
1145static int isa1200_dev_setup(bool enable)
1146{
1147 int rc = 0;
1148
Amy Maloche70090f992012-02-16 16:35:26 -08001149 if (!enable)
1150 goto free_gpio;
1151
1152 rc = gpio_request(ISA1200_HAP_CLK, "haptics_clk");
1153 if (rc) {
1154 pr_err("%s: unable to request gpio %d config(%d)\n",
1155 __func__, ISA1200_HAP_CLK, rc);
1156 return rc;
1157 }
1158
1159 rc = gpio_direction_output(ISA1200_HAP_CLK, 0);
1160 if (rc) {
1161 pr_err("%s: unable to set direction\n", __func__);
1162 goto free_gpio;
1163 }
1164
1165 return 0;
1166
1167free_gpio:
1168 gpio_free(ISA1200_HAP_CLK);
1169 return rc;
1170}
1171
1172static struct isa1200_regulator isa1200_reg_data[] = {
1173 {
1174 .name = "vddp",
1175 .min_uV = ISA_I2C_VTG_MIN_UV,
1176 .max_uV = ISA_I2C_VTG_MAX_UV,
1177 .load_uA = ISA_I2C_CURR_UA,
1178 },
1179};
1180
1181static struct isa1200_platform_data isa1200_1_pdata = {
1182 .name = "vibrator",
1183 .dev_setup = isa1200_dev_setup,
1184 .power_on = isa1200_power,
1185 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
1186 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
1187 .max_timeout = 15000,
1188 .mode_ctrl = PWM_GEN_MODE,
1189 .pwm_fd = {
1190 .pwm_div = 256,
1191 },
1192 .is_erm = false,
1193 .smart_en = true,
1194 .ext_clk_en = true,
1195 .chip_en = 1,
1196 .regulator_info = isa1200_reg_data,
1197 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1198};
1199
1200static struct i2c_board_info isa1200_board_info[] __initdata = {
1201 {
1202 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1203 .platform_data = &isa1200_1_pdata,
1204 },
1205};
Jing Lin21ed4de2012-02-05 15:53:28 -08001206/* configuration data for mxt1386e using V2.1 firmware */
1207static const u8 mxt1386e_config_data_v2_1[] = {
1208 /* T6 Object */
1209 0, 0, 0, 0, 0, 0,
1210 /* T38 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001211 14, 1, 0, 22, 2, 12, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001212 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1213 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1214 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1215 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1216 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1217 0, 0, 0, 0,
1218 /* T7 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001219 100, 10, 50,
Jing Lin21ed4de2012-02-05 15:53:28 -08001220 /* T8 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001221 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001222 /* T9 Object */
1223 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
1224 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
Jing Linf1208fd2012-02-23 11:15:42 -08001225 85, 5, 0, 5, 9, 5, 12, 35, 70, 40,
1226 20, 5, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001227 /* T18 Object */
1228 0, 0,
1229 /* T24 Object */
1230 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1231 0, 0, 0, 0, 0, 0, 0, 0, 0,
1232 /* T25 Object */
1233 3, 0, 60, 115, 156, 99,
1234 /* T27 Object */
1235 0, 0, 0, 0, 0, 0, 0,
1236 /* T40 Object */
1237 0, 0, 0, 0, 0,
1238 /* T42 Object */
1239 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
1240 /* T43 Object */
1241 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
1242 16,
1243 /* T46 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001244 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001245 /* T47 Object */
1246 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
1247 /* T48 Object */
1248 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001249 32, 40, 0, 10, 10, 0, 0, 100, 10, 90,
1250 0, 0, 0, 0, 0, 0, 0, 10, 1, 10,
1251 52, 10, 12, 0, 33, 0, 1, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001252 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1253 0, 0, 0, 0,
1254 /* T56 Object */
1255 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1256 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1257 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1258 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001259 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1260 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001261};
1262
Terence Hampson2e1705f2012-04-11 19:55:29 -04001263#ifndef CONFIG_MSM_VCAP
Jing Lin21ed4de2012-02-05 15:53:28 -08001264#define MXT_TS_GPIO_IRQ 6
1265#define MXT_TS_PWR_EN_GPIO PM8921_GPIO_PM_TO_SYS(23)
1266#define MXT_TS_RESET_GPIO 33
1267
1268static struct mxt_config_info mxt_config_array[] = {
1269 {
1270 .config = mxt1386e_config_data_v2_1,
1271 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1272 .family_id = 0xA0,
1273 .variant_id = 0x7,
1274 .version = 0x21,
1275 .build = 0xAA,
Jing Linef4aa9b2012-03-26 12:01:41 -07001276 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
1277 .fw_name = "atmel_8064_liquid_v2_2_AA.hex",
1278 },
1279 {
1280 /* The config data for V2.2.AA is the same as for V2.1.AA */
1281 .config = mxt1386e_config_data_v2_1,
1282 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1283 .family_id = 0xA0,
1284 .variant_id = 0x7,
1285 .version = 0x22,
1286 .build = 0xAA,
1287 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin21ed4de2012-02-05 15:53:28 -08001288 },
1289};
1290
1291static struct mxt_platform_data mxt_platform_data = {
1292 .config_array = mxt_config_array,
1293 .config_array_size = ARRAY_SIZE(mxt_config_array),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08001294 .panel_minx = 0,
1295 .panel_maxx = 1365,
1296 .panel_miny = 0,
1297 .panel_maxy = 767,
1298 .disp_minx = 0,
1299 .disp_maxx = 1365,
1300 .disp_miny = 0,
1301 .disp_maxy = 767,
Anirudh Ghayal39dbe3f2012-04-13 15:43:16 +05301302 .irqflags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
Jing Lin21ed4de2012-02-05 15:53:28 -08001303 .i2c_pull_up = true,
1304 .reset_gpio = MXT_TS_RESET_GPIO,
1305 .irq_gpio = MXT_TS_GPIO_IRQ,
1306};
1307
1308static struct i2c_board_info mxt_device_info[] __initdata = {
1309 {
1310 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
1311 .platform_data = &mxt_platform_data,
1312 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1313 },
1314};
Terence Hampson2e1705f2012-04-11 19:55:29 -04001315#endif
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001316#define CYTTSP_TS_GPIO_IRQ 6
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001317#define CYTTSP_TS_GPIO_SLEEP 33
1318
1319static ssize_t tma340_vkeys_show(struct kobject *kobj,
1320 struct kobj_attribute *attr, char *buf)
1321{
1322 return snprintf(buf, 200,
1323 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1324 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1325 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1326 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1327 "\n");
1328}
1329
1330static struct kobj_attribute tma340_vkeys_attr = {
1331 .attr = {
1332 .mode = S_IRUGO,
1333 },
1334 .show = &tma340_vkeys_show,
1335};
1336
1337static struct attribute *tma340_properties_attrs[] = {
1338 &tma340_vkeys_attr.attr,
1339 NULL
1340};
1341
1342static struct attribute_group tma340_properties_attr_group = {
1343 .attrs = tma340_properties_attrs,
1344};
1345
1346static int cyttsp_platform_init(struct i2c_client *client)
1347{
1348 int rc = 0;
1349 static struct kobject *tma340_properties_kobj;
1350
1351 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1352 tma340_properties_kobj = kobject_create_and_add("board_properties",
1353 NULL);
1354 if (tma340_properties_kobj)
1355 rc = sysfs_create_group(tma340_properties_kobj,
1356 &tma340_properties_attr_group);
1357 if (!tma340_properties_kobj || rc)
1358 pr_err("%s: failed to create board_properties\n",
1359 __func__);
1360
1361 return 0;
1362}
1363
1364static struct cyttsp_regulator cyttsp_regulator_data[] = {
1365 {
1366 .name = "vdd",
1367 .min_uV = CY_TMA300_VTG_MIN_UV,
1368 .max_uV = CY_TMA300_VTG_MAX_UV,
1369 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1370 .lpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1371 },
1372 {
1373 .name = "vcc_i2c",
1374 .min_uV = CY_I2C_VTG_MIN_UV,
1375 .max_uV = CY_I2C_VTG_MAX_UV,
1376 .hpm_load_uA = CY_I2C_CURR_UA,
1377 .lpm_load_uA = CY_I2C_CURR_UA,
1378 },
1379};
1380
1381static struct cyttsp_platform_data cyttsp_pdata = {
1382 .panel_maxx = 634,
1383 .panel_maxy = 1166,
1384 .disp_maxx = 599,
1385 .disp_maxy = 1023,
1386 .disp_minx = 0,
1387 .disp_miny = 0,
1388 .flags = 0x01,
1389 .gen = CY_GEN3,
1390 .use_st = CY_USE_ST,
1391 .use_mt = CY_USE_MT,
1392 .use_hndshk = CY_SEND_HNDSHK,
1393 .use_trk_id = CY_USE_TRACKING_ID,
1394 .use_sleep = CY_USE_DEEP_SLEEP_SEL,
1395 .use_gestures = CY_USE_GESTURES,
1396 .fw_fname = "cyttsp_8064_mtp.hex",
1397 /* change act_intrvl to customize the Active power state
1398 * scanning/processing refresh interval for Operating mode
1399 */
1400 .act_intrvl = CY_ACT_INTRVL_DFLT,
1401 /* change tch_tmout to customize the touch timeout for the
1402 * Active power state for Operating mode
1403 */
1404 .tch_tmout = CY_TCH_TMOUT_DFLT,
1405 /* change lp_intrvl to customize the Low Power power state
1406 * scanning/processing refresh interval for Operating mode
1407 */
1408 .lp_intrvl = CY_LP_INTRVL_DFLT,
1409 .sleep_gpio = CYTTSP_TS_GPIO_SLEEP,
Amy Maloche9ba3ffe2012-04-26 10:31:20 -07001410 .resout_gpio = -1,
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001411 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1412 .regulator_info = cyttsp_regulator_data,
1413 .num_regulators = ARRAY_SIZE(cyttsp_regulator_data),
1414 .init = cyttsp_platform_init,
1415 .correct_fw_ver = 17,
1416};
1417
1418static struct i2c_board_info cyttsp_info[] __initdata = {
1419 {
1420 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1421 .platform_data = &cyttsp_pdata,
1422 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1423 },
1424};
Jing Lin21ed4de2012-02-05 15:53:28 -08001425
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001426#define MSM_WCNSS_PHYS 0x03000000
1427#define MSM_WCNSS_SIZE 0x280000
1428
1429static struct resource resources_wcnss_wlan[] = {
1430 {
1431 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1432 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1433 .name = "wcnss_wlanrx_irq",
1434 .flags = IORESOURCE_IRQ,
1435 },
1436 {
1437 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1438 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1439 .name = "wcnss_wlantx_irq",
1440 .flags = IORESOURCE_IRQ,
1441 },
1442 {
1443 .start = MSM_WCNSS_PHYS,
1444 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1445 .name = "wcnss_mmio",
1446 .flags = IORESOURCE_MEM,
1447 },
1448 {
1449 .start = 64,
1450 .end = 68,
1451 .name = "wcnss_gpios_5wire",
1452 .flags = IORESOURCE_IO,
1453 },
1454};
1455
1456static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1457 .has_48mhz_xo = 1,
1458};
1459
1460static struct platform_device msm_device_wcnss_wlan = {
1461 .name = "wcnss_wlan",
1462 .id = 0,
1463 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1464 .resource = resources_wcnss_wlan,
1465 .dev = {.platform_data = &qcom_wcnss_pdata},
1466};
1467
Ankit Vermab7c26e62012-02-28 15:04:15 -08001468static struct platform_device msm_device_iris_fm __devinitdata = {
1469 .name = "iris_fm",
1470 .id = -1,
1471};
1472
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001473#ifdef CONFIG_QSEECOM
1474/* qseecom bus scaling */
1475static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
1476 {
1477 .src = MSM_BUS_MASTER_SPS,
1478 .dst = MSM_BUS_SLAVE_EBI_CH0,
1479 .ib = 0,
1480 .ab = 0,
1481 },
1482 {
1483 .src = MSM_BUS_MASTER_SPDM,
1484 .dst = MSM_BUS_SLAVE_SPDM,
1485 .ib = 0,
1486 .ab = 0,
1487 },
1488};
1489
1490static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
1491 {
1492 .src = MSM_BUS_MASTER_SPS,
1493 .dst = MSM_BUS_SLAVE_EBI_CH0,
1494 .ib = (492 * 8) * 1000000UL,
1495 .ab = (492 * 8) * 100000UL,
1496 },
1497 {
1498 .src = MSM_BUS_MASTER_SPDM,
1499 .dst = MSM_BUS_SLAVE_SPDM,
1500 .ib = 0,
1501 .ab = 0,
1502 },
1503};
1504
1505static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1506 {
1507 .src = MSM_BUS_MASTER_SPS,
1508 .dst = MSM_BUS_SLAVE_EBI_CH0,
1509 .ib = 0,
1510 .ab = 0,
1511 },
1512 {
1513 .src = MSM_BUS_MASTER_SPDM,
1514 .dst = MSM_BUS_SLAVE_SPDM,
1515 .ib = (64 * 8) * 1000000UL,
1516 .ab = (64 * 8) * 100000UL,
1517 },
1518};
1519
1520static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1521 {
1522 ARRAY_SIZE(qseecom_clks_init_vectors),
1523 qseecom_clks_init_vectors,
1524 },
1525 {
1526 ARRAY_SIZE(qseecom_enable_dfab_vectors),
1527 qseecom_enable_sfpb_vectors,
1528 },
1529 {
1530 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1531 qseecom_enable_sfpb_vectors,
1532 },
1533};
1534
1535static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1536 qseecom_hw_bus_scale_usecases,
1537 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1538 .name = "qsee",
1539};
1540
1541static struct platform_device qseecom_device = {
1542 .name = "qseecom",
1543 .id = 0,
1544 .dev = {
1545 .platform_data = &qseecom_bus_pdata,
1546 },
1547};
1548#endif
1549
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001550#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1551 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1552 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1553 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1554
1555#define QCE_SIZE 0x10000
1556#define QCE_0_BASE 0x11000000
1557
1558#define QCE_HW_KEY_SUPPORT 0
1559#define QCE_SHA_HMAC_SUPPORT 1
1560#define QCE_SHARE_CE_RESOURCE 3
1561#define QCE_CE_SHARED 0
1562
1563static struct resource qcrypto_resources[] = {
1564 [0] = {
1565 .start = QCE_0_BASE,
1566 .end = QCE_0_BASE + QCE_SIZE - 1,
1567 .flags = IORESOURCE_MEM,
1568 },
1569 [1] = {
1570 .name = "crypto_channels",
1571 .start = DMOV8064_CE_IN_CHAN,
1572 .end = DMOV8064_CE_OUT_CHAN,
1573 .flags = IORESOURCE_DMA,
1574 },
1575 [2] = {
1576 .name = "crypto_crci_in",
1577 .start = DMOV8064_CE_IN_CRCI,
1578 .end = DMOV8064_CE_IN_CRCI,
1579 .flags = IORESOURCE_DMA,
1580 },
1581 [3] = {
1582 .name = "crypto_crci_out",
1583 .start = DMOV8064_CE_OUT_CRCI,
1584 .end = DMOV8064_CE_OUT_CRCI,
1585 .flags = IORESOURCE_DMA,
1586 },
1587};
1588
1589static struct resource qcedev_resources[] = {
1590 [0] = {
1591 .start = QCE_0_BASE,
1592 .end = QCE_0_BASE + QCE_SIZE - 1,
1593 .flags = IORESOURCE_MEM,
1594 },
1595 [1] = {
1596 .name = "crypto_channels",
1597 .start = DMOV8064_CE_IN_CHAN,
1598 .end = DMOV8064_CE_OUT_CHAN,
1599 .flags = IORESOURCE_DMA,
1600 },
1601 [2] = {
1602 .name = "crypto_crci_in",
1603 .start = DMOV8064_CE_IN_CRCI,
1604 .end = DMOV8064_CE_IN_CRCI,
1605 .flags = IORESOURCE_DMA,
1606 },
1607 [3] = {
1608 .name = "crypto_crci_out",
1609 .start = DMOV8064_CE_OUT_CRCI,
1610 .end = DMOV8064_CE_OUT_CRCI,
1611 .flags = IORESOURCE_DMA,
1612 },
1613};
1614
1615#endif
1616
1617#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1618 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1619
1620static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1621 .ce_shared = QCE_CE_SHARED,
1622 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1623 .hw_key_support = QCE_HW_KEY_SUPPORT,
1624 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001625 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001626};
1627
1628static struct platform_device qcrypto_device = {
1629 .name = "qcrypto",
1630 .id = 0,
1631 .num_resources = ARRAY_SIZE(qcrypto_resources),
1632 .resource = qcrypto_resources,
1633 .dev = {
1634 .coherent_dma_mask = DMA_BIT_MASK(32),
1635 .platform_data = &qcrypto_ce_hw_suppport,
1636 },
1637};
1638#endif
1639
1640#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1641 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1642
1643static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1644 .ce_shared = QCE_CE_SHARED,
1645 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1646 .hw_key_support = QCE_HW_KEY_SUPPORT,
1647 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001648 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001649};
1650
1651static struct platform_device qcedev_device = {
1652 .name = "qce",
1653 .id = 0,
1654 .num_resources = ARRAY_SIZE(qcedev_resources),
1655 .resource = qcedev_resources,
1656 .dev = {
1657 .coherent_dma_mask = DMA_BIT_MASK(32),
1658 .platform_data = &qcedev_ce_hw_suppport,
1659 },
1660};
1661#endif
1662
Joel Kingdacbc822012-01-25 13:30:57 -08001663static struct mdm_platform_data mdm_platform_data = {
1664 .mdm_version = "3.0",
1665 .ramdump_delay_ms = 2000,
Hemant Kumara945b472012-01-25 15:08:06 -08001666 .peripheral_platform_device = &apq8064_device_hsic_host,
Joel Kingdacbc822012-01-25 13:30:57 -08001667};
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001668
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001669static struct tsens_platform_data apq_tsens_pdata = {
1670 .tsens_factor = 1000,
1671 .hw_type = APQ_8064,
1672 .tsens_num_sensor = 11,
1673 .slope = {1176, 1176, 1154, 1176, 1111,
1674 1132, 1132, 1199, 1132, 1199, 1132},
1675};
1676
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07001677static struct platform_device msm_tsens_device = {
1678 .name = "tsens8960-tm",
1679 .id = -1,
1680};
1681
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001682#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001683static void __init apq8064_map_io(void)
1684{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001685 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001686 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001687 if (socinfo_init() < 0)
1688 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001689}
1690
1691static void __init apq8064_init_irq(void)
1692{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001693 struct msm_mpm_device_data *data = NULL;
1694
1695#ifdef CONFIG_MSM_MPM
1696 data = &apq8064_mpm_dev_data;
1697#endif
1698
1699 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001700 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1701 (void *)MSM_QGIC_CPU_BASE);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001702}
1703
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001704static struct platform_device msm8064_device_saw_regulator_core0 = {
1705 .name = "saw-regulator",
1706 .id = 0,
1707 .dev = {
1708 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
1709 },
1710};
1711
1712static struct platform_device msm8064_device_saw_regulator_core1 = {
1713 .name = "saw-regulator",
1714 .id = 1,
1715 .dev = {
1716 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
1717 },
1718};
1719
1720static struct platform_device msm8064_device_saw_regulator_core2 = {
1721 .name = "saw-regulator",
1722 .id = 2,
1723 .dev = {
1724 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
1725 },
1726};
1727
1728static struct platform_device msm8064_device_saw_regulator_core3 = {
1729 .name = "saw-regulator",
1730 .id = 3,
1731 .dev = {
1732 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001733
1734 },
1735};
1736
Oluwafemi Adeyemif5a31422012-03-08 16:58:45 -08001737static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001738 {
1739 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1740 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1741 true,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001742 100, 650, 801, 200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001743 },
1744
1745 {
1746 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1747 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1748 true,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001749 2000, 200, 576000, 2000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001750 },
1751
1752 {
1753 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1754 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1755 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001756 8500, 51, 1122000, 8500,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001757 },
1758
1759 {
1760 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1761 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
1762 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001763 9000, 51, 1130300, 9000,
1764 },
1765 {
1766 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1767 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
1768 false,
1769 10000, 51, 1130300, 10000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001770 },
1771
1772 {
1773 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1774 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1775 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001776 12000, 14, 2205900, 12000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001777 },
1778
1779 {
1780 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1781 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1782 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001783 18000, 12, 2364250, 18000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001784 },
1785
1786 {
1787 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1788 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1789 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001790 23500, 10, 2667000, 23500,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001791 },
1792
1793 {
1794 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1795 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1796 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001797 29700, 5, 2867000, 30000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001798 },
1799};
1800
1801static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1802 .mode = MSM_PM_BOOT_CONFIG_TZ,
1803};
1804
1805static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
1806 .levels = &msm_rpmrs_levels[0],
1807 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
1808 .vdd_mem_levels = {
1809 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
1810 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
1811 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
1812 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
1813 },
1814 .vdd_dig_levels = {
1815 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
1816 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
1817 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
1818 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
1819 },
1820 .vdd_mask = 0x7FFFFF,
1821 .rpmrs_target_id = {
1822 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
1823 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
1824 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
1825 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
1826 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
1827 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
1828 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
1829 },
1830};
1831
Praveen Chidambaram78499012011-11-01 17:15:17 -06001832static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1833 0x03, 0x0f,
1834};
1835
1836static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1837 0x00, 0x24, 0x54, 0x10,
1838 0x09, 0x03, 0x01,
1839 0x10, 0x54, 0x30, 0x0C,
1840 0x24, 0x30, 0x0f,
1841};
1842
1843static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1844 0x00, 0x24, 0x54, 0x10,
1845 0x09, 0x07, 0x01, 0x0B,
1846 0x10, 0x54, 0x30, 0x0C,
1847 0x24, 0x30, 0x0f,
1848};
1849
1850static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1851 [0] = {
1852 .mode = MSM_SPM_MODE_CLOCK_GATING,
1853 .notify_rpm = false,
1854 .cmd = spm_wfi_cmd_sequence,
1855 },
1856 [1] = {
1857 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1858 .notify_rpm = false,
1859 .cmd = spm_power_collapse_without_rpm,
1860 },
1861 [2] = {
1862 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1863 .notify_rpm = true,
1864 .cmd = spm_power_collapse_with_rpm,
1865 },
1866};
1867
1868static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1869 0x00, 0x20, 0x03, 0x20,
1870 0x00, 0x0f,
1871};
1872
1873static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1874 0x00, 0x20, 0x34, 0x64,
1875 0x48, 0x07, 0x48, 0x20,
1876 0x50, 0x64, 0x04, 0x34,
1877 0x50, 0x0f,
1878};
1879static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1880 0x00, 0x10, 0x34, 0x64,
1881 0x48, 0x07, 0x48, 0x10,
1882 0x50, 0x64, 0x04, 0x34,
1883 0x50, 0x0F,
1884};
1885
1886static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1887 [0] = {
1888 .mode = MSM_SPM_L2_MODE_RETENTION,
1889 .notify_rpm = false,
1890 .cmd = l2_spm_wfi_cmd_sequence,
1891 },
1892 [1] = {
1893 .mode = MSM_SPM_L2_MODE_GDHS,
1894 .notify_rpm = true,
1895 .cmd = l2_spm_gdhs_cmd_sequence,
1896 },
1897 [2] = {
1898 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1899 .notify_rpm = true,
1900 .cmd = l2_spm_power_off_cmd_sequence,
1901 },
1902};
1903
1904
1905static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1906 [0] = {
1907 .reg_base_addr = MSM_SAW_L2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001908 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001909 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001910 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1911 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1912 .modes = msm_spm_l2_seq_list,
1913 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1914 },
1915};
1916
1917static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1918 [0] = {
1919 .reg_base_addr = MSM_SAW0_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001920 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001921#if defined(CONFIG_MSM_AVS_HW)
1922 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1923 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1924#endif
1925 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001926 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001927 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1928 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1929 .vctl_timeout_us = 50,
1930 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1931 .modes = msm_spm_seq_list,
1932 },
1933 [1] = {
1934 .reg_base_addr = MSM_SAW1_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001935 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001936#if defined(CONFIG_MSM_AVS_HW)
1937 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1938 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1939#endif
1940 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001941 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001942 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1943 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1944 .vctl_timeout_us = 50,
1945 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1946 .modes = msm_spm_seq_list,
1947 },
1948 [2] = {
1949 .reg_base_addr = MSM_SAW2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001950 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001951#if defined(CONFIG_MSM_AVS_HW)
1952 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1953 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1954#endif
1955 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001956 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001957 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1958 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1959 .vctl_timeout_us = 50,
1960 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1961 .modes = msm_spm_seq_list,
1962 },
1963 [3] = {
1964 .reg_base_addr = MSM_SAW3_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001965 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001966#if defined(CONFIG_MSM_AVS_HW)
1967 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1968 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1969#endif
1970 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001971 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001972 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1973 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1974 .vctl_timeout_us = 50,
1975 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1976 .modes = msm_spm_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001977 },
1978};
1979
Praveen Chidambaram4d19be42012-04-03 18:05:52 -06001980static struct msm_pm_sleep_status_data msm_pm_slp_sts_data = {
1981 .base_addr = MSM_ACC0_BASE + 0x08,
1982 .cpu_offset = MSM_ACC1_BASE - MSM_ACC0_BASE,
1983 .mask = 1UL << 13,
1984};
1985
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001986static void __init apq8064_init_buses(void)
1987{
1988 msm_bus_rpm_set_mt_mask();
1989 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
1990 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
1991 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
1992 msm_bus_8064_apps_fabric.dev.platform_data =
1993 &msm_bus_8064_apps_fabric_pdata;
1994 msm_bus_8064_sys_fabric.dev.platform_data =
1995 &msm_bus_8064_sys_fabric_pdata;
1996 msm_bus_8064_mm_fabric.dev.platform_data =
1997 &msm_bus_8064_mm_fabric_pdata;
1998 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
1999 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
2000}
2001
David Collinsf0d00732012-01-25 15:46:50 -08002002static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
2003 .name = GPIO_REGULATOR_DEV_NAME,
2004 .id = PM8921_MPP_PM_TO_SYS(7),
2005 .dev = {
2006 .platform_data
2007 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2008 },
2009};
2010
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08002011static struct platform_device apq8064_device_ext_mpp8_vreg __devinitdata = {
2012 .name = GPIO_REGULATOR_DEV_NAME,
2013 .id = PM8921_MPP_PM_TO_SYS(8),
2014 .dev = {
2015 .platform_data
2016 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_MPP8],
2017 },
2018};
2019
David Collinsf0d00732012-01-25 15:46:50 -08002020static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
2021 .name = GPIO_REGULATOR_DEV_NAME,
2022 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
2023 .dev = {
2024 .platform_data =
2025 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2026 },
2027};
2028
David Collins390fc332012-02-07 14:38:16 -08002029static struct platform_device apq8064_device_ext_ts_sw_vreg __devinitdata = {
2030 .name = GPIO_REGULATOR_DEV_NAME,
2031 .id = PM8921_GPIO_PM_TO_SYS(23),
2032 .dev = {
2033 .platform_data
2034 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_TS_SW],
2035 },
2036};
2037
David Collins2782b5c2012-02-06 10:02:42 -08002038static struct platform_device apq8064_device_rpm_regulator __devinitdata = {
2039 .name = "rpm-regulator",
2040 .id = -1,
2041 .dev = {
2042 .platform_data = &apq8064_rpm_regulator_pdata,
2043 },
2044};
2045
Ravi Kumar V05931a22012-04-04 17:09:37 +05302046static struct gpio_ir_recv_platform_data gpio_ir_recv_pdata = {
2047 .gpio_nr = 88,
2048 .active_low = 1,
2049};
2050
2051static struct platform_device gpio_ir_recv_pdev = {
2052 .name = "gpio-rc-recv",
2053 .dev = {
2054 .platform_data = &gpio_ir_recv_pdata,
2055 },
2056};
2057
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002058static struct platform_device *common_devices[] __initdata = {
Jin Hong01f2dbb2011-11-03 22:13:51 -07002059 &apq8064_device_dmov,
Terence Hampson2e1705f2012-04-11 19:55:29 -04002060#ifndef CONFIG_MSM_VCAP
David Keitel3c40fc52012-02-09 17:53:52 -08002061 &apq8064_device_qup_i2c_gsbi1,
Jing Lin04601f92012-02-05 15:36:07 -08002062 &apq8064_device_qup_i2c_gsbi3,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002063 &apq8064_device_qup_i2c_gsbi4,
Terence Hampson2e1705f2012-04-11 19:55:29 -04002064#endif
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002065 &apq8064_device_qup_spi_gsbi5,
David Collinsf0d00732012-01-25 15:46:50 -08002066 &apq8064_device_ext_5v_vreg,
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08002067 &apq8064_device_ext_mpp8_vreg,
David Collinsf0d00732012-01-25 15:46:50 -08002068 &apq8064_device_ext_3p3v_vreg,
David Collins390fc332012-02-07 14:38:16 -08002069 &apq8064_device_ext_ts_sw_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07002070 &apq8064_device_ssbi_pmic1,
2071 &apq8064_device_ssbi_pmic2,
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06002072 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07002073 &apq8064_device_otg,
2074 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08002075 &apq8064_device_hsusb_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07002076 &android_usb_device,
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08002077 &msm_device_wcnss_wlan,
Ankit Vermab7c26e62012-02-28 15:04:15 -08002078 &msm_device_iris_fm,
Larry Bassel67b921d2012-04-06 10:23:27 -07002079 &apq8064_fmem_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08002080#ifdef CONFIG_ANDROID_PMEM
2081#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002082 &apq8064_android_pmem_device,
2083 &apq8064_android_pmem_adsp_device,
2084 &apq8064_android_pmem_audio_device,
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -07002085#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
2086#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -08002087#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002088 &apq8064_ion_dev,
Olav Haugan7c6aa742012-01-16 16:47:37 -08002089#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002090 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08002091 &msm8064_device_saw_regulator_core0,
2092 &msm8064_device_saw_regulator_core1,
2093 &msm8064_device_saw_regulator_core2,
2094 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002095#if defined(CONFIG_QSEECOM)
2096 &qseecom_device,
2097#endif
2098
Ramesh Masavarapu28311912011-10-27 11:04:12 -07002099#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2100 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2101 &qcrypto_device,
2102#endif
2103
2104#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2105 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2106 &qcedev_device,
2107#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07002108
2109#ifdef CONFIG_HW_RANDOM_MSM
2110 &apq8064_device_rng,
2111#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002112 &apq_pcm,
2113 &apq_pcm_routing,
2114 &apq_cpudai0,
2115 &apq_cpudai1,
Santosh Mardieff9a742012-04-09 23:23:39 +05302116 &mpq_cpudai_sec_i2s_rx,
Kuirong Wangf23f8c52012-03-31 12:34:51 -07002117 &mpq_cpudai_mi2s_tx,
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002118 &apq_cpudai_hdmi_rx,
2119 &apq_cpudai_bt_rx,
2120 &apq_cpudai_bt_tx,
2121 &apq_cpudai_fm_rx,
2122 &apq_cpudai_fm_tx,
2123 &apq_cpu_fe,
2124 &apq_stub_codec,
2125 &apq_voice,
2126 &apq_voip,
2127 &apq_lpa_pcm,
Krishnankutty Kolathappilly4374e332012-03-18 22:27:30 -07002128 &apq_compr_dsp,
2129 &apq_multi_ch_pcm,
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002130 &apq_pcm_hostless,
2131 &apq_cpudai_afe_01_rx,
2132 &apq_cpudai_afe_01_tx,
2133 &apq_cpudai_afe_02_rx,
2134 &apq_cpudai_afe_02_tx,
2135 &apq_pcm_afe,
2136 &apq_cpudai_auxpcm_rx,
2137 &apq_cpudai_auxpcm_tx,
Neema Shetty8427c262012-02-16 11:23:43 -08002138 &apq_cpudai_stub,
Neema Shetty3c9d2862012-03-11 01:25:32 -08002139 &apq_cpudai_slimbus_1_rx,
2140 &apq_cpudai_slimbus_1_tx,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002141 &apq_cpudai_slimbus_2_tx,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002142 &apq8064_rpm_device,
2143 &apq8064_rpm_log_device,
2144 &apq8064_rpm_stat_device,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002145 &msm_bus_8064_apps_fabric,
2146 &msm_bus_8064_sys_fabric,
2147 &msm_bus_8064_mm_fabric,
2148 &msm_bus_8064_sys_fpb,
2149 &msm_bus_8064_cpss_fpb,
Mohan Kumar Gubbihalli Lachma Naik7f72edd2012-02-06 17:26:47 -08002150 &apq8064_msm_device_vidc,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07002151 &msm_pil_dsps,
Matt Wagantalled832652012-02-02 19:23:17 -08002152 &msm_8960_riva,
Matt Wagantallb94b9a52012-02-02 21:59:54 -08002153 &msm_8960_q6_lpass,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002154 &msm_pil_vidc,
Matt Wagantall292aace2012-01-26 19:12:34 -08002155 &msm_gss,
Laura Abbottb93525f2012-04-12 09:57:19 -07002156 &apq8064_rtb_device,
Praveen Chidambaram8ea3dcd2011-12-07 14:46:31 -07002157 &apq8064_cpu_idle_device,
Praveen Chidambaram5c8adf22012-02-23 18:44:37 -07002158 &apq8064_msm_gov_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002159 &apq8064_device_cache_erp,
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002160 &epm_adc_device,
Pratik Patel212ab362012-03-16 12:30:07 -07002161 &apq8064_qdss_device,
2162 &msm_etb_device,
2163 &msm_tpiu_device,
2164 &msm_funnel_device,
2165 &apq8064_etm_device,
Helen Zeng8f925502012-03-05 16:50:17 -08002166 &apq_cpudai_slim_4_rx,
2167 &apq_cpudai_slim_4_tx,
Jignesh Mehta921649d2012-04-19 06:57:23 -07002168 &msm8960_gemini_device,
Laura Abbott0577d7b2012-04-17 11:14:30 -07002169 &apq8064_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002170 &msm_tsens_device,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002171};
2172
Joel King4e7ad222011-08-17 15:47:38 -07002173static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002174 &apq8064_device_uart_gsbi3,
Yan He06913ce2011-08-26 16:33:46 -07002175 &msm_device_sps_apq8064,
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002176};
2177
2178static struct platform_device *rumi3_devices[] __initdata = {
2179 &apq8064_device_uart_gsbi1,
Yan He435ed612011-11-23 17:34:59 -08002180 &msm_device_sps_apq8064,
Huaibin Yang4a084e32011-12-15 15:25:52 -08002181#ifdef CONFIG_MSM_ROTATOR
2182 &msm_rotator_device,
2183#endif
Joel King4e7ad222011-08-17 15:47:38 -07002184};
2185
Joel King82b7e3f2012-01-05 10:03:27 -08002186static struct platform_device *cdp_devices[] __initdata = {
2187 &apq8064_device_uart_gsbi1,
Jin Hong4bbbfba2012-02-02 21:48:07 -08002188 &apq8064_device_uart_gsbi7,
Joel King82b7e3f2012-01-05 10:03:27 -08002189 &msm_device_sps_apq8064,
Aravind Venkateswaran4ca27532012-02-16 14:27:05 -08002190#ifdef CONFIG_MSM_ROTATOR
2191 &msm_rotator_device,
2192#endif
Joel King82b7e3f2012-01-05 10:03:27 -08002193};
2194
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002195static struct platform_device
2196mpq8064_device_ext_5v_frc_vreg __devinitdata = {
2197 .name = GPIO_REGULATOR_DEV_NAME,
2198 .id = SX150X_GPIO(4, 10),
2199 .dev = {
2200 .platform_data =
2201 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_FRC_5V],
2202 },
2203};
2204
2205static struct platform_device
2206mpq8064_device_ext_1p2_buck_vreg __devinitdata = {
2207 .name = GPIO_REGULATOR_DEV_NAME,
2208 .id = SX150X_GPIO(4, 2),
2209 .dev = {
2210 .platform_data =
2211 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P2V],
2212 },
2213};
2214
2215static struct platform_device
2216mpq8064_device_ext_1p8_buck_vreg __devinitdata = {
2217 .name = GPIO_REGULATOR_DEV_NAME,
2218 .id = SX150X_GPIO(4, 4),
2219 .dev = {
2220 .platform_data =
2221 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P8V],
2222 },
2223};
2224
2225static struct platform_device
2226mpq8064_device_ext_2p2_buck_vreg __devinitdata = {
2227 .name = GPIO_REGULATOR_DEV_NAME,
2228 .id = SX150X_GPIO(4, 14),
2229 .dev = {
2230 .platform_data =
2231 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_2P2V],
2232 },
2233};
2234
2235static struct platform_device
2236mpq8064_device_ext_5v_buck_vreg __devinitdata = {
2237 .name = GPIO_REGULATOR_DEV_NAME,
2238 .id = SX150X_GPIO(4, 3),
2239 .dev = {
2240 .platform_data =
2241 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_5V],
2242 },
2243};
2244
2245static struct platform_device
2246mpq8064_device_ext_3p3v_ldo_vreg __devinitdata = {
2247 .name = GPIO_REGULATOR_DEV_NAME,
2248 .id = SX150X_GPIO(4, 15),
2249 .dev = {
2250 .platform_data =
2251 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_3P3V],
2252 },
2253};
2254
2255static struct platform_device *mpq_devices[] __initdata = {
2256 &msm_device_sps_apq8064,
2257 &mpq8064_device_qup_i2c_gsbi5,
2258#ifdef CONFIG_MSM_ROTATOR
2259 &msm_rotator_device,
2260#endif
Ravi Kumar V05931a22012-04-04 17:09:37 +05302261 &gpio_ir_recv_pdev,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002262 &mpq8064_device_ext_5v_frc_vreg,
2263 &mpq8064_device_ext_1p2_buck_vreg,
2264 &mpq8064_device_ext_1p8_buck_vreg,
2265 &mpq8064_device_ext_2p2_buck_vreg,
2266 &mpq8064_device_ext_5v_buck_vreg,
2267 &mpq8064_device_ext_3p3v_ldo_vreg,
Terence Hampson2e1705f2012-04-11 19:55:29 -04002268#ifdef CONFIG_MSM_VCAP
2269 &msm8064_device_vcap,
2270#endif
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002271};
2272
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002273static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002274 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002275};
2276
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002277#define KS8851_IRQ_GPIO 43
2278
2279static struct spi_board_info spi_board_info[] __initdata = {
2280 {
2281 .modalias = "ks8851",
2282 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2283 .max_speed_hz = 19200000,
2284 .bus_num = 0,
2285 .chip_select = 2,
2286 .mode = SPI_MODE_0,
2287 },
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002288 {
2289 .modalias = "epm_adc",
2290 .max_speed_hz = 1100000,
2291 .bus_num = 0,
2292 .chip_select = 3,
2293 .mode = SPI_MODE_0,
2294 },
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002295};
2296
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002297static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002298 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08002299 .bus_num = 1,
2300 .slim_slave = &apq8064_slim_tabla,
2301 },
2302 {
2303 .bus_num = 1,
2304 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002305 },
2306 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002307};
2308
David Keitel3c40fc52012-02-09 17:53:52 -08002309static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi1_pdata = {
2310 .clk_freq = 100000,
2311 .src_clk_rate = 24000000,
2312};
2313
Jing Lin04601f92012-02-05 15:36:07 -08002314static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi3_pdata = {
Anirudh Ghayalc2163472012-04-10 14:58:14 +05302315 .clk_freq = 384000,
Jing Lin04601f92012-02-05 15:36:07 -08002316 .src_clk_rate = 24000000,
2317};
2318
Kenneth Heitke748593a2011-07-15 15:45:11 -06002319static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
2320 .clk_freq = 100000,
2321 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002322};
2323
Joel King8f839b92012-04-01 14:37:46 -07002324static struct msm_i2c_platform_data mpq8064_i2c_qup_gsbi5_pdata = {
2325 .clk_freq = 100000,
2326 .src_clk_rate = 24000000,
2327};
2328
David Keitel3c40fc52012-02-09 17:53:52 -08002329#define GSBI_DUAL_MODE_CODE 0x60
2330#define MSM_GSBI1_PHYS 0x12440000
Kenneth Heitke748593a2011-07-15 15:45:11 -06002331static void __init apq8064_i2c_init(void)
2332{
David Keitel3c40fc52012-02-09 17:53:52 -08002333 void __iomem *gsbi_mem;
2334
2335 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2336 &apq8064_i2c_qup_gsbi1_pdata;
2337 gsbi_mem = ioremap_nocache(MSM_GSBI1_PHYS, 4);
2338 writel_relaxed(GSBI_DUAL_MODE_CODE, gsbi_mem);
2339 /* Ensure protocol code is written before proceeding */
2340 wmb();
2341 iounmap(gsbi_mem);
2342 apq8064_i2c_qup_gsbi1_pdata.use_gsbi_shared_mode = 1;
Jing Lin04601f92012-02-05 15:36:07 -08002343 apq8064_device_qup_i2c_gsbi3.dev.platform_data =
2344 &apq8064_i2c_qup_gsbi3_pdata;
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002345 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2346 &apq8064_i2c_qup_gsbi1_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002347 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
2348 &apq8064_i2c_qup_gsbi4_pdata;
Joel King8f839b92012-04-01 14:37:46 -07002349 mpq8064_device_qup_i2c_gsbi5.dev.platform_data =
2350 &mpq8064_i2c_qup_gsbi5_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002351}
2352
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002353#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002354static int ethernet_init(void)
2355{
2356 int ret;
2357 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
2358 if (ret) {
2359 pr_err("ks8851 gpio_request failed: %d\n", ret);
2360 goto fail;
2361 }
2362
2363 return 0;
2364fail:
2365 return ret;
2366}
2367#else
2368static int ethernet_init(void)
2369{
2370 return 0;
2371}
2372#endif
2373
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302374#define GPIO_KEY_HOME PM8921_GPIO_PM_TO_SYS(27)
2375#define GPIO_KEY_VOLUME_UP PM8921_GPIO_PM_TO_SYS(35)
2376#define GPIO_KEY_VOLUME_DOWN PM8921_GPIO_PM_TO_SYS(38)
2377#define GPIO_KEY_CAM_FOCUS PM8921_GPIO_PM_TO_SYS(3)
2378#define GPIO_KEY_CAM_SNAP PM8921_GPIO_PM_TO_SYS(4)
Jing Lin3f8f8422012-03-05 09:32:11 -08002379#define GPIO_KEY_ROTATION PM8921_GPIO_PM_TO_SYS(42)
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302380
2381static struct gpio_keys_button cdp_keys[] = {
2382 {
2383 .code = KEY_HOME,
2384 .gpio = GPIO_KEY_HOME,
2385 .desc = "home_key",
2386 .active_low = 1,
2387 .type = EV_KEY,
2388 .wakeup = 1,
2389 .debounce_interval = 15,
2390 },
2391 {
2392 .code = KEY_VOLUMEUP,
2393 .gpio = GPIO_KEY_VOLUME_UP,
2394 .desc = "volume_up_key",
2395 .active_low = 1,
2396 .type = EV_KEY,
2397 .wakeup = 1,
2398 .debounce_interval = 15,
2399 },
2400 {
2401 .code = KEY_VOLUMEDOWN,
2402 .gpio = GPIO_KEY_VOLUME_DOWN,
2403 .desc = "volume_down_key",
2404 .active_low = 1,
2405 .type = EV_KEY,
2406 .wakeup = 1,
2407 .debounce_interval = 15,
2408 },
2409 {
2410 .code = SW_ROTATE_LOCK,
2411 .gpio = GPIO_KEY_ROTATION,
2412 .desc = "rotate_key",
2413 .active_low = 1,
2414 .type = EV_SW,
2415 .debounce_interval = 15,
2416 },
2417};
2418
2419static struct gpio_keys_platform_data cdp_keys_data = {
2420 .buttons = cdp_keys,
2421 .nbuttons = ARRAY_SIZE(cdp_keys),
2422};
2423
2424static struct platform_device cdp_kp_pdev = {
2425 .name = "gpio-keys",
2426 .id = -1,
2427 .dev = {
2428 .platform_data = &cdp_keys_data,
2429 },
2430};
2431
2432static struct gpio_keys_button mtp_keys[] = {
2433 {
2434 .code = KEY_CAMERA_FOCUS,
2435 .gpio = GPIO_KEY_CAM_FOCUS,
2436 .desc = "cam_focus_key",
2437 .active_low = 1,
2438 .type = EV_KEY,
2439 .wakeup = 1,
2440 .debounce_interval = 15,
2441 },
2442 {
2443 .code = KEY_VOLUMEUP,
2444 .gpio = GPIO_KEY_VOLUME_UP,
2445 .desc = "volume_up_key",
2446 .active_low = 1,
2447 .type = EV_KEY,
2448 .wakeup = 1,
2449 .debounce_interval = 15,
2450 },
2451 {
2452 .code = KEY_VOLUMEDOWN,
2453 .gpio = GPIO_KEY_VOLUME_DOWN,
2454 .desc = "volume_down_key",
2455 .active_low = 1,
2456 .type = EV_KEY,
2457 .wakeup = 1,
2458 .debounce_interval = 15,
2459 },
2460 {
2461 .code = KEY_CAMERA_SNAPSHOT,
2462 .gpio = GPIO_KEY_CAM_SNAP,
2463 .desc = "cam_snap_key",
2464 .active_low = 1,
2465 .type = EV_KEY,
2466 .debounce_interval = 15,
2467 },
2468};
2469
2470static struct gpio_keys_platform_data mtp_keys_data = {
2471 .buttons = mtp_keys,
2472 .nbuttons = ARRAY_SIZE(mtp_keys),
2473};
2474
2475static struct platform_device mtp_kp_pdev = {
2476 .name = "gpio-keys",
2477 .id = -1,
2478 .dev = {
2479 .platform_data = &mtp_keys_data,
2480 },
2481};
2482
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05302483static struct gpio_keys_button mpq_keys[] = {
2484 {
2485 .code = KEY_VOLUMEDOWN,
2486 .gpio = GPIO_KEY_VOLUME_DOWN,
2487 .desc = "volume_down_key",
2488 .active_low = 1,
2489 .type = EV_KEY,
2490 .wakeup = 1,
2491 .debounce_interval = 15,
2492 },
2493 {
2494 .code = KEY_VOLUMEUP,
2495 .gpio = GPIO_KEY_VOLUME_UP,
2496 .desc = "volume_up_key",
2497 .active_low = 1,
2498 .type = EV_KEY,
2499 .wakeup = 1,
2500 .debounce_interval = 15,
2501 },
2502};
2503
2504static struct gpio_keys_platform_data mpq_keys_data = {
2505 .buttons = mpq_keys,
2506 .nbuttons = ARRAY_SIZE(mpq_keys),
2507};
2508
2509static struct platform_device mpq_gpio_keys_pdev = {
2510 .name = "gpio-keys",
2511 .id = -1,
2512 .dev = {
2513 .platform_data = &mpq_keys_data,
2514 },
2515};
2516
2517#define MPQ_KP_ROW_BASE SX150X_EXP2_GPIO_BASE
2518#define MPQ_KP_COL_BASE (SX150X_EXP2_GPIO_BASE + 4)
2519
2520static unsigned int mpq_row_gpios[] = {MPQ_KP_ROW_BASE, MPQ_KP_ROW_BASE + 1,
2521 MPQ_KP_ROW_BASE + 2, MPQ_KP_ROW_BASE + 3};
2522static unsigned int mpq_col_gpios[] = {MPQ_KP_COL_BASE, MPQ_KP_COL_BASE + 1,
2523 MPQ_KP_COL_BASE + 2};
2524
2525static const unsigned int mpq_keymap[] = {
2526 KEY(0, 0, KEY_UP),
2527 KEY(0, 1, KEY_ENTER),
2528 KEY(0, 2, KEY_3),
2529
2530 KEY(1, 0, KEY_DOWN),
2531 KEY(1, 1, KEY_EXIT),
2532 KEY(1, 2, KEY_4),
2533
2534 KEY(2, 0, KEY_LEFT),
2535 KEY(2, 1, KEY_1),
2536 KEY(2, 2, KEY_5),
2537
2538 KEY(3, 0, KEY_RIGHT),
2539 KEY(3, 1, KEY_2),
2540 KEY(3, 2, KEY_6),
2541};
2542
2543static struct matrix_keymap_data mpq_keymap_data = {
2544 .keymap_size = ARRAY_SIZE(mpq_keymap),
2545 .keymap = mpq_keymap,
2546};
2547
2548static struct matrix_keypad_platform_data mpq_keypad_data = {
2549 .keymap_data = &mpq_keymap_data,
2550 .row_gpios = mpq_row_gpios,
2551 .col_gpios = mpq_col_gpios,
2552 .num_row_gpios = ARRAY_SIZE(mpq_row_gpios),
2553 .num_col_gpios = ARRAY_SIZE(mpq_col_gpios),
2554 .col_scan_delay_us = 32000,
2555 .debounce_ms = 20,
2556 .wakeup = 1,
2557 .active_low = 1,
2558 .no_autorepeat = 1,
2559};
2560
2561static struct platform_device mpq_keypad_device = {
2562 .name = "matrix-keypad",
2563 .id = -1,
2564 .dev = {
2565 .platform_data = &mpq_keypad_data,
2566 },
2567};
2568
Jin Hongd3024e62012-02-09 16:13:32 -08002569/* Sensors DSPS platform data */
2570#define DSPS_PIL_GENERIC_NAME "dsps"
2571static void __init apq8064_init_dsps(void)
2572{
2573 struct msm_dsps_platform_data *pdata =
2574 msm_dsps_device_8064.dev.platform_data;
2575 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
2576 pdata->gpios = NULL;
2577 pdata->gpios_num = 0;
2578
2579 platform_device_register(&msm_dsps_device_8064);
2580}
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302581
Jing Lin417fa452012-02-05 14:31:06 -08002582#define I2C_SURF 1
2583#define I2C_FFA (1 << 1)
2584#define I2C_RUMI (1 << 2)
2585#define I2C_SIM (1 << 3)
2586#define I2C_LIQUID (1 << 4)
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002587#define I2C_MPQ_CDP BIT(5)
2588#define I2C_MPQ_HRD BIT(6)
2589#define I2C_MPQ_DTV BIT(7)
Jing Lin417fa452012-02-05 14:31:06 -08002590
2591struct i2c_registry {
2592 u8 machs;
2593 int bus;
2594 struct i2c_board_info *info;
2595 int len;
2596};
2597
2598static struct i2c_registry apq8064_i2c_devices[] __initdata = {
Jing Lin21ed4de2012-02-05 15:53:28 -08002599 {
David Keitel2f613d92012-02-15 11:29:16 -08002600 I2C_LIQUID,
2601 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
2602 smb349_charger_i2c_info,
2603 ARRAY_SIZE(smb349_charger_i2c_info)
2604 },
Terence Hampson2e1705f2012-04-11 19:55:29 -04002605#ifndef CONFIG_MSM_VCAP
David Keitel2f613d92012-02-15 11:29:16 -08002606 {
Jing Lin21ed4de2012-02-05 15:53:28 -08002607 I2C_SURF | I2C_LIQUID,
2608 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
2609 mxt_device_info,
2610 ARRAY_SIZE(mxt_device_info),
2611 },
Terence Hampson2e1705f2012-04-11 19:55:29 -04002612#endif
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08002613 {
2614 I2C_FFA,
2615 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
2616 cyttsp_info,
2617 ARRAY_SIZE(cyttsp_info),
2618 },
Amy Maloche70090f992012-02-16 16:35:26 -08002619 {
2620 I2C_FFA | I2C_LIQUID,
2621 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
2622 isa1200_board_info,
2623 ARRAY_SIZE(isa1200_board_info),
2624 },
Santosh Mardieff9a742012-04-09 23:23:39 +05302625 {
2626 I2C_MPQ_CDP,
2627 APQ_8064_GSBI5_QUP_I2C_BUS_ID,
2628 cs8427_device_info,
2629 ARRAY_SIZE(cs8427_device_info),
2630 },
Jing Lin417fa452012-02-05 14:31:06 -08002631};
2632
Jay Chokshi607f61b2012-04-25 18:21:21 -07002633#define SX150X_EXP1_INT_N PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9)
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05302634#define SX150X_EXP2_INT_N MSM_GPIO_TO_INT(81)
Jay Chokshi607f61b2012-04-25 18:21:21 -07002635
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002636struct sx150x_platform_data mpq8064_sx150x_pdata[] = {
2637 [SX150X_EXP1] = {
2638 .gpio_base = SX150X_EXP1_GPIO_BASE,
2639 .oscio_is_gpo = false,
2640 .io_pullup_ena = 0x0,
2641 .io_pulldn_ena = 0x0,
2642 .io_open_drain_ena = 0x0,
2643 .io_polarity = 0,
Jay Chokshi607f61b2012-04-25 18:21:21 -07002644 .irq_summary = SX150X_EXP1_INT_N,
2645 .irq_base = SX150X_EXP1_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002646 },
2647 [SX150X_EXP2] = {
2648 .gpio_base = SX150X_EXP2_GPIO_BASE,
2649 .oscio_is_gpo = false,
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05302650 .io_pullup_ena = 0x0f,
2651 .io_pulldn_ena = 0x70,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002652 .io_open_drain_ena = 0x0,
2653 .io_polarity = 0,
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05302654 .irq_summary = SX150X_EXP2_INT_N,
2655 .irq_base = SX150X_EXP2_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002656 },
2657 [SX150X_EXP3] = {
2658 .gpio_base = SX150X_EXP3_GPIO_BASE,
2659 .oscio_is_gpo = false,
2660 .io_pullup_ena = 0x0,
2661 .io_pulldn_ena = 0x0,
2662 .io_open_drain_ena = 0x0,
2663 .io_polarity = 0,
2664 .irq_summary = -1,
2665 },
2666 [SX150X_EXP4] = {
2667 .gpio_base = SX150X_EXP4_GPIO_BASE,
2668 .oscio_is_gpo = false,
2669 .io_pullup_ena = 0x0,
2670 .io_pulldn_ena = 0x0,
2671 .io_open_drain_ena = 0x0,
2672 .io_polarity = 0,
2673 .irq_summary = -1,
2674 },
2675};
2676
2677static struct i2c_board_info sx150x_gpio_exp_info[] = {
2678 {
2679 I2C_BOARD_INFO("sx1509q", 0x70),
2680 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP1],
2681 },
2682 {
2683 I2C_BOARD_INFO("sx1508q", 0x23),
2684 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP2],
2685 },
2686 {
2687 I2C_BOARD_INFO("sx1508q", 0x22),
2688 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP3],
2689 },
2690 {
2691 I2C_BOARD_INFO("sx1509q", 0x3E),
2692 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP4],
2693 },
2694};
2695
2696#define MPQ8064_I2C_GSBI5_BUS_ID 5
2697
2698static struct i2c_registry mpq8064_i2c_devices[] __initdata = {
2699 {
2700 I2C_MPQ_CDP,
2701 MPQ8064_I2C_GSBI5_BUS_ID,
2702 sx150x_gpio_exp_info,
2703 ARRAY_SIZE(sx150x_gpio_exp_info),
2704 },
2705};
2706
Jing Lin417fa452012-02-05 14:31:06 -08002707static void __init register_i2c_devices(void)
2708{
2709 u8 mach_mask = 0;
2710 int i;
2711
Kevin Chand07220e2012-02-13 15:52:22 -08002712#ifdef CONFIG_MSM_CAMERA
2713 struct i2c_registry apq8064_camera_i2c_devices = {
2714 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_RUMI,
2715 APQ_8064_GSBI4_QUP_I2C_BUS_ID,
2716 apq8064_camera_board_info.board_info,
2717 apq8064_camera_board_info.num_i2c_board_info,
2718 };
2719#endif
Jing Lin417fa452012-02-05 14:31:06 -08002720 /* Build the matching 'supported_machs' bitmask */
2721 if (machine_is_apq8064_cdp())
2722 mach_mask = I2C_SURF;
2723 else if (machine_is_apq8064_mtp())
2724 mach_mask = I2C_FFA;
2725 else if (machine_is_apq8064_liquid())
2726 mach_mask = I2C_LIQUID;
2727 else if (machine_is_apq8064_rumi3())
2728 mach_mask = I2C_RUMI;
2729 else if (machine_is_apq8064_sim())
2730 mach_mask = I2C_SIM;
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002731 else if (PLATFORM_IS_MPQ8064())
2732 mach_mask = I2C_MPQ_CDP;
Jing Lin417fa452012-02-05 14:31:06 -08002733 else
2734 pr_err("unmatched machine ID in register_i2c_devices\n");
2735
2736 /* Run the array and install devices as appropriate */
2737 for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) {
2738 if (apq8064_i2c_devices[i].machs & mach_mask)
2739 i2c_register_board_info(apq8064_i2c_devices[i].bus,
2740 apq8064_i2c_devices[i].info,
2741 apq8064_i2c_devices[i].len);
2742 }
Kevin Chand07220e2012-02-13 15:52:22 -08002743#ifdef CONFIG_MSM_CAMERA
2744 if (apq8064_camera_i2c_devices.machs & mach_mask)
2745 i2c_register_board_info(apq8064_camera_i2c_devices.bus,
2746 apq8064_camera_i2c_devices.info,
2747 apq8064_camera_i2c_devices.len);
2748#endif
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002749
2750 for (i = 0; i < ARRAY_SIZE(mpq8064_i2c_devices); ++i) {
2751 if (mpq8064_i2c_devices[i].machs & mach_mask)
2752 i2c_register_board_info(
2753 mpq8064_i2c_devices[i].bus,
2754 mpq8064_i2c_devices[i].info,
2755 mpq8064_i2c_devices[i].len);
2756 }
Jing Lin417fa452012-02-05 14:31:06 -08002757}
2758
Jay Chokshi994ff122012-03-27 15:43:48 -07002759static void enable_ddr3_regulator(void)
2760{
2761 static struct regulator *ext_ddr3;
2762
2763 /* Use MPP7 output state as a flag for PCDDR3 presence. */
2764 if (gpio_get_value_cansleep(PM8921_MPP_PM_TO_SYS(7)) > 0) {
2765 ext_ddr3 = regulator_get(NULL, "ext_ddr3");
2766 if (IS_ERR(ext_ddr3) || ext_ddr3 == NULL)
2767 pr_err("Could not get MPP7 regulator\n");
2768 else
2769 regulator_enable(ext_ddr3);
2770 }
2771}
2772
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002773static void enable_avc_i2c_bus(void)
2774{
2775 int avc_i2c_en_mpp = PM8921_MPP_PM_TO_SYS(8);
2776 int rc;
2777
2778 rc = gpio_request(avc_i2c_en_mpp, "avc_i2c_en");
2779 if (rc)
2780 pr_err("request for avc_i2c_en mpp failed,"
2781 "rc=%d\n", rc);
2782 else
2783 gpio_set_value_cansleep(avc_i2c_en_mpp, 1);
2784}
2785
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002786static void __init apq8064_common_init(void)
2787{
Joel King8f839b92012-04-01 14:37:46 -07002788 msm_tsens_early_init(&apq_tsens_pdata);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002789 if (socinfo_init() < 0)
2790 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06002791 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
2792 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
David Collins2782b5c2012-02-06 10:02:42 -08002793 regulator_suppress_info_printing();
2794 platform_device_register(&apq8064_device_rpm_regulator);
Stephen Boyd4d0d2582012-02-10 14:49:40 -08002795 if (msm_xo_init())
2796 pr_err("Failed to initialize XO votes\n");
Matt Wagantallc51e5602012-02-27 17:25:25 -08002797 msm_clock_init(&apq8064_clock_init_data);
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08002798 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06002799 apq8064_i2c_init();
Jing Lin417fa452012-02-05 14:31:06 -08002800 register_i2c_devices();
Kenneth Heitke36920d32011-07-20 16:44:30 -06002801
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002802 apq8064_device_qup_spi_gsbi5.dev.platform_data =
2803 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08002804 apq8064_init_pmic();
Hemant Kumar94e7da22012-02-03 16:52:29 -08002805 if (machine_is_apq8064_liquid())
2806 msm_otg_pdata.mhl_enable = true;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07002807
Ofir Cohen94213a72012-05-03 14:26:32 +03002808 android_usb_pdata.swfi_latency =
2809 msm_rpmrs_levels[0].latency_us;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07002810
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002811 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Manu Gautam91223e02011-11-08 15:27:22 +05302812 apq8064_ehci_host_init();
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002813 apq8064_init_buses();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002814 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Jay Chokshi994ff122012-03-27 15:43:48 -07002815 enable_ddr3_regulator();
Hemant Kumarf1ca9192012-02-07 18:59:33 -08002816 if (machine_is_apq8064_mtp()) {
2817 apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
2818 device_initialize(&apq8064_device_hsic_host.dev);
2819 }
Jay Chokshie8741282012-01-25 15:22:55 -08002820 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05302821 apq8064_init_mmc();
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08002822
2823 if (machine_is_apq8064_mtp()) {
2824 mdm_8064_device.dev.platform_data = &mdm_platform_data;
2825 platform_device_register(&mdm_8064_device);
2826 }
2827 platform_device_register(&apq8064_slim_ctrl);
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002828 slim_register_board_info(apq8064_slim_devices,
2829 ARRAY_SIZE(apq8064_slim_devices));
Jin Hongd3024e62012-02-09 16:13:32 -08002830 apq8064_init_dsps();
Praveen Chidambaram78499012011-11-01 17:15:17 -06002831 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Mahesh Sivasubramaniancbce1ec2012-01-24 10:32:44 -07002832 acpuclk_init(&acpuclk_8064_soc_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002833 msm_spm_l2_init(msm_spm_l2_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002834 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Praveen Chidambaram4d19be42012-04-03 18:05:52 -06002835 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002836 apq8064_epm_adc_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002837}
2838
Huaibin Yang4a084e32011-12-15 15:25:52 -08002839static void __init apq8064_allocate_memory_regions(void)
2840{
2841 apq8064_allocate_fb_region();
2842}
2843
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002844static void __init apq8064_sim_init(void)
2845{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002846 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
2847 &msm8064_device_watchdog.dev.platform_data;
2848
2849 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002850 apq8064_common_init();
Joel King4e7ad222011-08-17 15:47:38 -07002851 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
2852}
2853
2854static void __init apq8064_rumi3_init(void)
2855{
2856 apq8064_common_init();
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002857 ethernet_init();
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002858 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002859 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002860}
2861
Joel King82b7e3f2012-01-05 10:03:27 -08002862static void __init apq8064_cdp_init(void)
2863{
Hanumant Singh50440d42012-04-23 19:27:16 -07002864 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2865 pr_err("meminfo_init() failed!\n");
Joel King82b7e3f2012-01-05 10:03:27 -08002866 apq8064_common_init();
Joel King8f839b92012-04-01 14:37:46 -07002867 if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
2868 machine_is_mpq8064_dtv()) {
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002869 enable_avc_i2c_bus();
Joel King8f839b92012-04-01 14:37:46 -07002870 platform_add_devices(mpq_devices, ARRAY_SIZE(mpq_devices));
2871 } else {
2872 ethernet_init();
2873 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
2874 spi_register_board_info(spi_board_info,
2875 ARRAY_SIZE(spi_board_info));
2876 }
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002877 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07002878 apq8064_init_gpu();
Matt Wagantall1f65d9d2012-04-25 14:24:20 -07002879 platform_add_devices(apq8064_footswitch, apq8064_num_footswitch);
Kevin Chand07220e2012-02-13 15:52:22 -08002880 apq8064_init_cam();
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302881
2882 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
2883 platform_device_register(&cdp_kp_pdev);
2884
2885 if (machine_is_apq8064_mtp())
2886 platform_device_register(&mtp_kp_pdev);
Hanumant Singh50440d42012-04-23 19:27:16 -07002887
2888 change_memory_power = &apq8064_change_memory_power;
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05302889
2890 if (machine_is_mpq8064_cdp()) {
2891 platform_device_register(&mpq_gpio_keys_pdev);
2892 platform_device_register(&mpq_keypad_device);
2893 }
Joel King82b7e3f2012-01-05 10:03:27 -08002894}
2895
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002896MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
2897 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002898 .reserve = apq8064_reserve,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002899 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302900 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002901 .timer = &msm_timer,
2902 .init_machine = apq8064_sim_init,
2903MACHINE_END
2904
Joel King4e7ad222011-08-17 15:47:38 -07002905MACHINE_START(APQ8064_RUMI3, "QCT APQ8064 RUMI3")
2906 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002907 .reserve = apq8064_reserve,
Joel King4e7ad222011-08-17 15:47:38 -07002908 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302909 .handle_irq = gic_handle_irq,
Joel King4e7ad222011-08-17 15:47:38 -07002910 .timer = &msm_timer,
2911 .init_machine = apq8064_rumi3_init,
Huaibin Yang4a084e32011-12-15 15:25:52 -08002912 .init_early = apq8064_allocate_memory_regions,
Joel King4e7ad222011-08-17 15:47:38 -07002913MACHINE_END
2914
Joel King82b7e3f2012-01-05 10:03:27 -08002915MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
2916 .map_io = apq8064_map_io,
2917 .reserve = apq8064_reserve,
2918 .init_irq = apq8064_init_irq,
2919 .handle_irq = gic_handle_irq,
2920 .timer = &msm_timer,
2921 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002922 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07002923 .init_very_early = apq8064_early_reserve,
Joel King82b7e3f2012-01-05 10:03:27 -08002924MACHINE_END
2925
2926MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
2927 .map_io = apq8064_map_io,
2928 .reserve = apq8064_reserve,
2929 .init_irq = apq8064_init_irq,
2930 .handle_irq = gic_handle_irq,
2931 .timer = &msm_timer,
2932 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002933 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07002934 .init_very_early = apq8064_early_reserve,
Joel King82b7e3f2012-01-05 10:03:27 -08002935MACHINE_END
2936
2937MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
2938 .map_io = apq8064_map_io,
2939 .reserve = apq8064_reserve,
2940 .init_irq = apq8064_init_irq,
2941 .handle_irq = gic_handle_irq,
2942 .timer = &msm_timer,
2943 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002944 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07002945 .init_very_early = apq8064_early_reserve,
Joel King82b7e3f2012-01-05 10:03:27 -08002946MACHINE_END
2947
Joel King064bbf82012-04-01 13:23:39 -07002948MACHINE_START(MPQ8064_CDP, "QCT MPQ8064 CDP")
2949 .map_io = apq8064_map_io,
2950 .reserve = apq8064_reserve,
2951 .init_irq = apq8064_init_irq,
2952 .handle_irq = gic_handle_irq,
2953 .timer = &msm_timer,
2954 .init_machine = apq8064_cdp_init,
2955 .init_early = apq8064_allocate_memory_regions,
2956 .init_very_early = apq8064_early_reserve,
2957MACHINE_END
2958
Joel King11ca8202012-02-13 16:19:03 -08002959MACHINE_START(MPQ8064_HRD, "QCT MPQ8064 HRD")
2960 .map_io = apq8064_map_io,
2961 .reserve = apq8064_reserve,
2962 .init_irq = apq8064_init_irq,
2963 .handle_irq = gic_handle_irq,
2964 .timer = &msm_timer,
2965 .init_machine = apq8064_cdp_init,
Laura Abbott6988cef2012-03-15 14:27:13 -07002966 .init_very_early = apq8064_early_reserve,
Joel King11ca8202012-02-13 16:19:03 -08002967MACHINE_END
2968
2969MACHINE_START(MPQ8064_DTV, "QCT MPQ8064 DTV")
2970 .map_io = apq8064_map_io,
2971 .reserve = apq8064_reserve,
2972 .init_irq = apq8064_init_irq,
2973 .handle_irq = gic_handle_irq,
2974 .timer = &msm_timer,
2975 .init_machine = apq8064_cdp_init,
Laura Abbott6988cef2012-03-15 14:27:13 -07002976 .init_very_early = apq8064_early_reserve,
Joel King11ca8202012-02-13 16:19:03 -08002977MACHINE_END
2978