blob: e4958f5f050508b165c3452833b67237033222d8 [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>
Steve Mucklef132c6c2012-06-06 18:30:57 -070015#include <linux/gpio.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070016#include <linux/io.h>
17#include <linux/irq.h>
Kenneth Heitke748593a2011-07-15 15:45:11 -060018#include <linux/i2c.h>
David Keitel2f613d92012-02-15 11:29:16 -080019#include <linux/i2c/smb349.h>
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -080020#include <linux/i2c/sx150x.h>
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -060021#include <linux/slimbus/slimbus.h>
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +053022#include <linux/mfd/wcd9xxx/core.h>
23#include <linux/mfd/wcd9xxx/pdata.h>
Amy Maloche70090f992012-02-16 16:35:26 -080024#include <linux/mfd/pm8xxx/misc.h>
Kenneth Heitke36920d32011-07-20 16:44:30 -060025#include <linux/msm_ssbi.h>
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -070026#include <linux/spi/spi.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070027#include <linux/dma-mapping.h>
28#include <linux/platform_data/qcom_crypto_device.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080029#include <linux/ion.h>
Jack Cheung46bfffa2012-01-19 15:26:24 -080030#include <linux/memory.h>
Larry Bassel67b921d2012-04-06 10:23:27 -070031#include <linux/memblock.h>
Praveen Chidambaram877d7a42012-06-05 14:33:20 -060032#include <linux/msm_thermal.h>
Jing Lin21ed4de2012-02-05 15:53:28 -080033#include <linux/i2c/atmel_mxt_ts.h>
Steve Mucklef132c6c2012-06-06 18:30:57 -070034#include <linux/cyttsp-qc.h>
Amy Maloche70090f992012-02-16 16:35:26 -080035#include <linux/i2c/isa1200.h>
Mohan Pallaka474b94b2012-01-25 12:59:58 +053036#include <linux/gpio_keys.h>
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -080037#include <linux/epm_adc.h>
Jay Chokshie7d8d4f2012-04-04 14:47:57 -070038#include <linux/i2c/sx150x.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070039#include <asm/mach-types.h>
40#include <asm/mach/arch.h>
41#include <asm/hardware/gic.h>
Sahitya Tummala3586ed92011-08-03 09:13:23 +053042#include <asm/mach/mmc.h>
Ankit Verma6b7e2ba2012-01-26 15:48:54 -080043#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070044
45#include <mach/board.h>
46#include <mach/msm_iomap.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080047#include <mach/ion.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070048#include <linux/usb/msm_hsusb.h>
49#include <linux/usb/android.h>
50#include <mach/socinfo.h>
Harini Jayaramanc4c58692011-07-19 14:50:10 -060051#include <mach/msm_spi.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070052#include "timer.h"
53#include "devices.h"
Joel King4ebccc62011-07-22 09:43:22 -070054#include <mach/gpiomux.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060055#include <mach/rpm.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080056#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -070057#include <linux/android_pmem.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080058#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070059#include <mach/msm_memtypes.h>
60#include <linux/bootmem.h>
61#include <asm/setup.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070062#include <mach/dma.h>
Jin Hongd3024e62012-02-09 16:13:32 -080063#include <mach/msm_dsps.h>
Gagan Mac8a7a5d32011-11-11 16:43:06 -070064#include <mach/msm_bus_board.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060065#include <mach/cpuidle.h>
Joel Kingdacbc822012-01-25 13:30:57 -080066#include <mach/mdm2.h>
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -080067#include <linux/msm_tsens.h>
Stephen Boyd4d0d2582012-02-10 14:49:40 -080068#include <mach/msm_xo.h>
Laura Abbott350c8362012-02-28 14:46:52 -080069#include <mach/msm_rtb.h>
Santosh Mardieff9a742012-04-09 23:23:39 +053070#include <sound/cs8427.h>
Ravi Kumar V05931a22012-04-04 17:09:37 +053071#include <media/gpio-ir-recv.h>
Larry Bassel67b921d2012-04-06 10:23:27 -070072#include <linux/fmem.h>
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -060073#include <mach/msm_pcie.h>
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -070074#include <mach/restart.h>
Joel King4ebccc62011-07-22 09:43:22 -070075
Jeff Ohlstein7e668552011-10-06 16:17:25 -070076#include "msm_watchdog.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080077#include "board-8064.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060078#include "spm.h"
Subhash Jadavani909e04f2012-04-12 10:52:50 +053079#include <mach/mpm.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060080#include "rpm_resources.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080081#include "pm.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060082#include "pm-boot.h"
Rajesh Sastrulaaee8af32012-01-20 11:46:31 -080083#include "devices-msm8x60.h"
Hanumant Singh50440d42012-04-23 19:27:16 -070084#include "smd_private.h"
Jay Chokshiea67c622011-07-29 17:12:26 -070085
Olav Haugan7c6aa742012-01-16 16:47:37 -080086#define MSM_PMEM_ADSP_SIZE 0x7800000
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -070087#define MSM_PMEM_AUDIO_SIZE 0x4CF000
Olav Haugan7c6aa742012-01-16 16:47:37 -080088#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
89#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
90#else
Chetan Kalyan72aac4f2012-02-23 14:56:54 -080091#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Olav Haugan7c6aa742012-01-16 16:47:37 -080092#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070093
Olav Haugan7c6aa742012-01-16 16:47:37 -080094#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Hanumant Singheadb7502012-05-15 18:14:04 -070095#define HOLE_SIZE 0x20000
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -070096#define MSM_PMEM_KERNEL_EBI1_SIZE 0x65000
Olav Haugan129992c2012-03-22 09:54:01 -070097#ifdef CONFIG_MSM_IOMMU
98#define MSM_ION_MM_SIZE 0x3800000
99#define MSM_ION_SF_SIZE 0
Olav Haugan39477bb2012-05-14 16:05:36 -0700100#define MSM_ION_QSECOM_SIZE 0x780000 /* (7.5MB) */
Olav Haugan129992c2012-03-22 09:54:01 -0700101#define MSM_ION_HEAP_NUM 7
102#else
Olav Haugan7c6aa742012-01-16 16:47:37 -0800103#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Haugan129992c2012-03-22 09:54:01 -0700104#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Haugan39477bb2012-05-14 16:05:36 -0700105#define MSM_ION_QSECOM_SIZE 0x600000 /* (6MB) */
Olav Haugan129992c2012-03-22 09:54:01 -0700106#define MSM_ION_HEAP_NUM 8
107#endif
Hanumant Singheadb7502012-05-15 18:14:04 -0700108#define MSM_ION_MM_FW_SIZE (0x200000 - HOLE_SIZE) /* (2MB - 128KB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800109#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan2c43fac2012-01-19 11:06:37 -0800110#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Olav Haugan7c6aa742012-01-16 16:47:37 -0800111#else
112#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
113#define MSM_ION_HEAP_NUM 1
114#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700115
Hanumant Singheadb7502012-05-15 18:14:04 -0700116#define APQ8064_FIXED_AREA_START (0xa0000000 - (MSM_ION_MM_FW_SIZE + \
117 HOLE_SIZE))
Larry Bassel67b921d2012-04-06 10:23:27 -0700118#define MAX_FIXED_AREA_SIZE 0x10000000
Hanumant Singheadb7502012-05-15 18:14:04 -0700119#define MSM_MM_FW_SIZE (0x200000 - HOLE_SIZE)
120#define APQ8064_FW_START APQ8064_FIXED_AREA_START
Larry Bassel67b921d2012-04-06 10:23:27 -0700121
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -0600122/* PCIe power enable pmic gpio */
123#define PCIE_PWR_EN_PMIC_GPIO 13
124#define PCIE_RST_N_PMIC_MPP 1
125
Olav Haugan7c6aa742012-01-16 16:47:37 -0800126#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
127static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
128static int __init pmem_kernel_ebi1_size_setup(char *p)
Kevin Chan13be4e22011-10-20 11:30:32 -0700129{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800130 pmem_kernel_ebi1_size = memparse(p, NULL);
131 return 0;
Kevin Chan13be4e22011-10-20 11:30:32 -0700132}
Olav Haugan7c6aa742012-01-16 16:47:37 -0800133early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
134#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700135
Olav Haugan7c6aa742012-01-16 16:47:37 -0800136#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -0700137static unsigned pmem_size = MSM_PMEM_SIZE;
138static int __init pmem_size_setup(char *p)
139{
140 pmem_size = memparse(p, NULL);
141 return 0;
142}
143early_param("pmem_size", pmem_size_setup);
144
145static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
146
147static int __init pmem_adsp_size_setup(char *p)
148{
149 pmem_adsp_size = memparse(p, NULL);
150 return 0;
151}
152early_param("pmem_adsp_size", pmem_adsp_size_setup);
153
154static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
155
156static int __init pmem_audio_size_setup(char *p)
157{
158 pmem_audio_size = memparse(p, NULL);
159 return 0;
160}
161early_param("pmem_audio_size", pmem_audio_size_setup);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800162#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700163
Olav Haugan7c6aa742012-01-16 16:47:37 -0800164#ifdef CONFIG_ANDROID_PMEM
165#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700166static struct android_pmem_platform_data android_pmem_pdata = {
167 .name = "pmem",
168 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
169 .cached = 1,
170 .memory_type = MEMTYPE_EBI1,
171};
172
Laura Abbottb93525f2012-04-12 09:57:19 -0700173static struct platform_device apq8064_android_pmem_device = {
Kevin Chan13be4e22011-10-20 11:30:32 -0700174 .name = "android_pmem",
175 .id = 0,
176 .dev = {.platform_data = &android_pmem_pdata},
177};
178
179static struct android_pmem_platform_data android_pmem_adsp_pdata = {
180 .name = "pmem_adsp",
181 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
182 .cached = 0,
183 .memory_type = MEMTYPE_EBI1,
184};
Laura Abbottb93525f2012-04-12 09:57:19 -0700185static struct platform_device apq8064_android_pmem_adsp_device = {
Kevin Chan13be4e22011-10-20 11:30:32 -0700186 .name = "android_pmem",
187 .id = 2,
188 .dev = { .platform_data = &android_pmem_adsp_pdata },
189};
190
191static struct android_pmem_platform_data android_pmem_audio_pdata = {
192 .name = "pmem_audio",
193 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
194 .cached = 0,
195 .memory_type = MEMTYPE_EBI1,
196};
197
Laura Abbottb93525f2012-04-12 09:57:19 -0700198static struct platform_device apq8064_android_pmem_audio_device = {
Kevin Chan13be4e22011-10-20 11:30:32 -0700199 .name = "android_pmem",
200 .id = 4,
201 .dev = { .platform_data = &android_pmem_audio_pdata },
202};
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700203#endif /* CONFIG_MSM_MULTIMEDIA_USE_ION */
204#endif /* CONFIG_ANDROID_PMEM */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800205
Larry Bassel67b921d2012-04-06 10:23:27 -0700206struct fmem_platform_data apq8064_fmem_pdata = {
207};
208
Olav Haugan7c6aa742012-01-16 16:47:37 -0800209static struct memtype_reserve apq8064_reserve_table[] __initdata = {
210 [MEMTYPE_SMI] = {
211 },
212 [MEMTYPE_EBI0] = {
213 .flags = MEMTYPE_FLAGS_1M_ALIGN,
214 },
215 [MEMTYPE_EBI1] = {
216 .flags = MEMTYPE_FLAGS_1M_ALIGN,
217 },
218};
Kevin Chan13be4e22011-10-20 11:30:32 -0700219
Laura Abbott350c8362012-02-28 14:46:52 -0800220static void __init reserve_rtb_memory(void)
221{
222#if defined(CONFIG_MSM_RTB)
Laura Abbottb93525f2012-04-12 09:57:19 -0700223 apq8064_reserve_table[MEMTYPE_EBI1].size += apq8064_rtb_pdata.size;
Laura Abbott350c8362012-02-28 14:46:52 -0800224#endif
225}
226
227
Kevin Chan13be4e22011-10-20 11:30:32 -0700228static void __init size_pmem_devices(void)
229{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800230#ifdef CONFIG_ANDROID_PMEM
231#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700232 android_pmem_adsp_pdata.size = pmem_adsp_size;
233 android_pmem_pdata.size = pmem_size;
234 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700235#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
236#endif /*CONFIG_ANDROID_PMEM*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700237}
238
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700239#ifdef CONFIG_ANDROID_PMEM
240#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700241static void __init reserve_memory_for(struct android_pmem_platform_data *p)
242{
243 apq8064_reserve_table[p->memory_type].size += p->size;
244}
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700245#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
246#endif /*CONFIG_ANDROID_PMEM*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700247
Kevin Chan13be4e22011-10-20 11:30:32 -0700248static void __init reserve_pmem_memory(void)
249{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800250#ifdef CONFIG_ANDROID_PMEM
251#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700252 reserve_memory_for(&android_pmem_adsp_pdata);
253 reserve_memory_for(&android_pmem_pdata);
254 reserve_memory_for(&android_pmem_audio_pdata);
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700255#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700256 apq8064_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700257#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -0800258}
259
260static int apq8064_paddr_to_memtype(unsigned int paddr)
261{
262 return MEMTYPE_EBI1;
263}
264
Steve Mucklef132c6c2012-06-06 18:30:57 -0700265#define FMEM_ENABLED 0
Larry Bassel67b921d2012-04-06 10:23:27 -0700266
Olav Haugan7c6aa742012-01-16 16:47:37 -0800267#ifdef CONFIG_ION_MSM
268#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -0700269static struct ion_cp_heap_pdata cp_mm_apq8064_ion_pdata = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800270 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugand3d29682012-01-19 10:57:07 -0800271 .align = PAGE_SIZE,
Larry Bassel67b921d2012-04-06 10:23:27 -0700272 .reusable = FMEM_ENABLED,
273 .mem_is_fmem = FMEM_ENABLED,
274 .fixed_position = FIXED_MIDDLE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800275};
276
Laura Abbottb93525f2012-04-12 09:57:19 -0700277static struct ion_cp_heap_pdata cp_mfc_apq8064_ion_pdata = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800278 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugand3d29682012-01-19 10:57:07 -0800279 .align = PAGE_SIZE,
Larry Bassel67b921d2012-04-06 10:23:27 -0700280 .reusable = 0,
281 .mem_is_fmem = FMEM_ENABLED,
282 .fixed_position = FIXED_HIGH,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800283};
284
Laura Abbottb93525f2012-04-12 09:57:19 -0700285static struct ion_co_heap_pdata co_apq8064_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800286 .adjacent_mem_id = INVALID_HEAP_ID,
287 .align = PAGE_SIZE,
Larry Bassel67b921d2012-04-06 10:23:27 -0700288 .mem_is_fmem = 0,
Olav Haugand3d29682012-01-19 10:57:07 -0800289};
290
Laura Abbottb93525f2012-04-12 09:57:19 -0700291static struct ion_co_heap_pdata fw_co_apq8064_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800292 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
293 .align = SZ_128K,
Larry Bassel67b921d2012-04-06 10:23:27 -0700294 .mem_is_fmem = FMEM_ENABLED,
295 .fixed_position = FIXED_LOW,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800296};
297#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800298
299/**
300 * These heaps are listed in the order they will be allocated. Due to
301 * video hardware restrictions and content protection the FW heap has to
302 * be allocated adjacent (below) the MM heap and the MFC heap has to be
303 * allocated after the MM heap to ensure MFC heap is not more than 256MB
304 * away from the base address of the FW heap.
305 * However, the order of FW heap and MM heap doesn't matter since these
306 * two heaps are taken care of by separate code to ensure they are adjacent
307 * to each other.
308 * Don't swap the order unless you know what you are doing!
309 */
Laura Abbottb93525f2012-04-12 09:57:19 -0700310static struct ion_platform_data apq8064_ion_pdata = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800311 .nr = MSM_ION_HEAP_NUM,
312 .heaps = {
313 {
314 .id = ION_SYSTEM_HEAP_ID,
315 .type = ION_HEAP_TYPE_SYSTEM,
316 .name = ION_VMALLOC_HEAP_NAME,
317 },
318#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
319 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800320 .id = ION_CP_MM_HEAP_ID,
321 .type = ION_HEAP_TYPE_CP,
322 .name = ION_MM_HEAP_NAME,
323 .size = MSM_ION_MM_SIZE,
324 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700325 .extra_data = (void *) &cp_mm_apq8064_ion_pdata,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800326 },
327 {
Olav Haugand3d29682012-01-19 10:57:07 -0800328 .id = ION_MM_FIRMWARE_HEAP_ID,
329 .type = ION_HEAP_TYPE_CARVEOUT,
330 .name = ION_MM_FIRMWARE_HEAP_NAME,
331 .size = MSM_ION_MM_FW_SIZE,
332 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700333 .extra_data = (void *) &fw_co_apq8064_ion_pdata,
Olav Haugand3d29682012-01-19 10:57:07 -0800334 },
335 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800336 .id = ION_CP_MFC_HEAP_ID,
337 .type = ION_HEAP_TYPE_CP,
338 .name = ION_MFC_HEAP_NAME,
339 .size = MSM_ION_MFC_SIZE,
340 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700341 .extra_data = (void *) &cp_mfc_apq8064_ion_pdata,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800342 },
Olav Haugan129992c2012-03-22 09:54:01 -0700343#ifndef CONFIG_MSM_IOMMU
Olav Haugan7c6aa742012-01-16 16:47:37 -0800344 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800345 .id = ION_SF_HEAP_ID,
346 .type = ION_HEAP_TYPE_CARVEOUT,
347 .name = ION_SF_HEAP_NAME,
348 .size = MSM_ION_SF_SIZE,
349 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700350 .extra_data = (void *) &co_apq8064_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800351 },
Olav Haugan129992c2012-03-22 09:54:01 -0700352#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800353 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800354 .id = ION_IOMMU_HEAP_ID,
355 .type = ION_HEAP_TYPE_IOMMU,
356 .name = ION_IOMMU_HEAP_NAME,
357 },
Olav Hauganf45e2142012-01-19 11:01:01 -0800358 {
359 .id = ION_QSECOM_HEAP_ID,
360 .type = ION_HEAP_TYPE_CARVEOUT,
361 .name = ION_QSECOM_HEAP_NAME,
362 .size = MSM_ION_QSECOM_SIZE,
363 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700364 .extra_data = (void *) &co_apq8064_ion_pdata,
Olav Hauganf45e2142012-01-19 11:01:01 -0800365 },
Olav Haugan2c43fac2012-01-19 11:06:37 -0800366 {
367 .id = ION_AUDIO_HEAP_ID,
368 .type = ION_HEAP_TYPE_CARVEOUT,
369 .name = ION_AUDIO_HEAP_NAME,
370 .size = MSM_ION_AUDIO_SIZE,
371 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700372 .extra_data = (void *) &co_apq8064_ion_pdata,
Olav Haugan2c43fac2012-01-19 11:06:37 -0800373 },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800374#endif
375 }
376};
377
Laura Abbottb93525f2012-04-12 09:57:19 -0700378static struct platform_device apq8064_ion_dev = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800379 .name = "ion-msm",
380 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700381 .dev = { .platform_data = &apq8064_ion_pdata },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800382};
383#endif
384
Larry Bassel67b921d2012-04-06 10:23:27 -0700385static struct platform_device apq8064_fmem_device = {
386 .name = "fmem",
387 .id = 1,
388 .dev = { .platform_data = &apq8064_fmem_pdata },
389};
390
391static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
392 unsigned long size)
393{
394 apq8064_reserve_table[mem_type].size += size;
395}
396
397static void __init apq8064_reserve_fixed_area(unsigned long fixed_area_size)
398{
399#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
400 int ret;
401
402 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
403 panic("fixed area size is larger than %dM\n",
404 MAX_FIXED_AREA_SIZE >> 20);
405
406 reserve_info->fixed_area_size = fixed_area_size;
407 reserve_info->fixed_area_start = APQ8064_FW_START;
408
409 ret = memblock_remove(reserve_info->fixed_area_start,
410 reserve_info->fixed_area_size);
411 BUG_ON(ret);
412#endif
413}
414
415/**
416 * Reserve memory for ION and calculate amount of reusable memory for fmem.
417 * We only reserve memory for heaps that are not reusable. However, we only
418 * support one reusable heap at the moment so we ignore the reusable flag for
419 * other than the first heap with reusable flag set. Also handle special case
420 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
421 * at a higher address than FW in addition to not more than 256MB away from the
422 * base address of the firmware. This means that if MM is reusable the other
423 * two heaps must be allocated in the same region as FW. This is handled by the
424 * mem_is_fmem flag in the platform data. In addition the MM heap must be
425 * adjacent to the FW heap for content protection purposes.
426 */
Stephen Boyd668d7652012-04-25 11:31:01 -0700427static void __init reserve_ion_memory(void)
Olav Haugan7c6aa742012-01-16 16:47:37 -0800428{
429#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Larry Bassel67b921d2012-04-06 10:23:27 -0700430 unsigned int i;
431 unsigned int reusable_count = 0;
432 unsigned int fixed_size = 0;
433 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
434 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
435
436 apq8064_fmem_pdata.size = 0;
437 apq8064_fmem_pdata.reserved_size_low = 0;
438 apq8064_fmem_pdata.reserved_size_high = 0;
Olav Haugan62436252012-05-16 09:09:43 -0700439 apq8064_fmem_pdata.align = PAGE_SIZE;
Larry Bassel67b921d2012-04-06 10:23:27 -0700440 fixed_low_size = 0;
441 fixed_middle_size = 0;
442 fixed_high_size = 0;
443
444 /* We only support 1 reusable heap. Check if more than one heap
445 * is specified as reusable and set as non-reusable if found.
446 */
447 for (i = 0; i < apq8064_ion_pdata.nr; ++i) {
448 const struct ion_platform_heap *heap =
449 &(apq8064_ion_pdata.heaps[i]);
450
451 if (heap->type == ION_HEAP_TYPE_CP && heap->extra_data) {
452 struct ion_cp_heap_pdata *data = heap->extra_data;
453
454 reusable_count += (data->reusable) ? 1 : 0;
455
456 if (data->reusable && reusable_count > 1) {
457 pr_err("%s: Too many heaps specified as "
458 "reusable. Heap %s was not configured "
459 "as reusable.\n", __func__, heap->name);
460 data->reusable = 0;
461 }
462 }
463 }
464
465 for (i = 0; i < apq8064_ion_pdata.nr; ++i) {
466 const struct ion_platform_heap *heap =
467 &(apq8064_ion_pdata.heaps[i]);
468
469 if (heap->extra_data) {
470 int fixed_position = NOT_FIXED;
471 int mem_is_fmem = 0;
472
473 switch (heap->type) {
474 case ION_HEAP_TYPE_CP:
475 mem_is_fmem = ((struct ion_cp_heap_pdata *)
476 heap->extra_data)->mem_is_fmem;
477 fixed_position = ((struct ion_cp_heap_pdata *)
478 heap->extra_data)->fixed_position;
479 break;
480 case ION_HEAP_TYPE_CARVEOUT:
481 mem_is_fmem = ((struct ion_co_heap_pdata *)
482 heap->extra_data)->mem_is_fmem;
483 fixed_position = ((struct ion_co_heap_pdata *)
484 heap->extra_data)->fixed_position;
485 break;
486 default:
487 break;
488 }
489
490 if (fixed_position != NOT_FIXED)
491 fixed_size += heap->size;
492 else
493 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
494
495 if (fixed_position == FIXED_LOW)
496 fixed_low_size += heap->size;
497 else if (fixed_position == FIXED_MIDDLE)
498 fixed_middle_size += heap->size;
499 else if (fixed_position == FIXED_HIGH)
500 fixed_high_size += heap->size;
501
502 if (mem_is_fmem)
503 apq8064_fmem_pdata.size += heap->size;
504 }
505 }
506
507 if (!fixed_size)
508 return;
509
510 if (apq8064_fmem_pdata.size) {
Hanumant Singheadb7502012-05-15 18:14:04 -0700511 apq8064_fmem_pdata.reserved_size_low = fixed_low_size +
512 HOLE_SIZE;
Larry Bassel67b921d2012-04-06 10:23:27 -0700513 apq8064_fmem_pdata.reserved_size_high = fixed_high_size;
514 }
515
516 /* Since the fixed area may be carved out of lowmem,
517 * make sure the length is a multiple of 1M.
518 */
Hanumant Singheadb7502012-05-15 18:14:04 -0700519 fixed_size = (fixed_size + HOLE_SIZE + SECTION_SIZE - 1)
Larry Bassel67b921d2012-04-06 10:23:27 -0700520 & SECTION_MASK;
521 apq8064_reserve_fixed_area(fixed_size);
522
523 fixed_low_start = APQ8064_FIXED_AREA_START;
Hanumant Singheadb7502012-05-15 18:14:04 -0700524 fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE;
Larry Bassel67b921d2012-04-06 10:23:27 -0700525 fixed_high_start = fixed_middle_start + fixed_middle_size;
526
527 for (i = 0; i < apq8064_ion_pdata.nr; ++i) {
528 struct ion_platform_heap *heap = &(apq8064_ion_pdata.heaps[i]);
529
530 if (heap->extra_data) {
531 int fixed_position = NOT_FIXED;
Steve Mucklef132c6c2012-06-06 18:30:57 -0700532 struct ion_cp_heap_pdata *pdata = NULL;
Larry Bassel67b921d2012-04-06 10:23:27 -0700533
534 switch (heap->type) {
535 case ION_HEAP_TYPE_CP:
Hanumant Singheadb7502012-05-15 18:14:04 -0700536 pdata =
537 (struct ion_cp_heap_pdata *)heap->extra_data;
538 fixed_position = pdata->fixed_position;
Larry Bassel67b921d2012-04-06 10:23:27 -0700539 break;
540 case ION_HEAP_TYPE_CARVEOUT:
541 fixed_position = ((struct ion_co_heap_pdata *)
542 heap->extra_data)->fixed_position;
543 break;
544 default:
545 break;
546 }
547
548 switch (fixed_position) {
549 case FIXED_LOW:
550 heap->base = fixed_low_start;
551 break;
552 case FIXED_MIDDLE:
553 heap->base = fixed_middle_start;
Hanumant Singheadb7502012-05-15 18:14:04 -0700554 pdata->secure_base = fixed_middle_start
555 - HOLE_SIZE;
556 pdata->secure_size = HOLE_SIZE + heap->size;
Larry Bassel67b921d2012-04-06 10:23:27 -0700557 break;
558 case FIXED_HIGH:
559 heap->base = fixed_high_start;
560 break;
561 default:
562 break;
563 }
564 }
565 }
Olav Haugan7c6aa742012-01-16 16:47:37 -0800566#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700567}
568
Huaibin Yang4a084e32011-12-15 15:25:52 -0800569static void __init reserve_mdp_memory(void)
570{
571 apq8064_mdp_writeback(apq8064_reserve_table);
572}
573
Laura Abbott93a4a352012-05-25 09:26:35 -0700574static void __init reserve_cache_dump_memory(void)
575{
576#ifdef CONFIG_MSM_CACHE_DUMP
577 unsigned int total;
578
579 total = apq8064_cache_dump_pdata.l1_size +
580 apq8064_cache_dump_pdata.l2_size;
581 apq8064_reserve_table[MEMTYPE_EBI1].size += total;
582#endif
583}
584
Kevin Chan13be4e22011-10-20 11:30:32 -0700585static void __init apq8064_calculate_reserve_sizes(void)
586{
587 size_pmem_devices();
588 reserve_pmem_memory();
Olav Haugan7c6aa742012-01-16 16:47:37 -0800589 reserve_ion_memory();
Huaibin Yang4a084e32011-12-15 15:25:52 -0800590 reserve_mdp_memory();
Laura Abbott350c8362012-02-28 14:46:52 -0800591 reserve_rtb_memory();
Laura Abbott93a4a352012-05-25 09:26:35 -0700592 reserve_cache_dump_memory();
Kevin Chan13be4e22011-10-20 11:30:32 -0700593}
594
595static struct reserve_info apq8064_reserve_info __initdata = {
596 .memtype_reserve_table = apq8064_reserve_table,
597 .calculate_reserve_sizes = apq8064_calculate_reserve_sizes,
Larry Bassel67b921d2012-04-06 10:23:27 -0700598 .reserve_fixed_area = apq8064_reserve_fixed_area,
Kevin Chan13be4e22011-10-20 11:30:32 -0700599 .paddr_to_memtype = apq8064_paddr_to_memtype,
600};
601
602static int apq8064_memory_bank_size(void)
603{
604 return 1<<29;
605}
606
607static void __init locate_unstable_memory(void)
608{
609 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
610 unsigned long bank_size;
611 unsigned long low, high;
612
613 bank_size = apq8064_memory_bank_size();
614 low = meminfo.bank[0].start;
615 high = mb->start + mb->size;
Olav Haugand76e3a82012-01-16 16:55:07 -0800616
617 /* Check if 32 bit overflow occured */
618 if (high < mb->start)
Larry Bassel67b921d2012-04-06 10:23:27 -0700619 high = -PAGE_SIZE;
Olav Haugand76e3a82012-01-16 16:55:07 -0800620
Kevin Chan13be4e22011-10-20 11:30:32 -0700621 low &= ~(bank_size - 1);
622
623 if (high - low <= bank_size)
Larry Bassel67b921d2012-04-06 10:23:27 -0700624 goto no_dmm;
625
626#ifdef CONFIG_ENABLE_DMM
Jack Cheung46bfffa2012-01-19 15:26:24 -0800627 apq8064_reserve_info.low_unstable_address = mb->start -
628 MIN_MEMORY_BLOCK_SIZE + mb->size;
629 apq8064_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
630
Kevin Chan13be4e22011-10-20 11:30:32 -0700631 apq8064_reserve_info.bank_size = bank_size;
632 pr_info("low unstable address %lx max size %lx bank size %lx\n",
633 apq8064_reserve_info.low_unstable_address,
634 apq8064_reserve_info.max_unstable_size,
635 apq8064_reserve_info.bank_size);
Larry Bassel67b921d2012-04-06 10:23:27 -0700636 return;
637#endif
638no_dmm:
639 apq8064_reserve_info.low_unstable_address = high;
640 apq8064_reserve_info.max_unstable_size = 0;
Kevin Chan13be4e22011-10-20 11:30:32 -0700641}
642
Hanumant Singh50440d42012-04-23 19:27:16 -0700643static int apq8064_change_memory_power(u64 start, u64 size,
644 int change_type)
645{
646 return soc_change_memory_power(start, size, change_type);
647}
648
Aravind Venkateswaran8ac7f412012-03-16 17:57:30 -0700649static char prim_panel_name[PANEL_NAME_MAX_LEN];
650static char ext_panel_name[PANEL_NAME_MAX_LEN];
651static int __init prim_display_setup(char *param)
652{
653 if (strnlen(param, PANEL_NAME_MAX_LEN))
654 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
655 return 0;
656}
657early_param("prim_display", prim_display_setup);
658
659static int __init ext_display_setup(char *param)
660{
661 if (strnlen(param, PANEL_NAME_MAX_LEN))
662 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
663 return 0;
664}
665early_param("ext_display", ext_display_setup);
666
Kevin Chan13be4e22011-10-20 11:30:32 -0700667static void __init apq8064_reserve(void)
668{
Aravind Venkateswaran8ac7f412012-03-16 17:57:30 -0700669 apq8064_set_display_params(prim_panel_name, ext_panel_name);
Kevin Chan13be4e22011-10-20 11:30:32 -0700670 msm_reserve();
Larry Bassel67b921d2012-04-06 10:23:27 -0700671 if (apq8064_fmem_pdata.size) {
672#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
673 if (reserve_info->fixed_area_size) {
674 apq8064_fmem_pdata.phys =
675 reserve_info->fixed_area_start + MSM_MM_FW_SIZE;
676 pr_info("mm fw at %lx (fixed) size %x\n",
677 reserve_info->fixed_area_start, MSM_MM_FW_SIZE);
678 pr_info("fmem start %lx (fixed) size %lx\n",
679 apq8064_fmem_pdata.phys,
680 apq8064_fmem_pdata.size);
681 }
682#endif
683 }
Kevin Chan13be4e22011-10-20 11:30:32 -0700684}
685
Laura Abbott6988cef2012-03-15 14:27:13 -0700686static void __init place_movable_zone(void)
687{
Larry Bassel67b921d2012-04-06 10:23:27 -0700688#ifdef CONFIG_ENABLE_DMM
Laura Abbott6988cef2012-03-15 14:27:13 -0700689 movable_reserved_start = apq8064_reserve_info.low_unstable_address;
690 movable_reserved_size = apq8064_reserve_info.max_unstable_size;
691 pr_info("movable zone start %lx size %lx\n",
692 movable_reserved_start, movable_reserved_size);
Larry Bassel67b921d2012-04-06 10:23:27 -0700693#endif
Laura Abbott6988cef2012-03-15 14:27:13 -0700694}
695
696static void __init apq8064_early_reserve(void)
697{
698 reserve_info = &apq8064_reserve_info;
699 locate_unstable_memory();
700 place_movable_zone();
701
702}
Hemant Kumara945b472012-01-25 15:08:06 -0800703#ifdef CONFIG_USB_EHCI_MSM_HSIC
Hemant Kumare6275972012-02-29 20:06:21 -0800704/* Bandwidth requests (zero) if no vote placed */
705static struct msm_bus_vectors hsic_init_vectors[] = {
706 {
707 .src = MSM_BUS_MASTER_SPS,
708 .dst = MSM_BUS_SLAVE_EBI_CH0,
709 .ab = 0,
710 .ib = 0,
711 },
712 {
713 .src = MSM_BUS_MASTER_SPS,
714 .dst = MSM_BUS_SLAVE_SPS,
715 .ab = 0,
716 .ib = 0,
717 },
718};
719
720/* Bus bandwidth requests in Bytes/sec */
721static struct msm_bus_vectors hsic_max_vectors[] = {
722 {
723 .src = MSM_BUS_MASTER_SPS,
724 .dst = MSM_BUS_SLAVE_EBI_CH0,
725 .ab = 60000000, /* At least 480Mbps on bus. */
726 .ib = 960000000, /* MAX bursts rate */
727 },
728 {
729 .src = MSM_BUS_MASTER_SPS,
730 .dst = MSM_BUS_SLAVE_SPS,
731 .ab = 0,
732 .ib = 512000000, /*vote for 64Mhz dfab clk rate*/
733 },
734};
735
736static struct msm_bus_paths hsic_bus_scale_usecases[] = {
737 {
738 ARRAY_SIZE(hsic_init_vectors),
739 hsic_init_vectors,
740 },
741 {
742 ARRAY_SIZE(hsic_max_vectors),
743 hsic_max_vectors,
744 },
745};
746
747static struct msm_bus_scale_pdata hsic_bus_scale_pdata = {
748 hsic_bus_scale_usecases,
749 ARRAY_SIZE(hsic_bus_scale_usecases),
750 .name = "hsic",
751};
752
Hemant Kumara945b472012-01-25 15:08:06 -0800753static struct msm_hsic_host_platform_data msm_hsic_pdata = {
Hemant Kumare6275972012-02-29 20:06:21 -0800754 .strobe = 88,
755 .data = 89,
756 .bus_scale_table = &hsic_bus_scale_pdata,
Hemant Kumara945b472012-01-25 15:08:06 -0800757};
758#else
759static struct msm_hsic_host_platform_data msm_hsic_pdata;
760#endif
761
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800762#define PID_MAGIC_ID 0x71432909
763#define SERIAL_NUM_MAGIC_ID 0x61945374
764#define SERIAL_NUMBER_LENGTH 127
765#define DLOAD_USB_BASE_ADD 0x2A03F0C8
766
767struct magic_num_struct {
768 uint32_t pid;
769 uint32_t serial_num;
770};
771
772struct dload_struct {
773 uint32_t reserved1;
774 uint32_t reserved2;
775 uint32_t reserved3;
776 uint16_t reserved4;
777 uint16_t pid;
778 char serial_number[SERIAL_NUMBER_LENGTH];
779 uint16_t reserved5;
780 struct magic_num_struct magic_struct;
781};
782
783static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
784{
785 struct dload_struct __iomem *dload = 0;
786
787 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
788 if (!dload) {
789 pr_err("%s: cannot remap I/O memory region: %08x\n",
790 __func__, DLOAD_USB_BASE_ADD);
791 return -ENXIO;
792 }
793
794 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
795 __func__, dload, pid, snum);
796 /* update pid */
797 dload->magic_struct.pid = PID_MAGIC_ID;
798 dload->pid = pid;
799
800 /* update serial number */
801 dload->magic_struct.serial_num = 0;
802 if (!snum) {
803 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
804 goto out;
805 }
806
807 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
808 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
809out:
810 iounmap(dload);
811 return 0;
812}
813
814static struct android_usb_platform_data android_usb_pdata = {
815 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
816};
817
Hemant Kumar4933b072011-10-17 23:43:11 -0700818static struct platform_device android_usb_device = {
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800819 .name = "android_usb",
820 .id = -1,
821 .dev = {
822 .platform_data = &android_usb_pdata,
823 },
Hemant Kumar4933b072011-10-17 23:43:11 -0700824};
825
Hemant Kumar7620eed2012-02-26 09:08:43 -0800826/* Bandwidth requests (zero) if no vote placed */
827static struct msm_bus_vectors usb_init_vectors[] = {
828 {
829 .src = MSM_BUS_MASTER_SPS,
830 .dst = MSM_BUS_SLAVE_EBI_CH0,
831 .ab = 0,
832 .ib = 0,
833 },
834};
835
836/* Bus bandwidth requests in Bytes/sec */
837static struct msm_bus_vectors usb_max_vectors[] = {
838 {
839 .src = MSM_BUS_MASTER_SPS,
840 .dst = MSM_BUS_SLAVE_EBI_CH0,
841 .ab = 60000000, /* At least 480Mbps on bus. */
842 .ib = 960000000, /* MAX bursts rate */
843 },
844};
845
846static struct msm_bus_paths usb_bus_scale_usecases[] = {
847 {
848 ARRAY_SIZE(usb_init_vectors),
849 usb_init_vectors,
850 },
851 {
852 ARRAY_SIZE(usb_max_vectors),
853 usb_max_vectors,
854 },
855};
856
857static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
858 usb_bus_scale_usecases,
859 ARRAY_SIZE(usb_bus_scale_usecases),
860 .name = "usb",
861};
862
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700863static int phy_init_seq[] = {
864 0x38, 0x81, /* update DC voltage level */
865 0x24, 0x82, /* set pre-emphasis and rise/fall time */
866 -1
867};
868
Hemant Kumar4933b072011-10-17 23:43:11 -0700869static struct msm_otg_platform_data msm_otg_pdata = {
Hemant Kumard86c4882012-01-24 19:39:37 -0800870 .mode = USB_OTG,
871 .otg_control = OTG_PMIC_CONTROL,
Hemant Kumar4933b072011-10-17 23:43:11 -0700872 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Hemant Kumard86c4882012-01-24 19:39:37 -0800873 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
874 .power_budget = 750,
Hemant Kumar7620eed2012-02-26 09:08:43 -0800875 .bus_scale_table = &usb_bus_scale_pdata,
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700876 .phy_init_seq = phy_init_seq,
Hemant Kumar4933b072011-10-17 23:43:11 -0700877};
878
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800879static struct msm_usb_host_platform_data msm_ehci_host_pdata3 = {
Manu Gautam91223e02011-11-08 15:27:22 +0530880 .power_budget = 500,
881};
882
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800883#ifdef CONFIG_USB_EHCI_MSM_HOST4
884static struct msm_usb_host_platform_data msm_ehci_host_pdata4;
885#endif
886
Manu Gautam91223e02011-11-08 15:27:22 +0530887static void __init apq8064_ehci_host_init(void)
888{
Chiranjeevi Velempatib822fa32012-05-23 22:05:59 +0530889 if (machine_is_apq8064_liquid() || machine_is_mpq8064_cdp() ||
890 machine_is_mpq8064_hrd() || machine_is_mpq8064_dtv()) {
891 if (machine_is_apq8064_liquid())
892 msm_ehci_host_pdata3.dock_connect_irq =
893 PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9);
Hemant Kumar56925352012-02-13 16:59:52 -0800894
Manu Gautam91223e02011-11-08 15:27:22 +0530895 apq8064_device_ehci_host3.dev.platform_data =
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800896 &msm_ehci_host_pdata3;
Manu Gautam91223e02011-11-08 15:27:22 +0530897 platform_device_register(&apq8064_device_ehci_host3);
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800898
899#ifdef CONFIG_USB_EHCI_MSM_HOST4
900 apq8064_device_ehci_host4.dev.platform_data =
901 &msm_ehci_host_pdata4;
902 platform_device_register(&apq8064_device_ehci_host4);
903#endif
Manu Gautam91223e02011-11-08 15:27:22 +0530904 }
905}
906
David Keitel2f613d92012-02-15 11:29:16 -0800907static struct smb349_platform_data smb349_data __initdata = {
908 .en_n_gpio = PM8921_GPIO_PM_TO_SYS(37),
909 .chg_susp_gpio = PM8921_GPIO_PM_TO_SYS(30),
910 .chg_current_ma = 2200,
911};
912
913static struct i2c_board_info smb349_charger_i2c_info[] __initdata = {
914 {
915 I2C_BOARD_INFO(SMB349_NAME, 0x1B),
916 .platform_data = &smb349_data,
917 },
918};
919
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -0800920struct sx150x_platform_data apq8064_sx150x_data[] = {
921 [SX150X_EPM] = {
922 .gpio_base = GPIO_EPM_EXPANDER_BASE,
923 .oscio_is_gpo = false,
924 .io_pullup_ena = 0x0,
925 .io_pulldn_ena = 0x0,
926 .io_open_drain_ena = 0x0,
927 .io_polarity = 0,
928 .irq_summary = -1,
929 },
930};
931
932static struct epm_chan_properties ads_adc_channel_data[] = {
933 {10, 100}, {500, 50}, {1, 1}, {1, 1},
934 {20, 50}, {10, 100}, {1, 1}, {1, 1},
935 {10, 100}, {10, 100}, {100, 100}, {200, 100},
936 {100, 50}, {2000, 50}, {1000, 50}, {200, 50},
937 {200, 100}, {1, 1}, {20, 50}, {500, 50},
938 {50, 50}, {200, 100}, {500, 100}, {20, 50},
939 {200, 50}, {2000, 100}, {1000, 50}, {100, 50},
940 {200, 100}, {500, 50}, {1000, 100}, {200, 50},
941 {1000, 50}, {50, 50}, {100, 50}, {100, 50},
942 {1, 1}, {1, 1}, {20, 100}, {20, 50},
943 {500, 100}, {1000, 100}, {100, 50}, {1000, 50},
944 {100, 50}, {1000, 100}, {100, 50}, {100, 50},
945};
946
947static struct epm_adc_platform_data epm_adc_pdata = {
948 .channel = ads_adc_channel_data,
949 .bus_id = 0x0,
950 .epm_i2c_board_info = {
951 .type = "sx1509q",
952 .addr = 0x3e,
953 .platform_data = &apq8064_sx150x_data[SX150X_EPM],
954 },
955 .gpio_expander_base_addr = GPIO_EPM_EXPANDER_BASE,
956};
957
958static struct platform_device epm_adc_device = {
959 .name = "epm_adc",
960 .id = -1,
961 .dev = {
962 .platform_data = &epm_adc_pdata,
963 },
964};
965
966static void __init apq8064_epm_adc_init(void)
967{
968 epm_adc_pdata.num_channels = 32;
969 epm_adc_pdata.num_adc = 2;
970 epm_adc_pdata.chan_per_adc = 16;
971 epm_adc_pdata.chan_per_mux = 8;
972};
973
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800974/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
975 * 4 micbiases are used to power various analog and digital
976 * microphones operating at 1800 mV. Technically, all micbiases
977 * can source from single cfilter since all microphones operate
978 * at the same voltage level. The arrangement below is to make
979 * sure all cfilters are exercised. LDO_H regulator ouput level
980 * does not need to be as high as 2.85V. It is choosen for
981 * microphone sensitivity purpose.
982 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530983static struct wcd9xxx_pdata apq8064_tabla_platform_data = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800984 .slimbus_slave_device = {
985 .name = "tabla-slave",
986 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
987 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800988 .irq = MSM_GPIO_TO_INT(42),
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800989 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530990 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800991 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
992 .micbias = {
993 .ldoh_v = TABLA_LDOH_2P85_V,
994 .cfilt1_mv = 1800,
995 .cfilt2_mv = 1800,
996 .cfilt3_mv = 1800,
997 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
998 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
999 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
1000 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301001 },
1002 .regulator = {
1003 {
1004 .name = "CDC_VDD_CP",
1005 .min_uV = 1800000,
1006 .max_uV = 1800000,
1007 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
1008 },
1009 {
1010 .name = "CDC_VDDA_RX",
1011 .min_uV = 1800000,
1012 .max_uV = 1800000,
1013 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
1014 },
1015 {
1016 .name = "CDC_VDDA_TX",
1017 .min_uV = 1800000,
1018 .max_uV = 1800000,
1019 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
1020 },
1021 {
1022 .name = "VDDIO_CDC",
1023 .min_uV = 1800000,
1024 .max_uV = 1800000,
1025 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1026 },
1027 {
1028 .name = "VDDD_CDC_D",
1029 .min_uV = 1225000,
David Collins62debe82012-06-06 17:01:03 -07001030 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301031 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1032 },
1033 {
1034 .name = "CDC_VDDA_A_1P2V",
1035 .min_uV = 1225000,
David Collins62debe82012-06-06 17:01:03 -07001036 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301037 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1038 },
1039 },
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001040};
1041
1042static struct slim_device apq8064_slim_tabla = {
1043 .name = "tabla-slim",
1044 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
1045 .dev = {
1046 .platform_data = &apq8064_tabla_platform_data,
1047 },
1048};
1049
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301050static struct wcd9xxx_pdata apq8064_tabla20_platform_data = {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001051 .slimbus_slave_device = {
1052 .name = "tabla-slave",
1053 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
1054 },
1055 .irq = MSM_GPIO_TO_INT(42),
1056 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301057 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001058 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
1059 .micbias = {
1060 .ldoh_v = TABLA_LDOH_2P85_V,
1061 .cfilt1_mv = 1800,
1062 .cfilt2_mv = 1800,
1063 .cfilt3_mv = 1800,
1064 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
1065 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
1066 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
1067 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301068 },
1069 .regulator = {
1070 {
1071 .name = "CDC_VDD_CP",
1072 .min_uV = 1800000,
1073 .max_uV = 1800000,
1074 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
1075 },
1076 {
1077 .name = "CDC_VDDA_RX",
1078 .min_uV = 1800000,
1079 .max_uV = 1800000,
1080 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
1081 },
1082 {
1083 .name = "CDC_VDDA_TX",
1084 .min_uV = 1800000,
1085 .max_uV = 1800000,
1086 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
1087 },
1088 {
1089 .name = "VDDIO_CDC",
1090 .min_uV = 1800000,
1091 .max_uV = 1800000,
1092 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1093 },
1094 {
1095 .name = "VDDD_CDC_D",
1096 .min_uV = 1225000,
David Collins62debe82012-06-06 17:01:03 -07001097 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301098 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1099 },
1100 {
1101 .name = "CDC_VDDA_A_1P2V",
1102 .min_uV = 1225000,
David Collins62debe82012-06-06 17:01:03 -07001103 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301104 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1105 },
1106 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001107};
1108
1109static struct slim_device apq8064_slim_tabla20 = {
1110 .name = "tabla2x-slim",
1111 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
1112 .dev = {
1113 .platform_data = &apq8064_tabla20_platform_data,
1114 },
1115};
1116
Santosh Mardi695be0d2012-04-10 23:21:12 +05301117/* enable the level shifter for cs8427 to make sure the I2C
1118 * clock is running at 100KHz and voltage levels are at 3.3
1119 * and 5 volts
1120 */
1121static int enable_100KHz_ls(int enable)
1122{
1123 int ret = 0;
1124 if (enable) {
1125 ret = gpio_request(SX150X_GPIO(1, 10),
1126 "cs8427_100KHZ_ENABLE");
1127 if (ret) {
1128 pr_err("%s: Failed to request gpio %d\n", __func__,
1129 SX150X_GPIO(1, 10));
1130 return ret;
1131 }
1132 gpio_direction_output(SX150X_GPIO(1, 10), 1);
1133 } else
1134 gpio_free(SX150X_GPIO(1, 10));
1135 return ret;
1136}
1137
Santosh Mardieff9a742012-04-09 23:23:39 +05301138static struct cs8427_platform_data cs8427_i2c_platform_data = {
1139 .irq = SX150X_GPIO(1, 4),
1140 .reset_gpio = SX150X_GPIO(1, 6),
Santosh Mardi695be0d2012-04-10 23:21:12 +05301141 .enable = enable_100KHz_ls,
Santosh Mardieff9a742012-04-09 23:23:39 +05301142};
1143
1144static struct i2c_board_info cs8427_device_info[] __initdata = {
1145 {
1146 I2C_BOARD_INFO("cs8427", CS8427_ADDR4),
1147 .platform_data = &cs8427_i2c_platform_data,
1148 },
1149};
1150
Amy Maloche70090f992012-02-16 16:35:26 -08001151#define HAP_SHIFT_LVL_OE_GPIO PM8921_MPP_PM_TO_SYS(8)
1152#define ISA1200_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1153#define ISA1200_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
1154#define ISA1200_HAP_CLK PM8921_GPIO_PM_TO_SYS(44)
1155
Mohan Pallaka2d877602012-05-11 13:07:30 +05301156static int isa1200_clk_enable(bool on)
Amy Maloche70090f992012-02-16 16:35:26 -08001157{
Amy Maloche8f973892012-03-26 14:53:13 -07001158 int rc = 0;
1159
Mohan Pallaka2d877602012-05-11 13:07:30 +05301160 gpio_set_value_cansleep(ISA1200_HAP_CLK, on);
Amy Maloche70090f992012-02-16 16:35:26 -08001161
Mohan Pallaka2d877602012-05-11 13:07:30 +05301162 if (on) {
Amy Maloche8f973892012-03-26 14:53:13 -07001163 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_1, true);
Mohan Pallaka2d877602012-05-11 13:07:30 +05301164 if (rc) {
1165 pr_err("%s: unable to write aux clock register(%d)\n",
1166 __func__, rc);
1167 goto err_gpio_dis;
1168 }
1169 } else {
Amy Maloche8f973892012-03-26 14:53:13 -07001170 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_NONE, true);
Mohan Pallaka2d877602012-05-11 13:07:30 +05301171 if (rc)
1172 pr_err("%s: unable to write aux clock register(%d)\n",
1173 __func__, rc);
Amy Maloche8f973892012-03-26 14:53:13 -07001174 }
1175
1176 return rc;
Mohan Pallaka2d877602012-05-11 13:07:30 +05301177
1178err_gpio_dis:
1179 gpio_set_value_cansleep(ISA1200_HAP_CLK, !on);
1180 return rc;
Amy Maloche70090f992012-02-16 16:35:26 -08001181}
1182
1183static int isa1200_dev_setup(bool enable)
1184{
1185 int rc = 0;
1186
Amy Maloche70090f992012-02-16 16:35:26 -08001187 if (!enable)
1188 goto free_gpio;
1189
1190 rc = gpio_request(ISA1200_HAP_CLK, "haptics_clk");
1191 if (rc) {
1192 pr_err("%s: unable to request gpio %d config(%d)\n",
1193 __func__, ISA1200_HAP_CLK, rc);
1194 return rc;
1195 }
1196
1197 rc = gpio_direction_output(ISA1200_HAP_CLK, 0);
1198 if (rc) {
1199 pr_err("%s: unable to set direction\n", __func__);
1200 goto free_gpio;
1201 }
1202
1203 return 0;
1204
1205free_gpio:
1206 gpio_free(ISA1200_HAP_CLK);
1207 return rc;
1208}
1209
1210static struct isa1200_regulator isa1200_reg_data[] = {
1211 {
1212 .name = "vddp",
1213 .min_uV = ISA_I2C_VTG_MIN_UV,
1214 .max_uV = ISA_I2C_VTG_MAX_UV,
1215 .load_uA = ISA_I2C_CURR_UA,
1216 },
1217};
1218
1219static struct isa1200_platform_data isa1200_1_pdata = {
1220 .name = "vibrator",
1221 .dev_setup = isa1200_dev_setup,
Mohan Pallaka2d877602012-05-11 13:07:30 +05301222 .clk_enable = isa1200_clk_enable,
Amy Maloche70090f992012-02-16 16:35:26 -08001223 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
1224 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
1225 .max_timeout = 15000,
1226 .mode_ctrl = PWM_GEN_MODE,
1227 .pwm_fd = {
1228 .pwm_div = 256,
1229 },
1230 .is_erm = false,
1231 .smart_en = true,
1232 .ext_clk_en = true,
1233 .chip_en = 1,
1234 .regulator_info = isa1200_reg_data,
1235 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1236};
1237
1238static struct i2c_board_info isa1200_board_info[] __initdata = {
1239 {
1240 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1241 .platform_data = &isa1200_1_pdata,
1242 },
1243};
Jing Lin21ed4de2012-02-05 15:53:28 -08001244/* configuration data for mxt1386e using V2.1 firmware */
1245static const u8 mxt1386e_config_data_v2_1[] = {
1246 /* T6 Object */
1247 0, 0, 0, 0, 0, 0,
1248 /* T38 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001249 14, 2, 0, 24, 5, 12, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001250 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1251 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1252 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1253 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1254 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1255 0, 0, 0, 0,
1256 /* T7 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001257 100, 10, 50,
Jing Lin21ed4de2012-02-05 15:53:28 -08001258 /* T8 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001259 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001260 /* T9 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001261 139, 0, 0, 26, 42, 0, 32, 80, 2, 5,
Jing Lin21ed4de2012-02-05 15:53:28 -08001262 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
Jing Linf1208fd2012-02-23 11:15:42 -08001263 85, 5, 0, 5, 9, 5, 12, 35, 70, 40,
1264 20, 5, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001265 /* T18 Object */
1266 0, 0,
1267 /* T24 Object */
1268 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1269 0, 0, 0, 0, 0, 0, 0, 0, 0,
1270 /* T25 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001271 1, 0, 60, 115, 156, 99,
Jing Lin21ed4de2012-02-05 15:53:28 -08001272 /* T27 Object */
1273 0, 0, 0, 0, 0, 0, 0,
1274 /* T40 Object */
1275 0, 0, 0, 0, 0,
1276 /* T42 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001277 0, 0, 255, 0, 255, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001278 /* T43 Object */
1279 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
1280 16,
1281 /* T46 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001282 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001283 /* T47 Object */
1284 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
1285 /* T48 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001286 1, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001287 32, 40, 0, 10, 10, 0, 0, 100, 10, 90,
1288 0, 0, 0, 0, 0, 0, 0, 10, 1, 10,
1289 52, 10, 12, 0, 33, 0, 1, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001290 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1291 0, 0, 0, 0,
1292 /* T56 Object */
1293 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1294 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1295 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1296 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001297 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1298 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001299};
1300
1301#define MXT_TS_GPIO_IRQ 6
1302#define MXT_TS_PWR_EN_GPIO PM8921_GPIO_PM_TO_SYS(23)
1303#define MXT_TS_RESET_GPIO 33
1304
1305static struct mxt_config_info mxt_config_array[] = {
1306 {
1307 .config = mxt1386e_config_data_v2_1,
1308 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1309 .family_id = 0xA0,
1310 .variant_id = 0x7,
1311 .version = 0x21,
1312 .build = 0xAA,
Jing Linef4aa9b2012-03-26 12:01:41 -07001313 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
1314 .fw_name = "atmel_8064_liquid_v2_2_AA.hex",
1315 },
1316 {
1317 /* The config data for V2.2.AA is the same as for V2.1.AA */
1318 .config = mxt1386e_config_data_v2_1,
1319 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1320 .family_id = 0xA0,
1321 .variant_id = 0x7,
1322 .version = 0x22,
1323 .build = 0xAA,
1324 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin21ed4de2012-02-05 15:53:28 -08001325 },
1326};
1327
1328static struct mxt_platform_data mxt_platform_data = {
1329 .config_array = mxt_config_array,
1330 .config_array_size = ARRAY_SIZE(mxt_config_array),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08001331 .panel_minx = 0,
1332 .panel_maxx = 1365,
1333 .panel_miny = 0,
1334 .panel_maxy = 767,
1335 .disp_minx = 0,
1336 .disp_maxx = 1365,
1337 .disp_miny = 0,
1338 .disp_maxy = 767,
Anirudh Ghayal39dbe3f2012-04-13 15:43:16 +05301339 .irqflags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
Jing Lin21ed4de2012-02-05 15:53:28 -08001340 .i2c_pull_up = true,
1341 .reset_gpio = MXT_TS_RESET_GPIO,
1342 .irq_gpio = MXT_TS_GPIO_IRQ,
1343};
1344
1345static struct i2c_board_info mxt_device_info[] __initdata = {
1346 {
1347 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
1348 .platform_data = &mxt_platform_data,
1349 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1350 },
1351};
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001352#define CYTTSP_TS_GPIO_IRQ 6
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001353#define CYTTSP_TS_GPIO_SLEEP 33
1354
1355static ssize_t tma340_vkeys_show(struct kobject *kobj,
1356 struct kobj_attribute *attr, char *buf)
1357{
1358 return snprintf(buf, 200,
1359 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1360 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1361 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1362 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1363 "\n");
1364}
1365
1366static struct kobj_attribute tma340_vkeys_attr = {
1367 .attr = {
1368 .mode = S_IRUGO,
1369 },
1370 .show = &tma340_vkeys_show,
1371};
1372
1373static struct attribute *tma340_properties_attrs[] = {
1374 &tma340_vkeys_attr.attr,
1375 NULL
1376};
1377
1378static struct attribute_group tma340_properties_attr_group = {
1379 .attrs = tma340_properties_attrs,
1380};
1381
1382static int cyttsp_platform_init(struct i2c_client *client)
1383{
1384 int rc = 0;
1385 static struct kobject *tma340_properties_kobj;
1386
1387 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1388 tma340_properties_kobj = kobject_create_and_add("board_properties",
1389 NULL);
1390 if (tma340_properties_kobj)
1391 rc = sysfs_create_group(tma340_properties_kobj,
1392 &tma340_properties_attr_group);
1393 if (!tma340_properties_kobj || rc)
1394 pr_err("%s: failed to create board_properties\n",
1395 __func__);
1396
1397 return 0;
1398}
1399
1400static struct cyttsp_regulator cyttsp_regulator_data[] = {
1401 {
1402 .name = "vdd",
1403 .min_uV = CY_TMA300_VTG_MIN_UV,
1404 .max_uV = CY_TMA300_VTG_MAX_UV,
1405 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1406 .lpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1407 },
1408 {
1409 .name = "vcc_i2c",
1410 .min_uV = CY_I2C_VTG_MIN_UV,
1411 .max_uV = CY_I2C_VTG_MAX_UV,
1412 .hpm_load_uA = CY_I2C_CURR_UA,
1413 .lpm_load_uA = CY_I2C_CURR_UA,
1414 },
1415};
1416
1417static struct cyttsp_platform_data cyttsp_pdata = {
1418 .panel_maxx = 634,
1419 .panel_maxy = 1166,
1420 .disp_maxx = 599,
1421 .disp_maxy = 1023,
1422 .disp_minx = 0,
1423 .disp_miny = 0,
1424 .flags = 0x01,
1425 .gen = CY_GEN3,
1426 .use_st = CY_USE_ST,
1427 .use_mt = CY_USE_MT,
1428 .use_hndshk = CY_SEND_HNDSHK,
1429 .use_trk_id = CY_USE_TRACKING_ID,
1430 .use_sleep = CY_USE_DEEP_SLEEP_SEL,
1431 .use_gestures = CY_USE_GESTURES,
1432 .fw_fname = "cyttsp_8064_mtp.hex",
1433 /* change act_intrvl to customize the Active power state
1434 * scanning/processing refresh interval for Operating mode
1435 */
1436 .act_intrvl = CY_ACT_INTRVL_DFLT,
1437 /* change tch_tmout to customize the touch timeout for the
1438 * Active power state for Operating mode
1439 */
1440 .tch_tmout = CY_TCH_TMOUT_DFLT,
1441 /* change lp_intrvl to customize the Low Power power state
1442 * scanning/processing refresh interval for Operating mode
1443 */
1444 .lp_intrvl = CY_LP_INTRVL_DFLT,
1445 .sleep_gpio = CYTTSP_TS_GPIO_SLEEP,
Amy Maloche9ba3ffe2012-04-26 10:31:20 -07001446 .resout_gpio = -1,
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001447 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1448 .regulator_info = cyttsp_regulator_data,
1449 .num_regulators = ARRAY_SIZE(cyttsp_regulator_data),
1450 .init = cyttsp_platform_init,
1451 .correct_fw_ver = 17,
1452};
1453
1454static struct i2c_board_info cyttsp_info[] __initdata = {
1455 {
1456 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1457 .platform_data = &cyttsp_pdata,
1458 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1459 },
1460};
Jing Lin21ed4de2012-02-05 15:53:28 -08001461
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001462#define MSM_WCNSS_PHYS 0x03000000
1463#define MSM_WCNSS_SIZE 0x280000
1464
1465static struct resource resources_wcnss_wlan[] = {
1466 {
1467 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1468 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1469 .name = "wcnss_wlanrx_irq",
1470 .flags = IORESOURCE_IRQ,
1471 },
1472 {
1473 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1474 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1475 .name = "wcnss_wlantx_irq",
1476 .flags = IORESOURCE_IRQ,
1477 },
1478 {
1479 .start = MSM_WCNSS_PHYS,
1480 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1481 .name = "wcnss_mmio",
1482 .flags = IORESOURCE_MEM,
1483 },
1484 {
1485 .start = 64,
1486 .end = 68,
1487 .name = "wcnss_gpios_5wire",
1488 .flags = IORESOURCE_IO,
1489 },
1490};
1491
1492static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1493 .has_48mhz_xo = 1,
1494};
1495
1496static struct platform_device msm_device_wcnss_wlan = {
1497 .name = "wcnss_wlan",
1498 .id = 0,
1499 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1500 .resource = resources_wcnss_wlan,
1501 .dev = {.platform_data = &qcom_wcnss_pdata},
1502};
1503
Ankit Vermab7c26e62012-02-28 15:04:15 -08001504static struct platform_device msm_device_iris_fm __devinitdata = {
1505 .name = "iris_fm",
1506 .id = -1,
1507};
1508
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001509#ifdef CONFIG_QSEECOM
1510/* qseecom bus scaling */
1511static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
1512 {
1513 .src = MSM_BUS_MASTER_SPS,
1514 .dst = MSM_BUS_SLAVE_EBI_CH0,
1515 .ib = 0,
1516 .ab = 0,
1517 },
1518 {
1519 .src = MSM_BUS_MASTER_SPDM,
1520 .dst = MSM_BUS_SLAVE_SPDM,
1521 .ib = 0,
1522 .ab = 0,
1523 },
1524};
1525
1526static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
1527 {
1528 .src = MSM_BUS_MASTER_SPS,
1529 .dst = MSM_BUS_SLAVE_EBI_CH0,
1530 .ib = (492 * 8) * 1000000UL,
1531 .ab = (492 * 8) * 100000UL,
1532 },
1533 {
1534 .src = MSM_BUS_MASTER_SPDM,
1535 .dst = MSM_BUS_SLAVE_SPDM,
1536 .ib = 0,
1537 .ab = 0,
1538 },
1539};
1540
1541static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1542 {
1543 .src = MSM_BUS_MASTER_SPS,
1544 .dst = MSM_BUS_SLAVE_EBI_CH0,
1545 .ib = 0,
1546 .ab = 0,
1547 },
1548 {
1549 .src = MSM_BUS_MASTER_SPDM,
1550 .dst = MSM_BUS_SLAVE_SPDM,
1551 .ib = (64 * 8) * 1000000UL,
1552 .ab = (64 * 8) * 100000UL,
1553 },
1554};
1555
1556static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1557 {
1558 ARRAY_SIZE(qseecom_clks_init_vectors),
1559 qseecom_clks_init_vectors,
1560 },
1561 {
1562 ARRAY_SIZE(qseecom_enable_dfab_vectors),
1563 qseecom_enable_sfpb_vectors,
1564 },
1565 {
1566 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1567 qseecom_enable_sfpb_vectors,
1568 },
1569};
1570
1571static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1572 qseecom_hw_bus_scale_usecases,
1573 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1574 .name = "qsee",
1575};
1576
1577static struct platform_device qseecom_device = {
1578 .name = "qseecom",
1579 .id = 0,
1580 .dev = {
1581 .platform_data = &qseecom_bus_pdata,
1582 },
1583};
1584#endif
1585
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001586#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1587 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1588 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1589 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1590
1591#define QCE_SIZE 0x10000
1592#define QCE_0_BASE 0x11000000
1593
1594#define QCE_HW_KEY_SUPPORT 0
1595#define QCE_SHA_HMAC_SUPPORT 1
1596#define QCE_SHARE_CE_RESOURCE 3
1597#define QCE_CE_SHARED 0
1598
1599static struct resource qcrypto_resources[] = {
1600 [0] = {
1601 .start = QCE_0_BASE,
1602 .end = QCE_0_BASE + QCE_SIZE - 1,
1603 .flags = IORESOURCE_MEM,
1604 },
1605 [1] = {
1606 .name = "crypto_channels",
1607 .start = DMOV8064_CE_IN_CHAN,
1608 .end = DMOV8064_CE_OUT_CHAN,
1609 .flags = IORESOURCE_DMA,
1610 },
1611 [2] = {
1612 .name = "crypto_crci_in",
1613 .start = DMOV8064_CE_IN_CRCI,
1614 .end = DMOV8064_CE_IN_CRCI,
1615 .flags = IORESOURCE_DMA,
1616 },
1617 [3] = {
1618 .name = "crypto_crci_out",
1619 .start = DMOV8064_CE_OUT_CRCI,
1620 .end = DMOV8064_CE_OUT_CRCI,
1621 .flags = IORESOURCE_DMA,
1622 },
1623};
1624
1625static struct resource qcedev_resources[] = {
1626 [0] = {
1627 .start = QCE_0_BASE,
1628 .end = QCE_0_BASE + QCE_SIZE - 1,
1629 .flags = IORESOURCE_MEM,
1630 },
1631 [1] = {
1632 .name = "crypto_channels",
1633 .start = DMOV8064_CE_IN_CHAN,
1634 .end = DMOV8064_CE_OUT_CHAN,
1635 .flags = IORESOURCE_DMA,
1636 },
1637 [2] = {
1638 .name = "crypto_crci_in",
1639 .start = DMOV8064_CE_IN_CRCI,
1640 .end = DMOV8064_CE_IN_CRCI,
1641 .flags = IORESOURCE_DMA,
1642 },
1643 [3] = {
1644 .name = "crypto_crci_out",
1645 .start = DMOV8064_CE_OUT_CRCI,
1646 .end = DMOV8064_CE_OUT_CRCI,
1647 .flags = IORESOURCE_DMA,
1648 },
1649};
1650
1651#endif
1652
1653#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1654 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1655
1656static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1657 .ce_shared = QCE_CE_SHARED,
1658 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1659 .hw_key_support = QCE_HW_KEY_SUPPORT,
1660 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001661 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001662};
1663
1664static struct platform_device qcrypto_device = {
1665 .name = "qcrypto",
1666 .id = 0,
1667 .num_resources = ARRAY_SIZE(qcrypto_resources),
1668 .resource = qcrypto_resources,
1669 .dev = {
1670 .coherent_dma_mask = DMA_BIT_MASK(32),
1671 .platform_data = &qcrypto_ce_hw_suppport,
1672 },
1673};
1674#endif
1675
1676#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1677 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1678
1679static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1680 .ce_shared = QCE_CE_SHARED,
1681 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1682 .hw_key_support = QCE_HW_KEY_SUPPORT,
1683 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001684 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001685};
1686
1687static struct platform_device qcedev_device = {
1688 .name = "qce",
1689 .id = 0,
1690 .num_resources = ARRAY_SIZE(qcedev_resources),
1691 .resource = qcedev_resources,
1692 .dev = {
1693 .coherent_dma_mask = DMA_BIT_MASK(32),
1694 .platform_data = &qcedev_ce_hw_suppport,
1695 },
1696};
1697#endif
1698
Joel Kingdacbc822012-01-25 13:30:57 -08001699static struct mdm_platform_data mdm_platform_data = {
1700 .mdm_version = "3.0",
1701 .ramdump_delay_ms = 2000,
Joel King14fe7fa2012-05-27 14:26:11 -07001702 .early_power_on = 1,
1703 .sfr_query = 1,
Hemant Kumara945b472012-01-25 15:08:06 -08001704 .peripheral_platform_device = &apq8064_device_hsic_host,
Joel Kingdacbc822012-01-25 13:30:57 -08001705};
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001706
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001707static struct tsens_platform_data apq_tsens_pdata = {
1708 .tsens_factor = 1000,
1709 .hw_type = APQ_8064,
1710 .tsens_num_sensor = 11,
1711 .slope = {1176, 1176, 1154, 1176, 1111,
1712 1132, 1132, 1199, 1132, 1199, 1132},
1713};
1714
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07001715static struct platform_device msm_tsens_device = {
1716 .name = "tsens8960-tm",
1717 .id = -1,
1718};
1719
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06001720static struct msm_thermal_data msm_thermal_pdata = {
1721 .sensor_id = 7,
1722 .poll_ms = 1000,
1723 .limit_temp = 60,
1724 .temp_hysteresis = 10,
1725 .limit_freq = 918000,
1726};
1727
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001728#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001729static void __init apq8064_map_io(void)
1730{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001731 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001732 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001733 if (socinfo_init() < 0)
1734 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001735}
1736
1737static void __init apq8064_init_irq(void)
1738{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001739 struct msm_mpm_device_data *data = NULL;
1740
1741#ifdef CONFIG_MSM_MPM
1742 data = &apq8064_mpm_dev_data;
1743#endif
1744
1745 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001746 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1747 (void *)MSM_QGIC_CPU_BASE);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001748}
1749
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001750static struct platform_device msm8064_device_saw_regulator_core0 = {
1751 .name = "saw-regulator",
1752 .id = 0,
1753 .dev = {
1754 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
1755 },
1756};
1757
1758static struct platform_device msm8064_device_saw_regulator_core1 = {
1759 .name = "saw-regulator",
1760 .id = 1,
1761 .dev = {
1762 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
1763 },
1764};
1765
1766static struct platform_device msm8064_device_saw_regulator_core2 = {
1767 .name = "saw-regulator",
1768 .id = 2,
1769 .dev = {
1770 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
1771 },
1772};
1773
1774static struct platform_device msm8064_device_saw_regulator_core3 = {
1775 .name = "saw-regulator",
1776 .id = 3,
1777 .dev = {
1778 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001779
1780 },
1781};
1782
Oluwafemi Adeyemif5a31422012-03-08 16:58:45 -08001783static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001784 {
1785 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1786 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1787 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001788 1, 784, 180000, 100,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001789 },
1790
1791 {
1792 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1793 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1794 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001795 1300, 228, 1200000, 2000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001796 },
1797
1798 {
1799 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1800 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1801 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001802 2000, 138, 1208400, 3200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001803 },
1804
1805 {
1806 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001807 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
1808 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001809 6000, 119, 1850300, 9000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001810 },
1811
1812 {
1813 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1814 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1815 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001816 9200, 68, 2839200, 16400,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001817 },
1818
1819 {
1820 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1821 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1822 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001823 10300, 63, 3128000, 18200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001824 },
1825
1826 {
1827 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1828 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1829 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001830 18000, 10, 4602600, 27000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001831 },
1832
1833 {
1834 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1835 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1836 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001837 20000, 2, 5752000, 32000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001838 },
1839};
1840
1841static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1842 .mode = MSM_PM_BOOT_CONFIG_TZ,
1843};
1844
1845static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
1846 .levels = &msm_rpmrs_levels[0],
1847 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
1848 .vdd_mem_levels = {
1849 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
1850 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
1851 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
1852 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
1853 },
1854 .vdd_dig_levels = {
1855 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
1856 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
1857 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
1858 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
1859 },
1860 .vdd_mask = 0x7FFFFF,
1861 .rpmrs_target_id = {
1862 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
1863 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
1864 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
1865 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
1866 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
1867 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
1868 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
1869 },
1870};
1871
Praveen Chidambaram78499012011-11-01 17:15:17 -06001872static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1873 0x03, 0x0f,
1874};
1875
1876static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1877 0x00, 0x24, 0x54, 0x10,
1878 0x09, 0x03, 0x01,
1879 0x10, 0x54, 0x30, 0x0C,
1880 0x24, 0x30, 0x0f,
1881};
1882
1883static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1884 0x00, 0x24, 0x54, 0x10,
1885 0x09, 0x07, 0x01, 0x0B,
1886 0x10, 0x54, 0x30, 0x0C,
1887 0x24, 0x30, 0x0f,
1888};
1889
1890static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1891 [0] = {
1892 .mode = MSM_SPM_MODE_CLOCK_GATING,
1893 .notify_rpm = false,
1894 .cmd = spm_wfi_cmd_sequence,
1895 },
1896 [1] = {
1897 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1898 .notify_rpm = false,
1899 .cmd = spm_power_collapse_without_rpm,
1900 },
1901 [2] = {
1902 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1903 .notify_rpm = true,
1904 .cmd = spm_power_collapse_with_rpm,
1905 },
1906};
1907
1908static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1909 0x00, 0x20, 0x03, 0x20,
1910 0x00, 0x0f,
1911};
1912
1913static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1914 0x00, 0x20, 0x34, 0x64,
1915 0x48, 0x07, 0x48, 0x20,
1916 0x50, 0x64, 0x04, 0x34,
1917 0x50, 0x0f,
1918};
1919static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1920 0x00, 0x10, 0x34, 0x64,
1921 0x48, 0x07, 0x48, 0x10,
1922 0x50, 0x64, 0x04, 0x34,
1923 0x50, 0x0F,
1924};
1925
1926static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1927 [0] = {
1928 .mode = MSM_SPM_L2_MODE_RETENTION,
1929 .notify_rpm = false,
1930 .cmd = l2_spm_wfi_cmd_sequence,
1931 },
1932 [1] = {
1933 .mode = MSM_SPM_L2_MODE_GDHS,
1934 .notify_rpm = true,
1935 .cmd = l2_spm_gdhs_cmd_sequence,
1936 },
1937 [2] = {
1938 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1939 .notify_rpm = true,
1940 .cmd = l2_spm_power_off_cmd_sequence,
1941 },
1942};
1943
1944
1945static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1946 [0] = {
1947 .reg_base_addr = MSM_SAW_L2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001948 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001949 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001950 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1951 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1952 .modes = msm_spm_l2_seq_list,
1953 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1954 },
1955};
1956
1957static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1958 [0] = {
1959 .reg_base_addr = MSM_SAW0_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001960 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001961#if defined(CONFIG_MSM_AVS_HW)
1962 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1963 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1964#endif
1965 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001966 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001967 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1968 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1969 .vctl_timeout_us = 50,
1970 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1971 .modes = msm_spm_seq_list,
1972 },
1973 [1] = {
1974 .reg_base_addr = MSM_SAW1_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001975 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001976#if defined(CONFIG_MSM_AVS_HW)
1977 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1978 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1979#endif
1980 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001981 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001982 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1983 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1984 .vctl_timeout_us = 50,
1985 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1986 .modes = msm_spm_seq_list,
1987 },
1988 [2] = {
1989 .reg_base_addr = MSM_SAW2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001990 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001991#if defined(CONFIG_MSM_AVS_HW)
1992 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1993 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1994#endif
1995 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001996 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001997 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1998 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1999 .vctl_timeout_us = 50,
2000 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2001 .modes = msm_spm_seq_list,
2002 },
2003 [3] = {
2004 .reg_base_addr = MSM_SAW3_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002005 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002006#if defined(CONFIG_MSM_AVS_HW)
2007 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2008 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2009#endif
2010 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07002011 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002012 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2013 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2014 .vctl_timeout_us = 50,
2015 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2016 .modes = msm_spm_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08002017 },
2018};
2019
Praveen Chidambaram4d19be42012-04-03 18:05:52 -06002020static struct msm_pm_sleep_status_data msm_pm_slp_sts_data = {
2021 .base_addr = MSM_ACC0_BASE + 0x08,
2022 .cpu_offset = MSM_ACC1_BASE - MSM_ACC0_BASE,
2023 .mask = 1UL << 13,
2024};
2025
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002026static void __init apq8064_init_buses(void)
2027{
2028 msm_bus_rpm_set_mt_mask();
2029 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
2030 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
2031 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
2032 msm_bus_8064_apps_fabric.dev.platform_data =
2033 &msm_bus_8064_apps_fabric_pdata;
2034 msm_bus_8064_sys_fabric.dev.platform_data =
2035 &msm_bus_8064_sys_fabric_pdata;
2036 msm_bus_8064_mm_fabric.dev.platform_data =
2037 &msm_bus_8064_mm_fabric_pdata;
2038 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
2039 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
2040}
2041
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002042/* PCIe gpios */
2043static struct msm_pcie_gpio_info_t msm_pcie_gpio_info[MSM_PCIE_MAX_GPIO] = {
2044 {"rst_n", PM8921_MPP_PM_TO_SYS(PCIE_RST_N_PMIC_MPP), 0},
2045 {"pwr_en", PM8921_GPIO_PM_TO_SYS(PCIE_PWR_EN_PMIC_GPIO), 1},
2046};
2047
2048static struct msm_pcie_platform msm_pcie_platform_data = {
2049 .gpio = msm_pcie_gpio_info,
2050};
2051
2052static void __init mpq8064_pcie_init(void)
2053{
2054 msm_device_pcie.dev.platform_data = &msm_pcie_platform_data;
2055 platform_device_register(&msm_device_pcie);
2056}
2057
David Collinsf0d00732012-01-25 15:46:50 -08002058static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
2059 .name = GPIO_REGULATOR_DEV_NAME,
2060 .id = PM8921_MPP_PM_TO_SYS(7),
2061 .dev = {
2062 .platform_data
2063 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2064 },
2065};
2066
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08002067static struct platform_device apq8064_device_ext_mpp8_vreg __devinitdata = {
2068 .name = GPIO_REGULATOR_DEV_NAME,
2069 .id = PM8921_MPP_PM_TO_SYS(8),
2070 .dev = {
2071 .platform_data
2072 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_MPP8],
2073 },
2074};
2075
David Collinsf0d00732012-01-25 15:46:50 -08002076static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
2077 .name = GPIO_REGULATOR_DEV_NAME,
2078 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
2079 .dev = {
2080 .platform_data =
2081 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2082 },
2083};
2084
David Collins390fc332012-02-07 14:38:16 -08002085static struct platform_device apq8064_device_ext_ts_sw_vreg __devinitdata = {
2086 .name = GPIO_REGULATOR_DEV_NAME,
2087 .id = PM8921_GPIO_PM_TO_SYS(23),
2088 .dev = {
2089 .platform_data
2090 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_TS_SW],
2091 },
2092};
2093
David Collins2782b5c2012-02-06 10:02:42 -08002094static struct platform_device apq8064_device_rpm_regulator __devinitdata = {
2095 .name = "rpm-regulator",
2096 .id = -1,
2097 .dev = {
2098 .platform_data = &apq8064_rpm_regulator_pdata,
2099 },
2100};
2101
Ravi Kumar V05931a22012-04-04 17:09:37 +05302102static struct gpio_ir_recv_platform_data gpio_ir_recv_pdata = {
2103 .gpio_nr = 88,
2104 .active_low = 1,
2105};
2106
2107static struct platform_device gpio_ir_recv_pdev = {
2108 .name = "gpio-rc-recv",
2109 .dev = {
2110 .platform_data = &gpio_ir_recv_pdata,
2111 },
2112};
2113
Terence Hampson36b70722012-05-10 13:18:16 -04002114static struct platform_device *common_not_mpq_devices[] __initdata = {
David Keitel3c40fc52012-02-09 17:53:52 -08002115 &apq8064_device_qup_i2c_gsbi1,
Jing Lin04601f92012-02-05 15:36:07 -08002116 &apq8064_device_qup_i2c_gsbi3,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002117 &apq8064_device_qup_i2c_gsbi4,
Terence Hampson36b70722012-05-10 13:18:16 -04002118};
2119
2120static struct platform_device *common_devices[] __initdata = {
Matt Wagantallbf430eb2012-03-22 11:45:49 -07002121 &msm8960_device_acpuclk,
Terence Hampson36b70722012-05-10 13:18:16 -04002122 &apq8064_device_dmov,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002123 &apq8064_device_qup_spi_gsbi5,
David Collinsf0d00732012-01-25 15:46:50 -08002124 &apq8064_device_ext_5v_vreg,
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08002125 &apq8064_device_ext_mpp8_vreg,
David Collinsf0d00732012-01-25 15:46:50 -08002126 &apq8064_device_ext_3p3v_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07002127 &apq8064_device_ssbi_pmic1,
2128 &apq8064_device_ssbi_pmic2,
Steve Mucklef132c6c2012-06-06 18:30:57 -07002129 &apq8064_device_ext_ts_sw_vreg,
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06002130 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07002131 &apq8064_device_otg,
2132 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08002133 &apq8064_device_hsusb_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07002134 &android_usb_device,
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08002135 &msm_device_wcnss_wlan,
Ankit Vermab7c26e62012-02-28 15:04:15 -08002136 &msm_device_iris_fm,
Larry Bassel67b921d2012-04-06 10:23:27 -07002137 &apq8064_fmem_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08002138#ifdef CONFIG_ANDROID_PMEM
2139#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002140 &apq8064_android_pmem_device,
2141 &apq8064_android_pmem_adsp_device,
2142 &apq8064_android_pmem_audio_device,
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -07002143#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
2144#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -08002145#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002146 &apq8064_ion_dev,
Olav Haugan7c6aa742012-01-16 16:47:37 -08002147#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002148 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08002149 &msm8064_device_saw_regulator_core0,
2150 &msm8064_device_saw_regulator_core1,
2151 &msm8064_device_saw_regulator_core2,
2152 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002153#if defined(CONFIG_QSEECOM)
2154 &qseecom_device,
2155#endif
2156
Ramesh Masavarapu28311912011-10-27 11:04:12 -07002157#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2158 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2159 &qcrypto_device,
2160#endif
2161
2162#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2163 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2164 &qcedev_device,
2165#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07002166
2167#ifdef CONFIG_HW_RANDOM_MSM
2168 &apq8064_device_rng,
2169#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002170 &apq_pcm,
2171 &apq_pcm_routing,
2172 &apq_cpudai0,
2173 &apq_cpudai1,
Santosh Mardieff9a742012-04-09 23:23:39 +05302174 &mpq_cpudai_sec_i2s_rx,
Kuirong Wangf23f8c52012-03-31 12:34:51 -07002175 &mpq_cpudai_mi2s_tx,
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002176 &apq_cpudai_hdmi_rx,
2177 &apq_cpudai_bt_rx,
2178 &apq_cpudai_bt_tx,
2179 &apq_cpudai_fm_rx,
2180 &apq_cpudai_fm_tx,
2181 &apq_cpu_fe,
2182 &apq_stub_codec,
2183 &apq_voice,
2184 &apq_voip,
2185 &apq_lpa_pcm,
Krishnankutty Kolathappilly4374e332012-03-18 22:27:30 -07002186 &apq_compr_dsp,
2187 &apq_multi_ch_pcm,
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002188 &apq_pcm_hostless,
2189 &apq_cpudai_afe_01_rx,
2190 &apq_cpudai_afe_01_tx,
2191 &apq_cpudai_afe_02_rx,
2192 &apq_cpudai_afe_02_tx,
2193 &apq_pcm_afe,
2194 &apq_cpudai_auxpcm_rx,
2195 &apq_cpudai_auxpcm_tx,
Neema Shetty8427c262012-02-16 11:23:43 -08002196 &apq_cpudai_stub,
Neema Shetty3c9d2862012-03-11 01:25:32 -08002197 &apq_cpudai_slimbus_1_rx,
2198 &apq_cpudai_slimbus_1_tx,
Kiran Kandi97fe19d2012-05-20 22:34:04 -07002199 &apq_cpudai_slimbus_2_rx,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002200 &apq_cpudai_slimbus_2_tx,
Neema Shettyc9d86c32012-05-09 12:01:39 -07002201 &apq_cpudai_slimbus_3_rx,
Helen Zeng38c3c962012-05-17 14:56:20 -07002202 &apq_cpudai_slimbus_3_tx,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002203 &apq8064_rpm_device,
2204 &apq8064_rpm_log_device,
2205 &apq8064_rpm_stat_device,
Ramesh Masavarapuf31ff242012-05-10 18:55:21 -07002206 &apq_device_tz_log,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002207 &msm_bus_8064_apps_fabric,
2208 &msm_bus_8064_sys_fabric,
2209 &msm_bus_8064_mm_fabric,
2210 &msm_bus_8064_sys_fpb,
2211 &msm_bus_8064_cpss_fpb,
Mohan Kumar Gubbihalli Lachma Naik7f72edd2012-02-06 17:26:47 -08002212 &apq8064_msm_device_vidc,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07002213 &msm_pil_dsps,
Matt Wagantalled832652012-02-02 19:23:17 -08002214 &msm_8960_riva,
Matt Wagantallb94b9a52012-02-02 21:59:54 -08002215 &msm_8960_q6_lpass,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002216 &msm_pil_vidc,
Matt Wagantall292aace2012-01-26 19:12:34 -08002217 &msm_gss,
Laura Abbottb93525f2012-04-12 09:57:19 -07002218 &apq8064_rtb_device,
Praveen Chidambaram8ea3dcd2011-12-07 14:46:31 -07002219 &apq8064_cpu_idle_device,
Praveen Chidambaram5c8adf22012-02-23 18:44:37 -07002220 &apq8064_msm_gov_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002221 &apq8064_device_cache_erp,
Stepan Moskovchenko0f3de112012-06-08 18:11:46 -07002222 &msm8960_device_ebi1_ch0_erp,
2223 &msm8960_device_ebi1_ch1_erp,
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002224 &epm_adc_device,
Pratik Patel212ab362012-03-16 12:30:07 -07002225 &apq8064_qdss_device,
2226 &msm_etb_device,
2227 &msm_tpiu_device,
2228 &msm_funnel_device,
2229 &apq8064_etm_device,
Helen Zeng8f925502012-03-05 16:50:17 -08002230 &apq_cpudai_slim_4_rx,
2231 &apq_cpudai_slim_4_tx,
Steve Mucklef132c6c2012-06-06 18:30:57 -07002232#ifdef CONFIG_MSM_GEMINI
Jignesh Mehta921649d2012-04-19 06:57:23 -07002233 &msm8960_gemini_device,
Steve Mucklef132c6c2012-06-06 18:30:57 -07002234#endif
Laura Abbott0577d7b2012-04-17 11:14:30 -07002235 &apq8064_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002236 &msm_tsens_device,
Laura Abbott93a4a352012-05-25 09:26:35 -07002237 &apq8064_cache_dump_device,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002238};
2239
Joel King4e7ad222011-08-17 15:47:38 -07002240static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002241 &apq8064_device_uart_gsbi3,
Yan He06913ce2011-08-26 16:33:46 -07002242 &msm_device_sps_apq8064,
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002243};
2244
2245static struct platform_device *rumi3_devices[] __initdata = {
2246 &apq8064_device_uart_gsbi1,
Yan He435ed612011-11-23 17:34:59 -08002247 &msm_device_sps_apq8064,
Huaibin Yang4a084e32011-12-15 15:25:52 -08002248#ifdef CONFIG_MSM_ROTATOR
2249 &msm_rotator_device,
2250#endif
Joel King4e7ad222011-08-17 15:47:38 -07002251};
2252
Joel King82b7e3f2012-01-05 10:03:27 -08002253static struct platform_device *cdp_devices[] __initdata = {
2254 &apq8064_device_uart_gsbi1,
Jin Hong4bbbfba2012-02-02 21:48:07 -08002255 &apq8064_device_uart_gsbi7,
Joel King82b7e3f2012-01-05 10:03:27 -08002256 &msm_device_sps_apq8064,
Aravind Venkateswaran4ca27532012-02-16 14:27:05 -08002257#ifdef CONFIG_MSM_ROTATOR
2258 &msm_rotator_device,
2259#endif
Joel King82b7e3f2012-01-05 10:03:27 -08002260};
2261
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002262static struct platform_device
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002263mpq8064_device_ext_1p2_buck_vreg __devinitdata = {
2264 .name = GPIO_REGULATOR_DEV_NAME,
2265 .id = SX150X_GPIO(4, 2),
2266 .dev = {
2267 .platform_data =
2268 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P2V],
2269 },
2270};
2271
2272static struct platform_device
2273mpq8064_device_ext_1p8_buck_vreg __devinitdata = {
2274 .name = GPIO_REGULATOR_DEV_NAME,
2275 .id = SX150X_GPIO(4, 4),
2276 .dev = {
2277 .platform_data =
2278 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P8V],
2279 },
2280};
2281
2282static struct platform_device
2283mpq8064_device_ext_2p2_buck_vreg __devinitdata = {
2284 .name = GPIO_REGULATOR_DEV_NAME,
2285 .id = SX150X_GPIO(4, 14),
2286 .dev = {
2287 .platform_data =
2288 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_2P2V],
2289 },
2290};
2291
2292static struct platform_device
2293mpq8064_device_ext_5v_buck_vreg __devinitdata = {
2294 .name = GPIO_REGULATOR_DEV_NAME,
2295 .id = SX150X_GPIO(4, 3),
2296 .dev = {
2297 .platform_data =
2298 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_5V],
2299 },
2300};
2301
2302static struct platform_device
2303mpq8064_device_ext_3p3v_ldo_vreg __devinitdata = {
2304 .name = GPIO_REGULATOR_DEV_NAME,
2305 .id = SX150X_GPIO(4, 15),
2306 .dev = {
2307 .platform_data =
2308 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_3P3V],
2309 },
2310};
2311
Ravi Kumar V1c903012012-05-15 16:11:35 +05302312static struct platform_device rc_input_loopback_pdev = {
2313 .name = "rc-user-input",
2314 .id = -1,
2315};
2316
Ravi Kumar V040eeff2012-05-23 21:29:23 +05302317static int rf4ce_gpio_init(void)
2318{
2319 if (!machine_is_mpq8064_cdp())
2320 return -EINVAL;
2321
2322 /* CC2533 SRDY Input */
2323 if (!gpio_request(SX150X_GPIO(4, 6), "rf4ce_srdy")) {
2324 gpio_direction_input(SX150X_GPIO(4, 6));
2325 gpio_export(SX150X_GPIO(4, 6), true);
2326 }
2327
2328 /* CC2533 MRDY Output */
2329 if (!gpio_request(SX150X_GPIO(4, 5), "rf4ce_mrdy")) {
2330 gpio_direction_output(SX150X_GPIO(4, 5), 1);
2331 gpio_export(SX150X_GPIO(4, 5), true);
2332 }
2333
2334 /* CC2533 Reset Output */
2335 if (!gpio_request(SX150X_GPIO(4, 7), "rf4ce_reset")) {
2336 gpio_direction_output(SX150X_GPIO(4, 7), 0);
2337 gpio_export(SX150X_GPIO(4, 7), true);
2338 }
2339
2340 return 0;
2341}
2342late_initcall(rf4ce_gpio_init);
2343
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002344static struct platform_device *mpq_devices[] __initdata = {
2345 &msm_device_sps_apq8064,
2346 &mpq8064_device_qup_i2c_gsbi5,
2347#ifdef CONFIG_MSM_ROTATOR
2348 &msm_rotator_device,
2349#endif
Ravi Kumar V05931a22012-04-04 17:09:37 +05302350 &gpio_ir_recv_pdev,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002351 &mpq8064_device_ext_1p2_buck_vreg,
2352 &mpq8064_device_ext_1p8_buck_vreg,
2353 &mpq8064_device_ext_2p2_buck_vreg,
2354 &mpq8064_device_ext_5v_buck_vreg,
2355 &mpq8064_device_ext_3p3v_ldo_vreg,
Terence Hampson2e1705f2012-04-11 19:55:29 -04002356#ifdef CONFIG_MSM_VCAP
2357 &msm8064_device_vcap,
2358#endif
Ravi Kumar V1c903012012-05-15 16:11:35 +05302359 &rc_input_loopback_pdev,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002360};
2361
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002362static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002363 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002364};
2365
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002366#define KS8851_IRQ_GPIO 43
2367
2368static struct spi_board_info spi_board_info[] __initdata = {
2369 {
2370 .modalias = "ks8851",
2371 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2372 .max_speed_hz = 19200000,
2373 .bus_num = 0,
2374 .chip_select = 2,
2375 .mode = SPI_MODE_0,
2376 },
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002377 {
2378 .modalias = "epm_adc",
2379 .max_speed_hz = 1100000,
2380 .bus_num = 0,
2381 .chip_select = 3,
2382 .mode = SPI_MODE_0,
2383 },
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002384};
2385
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002386static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002387 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08002388 .bus_num = 1,
2389 .slim_slave = &apq8064_slim_tabla,
2390 },
2391 {
2392 .bus_num = 1,
2393 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002394 },
2395 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002396};
2397
David Keitel3c40fc52012-02-09 17:53:52 -08002398static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi1_pdata = {
2399 .clk_freq = 100000,
2400 .src_clk_rate = 24000000,
2401};
2402
Jing Lin04601f92012-02-05 15:36:07 -08002403static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi3_pdata = {
Anirudh Ghayalc2163472012-04-10 14:58:14 +05302404 .clk_freq = 384000,
Jing Lin04601f92012-02-05 15:36:07 -08002405 .src_clk_rate = 24000000,
2406};
2407
Kenneth Heitke748593a2011-07-15 15:45:11 -06002408static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
2409 .clk_freq = 100000,
2410 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002411};
2412
Joel King8f839b92012-04-01 14:37:46 -07002413static struct msm_i2c_platform_data mpq8064_i2c_qup_gsbi5_pdata = {
2414 .clk_freq = 100000,
2415 .src_clk_rate = 24000000,
2416};
2417
David Keitel3c40fc52012-02-09 17:53:52 -08002418#define GSBI_DUAL_MODE_CODE 0x60
2419#define MSM_GSBI1_PHYS 0x12440000
Kenneth Heitke748593a2011-07-15 15:45:11 -06002420static void __init apq8064_i2c_init(void)
2421{
David Keitel3c40fc52012-02-09 17:53:52 -08002422 void __iomem *gsbi_mem;
2423
2424 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2425 &apq8064_i2c_qup_gsbi1_pdata;
2426 gsbi_mem = ioremap_nocache(MSM_GSBI1_PHYS, 4);
2427 writel_relaxed(GSBI_DUAL_MODE_CODE, gsbi_mem);
2428 /* Ensure protocol code is written before proceeding */
2429 wmb();
2430 iounmap(gsbi_mem);
2431 apq8064_i2c_qup_gsbi1_pdata.use_gsbi_shared_mode = 1;
Jing Lin04601f92012-02-05 15:36:07 -08002432 apq8064_device_qup_i2c_gsbi3.dev.platform_data =
2433 &apq8064_i2c_qup_gsbi3_pdata;
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002434 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2435 &apq8064_i2c_qup_gsbi1_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002436 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
2437 &apq8064_i2c_qup_gsbi4_pdata;
Joel King8f839b92012-04-01 14:37:46 -07002438 mpq8064_device_qup_i2c_gsbi5.dev.platform_data =
2439 &mpq8064_i2c_qup_gsbi5_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002440}
2441
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002442#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002443static int ethernet_init(void)
2444{
2445 int ret;
2446 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
2447 if (ret) {
2448 pr_err("ks8851 gpio_request failed: %d\n", ret);
2449 goto fail;
2450 }
2451
2452 return 0;
2453fail:
2454 return ret;
2455}
2456#else
2457static int ethernet_init(void)
2458{
2459 return 0;
2460}
2461#endif
2462
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302463#define GPIO_KEY_HOME PM8921_GPIO_PM_TO_SYS(27)
2464#define GPIO_KEY_VOLUME_UP PM8921_GPIO_PM_TO_SYS(35)
2465#define GPIO_KEY_VOLUME_DOWN PM8921_GPIO_PM_TO_SYS(38)
2466#define GPIO_KEY_CAM_FOCUS PM8921_GPIO_PM_TO_SYS(3)
2467#define GPIO_KEY_CAM_SNAP PM8921_GPIO_PM_TO_SYS(4)
Jing Lin3f8f8422012-03-05 09:32:11 -08002468#define GPIO_KEY_ROTATION PM8921_GPIO_PM_TO_SYS(42)
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302469
2470static struct gpio_keys_button cdp_keys[] = {
2471 {
2472 .code = KEY_HOME,
2473 .gpio = GPIO_KEY_HOME,
2474 .desc = "home_key",
2475 .active_low = 1,
2476 .type = EV_KEY,
2477 .wakeup = 1,
2478 .debounce_interval = 15,
2479 },
2480 {
2481 .code = KEY_VOLUMEUP,
2482 .gpio = GPIO_KEY_VOLUME_UP,
2483 .desc = "volume_up_key",
2484 .active_low = 1,
2485 .type = EV_KEY,
2486 .wakeup = 1,
2487 .debounce_interval = 15,
2488 },
2489 {
2490 .code = KEY_VOLUMEDOWN,
2491 .gpio = GPIO_KEY_VOLUME_DOWN,
2492 .desc = "volume_down_key",
2493 .active_low = 1,
2494 .type = EV_KEY,
2495 .wakeup = 1,
2496 .debounce_interval = 15,
2497 },
2498 {
2499 .code = SW_ROTATE_LOCK,
2500 .gpio = GPIO_KEY_ROTATION,
2501 .desc = "rotate_key",
2502 .active_low = 1,
2503 .type = EV_SW,
2504 .debounce_interval = 15,
2505 },
2506};
2507
2508static struct gpio_keys_platform_data cdp_keys_data = {
2509 .buttons = cdp_keys,
2510 .nbuttons = ARRAY_SIZE(cdp_keys),
2511};
2512
2513static struct platform_device cdp_kp_pdev = {
2514 .name = "gpio-keys",
2515 .id = -1,
2516 .dev = {
2517 .platform_data = &cdp_keys_data,
2518 },
2519};
2520
2521static struct gpio_keys_button mtp_keys[] = {
2522 {
2523 .code = KEY_CAMERA_FOCUS,
2524 .gpio = GPIO_KEY_CAM_FOCUS,
2525 .desc = "cam_focus_key",
2526 .active_low = 1,
2527 .type = EV_KEY,
2528 .wakeup = 1,
2529 .debounce_interval = 15,
2530 },
2531 {
2532 .code = KEY_VOLUMEUP,
2533 .gpio = GPIO_KEY_VOLUME_UP,
2534 .desc = "volume_up_key",
2535 .active_low = 1,
2536 .type = EV_KEY,
2537 .wakeup = 1,
2538 .debounce_interval = 15,
2539 },
2540 {
2541 .code = KEY_VOLUMEDOWN,
2542 .gpio = GPIO_KEY_VOLUME_DOWN,
2543 .desc = "volume_down_key",
2544 .active_low = 1,
2545 .type = EV_KEY,
2546 .wakeup = 1,
2547 .debounce_interval = 15,
2548 },
2549 {
2550 .code = KEY_CAMERA_SNAPSHOT,
2551 .gpio = GPIO_KEY_CAM_SNAP,
2552 .desc = "cam_snap_key",
2553 .active_low = 1,
2554 .type = EV_KEY,
2555 .debounce_interval = 15,
2556 },
2557};
2558
2559static struct gpio_keys_platform_data mtp_keys_data = {
2560 .buttons = mtp_keys,
2561 .nbuttons = ARRAY_SIZE(mtp_keys),
2562};
2563
2564static struct platform_device mtp_kp_pdev = {
2565 .name = "gpio-keys",
2566 .id = -1,
2567 .dev = {
2568 .platform_data = &mtp_keys_data,
2569 },
2570};
2571
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05302572static struct gpio_keys_button mpq_keys[] = {
2573 {
2574 .code = KEY_VOLUMEDOWN,
2575 .gpio = GPIO_KEY_VOLUME_DOWN,
2576 .desc = "volume_down_key",
2577 .active_low = 1,
2578 .type = EV_KEY,
2579 .wakeup = 1,
2580 .debounce_interval = 15,
2581 },
2582 {
2583 .code = KEY_VOLUMEUP,
2584 .gpio = GPIO_KEY_VOLUME_UP,
2585 .desc = "volume_up_key",
2586 .active_low = 1,
2587 .type = EV_KEY,
2588 .wakeup = 1,
2589 .debounce_interval = 15,
2590 },
2591};
2592
2593static struct gpio_keys_platform_data mpq_keys_data = {
2594 .buttons = mpq_keys,
2595 .nbuttons = ARRAY_SIZE(mpq_keys),
2596};
2597
2598static struct platform_device mpq_gpio_keys_pdev = {
2599 .name = "gpio-keys",
2600 .id = -1,
2601 .dev = {
2602 .platform_data = &mpq_keys_data,
2603 },
2604};
2605
2606#define MPQ_KP_ROW_BASE SX150X_EXP2_GPIO_BASE
2607#define MPQ_KP_COL_BASE (SX150X_EXP2_GPIO_BASE + 4)
2608
2609static unsigned int mpq_row_gpios[] = {MPQ_KP_ROW_BASE, MPQ_KP_ROW_BASE + 1,
2610 MPQ_KP_ROW_BASE + 2, MPQ_KP_ROW_BASE + 3};
2611static unsigned int mpq_col_gpios[] = {MPQ_KP_COL_BASE, MPQ_KP_COL_BASE + 1,
2612 MPQ_KP_COL_BASE + 2};
2613
2614static const unsigned int mpq_keymap[] = {
2615 KEY(0, 0, KEY_UP),
2616 KEY(0, 1, KEY_ENTER),
2617 KEY(0, 2, KEY_3),
2618
2619 KEY(1, 0, KEY_DOWN),
2620 KEY(1, 1, KEY_EXIT),
2621 KEY(1, 2, KEY_4),
2622
2623 KEY(2, 0, KEY_LEFT),
2624 KEY(2, 1, KEY_1),
2625 KEY(2, 2, KEY_5),
2626
2627 KEY(3, 0, KEY_RIGHT),
2628 KEY(3, 1, KEY_2),
2629 KEY(3, 2, KEY_6),
2630};
2631
2632static struct matrix_keymap_data mpq_keymap_data = {
2633 .keymap_size = ARRAY_SIZE(mpq_keymap),
2634 .keymap = mpq_keymap,
2635};
2636
2637static struct matrix_keypad_platform_data mpq_keypad_data = {
2638 .keymap_data = &mpq_keymap_data,
2639 .row_gpios = mpq_row_gpios,
2640 .col_gpios = mpq_col_gpios,
2641 .num_row_gpios = ARRAY_SIZE(mpq_row_gpios),
2642 .num_col_gpios = ARRAY_SIZE(mpq_col_gpios),
2643 .col_scan_delay_us = 32000,
2644 .debounce_ms = 20,
2645 .wakeup = 1,
2646 .active_low = 1,
2647 .no_autorepeat = 1,
2648};
2649
2650static struct platform_device mpq_keypad_device = {
2651 .name = "matrix-keypad",
2652 .id = -1,
2653 .dev = {
2654 .platform_data = &mpq_keypad_data,
2655 },
2656};
2657
Jin Hongd3024e62012-02-09 16:13:32 -08002658/* Sensors DSPS platform data */
2659#define DSPS_PIL_GENERIC_NAME "dsps"
2660static void __init apq8064_init_dsps(void)
2661{
2662 struct msm_dsps_platform_data *pdata =
2663 msm_dsps_device_8064.dev.platform_data;
2664 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
2665 pdata->gpios = NULL;
2666 pdata->gpios_num = 0;
2667
2668 platform_device_register(&msm_dsps_device_8064);
2669}
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302670
Jing Lin417fa452012-02-05 14:31:06 -08002671#define I2C_SURF 1
2672#define I2C_FFA (1 << 1)
2673#define I2C_RUMI (1 << 2)
2674#define I2C_SIM (1 << 3)
2675#define I2C_LIQUID (1 << 4)
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002676#define I2C_MPQ_CDP BIT(5)
2677#define I2C_MPQ_HRD BIT(6)
2678#define I2C_MPQ_DTV BIT(7)
Jing Lin417fa452012-02-05 14:31:06 -08002679
2680struct i2c_registry {
2681 u8 machs;
2682 int bus;
2683 struct i2c_board_info *info;
2684 int len;
2685};
2686
2687static struct i2c_registry apq8064_i2c_devices[] __initdata = {
Jing Lin21ed4de2012-02-05 15:53:28 -08002688 {
David Keitel2f613d92012-02-15 11:29:16 -08002689 I2C_LIQUID,
2690 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
2691 smb349_charger_i2c_info,
2692 ARRAY_SIZE(smb349_charger_i2c_info)
2693 },
2694 {
Jing Lin21ed4de2012-02-05 15:53:28 -08002695 I2C_SURF | I2C_LIQUID,
2696 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
2697 mxt_device_info,
2698 ARRAY_SIZE(mxt_device_info),
2699 },
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08002700 {
2701 I2C_FFA,
2702 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
2703 cyttsp_info,
2704 ARRAY_SIZE(cyttsp_info),
2705 },
Amy Maloche70090f992012-02-16 16:35:26 -08002706 {
2707 I2C_FFA | I2C_LIQUID,
2708 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
2709 isa1200_board_info,
2710 ARRAY_SIZE(isa1200_board_info),
2711 },
Santosh Mardieff9a742012-04-09 23:23:39 +05302712 {
2713 I2C_MPQ_CDP,
2714 APQ_8064_GSBI5_QUP_I2C_BUS_ID,
2715 cs8427_device_info,
2716 ARRAY_SIZE(cs8427_device_info),
2717 },
Jing Lin417fa452012-02-05 14:31:06 -08002718};
2719
Jay Chokshi607f61b2012-04-25 18:21:21 -07002720#define SX150X_EXP1_INT_N PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9)
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05302721#define SX150X_EXP2_INT_N MSM_GPIO_TO_INT(81)
Jay Chokshi607f61b2012-04-25 18:21:21 -07002722
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002723struct sx150x_platform_data mpq8064_sx150x_pdata[] = {
2724 [SX150X_EXP1] = {
2725 .gpio_base = SX150X_EXP1_GPIO_BASE,
2726 .oscio_is_gpo = false,
2727 .io_pullup_ena = 0x0,
2728 .io_pulldn_ena = 0x0,
2729 .io_open_drain_ena = 0x0,
2730 .io_polarity = 0,
Jay Chokshi607f61b2012-04-25 18:21:21 -07002731 .irq_summary = SX150X_EXP1_INT_N,
2732 .irq_base = SX150X_EXP1_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002733 },
2734 [SX150X_EXP2] = {
2735 .gpio_base = SX150X_EXP2_GPIO_BASE,
2736 .oscio_is_gpo = false,
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05302737 .io_pullup_ena = 0x0f,
2738 .io_pulldn_ena = 0x70,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002739 .io_open_drain_ena = 0x0,
2740 .io_polarity = 0,
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05302741 .irq_summary = SX150X_EXP2_INT_N,
2742 .irq_base = SX150X_EXP2_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002743 },
2744 [SX150X_EXP3] = {
2745 .gpio_base = SX150X_EXP3_GPIO_BASE,
2746 .oscio_is_gpo = false,
2747 .io_pullup_ena = 0x0,
2748 .io_pulldn_ena = 0x0,
2749 .io_open_drain_ena = 0x0,
2750 .io_polarity = 0,
2751 .irq_summary = -1,
2752 },
2753 [SX150X_EXP4] = {
2754 .gpio_base = SX150X_EXP4_GPIO_BASE,
2755 .oscio_is_gpo = false,
2756 .io_pullup_ena = 0x0,
2757 .io_pulldn_ena = 0x0,
2758 .io_open_drain_ena = 0x0,
2759 .io_polarity = 0,
2760 .irq_summary = -1,
2761 },
2762};
2763
2764static struct i2c_board_info sx150x_gpio_exp_info[] = {
2765 {
2766 I2C_BOARD_INFO("sx1509q", 0x70),
2767 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP1],
2768 },
2769 {
2770 I2C_BOARD_INFO("sx1508q", 0x23),
2771 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP2],
2772 },
2773 {
2774 I2C_BOARD_INFO("sx1508q", 0x22),
2775 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP3],
2776 },
2777 {
2778 I2C_BOARD_INFO("sx1509q", 0x3E),
2779 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP4],
2780 },
2781};
2782
2783#define MPQ8064_I2C_GSBI5_BUS_ID 5
2784
2785static struct i2c_registry mpq8064_i2c_devices[] __initdata = {
2786 {
2787 I2C_MPQ_CDP,
2788 MPQ8064_I2C_GSBI5_BUS_ID,
2789 sx150x_gpio_exp_info,
2790 ARRAY_SIZE(sx150x_gpio_exp_info),
2791 },
2792};
2793
Jing Lin417fa452012-02-05 14:31:06 -08002794static void __init register_i2c_devices(void)
2795{
2796 u8 mach_mask = 0;
2797 int i;
2798
Kevin Chand07220e2012-02-13 15:52:22 -08002799#ifdef CONFIG_MSM_CAMERA
2800 struct i2c_registry apq8064_camera_i2c_devices = {
2801 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_RUMI,
2802 APQ_8064_GSBI4_QUP_I2C_BUS_ID,
2803 apq8064_camera_board_info.board_info,
2804 apq8064_camera_board_info.num_i2c_board_info,
2805 };
2806#endif
Jing Lin417fa452012-02-05 14:31:06 -08002807 /* Build the matching 'supported_machs' bitmask */
2808 if (machine_is_apq8064_cdp())
2809 mach_mask = I2C_SURF;
2810 else if (machine_is_apq8064_mtp())
2811 mach_mask = I2C_FFA;
2812 else if (machine_is_apq8064_liquid())
2813 mach_mask = I2C_LIQUID;
2814 else if (machine_is_apq8064_rumi3())
2815 mach_mask = I2C_RUMI;
2816 else if (machine_is_apq8064_sim())
2817 mach_mask = I2C_SIM;
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002818 else if (PLATFORM_IS_MPQ8064())
2819 mach_mask = I2C_MPQ_CDP;
Jing Lin417fa452012-02-05 14:31:06 -08002820 else
2821 pr_err("unmatched machine ID in register_i2c_devices\n");
2822
2823 /* Run the array and install devices as appropriate */
2824 for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) {
2825 if (apq8064_i2c_devices[i].machs & mach_mask)
2826 i2c_register_board_info(apq8064_i2c_devices[i].bus,
2827 apq8064_i2c_devices[i].info,
2828 apq8064_i2c_devices[i].len);
2829 }
Kevin Chand07220e2012-02-13 15:52:22 -08002830#ifdef CONFIG_MSM_CAMERA
2831 if (apq8064_camera_i2c_devices.machs & mach_mask)
2832 i2c_register_board_info(apq8064_camera_i2c_devices.bus,
2833 apq8064_camera_i2c_devices.info,
2834 apq8064_camera_i2c_devices.len);
2835#endif
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002836
2837 for (i = 0; i < ARRAY_SIZE(mpq8064_i2c_devices); ++i) {
2838 if (mpq8064_i2c_devices[i].machs & mach_mask)
2839 i2c_register_board_info(
2840 mpq8064_i2c_devices[i].bus,
2841 mpq8064_i2c_devices[i].info,
2842 mpq8064_i2c_devices[i].len);
2843 }
Jing Lin417fa452012-02-05 14:31:06 -08002844}
2845
Jay Chokshi994ff122012-03-27 15:43:48 -07002846static void enable_ddr3_regulator(void)
2847{
2848 static struct regulator *ext_ddr3;
2849
2850 /* Use MPP7 output state as a flag for PCDDR3 presence. */
2851 if (gpio_get_value_cansleep(PM8921_MPP_PM_TO_SYS(7)) > 0) {
2852 ext_ddr3 = regulator_get(NULL, "ext_ddr3");
2853 if (IS_ERR(ext_ddr3) || ext_ddr3 == NULL)
2854 pr_err("Could not get MPP7 regulator\n");
2855 else
2856 regulator_enable(ext_ddr3);
2857 }
2858}
2859
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002860static void enable_avc_i2c_bus(void)
2861{
2862 int avc_i2c_en_mpp = PM8921_MPP_PM_TO_SYS(8);
2863 int rc;
2864
2865 rc = gpio_request(avc_i2c_en_mpp, "avc_i2c_en");
2866 if (rc)
2867 pr_err("request for avc_i2c_en mpp failed,"
2868 "rc=%d\n", rc);
2869 else
2870 gpio_set_value_cansleep(avc_i2c_en_mpp, 1);
2871}
2872
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002873static void __init apq8064_common_init(void)
2874{
Joel King8f839b92012-04-01 14:37:46 -07002875 msm_tsens_early_init(&apq_tsens_pdata);
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002876 msm_thermal_init(&msm_thermal_pdata);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002877 if (socinfo_init() < 0)
2878 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06002879 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
2880 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
David Collins2782b5c2012-02-06 10:02:42 -08002881 regulator_suppress_info_printing();
2882 platform_device_register(&apq8064_device_rpm_regulator);
Stephen Boyd4d0d2582012-02-10 14:49:40 -08002883 if (msm_xo_init())
2884 pr_err("Failed to initialize XO votes\n");
Matt Wagantallc51e5602012-02-27 17:25:25 -08002885 msm_clock_init(&apq8064_clock_init_data);
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08002886 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06002887 apq8064_i2c_init();
Jing Lin417fa452012-02-05 14:31:06 -08002888 register_i2c_devices();
Kenneth Heitke36920d32011-07-20 16:44:30 -06002889
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002890 apq8064_device_qup_spi_gsbi5.dev.platform_data =
2891 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08002892 apq8064_init_pmic();
Hemant Kumar94e7da22012-02-03 16:52:29 -08002893 if (machine_is_apq8064_liquid())
2894 msm_otg_pdata.mhl_enable = true;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07002895
Ofir Cohen94213a72012-05-03 14:26:32 +03002896 android_usb_pdata.swfi_latency =
2897 msm_rpmrs_levels[0].latency_us;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07002898
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002899 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Manu Gautam91223e02011-11-08 15:27:22 +05302900 apq8064_ehci_host_init();
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002901 apq8064_init_buses();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002902 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Terence Hampson36b70722012-05-10 13:18:16 -04002903 if (!(machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
2904 machine_is_mpq8064_dtv()))
2905 platform_add_devices(common_not_mpq_devices,
2906 ARRAY_SIZE(common_not_mpq_devices));
Jay Chokshi994ff122012-03-27 15:43:48 -07002907 enable_ddr3_regulator();
Hemant Kumarf1ca9192012-02-07 18:59:33 -08002908 if (machine_is_apq8064_mtp()) {
2909 apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
2910 device_initialize(&apq8064_device_hsic_host.dev);
2911 }
Jay Chokshie8741282012-01-25 15:22:55 -08002912 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05302913 apq8064_init_mmc();
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08002914
2915 if (machine_is_apq8064_mtp()) {
2916 mdm_8064_device.dev.platform_data = &mdm_platform_data;
2917 platform_device_register(&mdm_8064_device);
2918 }
2919 platform_device_register(&apq8064_slim_ctrl);
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002920 slim_register_board_info(apq8064_slim_devices,
2921 ARRAY_SIZE(apq8064_slim_devices));
Jin Hongd3024e62012-02-09 16:13:32 -08002922 apq8064_init_dsps();
Praveen Chidambaram78499012011-11-01 17:15:17 -06002923 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2924 msm_spm_l2_init(msm_spm_l2_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002925 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Praveen Chidambaram4d19be42012-04-03 18:05:52 -06002926 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002927 apq8064_epm_adc_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002928}
2929
Huaibin Yang4a084e32011-12-15 15:25:52 -08002930static void __init apq8064_allocate_memory_regions(void)
2931{
2932 apq8064_allocate_fb_region();
2933}
2934
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002935static void __init apq8064_sim_init(void)
2936{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002937 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
2938 &msm8064_device_watchdog.dev.platform_data;
2939
2940 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002941 apq8064_common_init();
Joel King4e7ad222011-08-17 15:47:38 -07002942 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
2943}
2944
2945static void __init apq8064_rumi3_init(void)
2946{
2947 apq8064_common_init();
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002948 ethernet_init();
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002949 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002950 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002951}
2952
Joel King82b7e3f2012-01-05 10:03:27 -08002953static void __init apq8064_cdp_init(void)
2954{
Hanumant Singh50440d42012-04-23 19:27:16 -07002955 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2956 pr_err("meminfo_init() failed!\n");
Joel King82b7e3f2012-01-05 10:03:27 -08002957 apq8064_common_init();
Joel King8f839b92012-04-01 14:37:46 -07002958 if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
2959 machine_is_mpq8064_dtv()) {
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002960 enable_avc_i2c_bus();
Joel King8f839b92012-04-01 14:37:46 -07002961 platform_add_devices(mpq_devices, ARRAY_SIZE(mpq_devices));
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002962 mpq8064_pcie_init();
Joel King8f839b92012-04-01 14:37:46 -07002963 } else {
2964 ethernet_init();
2965 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
2966 spi_register_board_info(spi_board_info,
2967 ARRAY_SIZE(spi_board_info));
2968 }
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002969 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07002970 apq8064_init_gpu();
Matt Wagantall1f65d9d2012-04-25 14:24:20 -07002971 platform_add_devices(apq8064_footswitch, apq8064_num_footswitch);
Steve Mucklef132c6c2012-06-06 18:30:57 -07002972#ifdef CONFIG_MSM_CAMERA
Kevin Chand07220e2012-02-13 15:52:22 -08002973 apq8064_init_cam();
Steve Mucklef132c6c2012-06-06 18:30:57 -07002974#endif
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302975
2976 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
2977 platform_device_register(&cdp_kp_pdev);
2978
2979 if (machine_is_apq8064_mtp())
2980 platform_device_register(&mtp_kp_pdev);
Hanumant Singh50440d42012-04-23 19:27:16 -07002981
2982 change_memory_power = &apq8064_change_memory_power;
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05302983
2984 if (machine_is_mpq8064_cdp()) {
2985 platform_device_register(&mpq_gpio_keys_pdev);
2986 platform_device_register(&mpq_keypad_device);
2987 }
Joel King82b7e3f2012-01-05 10:03:27 -08002988}
2989
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002990MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
2991 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002992 .reserve = apq8064_reserve,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002993 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302994 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002995 .timer = &msm_timer,
2996 .init_machine = apq8064_sim_init,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002997 .restart = msm_restart,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002998MACHINE_END
2999
Joel King4e7ad222011-08-17 15:47:38 -07003000MACHINE_START(APQ8064_RUMI3, "QCT APQ8064 RUMI3")
3001 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07003002 .reserve = apq8064_reserve,
Joel King4e7ad222011-08-17 15:47:38 -07003003 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303004 .handle_irq = gic_handle_irq,
Joel King4e7ad222011-08-17 15:47:38 -07003005 .timer = &msm_timer,
3006 .init_machine = apq8064_rumi3_init,
Huaibin Yang4a084e32011-12-15 15:25:52 -08003007 .init_early = apq8064_allocate_memory_regions,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003008 .restart = msm_restart,
Joel King4e7ad222011-08-17 15:47:38 -07003009MACHINE_END
3010
Joel King82b7e3f2012-01-05 10:03:27 -08003011MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
3012 .map_io = apq8064_map_io,
3013 .reserve = apq8064_reserve,
3014 .init_irq = apq8064_init_irq,
3015 .handle_irq = gic_handle_irq,
3016 .timer = &msm_timer,
3017 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003018 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003019 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003020 .restart = msm_restart,
Joel King82b7e3f2012-01-05 10:03:27 -08003021MACHINE_END
3022
3023MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
3024 .map_io = apq8064_map_io,
3025 .reserve = apq8064_reserve,
3026 .init_irq = apq8064_init_irq,
3027 .handle_irq = gic_handle_irq,
3028 .timer = &msm_timer,
3029 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003030 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003031 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003032 .restart = msm_restart,
Joel King82b7e3f2012-01-05 10:03:27 -08003033MACHINE_END
3034
3035MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
3036 .map_io = apq8064_map_io,
3037 .reserve = apq8064_reserve,
3038 .init_irq = apq8064_init_irq,
3039 .handle_irq = gic_handle_irq,
3040 .timer = &msm_timer,
3041 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003042 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003043 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003044 .restart = msm_restart,
Joel King82b7e3f2012-01-05 10:03:27 -08003045MACHINE_END
3046
Joel King064bbf82012-04-01 13:23:39 -07003047MACHINE_START(MPQ8064_CDP, "QCT MPQ8064 CDP")
3048 .map_io = apq8064_map_io,
3049 .reserve = apq8064_reserve,
3050 .init_irq = apq8064_init_irq,
3051 .handle_irq = gic_handle_irq,
3052 .timer = &msm_timer,
3053 .init_machine = apq8064_cdp_init,
3054 .init_early = apq8064_allocate_memory_regions,
3055 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003056 .restart = msm_restart,
Joel King064bbf82012-04-01 13:23:39 -07003057MACHINE_END
3058
Joel King11ca8202012-02-13 16:19:03 -08003059MACHINE_START(MPQ8064_HRD, "QCT MPQ8064 HRD")
3060 .map_io = apq8064_map_io,
3061 .reserve = apq8064_reserve,
3062 .init_irq = apq8064_init_irq,
3063 .handle_irq = gic_handle_irq,
3064 .timer = &msm_timer,
3065 .init_machine = apq8064_cdp_init,
Joel King3a57e772012-05-28 11:22:55 -07003066 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003067 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003068 .restart = msm_restart,
Joel King11ca8202012-02-13 16:19:03 -08003069MACHINE_END
3070
3071MACHINE_START(MPQ8064_DTV, "QCT MPQ8064 DTV")
3072 .map_io = apq8064_map_io,
3073 .reserve = apq8064_reserve,
3074 .init_irq = apq8064_init_irq,
3075 .handle_irq = gic_handle_irq,
3076 .timer = &msm_timer,
3077 .init_machine = apq8064_cdp_init,
Joel King3a57e772012-05-28 11:22:55 -07003078 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003079 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003080 .restart = msm_restart,
Joel King11ca8202012-02-13 16:19:03 -08003081MACHINE_END
3082