blob: c1231380052bb3e79f1c2b4f3a28d3e603003488 [file] [log] [blame]
Manu Gautam5143b252012-01-05 19:25:23 -08001/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13#include <linux/kernel.h>
14#include <linux/platform_device.h>
15#include <linux/io.h>
16#include <linux/irq.h>
Kenneth Heitke748593a2011-07-15 15:45:11 -060017#include <linux/i2c.h>
David Keitel2f613d92012-02-15 11:29:16 -080018#include <linux/i2c/smb349.h>
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -080019#include <linux/i2c/sx150x.h>
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -060020#include <linux/slimbus/slimbus.h>
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +053021#include <linux/mfd/wcd9xxx/core.h>
22#include <linux/mfd/wcd9xxx/pdata.h>
Amy Maloche70090f992012-02-16 16:35:26 -080023#include <linux/mfd/pm8xxx/misc.h>
Kenneth Heitke36920d32011-07-20 16:44:30 -060024#include <linux/msm_ssbi.h>
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -070025#include <linux/spi/spi.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070026#include <linux/dma-mapping.h>
27#include <linux/platform_data/qcom_crypto_device.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080028#include <linux/ion.h>
Jack Cheung46bfffa2012-01-19 15:26:24 -080029#include <linux/memory.h>
Larry Bassel67b921d2012-04-06 10:23:27 -070030#include <linux/memblock.h>
Jing Lin21ed4de2012-02-05 15:53:28 -080031#include <linux/i2c/atmel_mxt_ts.h>
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -080032#include <linux/cyttsp.h>
Amy Maloche70090f992012-02-16 16:35:26 -080033#include <linux/i2c/isa1200.h>
Mohan Pallaka474b94b2012-01-25 12:59:58 +053034#include <linux/gpio_keys.h>
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -080035#include <linux/epm_adc.h>
Jay Chokshie7d8d4f2012-04-04 14:47:57 -070036#include <linux/i2c/sx150x.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070037#include <asm/mach-types.h>
38#include <asm/mach/arch.h>
39#include <asm/hardware/gic.h>
Sahitya Tummala3586ed92011-08-03 09:13:23 +053040#include <asm/mach/mmc.h>
Ankit Verma6b7e2ba2012-01-26 15:48:54 -080041#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070042
43#include <mach/board.h>
44#include <mach/msm_iomap.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080045#include <mach/ion.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070046#include <linux/usb/msm_hsusb.h>
47#include <linux/usb/android.h>
48#include <mach/socinfo.h>
Harini Jayaramanc4c58692011-07-19 14:50:10 -060049#include <mach/msm_spi.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070050#include "timer.h"
51#include "devices.h"
Joel King4ebccc62011-07-22 09:43:22 -070052#include <mach/gpio.h>
53#include <mach/gpiomux.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060054#include <mach/rpm.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080055#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -070056#include <linux/android_pmem.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080057#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070058#include <mach/msm_memtypes.h>
59#include <linux/bootmem.h>
60#include <asm/setup.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070061#include <mach/dma.h>
Jin Hongd3024e62012-02-09 16:13:32 -080062#include <mach/msm_dsps.h>
Gagan Mac8a7a5d32011-11-11 16:43:06 -070063#include <mach/msm_bus_board.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060064#include <mach/cpuidle.h>
Joel Kingdacbc822012-01-25 13:30:57 -080065#include <mach/mdm2.h>
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -080066#include <linux/msm_tsens.h>
Stephen Boyd4d0d2582012-02-10 14:49:40 -080067#include <mach/msm_xo.h>
Laura Abbott350c8362012-02-28 14:46:52 -080068#include <mach/msm_rtb.h>
Santosh Mardieff9a742012-04-09 23:23:39 +053069#include <sound/cs8427.h>
Ravi Kumar V05931a22012-04-04 17:09:37 +053070#include <media/gpio-ir-recv.h>
Larry Bassel67b921d2012-04-06 10:23:27 -070071#include <linux/fmem.h>
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -060072#include <mach/msm_pcie.h>
Joel King4ebccc62011-07-22 09:43:22 -070073
Jeff Ohlstein7e668552011-10-06 16:17:25 -070074#include "msm_watchdog.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080075#include "board-8064.h"
Vikram Mulukutlabc2e9572011-11-04 03:41:38 -070076#include "acpuclock.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060077#include "spm.h"
Subhash Jadavani909e04f2012-04-12 10:52:50 +053078#include <mach/mpm.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060079#include "rpm_resources.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080080#include "pm.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060081#include "pm-boot.h"
Rajesh Sastrulaaee8af32012-01-20 11:46:31 -080082#include "devices-msm8x60.h"
Hanumant Singh50440d42012-04-23 19:27:16 -070083#include "smd_private.h"
Jay Chokshiea67c622011-07-29 17:12:26 -070084
Olav Haugan7c6aa742012-01-16 16:47:37 -080085#define MSM_PMEM_ADSP_SIZE 0x7800000
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -070086#define MSM_PMEM_AUDIO_SIZE 0x4CF000
Olav Haugan7c6aa742012-01-16 16:47:37 -080087#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
88#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
89#else
Chetan Kalyan72aac4f2012-02-23 14:56:54 -080090#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Olav Haugan7c6aa742012-01-16 16:47:37 -080091#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070092
Olav Haugan7c6aa742012-01-16 16:47:37 -080093#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -070094#define MSM_PMEM_KERNEL_EBI1_SIZE 0x65000
Olav Haugan129992c2012-03-22 09:54:01 -070095#ifdef CONFIG_MSM_IOMMU
96#define MSM_ION_MM_SIZE 0x3800000
97#define MSM_ION_SF_SIZE 0
98#define MSM_ION_HEAP_NUM 7
99#else
Olav Haugan7c6aa742012-01-16 16:47:37 -0800100#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Haugan129992c2012-03-22 09:54:01 -0700101#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
102#define MSM_ION_HEAP_NUM 8
103#endif
104#define MSM_ION_MM_FW_SIZE 0x200000 /* (2MB) */
Olav Haugan3a9bd232012-02-15 14:23:27 -0800105#define MSM_ION_QSECOM_SIZE 0x300000 /* (3MB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800106#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan2c43fac2012-01-19 11:06:37 -0800107#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Olav Haugan7c6aa742012-01-16 16:47:37 -0800108#else
109#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
110#define MSM_ION_HEAP_NUM 1
111#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700112
Larry Bassel67b921d2012-04-06 10:23:27 -0700113#define APQ8064_FIXED_AREA_START 0xa0000000
114#define MAX_FIXED_AREA_SIZE 0x10000000
115#define MSM_MM_FW_SIZE 0x200000
116#define APQ8064_FW_START (APQ8064_FIXED_AREA_START - MSM_MM_FW_SIZE)
117
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -0600118/* PCIe power enable pmic gpio */
119#define PCIE_PWR_EN_PMIC_GPIO 13
120#define PCIE_RST_N_PMIC_MPP 1
121
Olav Haugan7c6aa742012-01-16 16:47:37 -0800122#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
123static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
124static int __init pmem_kernel_ebi1_size_setup(char *p)
Kevin Chan13be4e22011-10-20 11:30:32 -0700125{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800126 pmem_kernel_ebi1_size = memparse(p, NULL);
127 return 0;
Kevin Chan13be4e22011-10-20 11:30:32 -0700128}
Olav Haugan7c6aa742012-01-16 16:47:37 -0800129early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
130#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700131
Olav Haugan7c6aa742012-01-16 16:47:37 -0800132#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -0700133static unsigned pmem_size = MSM_PMEM_SIZE;
134static int __init pmem_size_setup(char *p)
135{
136 pmem_size = memparse(p, NULL);
137 return 0;
138}
139early_param("pmem_size", pmem_size_setup);
140
141static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
142
143static int __init pmem_adsp_size_setup(char *p)
144{
145 pmem_adsp_size = memparse(p, NULL);
146 return 0;
147}
148early_param("pmem_adsp_size", pmem_adsp_size_setup);
149
150static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
151
152static int __init pmem_audio_size_setup(char *p)
153{
154 pmem_audio_size = memparse(p, NULL);
155 return 0;
156}
157early_param("pmem_audio_size", pmem_audio_size_setup);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800158#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700159
Olav Haugan7c6aa742012-01-16 16:47:37 -0800160#ifdef CONFIG_ANDROID_PMEM
161#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700162static struct android_pmem_platform_data android_pmem_pdata = {
163 .name = "pmem",
164 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
165 .cached = 1,
166 .memory_type = MEMTYPE_EBI1,
167};
168
Laura Abbottb93525f2012-04-12 09:57:19 -0700169static struct platform_device apq8064_android_pmem_device = {
Kevin Chan13be4e22011-10-20 11:30:32 -0700170 .name = "android_pmem",
171 .id = 0,
172 .dev = {.platform_data = &android_pmem_pdata},
173};
174
175static struct android_pmem_platform_data android_pmem_adsp_pdata = {
176 .name = "pmem_adsp",
177 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
178 .cached = 0,
179 .memory_type = MEMTYPE_EBI1,
180};
Laura Abbottb93525f2012-04-12 09:57:19 -0700181static struct platform_device apq8064_android_pmem_adsp_device = {
Kevin Chan13be4e22011-10-20 11:30:32 -0700182 .name = "android_pmem",
183 .id = 2,
184 .dev = { .platform_data = &android_pmem_adsp_pdata },
185};
186
187static struct android_pmem_platform_data android_pmem_audio_pdata = {
188 .name = "pmem_audio",
189 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
190 .cached = 0,
191 .memory_type = MEMTYPE_EBI1,
192};
193
Laura Abbottb93525f2012-04-12 09:57:19 -0700194static struct platform_device apq8064_android_pmem_audio_device = {
Kevin Chan13be4e22011-10-20 11:30:32 -0700195 .name = "android_pmem",
196 .id = 4,
197 .dev = { .platform_data = &android_pmem_audio_pdata },
198};
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700199#endif /* CONFIG_MSM_MULTIMEDIA_USE_ION */
200#endif /* CONFIG_ANDROID_PMEM */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800201
Larry Bassel67b921d2012-04-06 10:23:27 -0700202struct fmem_platform_data apq8064_fmem_pdata = {
203};
204
Olav Haugan7c6aa742012-01-16 16:47:37 -0800205static struct memtype_reserve apq8064_reserve_table[] __initdata = {
206 [MEMTYPE_SMI] = {
207 },
208 [MEMTYPE_EBI0] = {
209 .flags = MEMTYPE_FLAGS_1M_ALIGN,
210 },
211 [MEMTYPE_EBI1] = {
212 .flags = MEMTYPE_FLAGS_1M_ALIGN,
213 },
214};
Kevin Chan13be4e22011-10-20 11:30:32 -0700215
Laura Abbott350c8362012-02-28 14:46:52 -0800216static void __init reserve_rtb_memory(void)
217{
218#if defined(CONFIG_MSM_RTB)
Laura Abbottb93525f2012-04-12 09:57:19 -0700219 apq8064_reserve_table[MEMTYPE_EBI1].size += apq8064_rtb_pdata.size;
Laura Abbott350c8362012-02-28 14:46:52 -0800220#endif
221}
222
223
Kevin Chan13be4e22011-10-20 11:30:32 -0700224static void __init size_pmem_devices(void)
225{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800226#ifdef CONFIG_ANDROID_PMEM
227#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700228 android_pmem_adsp_pdata.size = pmem_adsp_size;
229 android_pmem_pdata.size = pmem_size;
230 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700231#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
232#endif /*CONFIG_ANDROID_PMEM*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700233}
234
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700235#ifdef CONFIG_ANDROID_PMEM
236#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700237static void __init reserve_memory_for(struct android_pmem_platform_data *p)
238{
239 apq8064_reserve_table[p->memory_type].size += p->size;
240}
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700241#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
242#endif /*CONFIG_ANDROID_PMEM*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700243
Kevin Chan13be4e22011-10-20 11:30:32 -0700244static void __init reserve_pmem_memory(void)
245{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800246#ifdef CONFIG_ANDROID_PMEM
247#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700248 reserve_memory_for(&android_pmem_adsp_pdata);
249 reserve_memory_for(&android_pmem_pdata);
250 reserve_memory_for(&android_pmem_audio_pdata);
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700251#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700252 apq8064_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700253#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -0800254}
255
256static int apq8064_paddr_to_memtype(unsigned int paddr)
257{
258 return MEMTYPE_EBI1;
259}
260
Larry Bassel67b921d2012-04-06 10:23:27 -0700261#define FMEM_ENABLED 1
262
Olav Haugan7c6aa742012-01-16 16:47:37 -0800263#ifdef CONFIG_ION_MSM
264#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -0700265static struct ion_cp_heap_pdata cp_mm_apq8064_ion_pdata = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800266 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugand3d29682012-01-19 10:57:07 -0800267 .align = PAGE_SIZE,
Larry Bassel67b921d2012-04-06 10:23:27 -0700268 .reusable = FMEM_ENABLED,
269 .mem_is_fmem = FMEM_ENABLED,
270 .fixed_position = FIXED_MIDDLE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800271};
272
Laura Abbottb93525f2012-04-12 09:57:19 -0700273static struct ion_cp_heap_pdata cp_mfc_apq8064_ion_pdata = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800274 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugand3d29682012-01-19 10:57:07 -0800275 .align = PAGE_SIZE,
Larry Bassel67b921d2012-04-06 10:23:27 -0700276 .reusable = 0,
277 .mem_is_fmem = FMEM_ENABLED,
278 .fixed_position = FIXED_HIGH,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800279};
280
Laura Abbottb93525f2012-04-12 09:57:19 -0700281static struct ion_co_heap_pdata co_apq8064_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800282 .adjacent_mem_id = INVALID_HEAP_ID,
283 .align = PAGE_SIZE,
Larry Bassel67b921d2012-04-06 10:23:27 -0700284 .mem_is_fmem = 0,
Olav Haugand3d29682012-01-19 10:57:07 -0800285};
286
Laura Abbottb93525f2012-04-12 09:57:19 -0700287static struct ion_co_heap_pdata fw_co_apq8064_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800288 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
289 .align = SZ_128K,
Larry Bassel67b921d2012-04-06 10:23:27 -0700290 .mem_is_fmem = FMEM_ENABLED,
291 .fixed_position = FIXED_LOW,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800292};
293#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800294
295/**
296 * These heaps are listed in the order they will be allocated. Due to
297 * video hardware restrictions and content protection the FW heap has to
298 * be allocated adjacent (below) the MM heap and the MFC heap has to be
299 * allocated after the MM heap to ensure MFC heap is not more than 256MB
300 * away from the base address of the FW heap.
301 * However, the order of FW heap and MM heap doesn't matter since these
302 * two heaps are taken care of by separate code to ensure they are adjacent
303 * to each other.
304 * Don't swap the order unless you know what you are doing!
305 */
Laura Abbottb93525f2012-04-12 09:57:19 -0700306static struct ion_platform_data apq8064_ion_pdata = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800307 .nr = MSM_ION_HEAP_NUM,
308 .heaps = {
309 {
310 .id = ION_SYSTEM_HEAP_ID,
311 .type = ION_HEAP_TYPE_SYSTEM,
312 .name = ION_VMALLOC_HEAP_NAME,
313 },
314#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
315 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800316 .id = ION_CP_MM_HEAP_ID,
317 .type = ION_HEAP_TYPE_CP,
318 .name = ION_MM_HEAP_NAME,
319 .size = MSM_ION_MM_SIZE,
320 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700321 .extra_data = (void *) &cp_mm_apq8064_ion_pdata,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800322 },
323 {
Olav Haugand3d29682012-01-19 10:57:07 -0800324 .id = ION_MM_FIRMWARE_HEAP_ID,
325 .type = ION_HEAP_TYPE_CARVEOUT,
326 .name = ION_MM_FIRMWARE_HEAP_NAME,
327 .size = MSM_ION_MM_FW_SIZE,
328 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700329 .extra_data = (void *) &fw_co_apq8064_ion_pdata,
Olav Haugand3d29682012-01-19 10:57:07 -0800330 },
331 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800332 .id = ION_CP_MFC_HEAP_ID,
333 .type = ION_HEAP_TYPE_CP,
334 .name = ION_MFC_HEAP_NAME,
335 .size = MSM_ION_MFC_SIZE,
336 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700337 .extra_data = (void *) &cp_mfc_apq8064_ion_pdata,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800338 },
Olav Haugan129992c2012-03-22 09:54:01 -0700339#ifndef CONFIG_MSM_IOMMU
Olav Haugan7c6aa742012-01-16 16:47:37 -0800340 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800341 .id = ION_SF_HEAP_ID,
342 .type = ION_HEAP_TYPE_CARVEOUT,
343 .name = ION_SF_HEAP_NAME,
344 .size = MSM_ION_SF_SIZE,
345 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700346 .extra_data = (void *) &co_apq8064_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800347 },
Olav Haugan129992c2012-03-22 09:54:01 -0700348#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800349 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800350 .id = ION_IOMMU_HEAP_ID,
351 .type = ION_HEAP_TYPE_IOMMU,
352 .name = ION_IOMMU_HEAP_NAME,
353 },
Olav Hauganf45e2142012-01-19 11:01:01 -0800354 {
355 .id = ION_QSECOM_HEAP_ID,
356 .type = ION_HEAP_TYPE_CARVEOUT,
357 .name = ION_QSECOM_HEAP_NAME,
358 .size = MSM_ION_QSECOM_SIZE,
359 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700360 .extra_data = (void *) &co_apq8064_ion_pdata,
Olav Hauganf45e2142012-01-19 11:01:01 -0800361 },
Olav Haugan2c43fac2012-01-19 11:06:37 -0800362 {
363 .id = ION_AUDIO_HEAP_ID,
364 .type = ION_HEAP_TYPE_CARVEOUT,
365 .name = ION_AUDIO_HEAP_NAME,
366 .size = MSM_ION_AUDIO_SIZE,
367 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700368 .extra_data = (void *) &co_apq8064_ion_pdata,
Olav Haugan2c43fac2012-01-19 11:06:37 -0800369 },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800370#endif
371 }
372};
373
Laura Abbottb93525f2012-04-12 09:57:19 -0700374static struct platform_device apq8064_ion_dev = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800375 .name = "ion-msm",
376 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700377 .dev = { .platform_data = &apq8064_ion_pdata },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800378};
379#endif
380
Larry Bassel67b921d2012-04-06 10:23:27 -0700381static struct platform_device apq8064_fmem_device = {
382 .name = "fmem",
383 .id = 1,
384 .dev = { .platform_data = &apq8064_fmem_pdata },
385};
386
387static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
388 unsigned long size)
389{
390 apq8064_reserve_table[mem_type].size += size;
391}
392
393static void __init apq8064_reserve_fixed_area(unsigned long fixed_area_size)
394{
395#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
396 int ret;
397
398 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
399 panic("fixed area size is larger than %dM\n",
400 MAX_FIXED_AREA_SIZE >> 20);
401
402 reserve_info->fixed_area_size = fixed_area_size;
403 reserve_info->fixed_area_start = APQ8064_FW_START;
404
405 ret = memblock_remove(reserve_info->fixed_area_start,
406 reserve_info->fixed_area_size);
407 BUG_ON(ret);
408#endif
409}
410
411/**
412 * Reserve memory for ION and calculate amount of reusable memory for fmem.
413 * We only reserve memory for heaps that are not reusable. However, we only
414 * support one reusable heap at the moment so we ignore the reusable flag for
415 * other than the first heap with reusable flag set. Also handle special case
416 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
417 * at a higher address than FW in addition to not more than 256MB away from the
418 * base address of the firmware. This means that if MM is reusable the other
419 * two heaps must be allocated in the same region as FW. This is handled by the
420 * mem_is_fmem flag in the platform data. In addition the MM heap must be
421 * adjacent to the FW heap for content protection purposes.
422 */
Stephen Boyd668d7652012-04-25 11:31:01 -0700423static void __init reserve_ion_memory(void)
Olav Haugan7c6aa742012-01-16 16:47:37 -0800424{
425#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Larry Bassel67b921d2012-04-06 10:23:27 -0700426 unsigned int i;
427 unsigned int reusable_count = 0;
428 unsigned int fixed_size = 0;
429 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
430 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
431
432 apq8064_fmem_pdata.size = 0;
433 apq8064_fmem_pdata.reserved_size_low = 0;
434 apq8064_fmem_pdata.reserved_size_high = 0;
Olav Haugan62436252012-05-16 09:09:43 -0700435 apq8064_fmem_pdata.align = PAGE_SIZE;
Larry Bassel67b921d2012-04-06 10:23:27 -0700436 fixed_low_size = 0;
437 fixed_middle_size = 0;
438 fixed_high_size = 0;
439
440 /* We only support 1 reusable heap. Check if more than one heap
441 * is specified as reusable and set as non-reusable if found.
442 */
443 for (i = 0; i < apq8064_ion_pdata.nr; ++i) {
444 const struct ion_platform_heap *heap =
445 &(apq8064_ion_pdata.heaps[i]);
446
447 if (heap->type == ION_HEAP_TYPE_CP && heap->extra_data) {
448 struct ion_cp_heap_pdata *data = heap->extra_data;
449
450 reusable_count += (data->reusable) ? 1 : 0;
451
452 if (data->reusable && reusable_count > 1) {
453 pr_err("%s: Too many heaps specified as "
454 "reusable. Heap %s was not configured "
455 "as reusable.\n", __func__, heap->name);
456 data->reusable = 0;
457 }
458 }
459 }
460
461 for (i = 0; i < apq8064_ion_pdata.nr; ++i) {
462 const struct ion_platform_heap *heap =
463 &(apq8064_ion_pdata.heaps[i]);
464
465 if (heap->extra_data) {
466 int fixed_position = NOT_FIXED;
467 int mem_is_fmem = 0;
468
469 switch (heap->type) {
470 case ION_HEAP_TYPE_CP:
471 mem_is_fmem = ((struct ion_cp_heap_pdata *)
472 heap->extra_data)->mem_is_fmem;
473 fixed_position = ((struct ion_cp_heap_pdata *)
474 heap->extra_data)->fixed_position;
475 break;
476 case ION_HEAP_TYPE_CARVEOUT:
477 mem_is_fmem = ((struct ion_co_heap_pdata *)
478 heap->extra_data)->mem_is_fmem;
479 fixed_position = ((struct ion_co_heap_pdata *)
480 heap->extra_data)->fixed_position;
481 break;
482 default:
483 break;
484 }
485
486 if (fixed_position != NOT_FIXED)
487 fixed_size += heap->size;
488 else
489 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
490
491 if (fixed_position == FIXED_LOW)
492 fixed_low_size += heap->size;
493 else if (fixed_position == FIXED_MIDDLE)
494 fixed_middle_size += heap->size;
495 else if (fixed_position == FIXED_HIGH)
496 fixed_high_size += heap->size;
497
498 if (mem_is_fmem)
499 apq8064_fmem_pdata.size += heap->size;
500 }
501 }
502
503 if (!fixed_size)
504 return;
505
506 if (apq8064_fmem_pdata.size) {
507 apq8064_fmem_pdata.reserved_size_low = fixed_low_size;
508 apq8064_fmem_pdata.reserved_size_high = fixed_high_size;
509 }
510
511 /* Since the fixed area may be carved out of lowmem,
512 * make sure the length is a multiple of 1M.
513 */
514 fixed_size = (fixed_size + MSM_MM_FW_SIZE + SECTION_SIZE - 1)
515 & SECTION_MASK;
516 apq8064_reserve_fixed_area(fixed_size);
517
518 fixed_low_start = APQ8064_FIXED_AREA_START;
519 fixed_middle_start = fixed_low_start + fixed_low_size;
520 fixed_high_start = fixed_middle_start + fixed_middle_size;
521
522 for (i = 0; i < apq8064_ion_pdata.nr; ++i) {
523 struct ion_platform_heap *heap = &(apq8064_ion_pdata.heaps[i]);
524
525 if (heap->extra_data) {
526 int fixed_position = NOT_FIXED;
527
528 switch (heap->type) {
529 case ION_HEAP_TYPE_CP:
530 fixed_position = ((struct ion_cp_heap_pdata *)
531 heap->extra_data)->fixed_position;
532 break;
533 case ION_HEAP_TYPE_CARVEOUT:
534 fixed_position = ((struct ion_co_heap_pdata *)
535 heap->extra_data)->fixed_position;
536 break;
537 default:
538 break;
539 }
540
541 switch (fixed_position) {
542 case FIXED_LOW:
543 heap->base = fixed_low_start;
544 break;
545 case FIXED_MIDDLE:
546 heap->base = fixed_middle_start;
547 break;
548 case FIXED_HIGH:
549 heap->base = fixed_high_start;
550 break;
551 default:
552 break;
553 }
554 }
555 }
Olav Haugan7c6aa742012-01-16 16:47:37 -0800556#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700557}
558
Huaibin Yang4a084e32011-12-15 15:25:52 -0800559static void __init reserve_mdp_memory(void)
560{
561 apq8064_mdp_writeback(apq8064_reserve_table);
562}
563
Kevin Chan13be4e22011-10-20 11:30:32 -0700564static void __init apq8064_calculate_reserve_sizes(void)
565{
566 size_pmem_devices();
567 reserve_pmem_memory();
Olav Haugan7c6aa742012-01-16 16:47:37 -0800568 reserve_ion_memory();
Huaibin Yang4a084e32011-12-15 15:25:52 -0800569 reserve_mdp_memory();
Laura Abbott350c8362012-02-28 14:46:52 -0800570 reserve_rtb_memory();
Kevin Chan13be4e22011-10-20 11:30:32 -0700571}
572
573static struct reserve_info apq8064_reserve_info __initdata = {
574 .memtype_reserve_table = apq8064_reserve_table,
575 .calculate_reserve_sizes = apq8064_calculate_reserve_sizes,
Larry Bassel67b921d2012-04-06 10:23:27 -0700576 .reserve_fixed_area = apq8064_reserve_fixed_area,
Kevin Chan13be4e22011-10-20 11:30:32 -0700577 .paddr_to_memtype = apq8064_paddr_to_memtype,
578};
579
580static int apq8064_memory_bank_size(void)
581{
582 return 1<<29;
583}
584
585static void __init locate_unstable_memory(void)
586{
587 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
588 unsigned long bank_size;
589 unsigned long low, high;
590
591 bank_size = apq8064_memory_bank_size();
592 low = meminfo.bank[0].start;
593 high = mb->start + mb->size;
Olav Haugand76e3a82012-01-16 16:55:07 -0800594
595 /* Check if 32 bit overflow occured */
596 if (high < mb->start)
Larry Bassel67b921d2012-04-06 10:23:27 -0700597 high = -PAGE_SIZE;
Olav Haugand76e3a82012-01-16 16:55:07 -0800598
Kevin Chan13be4e22011-10-20 11:30:32 -0700599 low &= ~(bank_size - 1);
600
601 if (high - low <= bank_size)
Larry Bassel67b921d2012-04-06 10:23:27 -0700602 goto no_dmm;
603
604#ifdef CONFIG_ENABLE_DMM
Jack Cheung46bfffa2012-01-19 15:26:24 -0800605 apq8064_reserve_info.low_unstable_address = mb->start -
606 MIN_MEMORY_BLOCK_SIZE + mb->size;
607 apq8064_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
608
Kevin Chan13be4e22011-10-20 11:30:32 -0700609 apq8064_reserve_info.bank_size = bank_size;
610 pr_info("low unstable address %lx max size %lx bank size %lx\n",
611 apq8064_reserve_info.low_unstable_address,
612 apq8064_reserve_info.max_unstable_size,
613 apq8064_reserve_info.bank_size);
Larry Bassel67b921d2012-04-06 10:23:27 -0700614 return;
615#endif
616no_dmm:
617 apq8064_reserve_info.low_unstable_address = high;
618 apq8064_reserve_info.max_unstable_size = 0;
Kevin Chan13be4e22011-10-20 11:30:32 -0700619}
620
Hanumant Singh50440d42012-04-23 19:27:16 -0700621static int apq8064_change_memory_power(u64 start, u64 size,
622 int change_type)
623{
624 return soc_change_memory_power(start, size, change_type);
625}
626
Aravind Venkateswaran8ac7f412012-03-16 17:57:30 -0700627static char prim_panel_name[PANEL_NAME_MAX_LEN];
628static char ext_panel_name[PANEL_NAME_MAX_LEN];
629static int __init prim_display_setup(char *param)
630{
631 if (strnlen(param, PANEL_NAME_MAX_LEN))
632 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
633 return 0;
634}
635early_param("prim_display", prim_display_setup);
636
637static int __init ext_display_setup(char *param)
638{
639 if (strnlen(param, PANEL_NAME_MAX_LEN))
640 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
641 return 0;
642}
643early_param("ext_display", ext_display_setup);
644
Kevin Chan13be4e22011-10-20 11:30:32 -0700645static void __init apq8064_reserve(void)
646{
Aravind Venkateswaran8ac7f412012-03-16 17:57:30 -0700647 apq8064_set_display_params(prim_panel_name, ext_panel_name);
Kevin Chan13be4e22011-10-20 11:30:32 -0700648 msm_reserve();
Larry Bassel67b921d2012-04-06 10:23:27 -0700649 if (apq8064_fmem_pdata.size) {
650#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
651 if (reserve_info->fixed_area_size) {
652 apq8064_fmem_pdata.phys =
653 reserve_info->fixed_area_start + MSM_MM_FW_SIZE;
654 pr_info("mm fw at %lx (fixed) size %x\n",
655 reserve_info->fixed_area_start, MSM_MM_FW_SIZE);
656 pr_info("fmem start %lx (fixed) size %lx\n",
657 apq8064_fmem_pdata.phys,
658 apq8064_fmem_pdata.size);
659 }
660#endif
661 }
Kevin Chan13be4e22011-10-20 11:30:32 -0700662}
663
Laura Abbott6988cef2012-03-15 14:27:13 -0700664static void __init place_movable_zone(void)
665{
Larry Bassel67b921d2012-04-06 10:23:27 -0700666#ifdef CONFIG_ENABLE_DMM
Laura Abbott6988cef2012-03-15 14:27:13 -0700667 movable_reserved_start = apq8064_reserve_info.low_unstable_address;
668 movable_reserved_size = apq8064_reserve_info.max_unstable_size;
669 pr_info("movable zone start %lx size %lx\n",
670 movable_reserved_start, movable_reserved_size);
Larry Bassel67b921d2012-04-06 10:23:27 -0700671#endif
Laura Abbott6988cef2012-03-15 14:27:13 -0700672}
673
674static void __init apq8064_early_reserve(void)
675{
676 reserve_info = &apq8064_reserve_info;
677 locate_unstable_memory();
678 place_movable_zone();
679
680}
Hemant Kumara945b472012-01-25 15:08:06 -0800681#ifdef CONFIG_USB_EHCI_MSM_HSIC
Hemant Kumare6275972012-02-29 20:06:21 -0800682/* Bandwidth requests (zero) if no vote placed */
683static struct msm_bus_vectors hsic_init_vectors[] = {
684 {
685 .src = MSM_BUS_MASTER_SPS,
686 .dst = MSM_BUS_SLAVE_EBI_CH0,
687 .ab = 0,
688 .ib = 0,
689 },
690 {
691 .src = MSM_BUS_MASTER_SPS,
692 .dst = MSM_BUS_SLAVE_SPS,
693 .ab = 0,
694 .ib = 0,
695 },
696};
697
698/* Bus bandwidth requests in Bytes/sec */
699static struct msm_bus_vectors hsic_max_vectors[] = {
700 {
701 .src = MSM_BUS_MASTER_SPS,
702 .dst = MSM_BUS_SLAVE_EBI_CH0,
703 .ab = 60000000, /* At least 480Mbps on bus. */
704 .ib = 960000000, /* MAX bursts rate */
705 },
706 {
707 .src = MSM_BUS_MASTER_SPS,
708 .dst = MSM_BUS_SLAVE_SPS,
709 .ab = 0,
710 .ib = 512000000, /*vote for 64Mhz dfab clk rate*/
711 },
712};
713
714static struct msm_bus_paths hsic_bus_scale_usecases[] = {
715 {
716 ARRAY_SIZE(hsic_init_vectors),
717 hsic_init_vectors,
718 },
719 {
720 ARRAY_SIZE(hsic_max_vectors),
721 hsic_max_vectors,
722 },
723};
724
725static struct msm_bus_scale_pdata hsic_bus_scale_pdata = {
726 hsic_bus_scale_usecases,
727 ARRAY_SIZE(hsic_bus_scale_usecases),
728 .name = "hsic",
729};
730
Hemant Kumara945b472012-01-25 15:08:06 -0800731static struct msm_hsic_host_platform_data msm_hsic_pdata = {
Hemant Kumare6275972012-02-29 20:06:21 -0800732 .strobe = 88,
733 .data = 89,
734 .bus_scale_table = &hsic_bus_scale_pdata,
Hemant Kumara945b472012-01-25 15:08:06 -0800735};
736#else
737static struct msm_hsic_host_platform_data msm_hsic_pdata;
738#endif
739
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800740#define PID_MAGIC_ID 0x71432909
741#define SERIAL_NUM_MAGIC_ID 0x61945374
742#define SERIAL_NUMBER_LENGTH 127
743#define DLOAD_USB_BASE_ADD 0x2A03F0C8
744
745struct magic_num_struct {
746 uint32_t pid;
747 uint32_t serial_num;
748};
749
750struct dload_struct {
751 uint32_t reserved1;
752 uint32_t reserved2;
753 uint32_t reserved3;
754 uint16_t reserved4;
755 uint16_t pid;
756 char serial_number[SERIAL_NUMBER_LENGTH];
757 uint16_t reserved5;
758 struct magic_num_struct magic_struct;
759};
760
761static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
762{
763 struct dload_struct __iomem *dload = 0;
764
765 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
766 if (!dload) {
767 pr_err("%s: cannot remap I/O memory region: %08x\n",
768 __func__, DLOAD_USB_BASE_ADD);
769 return -ENXIO;
770 }
771
772 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
773 __func__, dload, pid, snum);
774 /* update pid */
775 dload->magic_struct.pid = PID_MAGIC_ID;
776 dload->pid = pid;
777
778 /* update serial number */
779 dload->magic_struct.serial_num = 0;
780 if (!snum) {
781 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
782 goto out;
783 }
784
785 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
786 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
787out:
788 iounmap(dload);
789 return 0;
790}
791
792static struct android_usb_platform_data android_usb_pdata = {
793 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
794};
795
Hemant Kumar4933b072011-10-17 23:43:11 -0700796static struct platform_device android_usb_device = {
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800797 .name = "android_usb",
798 .id = -1,
799 .dev = {
800 .platform_data = &android_usb_pdata,
801 },
Hemant Kumar4933b072011-10-17 23:43:11 -0700802};
803
Hemant Kumar7620eed2012-02-26 09:08:43 -0800804/* Bandwidth requests (zero) if no vote placed */
805static struct msm_bus_vectors usb_init_vectors[] = {
806 {
807 .src = MSM_BUS_MASTER_SPS,
808 .dst = MSM_BUS_SLAVE_EBI_CH0,
809 .ab = 0,
810 .ib = 0,
811 },
812};
813
814/* Bus bandwidth requests in Bytes/sec */
815static struct msm_bus_vectors usb_max_vectors[] = {
816 {
817 .src = MSM_BUS_MASTER_SPS,
818 .dst = MSM_BUS_SLAVE_EBI_CH0,
819 .ab = 60000000, /* At least 480Mbps on bus. */
820 .ib = 960000000, /* MAX bursts rate */
821 },
822};
823
824static struct msm_bus_paths usb_bus_scale_usecases[] = {
825 {
826 ARRAY_SIZE(usb_init_vectors),
827 usb_init_vectors,
828 },
829 {
830 ARRAY_SIZE(usb_max_vectors),
831 usb_max_vectors,
832 },
833};
834
835static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
836 usb_bus_scale_usecases,
837 ARRAY_SIZE(usb_bus_scale_usecases),
838 .name = "usb",
839};
840
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700841static int phy_init_seq[] = {
842 0x38, 0x81, /* update DC voltage level */
843 0x24, 0x82, /* set pre-emphasis and rise/fall time */
844 -1
845};
846
Hemant Kumar4933b072011-10-17 23:43:11 -0700847static struct msm_otg_platform_data msm_otg_pdata = {
Hemant Kumard86c4882012-01-24 19:39:37 -0800848 .mode = USB_OTG,
849 .otg_control = OTG_PMIC_CONTROL,
Hemant Kumar4933b072011-10-17 23:43:11 -0700850 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Hemant Kumard86c4882012-01-24 19:39:37 -0800851 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
852 .power_budget = 750,
Hemant Kumar7620eed2012-02-26 09:08:43 -0800853 .bus_scale_table = &usb_bus_scale_pdata,
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700854 .phy_init_seq = phy_init_seq,
Hemant Kumar4933b072011-10-17 23:43:11 -0700855};
856
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800857static struct msm_usb_host_platform_data msm_ehci_host_pdata3 = {
Manu Gautam91223e02011-11-08 15:27:22 +0530858 .power_budget = 500,
859};
860
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800861#ifdef CONFIG_USB_EHCI_MSM_HOST4
862static struct msm_usb_host_platform_data msm_ehci_host_pdata4;
863#endif
864
Manu Gautam91223e02011-11-08 15:27:22 +0530865static void __init apq8064_ehci_host_init(void)
866{
867 if (machine_is_apq8064_liquid()) {
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800868 msm_ehci_host_pdata3.dock_connect_irq =
Hemant Kumar56925352012-02-13 16:59:52 -0800869 PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9);
870
Manu Gautam91223e02011-11-08 15:27:22 +0530871 apq8064_device_ehci_host3.dev.platform_data =
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800872 &msm_ehci_host_pdata3;
Manu Gautam91223e02011-11-08 15:27:22 +0530873 platform_device_register(&apq8064_device_ehci_host3);
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800874
875#ifdef CONFIG_USB_EHCI_MSM_HOST4
876 apq8064_device_ehci_host4.dev.platform_data =
877 &msm_ehci_host_pdata4;
878 platform_device_register(&apq8064_device_ehci_host4);
879#endif
Manu Gautam91223e02011-11-08 15:27:22 +0530880 }
881}
882
David Keitel2f613d92012-02-15 11:29:16 -0800883static struct smb349_platform_data smb349_data __initdata = {
884 .en_n_gpio = PM8921_GPIO_PM_TO_SYS(37),
885 .chg_susp_gpio = PM8921_GPIO_PM_TO_SYS(30),
886 .chg_current_ma = 2200,
887};
888
889static struct i2c_board_info smb349_charger_i2c_info[] __initdata = {
890 {
891 I2C_BOARD_INFO(SMB349_NAME, 0x1B),
892 .platform_data = &smb349_data,
893 },
894};
895
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -0800896struct sx150x_platform_data apq8064_sx150x_data[] = {
897 [SX150X_EPM] = {
898 .gpio_base = GPIO_EPM_EXPANDER_BASE,
899 .oscio_is_gpo = false,
900 .io_pullup_ena = 0x0,
901 .io_pulldn_ena = 0x0,
902 .io_open_drain_ena = 0x0,
903 .io_polarity = 0,
904 .irq_summary = -1,
905 },
906};
907
908static struct epm_chan_properties ads_adc_channel_data[] = {
909 {10, 100}, {500, 50}, {1, 1}, {1, 1},
910 {20, 50}, {10, 100}, {1, 1}, {1, 1},
911 {10, 100}, {10, 100}, {100, 100}, {200, 100},
912 {100, 50}, {2000, 50}, {1000, 50}, {200, 50},
913 {200, 100}, {1, 1}, {20, 50}, {500, 50},
914 {50, 50}, {200, 100}, {500, 100}, {20, 50},
915 {200, 50}, {2000, 100}, {1000, 50}, {100, 50},
916 {200, 100}, {500, 50}, {1000, 100}, {200, 50},
917 {1000, 50}, {50, 50}, {100, 50}, {100, 50},
918 {1, 1}, {1, 1}, {20, 100}, {20, 50},
919 {500, 100}, {1000, 100}, {100, 50}, {1000, 50},
920 {100, 50}, {1000, 100}, {100, 50}, {100, 50},
921};
922
923static struct epm_adc_platform_data epm_adc_pdata = {
924 .channel = ads_adc_channel_data,
925 .bus_id = 0x0,
926 .epm_i2c_board_info = {
927 .type = "sx1509q",
928 .addr = 0x3e,
929 .platform_data = &apq8064_sx150x_data[SX150X_EPM],
930 },
931 .gpio_expander_base_addr = GPIO_EPM_EXPANDER_BASE,
932};
933
934static struct platform_device epm_adc_device = {
935 .name = "epm_adc",
936 .id = -1,
937 .dev = {
938 .platform_data = &epm_adc_pdata,
939 },
940};
941
942static void __init apq8064_epm_adc_init(void)
943{
944 epm_adc_pdata.num_channels = 32;
945 epm_adc_pdata.num_adc = 2;
946 epm_adc_pdata.chan_per_adc = 16;
947 epm_adc_pdata.chan_per_mux = 8;
948};
949
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800950/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
951 * 4 micbiases are used to power various analog and digital
952 * microphones operating at 1800 mV. Technically, all micbiases
953 * can source from single cfilter since all microphones operate
954 * at the same voltage level. The arrangement below is to make
955 * sure all cfilters are exercised. LDO_H regulator ouput level
956 * does not need to be as high as 2.85V. It is choosen for
957 * microphone sensitivity purpose.
958 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530959static struct wcd9xxx_pdata apq8064_tabla_platform_data = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800960 .slimbus_slave_device = {
961 .name = "tabla-slave",
962 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
963 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800964 .irq = MSM_GPIO_TO_INT(42),
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800965 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530966 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800967 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
968 .micbias = {
969 .ldoh_v = TABLA_LDOH_2P85_V,
970 .cfilt1_mv = 1800,
971 .cfilt2_mv = 1800,
972 .cfilt3_mv = 1800,
973 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
974 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
975 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
976 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530977 },
978 .regulator = {
979 {
980 .name = "CDC_VDD_CP",
981 .min_uV = 1800000,
982 .max_uV = 1800000,
983 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
984 },
985 {
986 .name = "CDC_VDDA_RX",
987 .min_uV = 1800000,
988 .max_uV = 1800000,
989 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
990 },
991 {
992 .name = "CDC_VDDA_TX",
993 .min_uV = 1800000,
994 .max_uV = 1800000,
995 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
996 },
997 {
998 .name = "VDDIO_CDC",
999 .min_uV = 1800000,
1000 .max_uV = 1800000,
1001 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1002 },
1003 {
1004 .name = "VDDD_CDC_D",
1005 .min_uV = 1225000,
1006 .max_uV = 1225000,
1007 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1008 },
1009 {
1010 .name = "CDC_VDDA_A_1P2V",
1011 .min_uV = 1225000,
1012 .max_uV = 1225000,
1013 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1014 },
1015 },
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001016};
1017
1018static struct slim_device apq8064_slim_tabla = {
1019 .name = "tabla-slim",
1020 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
1021 .dev = {
1022 .platform_data = &apq8064_tabla_platform_data,
1023 },
1024};
1025
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301026static struct wcd9xxx_pdata apq8064_tabla20_platform_data = {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001027 .slimbus_slave_device = {
1028 .name = "tabla-slave",
1029 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
1030 },
1031 .irq = MSM_GPIO_TO_INT(42),
1032 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301033 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001034 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
1035 .micbias = {
1036 .ldoh_v = TABLA_LDOH_2P85_V,
1037 .cfilt1_mv = 1800,
1038 .cfilt2_mv = 1800,
1039 .cfilt3_mv = 1800,
1040 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
1041 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
1042 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
1043 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301044 },
1045 .regulator = {
1046 {
1047 .name = "CDC_VDD_CP",
1048 .min_uV = 1800000,
1049 .max_uV = 1800000,
1050 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
1051 },
1052 {
1053 .name = "CDC_VDDA_RX",
1054 .min_uV = 1800000,
1055 .max_uV = 1800000,
1056 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
1057 },
1058 {
1059 .name = "CDC_VDDA_TX",
1060 .min_uV = 1800000,
1061 .max_uV = 1800000,
1062 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
1063 },
1064 {
1065 .name = "VDDIO_CDC",
1066 .min_uV = 1800000,
1067 .max_uV = 1800000,
1068 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1069 },
1070 {
1071 .name = "VDDD_CDC_D",
1072 .min_uV = 1225000,
1073 .max_uV = 1225000,
1074 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1075 },
1076 {
1077 .name = "CDC_VDDA_A_1P2V",
1078 .min_uV = 1225000,
1079 .max_uV = 1225000,
1080 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1081 },
1082 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001083};
1084
1085static struct slim_device apq8064_slim_tabla20 = {
1086 .name = "tabla2x-slim",
1087 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
1088 .dev = {
1089 .platform_data = &apq8064_tabla20_platform_data,
1090 },
1091};
1092
Santosh Mardi695be0d2012-04-10 23:21:12 +05301093/* enable the level shifter for cs8427 to make sure the I2C
1094 * clock is running at 100KHz and voltage levels are at 3.3
1095 * and 5 volts
1096 */
1097static int enable_100KHz_ls(int enable)
1098{
1099 int ret = 0;
1100 if (enable) {
1101 ret = gpio_request(SX150X_GPIO(1, 10),
1102 "cs8427_100KHZ_ENABLE");
1103 if (ret) {
1104 pr_err("%s: Failed to request gpio %d\n", __func__,
1105 SX150X_GPIO(1, 10));
1106 return ret;
1107 }
1108 gpio_direction_output(SX150X_GPIO(1, 10), 1);
1109 } else
1110 gpio_free(SX150X_GPIO(1, 10));
1111 return ret;
1112}
1113
Santosh Mardieff9a742012-04-09 23:23:39 +05301114static struct cs8427_platform_data cs8427_i2c_platform_data = {
1115 .irq = SX150X_GPIO(1, 4),
1116 .reset_gpio = SX150X_GPIO(1, 6),
Santosh Mardi695be0d2012-04-10 23:21:12 +05301117 .enable = enable_100KHz_ls,
Santosh Mardieff9a742012-04-09 23:23:39 +05301118};
1119
1120static struct i2c_board_info cs8427_device_info[] __initdata = {
1121 {
1122 I2C_BOARD_INFO("cs8427", CS8427_ADDR4),
1123 .platform_data = &cs8427_i2c_platform_data,
1124 },
1125};
1126
Amy Maloche70090f992012-02-16 16:35:26 -08001127#define HAP_SHIFT_LVL_OE_GPIO PM8921_MPP_PM_TO_SYS(8)
1128#define ISA1200_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1129#define ISA1200_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
1130#define ISA1200_HAP_CLK PM8921_GPIO_PM_TO_SYS(44)
1131
1132static int isa1200_power(int on)
1133{
Amy Maloche8f973892012-03-26 14:53:13 -07001134 int rc = 0;
1135
Amy Maloche70090f992012-02-16 16:35:26 -08001136 gpio_set_value_cansleep(ISA1200_HAP_CLK, !!on);
1137
Amy Maloche8f973892012-03-26 14:53:13 -07001138 if (on)
1139 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_1, true);
1140 else
1141 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_NONE, true);
1142
1143 if (rc) {
1144 pr_err("%s: unable to write aux clock register(%d)\n",
1145 __func__, rc);
1146 }
1147
1148 return rc;
Amy Maloche70090f992012-02-16 16:35:26 -08001149}
1150
1151static int isa1200_dev_setup(bool enable)
1152{
1153 int rc = 0;
1154
Amy Maloche70090f992012-02-16 16:35:26 -08001155 if (!enable)
1156 goto free_gpio;
1157
1158 rc = gpio_request(ISA1200_HAP_CLK, "haptics_clk");
1159 if (rc) {
1160 pr_err("%s: unable to request gpio %d config(%d)\n",
1161 __func__, ISA1200_HAP_CLK, rc);
1162 return rc;
1163 }
1164
1165 rc = gpio_direction_output(ISA1200_HAP_CLK, 0);
1166 if (rc) {
1167 pr_err("%s: unable to set direction\n", __func__);
1168 goto free_gpio;
1169 }
1170
1171 return 0;
1172
1173free_gpio:
1174 gpio_free(ISA1200_HAP_CLK);
1175 return rc;
1176}
1177
1178static struct isa1200_regulator isa1200_reg_data[] = {
1179 {
1180 .name = "vddp",
1181 .min_uV = ISA_I2C_VTG_MIN_UV,
1182 .max_uV = ISA_I2C_VTG_MAX_UV,
1183 .load_uA = ISA_I2C_CURR_UA,
1184 },
1185};
1186
1187static struct isa1200_platform_data isa1200_1_pdata = {
1188 .name = "vibrator",
1189 .dev_setup = isa1200_dev_setup,
1190 .power_on = isa1200_power,
1191 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
1192 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
1193 .max_timeout = 15000,
1194 .mode_ctrl = PWM_GEN_MODE,
1195 .pwm_fd = {
1196 .pwm_div = 256,
1197 },
1198 .is_erm = false,
1199 .smart_en = true,
1200 .ext_clk_en = true,
1201 .chip_en = 1,
1202 .regulator_info = isa1200_reg_data,
1203 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1204};
1205
1206static struct i2c_board_info isa1200_board_info[] __initdata = {
1207 {
1208 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1209 .platform_data = &isa1200_1_pdata,
1210 },
1211};
Jing Lin21ed4de2012-02-05 15:53:28 -08001212/* configuration data for mxt1386e using V2.1 firmware */
1213static const u8 mxt1386e_config_data_v2_1[] = {
1214 /* T6 Object */
1215 0, 0, 0, 0, 0, 0,
1216 /* T38 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001217 14, 1, 0, 22, 2, 12, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001218 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1219 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1220 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1221 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1222 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1223 0, 0, 0, 0,
1224 /* T7 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001225 100, 10, 50,
Jing Lin21ed4de2012-02-05 15:53:28 -08001226 /* T8 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001227 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001228 /* T9 Object */
1229 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
1230 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
Jing Linf1208fd2012-02-23 11:15:42 -08001231 85, 5, 0, 5, 9, 5, 12, 35, 70, 40,
1232 20, 5, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001233 /* T18 Object */
1234 0, 0,
1235 /* T24 Object */
1236 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1237 0, 0, 0, 0, 0, 0, 0, 0, 0,
1238 /* T25 Object */
1239 3, 0, 60, 115, 156, 99,
1240 /* T27 Object */
1241 0, 0, 0, 0, 0, 0, 0,
1242 /* T40 Object */
1243 0, 0, 0, 0, 0,
1244 /* T42 Object */
1245 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
1246 /* T43 Object */
1247 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
1248 16,
1249 /* T46 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001250 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001251 /* T47 Object */
1252 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
1253 /* T48 Object */
1254 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001255 32, 40, 0, 10, 10, 0, 0, 100, 10, 90,
1256 0, 0, 0, 0, 0, 0, 0, 10, 1, 10,
1257 52, 10, 12, 0, 33, 0, 1, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001258 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1259 0, 0, 0, 0,
1260 /* T56 Object */
1261 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1262 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1263 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1264 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001265 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1266 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001267};
1268
1269#define MXT_TS_GPIO_IRQ 6
1270#define MXT_TS_PWR_EN_GPIO PM8921_GPIO_PM_TO_SYS(23)
1271#define MXT_TS_RESET_GPIO 33
1272
1273static struct mxt_config_info mxt_config_array[] = {
1274 {
1275 .config = mxt1386e_config_data_v2_1,
1276 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1277 .family_id = 0xA0,
1278 .variant_id = 0x7,
1279 .version = 0x21,
1280 .build = 0xAA,
Jing Linef4aa9b2012-03-26 12:01:41 -07001281 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
1282 .fw_name = "atmel_8064_liquid_v2_2_AA.hex",
1283 },
1284 {
1285 /* The config data for V2.2.AA is the same as for V2.1.AA */
1286 .config = mxt1386e_config_data_v2_1,
1287 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1288 .family_id = 0xA0,
1289 .variant_id = 0x7,
1290 .version = 0x22,
1291 .build = 0xAA,
1292 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin21ed4de2012-02-05 15:53:28 -08001293 },
1294};
1295
1296static struct mxt_platform_data mxt_platform_data = {
1297 .config_array = mxt_config_array,
1298 .config_array_size = ARRAY_SIZE(mxt_config_array),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08001299 .panel_minx = 0,
1300 .panel_maxx = 1365,
1301 .panel_miny = 0,
1302 .panel_maxy = 767,
1303 .disp_minx = 0,
1304 .disp_maxx = 1365,
1305 .disp_miny = 0,
1306 .disp_maxy = 767,
Anirudh Ghayal39dbe3f2012-04-13 15:43:16 +05301307 .irqflags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
Jing Lin21ed4de2012-02-05 15:53:28 -08001308 .i2c_pull_up = true,
1309 .reset_gpio = MXT_TS_RESET_GPIO,
1310 .irq_gpio = MXT_TS_GPIO_IRQ,
1311};
1312
1313static struct i2c_board_info mxt_device_info[] __initdata = {
1314 {
1315 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
1316 .platform_data = &mxt_platform_data,
1317 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1318 },
1319};
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001320#define CYTTSP_TS_GPIO_IRQ 6
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001321#define CYTTSP_TS_GPIO_SLEEP 33
1322
1323static ssize_t tma340_vkeys_show(struct kobject *kobj,
1324 struct kobj_attribute *attr, char *buf)
1325{
1326 return snprintf(buf, 200,
1327 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1328 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1329 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1330 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1331 "\n");
1332}
1333
1334static struct kobj_attribute tma340_vkeys_attr = {
1335 .attr = {
1336 .mode = S_IRUGO,
1337 },
1338 .show = &tma340_vkeys_show,
1339};
1340
1341static struct attribute *tma340_properties_attrs[] = {
1342 &tma340_vkeys_attr.attr,
1343 NULL
1344};
1345
1346static struct attribute_group tma340_properties_attr_group = {
1347 .attrs = tma340_properties_attrs,
1348};
1349
1350static int cyttsp_platform_init(struct i2c_client *client)
1351{
1352 int rc = 0;
1353 static struct kobject *tma340_properties_kobj;
1354
1355 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1356 tma340_properties_kobj = kobject_create_and_add("board_properties",
1357 NULL);
1358 if (tma340_properties_kobj)
1359 rc = sysfs_create_group(tma340_properties_kobj,
1360 &tma340_properties_attr_group);
1361 if (!tma340_properties_kobj || rc)
1362 pr_err("%s: failed to create board_properties\n",
1363 __func__);
1364
1365 return 0;
1366}
1367
1368static struct cyttsp_regulator cyttsp_regulator_data[] = {
1369 {
1370 .name = "vdd",
1371 .min_uV = CY_TMA300_VTG_MIN_UV,
1372 .max_uV = CY_TMA300_VTG_MAX_UV,
1373 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1374 .lpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1375 },
1376 {
1377 .name = "vcc_i2c",
1378 .min_uV = CY_I2C_VTG_MIN_UV,
1379 .max_uV = CY_I2C_VTG_MAX_UV,
1380 .hpm_load_uA = CY_I2C_CURR_UA,
1381 .lpm_load_uA = CY_I2C_CURR_UA,
1382 },
1383};
1384
1385static struct cyttsp_platform_data cyttsp_pdata = {
1386 .panel_maxx = 634,
1387 .panel_maxy = 1166,
1388 .disp_maxx = 599,
1389 .disp_maxy = 1023,
1390 .disp_minx = 0,
1391 .disp_miny = 0,
1392 .flags = 0x01,
1393 .gen = CY_GEN3,
1394 .use_st = CY_USE_ST,
1395 .use_mt = CY_USE_MT,
1396 .use_hndshk = CY_SEND_HNDSHK,
1397 .use_trk_id = CY_USE_TRACKING_ID,
1398 .use_sleep = CY_USE_DEEP_SLEEP_SEL,
1399 .use_gestures = CY_USE_GESTURES,
1400 .fw_fname = "cyttsp_8064_mtp.hex",
1401 /* change act_intrvl to customize the Active power state
1402 * scanning/processing refresh interval for Operating mode
1403 */
1404 .act_intrvl = CY_ACT_INTRVL_DFLT,
1405 /* change tch_tmout to customize the touch timeout for the
1406 * Active power state for Operating mode
1407 */
1408 .tch_tmout = CY_TCH_TMOUT_DFLT,
1409 /* change lp_intrvl to customize the Low Power power state
1410 * scanning/processing refresh interval for Operating mode
1411 */
1412 .lp_intrvl = CY_LP_INTRVL_DFLT,
1413 .sleep_gpio = CYTTSP_TS_GPIO_SLEEP,
Amy Maloche9ba3ffe2012-04-26 10:31:20 -07001414 .resout_gpio = -1,
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001415 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1416 .regulator_info = cyttsp_regulator_data,
1417 .num_regulators = ARRAY_SIZE(cyttsp_regulator_data),
1418 .init = cyttsp_platform_init,
1419 .correct_fw_ver = 17,
1420};
1421
1422static struct i2c_board_info cyttsp_info[] __initdata = {
1423 {
1424 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1425 .platform_data = &cyttsp_pdata,
1426 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1427 },
1428};
Jing Lin21ed4de2012-02-05 15:53:28 -08001429
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001430#define MSM_WCNSS_PHYS 0x03000000
1431#define MSM_WCNSS_SIZE 0x280000
1432
1433static struct resource resources_wcnss_wlan[] = {
1434 {
1435 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1436 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1437 .name = "wcnss_wlanrx_irq",
1438 .flags = IORESOURCE_IRQ,
1439 },
1440 {
1441 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1442 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1443 .name = "wcnss_wlantx_irq",
1444 .flags = IORESOURCE_IRQ,
1445 },
1446 {
1447 .start = MSM_WCNSS_PHYS,
1448 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1449 .name = "wcnss_mmio",
1450 .flags = IORESOURCE_MEM,
1451 },
1452 {
1453 .start = 64,
1454 .end = 68,
1455 .name = "wcnss_gpios_5wire",
1456 .flags = IORESOURCE_IO,
1457 },
1458};
1459
1460static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1461 .has_48mhz_xo = 1,
1462};
1463
1464static struct platform_device msm_device_wcnss_wlan = {
1465 .name = "wcnss_wlan",
1466 .id = 0,
1467 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1468 .resource = resources_wcnss_wlan,
1469 .dev = {.platform_data = &qcom_wcnss_pdata},
1470};
1471
Ankit Vermab7c26e62012-02-28 15:04:15 -08001472static struct platform_device msm_device_iris_fm __devinitdata = {
1473 .name = "iris_fm",
1474 .id = -1,
1475};
1476
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001477#ifdef CONFIG_QSEECOM
1478/* qseecom bus scaling */
1479static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
1480 {
1481 .src = MSM_BUS_MASTER_SPS,
1482 .dst = MSM_BUS_SLAVE_EBI_CH0,
1483 .ib = 0,
1484 .ab = 0,
1485 },
1486 {
1487 .src = MSM_BUS_MASTER_SPDM,
1488 .dst = MSM_BUS_SLAVE_SPDM,
1489 .ib = 0,
1490 .ab = 0,
1491 },
1492};
1493
1494static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
1495 {
1496 .src = MSM_BUS_MASTER_SPS,
1497 .dst = MSM_BUS_SLAVE_EBI_CH0,
1498 .ib = (492 * 8) * 1000000UL,
1499 .ab = (492 * 8) * 100000UL,
1500 },
1501 {
1502 .src = MSM_BUS_MASTER_SPDM,
1503 .dst = MSM_BUS_SLAVE_SPDM,
1504 .ib = 0,
1505 .ab = 0,
1506 },
1507};
1508
1509static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1510 {
1511 .src = MSM_BUS_MASTER_SPS,
1512 .dst = MSM_BUS_SLAVE_EBI_CH0,
1513 .ib = 0,
1514 .ab = 0,
1515 },
1516 {
1517 .src = MSM_BUS_MASTER_SPDM,
1518 .dst = MSM_BUS_SLAVE_SPDM,
1519 .ib = (64 * 8) * 1000000UL,
1520 .ab = (64 * 8) * 100000UL,
1521 },
1522};
1523
1524static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1525 {
1526 ARRAY_SIZE(qseecom_clks_init_vectors),
1527 qseecom_clks_init_vectors,
1528 },
1529 {
1530 ARRAY_SIZE(qseecom_enable_dfab_vectors),
1531 qseecom_enable_sfpb_vectors,
1532 },
1533 {
1534 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1535 qseecom_enable_sfpb_vectors,
1536 },
1537};
1538
1539static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1540 qseecom_hw_bus_scale_usecases,
1541 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1542 .name = "qsee",
1543};
1544
1545static struct platform_device qseecom_device = {
1546 .name = "qseecom",
1547 .id = 0,
1548 .dev = {
1549 .platform_data = &qseecom_bus_pdata,
1550 },
1551};
1552#endif
1553
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001554#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1555 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1556 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1557 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1558
1559#define QCE_SIZE 0x10000
1560#define QCE_0_BASE 0x11000000
1561
1562#define QCE_HW_KEY_SUPPORT 0
1563#define QCE_SHA_HMAC_SUPPORT 1
1564#define QCE_SHARE_CE_RESOURCE 3
1565#define QCE_CE_SHARED 0
1566
1567static struct resource qcrypto_resources[] = {
1568 [0] = {
1569 .start = QCE_0_BASE,
1570 .end = QCE_0_BASE + QCE_SIZE - 1,
1571 .flags = IORESOURCE_MEM,
1572 },
1573 [1] = {
1574 .name = "crypto_channels",
1575 .start = DMOV8064_CE_IN_CHAN,
1576 .end = DMOV8064_CE_OUT_CHAN,
1577 .flags = IORESOURCE_DMA,
1578 },
1579 [2] = {
1580 .name = "crypto_crci_in",
1581 .start = DMOV8064_CE_IN_CRCI,
1582 .end = DMOV8064_CE_IN_CRCI,
1583 .flags = IORESOURCE_DMA,
1584 },
1585 [3] = {
1586 .name = "crypto_crci_out",
1587 .start = DMOV8064_CE_OUT_CRCI,
1588 .end = DMOV8064_CE_OUT_CRCI,
1589 .flags = IORESOURCE_DMA,
1590 },
1591};
1592
1593static struct resource qcedev_resources[] = {
1594 [0] = {
1595 .start = QCE_0_BASE,
1596 .end = QCE_0_BASE + QCE_SIZE - 1,
1597 .flags = IORESOURCE_MEM,
1598 },
1599 [1] = {
1600 .name = "crypto_channels",
1601 .start = DMOV8064_CE_IN_CHAN,
1602 .end = DMOV8064_CE_OUT_CHAN,
1603 .flags = IORESOURCE_DMA,
1604 },
1605 [2] = {
1606 .name = "crypto_crci_in",
1607 .start = DMOV8064_CE_IN_CRCI,
1608 .end = DMOV8064_CE_IN_CRCI,
1609 .flags = IORESOURCE_DMA,
1610 },
1611 [3] = {
1612 .name = "crypto_crci_out",
1613 .start = DMOV8064_CE_OUT_CRCI,
1614 .end = DMOV8064_CE_OUT_CRCI,
1615 .flags = IORESOURCE_DMA,
1616 },
1617};
1618
1619#endif
1620
1621#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1622 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1623
1624static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1625 .ce_shared = QCE_CE_SHARED,
1626 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1627 .hw_key_support = QCE_HW_KEY_SUPPORT,
1628 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001629 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001630};
1631
1632static struct platform_device qcrypto_device = {
1633 .name = "qcrypto",
1634 .id = 0,
1635 .num_resources = ARRAY_SIZE(qcrypto_resources),
1636 .resource = qcrypto_resources,
1637 .dev = {
1638 .coherent_dma_mask = DMA_BIT_MASK(32),
1639 .platform_data = &qcrypto_ce_hw_suppport,
1640 },
1641};
1642#endif
1643
1644#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1645 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1646
1647static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1648 .ce_shared = QCE_CE_SHARED,
1649 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1650 .hw_key_support = QCE_HW_KEY_SUPPORT,
1651 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001652 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001653};
1654
1655static struct platform_device qcedev_device = {
1656 .name = "qce",
1657 .id = 0,
1658 .num_resources = ARRAY_SIZE(qcedev_resources),
1659 .resource = qcedev_resources,
1660 .dev = {
1661 .coherent_dma_mask = DMA_BIT_MASK(32),
1662 .platform_data = &qcedev_ce_hw_suppport,
1663 },
1664};
1665#endif
1666
Joel Kingdacbc822012-01-25 13:30:57 -08001667static struct mdm_platform_data mdm_platform_data = {
1668 .mdm_version = "3.0",
1669 .ramdump_delay_ms = 2000,
Hemant Kumara945b472012-01-25 15:08:06 -08001670 .peripheral_platform_device = &apq8064_device_hsic_host,
Joel Kingdacbc822012-01-25 13:30:57 -08001671};
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001672
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001673static struct tsens_platform_data apq_tsens_pdata = {
1674 .tsens_factor = 1000,
1675 .hw_type = APQ_8064,
1676 .tsens_num_sensor = 11,
1677 .slope = {1176, 1176, 1154, 1176, 1111,
1678 1132, 1132, 1199, 1132, 1199, 1132},
1679};
1680
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07001681static struct platform_device msm_tsens_device = {
1682 .name = "tsens8960-tm",
1683 .id = -1,
1684};
1685
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001686#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001687static void __init apq8064_map_io(void)
1688{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001689 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001690 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001691 if (socinfo_init() < 0)
1692 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001693}
1694
1695static void __init apq8064_init_irq(void)
1696{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001697 struct msm_mpm_device_data *data = NULL;
1698
1699#ifdef CONFIG_MSM_MPM
1700 data = &apq8064_mpm_dev_data;
1701#endif
1702
1703 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001704 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1705 (void *)MSM_QGIC_CPU_BASE);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001706}
1707
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001708static struct platform_device msm8064_device_saw_regulator_core0 = {
1709 .name = "saw-regulator",
1710 .id = 0,
1711 .dev = {
1712 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
1713 },
1714};
1715
1716static struct platform_device msm8064_device_saw_regulator_core1 = {
1717 .name = "saw-regulator",
1718 .id = 1,
1719 .dev = {
1720 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
1721 },
1722};
1723
1724static struct platform_device msm8064_device_saw_regulator_core2 = {
1725 .name = "saw-regulator",
1726 .id = 2,
1727 .dev = {
1728 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
1729 },
1730};
1731
1732static struct platform_device msm8064_device_saw_regulator_core3 = {
1733 .name = "saw-regulator",
1734 .id = 3,
1735 .dev = {
1736 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001737
1738 },
1739};
1740
Oluwafemi Adeyemif5a31422012-03-08 16:58:45 -08001741static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001742 {
1743 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1744 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1745 true,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001746 100, 650, 801, 200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001747 },
1748
1749 {
1750 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1751 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1752 true,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001753 2000, 200, 576000, 2000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001754 },
1755
1756 {
1757 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1758 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1759 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001760 8500, 51, 1122000, 8500,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001761 },
1762
1763 {
1764 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1765 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
1766 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001767 9000, 51, 1130300, 9000,
1768 },
1769 {
1770 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1771 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
1772 false,
1773 10000, 51, 1130300, 10000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001774 },
1775
1776 {
1777 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1778 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1779 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001780 12000, 14, 2205900, 12000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001781 },
1782
1783 {
1784 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1785 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1786 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001787 18000, 12, 2364250, 18000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001788 },
1789
1790 {
1791 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1792 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1793 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001794 23500, 10, 2667000, 23500,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001795 },
1796
1797 {
1798 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1799 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1800 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001801 29700, 5, 2867000, 30000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001802 },
1803};
1804
1805static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1806 .mode = MSM_PM_BOOT_CONFIG_TZ,
1807};
1808
1809static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
1810 .levels = &msm_rpmrs_levels[0],
1811 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
1812 .vdd_mem_levels = {
1813 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
1814 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
1815 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
1816 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
1817 },
1818 .vdd_dig_levels = {
1819 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
1820 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
1821 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
1822 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
1823 },
1824 .vdd_mask = 0x7FFFFF,
1825 .rpmrs_target_id = {
1826 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
1827 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
1828 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
1829 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
1830 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
1831 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
1832 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
1833 },
1834};
1835
Praveen Chidambaram78499012011-11-01 17:15:17 -06001836static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1837 0x03, 0x0f,
1838};
1839
1840static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1841 0x00, 0x24, 0x54, 0x10,
1842 0x09, 0x03, 0x01,
1843 0x10, 0x54, 0x30, 0x0C,
1844 0x24, 0x30, 0x0f,
1845};
1846
1847static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1848 0x00, 0x24, 0x54, 0x10,
1849 0x09, 0x07, 0x01, 0x0B,
1850 0x10, 0x54, 0x30, 0x0C,
1851 0x24, 0x30, 0x0f,
1852};
1853
1854static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1855 [0] = {
1856 .mode = MSM_SPM_MODE_CLOCK_GATING,
1857 .notify_rpm = false,
1858 .cmd = spm_wfi_cmd_sequence,
1859 },
1860 [1] = {
1861 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1862 .notify_rpm = false,
1863 .cmd = spm_power_collapse_without_rpm,
1864 },
1865 [2] = {
1866 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1867 .notify_rpm = true,
1868 .cmd = spm_power_collapse_with_rpm,
1869 },
1870};
1871
1872static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1873 0x00, 0x20, 0x03, 0x20,
1874 0x00, 0x0f,
1875};
1876
1877static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1878 0x00, 0x20, 0x34, 0x64,
1879 0x48, 0x07, 0x48, 0x20,
1880 0x50, 0x64, 0x04, 0x34,
1881 0x50, 0x0f,
1882};
1883static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1884 0x00, 0x10, 0x34, 0x64,
1885 0x48, 0x07, 0x48, 0x10,
1886 0x50, 0x64, 0x04, 0x34,
1887 0x50, 0x0F,
1888};
1889
1890static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1891 [0] = {
1892 .mode = MSM_SPM_L2_MODE_RETENTION,
1893 .notify_rpm = false,
1894 .cmd = l2_spm_wfi_cmd_sequence,
1895 },
1896 [1] = {
1897 .mode = MSM_SPM_L2_MODE_GDHS,
1898 .notify_rpm = true,
1899 .cmd = l2_spm_gdhs_cmd_sequence,
1900 },
1901 [2] = {
1902 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1903 .notify_rpm = true,
1904 .cmd = l2_spm_power_off_cmd_sequence,
1905 },
1906};
1907
1908
1909static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1910 [0] = {
1911 .reg_base_addr = MSM_SAW_L2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001912 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001913 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001914 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1915 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1916 .modes = msm_spm_l2_seq_list,
1917 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1918 },
1919};
1920
1921static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1922 [0] = {
1923 .reg_base_addr = MSM_SAW0_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001924 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001925#if defined(CONFIG_MSM_AVS_HW)
1926 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1927 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1928#endif
1929 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001930 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001931 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1932 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1933 .vctl_timeout_us = 50,
1934 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1935 .modes = msm_spm_seq_list,
1936 },
1937 [1] = {
1938 .reg_base_addr = MSM_SAW1_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001939 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001940#if defined(CONFIG_MSM_AVS_HW)
1941 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1942 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1943#endif
1944 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001945 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001946 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1947 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1948 .vctl_timeout_us = 50,
1949 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1950 .modes = msm_spm_seq_list,
1951 },
1952 [2] = {
1953 .reg_base_addr = MSM_SAW2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001954 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001955#if defined(CONFIG_MSM_AVS_HW)
1956 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1957 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1958#endif
1959 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001960 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001961 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1962 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1963 .vctl_timeout_us = 50,
1964 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1965 .modes = msm_spm_seq_list,
1966 },
1967 [3] = {
1968 .reg_base_addr = MSM_SAW3_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001969 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001970#if defined(CONFIG_MSM_AVS_HW)
1971 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1972 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1973#endif
1974 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001975 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001976 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1977 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1978 .vctl_timeout_us = 50,
1979 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1980 .modes = msm_spm_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001981 },
1982};
1983
Praveen Chidambaram4d19be42012-04-03 18:05:52 -06001984static struct msm_pm_sleep_status_data msm_pm_slp_sts_data = {
1985 .base_addr = MSM_ACC0_BASE + 0x08,
1986 .cpu_offset = MSM_ACC1_BASE - MSM_ACC0_BASE,
1987 .mask = 1UL << 13,
1988};
1989
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001990static void __init apq8064_init_buses(void)
1991{
1992 msm_bus_rpm_set_mt_mask();
1993 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
1994 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
1995 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
1996 msm_bus_8064_apps_fabric.dev.platform_data =
1997 &msm_bus_8064_apps_fabric_pdata;
1998 msm_bus_8064_sys_fabric.dev.platform_data =
1999 &msm_bus_8064_sys_fabric_pdata;
2000 msm_bus_8064_mm_fabric.dev.platform_data =
2001 &msm_bus_8064_mm_fabric_pdata;
2002 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
2003 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
2004}
2005
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002006/* PCIe gpios */
2007static struct msm_pcie_gpio_info_t msm_pcie_gpio_info[MSM_PCIE_MAX_GPIO] = {
2008 {"rst_n", PM8921_MPP_PM_TO_SYS(PCIE_RST_N_PMIC_MPP), 0},
2009 {"pwr_en", PM8921_GPIO_PM_TO_SYS(PCIE_PWR_EN_PMIC_GPIO), 1},
2010};
2011
2012static struct msm_pcie_platform msm_pcie_platform_data = {
2013 .gpio = msm_pcie_gpio_info,
2014};
2015
2016static void __init mpq8064_pcie_init(void)
2017{
2018 msm_device_pcie.dev.platform_data = &msm_pcie_platform_data;
2019 platform_device_register(&msm_device_pcie);
2020}
2021
David Collinsf0d00732012-01-25 15:46:50 -08002022static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
2023 .name = GPIO_REGULATOR_DEV_NAME,
2024 .id = PM8921_MPP_PM_TO_SYS(7),
2025 .dev = {
2026 .platform_data
2027 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2028 },
2029};
2030
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08002031static struct platform_device apq8064_device_ext_mpp8_vreg __devinitdata = {
2032 .name = GPIO_REGULATOR_DEV_NAME,
2033 .id = PM8921_MPP_PM_TO_SYS(8),
2034 .dev = {
2035 .platform_data
2036 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_MPP8],
2037 },
2038};
2039
David Collinsf0d00732012-01-25 15:46:50 -08002040static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
2041 .name = GPIO_REGULATOR_DEV_NAME,
2042 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
2043 .dev = {
2044 .platform_data =
2045 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2046 },
2047};
2048
David Collins390fc332012-02-07 14:38:16 -08002049static struct platform_device apq8064_device_ext_ts_sw_vreg __devinitdata = {
2050 .name = GPIO_REGULATOR_DEV_NAME,
2051 .id = PM8921_GPIO_PM_TO_SYS(23),
2052 .dev = {
2053 .platform_data
2054 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_TS_SW],
2055 },
2056};
2057
David Collins2782b5c2012-02-06 10:02:42 -08002058static struct platform_device apq8064_device_rpm_regulator __devinitdata = {
2059 .name = "rpm-regulator",
2060 .id = -1,
2061 .dev = {
2062 .platform_data = &apq8064_rpm_regulator_pdata,
2063 },
2064};
2065
Ravi Kumar V05931a22012-04-04 17:09:37 +05302066static struct gpio_ir_recv_platform_data gpio_ir_recv_pdata = {
2067 .gpio_nr = 88,
2068 .active_low = 1,
2069};
2070
2071static struct platform_device gpio_ir_recv_pdev = {
2072 .name = "gpio-rc-recv",
2073 .dev = {
2074 .platform_data = &gpio_ir_recv_pdata,
2075 },
2076};
2077
Terence Hampson36b70722012-05-10 13:18:16 -04002078static struct platform_device *common_not_mpq_devices[] __initdata = {
David Keitel3c40fc52012-02-09 17:53:52 -08002079 &apq8064_device_qup_i2c_gsbi1,
Jing Lin04601f92012-02-05 15:36:07 -08002080 &apq8064_device_qup_i2c_gsbi3,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002081 &apq8064_device_qup_i2c_gsbi4,
Terence Hampson36b70722012-05-10 13:18:16 -04002082};
2083
2084static struct platform_device *common_devices[] __initdata = {
2085 &apq8064_device_dmov,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002086 &apq8064_device_qup_spi_gsbi5,
David Collinsf0d00732012-01-25 15:46:50 -08002087 &apq8064_device_ext_5v_vreg,
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08002088 &apq8064_device_ext_mpp8_vreg,
David Collinsf0d00732012-01-25 15:46:50 -08002089 &apq8064_device_ext_3p3v_vreg,
David Collins390fc332012-02-07 14:38:16 -08002090 &apq8064_device_ext_ts_sw_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07002091 &apq8064_device_ssbi_pmic1,
2092 &apq8064_device_ssbi_pmic2,
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06002093 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07002094 &apq8064_device_otg,
2095 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08002096 &apq8064_device_hsusb_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07002097 &android_usb_device,
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08002098 &msm_device_wcnss_wlan,
Ankit Vermab7c26e62012-02-28 15:04:15 -08002099 &msm_device_iris_fm,
Larry Bassel67b921d2012-04-06 10:23:27 -07002100 &apq8064_fmem_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08002101#ifdef CONFIG_ANDROID_PMEM
2102#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002103 &apq8064_android_pmem_device,
2104 &apq8064_android_pmem_adsp_device,
2105 &apq8064_android_pmem_audio_device,
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -07002106#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
2107#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -08002108#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002109 &apq8064_ion_dev,
Olav Haugan7c6aa742012-01-16 16:47:37 -08002110#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002111 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08002112 &msm8064_device_saw_regulator_core0,
2113 &msm8064_device_saw_regulator_core1,
2114 &msm8064_device_saw_regulator_core2,
2115 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002116#if defined(CONFIG_QSEECOM)
2117 &qseecom_device,
2118#endif
2119
Ramesh Masavarapu28311912011-10-27 11:04:12 -07002120#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2121 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2122 &qcrypto_device,
2123#endif
2124
2125#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2126 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2127 &qcedev_device,
2128#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07002129
2130#ifdef CONFIG_HW_RANDOM_MSM
2131 &apq8064_device_rng,
2132#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002133 &apq_pcm,
2134 &apq_pcm_routing,
2135 &apq_cpudai0,
2136 &apq_cpudai1,
Santosh Mardieff9a742012-04-09 23:23:39 +05302137 &mpq_cpudai_sec_i2s_rx,
Kuirong Wangf23f8c52012-03-31 12:34:51 -07002138 &mpq_cpudai_mi2s_tx,
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002139 &apq_cpudai_hdmi_rx,
2140 &apq_cpudai_bt_rx,
2141 &apq_cpudai_bt_tx,
2142 &apq_cpudai_fm_rx,
2143 &apq_cpudai_fm_tx,
2144 &apq_cpu_fe,
2145 &apq_stub_codec,
2146 &apq_voice,
2147 &apq_voip,
2148 &apq_lpa_pcm,
Krishnankutty Kolathappilly4374e332012-03-18 22:27:30 -07002149 &apq_compr_dsp,
2150 &apq_multi_ch_pcm,
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002151 &apq_pcm_hostless,
2152 &apq_cpudai_afe_01_rx,
2153 &apq_cpudai_afe_01_tx,
2154 &apq_cpudai_afe_02_rx,
2155 &apq_cpudai_afe_02_tx,
2156 &apq_pcm_afe,
2157 &apq_cpudai_auxpcm_rx,
2158 &apq_cpudai_auxpcm_tx,
Neema Shetty8427c262012-02-16 11:23:43 -08002159 &apq_cpudai_stub,
Neema Shetty3c9d2862012-03-11 01:25:32 -08002160 &apq_cpudai_slimbus_1_rx,
2161 &apq_cpudai_slimbus_1_tx,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002162 &apq_cpudai_slimbus_2_tx,
Neema Shettyc9d86c32012-05-09 12:01:39 -07002163 &apq_cpudai_slimbus_3_rx,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002164 &apq8064_rpm_device,
2165 &apq8064_rpm_log_device,
2166 &apq8064_rpm_stat_device,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002167 &msm_bus_8064_apps_fabric,
2168 &msm_bus_8064_sys_fabric,
2169 &msm_bus_8064_mm_fabric,
2170 &msm_bus_8064_sys_fpb,
2171 &msm_bus_8064_cpss_fpb,
Mohan Kumar Gubbihalli Lachma Naik7f72edd2012-02-06 17:26:47 -08002172 &apq8064_msm_device_vidc,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07002173 &msm_pil_dsps,
Matt Wagantalled832652012-02-02 19:23:17 -08002174 &msm_8960_riva,
Matt Wagantallb94b9a52012-02-02 21:59:54 -08002175 &msm_8960_q6_lpass,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002176 &msm_pil_vidc,
Matt Wagantall292aace2012-01-26 19:12:34 -08002177 &msm_gss,
Laura Abbottb93525f2012-04-12 09:57:19 -07002178 &apq8064_rtb_device,
Praveen Chidambaram8ea3dcd2011-12-07 14:46:31 -07002179 &apq8064_cpu_idle_device,
Praveen Chidambaram5c8adf22012-02-23 18:44:37 -07002180 &apq8064_msm_gov_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002181 &apq8064_device_cache_erp,
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002182 &epm_adc_device,
Pratik Patel212ab362012-03-16 12:30:07 -07002183 &apq8064_qdss_device,
2184 &msm_etb_device,
2185 &msm_tpiu_device,
2186 &msm_funnel_device,
2187 &apq8064_etm_device,
Helen Zeng8f925502012-03-05 16:50:17 -08002188 &apq_cpudai_slim_4_rx,
2189 &apq_cpudai_slim_4_tx,
Jignesh Mehta921649d2012-04-19 06:57:23 -07002190 &msm8960_gemini_device,
Laura Abbott0577d7b2012-04-17 11:14:30 -07002191 &apq8064_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002192 &msm_tsens_device,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002193};
2194
Joel King4e7ad222011-08-17 15:47:38 -07002195static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002196 &apq8064_device_uart_gsbi3,
Yan He06913ce2011-08-26 16:33:46 -07002197 &msm_device_sps_apq8064,
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002198};
2199
2200static struct platform_device *rumi3_devices[] __initdata = {
2201 &apq8064_device_uart_gsbi1,
Yan He435ed612011-11-23 17:34:59 -08002202 &msm_device_sps_apq8064,
Huaibin Yang4a084e32011-12-15 15:25:52 -08002203#ifdef CONFIG_MSM_ROTATOR
2204 &msm_rotator_device,
2205#endif
Joel King4e7ad222011-08-17 15:47:38 -07002206};
2207
Joel King82b7e3f2012-01-05 10:03:27 -08002208static struct platform_device *cdp_devices[] __initdata = {
2209 &apq8064_device_uart_gsbi1,
Jin Hong4bbbfba2012-02-02 21:48:07 -08002210 &apq8064_device_uart_gsbi7,
Joel King82b7e3f2012-01-05 10:03:27 -08002211 &msm_device_sps_apq8064,
Aravind Venkateswaran4ca27532012-02-16 14:27:05 -08002212#ifdef CONFIG_MSM_ROTATOR
2213 &msm_rotator_device,
2214#endif
Joel King82b7e3f2012-01-05 10:03:27 -08002215};
2216
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002217static struct platform_device
2218mpq8064_device_ext_5v_frc_vreg __devinitdata = {
2219 .name = GPIO_REGULATOR_DEV_NAME,
2220 .id = SX150X_GPIO(4, 10),
2221 .dev = {
2222 .platform_data =
2223 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_FRC_5V],
2224 },
2225};
2226
2227static struct platform_device
2228mpq8064_device_ext_1p2_buck_vreg __devinitdata = {
2229 .name = GPIO_REGULATOR_DEV_NAME,
2230 .id = SX150X_GPIO(4, 2),
2231 .dev = {
2232 .platform_data =
2233 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P2V],
2234 },
2235};
2236
2237static struct platform_device
2238mpq8064_device_ext_1p8_buck_vreg __devinitdata = {
2239 .name = GPIO_REGULATOR_DEV_NAME,
2240 .id = SX150X_GPIO(4, 4),
2241 .dev = {
2242 .platform_data =
2243 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P8V],
2244 },
2245};
2246
2247static struct platform_device
2248mpq8064_device_ext_2p2_buck_vreg __devinitdata = {
2249 .name = GPIO_REGULATOR_DEV_NAME,
2250 .id = SX150X_GPIO(4, 14),
2251 .dev = {
2252 .platform_data =
2253 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_2P2V],
2254 },
2255};
2256
2257static struct platform_device
2258mpq8064_device_ext_5v_buck_vreg __devinitdata = {
2259 .name = GPIO_REGULATOR_DEV_NAME,
2260 .id = SX150X_GPIO(4, 3),
2261 .dev = {
2262 .platform_data =
2263 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_5V],
2264 },
2265};
2266
2267static struct platform_device
2268mpq8064_device_ext_3p3v_ldo_vreg __devinitdata = {
2269 .name = GPIO_REGULATOR_DEV_NAME,
2270 .id = SX150X_GPIO(4, 15),
2271 .dev = {
2272 .platform_data =
2273 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_3P3V],
2274 },
2275};
2276
Ravi Kumar V1c903012012-05-15 16:11:35 +05302277static struct platform_device rc_input_loopback_pdev = {
2278 .name = "rc-user-input",
2279 .id = -1,
2280};
2281
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002282static struct platform_device *mpq_devices[] __initdata = {
2283 &msm_device_sps_apq8064,
2284 &mpq8064_device_qup_i2c_gsbi5,
2285#ifdef CONFIG_MSM_ROTATOR
2286 &msm_rotator_device,
2287#endif
Ravi Kumar V05931a22012-04-04 17:09:37 +05302288 &gpio_ir_recv_pdev,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002289 &mpq8064_device_ext_5v_frc_vreg,
2290 &mpq8064_device_ext_1p2_buck_vreg,
2291 &mpq8064_device_ext_1p8_buck_vreg,
2292 &mpq8064_device_ext_2p2_buck_vreg,
2293 &mpq8064_device_ext_5v_buck_vreg,
2294 &mpq8064_device_ext_3p3v_ldo_vreg,
Terence Hampson2e1705f2012-04-11 19:55:29 -04002295#ifdef CONFIG_MSM_VCAP
2296 &msm8064_device_vcap,
2297#endif
Ravi Kumar V1c903012012-05-15 16:11:35 +05302298 &rc_input_loopback_pdev,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002299};
2300
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002301static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002302 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002303};
2304
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002305#define KS8851_IRQ_GPIO 43
2306
2307static struct spi_board_info spi_board_info[] __initdata = {
2308 {
2309 .modalias = "ks8851",
2310 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2311 .max_speed_hz = 19200000,
2312 .bus_num = 0,
2313 .chip_select = 2,
2314 .mode = SPI_MODE_0,
2315 },
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002316 {
2317 .modalias = "epm_adc",
2318 .max_speed_hz = 1100000,
2319 .bus_num = 0,
2320 .chip_select = 3,
2321 .mode = SPI_MODE_0,
2322 },
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002323};
2324
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002325static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002326 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08002327 .bus_num = 1,
2328 .slim_slave = &apq8064_slim_tabla,
2329 },
2330 {
2331 .bus_num = 1,
2332 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002333 },
2334 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002335};
2336
David Keitel3c40fc52012-02-09 17:53:52 -08002337static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi1_pdata = {
2338 .clk_freq = 100000,
2339 .src_clk_rate = 24000000,
2340};
2341
Jing Lin04601f92012-02-05 15:36:07 -08002342static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi3_pdata = {
Anirudh Ghayalc2163472012-04-10 14:58:14 +05302343 .clk_freq = 384000,
Jing Lin04601f92012-02-05 15:36:07 -08002344 .src_clk_rate = 24000000,
2345};
2346
Kenneth Heitke748593a2011-07-15 15:45:11 -06002347static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
2348 .clk_freq = 100000,
2349 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002350};
2351
Joel King8f839b92012-04-01 14:37:46 -07002352static struct msm_i2c_platform_data mpq8064_i2c_qup_gsbi5_pdata = {
2353 .clk_freq = 100000,
2354 .src_clk_rate = 24000000,
2355};
2356
David Keitel3c40fc52012-02-09 17:53:52 -08002357#define GSBI_DUAL_MODE_CODE 0x60
2358#define MSM_GSBI1_PHYS 0x12440000
Kenneth Heitke748593a2011-07-15 15:45:11 -06002359static void __init apq8064_i2c_init(void)
2360{
David Keitel3c40fc52012-02-09 17:53:52 -08002361 void __iomem *gsbi_mem;
2362
2363 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2364 &apq8064_i2c_qup_gsbi1_pdata;
2365 gsbi_mem = ioremap_nocache(MSM_GSBI1_PHYS, 4);
2366 writel_relaxed(GSBI_DUAL_MODE_CODE, gsbi_mem);
2367 /* Ensure protocol code is written before proceeding */
2368 wmb();
2369 iounmap(gsbi_mem);
2370 apq8064_i2c_qup_gsbi1_pdata.use_gsbi_shared_mode = 1;
Jing Lin04601f92012-02-05 15:36:07 -08002371 apq8064_device_qup_i2c_gsbi3.dev.platform_data =
2372 &apq8064_i2c_qup_gsbi3_pdata;
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002373 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2374 &apq8064_i2c_qup_gsbi1_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002375 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
2376 &apq8064_i2c_qup_gsbi4_pdata;
Joel King8f839b92012-04-01 14:37:46 -07002377 mpq8064_device_qup_i2c_gsbi5.dev.platform_data =
2378 &mpq8064_i2c_qup_gsbi5_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002379}
2380
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002381#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002382static int ethernet_init(void)
2383{
2384 int ret;
2385 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
2386 if (ret) {
2387 pr_err("ks8851 gpio_request failed: %d\n", ret);
2388 goto fail;
2389 }
2390
2391 return 0;
2392fail:
2393 return ret;
2394}
2395#else
2396static int ethernet_init(void)
2397{
2398 return 0;
2399}
2400#endif
2401
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302402#define GPIO_KEY_HOME PM8921_GPIO_PM_TO_SYS(27)
2403#define GPIO_KEY_VOLUME_UP PM8921_GPIO_PM_TO_SYS(35)
2404#define GPIO_KEY_VOLUME_DOWN PM8921_GPIO_PM_TO_SYS(38)
2405#define GPIO_KEY_CAM_FOCUS PM8921_GPIO_PM_TO_SYS(3)
2406#define GPIO_KEY_CAM_SNAP PM8921_GPIO_PM_TO_SYS(4)
Jing Lin3f8f8422012-03-05 09:32:11 -08002407#define GPIO_KEY_ROTATION PM8921_GPIO_PM_TO_SYS(42)
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302408
2409static struct gpio_keys_button cdp_keys[] = {
2410 {
2411 .code = KEY_HOME,
2412 .gpio = GPIO_KEY_HOME,
2413 .desc = "home_key",
2414 .active_low = 1,
2415 .type = EV_KEY,
2416 .wakeup = 1,
2417 .debounce_interval = 15,
2418 },
2419 {
2420 .code = KEY_VOLUMEUP,
2421 .gpio = GPIO_KEY_VOLUME_UP,
2422 .desc = "volume_up_key",
2423 .active_low = 1,
2424 .type = EV_KEY,
2425 .wakeup = 1,
2426 .debounce_interval = 15,
2427 },
2428 {
2429 .code = KEY_VOLUMEDOWN,
2430 .gpio = GPIO_KEY_VOLUME_DOWN,
2431 .desc = "volume_down_key",
2432 .active_low = 1,
2433 .type = EV_KEY,
2434 .wakeup = 1,
2435 .debounce_interval = 15,
2436 },
2437 {
2438 .code = SW_ROTATE_LOCK,
2439 .gpio = GPIO_KEY_ROTATION,
2440 .desc = "rotate_key",
2441 .active_low = 1,
2442 .type = EV_SW,
2443 .debounce_interval = 15,
2444 },
2445};
2446
2447static struct gpio_keys_platform_data cdp_keys_data = {
2448 .buttons = cdp_keys,
2449 .nbuttons = ARRAY_SIZE(cdp_keys),
2450};
2451
2452static struct platform_device cdp_kp_pdev = {
2453 .name = "gpio-keys",
2454 .id = -1,
2455 .dev = {
2456 .platform_data = &cdp_keys_data,
2457 },
2458};
2459
2460static struct gpio_keys_button mtp_keys[] = {
2461 {
2462 .code = KEY_CAMERA_FOCUS,
2463 .gpio = GPIO_KEY_CAM_FOCUS,
2464 .desc = "cam_focus_key",
2465 .active_low = 1,
2466 .type = EV_KEY,
2467 .wakeup = 1,
2468 .debounce_interval = 15,
2469 },
2470 {
2471 .code = KEY_VOLUMEUP,
2472 .gpio = GPIO_KEY_VOLUME_UP,
2473 .desc = "volume_up_key",
2474 .active_low = 1,
2475 .type = EV_KEY,
2476 .wakeup = 1,
2477 .debounce_interval = 15,
2478 },
2479 {
2480 .code = KEY_VOLUMEDOWN,
2481 .gpio = GPIO_KEY_VOLUME_DOWN,
2482 .desc = "volume_down_key",
2483 .active_low = 1,
2484 .type = EV_KEY,
2485 .wakeup = 1,
2486 .debounce_interval = 15,
2487 },
2488 {
2489 .code = KEY_CAMERA_SNAPSHOT,
2490 .gpio = GPIO_KEY_CAM_SNAP,
2491 .desc = "cam_snap_key",
2492 .active_low = 1,
2493 .type = EV_KEY,
2494 .debounce_interval = 15,
2495 },
2496};
2497
2498static struct gpio_keys_platform_data mtp_keys_data = {
2499 .buttons = mtp_keys,
2500 .nbuttons = ARRAY_SIZE(mtp_keys),
2501};
2502
2503static struct platform_device mtp_kp_pdev = {
2504 .name = "gpio-keys",
2505 .id = -1,
2506 .dev = {
2507 .platform_data = &mtp_keys_data,
2508 },
2509};
2510
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05302511static struct gpio_keys_button mpq_keys[] = {
2512 {
2513 .code = KEY_VOLUMEDOWN,
2514 .gpio = GPIO_KEY_VOLUME_DOWN,
2515 .desc = "volume_down_key",
2516 .active_low = 1,
2517 .type = EV_KEY,
2518 .wakeup = 1,
2519 .debounce_interval = 15,
2520 },
2521 {
2522 .code = KEY_VOLUMEUP,
2523 .gpio = GPIO_KEY_VOLUME_UP,
2524 .desc = "volume_up_key",
2525 .active_low = 1,
2526 .type = EV_KEY,
2527 .wakeup = 1,
2528 .debounce_interval = 15,
2529 },
2530};
2531
2532static struct gpio_keys_platform_data mpq_keys_data = {
2533 .buttons = mpq_keys,
2534 .nbuttons = ARRAY_SIZE(mpq_keys),
2535};
2536
2537static struct platform_device mpq_gpio_keys_pdev = {
2538 .name = "gpio-keys",
2539 .id = -1,
2540 .dev = {
2541 .platform_data = &mpq_keys_data,
2542 },
2543};
2544
2545#define MPQ_KP_ROW_BASE SX150X_EXP2_GPIO_BASE
2546#define MPQ_KP_COL_BASE (SX150X_EXP2_GPIO_BASE + 4)
2547
2548static unsigned int mpq_row_gpios[] = {MPQ_KP_ROW_BASE, MPQ_KP_ROW_BASE + 1,
2549 MPQ_KP_ROW_BASE + 2, MPQ_KP_ROW_BASE + 3};
2550static unsigned int mpq_col_gpios[] = {MPQ_KP_COL_BASE, MPQ_KP_COL_BASE + 1,
2551 MPQ_KP_COL_BASE + 2};
2552
2553static const unsigned int mpq_keymap[] = {
2554 KEY(0, 0, KEY_UP),
2555 KEY(0, 1, KEY_ENTER),
2556 KEY(0, 2, KEY_3),
2557
2558 KEY(1, 0, KEY_DOWN),
2559 KEY(1, 1, KEY_EXIT),
2560 KEY(1, 2, KEY_4),
2561
2562 KEY(2, 0, KEY_LEFT),
2563 KEY(2, 1, KEY_1),
2564 KEY(2, 2, KEY_5),
2565
2566 KEY(3, 0, KEY_RIGHT),
2567 KEY(3, 1, KEY_2),
2568 KEY(3, 2, KEY_6),
2569};
2570
2571static struct matrix_keymap_data mpq_keymap_data = {
2572 .keymap_size = ARRAY_SIZE(mpq_keymap),
2573 .keymap = mpq_keymap,
2574};
2575
2576static struct matrix_keypad_platform_data mpq_keypad_data = {
2577 .keymap_data = &mpq_keymap_data,
2578 .row_gpios = mpq_row_gpios,
2579 .col_gpios = mpq_col_gpios,
2580 .num_row_gpios = ARRAY_SIZE(mpq_row_gpios),
2581 .num_col_gpios = ARRAY_SIZE(mpq_col_gpios),
2582 .col_scan_delay_us = 32000,
2583 .debounce_ms = 20,
2584 .wakeup = 1,
2585 .active_low = 1,
2586 .no_autorepeat = 1,
2587};
2588
2589static struct platform_device mpq_keypad_device = {
2590 .name = "matrix-keypad",
2591 .id = -1,
2592 .dev = {
2593 .platform_data = &mpq_keypad_data,
2594 },
2595};
2596
Jin Hongd3024e62012-02-09 16:13:32 -08002597/* Sensors DSPS platform data */
2598#define DSPS_PIL_GENERIC_NAME "dsps"
2599static void __init apq8064_init_dsps(void)
2600{
2601 struct msm_dsps_platform_data *pdata =
2602 msm_dsps_device_8064.dev.platform_data;
2603 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
2604 pdata->gpios = NULL;
2605 pdata->gpios_num = 0;
2606
2607 platform_device_register(&msm_dsps_device_8064);
2608}
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302609
Jing Lin417fa452012-02-05 14:31:06 -08002610#define I2C_SURF 1
2611#define I2C_FFA (1 << 1)
2612#define I2C_RUMI (1 << 2)
2613#define I2C_SIM (1 << 3)
2614#define I2C_LIQUID (1 << 4)
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002615#define I2C_MPQ_CDP BIT(5)
2616#define I2C_MPQ_HRD BIT(6)
2617#define I2C_MPQ_DTV BIT(7)
Jing Lin417fa452012-02-05 14:31:06 -08002618
2619struct i2c_registry {
2620 u8 machs;
2621 int bus;
2622 struct i2c_board_info *info;
2623 int len;
2624};
2625
2626static struct i2c_registry apq8064_i2c_devices[] __initdata = {
Jing Lin21ed4de2012-02-05 15:53:28 -08002627 {
David Keitel2f613d92012-02-15 11:29:16 -08002628 I2C_LIQUID,
2629 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
2630 smb349_charger_i2c_info,
2631 ARRAY_SIZE(smb349_charger_i2c_info)
2632 },
2633 {
Jing Lin21ed4de2012-02-05 15:53:28 -08002634 I2C_SURF | I2C_LIQUID,
2635 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
2636 mxt_device_info,
2637 ARRAY_SIZE(mxt_device_info),
2638 },
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08002639 {
2640 I2C_FFA,
2641 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
2642 cyttsp_info,
2643 ARRAY_SIZE(cyttsp_info),
2644 },
Amy Maloche70090f992012-02-16 16:35:26 -08002645 {
2646 I2C_FFA | I2C_LIQUID,
2647 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
2648 isa1200_board_info,
2649 ARRAY_SIZE(isa1200_board_info),
2650 },
Santosh Mardieff9a742012-04-09 23:23:39 +05302651 {
2652 I2C_MPQ_CDP,
2653 APQ_8064_GSBI5_QUP_I2C_BUS_ID,
2654 cs8427_device_info,
2655 ARRAY_SIZE(cs8427_device_info),
2656 },
Jing Lin417fa452012-02-05 14:31:06 -08002657};
2658
Jay Chokshi607f61b2012-04-25 18:21:21 -07002659#define SX150X_EXP1_INT_N PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9)
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05302660#define SX150X_EXP2_INT_N MSM_GPIO_TO_INT(81)
Jay Chokshi607f61b2012-04-25 18:21:21 -07002661
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002662struct sx150x_platform_data mpq8064_sx150x_pdata[] = {
2663 [SX150X_EXP1] = {
2664 .gpio_base = SX150X_EXP1_GPIO_BASE,
2665 .oscio_is_gpo = false,
2666 .io_pullup_ena = 0x0,
2667 .io_pulldn_ena = 0x0,
2668 .io_open_drain_ena = 0x0,
2669 .io_polarity = 0,
Jay Chokshi607f61b2012-04-25 18:21:21 -07002670 .irq_summary = SX150X_EXP1_INT_N,
2671 .irq_base = SX150X_EXP1_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002672 },
2673 [SX150X_EXP2] = {
2674 .gpio_base = SX150X_EXP2_GPIO_BASE,
2675 .oscio_is_gpo = false,
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05302676 .io_pullup_ena = 0x0f,
2677 .io_pulldn_ena = 0x70,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002678 .io_open_drain_ena = 0x0,
2679 .io_polarity = 0,
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05302680 .irq_summary = SX150X_EXP2_INT_N,
2681 .irq_base = SX150X_EXP2_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002682 },
2683 [SX150X_EXP3] = {
2684 .gpio_base = SX150X_EXP3_GPIO_BASE,
2685 .oscio_is_gpo = false,
2686 .io_pullup_ena = 0x0,
2687 .io_pulldn_ena = 0x0,
2688 .io_open_drain_ena = 0x0,
2689 .io_polarity = 0,
2690 .irq_summary = -1,
2691 },
2692 [SX150X_EXP4] = {
2693 .gpio_base = SX150X_EXP4_GPIO_BASE,
2694 .oscio_is_gpo = false,
2695 .io_pullup_ena = 0x0,
2696 .io_pulldn_ena = 0x0,
2697 .io_open_drain_ena = 0x0,
2698 .io_polarity = 0,
2699 .irq_summary = -1,
2700 },
2701};
2702
2703static struct i2c_board_info sx150x_gpio_exp_info[] = {
2704 {
2705 I2C_BOARD_INFO("sx1509q", 0x70),
2706 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP1],
2707 },
2708 {
2709 I2C_BOARD_INFO("sx1508q", 0x23),
2710 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP2],
2711 },
2712 {
2713 I2C_BOARD_INFO("sx1508q", 0x22),
2714 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP3],
2715 },
2716 {
2717 I2C_BOARD_INFO("sx1509q", 0x3E),
2718 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP4],
2719 },
2720};
2721
2722#define MPQ8064_I2C_GSBI5_BUS_ID 5
2723
2724static struct i2c_registry mpq8064_i2c_devices[] __initdata = {
2725 {
2726 I2C_MPQ_CDP,
2727 MPQ8064_I2C_GSBI5_BUS_ID,
2728 sx150x_gpio_exp_info,
2729 ARRAY_SIZE(sx150x_gpio_exp_info),
2730 },
2731};
2732
Jing Lin417fa452012-02-05 14:31:06 -08002733static void __init register_i2c_devices(void)
2734{
2735 u8 mach_mask = 0;
2736 int i;
2737
Kevin Chand07220e2012-02-13 15:52:22 -08002738#ifdef CONFIG_MSM_CAMERA
2739 struct i2c_registry apq8064_camera_i2c_devices = {
2740 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_RUMI,
2741 APQ_8064_GSBI4_QUP_I2C_BUS_ID,
2742 apq8064_camera_board_info.board_info,
2743 apq8064_camera_board_info.num_i2c_board_info,
2744 };
2745#endif
Jing Lin417fa452012-02-05 14:31:06 -08002746 /* Build the matching 'supported_machs' bitmask */
2747 if (machine_is_apq8064_cdp())
2748 mach_mask = I2C_SURF;
2749 else if (machine_is_apq8064_mtp())
2750 mach_mask = I2C_FFA;
2751 else if (machine_is_apq8064_liquid())
2752 mach_mask = I2C_LIQUID;
2753 else if (machine_is_apq8064_rumi3())
2754 mach_mask = I2C_RUMI;
2755 else if (machine_is_apq8064_sim())
2756 mach_mask = I2C_SIM;
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002757 else if (PLATFORM_IS_MPQ8064())
2758 mach_mask = I2C_MPQ_CDP;
Jing Lin417fa452012-02-05 14:31:06 -08002759 else
2760 pr_err("unmatched machine ID in register_i2c_devices\n");
2761
2762 /* Run the array and install devices as appropriate */
2763 for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) {
2764 if (apq8064_i2c_devices[i].machs & mach_mask)
2765 i2c_register_board_info(apq8064_i2c_devices[i].bus,
2766 apq8064_i2c_devices[i].info,
2767 apq8064_i2c_devices[i].len);
2768 }
Kevin Chand07220e2012-02-13 15:52:22 -08002769#ifdef CONFIG_MSM_CAMERA
2770 if (apq8064_camera_i2c_devices.machs & mach_mask)
2771 i2c_register_board_info(apq8064_camera_i2c_devices.bus,
2772 apq8064_camera_i2c_devices.info,
2773 apq8064_camera_i2c_devices.len);
2774#endif
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002775
2776 for (i = 0; i < ARRAY_SIZE(mpq8064_i2c_devices); ++i) {
2777 if (mpq8064_i2c_devices[i].machs & mach_mask)
2778 i2c_register_board_info(
2779 mpq8064_i2c_devices[i].bus,
2780 mpq8064_i2c_devices[i].info,
2781 mpq8064_i2c_devices[i].len);
2782 }
Jing Lin417fa452012-02-05 14:31:06 -08002783}
2784
Jay Chokshi994ff122012-03-27 15:43:48 -07002785static void enable_ddr3_regulator(void)
2786{
2787 static struct regulator *ext_ddr3;
2788
2789 /* Use MPP7 output state as a flag for PCDDR3 presence. */
2790 if (gpio_get_value_cansleep(PM8921_MPP_PM_TO_SYS(7)) > 0) {
2791 ext_ddr3 = regulator_get(NULL, "ext_ddr3");
2792 if (IS_ERR(ext_ddr3) || ext_ddr3 == NULL)
2793 pr_err("Could not get MPP7 regulator\n");
2794 else
2795 regulator_enable(ext_ddr3);
2796 }
2797}
2798
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002799static void enable_avc_i2c_bus(void)
2800{
2801 int avc_i2c_en_mpp = PM8921_MPP_PM_TO_SYS(8);
2802 int rc;
2803
2804 rc = gpio_request(avc_i2c_en_mpp, "avc_i2c_en");
2805 if (rc)
2806 pr_err("request for avc_i2c_en mpp failed,"
2807 "rc=%d\n", rc);
2808 else
2809 gpio_set_value_cansleep(avc_i2c_en_mpp, 1);
2810}
2811
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002812static void __init apq8064_common_init(void)
2813{
Joel King8f839b92012-04-01 14:37:46 -07002814 msm_tsens_early_init(&apq_tsens_pdata);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002815 if (socinfo_init() < 0)
2816 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06002817 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
2818 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
David Collins2782b5c2012-02-06 10:02:42 -08002819 regulator_suppress_info_printing();
2820 platform_device_register(&apq8064_device_rpm_regulator);
Stephen Boyd4d0d2582012-02-10 14:49:40 -08002821 if (msm_xo_init())
2822 pr_err("Failed to initialize XO votes\n");
Matt Wagantallc51e5602012-02-27 17:25:25 -08002823 msm_clock_init(&apq8064_clock_init_data);
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08002824 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06002825 apq8064_i2c_init();
Jing Lin417fa452012-02-05 14:31:06 -08002826 register_i2c_devices();
Kenneth Heitke36920d32011-07-20 16:44:30 -06002827
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002828 apq8064_device_qup_spi_gsbi5.dev.platform_data =
2829 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08002830 apq8064_init_pmic();
Hemant Kumar94e7da22012-02-03 16:52:29 -08002831 if (machine_is_apq8064_liquid())
2832 msm_otg_pdata.mhl_enable = true;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07002833
Ofir Cohen94213a72012-05-03 14:26:32 +03002834 android_usb_pdata.swfi_latency =
2835 msm_rpmrs_levels[0].latency_us;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07002836
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002837 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Manu Gautam91223e02011-11-08 15:27:22 +05302838 apq8064_ehci_host_init();
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002839 apq8064_init_buses();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002840 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Terence Hampson36b70722012-05-10 13:18:16 -04002841 if (!(machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
2842 machine_is_mpq8064_dtv()))
2843 platform_add_devices(common_not_mpq_devices,
2844 ARRAY_SIZE(common_not_mpq_devices));
Jay Chokshi994ff122012-03-27 15:43:48 -07002845 enable_ddr3_regulator();
Hemant Kumarf1ca9192012-02-07 18:59:33 -08002846 if (machine_is_apq8064_mtp()) {
2847 apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
2848 device_initialize(&apq8064_device_hsic_host.dev);
2849 }
Jay Chokshie8741282012-01-25 15:22:55 -08002850 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05302851 apq8064_init_mmc();
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08002852
2853 if (machine_is_apq8064_mtp()) {
2854 mdm_8064_device.dev.platform_data = &mdm_platform_data;
2855 platform_device_register(&mdm_8064_device);
2856 }
2857 platform_device_register(&apq8064_slim_ctrl);
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002858 slim_register_board_info(apq8064_slim_devices,
2859 ARRAY_SIZE(apq8064_slim_devices));
Jin Hongd3024e62012-02-09 16:13:32 -08002860 apq8064_init_dsps();
Praveen Chidambaram78499012011-11-01 17:15:17 -06002861 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Mahesh Sivasubramaniancbce1ec2012-01-24 10:32:44 -07002862 acpuclk_init(&acpuclk_8064_soc_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002863 msm_spm_l2_init(msm_spm_l2_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002864 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Praveen Chidambaram4d19be42012-04-03 18:05:52 -06002865 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002866 apq8064_epm_adc_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002867}
2868
Huaibin Yang4a084e32011-12-15 15:25:52 -08002869static void __init apq8064_allocate_memory_regions(void)
2870{
2871 apq8064_allocate_fb_region();
2872}
2873
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002874static void __init apq8064_sim_init(void)
2875{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002876 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
2877 &msm8064_device_watchdog.dev.platform_data;
2878
2879 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002880 apq8064_common_init();
Joel King4e7ad222011-08-17 15:47:38 -07002881 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
2882}
2883
2884static void __init apq8064_rumi3_init(void)
2885{
2886 apq8064_common_init();
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002887 ethernet_init();
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002888 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002889 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002890}
2891
Joel King82b7e3f2012-01-05 10:03:27 -08002892static void __init apq8064_cdp_init(void)
2893{
Hanumant Singh50440d42012-04-23 19:27:16 -07002894 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2895 pr_err("meminfo_init() failed!\n");
Joel King82b7e3f2012-01-05 10:03:27 -08002896 apq8064_common_init();
Joel King8f839b92012-04-01 14:37:46 -07002897 if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
2898 machine_is_mpq8064_dtv()) {
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002899 enable_avc_i2c_bus();
Joel King8f839b92012-04-01 14:37:46 -07002900 platform_add_devices(mpq_devices, ARRAY_SIZE(mpq_devices));
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002901 mpq8064_pcie_init();
Joel King8f839b92012-04-01 14:37:46 -07002902 } else {
2903 ethernet_init();
2904 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
2905 spi_register_board_info(spi_board_info,
2906 ARRAY_SIZE(spi_board_info));
2907 }
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002908 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07002909 apq8064_init_gpu();
Matt Wagantall1f65d9d2012-04-25 14:24:20 -07002910 platform_add_devices(apq8064_footswitch, apq8064_num_footswitch);
Kevin Chand07220e2012-02-13 15:52:22 -08002911 apq8064_init_cam();
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302912
2913 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
2914 platform_device_register(&cdp_kp_pdev);
2915
2916 if (machine_is_apq8064_mtp())
2917 platform_device_register(&mtp_kp_pdev);
Hanumant Singh50440d42012-04-23 19:27:16 -07002918
2919 change_memory_power = &apq8064_change_memory_power;
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05302920
2921 if (machine_is_mpq8064_cdp()) {
2922 platform_device_register(&mpq_gpio_keys_pdev);
2923 platform_device_register(&mpq_keypad_device);
2924 }
Joel King82b7e3f2012-01-05 10:03:27 -08002925}
2926
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002927MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
2928 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002929 .reserve = apq8064_reserve,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002930 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302931 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002932 .timer = &msm_timer,
2933 .init_machine = apq8064_sim_init,
2934MACHINE_END
2935
Joel King4e7ad222011-08-17 15:47:38 -07002936MACHINE_START(APQ8064_RUMI3, "QCT APQ8064 RUMI3")
2937 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002938 .reserve = apq8064_reserve,
Joel King4e7ad222011-08-17 15:47:38 -07002939 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302940 .handle_irq = gic_handle_irq,
Joel King4e7ad222011-08-17 15:47:38 -07002941 .timer = &msm_timer,
2942 .init_machine = apq8064_rumi3_init,
Huaibin Yang4a084e32011-12-15 15:25:52 -08002943 .init_early = apq8064_allocate_memory_regions,
Joel King4e7ad222011-08-17 15:47:38 -07002944MACHINE_END
2945
Joel King82b7e3f2012-01-05 10:03:27 -08002946MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
2947 .map_io = apq8064_map_io,
2948 .reserve = apq8064_reserve,
2949 .init_irq = apq8064_init_irq,
2950 .handle_irq = gic_handle_irq,
2951 .timer = &msm_timer,
2952 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002953 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07002954 .init_very_early = apq8064_early_reserve,
Joel King82b7e3f2012-01-05 10:03:27 -08002955MACHINE_END
2956
2957MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
2958 .map_io = apq8064_map_io,
2959 .reserve = apq8064_reserve,
2960 .init_irq = apq8064_init_irq,
2961 .handle_irq = gic_handle_irq,
2962 .timer = &msm_timer,
2963 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002964 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07002965 .init_very_early = apq8064_early_reserve,
Joel King82b7e3f2012-01-05 10:03:27 -08002966MACHINE_END
2967
2968MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
2969 .map_io = apq8064_map_io,
2970 .reserve = apq8064_reserve,
2971 .init_irq = apq8064_init_irq,
2972 .handle_irq = gic_handle_irq,
2973 .timer = &msm_timer,
2974 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002975 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07002976 .init_very_early = apq8064_early_reserve,
Joel King82b7e3f2012-01-05 10:03:27 -08002977MACHINE_END
2978
Joel King064bbf82012-04-01 13:23:39 -07002979MACHINE_START(MPQ8064_CDP, "QCT MPQ8064 CDP")
2980 .map_io = apq8064_map_io,
2981 .reserve = apq8064_reserve,
2982 .init_irq = apq8064_init_irq,
2983 .handle_irq = gic_handle_irq,
2984 .timer = &msm_timer,
2985 .init_machine = apq8064_cdp_init,
2986 .init_early = apq8064_allocate_memory_regions,
2987 .init_very_early = apq8064_early_reserve,
2988MACHINE_END
2989
Joel King11ca8202012-02-13 16:19:03 -08002990MACHINE_START(MPQ8064_HRD, "QCT MPQ8064 HRD")
2991 .map_io = apq8064_map_io,
2992 .reserve = apq8064_reserve,
2993 .init_irq = apq8064_init_irq,
2994 .handle_irq = gic_handle_irq,
2995 .timer = &msm_timer,
2996 .init_machine = apq8064_cdp_init,
Laura Abbott6988cef2012-03-15 14:27:13 -07002997 .init_very_early = apq8064_early_reserve,
Joel King11ca8202012-02-13 16:19:03 -08002998MACHINE_END
2999
3000MACHINE_START(MPQ8064_DTV, "QCT MPQ8064 DTV")
3001 .map_io = apq8064_map_io,
3002 .reserve = apq8064_reserve,
3003 .init_irq = apq8064_init_irq,
3004 .handle_irq = gic_handle_irq,
3005 .timer = &msm_timer,
3006 .init_machine = apq8064_cdp_init,
Laura Abbott6988cef2012-03-15 14:27:13 -07003007 .init_very_early = apq8064_early_reserve,
Joel King11ca8202012-02-13 16:19:03 -08003008MACHINE_END
3009