blob: 72430e60a30ca74237fe46ee3ea8245d4a675e46 [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>
Jing Lin21ed4de2012-02-05 15:53:28 -080032#include <linux/i2c/atmel_mxt_ts.h>
Steve Mucklef132c6c2012-06-06 18:30:57 -070033#include <linux/cyttsp-qc.h>
Amy Maloche70090f992012-02-16 16:35:26 -080034#include <linux/i2c/isa1200.h>
Mohan Pallaka474b94b2012-01-25 12:59:58 +053035#include <linux/gpio_keys.h>
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -080036#include <linux/epm_adc.h>
Jay Chokshie7d8d4f2012-04-04 14:47:57 -070037#include <linux/i2c/sx150x.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070038#include <asm/mach-types.h>
39#include <asm/mach/arch.h>
40#include <asm/hardware/gic.h>
Sahitya Tummala3586ed92011-08-03 09:13:23 +053041#include <asm/mach/mmc.h>
Ankit Verma6b7e2ba2012-01-26 15:48:54 -080042#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070043
44#include <mach/board.h>
45#include <mach/msm_iomap.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080046#include <mach/ion.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070047#include <linux/usb/msm_hsusb.h>
48#include <linux/usb/android.h>
49#include <mach/socinfo.h>
Harini Jayaramanc4c58692011-07-19 14:50:10 -060050#include <mach/msm_spi.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070051#include "timer.h"
52#include "devices.h"
Joel King4ebccc62011-07-22 09:43:22 -070053#include <mach/gpiomux.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060054#include <mach/rpm.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080055#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -070056#include <linux/android_pmem.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080057#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070058#include <mach/msm_memtypes.h>
59#include <linux/bootmem.h>
60#include <asm/setup.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070061#include <mach/dma.h>
Jin Hongd3024e62012-02-09 16:13:32 -080062#include <mach/msm_dsps.h>
Gagan Mac8a7a5d32011-11-11 16:43:06 -070063#include <mach/msm_bus_board.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060064#include <mach/cpuidle.h>
Joel Kingdacbc822012-01-25 13:30:57 -080065#include <mach/mdm2.h>
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -080066#include <linux/msm_tsens.h>
Stephen Boyd4d0d2582012-02-10 14:49:40 -080067#include <mach/msm_xo.h>
Laura Abbott350c8362012-02-28 14:46:52 -080068#include <mach/msm_rtb.h>
Santosh Mardieff9a742012-04-09 23:23:39 +053069#include <sound/cs8427.h>
Ravi Kumar V05931a22012-04-04 17:09:37 +053070#include <media/gpio-ir-recv.h>
Larry Bassel67b921d2012-04-06 10:23:27 -070071#include <linux/fmem.h>
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -060072#include <mach/msm_pcie.h>
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -070073#include <mach/restart.h>
Joel King4ebccc62011-07-22 09:43:22 -070074
Jeff Ohlstein7e668552011-10-06 16:17:25 -070075#include "msm_watchdog.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080076#include "board-8064.h"
Vikram Mulukutlabc2e9572011-11-04 03:41:38 -070077#include "acpuclock.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,
1030 .max_uV = 1225000,
1031 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1032 },
1033 {
1034 .name = "CDC_VDDA_A_1P2V",
1035 .min_uV = 1225000,
1036 .max_uV = 1225000,
1037 .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,
1097 .max_uV = 1225000,
1098 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1099 },
1100 {
1101 .name = "CDC_VDDA_A_1P2V",
1102 .min_uV = 1225000,
1103 .max_uV = 1225000,
1104 .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
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001720#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001721static void __init apq8064_map_io(void)
1722{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001723 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001724 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001725 if (socinfo_init() < 0)
1726 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001727}
1728
1729static void __init apq8064_init_irq(void)
1730{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001731 struct msm_mpm_device_data *data = NULL;
1732
1733#ifdef CONFIG_MSM_MPM
1734 data = &apq8064_mpm_dev_data;
1735#endif
1736
1737 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001738 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1739 (void *)MSM_QGIC_CPU_BASE);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001740}
1741
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001742static struct platform_device msm8064_device_saw_regulator_core0 = {
1743 .name = "saw-regulator",
1744 .id = 0,
1745 .dev = {
1746 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
1747 },
1748};
1749
1750static struct platform_device msm8064_device_saw_regulator_core1 = {
1751 .name = "saw-regulator",
1752 .id = 1,
1753 .dev = {
1754 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
1755 },
1756};
1757
1758static struct platform_device msm8064_device_saw_regulator_core2 = {
1759 .name = "saw-regulator",
1760 .id = 2,
1761 .dev = {
1762 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
1763 },
1764};
1765
1766static struct platform_device msm8064_device_saw_regulator_core3 = {
1767 .name = "saw-regulator",
1768 .id = 3,
1769 .dev = {
1770 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001771
1772 },
1773};
1774
Oluwafemi Adeyemif5a31422012-03-08 16:58:45 -08001775static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001776 {
1777 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1778 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1779 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001780 1, 784, 180000, 100,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001781 },
1782
1783 {
1784 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1785 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1786 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001787 1300, 228, 1200000, 2000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001788 },
1789
1790 {
1791 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1792 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1793 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001794 2000, 138, 1208400, 3200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001795 },
1796
1797 {
1798 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001799 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
1800 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001801 6000, 119, 1850300, 9000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001802 },
1803
1804 {
1805 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1806 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1807 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001808 9200, 68, 2839200, 16400,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001809 },
1810
1811 {
1812 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1813 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1814 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001815 10300, 63, 3128000, 18200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001816 },
1817
1818 {
1819 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1820 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1821 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001822 18000, 10, 4602600, 27000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001823 },
1824
1825 {
1826 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1827 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1828 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001829 20000, 2, 5752000, 32000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001830 },
1831};
1832
1833static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1834 .mode = MSM_PM_BOOT_CONFIG_TZ,
1835};
1836
1837static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
1838 .levels = &msm_rpmrs_levels[0],
1839 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
1840 .vdd_mem_levels = {
1841 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
1842 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
1843 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
1844 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
1845 },
1846 .vdd_dig_levels = {
1847 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
1848 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
1849 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
1850 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
1851 },
1852 .vdd_mask = 0x7FFFFF,
1853 .rpmrs_target_id = {
1854 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
1855 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
1856 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
1857 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
1858 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
1859 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
1860 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
1861 },
1862};
1863
Praveen Chidambaram78499012011-11-01 17:15:17 -06001864static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1865 0x03, 0x0f,
1866};
1867
1868static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1869 0x00, 0x24, 0x54, 0x10,
1870 0x09, 0x03, 0x01,
1871 0x10, 0x54, 0x30, 0x0C,
1872 0x24, 0x30, 0x0f,
1873};
1874
1875static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1876 0x00, 0x24, 0x54, 0x10,
1877 0x09, 0x07, 0x01, 0x0B,
1878 0x10, 0x54, 0x30, 0x0C,
1879 0x24, 0x30, 0x0f,
1880};
1881
1882static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1883 [0] = {
1884 .mode = MSM_SPM_MODE_CLOCK_GATING,
1885 .notify_rpm = false,
1886 .cmd = spm_wfi_cmd_sequence,
1887 },
1888 [1] = {
1889 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1890 .notify_rpm = false,
1891 .cmd = spm_power_collapse_without_rpm,
1892 },
1893 [2] = {
1894 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1895 .notify_rpm = true,
1896 .cmd = spm_power_collapse_with_rpm,
1897 },
1898};
1899
1900static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1901 0x00, 0x20, 0x03, 0x20,
1902 0x00, 0x0f,
1903};
1904
1905static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1906 0x00, 0x20, 0x34, 0x64,
1907 0x48, 0x07, 0x48, 0x20,
1908 0x50, 0x64, 0x04, 0x34,
1909 0x50, 0x0f,
1910};
1911static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1912 0x00, 0x10, 0x34, 0x64,
1913 0x48, 0x07, 0x48, 0x10,
1914 0x50, 0x64, 0x04, 0x34,
1915 0x50, 0x0F,
1916};
1917
1918static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1919 [0] = {
1920 .mode = MSM_SPM_L2_MODE_RETENTION,
1921 .notify_rpm = false,
1922 .cmd = l2_spm_wfi_cmd_sequence,
1923 },
1924 [1] = {
1925 .mode = MSM_SPM_L2_MODE_GDHS,
1926 .notify_rpm = true,
1927 .cmd = l2_spm_gdhs_cmd_sequence,
1928 },
1929 [2] = {
1930 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1931 .notify_rpm = true,
1932 .cmd = l2_spm_power_off_cmd_sequence,
1933 },
1934};
1935
1936
1937static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1938 [0] = {
1939 .reg_base_addr = MSM_SAW_L2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001940 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001941 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001942 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1943 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1944 .modes = msm_spm_l2_seq_list,
1945 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1946 },
1947};
1948
1949static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1950 [0] = {
1951 .reg_base_addr = MSM_SAW0_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001952 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001953#if defined(CONFIG_MSM_AVS_HW)
1954 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1955 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1956#endif
1957 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001958 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001959 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1960 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1961 .vctl_timeout_us = 50,
1962 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1963 .modes = msm_spm_seq_list,
1964 },
1965 [1] = {
1966 .reg_base_addr = MSM_SAW1_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001967 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001968#if defined(CONFIG_MSM_AVS_HW)
1969 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1970 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1971#endif
1972 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001973 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001974 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1975 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1976 .vctl_timeout_us = 50,
1977 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1978 .modes = msm_spm_seq_list,
1979 },
1980 [2] = {
1981 .reg_base_addr = MSM_SAW2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001982 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001983#if defined(CONFIG_MSM_AVS_HW)
1984 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1985 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1986#endif
1987 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001988 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001989 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1990 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1991 .vctl_timeout_us = 50,
1992 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1993 .modes = msm_spm_seq_list,
1994 },
1995 [3] = {
1996 .reg_base_addr = MSM_SAW3_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001997 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001998#if defined(CONFIG_MSM_AVS_HW)
1999 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2000 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2001#endif
2002 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07002003 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002004 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2005 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2006 .vctl_timeout_us = 50,
2007 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2008 .modes = msm_spm_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08002009 },
2010};
2011
Praveen Chidambaram4d19be42012-04-03 18:05:52 -06002012static struct msm_pm_sleep_status_data msm_pm_slp_sts_data = {
2013 .base_addr = MSM_ACC0_BASE + 0x08,
2014 .cpu_offset = MSM_ACC1_BASE - MSM_ACC0_BASE,
2015 .mask = 1UL << 13,
2016};
2017
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002018static void __init apq8064_init_buses(void)
2019{
2020 msm_bus_rpm_set_mt_mask();
2021 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
2022 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
2023 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
2024 msm_bus_8064_apps_fabric.dev.platform_data =
2025 &msm_bus_8064_apps_fabric_pdata;
2026 msm_bus_8064_sys_fabric.dev.platform_data =
2027 &msm_bus_8064_sys_fabric_pdata;
2028 msm_bus_8064_mm_fabric.dev.platform_data =
2029 &msm_bus_8064_mm_fabric_pdata;
2030 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
2031 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
2032}
2033
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002034/* PCIe gpios */
2035static struct msm_pcie_gpio_info_t msm_pcie_gpio_info[MSM_PCIE_MAX_GPIO] = {
2036 {"rst_n", PM8921_MPP_PM_TO_SYS(PCIE_RST_N_PMIC_MPP), 0},
2037 {"pwr_en", PM8921_GPIO_PM_TO_SYS(PCIE_PWR_EN_PMIC_GPIO), 1},
2038};
2039
2040static struct msm_pcie_platform msm_pcie_platform_data = {
2041 .gpio = msm_pcie_gpio_info,
2042};
2043
2044static void __init mpq8064_pcie_init(void)
2045{
2046 msm_device_pcie.dev.platform_data = &msm_pcie_platform_data;
2047 platform_device_register(&msm_device_pcie);
2048}
2049
David Collinsf0d00732012-01-25 15:46:50 -08002050static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
2051 .name = GPIO_REGULATOR_DEV_NAME,
2052 .id = PM8921_MPP_PM_TO_SYS(7),
2053 .dev = {
2054 .platform_data
2055 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2056 },
2057};
2058
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08002059static struct platform_device apq8064_device_ext_mpp8_vreg __devinitdata = {
2060 .name = GPIO_REGULATOR_DEV_NAME,
2061 .id = PM8921_MPP_PM_TO_SYS(8),
2062 .dev = {
2063 .platform_data
2064 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_MPP8],
2065 },
2066};
2067
David Collinsf0d00732012-01-25 15:46:50 -08002068static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
2069 .name = GPIO_REGULATOR_DEV_NAME,
2070 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
2071 .dev = {
2072 .platform_data =
2073 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2074 },
2075};
2076
David Collins390fc332012-02-07 14:38:16 -08002077static struct platform_device apq8064_device_ext_ts_sw_vreg __devinitdata = {
2078 .name = GPIO_REGULATOR_DEV_NAME,
2079 .id = PM8921_GPIO_PM_TO_SYS(23),
2080 .dev = {
2081 .platform_data
2082 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_TS_SW],
2083 },
2084};
2085
David Collins2782b5c2012-02-06 10:02:42 -08002086static struct platform_device apq8064_device_rpm_regulator __devinitdata = {
2087 .name = "rpm-regulator",
2088 .id = -1,
2089 .dev = {
2090 .platform_data = &apq8064_rpm_regulator_pdata,
2091 },
2092};
2093
Ravi Kumar V05931a22012-04-04 17:09:37 +05302094static struct gpio_ir_recv_platform_data gpio_ir_recv_pdata = {
2095 .gpio_nr = 88,
2096 .active_low = 1,
2097};
2098
2099static struct platform_device gpio_ir_recv_pdev = {
2100 .name = "gpio-rc-recv",
2101 .dev = {
2102 .platform_data = &gpio_ir_recv_pdata,
2103 },
2104};
2105
Terence Hampson36b70722012-05-10 13:18:16 -04002106static struct platform_device *common_not_mpq_devices[] __initdata = {
David Keitel3c40fc52012-02-09 17:53:52 -08002107 &apq8064_device_qup_i2c_gsbi1,
Jing Lin04601f92012-02-05 15:36:07 -08002108 &apq8064_device_qup_i2c_gsbi3,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002109 &apq8064_device_qup_i2c_gsbi4,
Terence Hampson36b70722012-05-10 13:18:16 -04002110};
2111
2112static struct platform_device *common_devices[] __initdata = {
2113 &apq8064_device_dmov,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002114 &apq8064_device_qup_spi_gsbi5,
David Collinsf0d00732012-01-25 15:46:50 -08002115 &apq8064_device_ext_5v_vreg,
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08002116 &apq8064_device_ext_mpp8_vreg,
David Collinsf0d00732012-01-25 15:46:50 -08002117 &apq8064_device_ext_3p3v_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07002118 &apq8064_device_ssbi_pmic1,
2119 &apq8064_device_ssbi_pmic2,
Steve Mucklef132c6c2012-06-06 18:30:57 -07002120 &apq8064_device_ext_ts_sw_vreg,
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06002121 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07002122 &apq8064_device_otg,
2123 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08002124 &apq8064_device_hsusb_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07002125 &android_usb_device,
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08002126 &msm_device_wcnss_wlan,
Ankit Vermab7c26e62012-02-28 15:04:15 -08002127 &msm_device_iris_fm,
Larry Bassel67b921d2012-04-06 10:23:27 -07002128 &apq8064_fmem_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08002129#ifdef CONFIG_ANDROID_PMEM
2130#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002131 &apq8064_android_pmem_device,
2132 &apq8064_android_pmem_adsp_device,
2133 &apq8064_android_pmem_audio_device,
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -07002134#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
2135#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -08002136#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002137 &apq8064_ion_dev,
Olav Haugan7c6aa742012-01-16 16:47:37 -08002138#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002139 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08002140 &msm8064_device_saw_regulator_core0,
2141 &msm8064_device_saw_regulator_core1,
2142 &msm8064_device_saw_regulator_core2,
2143 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002144#if defined(CONFIG_QSEECOM)
2145 &qseecom_device,
2146#endif
2147
Ramesh Masavarapu28311912011-10-27 11:04:12 -07002148#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2149 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2150 &qcrypto_device,
2151#endif
2152
2153#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2154 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2155 &qcedev_device,
2156#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07002157
2158#ifdef CONFIG_HW_RANDOM_MSM
2159 &apq8064_device_rng,
2160#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002161 &apq_pcm,
2162 &apq_pcm_routing,
2163 &apq_cpudai0,
2164 &apq_cpudai1,
Santosh Mardieff9a742012-04-09 23:23:39 +05302165 &mpq_cpudai_sec_i2s_rx,
Kuirong Wangf23f8c52012-03-31 12:34:51 -07002166 &mpq_cpudai_mi2s_tx,
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002167 &apq_cpudai_hdmi_rx,
2168 &apq_cpudai_bt_rx,
2169 &apq_cpudai_bt_tx,
2170 &apq_cpudai_fm_rx,
2171 &apq_cpudai_fm_tx,
2172 &apq_cpu_fe,
2173 &apq_stub_codec,
2174 &apq_voice,
2175 &apq_voip,
2176 &apq_lpa_pcm,
Krishnankutty Kolathappilly4374e332012-03-18 22:27:30 -07002177 &apq_compr_dsp,
2178 &apq_multi_ch_pcm,
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002179 &apq_pcm_hostless,
2180 &apq_cpudai_afe_01_rx,
2181 &apq_cpudai_afe_01_tx,
2182 &apq_cpudai_afe_02_rx,
2183 &apq_cpudai_afe_02_tx,
2184 &apq_pcm_afe,
2185 &apq_cpudai_auxpcm_rx,
2186 &apq_cpudai_auxpcm_tx,
Neema Shetty8427c262012-02-16 11:23:43 -08002187 &apq_cpudai_stub,
Neema Shetty3c9d2862012-03-11 01:25:32 -08002188 &apq_cpudai_slimbus_1_rx,
2189 &apq_cpudai_slimbus_1_tx,
Kiran Kandi97fe19d2012-05-20 22:34:04 -07002190 &apq_cpudai_slimbus_2_rx,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002191 &apq_cpudai_slimbus_2_tx,
Neema Shettyc9d86c32012-05-09 12:01:39 -07002192 &apq_cpudai_slimbus_3_rx,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002193 &apq8064_rpm_device,
2194 &apq8064_rpm_log_device,
2195 &apq8064_rpm_stat_device,
Ramesh Masavarapuf31ff242012-05-10 18:55:21 -07002196 &apq_device_tz_log,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002197 &msm_bus_8064_apps_fabric,
2198 &msm_bus_8064_sys_fabric,
2199 &msm_bus_8064_mm_fabric,
2200 &msm_bus_8064_sys_fpb,
2201 &msm_bus_8064_cpss_fpb,
Mohan Kumar Gubbihalli Lachma Naik7f72edd2012-02-06 17:26:47 -08002202 &apq8064_msm_device_vidc,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07002203 &msm_pil_dsps,
Matt Wagantalled832652012-02-02 19:23:17 -08002204 &msm_8960_riva,
Matt Wagantallb94b9a52012-02-02 21:59:54 -08002205 &msm_8960_q6_lpass,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002206 &msm_pil_vidc,
Matt Wagantall292aace2012-01-26 19:12:34 -08002207 &msm_gss,
Laura Abbottb93525f2012-04-12 09:57:19 -07002208 &apq8064_rtb_device,
Praveen Chidambaram8ea3dcd2011-12-07 14:46:31 -07002209 &apq8064_cpu_idle_device,
Praveen Chidambaram5c8adf22012-02-23 18:44:37 -07002210 &apq8064_msm_gov_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002211 &apq8064_device_cache_erp,
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002212 &epm_adc_device,
Pratik Patel212ab362012-03-16 12:30:07 -07002213 &apq8064_qdss_device,
2214 &msm_etb_device,
2215 &msm_tpiu_device,
2216 &msm_funnel_device,
2217 &apq8064_etm_device,
Helen Zeng8f925502012-03-05 16:50:17 -08002218 &apq_cpudai_slim_4_rx,
2219 &apq_cpudai_slim_4_tx,
Steve Mucklef132c6c2012-06-06 18:30:57 -07002220#ifdef CONFIG_MSM_GEMINI
Jignesh Mehta921649d2012-04-19 06:57:23 -07002221 &msm8960_gemini_device,
Steve Mucklef132c6c2012-06-06 18:30:57 -07002222#endif
Laura Abbott0577d7b2012-04-17 11:14:30 -07002223 &apq8064_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002224 &msm_tsens_device,
Laura Abbott93a4a352012-05-25 09:26:35 -07002225 &apq8064_cache_dump_device,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002226};
2227
Joel King4e7ad222011-08-17 15:47:38 -07002228static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002229 &apq8064_device_uart_gsbi3,
Yan He06913ce2011-08-26 16:33:46 -07002230 &msm_device_sps_apq8064,
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002231};
2232
2233static struct platform_device *rumi3_devices[] __initdata = {
2234 &apq8064_device_uart_gsbi1,
Yan He435ed612011-11-23 17:34:59 -08002235 &msm_device_sps_apq8064,
Huaibin Yang4a084e32011-12-15 15:25:52 -08002236#ifdef CONFIG_MSM_ROTATOR
2237 &msm_rotator_device,
2238#endif
Joel King4e7ad222011-08-17 15:47:38 -07002239};
2240
Joel King82b7e3f2012-01-05 10:03:27 -08002241static struct platform_device *cdp_devices[] __initdata = {
2242 &apq8064_device_uart_gsbi1,
Jin Hong4bbbfba2012-02-02 21:48:07 -08002243 &apq8064_device_uart_gsbi7,
Joel King82b7e3f2012-01-05 10:03:27 -08002244 &msm_device_sps_apq8064,
Aravind Venkateswaran4ca27532012-02-16 14:27:05 -08002245#ifdef CONFIG_MSM_ROTATOR
2246 &msm_rotator_device,
2247#endif
Joel King82b7e3f2012-01-05 10:03:27 -08002248};
2249
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002250static struct platform_device
2251mpq8064_device_ext_5v_frc_vreg __devinitdata = {
2252 .name = GPIO_REGULATOR_DEV_NAME,
2253 .id = SX150X_GPIO(4, 10),
2254 .dev = {
2255 .platform_data =
2256 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_FRC_5V],
2257 },
2258};
2259
2260static struct platform_device
2261mpq8064_device_ext_1p2_buck_vreg __devinitdata = {
2262 .name = GPIO_REGULATOR_DEV_NAME,
2263 .id = SX150X_GPIO(4, 2),
2264 .dev = {
2265 .platform_data =
2266 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P2V],
2267 },
2268};
2269
2270static struct platform_device
2271mpq8064_device_ext_1p8_buck_vreg __devinitdata = {
2272 .name = GPIO_REGULATOR_DEV_NAME,
2273 .id = SX150X_GPIO(4, 4),
2274 .dev = {
2275 .platform_data =
2276 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P8V],
2277 },
2278};
2279
2280static struct platform_device
2281mpq8064_device_ext_2p2_buck_vreg __devinitdata = {
2282 .name = GPIO_REGULATOR_DEV_NAME,
2283 .id = SX150X_GPIO(4, 14),
2284 .dev = {
2285 .platform_data =
2286 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_2P2V],
2287 },
2288};
2289
2290static struct platform_device
2291mpq8064_device_ext_5v_buck_vreg __devinitdata = {
2292 .name = GPIO_REGULATOR_DEV_NAME,
2293 .id = SX150X_GPIO(4, 3),
2294 .dev = {
2295 .platform_data =
2296 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_5V],
2297 },
2298};
2299
2300static struct platform_device
2301mpq8064_device_ext_3p3v_ldo_vreg __devinitdata = {
2302 .name = GPIO_REGULATOR_DEV_NAME,
2303 .id = SX150X_GPIO(4, 15),
2304 .dev = {
2305 .platform_data =
2306 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_3P3V],
2307 },
2308};
2309
Ravi Kumar V1c903012012-05-15 16:11:35 +05302310static struct platform_device rc_input_loopback_pdev = {
2311 .name = "rc-user-input",
2312 .id = -1,
2313};
2314
Ravi Kumar V040eeff2012-05-23 21:29:23 +05302315static int rf4ce_gpio_init(void)
2316{
2317 if (!machine_is_mpq8064_cdp())
2318 return -EINVAL;
2319
2320 /* CC2533 SRDY Input */
2321 if (!gpio_request(SX150X_GPIO(4, 6), "rf4ce_srdy")) {
2322 gpio_direction_input(SX150X_GPIO(4, 6));
2323 gpio_export(SX150X_GPIO(4, 6), true);
2324 }
2325
2326 /* CC2533 MRDY Output */
2327 if (!gpio_request(SX150X_GPIO(4, 5), "rf4ce_mrdy")) {
2328 gpio_direction_output(SX150X_GPIO(4, 5), 1);
2329 gpio_export(SX150X_GPIO(4, 5), true);
2330 }
2331
2332 /* CC2533 Reset Output */
2333 if (!gpio_request(SX150X_GPIO(4, 7), "rf4ce_reset")) {
2334 gpio_direction_output(SX150X_GPIO(4, 7), 0);
2335 gpio_export(SX150X_GPIO(4, 7), true);
2336 }
2337
2338 return 0;
2339}
2340late_initcall(rf4ce_gpio_init);
2341
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002342static struct platform_device *mpq_devices[] __initdata = {
2343 &msm_device_sps_apq8064,
2344 &mpq8064_device_qup_i2c_gsbi5,
2345#ifdef CONFIG_MSM_ROTATOR
2346 &msm_rotator_device,
2347#endif
Ravi Kumar V05931a22012-04-04 17:09:37 +05302348 &gpio_ir_recv_pdev,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002349 &mpq8064_device_ext_5v_frc_vreg,
2350 &mpq8064_device_ext_1p2_buck_vreg,
2351 &mpq8064_device_ext_1p8_buck_vreg,
2352 &mpq8064_device_ext_2p2_buck_vreg,
2353 &mpq8064_device_ext_5v_buck_vreg,
2354 &mpq8064_device_ext_3p3v_ldo_vreg,
Terence Hampson2e1705f2012-04-11 19:55:29 -04002355#ifdef CONFIG_MSM_VCAP
2356 &msm8064_device_vcap,
2357#endif
Ravi Kumar V1c903012012-05-15 16:11:35 +05302358 &rc_input_loopback_pdev,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002359};
2360
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002361static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002362 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002363};
2364
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002365#define KS8851_IRQ_GPIO 43
2366
2367static struct spi_board_info spi_board_info[] __initdata = {
2368 {
2369 .modalias = "ks8851",
2370 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2371 .max_speed_hz = 19200000,
2372 .bus_num = 0,
2373 .chip_select = 2,
2374 .mode = SPI_MODE_0,
2375 },
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002376 {
2377 .modalias = "epm_adc",
2378 .max_speed_hz = 1100000,
2379 .bus_num = 0,
2380 .chip_select = 3,
2381 .mode = SPI_MODE_0,
2382 },
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002383};
2384
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002385static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002386 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08002387 .bus_num = 1,
2388 .slim_slave = &apq8064_slim_tabla,
2389 },
2390 {
2391 .bus_num = 1,
2392 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002393 },
2394 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002395};
2396
David Keitel3c40fc52012-02-09 17:53:52 -08002397static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi1_pdata = {
2398 .clk_freq = 100000,
2399 .src_clk_rate = 24000000,
2400};
2401
Jing Lin04601f92012-02-05 15:36:07 -08002402static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi3_pdata = {
Anirudh Ghayalc2163472012-04-10 14:58:14 +05302403 .clk_freq = 384000,
Jing Lin04601f92012-02-05 15:36:07 -08002404 .src_clk_rate = 24000000,
2405};
2406
Kenneth Heitke748593a2011-07-15 15:45:11 -06002407static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
2408 .clk_freq = 100000,
2409 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002410};
2411
Joel King8f839b92012-04-01 14:37:46 -07002412static struct msm_i2c_platform_data mpq8064_i2c_qup_gsbi5_pdata = {
2413 .clk_freq = 100000,
2414 .src_clk_rate = 24000000,
2415};
2416
David Keitel3c40fc52012-02-09 17:53:52 -08002417#define GSBI_DUAL_MODE_CODE 0x60
2418#define MSM_GSBI1_PHYS 0x12440000
Kenneth Heitke748593a2011-07-15 15:45:11 -06002419static void __init apq8064_i2c_init(void)
2420{
David Keitel3c40fc52012-02-09 17:53:52 -08002421 void __iomem *gsbi_mem;
2422
2423 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2424 &apq8064_i2c_qup_gsbi1_pdata;
2425 gsbi_mem = ioremap_nocache(MSM_GSBI1_PHYS, 4);
2426 writel_relaxed(GSBI_DUAL_MODE_CODE, gsbi_mem);
2427 /* Ensure protocol code is written before proceeding */
2428 wmb();
2429 iounmap(gsbi_mem);
2430 apq8064_i2c_qup_gsbi1_pdata.use_gsbi_shared_mode = 1;
Jing Lin04601f92012-02-05 15:36:07 -08002431 apq8064_device_qup_i2c_gsbi3.dev.platform_data =
2432 &apq8064_i2c_qup_gsbi3_pdata;
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002433 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2434 &apq8064_i2c_qup_gsbi1_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002435 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
2436 &apq8064_i2c_qup_gsbi4_pdata;
Joel King8f839b92012-04-01 14:37:46 -07002437 mpq8064_device_qup_i2c_gsbi5.dev.platform_data =
2438 &mpq8064_i2c_qup_gsbi5_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002439}
2440
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002441#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002442static int ethernet_init(void)
2443{
2444 int ret;
2445 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
2446 if (ret) {
2447 pr_err("ks8851 gpio_request failed: %d\n", ret);
2448 goto fail;
2449 }
2450
2451 return 0;
2452fail:
2453 return ret;
2454}
2455#else
2456static int ethernet_init(void)
2457{
2458 return 0;
2459}
2460#endif
2461
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302462#define GPIO_KEY_HOME PM8921_GPIO_PM_TO_SYS(27)
2463#define GPIO_KEY_VOLUME_UP PM8921_GPIO_PM_TO_SYS(35)
2464#define GPIO_KEY_VOLUME_DOWN PM8921_GPIO_PM_TO_SYS(38)
2465#define GPIO_KEY_CAM_FOCUS PM8921_GPIO_PM_TO_SYS(3)
2466#define GPIO_KEY_CAM_SNAP PM8921_GPIO_PM_TO_SYS(4)
Jing Lin3f8f8422012-03-05 09:32:11 -08002467#define GPIO_KEY_ROTATION PM8921_GPIO_PM_TO_SYS(42)
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302468
2469static struct gpio_keys_button cdp_keys[] = {
2470 {
2471 .code = KEY_HOME,
2472 .gpio = GPIO_KEY_HOME,
2473 .desc = "home_key",
2474 .active_low = 1,
2475 .type = EV_KEY,
2476 .wakeup = 1,
2477 .debounce_interval = 15,
2478 },
2479 {
2480 .code = KEY_VOLUMEUP,
2481 .gpio = GPIO_KEY_VOLUME_UP,
2482 .desc = "volume_up_key",
2483 .active_low = 1,
2484 .type = EV_KEY,
2485 .wakeup = 1,
2486 .debounce_interval = 15,
2487 },
2488 {
2489 .code = KEY_VOLUMEDOWN,
2490 .gpio = GPIO_KEY_VOLUME_DOWN,
2491 .desc = "volume_down_key",
2492 .active_low = 1,
2493 .type = EV_KEY,
2494 .wakeup = 1,
2495 .debounce_interval = 15,
2496 },
2497 {
2498 .code = SW_ROTATE_LOCK,
2499 .gpio = GPIO_KEY_ROTATION,
2500 .desc = "rotate_key",
2501 .active_low = 1,
2502 .type = EV_SW,
2503 .debounce_interval = 15,
2504 },
2505};
2506
2507static struct gpio_keys_platform_data cdp_keys_data = {
2508 .buttons = cdp_keys,
2509 .nbuttons = ARRAY_SIZE(cdp_keys),
2510};
2511
2512static struct platform_device cdp_kp_pdev = {
2513 .name = "gpio-keys",
2514 .id = -1,
2515 .dev = {
2516 .platform_data = &cdp_keys_data,
2517 },
2518};
2519
2520static struct gpio_keys_button mtp_keys[] = {
2521 {
2522 .code = KEY_CAMERA_FOCUS,
2523 .gpio = GPIO_KEY_CAM_FOCUS,
2524 .desc = "cam_focus_key",
2525 .active_low = 1,
2526 .type = EV_KEY,
2527 .wakeup = 1,
2528 .debounce_interval = 15,
2529 },
2530 {
2531 .code = KEY_VOLUMEUP,
2532 .gpio = GPIO_KEY_VOLUME_UP,
2533 .desc = "volume_up_key",
2534 .active_low = 1,
2535 .type = EV_KEY,
2536 .wakeup = 1,
2537 .debounce_interval = 15,
2538 },
2539 {
2540 .code = KEY_VOLUMEDOWN,
2541 .gpio = GPIO_KEY_VOLUME_DOWN,
2542 .desc = "volume_down_key",
2543 .active_low = 1,
2544 .type = EV_KEY,
2545 .wakeup = 1,
2546 .debounce_interval = 15,
2547 },
2548 {
2549 .code = KEY_CAMERA_SNAPSHOT,
2550 .gpio = GPIO_KEY_CAM_SNAP,
2551 .desc = "cam_snap_key",
2552 .active_low = 1,
2553 .type = EV_KEY,
2554 .debounce_interval = 15,
2555 },
2556};
2557
2558static struct gpio_keys_platform_data mtp_keys_data = {
2559 .buttons = mtp_keys,
2560 .nbuttons = ARRAY_SIZE(mtp_keys),
2561};
2562
2563static struct platform_device mtp_kp_pdev = {
2564 .name = "gpio-keys",
2565 .id = -1,
2566 .dev = {
2567 .platform_data = &mtp_keys_data,
2568 },
2569};
2570
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05302571static struct gpio_keys_button mpq_keys[] = {
2572 {
2573 .code = KEY_VOLUMEDOWN,
2574 .gpio = GPIO_KEY_VOLUME_DOWN,
2575 .desc = "volume_down_key",
2576 .active_low = 1,
2577 .type = EV_KEY,
2578 .wakeup = 1,
2579 .debounce_interval = 15,
2580 },
2581 {
2582 .code = KEY_VOLUMEUP,
2583 .gpio = GPIO_KEY_VOLUME_UP,
2584 .desc = "volume_up_key",
2585 .active_low = 1,
2586 .type = EV_KEY,
2587 .wakeup = 1,
2588 .debounce_interval = 15,
2589 },
2590};
2591
2592static struct gpio_keys_platform_data mpq_keys_data = {
2593 .buttons = mpq_keys,
2594 .nbuttons = ARRAY_SIZE(mpq_keys),
2595};
2596
2597static struct platform_device mpq_gpio_keys_pdev = {
2598 .name = "gpio-keys",
2599 .id = -1,
2600 .dev = {
2601 .platform_data = &mpq_keys_data,
2602 },
2603};
2604
2605#define MPQ_KP_ROW_BASE SX150X_EXP2_GPIO_BASE
2606#define MPQ_KP_COL_BASE (SX150X_EXP2_GPIO_BASE + 4)
2607
2608static unsigned int mpq_row_gpios[] = {MPQ_KP_ROW_BASE, MPQ_KP_ROW_BASE + 1,
2609 MPQ_KP_ROW_BASE + 2, MPQ_KP_ROW_BASE + 3};
2610static unsigned int mpq_col_gpios[] = {MPQ_KP_COL_BASE, MPQ_KP_COL_BASE + 1,
2611 MPQ_KP_COL_BASE + 2};
2612
2613static const unsigned int mpq_keymap[] = {
2614 KEY(0, 0, KEY_UP),
2615 KEY(0, 1, KEY_ENTER),
2616 KEY(0, 2, KEY_3),
2617
2618 KEY(1, 0, KEY_DOWN),
2619 KEY(1, 1, KEY_EXIT),
2620 KEY(1, 2, KEY_4),
2621
2622 KEY(2, 0, KEY_LEFT),
2623 KEY(2, 1, KEY_1),
2624 KEY(2, 2, KEY_5),
2625
2626 KEY(3, 0, KEY_RIGHT),
2627 KEY(3, 1, KEY_2),
2628 KEY(3, 2, KEY_6),
2629};
2630
2631static struct matrix_keymap_data mpq_keymap_data = {
2632 .keymap_size = ARRAY_SIZE(mpq_keymap),
2633 .keymap = mpq_keymap,
2634};
2635
2636static struct matrix_keypad_platform_data mpq_keypad_data = {
2637 .keymap_data = &mpq_keymap_data,
2638 .row_gpios = mpq_row_gpios,
2639 .col_gpios = mpq_col_gpios,
2640 .num_row_gpios = ARRAY_SIZE(mpq_row_gpios),
2641 .num_col_gpios = ARRAY_SIZE(mpq_col_gpios),
2642 .col_scan_delay_us = 32000,
2643 .debounce_ms = 20,
2644 .wakeup = 1,
2645 .active_low = 1,
2646 .no_autorepeat = 1,
2647};
2648
2649static struct platform_device mpq_keypad_device = {
2650 .name = "matrix-keypad",
2651 .id = -1,
2652 .dev = {
2653 .platform_data = &mpq_keypad_data,
2654 },
2655};
2656
Jin Hongd3024e62012-02-09 16:13:32 -08002657/* Sensors DSPS platform data */
2658#define DSPS_PIL_GENERIC_NAME "dsps"
2659static void __init apq8064_init_dsps(void)
2660{
2661 struct msm_dsps_platform_data *pdata =
2662 msm_dsps_device_8064.dev.platform_data;
2663 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
2664 pdata->gpios = NULL;
2665 pdata->gpios_num = 0;
2666
2667 platform_device_register(&msm_dsps_device_8064);
2668}
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302669
Jing Lin417fa452012-02-05 14:31:06 -08002670#define I2C_SURF 1
2671#define I2C_FFA (1 << 1)
2672#define I2C_RUMI (1 << 2)
2673#define I2C_SIM (1 << 3)
2674#define I2C_LIQUID (1 << 4)
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002675#define I2C_MPQ_CDP BIT(5)
2676#define I2C_MPQ_HRD BIT(6)
2677#define I2C_MPQ_DTV BIT(7)
Jing Lin417fa452012-02-05 14:31:06 -08002678
2679struct i2c_registry {
2680 u8 machs;
2681 int bus;
2682 struct i2c_board_info *info;
2683 int len;
2684};
2685
2686static struct i2c_registry apq8064_i2c_devices[] __initdata = {
Jing Lin21ed4de2012-02-05 15:53:28 -08002687 {
David Keitel2f613d92012-02-15 11:29:16 -08002688 I2C_LIQUID,
2689 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
2690 smb349_charger_i2c_info,
2691 ARRAY_SIZE(smb349_charger_i2c_info)
2692 },
2693 {
Jing Lin21ed4de2012-02-05 15:53:28 -08002694 I2C_SURF | I2C_LIQUID,
2695 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
2696 mxt_device_info,
2697 ARRAY_SIZE(mxt_device_info),
2698 },
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08002699 {
2700 I2C_FFA,
2701 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
2702 cyttsp_info,
2703 ARRAY_SIZE(cyttsp_info),
2704 },
Amy Maloche70090f992012-02-16 16:35:26 -08002705 {
2706 I2C_FFA | I2C_LIQUID,
2707 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
2708 isa1200_board_info,
2709 ARRAY_SIZE(isa1200_board_info),
2710 },
Santosh Mardieff9a742012-04-09 23:23:39 +05302711 {
2712 I2C_MPQ_CDP,
2713 APQ_8064_GSBI5_QUP_I2C_BUS_ID,
2714 cs8427_device_info,
2715 ARRAY_SIZE(cs8427_device_info),
2716 },
Jing Lin417fa452012-02-05 14:31:06 -08002717};
2718
Jay Chokshi607f61b2012-04-25 18:21:21 -07002719#define SX150X_EXP1_INT_N PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9)
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05302720#define SX150X_EXP2_INT_N MSM_GPIO_TO_INT(81)
Jay Chokshi607f61b2012-04-25 18:21:21 -07002721
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002722struct sx150x_platform_data mpq8064_sx150x_pdata[] = {
2723 [SX150X_EXP1] = {
2724 .gpio_base = SX150X_EXP1_GPIO_BASE,
2725 .oscio_is_gpo = false,
2726 .io_pullup_ena = 0x0,
2727 .io_pulldn_ena = 0x0,
2728 .io_open_drain_ena = 0x0,
2729 .io_polarity = 0,
Jay Chokshi607f61b2012-04-25 18:21:21 -07002730 .irq_summary = SX150X_EXP1_INT_N,
2731 .irq_base = SX150X_EXP1_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002732 },
2733 [SX150X_EXP2] = {
2734 .gpio_base = SX150X_EXP2_GPIO_BASE,
2735 .oscio_is_gpo = false,
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05302736 .io_pullup_ena = 0x0f,
2737 .io_pulldn_ena = 0x70,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002738 .io_open_drain_ena = 0x0,
2739 .io_polarity = 0,
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05302740 .irq_summary = SX150X_EXP2_INT_N,
2741 .irq_base = SX150X_EXP2_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002742 },
2743 [SX150X_EXP3] = {
2744 .gpio_base = SX150X_EXP3_GPIO_BASE,
2745 .oscio_is_gpo = false,
2746 .io_pullup_ena = 0x0,
2747 .io_pulldn_ena = 0x0,
2748 .io_open_drain_ena = 0x0,
2749 .io_polarity = 0,
2750 .irq_summary = -1,
2751 },
2752 [SX150X_EXP4] = {
2753 .gpio_base = SX150X_EXP4_GPIO_BASE,
2754 .oscio_is_gpo = false,
2755 .io_pullup_ena = 0x0,
2756 .io_pulldn_ena = 0x0,
2757 .io_open_drain_ena = 0x0,
2758 .io_polarity = 0,
2759 .irq_summary = -1,
2760 },
2761};
2762
2763static struct i2c_board_info sx150x_gpio_exp_info[] = {
2764 {
2765 I2C_BOARD_INFO("sx1509q", 0x70),
2766 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP1],
2767 },
2768 {
2769 I2C_BOARD_INFO("sx1508q", 0x23),
2770 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP2],
2771 },
2772 {
2773 I2C_BOARD_INFO("sx1508q", 0x22),
2774 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP3],
2775 },
2776 {
2777 I2C_BOARD_INFO("sx1509q", 0x3E),
2778 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP4],
2779 },
2780};
2781
2782#define MPQ8064_I2C_GSBI5_BUS_ID 5
2783
2784static struct i2c_registry mpq8064_i2c_devices[] __initdata = {
2785 {
2786 I2C_MPQ_CDP,
2787 MPQ8064_I2C_GSBI5_BUS_ID,
2788 sx150x_gpio_exp_info,
2789 ARRAY_SIZE(sx150x_gpio_exp_info),
2790 },
2791};
2792
Jing Lin417fa452012-02-05 14:31:06 -08002793static void __init register_i2c_devices(void)
2794{
2795 u8 mach_mask = 0;
2796 int i;
2797
Kevin Chand07220e2012-02-13 15:52:22 -08002798#ifdef CONFIG_MSM_CAMERA
2799 struct i2c_registry apq8064_camera_i2c_devices = {
2800 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_RUMI,
2801 APQ_8064_GSBI4_QUP_I2C_BUS_ID,
2802 apq8064_camera_board_info.board_info,
2803 apq8064_camera_board_info.num_i2c_board_info,
2804 };
2805#endif
Jing Lin417fa452012-02-05 14:31:06 -08002806 /* Build the matching 'supported_machs' bitmask */
2807 if (machine_is_apq8064_cdp())
2808 mach_mask = I2C_SURF;
2809 else if (machine_is_apq8064_mtp())
2810 mach_mask = I2C_FFA;
2811 else if (machine_is_apq8064_liquid())
2812 mach_mask = I2C_LIQUID;
2813 else if (machine_is_apq8064_rumi3())
2814 mach_mask = I2C_RUMI;
2815 else if (machine_is_apq8064_sim())
2816 mach_mask = I2C_SIM;
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002817 else if (PLATFORM_IS_MPQ8064())
2818 mach_mask = I2C_MPQ_CDP;
Jing Lin417fa452012-02-05 14:31:06 -08002819 else
2820 pr_err("unmatched machine ID in register_i2c_devices\n");
2821
2822 /* Run the array and install devices as appropriate */
2823 for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) {
2824 if (apq8064_i2c_devices[i].machs & mach_mask)
2825 i2c_register_board_info(apq8064_i2c_devices[i].bus,
2826 apq8064_i2c_devices[i].info,
2827 apq8064_i2c_devices[i].len);
2828 }
Kevin Chand07220e2012-02-13 15:52:22 -08002829#ifdef CONFIG_MSM_CAMERA
2830 if (apq8064_camera_i2c_devices.machs & mach_mask)
2831 i2c_register_board_info(apq8064_camera_i2c_devices.bus,
2832 apq8064_camera_i2c_devices.info,
2833 apq8064_camera_i2c_devices.len);
2834#endif
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002835
2836 for (i = 0; i < ARRAY_SIZE(mpq8064_i2c_devices); ++i) {
2837 if (mpq8064_i2c_devices[i].machs & mach_mask)
2838 i2c_register_board_info(
2839 mpq8064_i2c_devices[i].bus,
2840 mpq8064_i2c_devices[i].info,
2841 mpq8064_i2c_devices[i].len);
2842 }
Jing Lin417fa452012-02-05 14:31:06 -08002843}
2844
Jay Chokshi994ff122012-03-27 15:43:48 -07002845static void enable_ddr3_regulator(void)
2846{
2847 static struct regulator *ext_ddr3;
2848
2849 /* Use MPP7 output state as a flag for PCDDR3 presence. */
2850 if (gpio_get_value_cansleep(PM8921_MPP_PM_TO_SYS(7)) > 0) {
2851 ext_ddr3 = regulator_get(NULL, "ext_ddr3");
2852 if (IS_ERR(ext_ddr3) || ext_ddr3 == NULL)
2853 pr_err("Could not get MPP7 regulator\n");
2854 else
2855 regulator_enable(ext_ddr3);
2856 }
2857}
2858
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002859static void enable_avc_i2c_bus(void)
2860{
2861 int avc_i2c_en_mpp = PM8921_MPP_PM_TO_SYS(8);
2862 int rc;
2863
2864 rc = gpio_request(avc_i2c_en_mpp, "avc_i2c_en");
2865 if (rc)
2866 pr_err("request for avc_i2c_en mpp failed,"
2867 "rc=%d\n", rc);
2868 else
2869 gpio_set_value_cansleep(avc_i2c_en_mpp, 1);
2870}
2871
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002872static void __init apq8064_common_init(void)
2873{
Joel King8f839b92012-04-01 14:37:46 -07002874 msm_tsens_early_init(&apq_tsens_pdata);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002875 if (socinfo_init() < 0)
2876 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06002877 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
2878 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
David Collins2782b5c2012-02-06 10:02:42 -08002879 regulator_suppress_info_printing();
2880 platform_device_register(&apq8064_device_rpm_regulator);
Stephen Boyd4d0d2582012-02-10 14:49:40 -08002881 if (msm_xo_init())
2882 pr_err("Failed to initialize XO votes\n");
Matt Wagantallc51e5602012-02-27 17:25:25 -08002883 msm_clock_init(&apq8064_clock_init_data);
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08002884 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06002885 apq8064_i2c_init();
Jing Lin417fa452012-02-05 14:31:06 -08002886 register_i2c_devices();
Kenneth Heitke36920d32011-07-20 16:44:30 -06002887
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002888 apq8064_device_qup_spi_gsbi5.dev.platform_data =
2889 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08002890 apq8064_init_pmic();
Hemant Kumar94e7da22012-02-03 16:52:29 -08002891 if (machine_is_apq8064_liquid())
2892 msm_otg_pdata.mhl_enable = true;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07002893
Ofir Cohen94213a72012-05-03 14:26:32 +03002894 android_usb_pdata.swfi_latency =
2895 msm_rpmrs_levels[0].latency_us;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07002896
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002897 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Manu Gautam91223e02011-11-08 15:27:22 +05302898 apq8064_ehci_host_init();
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002899 apq8064_init_buses();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002900 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Terence Hampson36b70722012-05-10 13:18:16 -04002901 if (!(machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
2902 machine_is_mpq8064_dtv()))
2903 platform_add_devices(common_not_mpq_devices,
2904 ARRAY_SIZE(common_not_mpq_devices));
Jay Chokshi994ff122012-03-27 15:43:48 -07002905 enable_ddr3_regulator();
Hemant Kumarf1ca9192012-02-07 18:59:33 -08002906 if (machine_is_apq8064_mtp()) {
2907 apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
2908 device_initialize(&apq8064_device_hsic_host.dev);
2909 }
Jay Chokshie8741282012-01-25 15:22:55 -08002910 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05302911 apq8064_init_mmc();
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08002912
2913 if (machine_is_apq8064_mtp()) {
2914 mdm_8064_device.dev.platform_data = &mdm_platform_data;
2915 platform_device_register(&mdm_8064_device);
2916 }
2917 platform_device_register(&apq8064_slim_ctrl);
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002918 slim_register_board_info(apq8064_slim_devices,
2919 ARRAY_SIZE(apq8064_slim_devices));
Jin Hongd3024e62012-02-09 16:13:32 -08002920 apq8064_init_dsps();
Praveen Chidambaram78499012011-11-01 17:15:17 -06002921 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Mahesh Sivasubramaniancbce1ec2012-01-24 10:32:44 -07002922 acpuclk_init(&acpuclk_8064_soc_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002923 msm_spm_l2_init(msm_spm_l2_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002924 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Praveen Chidambaram4d19be42012-04-03 18:05:52 -06002925 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002926 apq8064_epm_adc_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002927}
2928
Huaibin Yang4a084e32011-12-15 15:25:52 -08002929static void __init apq8064_allocate_memory_regions(void)
2930{
2931 apq8064_allocate_fb_region();
2932}
2933
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002934static void __init apq8064_sim_init(void)
2935{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002936 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
2937 &msm8064_device_watchdog.dev.platform_data;
2938
2939 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002940 apq8064_common_init();
Joel King4e7ad222011-08-17 15:47:38 -07002941 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
2942}
2943
2944static void __init apq8064_rumi3_init(void)
2945{
2946 apq8064_common_init();
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002947 ethernet_init();
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002948 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002949 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002950}
2951
Joel King82b7e3f2012-01-05 10:03:27 -08002952static void __init apq8064_cdp_init(void)
2953{
Hanumant Singh50440d42012-04-23 19:27:16 -07002954 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2955 pr_err("meminfo_init() failed!\n");
Joel King82b7e3f2012-01-05 10:03:27 -08002956 apq8064_common_init();
Joel King8f839b92012-04-01 14:37:46 -07002957 if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
2958 machine_is_mpq8064_dtv()) {
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002959 enable_avc_i2c_bus();
Joel King8f839b92012-04-01 14:37:46 -07002960 platform_add_devices(mpq_devices, ARRAY_SIZE(mpq_devices));
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002961 mpq8064_pcie_init();
Joel King8f839b92012-04-01 14:37:46 -07002962 } else {
2963 ethernet_init();
2964 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
2965 spi_register_board_info(spi_board_info,
2966 ARRAY_SIZE(spi_board_info));
2967 }
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002968 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07002969 apq8064_init_gpu();
Matt Wagantall1f65d9d2012-04-25 14:24:20 -07002970 platform_add_devices(apq8064_footswitch, apq8064_num_footswitch);
Steve Mucklef132c6c2012-06-06 18:30:57 -07002971#ifdef CONFIG_MSM_CAMERA
Kevin Chand07220e2012-02-13 15:52:22 -08002972 apq8064_init_cam();
Steve Mucklef132c6c2012-06-06 18:30:57 -07002973#endif
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302974
2975 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
2976 platform_device_register(&cdp_kp_pdev);
2977
2978 if (machine_is_apq8064_mtp())
2979 platform_device_register(&mtp_kp_pdev);
Hanumant Singh50440d42012-04-23 19:27:16 -07002980
2981 change_memory_power = &apq8064_change_memory_power;
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05302982
2983 if (machine_is_mpq8064_cdp()) {
2984 platform_device_register(&mpq_gpio_keys_pdev);
2985 platform_device_register(&mpq_keypad_device);
2986 }
Joel King82b7e3f2012-01-05 10:03:27 -08002987}
2988
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002989MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
2990 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002991 .reserve = apq8064_reserve,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002992 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302993 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002994 .timer = &msm_timer,
2995 .init_machine = apq8064_sim_init,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002996 .restart = msm_restart,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002997MACHINE_END
2998
Joel King4e7ad222011-08-17 15:47:38 -07002999MACHINE_START(APQ8064_RUMI3, "QCT APQ8064 RUMI3")
3000 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07003001 .reserve = apq8064_reserve,
Joel King4e7ad222011-08-17 15:47:38 -07003002 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303003 .handle_irq = gic_handle_irq,
Joel King4e7ad222011-08-17 15:47:38 -07003004 .timer = &msm_timer,
3005 .init_machine = apq8064_rumi3_init,
Huaibin Yang4a084e32011-12-15 15:25:52 -08003006 .init_early = apq8064_allocate_memory_regions,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003007 .restart = msm_restart,
Joel King4e7ad222011-08-17 15:47:38 -07003008MACHINE_END
3009
Joel King82b7e3f2012-01-05 10:03:27 -08003010MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
3011 .map_io = apq8064_map_io,
3012 .reserve = apq8064_reserve,
3013 .init_irq = apq8064_init_irq,
3014 .handle_irq = gic_handle_irq,
3015 .timer = &msm_timer,
3016 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003017 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003018 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003019 .restart = msm_restart,
Joel King82b7e3f2012-01-05 10:03:27 -08003020MACHINE_END
3021
3022MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
3023 .map_io = apq8064_map_io,
3024 .reserve = apq8064_reserve,
3025 .init_irq = apq8064_init_irq,
3026 .handle_irq = gic_handle_irq,
3027 .timer = &msm_timer,
3028 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003029 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003030 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003031 .restart = msm_restart,
Joel King82b7e3f2012-01-05 10:03:27 -08003032MACHINE_END
3033
3034MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
3035 .map_io = apq8064_map_io,
3036 .reserve = apq8064_reserve,
3037 .init_irq = apq8064_init_irq,
3038 .handle_irq = gic_handle_irq,
3039 .timer = &msm_timer,
3040 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003041 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003042 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003043 .restart = msm_restart,
Joel King82b7e3f2012-01-05 10:03:27 -08003044MACHINE_END
3045
Joel King064bbf82012-04-01 13:23:39 -07003046MACHINE_START(MPQ8064_CDP, "QCT MPQ8064 CDP")
3047 .map_io = apq8064_map_io,
3048 .reserve = apq8064_reserve,
3049 .init_irq = apq8064_init_irq,
3050 .handle_irq = gic_handle_irq,
3051 .timer = &msm_timer,
3052 .init_machine = apq8064_cdp_init,
3053 .init_early = apq8064_allocate_memory_regions,
3054 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003055 .restart = msm_restart,
Joel King064bbf82012-04-01 13:23:39 -07003056MACHINE_END
3057
Joel King11ca8202012-02-13 16:19:03 -08003058MACHINE_START(MPQ8064_HRD, "QCT MPQ8064 HRD")
3059 .map_io = apq8064_map_io,
3060 .reserve = apq8064_reserve,
3061 .init_irq = apq8064_init_irq,
3062 .handle_irq = gic_handle_irq,
3063 .timer = &msm_timer,
3064 .init_machine = apq8064_cdp_init,
Joel King3a57e772012-05-28 11:22:55 -07003065 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003066 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003067 .restart = msm_restart,
Joel King11ca8202012-02-13 16:19:03 -08003068MACHINE_END
3069
3070MACHINE_START(MPQ8064_DTV, "QCT MPQ8064 DTV")
3071 .map_io = apq8064_map_io,
3072 .reserve = apq8064_reserve,
3073 .init_irq = apq8064_init_irq,
3074 .handle_irq = gic_handle_irq,
3075 .timer = &msm_timer,
3076 .init_machine = apq8064_cdp_init,
Joel King3a57e772012-05-28 11:22:55 -07003077 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003078 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003079 .restart = msm_restart,
Joel King11ca8202012-02-13 16:19:03 -08003080MACHINE_END
3081