blob: 62f5d7000b1eafe8e5fb7d66a5c8f10efb9f10ff [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
1263#define MXT_TS_GPIO_IRQ 6
1264#define MXT_TS_PWR_EN_GPIO PM8921_GPIO_PM_TO_SYS(23)
1265#define MXT_TS_RESET_GPIO 33
1266
1267static struct mxt_config_info mxt_config_array[] = {
1268 {
1269 .config = mxt1386e_config_data_v2_1,
1270 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1271 .family_id = 0xA0,
1272 .variant_id = 0x7,
1273 .version = 0x21,
1274 .build = 0xAA,
Jing Linef4aa9b2012-03-26 12:01:41 -07001275 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
1276 .fw_name = "atmel_8064_liquid_v2_2_AA.hex",
1277 },
1278 {
1279 /* The config data for V2.2.AA is the same as for V2.1.AA */
1280 .config = mxt1386e_config_data_v2_1,
1281 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1282 .family_id = 0xA0,
1283 .variant_id = 0x7,
1284 .version = 0x22,
1285 .build = 0xAA,
1286 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin21ed4de2012-02-05 15:53:28 -08001287 },
1288};
1289
1290static struct mxt_platform_data mxt_platform_data = {
1291 .config_array = mxt_config_array,
1292 .config_array_size = ARRAY_SIZE(mxt_config_array),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08001293 .panel_minx = 0,
1294 .panel_maxx = 1365,
1295 .panel_miny = 0,
1296 .panel_maxy = 767,
1297 .disp_minx = 0,
1298 .disp_maxx = 1365,
1299 .disp_miny = 0,
1300 .disp_maxy = 767,
Anirudh Ghayal39dbe3f2012-04-13 15:43:16 +05301301 .irqflags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
Jing Lin21ed4de2012-02-05 15:53:28 -08001302 .i2c_pull_up = true,
1303 .reset_gpio = MXT_TS_RESET_GPIO,
1304 .irq_gpio = MXT_TS_GPIO_IRQ,
1305};
1306
1307static struct i2c_board_info mxt_device_info[] __initdata = {
1308 {
1309 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
1310 .platform_data = &mxt_platform_data,
1311 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1312 },
1313};
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001314#define CYTTSP_TS_GPIO_IRQ 6
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001315#define CYTTSP_TS_GPIO_SLEEP 33
1316
1317static ssize_t tma340_vkeys_show(struct kobject *kobj,
1318 struct kobj_attribute *attr, char *buf)
1319{
1320 return snprintf(buf, 200,
1321 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1322 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1323 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1324 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1325 "\n");
1326}
1327
1328static struct kobj_attribute tma340_vkeys_attr = {
1329 .attr = {
1330 .mode = S_IRUGO,
1331 },
1332 .show = &tma340_vkeys_show,
1333};
1334
1335static struct attribute *tma340_properties_attrs[] = {
1336 &tma340_vkeys_attr.attr,
1337 NULL
1338};
1339
1340static struct attribute_group tma340_properties_attr_group = {
1341 .attrs = tma340_properties_attrs,
1342};
1343
1344static int cyttsp_platform_init(struct i2c_client *client)
1345{
1346 int rc = 0;
1347 static struct kobject *tma340_properties_kobj;
1348
1349 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1350 tma340_properties_kobj = kobject_create_and_add("board_properties",
1351 NULL);
1352 if (tma340_properties_kobj)
1353 rc = sysfs_create_group(tma340_properties_kobj,
1354 &tma340_properties_attr_group);
1355 if (!tma340_properties_kobj || rc)
1356 pr_err("%s: failed to create board_properties\n",
1357 __func__);
1358
1359 return 0;
1360}
1361
1362static struct cyttsp_regulator cyttsp_regulator_data[] = {
1363 {
1364 .name = "vdd",
1365 .min_uV = CY_TMA300_VTG_MIN_UV,
1366 .max_uV = CY_TMA300_VTG_MAX_UV,
1367 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1368 .lpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1369 },
1370 {
1371 .name = "vcc_i2c",
1372 .min_uV = CY_I2C_VTG_MIN_UV,
1373 .max_uV = CY_I2C_VTG_MAX_UV,
1374 .hpm_load_uA = CY_I2C_CURR_UA,
1375 .lpm_load_uA = CY_I2C_CURR_UA,
1376 },
1377};
1378
1379static struct cyttsp_platform_data cyttsp_pdata = {
1380 .panel_maxx = 634,
1381 .panel_maxy = 1166,
1382 .disp_maxx = 599,
1383 .disp_maxy = 1023,
1384 .disp_minx = 0,
1385 .disp_miny = 0,
1386 .flags = 0x01,
1387 .gen = CY_GEN3,
1388 .use_st = CY_USE_ST,
1389 .use_mt = CY_USE_MT,
1390 .use_hndshk = CY_SEND_HNDSHK,
1391 .use_trk_id = CY_USE_TRACKING_ID,
1392 .use_sleep = CY_USE_DEEP_SLEEP_SEL,
1393 .use_gestures = CY_USE_GESTURES,
1394 .fw_fname = "cyttsp_8064_mtp.hex",
1395 /* change act_intrvl to customize the Active power state
1396 * scanning/processing refresh interval for Operating mode
1397 */
1398 .act_intrvl = CY_ACT_INTRVL_DFLT,
1399 /* change tch_tmout to customize the touch timeout for the
1400 * Active power state for Operating mode
1401 */
1402 .tch_tmout = CY_TCH_TMOUT_DFLT,
1403 /* change lp_intrvl to customize the Low Power power state
1404 * scanning/processing refresh interval for Operating mode
1405 */
1406 .lp_intrvl = CY_LP_INTRVL_DFLT,
1407 .sleep_gpio = CYTTSP_TS_GPIO_SLEEP,
Amy Maloche9ba3ffe2012-04-26 10:31:20 -07001408 .resout_gpio = -1,
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001409 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1410 .regulator_info = cyttsp_regulator_data,
1411 .num_regulators = ARRAY_SIZE(cyttsp_regulator_data),
1412 .init = cyttsp_platform_init,
1413 .correct_fw_ver = 17,
1414};
1415
1416static struct i2c_board_info cyttsp_info[] __initdata = {
1417 {
1418 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1419 .platform_data = &cyttsp_pdata,
1420 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1421 },
1422};
Jing Lin21ed4de2012-02-05 15:53:28 -08001423
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001424#define MSM_WCNSS_PHYS 0x03000000
1425#define MSM_WCNSS_SIZE 0x280000
1426
1427static struct resource resources_wcnss_wlan[] = {
1428 {
1429 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1430 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1431 .name = "wcnss_wlanrx_irq",
1432 .flags = IORESOURCE_IRQ,
1433 },
1434 {
1435 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1436 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1437 .name = "wcnss_wlantx_irq",
1438 .flags = IORESOURCE_IRQ,
1439 },
1440 {
1441 .start = MSM_WCNSS_PHYS,
1442 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1443 .name = "wcnss_mmio",
1444 .flags = IORESOURCE_MEM,
1445 },
1446 {
1447 .start = 64,
1448 .end = 68,
1449 .name = "wcnss_gpios_5wire",
1450 .flags = IORESOURCE_IO,
1451 },
1452};
1453
1454static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1455 .has_48mhz_xo = 1,
1456};
1457
1458static struct platform_device msm_device_wcnss_wlan = {
1459 .name = "wcnss_wlan",
1460 .id = 0,
1461 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1462 .resource = resources_wcnss_wlan,
1463 .dev = {.platform_data = &qcom_wcnss_pdata},
1464};
1465
Ankit Vermab7c26e62012-02-28 15:04:15 -08001466static struct platform_device msm_device_iris_fm __devinitdata = {
1467 .name = "iris_fm",
1468 .id = -1,
1469};
1470
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001471#ifdef CONFIG_QSEECOM
1472/* qseecom bus scaling */
1473static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
1474 {
1475 .src = MSM_BUS_MASTER_SPS,
1476 .dst = MSM_BUS_SLAVE_EBI_CH0,
1477 .ib = 0,
1478 .ab = 0,
1479 },
1480 {
1481 .src = MSM_BUS_MASTER_SPDM,
1482 .dst = MSM_BUS_SLAVE_SPDM,
1483 .ib = 0,
1484 .ab = 0,
1485 },
1486};
1487
1488static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
1489 {
1490 .src = MSM_BUS_MASTER_SPS,
1491 .dst = MSM_BUS_SLAVE_EBI_CH0,
1492 .ib = (492 * 8) * 1000000UL,
1493 .ab = (492 * 8) * 100000UL,
1494 },
1495 {
1496 .src = MSM_BUS_MASTER_SPDM,
1497 .dst = MSM_BUS_SLAVE_SPDM,
1498 .ib = 0,
1499 .ab = 0,
1500 },
1501};
1502
1503static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1504 {
1505 .src = MSM_BUS_MASTER_SPS,
1506 .dst = MSM_BUS_SLAVE_EBI_CH0,
1507 .ib = 0,
1508 .ab = 0,
1509 },
1510 {
1511 .src = MSM_BUS_MASTER_SPDM,
1512 .dst = MSM_BUS_SLAVE_SPDM,
1513 .ib = (64 * 8) * 1000000UL,
1514 .ab = (64 * 8) * 100000UL,
1515 },
1516};
1517
1518static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1519 {
1520 ARRAY_SIZE(qseecom_clks_init_vectors),
1521 qseecom_clks_init_vectors,
1522 },
1523 {
1524 ARRAY_SIZE(qseecom_enable_dfab_vectors),
1525 qseecom_enable_sfpb_vectors,
1526 },
1527 {
1528 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1529 qseecom_enable_sfpb_vectors,
1530 },
1531};
1532
1533static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1534 qseecom_hw_bus_scale_usecases,
1535 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1536 .name = "qsee",
1537};
1538
1539static struct platform_device qseecom_device = {
1540 .name = "qseecom",
1541 .id = 0,
1542 .dev = {
1543 .platform_data = &qseecom_bus_pdata,
1544 },
1545};
1546#endif
1547
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001548#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1549 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1550 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1551 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1552
1553#define QCE_SIZE 0x10000
1554#define QCE_0_BASE 0x11000000
1555
1556#define QCE_HW_KEY_SUPPORT 0
1557#define QCE_SHA_HMAC_SUPPORT 1
1558#define QCE_SHARE_CE_RESOURCE 3
1559#define QCE_CE_SHARED 0
1560
1561static struct resource qcrypto_resources[] = {
1562 [0] = {
1563 .start = QCE_0_BASE,
1564 .end = QCE_0_BASE + QCE_SIZE - 1,
1565 .flags = IORESOURCE_MEM,
1566 },
1567 [1] = {
1568 .name = "crypto_channels",
1569 .start = DMOV8064_CE_IN_CHAN,
1570 .end = DMOV8064_CE_OUT_CHAN,
1571 .flags = IORESOURCE_DMA,
1572 },
1573 [2] = {
1574 .name = "crypto_crci_in",
1575 .start = DMOV8064_CE_IN_CRCI,
1576 .end = DMOV8064_CE_IN_CRCI,
1577 .flags = IORESOURCE_DMA,
1578 },
1579 [3] = {
1580 .name = "crypto_crci_out",
1581 .start = DMOV8064_CE_OUT_CRCI,
1582 .end = DMOV8064_CE_OUT_CRCI,
1583 .flags = IORESOURCE_DMA,
1584 },
1585};
1586
1587static struct resource qcedev_resources[] = {
1588 [0] = {
1589 .start = QCE_0_BASE,
1590 .end = QCE_0_BASE + QCE_SIZE - 1,
1591 .flags = IORESOURCE_MEM,
1592 },
1593 [1] = {
1594 .name = "crypto_channels",
1595 .start = DMOV8064_CE_IN_CHAN,
1596 .end = DMOV8064_CE_OUT_CHAN,
1597 .flags = IORESOURCE_DMA,
1598 },
1599 [2] = {
1600 .name = "crypto_crci_in",
1601 .start = DMOV8064_CE_IN_CRCI,
1602 .end = DMOV8064_CE_IN_CRCI,
1603 .flags = IORESOURCE_DMA,
1604 },
1605 [3] = {
1606 .name = "crypto_crci_out",
1607 .start = DMOV8064_CE_OUT_CRCI,
1608 .end = DMOV8064_CE_OUT_CRCI,
1609 .flags = IORESOURCE_DMA,
1610 },
1611};
1612
1613#endif
1614
1615#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1616 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1617
1618static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1619 .ce_shared = QCE_CE_SHARED,
1620 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1621 .hw_key_support = QCE_HW_KEY_SUPPORT,
1622 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001623 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001624};
1625
1626static struct platform_device qcrypto_device = {
1627 .name = "qcrypto",
1628 .id = 0,
1629 .num_resources = ARRAY_SIZE(qcrypto_resources),
1630 .resource = qcrypto_resources,
1631 .dev = {
1632 .coherent_dma_mask = DMA_BIT_MASK(32),
1633 .platform_data = &qcrypto_ce_hw_suppport,
1634 },
1635};
1636#endif
1637
1638#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1639 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1640
1641static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1642 .ce_shared = QCE_CE_SHARED,
1643 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1644 .hw_key_support = QCE_HW_KEY_SUPPORT,
1645 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001646 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001647};
1648
1649static struct platform_device qcedev_device = {
1650 .name = "qce",
1651 .id = 0,
1652 .num_resources = ARRAY_SIZE(qcedev_resources),
1653 .resource = qcedev_resources,
1654 .dev = {
1655 .coherent_dma_mask = DMA_BIT_MASK(32),
1656 .platform_data = &qcedev_ce_hw_suppport,
1657 },
1658};
1659#endif
1660
Joel Kingdacbc822012-01-25 13:30:57 -08001661static struct mdm_platform_data mdm_platform_data = {
1662 .mdm_version = "3.0",
1663 .ramdump_delay_ms = 2000,
Hemant Kumara945b472012-01-25 15:08:06 -08001664 .peripheral_platform_device = &apq8064_device_hsic_host,
Joel Kingdacbc822012-01-25 13:30:57 -08001665};
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001666
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001667static struct tsens_platform_data apq_tsens_pdata = {
1668 .tsens_factor = 1000,
1669 .hw_type = APQ_8064,
1670 .tsens_num_sensor = 11,
1671 .slope = {1176, 1176, 1154, 1176, 1111,
1672 1132, 1132, 1199, 1132, 1199, 1132},
1673};
1674
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07001675static struct platform_device msm_tsens_device = {
1676 .name = "tsens8960-tm",
1677 .id = -1,
1678};
1679
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001680#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001681static void __init apq8064_map_io(void)
1682{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001683 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001684 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001685 if (socinfo_init() < 0)
1686 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001687}
1688
1689static void __init apq8064_init_irq(void)
1690{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001691 struct msm_mpm_device_data *data = NULL;
1692
1693#ifdef CONFIG_MSM_MPM
1694 data = &apq8064_mpm_dev_data;
1695#endif
1696
1697 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001698 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1699 (void *)MSM_QGIC_CPU_BASE);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001700}
1701
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001702static struct platform_device msm8064_device_saw_regulator_core0 = {
1703 .name = "saw-regulator",
1704 .id = 0,
1705 .dev = {
1706 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
1707 },
1708};
1709
1710static struct platform_device msm8064_device_saw_regulator_core1 = {
1711 .name = "saw-regulator",
1712 .id = 1,
1713 .dev = {
1714 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
1715 },
1716};
1717
1718static struct platform_device msm8064_device_saw_regulator_core2 = {
1719 .name = "saw-regulator",
1720 .id = 2,
1721 .dev = {
1722 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
1723 },
1724};
1725
1726static struct platform_device msm8064_device_saw_regulator_core3 = {
1727 .name = "saw-regulator",
1728 .id = 3,
1729 .dev = {
1730 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001731
1732 },
1733};
1734
Oluwafemi Adeyemif5a31422012-03-08 16:58:45 -08001735static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001736 {
1737 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1738 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1739 true,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001740 100, 650, 801, 200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001741 },
1742
1743 {
1744 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1745 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1746 true,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001747 2000, 200, 576000, 2000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001748 },
1749
1750 {
1751 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1752 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1753 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001754 8500, 51, 1122000, 8500,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001755 },
1756
1757 {
1758 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1759 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
1760 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001761 9000, 51, 1130300, 9000,
1762 },
1763 {
1764 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1765 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
1766 false,
1767 10000, 51, 1130300, 10000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001768 },
1769
1770 {
1771 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1772 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1773 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001774 12000, 14, 2205900, 12000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001775 },
1776
1777 {
1778 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1779 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1780 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001781 18000, 12, 2364250, 18000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001782 },
1783
1784 {
1785 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1786 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1787 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001788 23500, 10, 2667000, 23500,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001789 },
1790
1791 {
1792 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1793 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1794 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001795 29700, 5, 2867000, 30000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001796 },
1797};
1798
1799static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1800 .mode = MSM_PM_BOOT_CONFIG_TZ,
1801};
1802
1803static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
1804 .levels = &msm_rpmrs_levels[0],
1805 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
1806 .vdd_mem_levels = {
1807 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
1808 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
1809 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
1810 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
1811 },
1812 .vdd_dig_levels = {
1813 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
1814 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
1815 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
1816 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
1817 },
1818 .vdd_mask = 0x7FFFFF,
1819 .rpmrs_target_id = {
1820 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
1821 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
1822 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
1823 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
1824 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
1825 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
1826 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
1827 },
1828};
1829
Praveen Chidambaram78499012011-11-01 17:15:17 -06001830static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1831 0x03, 0x0f,
1832};
1833
1834static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1835 0x00, 0x24, 0x54, 0x10,
1836 0x09, 0x03, 0x01,
1837 0x10, 0x54, 0x30, 0x0C,
1838 0x24, 0x30, 0x0f,
1839};
1840
1841static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1842 0x00, 0x24, 0x54, 0x10,
1843 0x09, 0x07, 0x01, 0x0B,
1844 0x10, 0x54, 0x30, 0x0C,
1845 0x24, 0x30, 0x0f,
1846};
1847
1848static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1849 [0] = {
1850 .mode = MSM_SPM_MODE_CLOCK_GATING,
1851 .notify_rpm = false,
1852 .cmd = spm_wfi_cmd_sequence,
1853 },
1854 [1] = {
1855 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1856 .notify_rpm = false,
1857 .cmd = spm_power_collapse_without_rpm,
1858 },
1859 [2] = {
1860 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1861 .notify_rpm = true,
1862 .cmd = spm_power_collapse_with_rpm,
1863 },
1864};
1865
1866static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1867 0x00, 0x20, 0x03, 0x20,
1868 0x00, 0x0f,
1869};
1870
1871static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1872 0x00, 0x20, 0x34, 0x64,
1873 0x48, 0x07, 0x48, 0x20,
1874 0x50, 0x64, 0x04, 0x34,
1875 0x50, 0x0f,
1876};
1877static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1878 0x00, 0x10, 0x34, 0x64,
1879 0x48, 0x07, 0x48, 0x10,
1880 0x50, 0x64, 0x04, 0x34,
1881 0x50, 0x0F,
1882};
1883
1884static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1885 [0] = {
1886 .mode = MSM_SPM_L2_MODE_RETENTION,
1887 .notify_rpm = false,
1888 .cmd = l2_spm_wfi_cmd_sequence,
1889 },
1890 [1] = {
1891 .mode = MSM_SPM_L2_MODE_GDHS,
1892 .notify_rpm = true,
1893 .cmd = l2_spm_gdhs_cmd_sequence,
1894 },
1895 [2] = {
1896 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1897 .notify_rpm = true,
1898 .cmd = l2_spm_power_off_cmd_sequence,
1899 },
1900};
1901
1902
1903static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1904 [0] = {
1905 .reg_base_addr = MSM_SAW_L2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001906 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001907 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001908 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1909 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1910 .modes = msm_spm_l2_seq_list,
1911 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1912 },
1913};
1914
1915static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1916 [0] = {
1917 .reg_base_addr = MSM_SAW0_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001918 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001919#if defined(CONFIG_MSM_AVS_HW)
1920 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1921 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1922#endif
1923 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001924 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001925 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1926 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1927 .vctl_timeout_us = 50,
1928 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1929 .modes = msm_spm_seq_list,
1930 },
1931 [1] = {
1932 .reg_base_addr = MSM_SAW1_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001933 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001934#if defined(CONFIG_MSM_AVS_HW)
1935 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1936 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1937#endif
1938 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001939 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001940 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1941 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1942 .vctl_timeout_us = 50,
1943 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1944 .modes = msm_spm_seq_list,
1945 },
1946 [2] = {
1947 .reg_base_addr = MSM_SAW2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001948 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001949#if defined(CONFIG_MSM_AVS_HW)
1950 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1951 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1952#endif
1953 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001954 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001955 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1956 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1957 .vctl_timeout_us = 50,
1958 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1959 .modes = msm_spm_seq_list,
1960 },
1961 [3] = {
1962 .reg_base_addr = MSM_SAW3_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001963 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001964#if defined(CONFIG_MSM_AVS_HW)
1965 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1966 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1967#endif
1968 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001969 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001970 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1971 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1972 .vctl_timeout_us = 50,
1973 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1974 .modes = msm_spm_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001975 },
1976};
1977
Praveen Chidambaram4d19be42012-04-03 18:05:52 -06001978static struct msm_pm_sleep_status_data msm_pm_slp_sts_data = {
1979 .base_addr = MSM_ACC0_BASE + 0x08,
1980 .cpu_offset = MSM_ACC1_BASE - MSM_ACC0_BASE,
1981 .mask = 1UL << 13,
1982};
1983
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001984static void __init apq8064_init_buses(void)
1985{
1986 msm_bus_rpm_set_mt_mask();
1987 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
1988 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
1989 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
1990 msm_bus_8064_apps_fabric.dev.platform_data =
1991 &msm_bus_8064_apps_fabric_pdata;
1992 msm_bus_8064_sys_fabric.dev.platform_data =
1993 &msm_bus_8064_sys_fabric_pdata;
1994 msm_bus_8064_mm_fabric.dev.platform_data =
1995 &msm_bus_8064_mm_fabric_pdata;
1996 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
1997 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
1998}
1999
David Collinsf0d00732012-01-25 15:46:50 -08002000static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
2001 .name = GPIO_REGULATOR_DEV_NAME,
2002 .id = PM8921_MPP_PM_TO_SYS(7),
2003 .dev = {
2004 .platform_data
2005 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2006 },
2007};
2008
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08002009static struct platform_device apq8064_device_ext_mpp8_vreg __devinitdata = {
2010 .name = GPIO_REGULATOR_DEV_NAME,
2011 .id = PM8921_MPP_PM_TO_SYS(8),
2012 .dev = {
2013 .platform_data
2014 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_MPP8],
2015 },
2016};
2017
David Collinsf0d00732012-01-25 15:46:50 -08002018static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
2019 .name = GPIO_REGULATOR_DEV_NAME,
2020 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
2021 .dev = {
2022 .platform_data =
2023 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2024 },
2025};
2026
David Collins390fc332012-02-07 14:38:16 -08002027static struct platform_device apq8064_device_ext_ts_sw_vreg __devinitdata = {
2028 .name = GPIO_REGULATOR_DEV_NAME,
2029 .id = PM8921_GPIO_PM_TO_SYS(23),
2030 .dev = {
2031 .platform_data
2032 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_TS_SW],
2033 },
2034};
2035
David Collins2782b5c2012-02-06 10:02:42 -08002036static struct platform_device apq8064_device_rpm_regulator __devinitdata = {
2037 .name = "rpm-regulator",
2038 .id = -1,
2039 .dev = {
2040 .platform_data = &apq8064_rpm_regulator_pdata,
2041 },
2042};
2043
Ravi Kumar V05931a22012-04-04 17:09:37 +05302044static struct gpio_ir_recv_platform_data gpio_ir_recv_pdata = {
2045 .gpio_nr = 88,
2046 .active_low = 1,
2047};
2048
2049static struct platform_device gpio_ir_recv_pdev = {
2050 .name = "gpio-rc-recv",
2051 .dev = {
2052 .platform_data = &gpio_ir_recv_pdata,
2053 },
2054};
2055
Terence Hampson36b70722012-05-10 13:18:16 -04002056static struct platform_device *common_not_mpq_devices[] __initdata = {
David Keitel3c40fc52012-02-09 17:53:52 -08002057 &apq8064_device_qup_i2c_gsbi1,
Jing Lin04601f92012-02-05 15:36:07 -08002058 &apq8064_device_qup_i2c_gsbi3,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002059 &apq8064_device_qup_i2c_gsbi4,
Terence Hampson36b70722012-05-10 13:18:16 -04002060};
2061
2062static struct platform_device *common_devices[] __initdata = {
2063 &apq8064_device_dmov,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002064 &apq8064_device_qup_spi_gsbi5,
David Collinsf0d00732012-01-25 15:46:50 -08002065 &apq8064_device_ext_5v_vreg,
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08002066 &apq8064_device_ext_mpp8_vreg,
David Collinsf0d00732012-01-25 15:46:50 -08002067 &apq8064_device_ext_3p3v_vreg,
David Collins390fc332012-02-07 14:38:16 -08002068 &apq8064_device_ext_ts_sw_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07002069 &apq8064_device_ssbi_pmic1,
2070 &apq8064_device_ssbi_pmic2,
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06002071 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07002072 &apq8064_device_otg,
2073 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08002074 &apq8064_device_hsusb_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07002075 &android_usb_device,
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08002076 &msm_device_wcnss_wlan,
Ankit Vermab7c26e62012-02-28 15:04:15 -08002077 &msm_device_iris_fm,
Larry Bassel67b921d2012-04-06 10:23:27 -07002078 &apq8064_fmem_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08002079#ifdef CONFIG_ANDROID_PMEM
2080#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002081 &apq8064_android_pmem_device,
2082 &apq8064_android_pmem_adsp_device,
2083 &apq8064_android_pmem_audio_device,
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -07002084#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
2085#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -08002086#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002087 &apq8064_ion_dev,
Olav Haugan7c6aa742012-01-16 16:47:37 -08002088#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002089 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08002090 &msm8064_device_saw_regulator_core0,
2091 &msm8064_device_saw_regulator_core1,
2092 &msm8064_device_saw_regulator_core2,
2093 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002094#if defined(CONFIG_QSEECOM)
2095 &qseecom_device,
2096#endif
2097
Ramesh Masavarapu28311912011-10-27 11:04:12 -07002098#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2099 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2100 &qcrypto_device,
2101#endif
2102
2103#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2104 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2105 &qcedev_device,
2106#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07002107
2108#ifdef CONFIG_HW_RANDOM_MSM
2109 &apq8064_device_rng,
2110#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002111 &apq_pcm,
2112 &apq_pcm_routing,
2113 &apq_cpudai0,
2114 &apq_cpudai1,
Santosh Mardieff9a742012-04-09 23:23:39 +05302115 &mpq_cpudai_sec_i2s_rx,
Kuirong Wangf23f8c52012-03-31 12:34:51 -07002116 &mpq_cpudai_mi2s_tx,
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002117 &apq_cpudai_hdmi_rx,
2118 &apq_cpudai_bt_rx,
2119 &apq_cpudai_bt_tx,
2120 &apq_cpudai_fm_rx,
2121 &apq_cpudai_fm_tx,
2122 &apq_cpu_fe,
2123 &apq_stub_codec,
2124 &apq_voice,
2125 &apq_voip,
2126 &apq_lpa_pcm,
Krishnankutty Kolathappilly4374e332012-03-18 22:27:30 -07002127 &apq_compr_dsp,
2128 &apq_multi_ch_pcm,
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002129 &apq_pcm_hostless,
2130 &apq_cpudai_afe_01_rx,
2131 &apq_cpudai_afe_01_tx,
2132 &apq_cpudai_afe_02_rx,
2133 &apq_cpudai_afe_02_tx,
2134 &apq_pcm_afe,
2135 &apq_cpudai_auxpcm_rx,
2136 &apq_cpudai_auxpcm_tx,
Neema Shetty8427c262012-02-16 11:23:43 -08002137 &apq_cpudai_stub,
Neema Shetty3c9d2862012-03-11 01:25:32 -08002138 &apq_cpudai_slimbus_1_rx,
2139 &apq_cpudai_slimbus_1_tx,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002140 &apq_cpudai_slimbus_2_tx,
Neema Shettyc9d86c32012-05-09 12:01:39 -07002141 &apq_cpudai_slimbus_3_rx,
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
Ravi Kumar V1c903012012-05-15 16:11:35 +05302255static struct platform_device rc_input_loopback_pdev = {
2256 .name = "rc-user-input",
2257 .id = -1,
2258};
2259
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002260static struct platform_device *mpq_devices[] __initdata = {
2261 &msm_device_sps_apq8064,
2262 &mpq8064_device_qup_i2c_gsbi5,
2263#ifdef CONFIG_MSM_ROTATOR
2264 &msm_rotator_device,
2265#endif
Ravi Kumar V05931a22012-04-04 17:09:37 +05302266 &gpio_ir_recv_pdev,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002267 &mpq8064_device_ext_5v_frc_vreg,
2268 &mpq8064_device_ext_1p2_buck_vreg,
2269 &mpq8064_device_ext_1p8_buck_vreg,
2270 &mpq8064_device_ext_2p2_buck_vreg,
2271 &mpq8064_device_ext_5v_buck_vreg,
2272 &mpq8064_device_ext_3p3v_ldo_vreg,
Terence Hampson2e1705f2012-04-11 19:55:29 -04002273#ifdef CONFIG_MSM_VCAP
2274 &msm8064_device_vcap,
2275#endif
Ravi Kumar V1c903012012-05-15 16:11:35 +05302276 &rc_input_loopback_pdev,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002277};
2278
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002279static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002280 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002281};
2282
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002283#define KS8851_IRQ_GPIO 43
2284
2285static struct spi_board_info spi_board_info[] __initdata = {
2286 {
2287 .modalias = "ks8851",
2288 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2289 .max_speed_hz = 19200000,
2290 .bus_num = 0,
2291 .chip_select = 2,
2292 .mode = SPI_MODE_0,
2293 },
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002294 {
2295 .modalias = "epm_adc",
2296 .max_speed_hz = 1100000,
2297 .bus_num = 0,
2298 .chip_select = 3,
2299 .mode = SPI_MODE_0,
2300 },
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002301};
2302
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002303static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002304 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08002305 .bus_num = 1,
2306 .slim_slave = &apq8064_slim_tabla,
2307 },
2308 {
2309 .bus_num = 1,
2310 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002311 },
2312 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002313};
2314
David Keitel3c40fc52012-02-09 17:53:52 -08002315static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi1_pdata = {
2316 .clk_freq = 100000,
2317 .src_clk_rate = 24000000,
2318};
2319
Jing Lin04601f92012-02-05 15:36:07 -08002320static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi3_pdata = {
Anirudh Ghayalc2163472012-04-10 14:58:14 +05302321 .clk_freq = 384000,
Jing Lin04601f92012-02-05 15:36:07 -08002322 .src_clk_rate = 24000000,
2323};
2324
Kenneth Heitke748593a2011-07-15 15:45:11 -06002325static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
2326 .clk_freq = 100000,
2327 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002328};
2329
Joel King8f839b92012-04-01 14:37:46 -07002330static struct msm_i2c_platform_data mpq8064_i2c_qup_gsbi5_pdata = {
2331 .clk_freq = 100000,
2332 .src_clk_rate = 24000000,
2333};
2334
David Keitel3c40fc52012-02-09 17:53:52 -08002335#define GSBI_DUAL_MODE_CODE 0x60
2336#define MSM_GSBI1_PHYS 0x12440000
Kenneth Heitke748593a2011-07-15 15:45:11 -06002337static void __init apq8064_i2c_init(void)
2338{
David Keitel3c40fc52012-02-09 17:53:52 -08002339 void __iomem *gsbi_mem;
2340
2341 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2342 &apq8064_i2c_qup_gsbi1_pdata;
2343 gsbi_mem = ioremap_nocache(MSM_GSBI1_PHYS, 4);
2344 writel_relaxed(GSBI_DUAL_MODE_CODE, gsbi_mem);
2345 /* Ensure protocol code is written before proceeding */
2346 wmb();
2347 iounmap(gsbi_mem);
2348 apq8064_i2c_qup_gsbi1_pdata.use_gsbi_shared_mode = 1;
Jing Lin04601f92012-02-05 15:36:07 -08002349 apq8064_device_qup_i2c_gsbi3.dev.platform_data =
2350 &apq8064_i2c_qup_gsbi3_pdata;
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002351 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2352 &apq8064_i2c_qup_gsbi1_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002353 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
2354 &apq8064_i2c_qup_gsbi4_pdata;
Joel King8f839b92012-04-01 14:37:46 -07002355 mpq8064_device_qup_i2c_gsbi5.dev.platform_data =
2356 &mpq8064_i2c_qup_gsbi5_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002357}
2358
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002359#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002360static int ethernet_init(void)
2361{
2362 int ret;
2363 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
2364 if (ret) {
2365 pr_err("ks8851 gpio_request failed: %d\n", ret);
2366 goto fail;
2367 }
2368
2369 return 0;
2370fail:
2371 return ret;
2372}
2373#else
2374static int ethernet_init(void)
2375{
2376 return 0;
2377}
2378#endif
2379
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302380#define GPIO_KEY_HOME PM8921_GPIO_PM_TO_SYS(27)
2381#define GPIO_KEY_VOLUME_UP PM8921_GPIO_PM_TO_SYS(35)
2382#define GPIO_KEY_VOLUME_DOWN PM8921_GPIO_PM_TO_SYS(38)
2383#define GPIO_KEY_CAM_FOCUS PM8921_GPIO_PM_TO_SYS(3)
2384#define GPIO_KEY_CAM_SNAP PM8921_GPIO_PM_TO_SYS(4)
Jing Lin3f8f8422012-03-05 09:32:11 -08002385#define GPIO_KEY_ROTATION PM8921_GPIO_PM_TO_SYS(42)
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302386
2387static struct gpio_keys_button cdp_keys[] = {
2388 {
2389 .code = KEY_HOME,
2390 .gpio = GPIO_KEY_HOME,
2391 .desc = "home_key",
2392 .active_low = 1,
2393 .type = EV_KEY,
2394 .wakeup = 1,
2395 .debounce_interval = 15,
2396 },
2397 {
2398 .code = KEY_VOLUMEUP,
2399 .gpio = GPIO_KEY_VOLUME_UP,
2400 .desc = "volume_up_key",
2401 .active_low = 1,
2402 .type = EV_KEY,
2403 .wakeup = 1,
2404 .debounce_interval = 15,
2405 },
2406 {
2407 .code = KEY_VOLUMEDOWN,
2408 .gpio = GPIO_KEY_VOLUME_DOWN,
2409 .desc = "volume_down_key",
2410 .active_low = 1,
2411 .type = EV_KEY,
2412 .wakeup = 1,
2413 .debounce_interval = 15,
2414 },
2415 {
2416 .code = SW_ROTATE_LOCK,
2417 .gpio = GPIO_KEY_ROTATION,
2418 .desc = "rotate_key",
2419 .active_low = 1,
2420 .type = EV_SW,
2421 .debounce_interval = 15,
2422 },
2423};
2424
2425static struct gpio_keys_platform_data cdp_keys_data = {
2426 .buttons = cdp_keys,
2427 .nbuttons = ARRAY_SIZE(cdp_keys),
2428};
2429
2430static struct platform_device cdp_kp_pdev = {
2431 .name = "gpio-keys",
2432 .id = -1,
2433 .dev = {
2434 .platform_data = &cdp_keys_data,
2435 },
2436};
2437
2438static struct gpio_keys_button mtp_keys[] = {
2439 {
2440 .code = KEY_CAMERA_FOCUS,
2441 .gpio = GPIO_KEY_CAM_FOCUS,
2442 .desc = "cam_focus_key",
2443 .active_low = 1,
2444 .type = EV_KEY,
2445 .wakeup = 1,
2446 .debounce_interval = 15,
2447 },
2448 {
2449 .code = KEY_VOLUMEUP,
2450 .gpio = GPIO_KEY_VOLUME_UP,
2451 .desc = "volume_up_key",
2452 .active_low = 1,
2453 .type = EV_KEY,
2454 .wakeup = 1,
2455 .debounce_interval = 15,
2456 },
2457 {
2458 .code = KEY_VOLUMEDOWN,
2459 .gpio = GPIO_KEY_VOLUME_DOWN,
2460 .desc = "volume_down_key",
2461 .active_low = 1,
2462 .type = EV_KEY,
2463 .wakeup = 1,
2464 .debounce_interval = 15,
2465 },
2466 {
2467 .code = KEY_CAMERA_SNAPSHOT,
2468 .gpio = GPIO_KEY_CAM_SNAP,
2469 .desc = "cam_snap_key",
2470 .active_low = 1,
2471 .type = EV_KEY,
2472 .debounce_interval = 15,
2473 },
2474};
2475
2476static struct gpio_keys_platform_data mtp_keys_data = {
2477 .buttons = mtp_keys,
2478 .nbuttons = ARRAY_SIZE(mtp_keys),
2479};
2480
2481static struct platform_device mtp_kp_pdev = {
2482 .name = "gpio-keys",
2483 .id = -1,
2484 .dev = {
2485 .platform_data = &mtp_keys_data,
2486 },
2487};
2488
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05302489static struct gpio_keys_button mpq_keys[] = {
2490 {
2491 .code = KEY_VOLUMEDOWN,
2492 .gpio = GPIO_KEY_VOLUME_DOWN,
2493 .desc = "volume_down_key",
2494 .active_low = 1,
2495 .type = EV_KEY,
2496 .wakeup = 1,
2497 .debounce_interval = 15,
2498 },
2499 {
2500 .code = KEY_VOLUMEUP,
2501 .gpio = GPIO_KEY_VOLUME_UP,
2502 .desc = "volume_up_key",
2503 .active_low = 1,
2504 .type = EV_KEY,
2505 .wakeup = 1,
2506 .debounce_interval = 15,
2507 },
2508};
2509
2510static struct gpio_keys_platform_data mpq_keys_data = {
2511 .buttons = mpq_keys,
2512 .nbuttons = ARRAY_SIZE(mpq_keys),
2513};
2514
2515static struct platform_device mpq_gpio_keys_pdev = {
2516 .name = "gpio-keys",
2517 .id = -1,
2518 .dev = {
2519 .platform_data = &mpq_keys_data,
2520 },
2521};
2522
2523#define MPQ_KP_ROW_BASE SX150X_EXP2_GPIO_BASE
2524#define MPQ_KP_COL_BASE (SX150X_EXP2_GPIO_BASE + 4)
2525
2526static unsigned int mpq_row_gpios[] = {MPQ_KP_ROW_BASE, MPQ_KP_ROW_BASE + 1,
2527 MPQ_KP_ROW_BASE + 2, MPQ_KP_ROW_BASE + 3};
2528static unsigned int mpq_col_gpios[] = {MPQ_KP_COL_BASE, MPQ_KP_COL_BASE + 1,
2529 MPQ_KP_COL_BASE + 2};
2530
2531static const unsigned int mpq_keymap[] = {
2532 KEY(0, 0, KEY_UP),
2533 KEY(0, 1, KEY_ENTER),
2534 KEY(0, 2, KEY_3),
2535
2536 KEY(1, 0, KEY_DOWN),
2537 KEY(1, 1, KEY_EXIT),
2538 KEY(1, 2, KEY_4),
2539
2540 KEY(2, 0, KEY_LEFT),
2541 KEY(2, 1, KEY_1),
2542 KEY(2, 2, KEY_5),
2543
2544 KEY(3, 0, KEY_RIGHT),
2545 KEY(3, 1, KEY_2),
2546 KEY(3, 2, KEY_6),
2547};
2548
2549static struct matrix_keymap_data mpq_keymap_data = {
2550 .keymap_size = ARRAY_SIZE(mpq_keymap),
2551 .keymap = mpq_keymap,
2552};
2553
2554static struct matrix_keypad_platform_data mpq_keypad_data = {
2555 .keymap_data = &mpq_keymap_data,
2556 .row_gpios = mpq_row_gpios,
2557 .col_gpios = mpq_col_gpios,
2558 .num_row_gpios = ARRAY_SIZE(mpq_row_gpios),
2559 .num_col_gpios = ARRAY_SIZE(mpq_col_gpios),
2560 .col_scan_delay_us = 32000,
2561 .debounce_ms = 20,
2562 .wakeup = 1,
2563 .active_low = 1,
2564 .no_autorepeat = 1,
2565};
2566
2567static struct platform_device mpq_keypad_device = {
2568 .name = "matrix-keypad",
2569 .id = -1,
2570 .dev = {
2571 .platform_data = &mpq_keypad_data,
2572 },
2573};
2574
Jin Hongd3024e62012-02-09 16:13:32 -08002575/* Sensors DSPS platform data */
2576#define DSPS_PIL_GENERIC_NAME "dsps"
2577static void __init apq8064_init_dsps(void)
2578{
2579 struct msm_dsps_platform_data *pdata =
2580 msm_dsps_device_8064.dev.platform_data;
2581 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
2582 pdata->gpios = NULL;
2583 pdata->gpios_num = 0;
2584
2585 platform_device_register(&msm_dsps_device_8064);
2586}
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302587
Jing Lin417fa452012-02-05 14:31:06 -08002588#define I2C_SURF 1
2589#define I2C_FFA (1 << 1)
2590#define I2C_RUMI (1 << 2)
2591#define I2C_SIM (1 << 3)
2592#define I2C_LIQUID (1 << 4)
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002593#define I2C_MPQ_CDP BIT(5)
2594#define I2C_MPQ_HRD BIT(6)
2595#define I2C_MPQ_DTV BIT(7)
Jing Lin417fa452012-02-05 14:31:06 -08002596
2597struct i2c_registry {
2598 u8 machs;
2599 int bus;
2600 struct i2c_board_info *info;
2601 int len;
2602};
2603
2604static struct i2c_registry apq8064_i2c_devices[] __initdata = {
Jing Lin21ed4de2012-02-05 15:53:28 -08002605 {
David Keitel2f613d92012-02-15 11:29:16 -08002606 I2C_LIQUID,
2607 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
2608 smb349_charger_i2c_info,
2609 ARRAY_SIZE(smb349_charger_i2c_info)
2610 },
2611 {
Jing Lin21ed4de2012-02-05 15:53:28 -08002612 I2C_SURF | I2C_LIQUID,
2613 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
2614 mxt_device_info,
2615 ARRAY_SIZE(mxt_device_info),
2616 },
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08002617 {
2618 I2C_FFA,
2619 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
2620 cyttsp_info,
2621 ARRAY_SIZE(cyttsp_info),
2622 },
Amy Maloche70090f992012-02-16 16:35:26 -08002623 {
2624 I2C_FFA | I2C_LIQUID,
2625 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
2626 isa1200_board_info,
2627 ARRAY_SIZE(isa1200_board_info),
2628 },
Santosh Mardieff9a742012-04-09 23:23:39 +05302629 {
2630 I2C_MPQ_CDP,
2631 APQ_8064_GSBI5_QUP_I2C_BUS_ID,
2632 cs8427_device_info,
2633 ARRAY_SIZE(cs8427_device_info),
2634 },
Jing Lin417fa452012-02-05 14:31:06 -08002635};
2636
Jay Chokshi607f61b2012-04-25 18:21:21 -07002637#define SX150X_EXP1_INT_N PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9)
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05302638#define SX150X_EXP2_INT_N MSM_GPIO_TO_INT(81)
Jay Chokshi607f61b2012-04-25 18:21:21 -07002639
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002640struct sx150x_platform_data mpq8064_sx150x_pdata[] = {
2641 [SX150X_EXP1] = {
2642 .gpio_base = SX150X_EXP1_GPIO_BASE,
2643 .oscio_is_gpo = false,
2644 .io_pullup_ena = 0x0,
2645 .io_pulldn_ena = 0x0,
2646 .io_open_drain_ena = 0x0,
2647 .io_polarity = 0,
Jay Chokshi607f61b2012-04-25 18:21:21 -07002648 .irq_summary = SX150X_EXP1_INT_N,
2649 .irq_base = SX150X_EXP1_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002650 },
2651 [SX150X_EXP2] = {
2652 .gpio_base = SX150X_EXP2_GPIO_BASE,
2653 .oscio_is_gpo = false,
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05302654 .io_pullup_ena = 0x0f,
2655 .io_pulldn_ena = 0x70,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002656 .io_open_drain_ena = 0x0,
2657 .io_polarity = 0,
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05302658 .irq_summary = SX150X_EXP2_INT_N,
2659 .irq_base = SX150X_EXP2_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002660 },
2661 [SX150X_EXP3] = {
2662 .gpio_base = SX150X_EXP3_GPIO_BASE,
2663 .oscio_is_gpo = false,
2664 .io_pullup_ena = 0x0,
2665 .io_pulldn_ena = 0x0,
2666 .io_open_drain_ena = 0x0,
2667 .io_polarity = 0,
2668 .irq_summary = -1,
2669 },
2670 [SX150X_EXP4] = {
2671 .gpio_base = SX150X_EXP4_GPIO_BASE,
2672 .oscio_is_gpo = false,
2673 .io_pullup_ena = 0x0,
2674 .io_pulldn_ena = 0x0,
2675 .io_open_drain_ena = 0x0,
2676 .io_polarity = 0,
2677 .irq_summary = -1,
2678 },
2679};
2680
2681static struct i2c_board_info sx150x_gpio_exp_info[] = {
2682 {
2683 I2C_BOARD_INFO("sx1509q", 0x70),
2684 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP1],
2685 },
2686 {
2687 I2C_BOARD_INFO("sx1508q", 0x23),
2688 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP2],
2689 },
2690 {
2691 I2C_BOARD_INFO("sx1508q", 0x22),
2692 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP3],
2693 },
2694 {
2695 I2C_BOARD_INFO("sx1509q", 0x3E),
2696 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP4],
2697 },
2698};
2699
2700#define MPQ8064_I2C_GSBI5_BUS_ID 5
2701
2702static struct i2c_registry mpq8064_i2c_devices[] __initdata = {
2703 {
2704 I2C_MPQ_CDP,
2705 MPQ8064_I2C_GSBI5_BUS_ID,
2706 sx150x_gpio_exp_info,
2707 ARRAY_SIZE(sx150x_gpio_exp_info),
2708 },
2709};
2710
Jing Lin417fa452012-02-05 14:31:06 -08002711static void __init register_i2c_devices(void)
2712{
2713 u8 mach_mask = 0;
2714 int i;
2715
Kevin Chand07220e2012-02-13 15:52:22 -08002716#ifdef CONFIG_MSM_CAMERA
2717 struct i2c_registry apq8064_camera_i2c_devices = {
2718 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_RUMI,
2719 APQ_8064_GSBI4_QUP_I2C_BUS_ID,
2720 apq8064_camera_board_info.board_info,
2721 apq8064_camera_board_info.num_i2c_board_info,
2722 };
2723#endif
Jing Lin417fa452012-02-05 14:31:06 -08002724 /* Build the matching 'supported_machs' bitmask */
2725 if (machine_is_apq8064_cdp())
2726 mach_mask = I2C_SURF;
2727 else if (machine_is_apq8064_mtp())
2728 mach_mask = I2C_FFA;
2729 else if (machine_is_apq8064_liquid())
2730 mach_mask = I2C_LIQUID;
2731 else if (machine_is_apq8064_rumi3())
2732 mach_mask = I2C_RUMI;
2733 else if (machine_is_apq8064_sim())
2734 mach_mask = I2C_SIM;
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002735 else if (PLATFORM_IS_MPQ8064())
2736 mach_mask = I2C_MPQ_CDP;
Jing Lin417fa452012-02-05 14:31:06 -08002737 else
2738 pr_err("unmatched machine ID in register_i2c_devices\n");
2739
2740 /* Run the array and install devices as appropriate */
2741 for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) {
2742 if (apq8064_i2c_devices[i].machs & mach_mask)
2743 i2c_register_board_info(apq8064_i2c_devices[i].bus,
2744 apq8064_i2c_devices[i].info,
2745 apq8064_i2c_devices[i].len);
2746 }
Kevin Chand07220e2012-02-13 15:52:22 -08002747#ifdef CONFIG_MSM_CAMERA
2748 if (apq8064_camera_i2c_devices.machs & mach_mask)
2749 i2c_register_board_info(apq8064_camera_i2c_devices.bus,
2750 apq8064_camera_i2c_devices.info,
2751 apq8064_camera_i2c_devices.len);
2752#endif
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002753
2754 for (i = 0; i < ARRAY_SIZE(mpq8064_i2c_devices); ++i) {
2755 if (mpq8064_i2c_devices[i].machs & mach_mask)
2756 i2c_register_board_info(
2757 mpq8064_i2c_devices[i].bus,
2758 mpq8064_i2c_devices[i].info,
2759 mpq8064_i2c_devices[i].len);
2760 }
Jing Lin417fa452012-02-05 14:31:06 -08002761}
2762
Jay Chokshi994ff122012-03-27 15:43:48 -07002763static void enable_ddr3_regulator(void)
2764{
2765 static struct regulator *ext_ddr3;
2766
2767 /* Use MPP7 output state as a flag for PCDDR3 presence. */
2768 if (gpio_get_value_cansleep(PM8921_MPP_PM_TO_SYS(7)) > 0) {
2769 ext_ddr3 = regulator_get(NULL, "ext_ddr3");
2770 if (IS_ERR(ext_ddr3) || ext_ddr3 == NULL)
2771 pr_err("Could not get MPP7 regulator\n");
2772 else
2773 regulator_enable(ext_ddr3);
2774 }
2775}
2776
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002777static void enable_avc_i2c_bus(void)
2778{
2779 int avc_i2c_en_mpp = PM8921_MPP_PM_TO_SYS(8);
2780 int rc;
2781
2782 rc = gpio_request(avc_i2c_en_mpp, "avc_i2c_en");
2783 if (rc)
2784 pr_err("request for avc_i2c_en mpp failed,"
2785 "rc=%d\n", rc);
2786 else
2787 gpio_set_value_cansleep(avc_i2c_en_mpp, 1);
2788}
2789
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002790static void __init apq8064_common_init(void)
2791{
Joel King8f839b92012-04-01 14:37:46 -07002792 msm_tsens_early_init(&apq_tsens_pdata);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002793 if (socinfo_init() < 0)
2794 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06002795 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
2796 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
David Collins2782b5c2012-02-06 10:02:42 -08002797 regulator_suppress_info_printing();
2798 platform_device_register(&apq8064_device_rpm_regulator);
Stephen Boyd4d0d2582012-02-10 14:49:40 -08002799 if (msm_xo_init())
2800 pr_err("Failed to initialize XO votes\n");
Matt Wagantallc51e5602012-02-27 17:25:25 -08002801 msm_clock_init(&apq8064_clock_init_data);
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08002802 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06002803 apq8064_i2c_init();
Jing Lin417fa452012-02-05 14:31:06 -08002804 register_i2c_devices();
Kenneth Heitke36920d32011-07-20 16:44:30 -06002805
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002806 apq8064_device_qup_spi_gsbi5.dev.platform_data =
2807 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08002808 apq8064_init_pmic();
Hemant Kumar94e7da22012-02-03 16:52:29 -08002809 if (machine_is_apq8064_liquid())
2810 msm_otg_pdata.mhl_enable = true;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07002811
Ofir Cohen94213a72012-05-03 14:26:32 +03002812 android_usb_pdata.swfi_latency =
2813 msm_rpmrs_levels[0].latency_us;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07002814
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002815 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Manu Gautam91223e02011-11-08 15:27:22 +05302816 apq8064_ehci_host_init();
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002817 apq8064_init_buses();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002818 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Terence Hampson36b70722012-05-10 13:18:16 -04002819 if (!(machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
2820 machine_is_mpq8064_dtv()))
2821 platform_add_devices(common_not_mpq_devices,
2822 ARRAY_SIZE(common_not_mpq_devices));
Jay Chokshi994ff122012-03-27 15:43:48 -07002823 enable_ddr3_regulator();
Hemant Kumarf1ca9192012-02-07 18:59:33 -08002824 if (machine_is_apq8064_mtp()) {
2825 apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
2826 device_initialize(&apq8064_device_hsic_host.dev);
2827 }
Jay Chokshie8741282012-01-25 15:22:55 -08002828 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05302829 apq8064_init_mmc();
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08002830
2831 if (machine_is_apq8064_mtp()) {
2832 mdm_8064_device.dev.platform_data = &mdm_platform_data;
2833 platform_device_register(&mdm_8064_device);
2834 }
2835 platform_device_register(&apq8064_slim_ctrl);
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002836 slim_register_board_info(apq8064_slim_devices,
2837 ARRAY_SIZE(apq8064_slim_devices));
Jin Hongd3024e62012-02-09 16:13:32 -08002838 apq8064_init_dsps();
Praveen Chidambaram78499012011-11-01 17:15:17 -06002839 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Mahesh Sivasubramaniancbce1ec2012-01-24 10:32:44 -07002840 acpuclk_init(&acpuclk_8064_soc_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002841 msm_spm_l2_init(msm_spm_l2_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002842 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Praveen Chidambaram4d19be42012-04-03 18:05:52 -06002843 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002844 apq8064_epm_adc_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002845}
2846
Huaibin Yang4a084e32011-12-15 15:25:52 -08002847static void __init apq8064_allocate_memory_regions(void)
2848{
2849 apq8064_allocate_fb_region();
2850}
2851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002852static void __init apq8064_sim_init(void)
2853{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002854 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
2855 &msm8064_device_watchdog.dev.platform_data;
2856
2857 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002858 apq8064_common_init();
Joel King4e7ad222011-08-17 15:47:38 -07002859 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
2860}
2861
2862static void __init apq8064_rumi3_init(void)
2863{
2864 apq8064_common_init();
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002865 ethernet_init();
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002866 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002867 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002868}
2869
Joel King82b7e3f2012-01-05 10:03:27 -08002870static void __init apq8064_cdp_init(void)
2871{
Hanumant Singh50440d42012-04-23 19:27:16 -07002872 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2873 pr_err("meminfo_init() failed!\n");
Joel King82b7e3f2012-01-05 10:03:27 -08002874 apq8064_common_init();
Joel King8f839b92012-04-01 14:37:46 -07002875 if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
2876 machine_is_mpq8064_dtv()) {
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002877 enable_avc_i2c_bus();
Joel King8f839b92012-04-01 14:37:46 -07002878 platform_add_devices(mpq_devices, ARRAY_SIZE(mpq_devices));
2879 } else {
2880 ethernet_init();
2881 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
2882 spi_register_board_info(spi_board_info,
2883 ARRAY_SIZE(spi_board_info));
2884 }
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002885 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07002886 apq8064_init_gpu();
Matt Wagantall1f65d9d2012-04-25 14:24:20 -07002887 platform_add_devices(apq8064_footswitch, apq8064_num_footswitch);
Kevin Chand07220e2012-02-13 15:52:22 -08002888 apq8064_init_cam();
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302889
2890 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
2891 platform_device_register(&cdp_kp_pdev);
2892
2893 if (machine_is_apq8064_mtp())
2894 platform_device_register(&mtp_kp_pdev);
Hanumant Singh50440d42012-04-23 19:27:16 -07002895
2896 change_memory_power = &apq8064_change_memory_power;
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05302897
2898 if (machine_is_mpq8064_cdp()) {
2899 platform_device_register(&mpq_gpio_keys_pdev);
2900 platform_device_register(&mpq_keypad_device);
2901 }
Joel King82b7e3f2012-01-05 10:03:27 -08002902}
2903
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002904MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
2905 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002906 .reserve = apq8064_reserve,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002907 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302908 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002909 .timer = &msm_timer,
2910 .init_machine = apq8064_sim_init,
2911MACHINE_END
2912
Joel King4e7ad222011-08-17 15:47:38 -07002913MACHINE_START(APQ8064_RUMI3, "QCT APQ8064 RUMI3")
2914 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002915 .reserve = apq8064_reserve,
Joel King4e7ad222011-08-17 15:47:38 -07002916 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302917 .handle_irq = gic_handle_irq,
Joel King4e7ad222011-08-17 15:47:38 -07002918 .timer = &msm_timer,
2919 .init_machine = apq8064_rumi3_init,
Huaibin Yang4a084e32011-12-15 15:25:52 -08002920 .init_early = apq8064_allocate_memory_regions,
Joel King4e7ad222011-08-17 15:47:38 -07002921MACHINE_END
2922
Joel King82b7e3f2012-01-05 10:03:27 -08002923MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
2924 .map_io = apq8064_map_io,
2925 .reserve = apq8064_reserve,
2926 .init_irq = apq8064_init_irq,
2927 .handle_irq = gic_handle_irq,
2928 .timer = &msm_timer,
2929 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002930 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07002931 .init_very_early = apq8064_early_reserve,
Joel King82b7e3f2012-01-05 10:03:27 -08002932MACHINE_END
2933
2934MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
2935 .map_io = apq8064_map_io,
2936 .reserve = apq8064_reserve,
2937 .init_irq = apq8064_init_irq,
2938 .handle_irq = gic_handle_irq,
2939 .timer = &msm_timer,
2940 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002941 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07002942 .init_very_early = apq8064_early_reserve,
Joel King82b7e3f2012-01-05 10:03:27 -08002943MACHINE_END
2944
2945MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
2946 .map_io = apq8064_map_io,
2947 .reserve = apq8064_reserve,
2948 .init_irq = apq8064_init_irq,
2949 .handle_irq = gic_handle_irq,
2950 .timer = &msm_timer,
2951 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002952 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07002953 .init_very_early = apq8064_early_reserve,
Joel King82b7e3f2012-01-05 10:03:27 -08002954MACHINE_END
2955
Joel King064bbf82012-04-01 13:23:39 -07002956MACHINE_START(MPQ8064_CDP, "QCT MPQ8064 CDP")
2957 .map_io = apq8064_map_io,
2958 .reserve = apq8064_reserve,
2959 .init_irq = apq8064_init_irq,
2960 .handle_irq = gic_handle_irq,
2961 .timer = &msm_timer,
2962 .init_machine = apq8064_cdp_init,
2963 .init_early = apq8064_allocate_memory_regions,
2964 .init_very_early = apq8064_early_reserve,
2965MACHINE_END
2966
Joel King11ca8202012-02-13 16:19:03 -08002967MACHINE_START(MPQ8064_HRD, "QCT MPQ8064 HRD")
2968 .map_io = apq8064_map_io,
2969 .reserve = apq8064_reserve,
2970 .init_irq = apq8064_init_irq,
2971 .handle_irq = gic_handle_irq,
2972 .timer = &msm_timer,
2973 .init_machine = apq8064_cdp_init,
Laura Abbott6988cef2012-03-15 14:27:13 -07002974 .init_very_early = apq8064_early_reserve,
Joel King11ca8202012-02-13 16:19:03 -08002975MACHINE_END
2976
2977MACHINE_START(MPQ8064_DTV, "QCT MPQ8064 DTV")
2978 .map_io = apq8064_map_io,
2979 .reserve = apq8064_reserve,
2980 .init_irq = apq8064_init_irq,
2981 .handle_irq = gic_handle_irq,
2982 .timer = &msm_timer,
2983 .init_machine = apq8064_cdp_init,
Laura Abbott6988cef2012-03-15 14:27:13 -07002984 .init_very_early = apq8064_early_reserve,
Joel King11ca8202012-02-13 16:19:03 -08002985MACHINE_END
2986