blob: 6a3b29c146be04d11c0f029d75f117bdd7e9167d [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
Hanumant Singheadb7502012-05-15 18:14:04 -070094#define HOLE_SIZE 0x20000
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -070095#define MSM_PMEM_KERNEL_EBI1_SIZE 0x65000
Olav Haugan129992c2012-03-22 09:54:01 -070096#ifdef CONFIG_MSM_IOMMU
97#define MSM_ION_MM_SIZE 0x3800000
98#define MSM_ION_SF_SIZE 0
Olav Haugan39477bb2012-05-14 16:05:36 -070099#define MSM_ION_QSECOM_SIZE 0x780000 /* (7.5MB) */
Olav Haugan129992c2012-03-22 09:54:01 -0700100#define MSM_ION_HEAP_NUM 7
101#else
Olav Haugan7c6aa742012-01-16 16:47:37 -0800102#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Haugan129992c2012-03-22 09:54:01 -0700103#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Haugan39477bb2012-05-14 16:05:36 -0700104#define MSM_ION_QSECOM_SIZE 0x600000 /* (6MB) */
Olav Haugan129992c2012-03-22 09:54:01 -0700105#define MSM_ION_HEAP_NUM 8
106#endif
Hanumant Singheadb7502012-05-15 18:14:04 -0700107#define MSM_ION_MM_FW_SIZE (0x200000 - HOLE_SIZE) /* (2MB - 128KB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800108#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan2c43fac2012-01-19 11:06:37 -0800109#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Olav Haugan7c6aa742012-01-16 16:47:37 -0800110#else
111#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
112#define MSM_ION_HEAP_NUM 1
113#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700114
Hanumant Singheadb7502012-05-15 18:14:04 -0700115#define APQ8064_FIXED_AREA_START (0xa0000000 - (MSM_ION_MM_FW_SIZE + \
116 HOLE_SIZE))
Larry Bassel67b921d2012-04-06 10:23:27 -0700117#define MAX_FIXED_AREA_SIZE 0x10000000
Hanumant Singheadb7502012-05-15 18:14:04 -0700118#define MSM_MM_FW_SIZE (0x200000 - HOLE_SIZE)
119#define APQ8064_FW_START APQ8064_FIXED_AREA_START
Larry Bassel67b921d2012-04-06 10:23:27 -0700120
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -0600121/* PCIe power enable pmic gpio */
122#define PCIE_PWR_EN_PMIC_GPIO 13
123#define PCIE_RST_N_PMIC_MPP 1
124
Olav Haugan7c6aa742012-01-16 16:47:37 -0800125#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
126static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
127static int __init pmem_kernel_ebi1_size_setup(char *p)
Kevin Chan13be4e22011-10-20 11:30:32 -0700128{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800129 pmem_kernel_ebi1_size = memparse(p, NULL);
130 return 0;
Kevin Chan13be4e22011-10-20 11:30:32 -0700131}
Olav Haugan7c6aa742012-01-16 16:47:37 -0800132early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
133#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700134
Olav Haugan7c6aa742012-01-16 16:47:37 -0800135#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -0700136static unsigned pmem_size = MSM_PMEM_SIZE;
137static int __init pmem_size_setup(char *p)
138{
139 pmem_size = memparse(p, NULL);
140 return 0;
141}
142early_param("pmem_size", pmem_size_setup);
143
144static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
145
146static int __init pmem_adsp_size_setup(char *p)
147{
148 pmem_adsp_size = memparse(p, NULL);
149 return 0;
150}
151early_param("pmem_adsp_size", pmem_adsp_size_setup);
152
153static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
154
155static int __init pmem_audio_size_setup(char *p)
156{
157 pmem_audio_size = memparse(p, NULL);
158 return 0;
159}
160early_param("pmem_audio_size", pmem_audio_size_setup);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800161#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700162
Olav Haugan7c6aa742012-01-16 16:47:37 -0800163#ifdef CONFIG_ANDROID_PMEM
164#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700165static struct android_pmem_platform_data android_pmem_pdata = {
166 .name = "pmem",
167 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
168 .cached = 1,
169 .memory_type = MEMTYPE_EBI1,
170};
171
Laura Abbottb93525f2012-04-12 09:57:19 -0700172static struct platform_device apq8064_android_pmem_device = {
Kevin Chan13be4e22011-10-20 11:30:32 -0700173 .name = "android_pmem",
174 .id = 0,
175 .dev = {.platform_data = &android_pmem_pdata},
176};
177
178static struct android_pmem_platform_data android_pmem_adsp_pdata = {
179 .name = "pmem_adsp",
180 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
181 .cached = 0,
182 .memory_type = MEMTYPE_EBI1,
183};
Laura Abbottb93525f2012-04-12 09:57:19 -0700184static struct platform_device apq8064_android_pmem_adsp_device = {
Kevin Chan13be4e22011-10-20 11:30:32 -0700185 .name = "android_pmem",
186 .id = 2,
187 .dev = { .platform_data = &android_pmem_adsp_pdata },
188};
189
190static struct android_pmem_platform_data android_pmem_audio_pdata = {
191 .name = "pmem_audio",
192 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
193 .cached = 0,
194 .memory_type = MEMTYPE_EBI1,
195};
196
Laura Abbottb93525f2012-04-12 09:57:19 -0700197static struct platform_device apq8064_android_pmem_audio_device = {
Kevin Chan13be4e22011-10-20 11:30:32 -0700198 .name = "android_pmem",
199 .id = 4,
200 .dev = { .platform_data = &android_pmem_audio_pdata },
201};
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700202#endif /* CONFIG_MSM_MULTIMEDIA_USE_ION */
203#endif /* CONFIG_ANDROID_PMEM */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800204
Larry Bassel67b921d2012-04-06 10:23:27 -0700205struct fmem_platform_data apq8064_fmem_pdata = {
206};
207
Olav Haugan7c6aa742012-01-16 16:47:37 -0800208static struct memtype_reserve apq8064_reserve_table[] __initdata = {
209 [MEMTYPE_SMI] = {
210 },
211 [MEMTYPE_EBI0] = {
212 .flags = MEMTYPE_FLAGS_1M_ALIGN,
213 },
214 [MEMTYPE_EBI1] = {
215 .flags = MEMTYPE_FLAGS_1M_ALIGN,
216 },
217};
Kevin Chan13be4e22011-10-20 11:30:32 -0700218
Laura Abbott350c8362012-02-28 14:46:52 -0800219static void __init reserve_rtb_memory(void)
220{
221#if defined(CONFIG_MSM_RTB)
Laura Abbottb93525f2012-04-12 09:57:19 -0700222 apq8064_reserve_table[MEMTYPE_EBI1].size += apq8064_rtb_pdata.size;
Laura Abbott350c8362012-02-28 14:46:52 -0800223#endif
224}
225
226
Kevin Chan13be4e22011-10-20 11:30:32 -0700227static void __init size_pmem_devices(void)
228{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800229#ifdef CONFIG_ANDROID_PMEM
230#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700231 android_pmem_adsp_pdata.size = pmem_adsp_size;
232 android_pmem_pdata.size = pmem_size;
233 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700234#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
235#endif /*CONFIG_ANDROID_PMEM*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700236}
237
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700238#ifdef CONFIG_ANDROID_PMEM
239#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700240static void __init reserve_memory_for(struct android_pmem_platform_data *p)
241{
242 apq8064_reserve_table[p->memory_type].size += p->size;
243}
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700244#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
245#endif /*CONFIG_ANDROID_PMEM*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700246
Kevin Chan13be4e22011-10-20 11:30:32 -0700247static void __init reserve_pmem_memory(void)
248{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800249#ifdef CONFIG_ANDROID_PMEM
250#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700251 reserve_memory_for(&android_pmem_adsp_pdata);
252 reserve_memory_for(&android_pmem_pdata);
253 reserve_memory_for(&android_pmem_audio_pdata);
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700254#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700255 apq8064_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700256#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -0800257}
258
259static int apq8064_paddr_to_memtype(unsigned int paddr)
260{
261 return MEMTYPE_EBI1;
262}
263
Larry Bassel67b921d2012-04-06 10:23:27 -0700264#define FMEM_ENABLED 1
265
Olav Haugan7c6aa742012-01-16 16:47:37 -0800266#ifdef CONFIG_ION_MSM
267#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -0700268static struct ion_cp_heap_pdata cp_mm_apq8064_ion_pdata = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800269 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugand3d29682012-01-19 10:57:07 -0800270 .align = PAGE_SIZE,
Larry Bassel67b921d2012-04-06 10:23:27 -0700271 .reusable = FMEM_ENABLED,
272 .mem_is_fmem = FMEM_ENABLED,
273 .fixed_position = FIXED_MIDDLE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800274};
275
Laura Abbottb93525f2012-04-12 09:57:19 -0700276static struct ion_cp_heap_pdata cp_mfc_apq8064_ion_pdata = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800277 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugand3d29682012-01-19 10:57:07 -0800278 .align = PAGE_SIZE,
Larry Bassel67b921d2012-04-06 10:23:27 -0700279 .reusable = 0,
280 .mem_is_fmem = FMEM_ENABLED,
281 .fixed_position = FIXED_HIGH,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800282};
283
Laura Abbottb93525f2012-04-12 09:57:19 -0700284static struct ion_co_heap_pdata co_apq8064_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800285 .adjacent_mem_id = INVALID_HEAP_ID,
286 .align = PAGE_SIZE,
Larry Bassel67b921d2012-04-06 10:23:27 -0700287 .mem_is_fmem = 0,
Olav Haugand3d29682012-01-19 10:57:07 -0800288};
289
Laura Abbottb93525f2012-04-12 09:57:19 -0700290static struct ion_co_heap_pdata fw_co_apq8064_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800291 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
292 .align = SZ_128K,
Larry Bassel67b921d2012-04-06 10:23:27 -0700293 .mem_is_fmem = FMEM_ENABLED,
294 .fixed_position = FIXED_LOW,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800295};
296#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800297
298/**
299 * These heaps are listed in the order they will be allocated. Due to
300 * video hardware restrictions and content protection the FW heap has to
301 * be allocated adjacent (below) the MM heap and the MFC heap has to be
302 * allocated after the MM heap to ensure MFC heap is not more than 256MB
303 * away from the base address of the FW heap.
304 * However, the order of FW heap and MM heap doesn't matter since these
305 * two heaps are taken care of by separate code to ensure they are adjacent
306 * to each other.
307 * Don't swap the order unless you know what you are doing!
308 */
Laura Abbottb93525f2012-04-12 09:57:19 -0700309static struct ion_platform_data apq8064_ion_pdata = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800310 .nr = MSM_ION_HEAP_NUM,
311 .heaps = {
312 {
313 .id = ION_SYSTEM_HEAP_ID,
314 .type = ION_HEAP_TYPE_SYSTEM,
315 .name = ION_VMALLOC_HEAP_NAME,
316 },
317#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
318 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800319 .id = ION_CP_MM_HEAP_ID,
320 .type = ION_HEAP_TYPE_CP,
321 .name = ION_MM_HEAP_NAME,
322 .size = MSM_ION_MM_SIZE,
323 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700324 .extra_data = (void *) &cp_mm_apq8064_ion_pdata,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800325 },
326 {
Olav Haugand3d29682012-01-19 10:57:07 -0800327 .id = ION_MM_FIRMWARE_HEAP_ID,
328 .type = ION_HEAP_TYPE_CARVEOUT,
329 .name = ION_MM_FIRMWARE_HEAP_NAME,
330 .size = MSM_ION_MM_FW_SIZE,
331 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700332 .extra_data = (void *) &fw_co_apq8064_ion_pdata,
Olav Haugand3d29682012-01-19 10:57:07 -0800333 },
334 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800335 .id = ION_CP_MFC_HEAP_ID,
336 .type = ION_HEAP_TYPE_CP,
337 .name = ION_MFC_HEAP_NAME,
338 .size = MSM_ION_MFC_SIZE,
339 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700340 .extra_data = (void *) &cp_mfc_apq8064_ion_pdata,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800341 },
Olav Haugan129992c2012-03-22 09:54:01 -0700342#ifndef CONFIG_MSM_IOMMU
Olav Haugan7c6aa742012-01-16 16:47:37 -0800343 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800344 .id = ION_SF_HEAP_ID,
345 .type = ION_HEAP_TYPE_CARVEOUT,
346 .name = ION_SF_HEAP_NAME,
347 .size = MSM_ION_SF_SIZE,
348 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700349 .extra_data = (void *) &co_apq8064_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800350 },
Olav Haugan129992c2012-03-22 09:54:01 -0700351#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800352 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800353 .id = ION_IOMMU_HEAP_ID,
354 .type = ION_HEAP_TYPE_IOMMU,
355 .name = ION_IOMMU_HEAP_NAME,
356 },
Olav Hauganf45e2142012-01-19 11:01:01 -0800357 {
358 .id = ION_QSECOM_HEAP_ID,
359 .type = ION_HEAP_TYPE_CARVEOUT,
360 .name = ION_QSECOM_HEAP_NAME,
361 .size = MSM_ION_QSECOM_SIZE,
362 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700363 .extra_data = (void *) &co_apq8064_ion_pdata,
Olav Hauganf45e2142012-01-19 11:01:01 -0800364 },
Olav Haugan2c43fac2012-01-19 11:06:37 -0800365 {
366 .id = ION_AUDIO_HEAP_ID,
367 .type = ION_HEAP_TYPE_CARVEOUT,
368 .name = ION_AUDIO_HEAP_NAME,
369 .size = MSM_ION_AUDIO_SIZE,
370 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700371 .extra_data = (void *) &co_apq8064_ion_pdata,
Olav Haugan2c43fac2012-01-19 11:06:37 -0800372 },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800373#endif
374 }
375};
376
Laura Abbottb93525f2012-04-12 09:57:19 -0700377static struct platform_device apq8064_ion_dev = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800378 .name = "ion-msm",
379 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700380 .dev = { .platform_data = &apq8064_ion_pdata },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800381};
382#endif
383
Larry Bassel67b921d2012-04-06 10:23:27 -0700384static struct platform_device apq8064_fmem_device = {
385 .name = "fmem",
386 .id = 1,
387 .dev = { .platform_data = &apq8064_fmem_pdata },
388};
389
390static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
391 unsigned long size)
392{
393 apq8064_reserve_table[mem_type].size += size;
394}
395
396static void __init apq8064_reserve_fixed_area(unsigned long fixed_area_size)
397{
398#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
399 int ret;
400
401 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
402 panic("fixed area size is larger than %dM\n",
403 MAX_FIXED_AREA_SIZE >> 20);
404
405 reserve_info->fixed_area_size = fixed_area_size;
406 reserve_info->fixed_area_start = APQ8064_FW_START;
407
408 ret = memblock_remove(reserve_info->fixed_area_start,
409 reserve_info->fixed_area_size);
410 BUG_ON(ret);
411#endif
412}
413
414/**
415 * Reserve memory for ION and calculate amount of reusable memory for fmem.
416 * We only reserve memory for heaps that are not reusable. However, we only
417 * support one reusable heap at the moment so we ignore the reusable flag for
418 * other than the first heap with reusable flag set. Also handle special case
419 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
420 * at a higher address than FW in addition to not more than 256MB away from the
421 * base address of the firmware. This means that if MM is reusable the other
422 * two heaps must be allocated in the same region as FW. This is handled by the
423 * mem_is_fmem flag in the platform data. In addition the MM heap must be
424 * adjacent to the FW heap for content protection purposes.
425 */
Stephen Boyd668d7652012-04-25 11:31:01 -0700426static void __init reserve_ion_memory(void)
Olav Haugan7c6aa742012-01-16 16:47:37 -0800427{
428#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Larry Bassel67b921d2012-04-06 10:23:27 -0700429 unsigned int i;
430 unsigned int reusable_count = 0;
431 unsigned int fixed_size = 0;
432 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
433 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
434
435 apq8064_fmem_pdata.size = 0;
436 apq8064_fmem_pdata.reserved_size_low = 0;
437 apq8064_fmem_pdata.reserved_size_high = 0;
Olav Haugan62436252012-05-16 09:09:43 -0700438 apq8064_fmem_pdata.align = PAGE_SIZE;
Larry Bassel67b921d2012-04-06 10:23:27 -0700439 fixed_low_size = 0;
440 fixed_middle_size = 0;
441 fixed_high_size = 0;
442
443 /* We only support 1 reusable heap. Check if more than one heap
444 * is specified as reusable and set as non-reusable if found.
445 */
446 for (i = 0; i < apq8064_ion_pdata.nr; ++i) {
447 const struct ion_platform_heap *heap =
448 &(apq8064_ion_pdata.heaps[i]);
449
450 if (heap->type == ION_HEAP_TYPE_CP && heap->extra_data) {
451 struct ion_cp_heap_pdata *data = heap->extra_data;
452
453 reusable_count += (data->reusable) ? 1 : 0;
454
455 if (data->reusable && reusable_count > 1) {
456 pr_err("%s: Too many heaps specified as "
457 "reusable. Heap %s was not configured "
458 "as reusable.\n", __func__, heap->name);
459 data->reusable = 0;
460 }
461 }
462 }
463
464 for (i = 0; i < apq8064_ion_pdata.nr; ++i) {
465 const struct ion_platform_heap *heap =
466 &(apq8064_ion_pdata.heaps[i]);
467
468 if (heap->extra_data) {
469 int fixed_position = NOT_FIXED;
470 int mem_is_fmem = 0;
471
472 switch (heap->type) {
473 case ION_HEAP_TYPE_CP:
474 mem_is_fmem = ((struct ion_cp_heap_pdata *)
475 heap->extra_data)->mem_is_fmem;
476 fixed_position = ((struct ion_cp_heap_pdata *)
477 heap->extra_data)->fixed_position;
478 break;
479 case ION_HEAP_TYPE_CARVEOUT:
480 mem_is_fmem = ((struct ion_co_heap_pdata *)
481 heap->extra_data)->mem_is_fmem;
482 fixed_position = ((struct ion_co_heap_pdata *)
483 heap->extra_data)->fixed_position;
484 break;
485 default:
486 break;
487 }
488
489 if (fixed_position != NOT_FIXED)
490 fixed_size += heap->size;
491 else
492 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
493
494 if (fixed_position == FIXED_LOW)
495 fixed_low_size += heap->size;
496 else if (fixed_position == FIXED_MIDDLE)
497 fixed_middle_size += heap->size;
498 else if (fixed_position == FIXED_HIGH)
499 fixed_high_size += heap->size;
500
501 if (mem_is_fmem)
502 apq8064_fmem_pdata.size += heap->size;
503 }
504 }
505
506 if (!fixed_size)
507 return;
508
509 if (apq8064_fmem_pdata.size) {
Hanumant Singheadb7502012-05-15 18:14:04 -0700510 apq8064_fmem_pdata.reserved_size_low = fixed_low_size +
511 HOLE_SIZE;
Larry Bassel67b921d2012-04-06 10:23:27 -0700512 apq8064_fmem_pdata.reserved_size_high = fixed_high_size;
513 }
514
515 /* Since the fixed area may be carved out of lowmem,
516 * make sure the length is a multiple of 1M.
517 */
Hanumant Singheadb7502012-05-15 18:14:04 -0700518 fixed_size = (fixed_size + HOLE_SIZE + SECTION_SIZE - 1)
Larry Bassel67b921d2012-04-06 10:23:27 -0700519 & SECTION_MASK;
520 apq8064_reserve_fixed_area(fixed_size);
521
522 fixed_low_start = APQ8064_FIXED_AREA_START;
Hanumant Singheadb7502012-05-15 18:14:04 -0700523 fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE;
Larry Bassel67b921d2012-04-06 10:23:27 -0700524 fixed_high_start = fixed_middle_start + fixed_middle_size;
525
526 for (i = 0; i < apq8064_ion_pdata.nr; ++i) {
527 struct ion_platform_heap *heap = &(apq8064_ion_pdata.heaps[i]);
528
529 if (heap->extra_data) {
530 int fixed_position = NOT_FIXED;
Hanumant Singheadb7502012-05-15 18:14:04 -0700531 struct ion_cp_heap_pdata *pdata;
Larry Bassel67b921d2012-04-06 10:23:27 -0700532
533 switch (heap->type) {
534 case ION_HEAP_TYPE_CP:
Hanumant Singheadb7502012-05-15 18:14:04 -0700535 pdata =
536 (struct ion_cp_heap_pdata *)heap->extra_data;
537 fixed_position = pdata->fixed_position;
Larry Bassel67b921d2012-04-06 10:23:27 -0700538 break;
539 case ION_HEAP_TYPE_CARVEOUT:
540 fixed_position = ((struct ion_co_heap_pdata *)
541 heap->extra_data)->fixed_position;
542 break;
543 default:
544 break;
545 }
546
547 switch (fixed_position) {
548 case FIXED_LOW:
549 heap->base = fixed_low_start;
550 break;
551 case FIXED_MIDDLE:
552 heap->base = fixed_middle_start;
Hanumant Singheadb7502012-05-15 18:14:04 -0700553 pdata->secure_base = fixed_middle_start
554 - HOLE_SIZE;
555 pdata->secure_size = HOLE_SIZE + heap->size;
Larry Bassel67b921d2012-04-06 10:23:27 -0700556 break;
557 case FIXED_HIGH:
558 heap->base = fixed_high_start;
559 break;
560 default:
561 break;
562 }
563 }
564 }
Olav Haugan7c6aa742012-01-16 16:47:37 -0800565#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700566}
567
Huaibin Yang4a084e32011-12-15 15:25:52 -0800568static void __init reserve_mdp_memory(void)
569{
570 apq8064_mdp_writeback(apq8064_reserve_table);
571}
572
Laura Abbott93a4a352012-05-25 09:26:35 -0700573static void __init reserve_cache_dump_memory(void)
574{
575#ifdef CONFIG_MSM_CACHE_DUMP
576 unsigned int total;
577
578 total = apq8064_cache_dump_pdata.l1_size +
579 apq8064_cache_dump_pdata.l2_size;
580 apq8064_reserve_table[MEMTYPE_EBI1].size += total;
581#endif
582}
583
Kevin Chan13be4e22011-10-20 11:30:32 -0700584static void __init apq8064_calculate_reserve_sizes(void)
585{
586 size_pmem_devices();
587 reserve_pmem_memory();
Olav Haugan7c6aa742012-01-16 16:47:37 -0800588 reserve_ion_memory();
Huaibin Yang4a084e32011-12-15 15:25:52 -0800589 reserve_mdp_memory();
Laura Abbott350c8362012-02-28 14:46:52 -0800590 reserve_rtb_memory();
Laura Abbott93a4a352012-05-25 09:26:35 -0700591 reserve_cache_dump_memory();
Kevin Chan13be4e22011-10-20 11:30:32 -0700592}
593
594static struct reserve_info apq8064_reserve_info __initdata = {
595 .memtype_reserve_table = apq8064_reserve_table,
596 .calculate_reserve_sizes = apq8064_calculate_reserve_sizes,
Larry Bassel67b921d2012-04-06 10:23:27 -0700597 .reserve_fixed_area = apq8064_reserve_fixed_area,
Kevin Chan13be4e22011-10-20 11:30:32 -0700598 .paddr_to_memtype = apq8064_paddr_to_memtype,
599};
600
601static int apq8064_memory_bank_size(void)
602{
603 return 1<<29;
604}
605
606static void __init locate_unstable_memory(void)
607{
608 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
609 unsigned long bank_size;
610 unsigned long low, high;
611
612 bank_size = apq8064_memory_bank_size();
613 low = meminfo.bank[0].start;
614 high = mb->start + mb->size;
Olav Haugand76e3a82012-01-16 16:55:07 -0800615
616 /* Check if 32 bit overflow occured */
617 if (high < mb->start)
Larry Bassel67b921d2012-04-06 10:23:27 -0700618 high = -PAGE_SIZE;
Olav Haugand76e3a82012-01-16 16:55:07 -0800619
Kevin Chan13be4e22011-10-20 11:30:32 -0700620 low &= ~(bank_size - 1);
621
622 if (high - low <= bank_size)
Larry Bassel67b921d2012-04-06 10:23:27 -0700623 goto no_dmm;
624
625#ifdef CONFIG_ENABLE_DMM
Jack Cheung46bfffa2012-01-19 15:26:24 -0800626 apq8064_reserve_info.low_unstable_address = mb->start -
627 MIN_MEMORY_BLOCK_SIZE + mb->size;
628 apq8064_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
629
Kevin Chan13be4e22011-10-20 11:30:32 -0700630 apq8064_reserve_info.bank_size = bank_size;
631 pr_info("low unstable address %lx max size %lx bank size %lx\n",
632 apq8064_reserve_info.low_unstable_address,
633 apq8064_reserve_info.max_unstable_size,
634 apq8064_reserve_info.bank_size);
Larry Bassel67b921d2012-04-06 10:23:27 -0700635 return;
636#endif
637no_dmm:
638 apq8064_reserve_info.low_unstable_address = high;
639 apq8064_reserve_info.max_unstable_size = 0;
Kevin Chan13be4e22011-10-20 11:30:32 -0700640}
641
Hanumant Singh50440d42012-04-23 19:27:16 -0700642static int apq8064_change_memory_power(u64 start, u64 size,
643 int change_type)
644{
645 return soc_change_memory_power(start, size, change_type);
646}
647
Aravind Venkateswaran8ac7f412012-03-16 17:57:30 -0700648static char prim_panel_name[PANEL_NAME_MAX_LEN];
649static char ext_panel_name[PANEL_NAME_MAX_LEN];
650static int __init prim_display_setup(char *param)
651{
652 if (strnlen(param, PANEL_NAME_MAX_LEN))
653 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
654 return 0;
655}
656early_param("prim_display", prim_display_setup);
657
658static int __init ext_display_setup(char *param)
659{
660 if (strnlen(param, PANEL_NAME_MAX_LEN))
661 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
662 return 0;
663}
664early_param("ext_display", ext_display_setup);
665
Kevin Chan13be4e22011-10-20 11:30:32 -0700666static void __init apq8064_reserve(void)
667{
Aravind Venkateswaran8ac7f412012-03-16 17:57:30 -0700668 apq8064_set_display_params(prim_panel_name, ext_panel_name);
Kevin Chan13be4e22011-10-20 11:30:32 -0700669 msm_reserve();
Larry Bassel67b921d2012-04-06 10:23:27 -0700670 if (apq8064_fmem_pdata.size) {
671#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
672 if (reserve_info->fixed_area_size) {
673 apq8064_fmem_pdata.phys =
674 reserve_info->fixed_area_start + MSM_MM_FW_SIZE;
675 pr_info("mm fw at %lx (fixed) size %x\n",
676 reserve_info->fixed_area_start, MSM_MM_FW_SIZE);
677 pr_info("fmem start %lx (fixed) size %lx\n",
678 apq8064_fmem_pdata.phys,
679 apq8064_fmem_pdata.size);
680 }
681#endif
682 }
Kevin Chan13be4e22011-10-20 11:30:32 -0700683}
684
Laura Abbott6988cef2012-03-15 14:27:13 -0700685static void __init place_movable_zone(void)
686{
Larry Bassel67b921d2012-04-06 10:23:27 -0700687#ifdef CONFIG_ENABLE_DMM
Laura Abbott6988cef2012-03-15 14:27:13 -0700688 movable_reserved_start = apq8064_reserve_info.low_unstable_address;
689 movable_reserved_size = apq8064_reserve_info.max_unstable_size;
690 pr_info("movable zone start %lx size %lx\n",
691 movable_reserved_start, movable_reserved_size);
Larry Bassel67b921d2012-04-06 10:23:27 -0700692#endif
Laura Abbott6988cef2012-03-15 14:27:13 -0700693}
694
695static void __init apq8064_early_reserve(void)
696{
697 reserve_info = &apq8064_reserve_info;
698 locate_unstable_memory();
699 place_movable_zone();
700
701}
Hemant Kumara945b472012-01-25 15:08:06 -0800702#ifdef CONFIG_USB_EHCI_MSM_HSIC
Hemant Kumare6275972012-02-29 20:06:21 -0800703/* Bandwidth requests (zero) if no vote placed */
704static struct msm_bus_vectors hsic_init_vectors[] = {
705 {
706 .src = MSM_BUS_MASTER_SPS,
707 .dst = MSM_BUS_SLAVE_EBI_CH0,
708 .ab = 0,
709 .ib = 0,
710 },
711 {
712 .src = MSM_BUS_MASTER_SPS,
713 .dst = MSM_BUS_SLAVE_SPS,
714 .ab = 0,
715 .ib = 0,
716 },
717};
718
719/* Bus bandwidth requests in Bytes/sec */
720static struct msm_bus_vectors hsic_max_vectors[] = {
721 {
722 .src = MSM_BUS_MASTER_SPS,
723 .dst = MSM_BUS_SLAVE_EBI_CH0,
724 .ab = 60000000, /* At least 480Mbps on bus. */
725 .ib = 960000000, /* MAX bursts rate */
726 },
727 {
728 .src = MSM_BUS_MASTER_SPS,
729 .dst = MSM_BUS_SLAVE_SPS,
730 .ab = 0,
731 .ib = 512000000, /*vote for 64Mhz dfab clk rate*/
732 },
733};
734
735static struct msm_bus_paths hsic_bus_scale_usecases[] = {
736 {
737 ARRAY_SIZE(hsic_init_vectors),
738 hsic_init_vectors,
739 },
740 {
741 ARRAY_SIZE(hsic_max_vectors),
742 hsic_max_vectors,
743 },
744};
745
746static struct msm_bus_scale_pdata hsic_bus_scale_pdata = {
747 hsic_bus_scale_usecases,
748 ARRAY_SIZE(hsic_bus_scale_usecases),
749 .name = "hsic",
750};
751
Hemant Kumara945b472012-01-25 15:08:06 -0800752static struct msm_hsic_host_platform_data msm_hsic_pdata = {
Hemant Kumare6275972012-02-29 20:06:21 -0800753 .strobe = 88,
754 .data = 89,
755 .bus_scale_table = &hsic_bus_scale_pdata,
Hemant Kumara945b472012-01-25 15:08:06 -0800756};
757#else
758static struct msm_hsic_host_platform_data msm_hsic_pdata;
759#endif
760
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800761#define PID_MAGIC_ID 0x71432909
762#define SERIAL_NUM_MAGIC_ID 0x61945374
763#define SERIAL_NUMBER_LENGTH 127
764#define DLOAD_USB_BASE_ADD 0x2A03F0C8
765
766struct magic_num_struct {
767 uint32_t pid;
768 uint32_t serial_num;
769};
770
771struct dload_struct {
772 uint32_t reserved1;
773 uint32_t reserved2;
774 uint32_t reserved3;
775 uint16_t reserved4;
776 uint16_t pid;
777 char serial_number[SERIAL_NUMBER_LENGTH];
778 uint16_t reserved5;
779 struct magic_num_struct magic_struct;
780};
781
782static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
783{
784 struct dload_struct __iomem *dload = 0;
785
786 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
787 if (!dload) {
788 pr_err("%s: cannot remap I/O memory region: %08x\n",
789 __func__, DLOAD_USB_BASE_ADD);
790 return -ENXIO;
791 }
792
793 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
794 __func__, dload, pid, snum);
795 /* update pid */
796 dload->magic_struct.pid = PID_MAGIC_ID;
797 dload->pid = pid;
798
799 /* update serial number */
800 dload->magic_struct.serial_num = 0;
801 if (!snum) {
802 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
803 goto out;
804 }
805
806 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
807 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
808out:
809 iounmap(dload);
810 return 0;
811}
812
813static struct android_usb_platform_data android_usb_pdata = {
814 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
815};
816
Hemant Kumar4933b072011-10-17 23:43:11 -0700817static struct platform_device android_usb_device = {
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800818 .name = "android_usb",
819 .id = -1,
820 .dev = {
821 .platform_data = &android_usb_pdata,
822 },
Hemant Kumar4933b072011-10-17 23:43:11 -0700823};
824
Hemant Kumar7620eed2012-02-26 09:08:43 -0800825/* Bandwidth requests (zero) if no vote placed */
826static struct msm_bus_vectors usb_init_vectors[] = {
827 {
828 .src = MSM_BUS_MASTER_SPS,
829 .dst = MSM_BUS_SLAVE_EBI_CH0,
830 .ab = 0,
831 .ib = 0,
832 },
833};
834
835/* Bus bandwidth requests in Bytes/sec */
836static struct msm_bus_vectors usb_max_vectors[] = {
837 {
838 .src = MSM_BUS_MASTER_SPS,
839 .dst = MSM_BUS_SLAVE_EBI_CH0,
840 .ab = 60000000, /* At least 480Mbps on bus. */
841 .ib = 960000000, /* MAX bursts rate */
842 },
843};
844
845static struct msm_bus_paths usb_bus_scale_usecases[] = {
846 {
847 ARRAY_SIZE(usb_init_vectors),
848 usb_init_vectors,
849 },
850 {
851 ARRAY_SIZE(usb_max_vectors),
852 usb_max_vectors,
853 },
854};
855
856static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
857 usb_bus_scale_usecases,
858 ARRAY_SIZE(usb_bus_scale_usecases),
859 .name = "usb",
860};
861
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700862static int phy_init_seq[] = {
863 0x38, 0x81, /* update DC voltage level */
864 0x24, 0x82, /* set pre-emphasis and rise/fall time */
865 -1
866};
867
Hemant Kumar4933b072011-10-17 23:43:11 -0700868static struct msm_otg_platform_data msm_otg_pdata = {
Hemant Kumard86c4882012-01-24 19:39:37 -0800869 .mode = USB_OTG,
870 .otg_control = OTG_PMIC_CONTROL,
Hemant Kumar4933b072011-10-17 23:43:11 -0700871 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Hemant Kumard86c4882012-01-24 19:39:37 -0800872 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
873 .power_budget = 750,
Hemant Kumar7620eed2012-02-26 09:08:43 -0800874 .bus_scale_table = &usb_bus_scale_pdata,
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700875 .phy_init_seq = phy_init_seq,
Hemant Kumar4933b072011-10-17 23:43:11 -0700876};
877
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800878static struct msm_usb_host_platform_data msm_ehci_host_pdata3 = {
Manu Gautam91223e02011-11-08 15:27:22 +0530879 .power_budget = 500,
880};
881
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800882#ifdef CONFIG_USB_EHCI_MSM_HOST4
883static struct msm_usb_host_platform_data msm_ehci_host_pdata4;
884#endif
885
Manu Gautam91223e02011-11-08 15:27:22 +0530886static void __init apq8064_ehci_host_init(void)
887{
Chiranjeevi Velempatib822fa32012-05-23 22:05:59 +0530888 if (machine_is_apq8064_liquid() || machine_is_mpq8064_cdp() ||
889 machine_is_mpq8064_hrd() || machine_is_mpq8064_dtv()) {
890 if (machine_is_apq8064_liquid())
891 msm_ehci_host_pdata3.dock_connect_irq =
892 PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9);
Hemant Kumar56925352012-02-13 16:59:52 -0800893
Manu Gautam91223e02011-11-08 15:27:22 +0530894 apq8064_device_ehci_host3.dev.platform_data =
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800895 &msm_ehci_host_pdata3;
Manu Gautam91223e02011-11-08 15:27:22 +0530896 platform_device_register(&apq8064_device_ehci_host3);
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800897
898#ifdef CONFIG_USB_EHCI_MSM_HOST4
899 apq8064_device_ehci_host4.dev.platform_data =
900 &msm_ehci_host_pdata4;
901 platform_device_register(&apq8064_device_ehci_host4);
902#endif
Manu Gautam91223e02011-11-08 15:27:22 +0530903 }
904}
905
David Keitel2f613d92012-02-15 11:29:16 -0800906static struct smb349_platform_data smb349_data __initdata = {
907 .en_n_gpio = PM8921_GPIO_PM_TO_SYS(37),
908 .chg_susp_gpio = PM8921_GPIO_PM_TO_SYS(30),
909 .chg_current_ma = 2200,
910};
911
912static struct i2c_board_info smb349_charger_i2c_info[] __initdata = {
913 {
914 I2C_BOARD_INFO(SMB349_NAME, 0x1B),
915 .platform_data = &smb349_data,
916 },
917};
918
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -0800919struct sx150x_platform_data apq8064_sx150x_data[] = {
920 [SX150X_EPM] = {
921 .gpio_base = GPIO_EPM_EXPANDER_BASE,
922 .oscio_is_gpo = false,
923 .io_pullup_ena = 0x0,
924 .io_pulldn_ena = 0x0,
925 .io_open_drain_ena = 0x0,
926 .io_polarity = 0,
927 .irq_summary = -1,
928 },
929};
930
931static struct epm_chan_properties ads_adc_channel_data[] = {
932 {10, 100}, {500, 50}, {1, 1}, {1, 1},
933 {20, 50}, {10, 100}, {1, 1}, {1, 1},
934 {10, 100}, {10, 100}, {100, 100}, {200, 100},
935 {100, 50}, {2000, 50}, {1000, 50}, {200, 50},
936 {200, 100}, {1, 1}, {20, 50}, {500, 50},
937 {50, 50}, {200, 100}, {500, 100}, {20, 50},
938 {200, 50}, {2000, 100}, {1000, 50}, {100, 50},
939 {200, 100}, {500, 50}, {1000, 100}, {200, 50},
940 {1000, 50}, {50, 50}, {100, 50}, {100, 50},
941 {1, 1}, {1, 1}, {20, 100}, {20, 50},
942 {500, 100}, {1000, 100}, {100, 50}, {1000, 50},
943 {100, 50}, {1000, 100}, {100, 50}, {100, 50},
944};
945
946static struct epm_adc_platform_data epm_adc_pdata = {
947 .channel = ads_adc_channel_data,
948 .bus_id = 0x0,
949 .epm_i2c_board_info = {
950 .type = "sx1509q",
951 .addr = 0x3e,
952 .platform_data = &apq8064_sx150x_data[SX150X_EPM],
953 },
954 .gpio_expander_base_addr = GPIO_EPM_EXPANDER_BASE,
955};
956
957static struct platform_device epm_adc_device = {
958 .name = "epm_adc",
959 .id = -1,
960 .dev = {
961 .platform_data = &epm_adc_pdata,
962 },
963};
964
965static void __init apq8064_epm_adc_init(void)
966{
967 epm_adc_pdata.num_channels = 32;
968 epm_adc_pdata.num_adc = 2;
969 epm_adc_pdata.chan_per_adc = 16;
970 epm_adc_pdata.chan_per_mux = 8;
971};
972
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800973/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
974 * 4 micbiases are used to power various analog and digital
975 * microphones operating at 1800 mV. Technically, all micbiases
976 * can source from single cfilter since all microphones operate
977 * at the same voltage level. The arrangement below is to make
978 * sure all cfilters are exercised. LDO_H regulator ouput level
979 * does not need to be as high as 2.85V. It is choosen for
980 * microphone sensitivity purpose.
981 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530982static struct wcd9xxx_pdata apq8064_tabla_platform_data = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800983 .slimbus_slave_device = {
984 .name = "tabla-slave",
985 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
986 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800987 .irq = MSM_GPIO_TO_INT(42),
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800988 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530989 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800990 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
991 .micbias = {
992 .ldoh_v = TABLA_LDOH_2P85_V,
993 .cfilt1_mv = 1800,
994 .cfilt2_mv = 1800,
995 .cfilt3_mv = 1800,
996 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
997 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
998 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
999 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301000 },
1001 .regulator = {
1002 {
1003 .name = "CDC_VDD_CP",
1004 .min_uV = 1800000,
1005 .max_uV = 1800000,
1006 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
1007 },
1008 {
1009 .name = "CDC_VDDA_RX",
1010 .min_uV = 1800000,
1011 .max_uV = 1800000,
1012 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
1013 },
1014 {
1015 .name = "CDC_VDDA_TX",
1016 .min_uV = 1800000,
1017 .max_uV = 1800000,
1018 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
1019 },
1020 {
1021 .name = "VDDIO_CDC",
1022 .min_uV = 1800000,
1023 .max_uV = 1800000,
1024 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1025 },
1026 {
1027 .name = "VDDD_CDC_D",
1028 .min_uV = 1225000,
1029 .max_uV = 1225000,
1030 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1031 },
1032 {
1033 .name = "CDC_VDDA_A_1P2V",
1034 .min_uV = 1225000,
1035 .max_uV = 1225000,
1036 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1037 },
1038 },
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001039};
1040
1041static struct slim_device apq8064_slim_tabla = {
1042 .name = "tabla-slim",
1043 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
1044 .dev = {
1045 .platform_data = &apq8064_tabla_platform_data,
1046 },
1047};
1048
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301049static struct wcd9xxx_pdata apq8064_tabla20_platform_data = {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001050 .slimbus_slave_device = {
1051 .name = "tabla-slave",
1052 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
1053 },
1054 .irq = MSM_GPIO_TO_INT(42),
1055 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301056 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001057 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
1058 .micbias = {
1059 .ldoh_v = TABLA_LDOH_2P85_V,
1060 .cfilt1_mv = 1800,
1061 .cfilt2_mv = 1800,
1062 .cfilt3_mv = 1800,
1063 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
1064 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
1065 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
1066 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301067 },
1068 .regulator = {
1069 {
1070 .name = "CDC_VDD_CP",
1071 .min_uV = 1800000,
1072 .max_uV = 1800000,
1073 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
1074 },
1075 {
1076 .name = "CDC_VDDA_RX",
1077 .min_uV = 1800000,
1078 .max_uV = 1800000,
1079 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
1080 },
1081 {
1082 .name = "CDC_VDDA_TX",
1083 .min_uV = 1800000,
1084 .max_uV = 1800000,
1085 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
1086 },
1087 {
1088 .name = "VDDIO_CDC",
1089 .min_uV = 1800000,
1090 .max_uV = 1800000,
1091 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1092 },
1093 {
1094 .name = "VDDD_CDC_D",
1095 .min_uV = 1225000,
1096 .max_uV = 1225000,
1097 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1098 },
1099 {
1100 .name = "CDC_VDDA_A_1P2V",
1101 .min_uV = 1225000,
1102 .max_uV = 1225000,
1103 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1104 },
1105 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001106};
1107
1108static struct slim_device apq8064_slim_tabla20 = {
1109 .name = "tabla2x-slim",
1110 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
1111 .dev = {
1112 .platform_data = &apq8064_tabla20_platform_data,
1113 },
1114};
1115
Santosh Mardi695be0d2012-04-10 23:21:12 +05301116/* enable the level shifter for cs8427 to make sure the I2C
1117 * clock is running at 100KHz and voltage levels are at 3.3
1118 * and 5 volts
1119 */
1120static int enable_100KHz_ls(int enable)
1121{
1122 int ret = 0;
1123 if (enable) {
1124 ret = gpio_request(SX150X_GPIO(1, 10),
1125 "cs8427_100KHZ_ENABLE");
1126 if (ret) {
1127 pr_err("%s: Failed to request gpio %d\n", __func__,
1128 SX150X_GPIO(1, 10));
1129 return ret;
1130 }
1131 gpio_direction_output(SX150X_GPIO(1, 10), 1);
1132 } else
1133 gpio_free(SX150X_GPIO(1, 10));
1134 return ret;
1135}
1136
Santosh Mardieff9a742012-04-09 23:23:39 +05301137static struct cs8427_platform_data cs8427_i2c_platform_data = {
1138 .irq = SX150X_GPIO(1, 4),
1139 .reset_gpio = SX150X_GPIO(1, 6),
Santosh Mardi695be0d2012-04-10 23:21:12 +05301140 .enable = enable_100KHz_ls,
Santosh Mardieff9a742012-04-09 23:23:39 +05301141};
1142
1143static struct i2c_board_info cs8427_device_info[] __initdata = {
1144 {
1145 I2C_BOARD_INFO("cs8427", CS8427_ADDR4),
1146 .platform_data = &cs8427_i2c_platform_data,
1147 },
1148};
1149
Amy Maloche70090f992012-02-16 16:35:26 -08001150#define HAP_SHIFT_LVL_OE_GPIO PM8921_MPP_PM_TO_SYS(8)
1151#define ISA1200_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1152#define ISA1200_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
1153#define ISA1200_HAP_CLK PM8921_GPIO_PM_TO_SYS(44)
1154
Mohan Pallaka2d877602012-05-11 13:07:30 +05301155static int isa1200_clk_enable(bool on)
Amy Maloche70090f992012-02-16 16:35:26 -08001156{
Amy Maloche8f973892012-03-26 14:53:13 -07001157 int rc = 0;
1158
Mohan Pallaka2d877602012-05-11 13:07:30 +05301159 gpio_set_value_cansleep(ISA1200_HAP_CLK, on);
Amy Maloche70090f992012-02-16 16:35:26 -08001160
Mohan Pallaka2d877602012-05-11 13:07:30 +05301161 if (on) {
Amy Maloche8f973892012-03-26 14:53:13 -07001162 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_1, true);
Mohan Pallaka2d877602012-05-11 13:07:30 +05301163 if (rc) {
1164 pr_err("%s: unable to write aux clock register(%d)\n",
1165 __func__, rc);
1166 goto err_gpio_dis;
1167 }
1168 } else {
Amy Maloche8f973892012-03-26 14:53:13 -07001169 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_NONE, true);
Mohan Pallaka2d877602012-05-11 13:07:30 +05301170 if (rc)
1171 pr_err("%s: unable to write aux clock register(%d)\n",
1172 __func__, rc);
Amy Maloche8f973892012-03-26 14:53:13 -07001173 }
1174
1175 return rc;
Mohan Pallaka2d877602012-05-11 13:07:30 +05301176
1177err_gpio_dis:
1178 gpio_set_value_cansleep(ISA1200_HAP_CLK, !on);
1179 return rc;
Amy Maloche70090f992012-02-16 16:35:26 -08001180}
1181
1182static int isa1200_dev_setup(bool enable)
1183{
1184 int rc = 0;
1185
Amy Maloche70090f992012-02-16 16:35:26 -08001186 if (!enable)
1187 goto free_gpio;
1188
1189 rc = gpio_request(ISA1200_HAP_CLK, "haptics_clk");
1190 if (rc) {
1191 pr_err("%s: unable to request gpio %d config(%d)\n",
1192 __func__, ISA1200_HAP_CLK, rc);
1193 return rc;
1194 }
1195
1196 rc = gpio_direction_output(ISA1200_HAP_CLK, 0);
1197 if (rc) {
1198 pr_err("%s: unable to set direction\n", __func__);
1199 goto free_gpio;
1200 }
1201
1202 return 0;
1203
1204free_gpio:
1205 gpio_free(ISA1200_HAP_CLK);
1206 return rc;
1207}
1208
1209static struct isa1200_regulator isa1200_reg_data[] = {
1210 {
1211 .name = "vddp",
1212 .min_uV = ISA_I2C_VTG_MIN_UV,
1213 .max_uV = ISA_I2C_VTG_MAX_UV,
1214 .load_uA = ISA_I2C_CURR_UA,
1215 },
1216};
1217
1218static struct isa1200_platform_data isa1200_1_pdata = {
1219 .name = "vibrator",
1220 .dev_setup = isa1200_dev_setup,
Mohan Pallaka2d877602012-05-11 13:07:30 +05301221 .clk_enable = isa1200_clk_enable,
Amy Maloche70090f992012-02-16 16:35:26 -08001222 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
1223 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
1224 .max_timeout = 15000,
1225 .mode_ctrl = PWM_GEN_MODE,
1226 .pwm_fd = {
1227 .pwm_div = 256,
1228 },
1229 .is_erm = false,
1230 .smart_en = true,
1231 .ext_clk_en = true,
1232 .chip_en = 1,
1233 .regulator_info = isa1200_reg_data,
1234 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1235};
1236
1237static struct i2c_board_info isa1200_board_info[] __initdata = {
1238 {
1239 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1240 .platform_data = &isa1200_1_pdata,
1241 },
1242};
Jing Lin21ed4de2012-02-05 15:53:28 -08001243/* configuration data for mxt1386e using V2.1 firmware */
1244static const u8 mxt1386e_config_data_v2_1[] = {
1245 /* T6 Object */
1246 0, 0, 0, 0, 0, 0,
1247 /* T38 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001248 14, 2, 0, 24, 5, 12, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001249 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1250 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1251 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1252 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1253 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1254 0, 0, 0, 0,
1255 /* T7 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001256 100, 10, 50,
Jing Lin21ed4de2012-02-05 15:53:28 -08001257 /* T8 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001258 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001259 /* T9 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001260 139, 0, 0, 26, 42, 0, 32, 80, 2, 5,
Jing Lin21ed4de2012-02-05 15:53:28 -08001261 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
Jing Linf1208fd2012-02-23 11:15:42 -08001262 85, 5, 0, 5, 9, 5, 12, 35, 70, 40,
1263 20, 5, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001264 /* T18 Object */
1265 0, 0,
1266 /* T24 Object */
1267 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1268 0, 0, 0, 0, 0, 0, 0, 0, 0,
1269 /* T25 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001270 1, 0, 60, 115, 156, 99,
Jing Lin21ed4de2012-02-05 15:53:28 -08001271 /* T27 Object */
1272 0, 0, 0, 0, 0, 0, 0,
1273 /* T40 Object */
1274 0, 0, 0, 0, 0,
1275 /* T42 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001276 0, 0, 255, 0, 255, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001277 /* T43 Object */
1278 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
1279 16,
1280 /* T46 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001281 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001282 /* T47 Object */
1283 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
1284 /* T48 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001285 1, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001286 32, 40, 0, 10, 10, 0, 0, 100, 10, 90,
1287 0, 0, 0, 0, 0, 0, 0, 10, 1, 10,
1288 52, 10, 12, 0, 33, 0, 1, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001289 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1290 0, 0, 0, 0,
1291 /* T56 Object */
1292 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1293 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1294 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1295 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001296 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1297 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001298};
1299
1300#define MXT_TS_GPIO_IRQ 6
1301#define MXT_TS_PWR_EN_GPIO PM8921_GPIO_PM_TO_SYS(23)
1302#define MXT_TS_RESET_GPIO 33
1303
1304static struct mxt_config_info mxt_config_array[] = {
1305 {
1306 .config = mxt1386e_config_data_v2_1,
1307 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1308 .family_id = 0xA0,
1309 .variant_id = 0x7,
1310 .version = 0x21,
1311 .build = 0xAA,
Jing Linef4aa9b2012-03-26 12:01:41 -07001312 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
1313 .fw_name = "atmel_8064_liquid_v2_2_AA.hex",
1314 },
1315 {
1316 /* The config data for V2.2.AA is the same as for V2.1.AA */
1317 .config = mxt1386e_config_data_v2_1,
1318 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1319 .family_id = 0xA0,
1320 .variant_id = 0x7,
1321 .version = 0x22,
1322 .build = 0xAA,
1323 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin21ed4de2012-02-05 15:53:28 -08001324 },
1325};
1326
1327static struct mxt_platform_data mxt_platform_data = {
1328 .config_array = mxt_config_array,
1329 .config_array_size = ARRAY_SIZE(mxt_config_array),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08001330 .panel_minx = 0,
1331 .panel_maxx = 1365,
1332 .panel_miny = 0,
1333 .panel_maxy = 767,
1334 .disp_minx = 0,
1335 .disp_maxx = 1365,
1336 .disp_miny = 0,
1337 .disp_maxy = 767,
Anirudh Ghayal39dbe3f2012-04-13 15:43:16 +05301338 .irqflags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
Jing Lin21ed4de2012-02-05 15:53:28 -08001339 .i2c_pull_up = true,
1340 .reset_gpio = MXT_TS_RESET_GPIO,
1341 .irq_gpio = MXT_TS_GPIO_IRQ,
1342};
1343
1344static struct i2c_board_info mxt_device_info[] __initdata = {
1345 {
1346 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
1347 .platform_data = &mxt_platform_data,
1348 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1349 },
1350};
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001351#define CYTTSP_TS_GPIO_IRQ 6
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001352#define CYTTSP_TS_GPIO_SLEEP 33
1353
1354static ssize_t tma340_vkeys_show(struct kobject *kobj,
1355 struct kobj_attribute *attr, char *buf)
1356{
1357 return snprintf(buf, 200,
1358 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1359 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1360 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1361 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1362 "\n");
1363}
1364
1365static struct kobj_attribute tma340_vkeys_attr = {
1366 .attr = {
1367 .mode = S_IRUGO,
1368 },
1369 .show = &tma340_vkeys_show,
1370};
1371
1372static struct attribute *tma340_properties_attrs[] = {
1373 &tma340_vkeys_attr.attr,
1374 NULL
1375};
1376
1377static struct attribute_group tma340_properties_attr_group = {
1378 .attrs = tma340_properties_attrs,
1379};
1380
1381static int cyttsp_platform_init(struct i2c_client *client)
1382{
1383 int rc = 0;
1384 static struct kobject *tma340_properties_kobj;
1385
1386 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1387 tma340_properties_kobj = kobject_create_and_add("board_properties",
1388 NULL);
1389 if (tma340_properties_kobj)
1390 rc = sysfs_create_group(tma340_properties_kobj,
1391 &tma340_properties_attr_group);
1392 if (!tma340_properties_kobj || rc)
1393 pr_err("%s: failed to create board_properties\n",
1394 __func__);
1395
1396 return 0;
1397}
1398
1399static struct cyttsp_regulator cyttsp_regulator_data[] = {
1400 {
1401 .name = "vdd",
1402 .min_uV = CY_TMA300_VTG_MIN_UV,
1403 .max_uV = CY_TMA300_VTG_MAX_UV,
1404 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1405 .lpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1406 },
1407 {
1408 .name = "vcc_i2c",
1409 .min_uV = CY_I2C_VTG_MIN_UV,
1410 .max_uV = CY_I2C_VTG_MAX_UV,
1411 .hpm_load_uA = CY_I2C_CURR_UA,
1412 .lpm_load_uA = CY_I2C_CURR_UA,
1413 },
1414};
1415
1416static struct cyttsp_platform_data cyttsp_pdata = {
1417 .panel_maxx = 634,
1418 .panel_maxy = 1166,
1419 .disp_maxx = 599,
1420 .disp_maxy = 1023,
1421 .disp_minx = 0,
1422 .disp_miny = 0,
1423 .flags = 0x01,
1424 .gen = CY_GEN3,
1425 .use_st = CY_USE_ST,
1426 .use_mt = CY_USE_MT,
1427 .use_hndshk = CY_SEND_HNDSHK,
1428 .use_trk_id = CY_USE_TRACKING_ID,
1429 .use_sleep = CY_USE_DEEP_SLEEP_SEL,
1430 .use_gestures = CY_USE_GESTURES,
1431 .fw_fname = "cyttsp_8064_mtp.hex",
1432 /* change act_intrvl to customize the Active power state
1433 * scanning/processing refresh interval for Operating mode
1434 */
1435 .act_intrvl = CY_ACT_INTRVL_DFLT,
1436 /* change tch_tmout to customize the touch timeout for the
1437 * Active power state for Operating mode
1438 */
1439 .tch_tmout = CY_TCH_TMOUT_DFLT,
1440 /* change lp_intrvl to customize the Low Power power state
1441 * scanning/processing refresh interval for Operating mode
1442 */
1443 .lp_intrvl = CY_LP_INTRVL_DFLT,
1444 .sleep_gpio = CYTTSP_TS_GPIO_SLEEP,
Amy Maloche9ba3ffe2012-04-26 10:31:20 -07001445 .resout_gpio = -1,
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001446 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1447 .regulator_info = cyttsp_regulator_data,
1448 .num_regulators = ARRAY_SIZE(cyttsp_regulator_data),
1449 .init = cyttsp_platform_init,
1450 .correct_fw_ver = 17,
1451};
1452
1453static struct i2c_board_info cyttsp_info[] __initdata = {
1454 {
1455 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1456 .platform_data = &cyttsp_pdata,
1457 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1458 },
1459};
Jing Lin21ed4de2012-02-05 15:53:28 -08001460
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001461#define MSM_WCNSS_PHYS 0x03000000
1462#define MSM_WCNSS_SIZE 0x280000
1463
1464static struct resource resources_wcnss_wlan[] = {
1465 {
1466 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1467 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1468 .name = "wcnss_wlanrx_irq",
1469 .flags = IORESOURCE_IRQ,
1470 },
1471 {
1472 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1473 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1474 .name = "wcnss_wlantx_irq",
1475 .flags = IORESOURCE_IRQ,
1476 },
1477 {
1478 .start = MSM_WCNSS_PHYS,
1479 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1480 .name = "wcnss_mmio",
1481 .flags = IORESOURCE_MEM,
1482 },
1483 {
1484 .start = 64,
1485 .end = 68,
1486 .name = "wcnss_gpios_5wire",
1487 .flags = IORESOURCE_IO,
1488 },
1489};
1490
1491static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1492 .has_48mhz_xo = 1,
1493};
1494
1495static struct platform_device msm_device_wcnss_wlan = {
1496 .name = "wcnss_wlan",
1497 .id = 0,
1498 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1499 .resource = resources_wcnss_wlan,
1500 .dev = {.platform_data = &qcom_wcnss_pdata},
1501};
1502
Ankit Vermab7c26e62012-02-28 15:04:15 -08001503static struct platform_device msm_device_iris_fm __devinitdata = {
1504 .name = "iris_fm",
1505 .id = -1,
1506};
1507
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001508#ifdef CONFIG_QSEECOM
1509/* qseecom bus scaling */
1510static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
1511 {
1512 .src = MSM_BUS_MASTER_SPS,
1513 .dst = MSM_BUS_SLAVE_EBI_CH0,
1514 .ib = 0,
1515 .ab = 0,
1516 },
1517 {
1518 .src = MSM_BUS_MASTER_SPDM,
1519 .dst = MSM_BUS_SLAVE_SPDM,
1520 .ib = 0,
1521 .ab = 0,
1522 },
1523};
1524
1525static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
1526 {
1527 .src = MSM_BUS_MASTER_SPS,
1528 .dst = MSM_BUS_SLAVE_EBI_CH0,
1529 .ib = (492 * 8) * 1000000UL,
1530 .ab = (492 * 8) * 100000UL,
1531 },
1532 {
1533 .src = MSM_BUS_MASTER_SPDM,
1534 .dst = MSM_BUS_SLAVE_SPDM,
1535 .ib = 0,
1536 .ab = 0,
1537 },
1538};
1539
1540static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1541 {
1542 .src = MSM_BUS_MASTER_SPS,
1543 .dst = MSM_BUS_SLAVE_EBI_CH0,
1544 .ib = 0,
1545 .ab = 0,
1546 },
1547 {
1548 .src = MSM_BUS_MASTER_SPDM,
1549 .dst = MSM_BUS_SLAVE_SPDM,
1550 .ib = (64 * 8) * 1000000UL,
1551 .ab = (64 * 8) * 100000UL,
1552 },
1553};
1554
1555static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1556 {
1557 ARRAY_SIZE(qseecom_clks_init_vectors),
1558 qseecom_clks_init_vectors,
1559 },
1560 {
1561 ARRAY_SIZE(qseecom_enable_dfab_vectors),
1562 qseecom_enable_sfpb_vectors,
1563 },
1564 {
1565 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1566 qseecom_enable_sfpb_vectors,
1567 },
1568};
1569
1570static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1571 qseecom_hw_bus_scale_usecases,
1572 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1573 .name = "qsee",
1574};
1575
1576static struct platform_device qseecom_device = {
1577 .name = "qseecom",
1578 .id = 0,
1579 .dev = {
1580 .platform_data = &qseecom_bus_pdata,
1581 },
1582};
1583#endif
1584
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001585#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1586 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1587 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1588 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1589
1590#define QCE_SIZE 0x10000
1591#define QCE_0_BASE 0x11000000
1592
1593#define QCE_HW_KEY_SUPPORT 0
1594#define QCE_SHA_HMAC_SUPPORT 1
1595#define QCE_SHARE_CE_RESOURCE 3
1596#define QCE_CE_SHARED 0
1597
1598static struct resource qcrypto_resources[] = {
1599 [0] = {
1600 .start = QCE_0_BASE,
1601 .end = QCE_0_BASE + QCE_SIZE - 1,
1602 .flags = IORESOURCE_MEM,
1603 },
1604 [1] = {
1605 .name = "crypto_channels",
1606 .start = DMOV8064_CE_IN_CHAN,
1607 .end = DMOV8064_CE_OUT_CHAN,
1608 .flags = IORESOURCE_DMA,
1609 },
1610 [2] = {
1611 .name = "crypto_crci_in",
1612 .start = DMOV8064_CE_IN_CRCI,
1613 .end = DMOV8064_CE_IN_CRCI,
1614 .flags = IORESOURCE_DMA,
1615 },
1616 [3] = {
1617 .name = "crypto_crci_out",
1618 .start = DMOV8064_CE_OUT_CRCI,
1619 .end = DMOV8064_CE_OUT_CRCI,
1620 .flags = IORESOURCE_DMA,
1621 },
1622};
1623
1624static struct resource qcedev_resources[] = {
1625 [0] = {
1626 .start = QCE_0_BASE,
1627 .end = QCE_0_BASE + QCE_SIZE - 1,
1628 .flags = IORESOURCE_MEM,
1629 },
1630 [1] = {
1631 .name = "crypto_channels",
1632 .start = DMOV8064_CE_IN_CHAN,
1633 .end = DMOV8064_CE_OUT_CHAN,
1634 .flags = IORESOURCE_DMA,
1635 },
1636 [2] = {
1637 .name = "crypto_crci_in",
1638 .start = DMOV8064_CE_IN_CRCI,
1639 .end = DMOV8064_CE_IN_CRCI,
1640 .flags = IORESOURCE_DMA,
1641 },
1642 [3] = {
1643 .name = "crypto_crci_out",
1644 .start = DMOV8064_CE_OUT_CRCI,
1645 .end = DMOV8064_CE_OUT_CRCI,
1646 .flags = IORESOURCE_DMA,
1647 },
1648};
1649
1650#endif
1651
1652#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1653 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1654
1655static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1656 .ce_shared = QCE_CE_SHARED,
1657 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1658 .hw_key_support = QCE_HW_KEY_SUPPORT,
1659 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001660 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001661};
1662
1663static struct platform_device qcrypto_device = {
1664 .name = "qcrypto",
1665 .id = 0,
1666 .num_resources = ARRAY_SIZE(qcrypto_resources),
1667 .resource = qcrypto_resources,
1668 .dev = {
1669 .coherent_dma_mask = DMA_BIT_MASK(32),
1670 .platform_data = &qcrypto_ce_hw_suppport,
1671 },
1672};
1673#endif
1674
1675#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1676 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1677
1678static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1679 .ce_shared = QCE_CE_SHARED,
1680 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1681 .hw_key_support = QCE_HW_KEY_SUPPORT,
1682 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001683 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001684};
1685
1686static struct platform_device qcedev_device = {
1687 .name = "qce",
1688 .id = 0,
1689 .num_resources = ARRAY_SIZE(qcedev_resources),
1690 .resource = qcedev_resources,
1691 .dev = {
1692 .coherent_dma_mask = DMA_BIT_MASK(32),
1693 .platform_data = &qcedev_ce_hw_suppport,
1694 },
1695};
1696#endif
1697
Joel Kingdacbc822012-01-25 13:30:57 -08001698static struct mdm_platform_data mdm_platform_data = {
1699 .mdm_version = "3.0",
1700 .ramdump_delay_ms = 2000,
Joel King14fe7fa2012-05-27 14:26:11 -07001701 .early_power_on = 1,
1702 .sfr_query = 1,
Hemant Kumara945b472012-01-25 15:08:06 -08001703 .peripheral_platform_device = &apq8064_device_hsic_host,
Joel Kingdacbc822012-01-25 13:30:57 -08001704};
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001705
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001706static struct tsens_platform_data apq_tsens_pdata = {
1707 .tsens_factor = 1000,
1708 .hw_type = APQ_8064,
1709 .tsens_num_sensor = 11,
1710 .slope = {1176, 1176, 1154, 1176, 1111,
1711 1132, 1132, 1199, 1132, 1199, 1132},
1712};
1713
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07001714static struct platform_device msm_tsens_device = {
1715 .name = "tsens8960-tm",
1716 .id = -1,
1717};
1718
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001719#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001720static void __init apq8064_map_io(void)
1721{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001722 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001723 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001724 if (socinfo_init() < 0)
1725 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001726}
1727
1728static void __init apq8064_init_irq(void)
1729{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001730 struct msm_mpm_device_data *data = NULL;
1731
1732#ifdef CONFIG_MSM_MPM
1733 data = &apq8064_mpm_dev_data;
1734#endif
1735
1736 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001737 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1738 (void *)MSM_QGIC_CPU_BASE);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001739}
1740
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001741static struct platform_device msm8064_device_saw_regulator_core0 = {
1742 .name = "saw-regulator",
1743 .id = 0,
1744 .dev = {
1745 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
1746 },
1747};
1748
1749static struct platform_device msm8064_device_saw_regulator_core1 = {
1750 .name = "saw-regulator",
1751 .id = 1,
1752 .dev = {
1753 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
1754 },
1755};
1756
1757static struct platform_device msm8064_device_saw_regulator_core2 = {
1758 .name = "saw-regulator",
1759 .id = 2,
1760 .dev = {
1761 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
1762 },
1763};
1764
1765static struct platform_device msm8064_device_saw_regulator_core3 = {
1766 .name = "saw-regulator",
1767 .id = 3,
1768 .dev = {
1769 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001770
1771 },
1772};
1773
Oluwafemi Adeyemif5a31422012-03-08 16:58:45 -08001774static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001775 {
1776 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1777 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1778 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001779 1, 784, 180000, 100,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001780 },
1781
1782 {
1783 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1784 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1785 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001786 1300, 228, 1200000, 2000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001787 },
1788
1789 {
1790 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1791 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1792 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001793 2000, 138, 1208400, 3200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001794 },
1795
1796 {
1797 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001798 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
1799 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001800 6000, 119, 1850300, 9000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001801 },
1802
1803 {
1804 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1805 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1806 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001807 9200, 68, 2839200, 16400,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001808 },
1809
1810 {
1811 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1812 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1813 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001814 10300, 63, 3128000, 18200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001815 },
1816
1817 {
1818 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1819 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1820 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001821 18000, 10, 4602600, 27000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001822 },
1823
1824 {
1825 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1826 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1827 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001828 20000, 2, 5752000, 32000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001829 },
1830};
1831
1832static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1833 .mode = MSM_PM_BOOT_CONFIG_TZ,
1834};
1835
1836static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
1837 .levels = &msm_rpmrs_levels[0],
1838 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
1839 .vdd_mem_levels = {
1840 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
1841 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
1842 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
1843 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
1844 },
1845 .vdd_dig_levels = {
1846 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
1847 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
1848 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
1849 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
1850 },
1851 .vdd_mask = 0x7FFFFF,
1852 .rpmrs_target_id = {
1853 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
1854 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
1855 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
1856 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
1857 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
1858 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
1859 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
1860 },
1861};
1862
Praveen Chidambaram78499012011-11-01 17:15:17 -06001863static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1864 0x03, 0x0f,
1865};
1866
1867static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1868 0x00, 0x24, 0x54, 0x10,
1869 0x09, 0x03, 0x01,
1870 0x10, 0x54, 0x30, 0x0C,
1871 0x24, 0x30, 0x0f,
1872};
1873
1874static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1875 0x00, 0x24, 0x54, 0x10,
1876 0x09, 0x07, 0x01, 0x0B,
1877 0x10, 0x54, 0x30, 0x0C,
1878 0x24, 0x30, 0x0f,
1879};
1880
1881static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1882 [0] = {
1883 .mode = MSM_SPM_MODE_CLOCK_GATING,
1884 .notify_rpm = false,
1885 .cmd = spm_wfi_cmd_sequence,
1886 },
1887 [1] = {
1888 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1889 .notify_rpm = false,
1890 .cmd = spm_power_collapse_without_rpm,
1891 },
1892 [2] = {
1893 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1894 .notify_rpm = true,
1895 .cmd = spm_power_collapse_with_rpm,
1896 },
1897};
1898
1899static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1900 0x00, 0x20, 0x03, 0x20,
1901 0x00, 0x0f,
1902};
1903
1904static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1905 0x00, 0x20, 0x34, 0x64,
1906 0x48, 0x07, 0x48, 0x20,
1907 0x50, 0x64, 0x04, 0x34,
1908 0x50, 0x0f,
1909};
1910static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1911 0x00, 0x10, 0x34, 0x64,
1912 0x48, 0x07, 0x48, 0x10,
1913 0x50, 0x64, 0x04, 0x34,
1914 0x50, 0x0F,
1915};
1916
1917static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1918 [0] = {
1919 .mode = MSM_SPM_L2_MODE_RETENTION,
1920 .notify_rpm = false,
1921 .cmd = l2_spm_wfi_cmd_sequence,
1922 },
1923 [1] = {
1924 .mode = MSM_SPM_L2_MODE_GDHS,
1925 .notify_rpm = true,
1926 .cmd = l2_spm_gdhs_cmd_sequence,
1927 },
1928 [2] = {
1929 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1930 .notify_rpm = true,
1931 .cmd = l2_spm_power_off_cmd_sequence,
1932 },
1933};
1934
1935
1936static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1937 [0] = {
1938 .reg_base_addr = MSM_SAW_L2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001939 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001940 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001941 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1942 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1943 .modes = msm_spm_l2_seq_list,
1944 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1945 },
1946};
1947
1948static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1949 [0] = {
1950 .reg_base_addr = MSM_SAW0_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001951 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001952#if defined(CONFIG_MSM_AVS_HW)
1953 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1954 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1955#endif
1956 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001957 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001958 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1959 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1960 .vctl_timeout_us = 50,
1961 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1962 .modes = msm_spm_seq_list,
1963 },
1964 [1] = {
1965 .reg_base_addr = MSM_SAW1_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001966 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001967#if defined(CONFIG_MSM_AVS_HW)
1968 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1969 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1970#endif
1971 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001972 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001973 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1974 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1975 .vctl_timeout_us = 50,
1976 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1977 .modes = msm_spm_seq_list,
1978 },
1979 [2] = {
1980 .reg_base_addr = MSM_SAW2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001981 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001982#if defined(CONFIG_MSM_AVS_HW)
1983 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1984 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1985#endif
1986 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001987 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001988 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1989 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1990 .vctl_timeout_us = 50,
1991 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1992 .modes = msm_spm_seq_list,
1993 },
1994 [3] = {
1995 .reg_base_addr = MSM_SAW3_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001996 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001997#if defined(CONFIG_MSM_AVS_HW)
1998 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1999 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2000#endif
2001 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07002002 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002003 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2004 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2005 .vctl_timeout_us = 50,
2006 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2007 .modes = msm_spm_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08002008 },
2009};
2010
Praveen Chidambaram4d19be42012-04-03 18:05:52 -06002011static struct msm_pm_sleep_status_data msm_pm_slp_sts_data = {
2012 .base_addr = MSM_ACC0_BASE + 0x08,
2013 .cpu_offset = MSM_ACC1_BASE - MSM_ACC0_BASE,
2014 .mask = 1UL << 13,
2015};
2016
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002017static void __init apq8064_init_buses(void)
2018{
2019 msm_bus_rpm_set_mt_mask();
2020 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
2021 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
2022 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
2023 msm_bus_8064_apps_fabric.dev.platform_data =
2024 &msm_bus_8064_apps_fabric_pdata;
2025 msm_bus_8064_sys_fabric.dev.platform_data =
2026 &msm_bus_8064_sys_fabric_pdata;
2027 msm_bus_8064_mm_fabric.dev.platform_data =
2028 &msm_bus_8064_mm_fabric_pdata;
2029 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
2030 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
2031}
2032
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002033/* PCIe gpios */
2034static struct msm_pcie_gpio_info_t msm_pcie_gpio_info[MSM_PCIE_MAX_GPIO] = {
2035 {"rst_n", PM8921_MPP_PM_TO_SYS(PCIE_RST_N_PMIC_MPP), 0},
2036 {"pwr_en", PM8921_GPIO_PM_TO_SYS(PCIE_PWR_EN_PMIC_GPIO), 1},
2037};
2038
2039static struct msm_pcie_platform msm_pcie_platform_data = {
2040 .gpio = msm_pcie_gpio_info,
2041};
2042
2043static void __init mpq8064_pcie_init(void)
2044{
2045 msm_device_pcie.dev.platform_data = &msm_pcie_platform_data;
2046 platform_device_register(&msm_device_pcie);
2047}
2048
David Collinsf0d00732012-01-25 15:46:50 -08002049static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
2050 .name = GPIO_REGULATOR_DEV_NAME,
2051 .id = PM8921_MPP_PM_TO_SYS(7),
2052 .dev = {
2053 .platform_data
2054 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2055 },
2056};
2057
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08002058static struct platform_device apq8064_device_ext_mpp8_vreg __devinitdata = {
2059 .name = GPIO_REGULATOR_DEV_NAME,
2060 .id = PM8921_MPP_PM_TO_SYS(8),
2061 .dev = {
2062 .platform_data
2063 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_MPP8],
2064 },
2065};
2066
David Collinsf0d00732012-01-25 15:46:50 -08002067static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
2068 .name = GPIO_REGULATOR_DEV_NAME,
2069 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
2070 .dev = {
2071 .platform_data =
2072 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2073 },
2074};
2075
David Collins390fc332012-02-07 14:38:16 -08002076static struct platform_device apq8064_device_ext_ts_sw_vreg __devinitdata = {
2077 .name = GPIO_REGULATOR_DEV_NAME,
2078 .id = PM8921_GPIO_PM_TO_SYS(23),
2079 .dev = {
2080 .platform_data
2081 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_TS_SW],
2082 },
2083};
2084
David Collins2782b5c2012-02-06 10:02:42 -08002085static struct platform_device apq8064_device_rpm_regulator __devinitdata = {
2086 .name = "rpm-regulator",
2087 .id = -1,
2088 .dev = {
2089 .platform_data = &apq8064_rpm_regulator_pdata,
2090 },
2091};
2092
Ravi Kumar V05931a22012-04-04 17:09:37 +05302093static struct gpio_ir_recv_platform_data gpio_ir_recv_pdata = {
2094 .gpio_nr = 88,
2095 .active_low = 1,
2096};
2097
2098static struct platform_device gpio_ir_recv_pdev = {
2099 .name = "gpio-rc-recv",
2100 .dev = {
2101 .platform_data = &gpio_ir_recv_pdata,
2102 },
2103};
2104
Terence Hampson36b70722012-05-10 13:18:16 -04002105static struct platform_device *common_not_mpq_devices[] __initdata = {
David Keitel3c40fc52012-02-09 17:53:52 -08002106 &apq8064_device_qup_i2c_gsbi1,
Jing Lin04601f92012-02-05 15:36:07 -08002107 &apq8064_device_qup_i2c_gsbi3,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002108 &apq8064_device_qup_i2c_gsbi4,
Terence Hampson36b70722012-05-10 13:18:16 -04002109};
2110
2111static struct platform_device *common_devices[] __initdata = {
2112 &apq8064_device_dmov,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002113 &apq8064_device_qup_spi_gsbi5,
David Collinsf0d00732012-01-25 15:46:50 -08002114 &apq8064_device_ext_5v_vreg,
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08002115 &apq8064_device_ext_mpp8_vreg,
David Collinsf0d00732012-01-25 15:46:50 -08002116 &apq8064_device_ext_3p3v_vreg,
David Collins390fc332012-02-07 14:38:16 -08002117 &apq8064_device_ext_ts_sw_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07002118 &apq8064_device_ssbi_pmic1,
2119 &apq8064_device_ssbi_pmic2,
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06002120 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07002121 &apq8064_device_otg,
2122 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08002123 &apq8064_device_hsusb_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07002124 &android_usb_device,
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08002125 &msm_device_wcnss_wlan,
Ankit Vermab7c26e62012-02-28 15:04:15 -08002126 &msm_device_iris_fm,
Larry Bassel67b921d2012-04-06 10:23:27 -07002127 &apq8064_fmem_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08002128#ifdef CONFIG_ANDROID_PMEM
2129#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002130 &apq8064_android_pmem_device,
2131 &apq8064_android_pmem_adsp_device,
2132 &apq8064_android_pmem_audio_device,
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -07002133#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
2134#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -08002135#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002136 &apq8064_ion_dev,
Olav Haugan7c6aa742012-01-16 16:47:37 -08002137#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002138 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08002139 &msm8064_device_saw_regulator_core0,
2140 &msm8064_device_saw_regulator_core1,
2141 &msm8064_device_saw_regulator_core2,
2142 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002143#if defined(CONFIG_QSEECOM)
2144 &qseecom_device,
2145#endif
2146
Ramesh Masavarapu28311912011-10-27 11:04:12 -07002147#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2148 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2149 &qcrypto_device,
2150#endif
2151
2152#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2153 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2154 &qcedev_device,
2155#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07002156
2157#ifdef CONFIG_HW_RANDOM_MSM
2158 &apq8064_device_rng,
2159#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002160 &apq_pcm,
2161 &apq_pcm_routing,
2162 &apq_cpudai0,
2163 &apq_cpudai1,
Santosh Mardieff9a742012-04-09 23:23:39 +05302164 &mpq_cpudai_sec_i2s_rx,
Kuirong Wangf23f8c52012-03-31 12:34:51 -07002165 &mpq_cpudai_mi2s_tx,
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002166 &apq_cpudai_hdmi_rx,
2167 &apq_cpudai_bt_rx,
2168 &apq_cpudai_bt_tx,
2169 &apq_cpudai_fm_rx,
2170 &apq_cpudai_fm_tx,
2171 &apq_cpu_fe,
2172 &apq_stub_codec,
2173 &apq_voice,
2174 &apq_voip,
2175 &apq_lpa_pcm,
Krishnankutty Kolathappilly4374e332012-03-18 22:27:30 -07002176 &apq_compr_dsp,
2177 &apq_multi_ch_pcm,
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002178 &apq_pcm_hostless,
2179 &apq_cpudai_afe_01_rx,
2180 &apq_cpudai_afe_01_tx,
2181 &apq_cpudai_afe_02_rx,
2182 &apq_cpudai_afe_02_tx,
2183 &apq_pcm_afe,
2184 &apq_cpudai_auxpcm_rx,
2185 &apq_cpudai_auxpcm_tx,
Neema Shetty8427c262012-02-16 11:23:43 -08002186 &apq_cpudai_stub,
Neema Shetty3c9d2862012-03-11 01:25:32 -08002187 &apq_cpudai_slimbus_1_rx,
2188 &apq_cpudai_slimbus_1_tx,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002189 &apq_cpudai_slimbus_2_tx,
Neema Shettyc9d86c32012-05-09 12:01:39 -07002190 &apq_cpudai_slimbus_3_rx,
Helen Zeng38c3c962012-05-17 14:56:20 -07002191 &apq_cpudai_slimbus_3_tx,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002192 &apq8064_rpm_device,
2193 &apq8064_rpm_log_device,
2194 &apq8064_rpm_stat_device,
Ramesh Masavarapuf31ff242012-05-10 18:55:21 -07002195 &apq_device_tz_log,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002196 &msm_bus_8064_apps_fabric,
2197 &msm_bus_8064_sys_fabric,
2198 &msm_bus_8064_mm_fabric,
2199 &msm_bus_8064_sys_fpb,
2200 &msm_bus_8064_cpss_fpb,
Mohan Kumar Gubbihalli Lachma Naik7f72edd2012-02-06 17:26:47 -08002201 &apq8064_msm_device_vidc,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07002202 &msm_pil_dsps,
Matt Wagantalled832652012-02-02 19:23:17 -08002203 &msm_8960_riva,
Matt Wagantallb94b9a52012-02-02 21:59:54 -08002204 &msm_8960_q6_lpass,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002205 &msm_pil_vidc,
Matt Wagantall292aace2012-01-26 19:12:34 -08002206 &msm_gss,
Laura Abbottb93525f2012-04-12 09:57:19 -07002207 &apq8064_rtb_device,
Praveen Chidambaram8ea3dcd2011-12-07 14:46:31 -07002208 &apq8064_cpu_idle_device,
Praveen Chidambaram5c8adf22012-02-23 18:44:37 -07002209 &apq8064_msm_gov_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002210 &apq8064_device_cache_erp,
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002211 &epm_adc_device,
Pratik Patel212ab362012-03-16 12:30:07 -07002212 &apq8064_qdss_device,
2213 &msm_etb_device,
2214 &msm_tpiu_device,
2215 &msm_funnel_device,
2216 &apq8064_etm_device,
Helen Zeng8f925502012-03-05 16:50:17 -08002217 &apq_cpudai_slim_4_rx,
2218 &apq_cpudai_slim_4_tx,
Jignesh Mehta921649d2012-04-19 06:57:23 -07002219 &msm8960_gemini_device,
Laura Abbott0577d7b2012-04-17 11:14:30 -07002220 &apq8064_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002221 &msm_tsens_device,
Laura Abbott93a4a352012-05-25 09:26:35 -07002222 &apq8064_cache_dump_device,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002223};
2224
Joel King4e7ad222011-08-17 15:47:38 -07002225static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002226 &apq8064_device_uart_gsbi3,
Yan He06913ce2011-08-26 16:33:46 -07002227 &msm_device_sps_apq8064,
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002228};
2229
2230static struct platform_device *rumi3_devices[] __initdata = {
2231 &apq8064_device_uart_gsbi1,
Yan He435ed612011-11-23 17:34:59 -08002232 &msm_device_sps_apq8064,
Huaibin Yang4a084e32011-12-15 15:25:52 -08002233#ifdef CONFIG_MSM_ROTATOR
2234 &msm_rotator_device,
2235#endif
Joel King4e7ad222011-08-17 15:47:38 -07002236};
2237
Joel King82b7e3f2012-01-05 10:03:27 -08002238static struct platform_device *cdp_devices[] __initdata = {
2239 &apq8064_device_uart_gsbi1,
Jin Hong4bbbfba2012-02-02 21:48:07 -08002240 &apq8064_device_uart_gsbi7,
Joel King82b7e3f2012-01-05 10:03:27 -08002241 &msm_device_sps_apq8064,
Aravind Venkateswaran4ca27532012-02-16 14:27:05 -08002242#ifdef CONFIG_MSM_ROTATOR
2243 &msm_rotator_device,
2244#endif
Joel King82b7e3f2012-01-05 10:03:27 -08002245};
2246
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002247static struct platform_device
2248mpq8064_device_ext_5v_frc_vreg __devinitdata = {
2249 .name = GPIO_REGULATOR_DEV_NAME,
2250 .id = SX150X_GPIO(4, 10),
2251 .dev = {
2252 .platform_data =
2253 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_FRC_5V],
2254 },
2255};
2256
2257static struct platform_device
2258mpq8064_device_ext_1p2_buck_vreg __devinitdata = {
2259 .name = GPIO_REGULATOR_DEV_NAME,
2260 .id = SX150X_GPIO(4, 2),
2261 .dev = {
2262 .platform_data =
2263 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P2V],
2264 },
2265};
2266
2267static struct platform_device
2268mpq8064_device_ext_1p8_buck_vreg __devinitdata = {
2269 .name = GPIO_REGULATOR_DEV_NAME,
2270 .id = SX150X_GPIO(4, 4),
2271 .dev = {
2272 .platform_data =
2273 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P8V],
2274 },
2275};
2276
2277static struct platform_device
2278mpq8064_device_ext_2p2_buck_vreg __devinitdata = {
2279 .name = GPIO_REGULATOR_DEV_NAME,
2280 .id = SX150X_GPIO(4, 14),
2281 .dev = {
2282 .platform_data =
2283 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_2P2V],
2284 },
2285};
2286
2287static struct platform_device
2288mpq8064_device_ext_5v_buck_vreg __devinitdata = {
2289 .name = GPIO_REGULATOR_DEV_NAME,
2290 .id = SX150X_GPIO(4, 3),
2291 .dev = {
2292 .platform_data =
2293 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_5V],
2294 },
2295};
2296
2297static struct platform_device
2298mpq8064_device_ext_3p3v_ldo_vreg __devinitdata = {
2299 .name = GPIO_REGULATOR_DEV_NAME,
2300 .id = SX150X_GPIO(4, 15),
2301 .dev = {
2302 .platform_data =
2303 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_3P3V],
2304 },
2305};
2306
Ravi Kumar V1c903012012-05-15 16:11:35 +05302307static struct platform_device rc_input_loopback_pdev = {
2308 .name = "rc-user-input",
2309 .id = -1,
2310};
2311
Ravi Kumar V040eeff2012-05-23 21:29:23 +05302312static int rf4ce_gpio_init(void)
2313{
2314 if (!machine_is_mpq8064_cdp())
2315 return -EINVAL;
2316
2317 /* CC2533 SRDY Input */
2318 if (!gpio_request(SX150X_GPIO(4, 6), "rf4ce_srdy")) {
2319 gpio_direction_input(SX150X_GPIO(4, 6));
2320 gpio_export(SX150X_GPIO(4, 6), true);
2321 }
2322
2323 /* CC2533 MRDY Output */
2324 if (!gpio_request(SX150X_GPIO(4, 5), "rf4ce_mrdy")) {
2325 gpio_direction_output(SX150X_GPIO(4, 5), 1);
2326 gpio_export(SX150X_GPIO(4, 5), true);
2327 }
2328
2329 /* CC2533 Reset Output */
2330 if (!gpio_request(SX150X_GPIO(4, 7), "rf4ce_reset")) {
2331 gpio_direction_output(SX150X_GPIO(4, 7), 0);
2332 gpio_export(SX150X_GPIO(4, 7), true);
2333 }
2334
2335 return 0;
2336}
2337late_initcall(rf4ce_gpio_init);
2338
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002339static struct platform_device *mpq_devices[] __initdata = {
2340 &msm_device_sps_apq8064,
2341 &mpq8064_device_qup_i2c_gsbi5,
2342#ifdef CONFIG_MSM_ROTATOR
2343 &msm_rotator_device,
2344#endif
Ravi Kumar V05931a22012-04-04 17:09:37 +05302345 &gpio_ir_recv_pdev,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002346 &mpq8064_device_ext_5v_frc_vreg,
2347 &mpq8064_device_ext_1p2_buck_vreg,
2348 &mpq8064_device_ext_1p8_buck_vreg,
2349 &mpq8064_device_ext_2p2_buck_vreg,
2350 &mpq8064_device_ext_5v_buck_vreg,
2351 &mpq8064_device_ext_3p3v_ldo_vreg,
Terence Hampson2e1705f2012-04-11 19:55:29 -04002352#ifdef CONFIG_MSM_VCAP
2353 &msm8064_device_vcap,
2354#endif
Ravi Kumar V1c903012012-05-15 16:11:35 +05302355 &rc_input_loopback_pdev,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002356};
2357
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002358static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002359 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002360};
2361
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002362#define KS8851_IRQ_GPIO 43
2363
2364static struct spi_board_info spi_board_info[] __initdata = {
2365 {
2366 .modalias = "ks8851",
2367 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2368 .max_speed_hz = 19200000,
2369 .bus_num = 0,
2370 .chip_select = 2,
2371 .mode = SPI_MODE_0,
2372 },
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002373 {
2374 .modalias = "epm_adc",
2375 .max_speed_hz = 1100000,
2376 .bus_num = 0,
2377 .chip_select = 3,
2378 .mode = SPI_MODE_0,
2379 },
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002380};
2381
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002382static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002383 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08002384 .bus_num = 1,
2385 .slim_slave = &apq8064_slim_tabla,
2386 },
2387 {
2388 .bus_num = 1,
2389 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002390 },
2391 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002392};
2393
David Keitel3c40fc52012-02-09 17:53:52 -08002394static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi1_pdata = {
2395 .clk_freq = 100000,
2396 .src_clk_rate = 24000000,
2397};
2398
Jing Lin04601f92012-02-05 15:36:07 -08002399static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi3_pdata = {
Anirudh Ghayalc2163472012-04-10 14:58:14 +05302400 .clk_freq = 384000,
Jing Lin04601f92012-02-05 15:36:07 -08002401 .src_clk_rate = 24000000,
2402};
2403
Kenneth Heitke748593a2011-07-15 15:45:11 -06002404static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
2405 .clk_freq = 100000,
2406 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002407};
2408
Joel King8f839b92012-04-01 14:37:46 -07002409static struct msm_i2c_platform_data mpq8064_i2c_qup_gsbi5_pdata = {
2410 .clk_freq = 100000,
2411 .src_clk_rate = 24000000,
2412};
2413
David Keitel3c40fc52012-02-09 17:53:52 -08002414#define GSBI_DUAL_MODE_CODE 0x60
2415#define MSM_GSBI1_PHYS 0x12440000
Kenneth Heitke748593a2011-07-15 15:45:11 -06002416static void __init apq8064_i2c_init(void)
2417{
David Keitel3c40fc52012-02-09 17:53:52 -08002418 void __iomem *gsbi_mem;
2419
2420 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2421 &apq8064_i2c_qup_gsbi1_pdata;
2422 gsbi_mem = ioremap_nocache(MSM_GSBI1_PHYS, 4);
2423 writel_relaxed(GSBI_DUAL_MODE_CODE, gsbi_mem);
2424 /* Ensure protocol code is written before proceeding */
2425 wmb();
2426 iounmap(gsbi_mem);
2427 apq8064_i2c_qup_gsbi1_pdata.use_gsbi_shared_mode = 1;
Jing Lin04601f92012-02-05 15:36:07 -08002428 apq8064_device_qup_i2c_gsbi3.dev.platform_data =
2429 &apq8064_i2c_qup_gsbi3_pdata;
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002430 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2431 &apq8064_i2c_qup_gsbi1_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002432 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
2433 &apq8064_i2c_qup_gsbi4_pdata;
Joel King8f839b92012-04-01 14:37:46 -07002434 mpq8064_device_qup_i2c_gsbi5.dev.platform_data =
2435 &mpq8064_i2c_qup_gsbi5_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002436}
2437
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002438#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002439static int ethernet_init(void)
2440{
2441 int ret;
2442 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
2443 if (ret) {
2444 pr_err("ks8851 gpio_request failed: %d\n", ret);
2445 goto fail;
2446 }
2447
2448 return 0;
2449fail:
2450 return ret;
2451}
2452#else
2453static int ethernet_init(void)
2454{
2455 return 0;
2456}
2457#endif
2458
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302459#define GPIO_KEY_HOME PM8921_GPIO_PM_TO_SYS(27)
2460#define GPIO_KEY_VOLUME_UP PM8921_GPIO_PM_TO_SYS(35)
2461#define GPIO_KEY_VOLUME_DOWN PM8921_GPIO_PM_TO_SYS(38)
2462#define GPIO_KEY_CAM_FOCUS PM8921_GPIO_PM_TO_SYS(3)
2463#define GPIO_KEY_CAM_SNAP PM8921_GPIO_PM_TO_SYS(4)
Jing Lin3f8f8422012-03-05 09:32:11 -08002464#define GPIO_KEY_ROTATION PM8921_GPIO_PM_TO_SYS(42)
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302465
2466static struct gpio_keys_button cdp_keys[] = {
2467 {
2468 .code = KEY_HOME,
2469 .gpio = GPIO_KEY_HOME,
2470 .desc = "home_key",
2471 .active_low = 1,
2472 .type = EV_KEY,
2473 .wakeup = 1,
2474 .debounce_interval = 15,
2475 },
2476 {
2477 .code = KEY_VOLUMEUP,
2478 .gpio = GPIO_KEY_VOLUME_UP,
2479 .desc = "volume_up_key",
2480 .active_low = 1,
2481 .type = EV_KEY,
2482 .wakeup = 1,
2483 .debounce_interval = 15,
2484 },
2485 {
2486 .code = KEY_VOLUMEDOWN,
2487 .gpio = GPIO_KEY_VOLUME_DOWN,
2488 .desc = "volume_down_key",
2489 .active_low = 1,
2490 .type = EV_KEY,
2491 .wakeup = 1,
2492 .debounce_interval = 15,
2493 },
2494 {
2495 .code = SW_ROTATE_LOCK,
2496 .gpio = GPIO_KEY_ROTATION,
2497 .desc = "rotate_key",
2498 .active_low = 1,
2499 .type = EV_SW,
2500 .debounce_interval = 15,
2501 },
2502};
2503
2504static struct gpio_keys_platform_data cdp_keys_data = {
2505 .buttons = cdp_keys,
2506 .nbuttons = ARRAY_SIZE(cdp_keys),
2507};
2508
2509static struct platform_device cdp_kp_pdev = {
2510 .name = "gpio-keys",
2511 .id = -1,
2512 .dev = {
2513 .platform_data = &cdp_keys_data,
2514 },
2515};
2516
2517static struct gpio_keys_button mtp_keys[] = {
2518 {
2519 .code = KEY_CAMERA_FOCUS,
2520 .gpio = GPIO_KEY_CAM_FOCUS,
2521 .desc = "cam_focus_key",
2522 .active_low = 1,
2523 .type = EV_KEY,
2524 .wakeup = 1,
2525 .debounce_interval = 15,
2526 },
2527 {
2528 .code = KEY_VOLUMEUP,
2529 .gpio = GPIO_KEY_VOLUME_UP,
2530 .desc = "volume_up_key",
2531 .active_low = 1,
2532 .type = EV_KEY,
2533 .wakeup = 1,
2534 .debounce_interval = 15,
2535 },
2536 {
2537 .code = KEY_VOLUMEDOWN,
2538 .gpio = GPIO_KEY_VOLUME_DOWN,
2539 .desc = "volume_down_key",
2540 .active_low = 1,
2541 .type = EV_KEY,
2542 .wakeup = 1,
2543 .debounce_interval = 15,
2544 },
2545 {
2546 .code = KEY_CAMERA_SNAPSHOT,
2547 .gpio = GPIO_KEY_CAM_SNAP,
2548 .desc = "cam_snap_key",
2549 .active_low = 1,
2550 .type = EV_KEY,
2551 .debounce_interval = 15,
2552 },
2553};
2554
2555static struct gpio_keys_platform_data mtp_keys_data = {
2556 .buttons = mtp_keys,
2557 .nbuttons = ARRAY_SIZE(mtp_keys),
2558};
2559
2560static struct platform_device mtp_kp_pdev = {
2561 .name = "gpio-keys",
2562 .id = -1,
2563 .dev = {
2564 .platform_data = &mtp_keys_data,
2565 },
2566};
2567
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05302568static struct gpio_keys_button mpq_keys[] = {
2569 {
2570 .code = KEY_VOLUMEDOWN,
2571 .gpio = GPIO_KEY_VOLUME_DOWN,
2572 .desc = "volume_down_key",
2573 .active_low = 1,
2574 .type = EV_KEY,
2575 .wakeup = 1,
2576 .debounce_interval = 15,
2577 },
2578 {
2579 .code = KEY_VOLUMEUP,
2580 .gpio = GPIO_KEY_VOLUME_UP,
2581 .desc = "volume_up_key",
2582 .active_low = 1,
2583 .type = EV_KEY,
2584 .wakeup = 1,
2585 .debounce_interval = 15,
2586 },
2587};
2588
2589static struct gpio_keys_platform_data mpq_keys_data = {
2590 .buttons = mpq_keys,
2591 .nbuttons = ARRAY_SIZE(mpq_keys),
2592};
2593
2594static struct platform_device mpq_gpio_keys_pdev = {
2595 .name = "gpio-keys",
2596 .id = -1,
2597 .dev = {
2598 .platform_data = &mpq_keys_data,
2599 },
2600};
2601
2602#define MPQ_KP_ROW_BASE SX150X_EXP2_GPIO_BASE
2603#define MPQ_KP_COL_BASE (SX150X_EXP2_GPIO_BASE + 4)
2604
2605static unsigned int mpq_row_gpios[] = {MPQ_KP_ROW_BASE, MPQ_KP_ROW_BASE + 1,
2606 MPQ_KP_ROW_BASE + 2, MPQ_KP_ROW_BASE + 3};
2607static unsigned int mpq_col_gpios[] = {MPQ_KP_COL_BASE, MPQ_KP_COL_BASE + 1,
2608 MPQ_KP_COL_BASE + 2};
2609
2610static const unsigned int mpq_keymap[] = {
2611 KEY(0, 0, KEY_UP),
2612 KEY(0, 1, KEY_ENTER),
2613 KEY(0, 2, KEY_3),
2614
2615 KEY(1, 0, KEY_DOWN),
2616 KEY(1, 1, KEY_EXIT),
2617 KEY(1, 2, KEY_4),
2618
2619 KEY(2, 0, KEY_LEFT),
2620 KEY(2, 1, KEY_1),
2621 KEY(2, 2, KEY_5),
2622
2623 KEY(3, 0, KEY_RIGHT),
2624 KEY(3, 1, KEY_2),
2625 KEY(3, 2, KEY_6),
2626};
2627
2628static struct matrix_keymap_data mpq_keymap_data = {
2629 .keymap_size = ARRAY_SIZE(mpq_keymap),
2630 .keymap = mpq_keymap,
2631};
2632
2633static struct matrix_keypad_platform_data mpq_keypad_data = {
2634 .keymap_data = &mpq_keymap_data,
2635 .row_gpios = mpq_row_gpios,
2636 .col_gpios = mpq_col_gpios,
2637 .num_row_gpios = ARRAY_SIZE(mpq_row_gpios),
2638 .num_col_gpios = ARRAY_SIZE(mpq_col_gpios),
2639 .col_scan_delay_us = 32000,
2640 .debounce_ms = 20,
2641 .wakeup = 1,
2642 .active_low = 1,
2643 .no_autorepeat = 1,
2644};
2645
2646static struct platform_device mpq_keypad_device = {
2647 .name = "matrix-keypad",
2648 .id = -1,
2649 .dev = {
2650 .platform_data = &mpq_keypad_data,
2651 },
2652};
2653
Jin Hongd3024e62012-02-09 16:13:32 -08002654/* Sensors DSPS platform data */
2655#define DSPS_PIL_GENERIC_NAME "dsps"
2656static void __init apq8064_init_dsps(void)
2657{
2658 struct msm_dsps_platform_data *pdata =
2659 msm_dsps_device_8064.dev.platform_data;
2660 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
2661 pdata->gpios = NULL;
2662 pdata->gpios_num = 0;
2663
2664 platform_device_register(&msm_dsps_device_8064);
2665}
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302666
Jing Lin417fa452012-02-05 14:31:06 -08002667#define I2C_SURF 1
2668#define I2C_FFA (1 << 1)
2669#define I2C_RUMI (1 << 2)
2670#define I2C_SIM (1 << 3)
2671#define I2C_LIQUID (1 << 4)
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002672#define I2C_MPQ_CDP BIT(5)
2673#define I2C_MPQ_HRD BIT(6)
2674#define I2C_MPQ_DTV BIT(7)
Jing Lin417fa452012-02-05 14:31:06 -08002675
2676struct i2c_registry {
2677 u8 machs;
2678 int bus;
2679 struct i2c_board_info *info;
2680 int len;
2681};
2682
2683static struct i2c_registry apq8064_i2c_devices[] __initdata = {
Jing Lin21ed4de2012-02-05 15:53:28 -08002684 {
David Keitel2f613d92012-02-15 11:29:16 -08002685 I2C_LIQUID,
2686 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
2687 smb349_charger_i2c_info,
2688 ARRAY_SIZE(smb349_charger_i2c_info)
2689 },
2690 {
Jing Lin21ed4de2012-02-05 15:53:28 -08002691 I2C_SURF | I2C_LIQUID,
2692 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
2693 mxt_device_info,
2694 ARRAY_SIZE(mxt_device_info),
2695 },
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08002696 {
2697 I2C_FFA,
2698 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
2699 cyttsp_info,
2700 ARRAY_SIZE(cyttsp_info),
2701 },
Amy Maloche70090f992012-02-16 16:35:26 -08002702 {
2703 I2C_FFA | I2C_LIQUID,
2704 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
2705 isa1200_board_info,
2706 ARRAY_SIZE(isa1200_board_info),
2707 },
Santosh Mardieff9a742012-04-09 23:23:39 +05302708 {
2709 I2C_MPQ_CDP,
2710 APQ_8064_GSBI5_QUP_I2C_BUS_ID,
2711 cs8427_device_info,
2712 ARRAY_SIZE(cs8427_device_info),
2713 },
Jing Lin417fa452012-02-05 14:31:06 -08002714};
2715
Jay Chokshi607f61b2012-04-25 18:21:21 -07002716#define SX150X_EXP1_INT_N PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9)
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05302717#define SX150X_EXP2_INT_N MSM_GPIO_TO_INT(81)
Jay Chokshi607f61b2012-04-25 18:21:21 -07002718
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002719struct sx150x_platform_data mpq8064_sx150x_pdata[] = {
2720 [SX150X_EXP1] = {
2721 .gpio_base = SX150X_EXP1_GPIO_BASE,
2722 .oscio_is_gpo = false,
2723 .io_pullup_ena = 0x0,
2724 .io_pulldn_ena = 0x0,
2725 .io_open_drain_ena = 0x0,
2726 .io_polarity = 0,
Jay Chokshi607f61b2012-04-25 18:21:21 -07002727 .irq_summary = SX150X_EXP1_INT_N,
2728 .irq_base = SX150X_EXP1_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002729 },
2730 [SX150X_EXP2] = {
2731 .gpio_base = SX150X_EXP2_GPIO_BASE,
2732 .oscio_is_gpo = false,
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05302733 .io_pullup_ena = 0x0f,
2734 .io_pulldn_ena = 0x70,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002735 .io_open_drain_ena = 0x0,
2736 .io_polarity = 0,
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05302737 .irq_summary = SX150X_EXP2_INT_N,
2738 .irq_base = SX150X_EXP2_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002739 },
2740 [SX150X_EXP3] = {
2741 .gpio_base = SX150X_EXP3_GPIO_BASE,
2742 .oscio_is_gpo = false,
2743 .io_pullup_ena = 0x0,
2744 .io_pulldn_ena = 0x0,
2745 .io_open_drain_ena = 0x0,
2746 .io_polarity = 0,
2747 .irq_summary = -1,
2748 },
2749 [SX150X_EXP4] = {
2750 .gpio_base = SX150X_EXP4_GPIO_BASE,
2751 .oscio_is_gpo = false,
2752 .io_pullup_ena = 0x0,
2753 .io_pulldn_ena = 0x0,
2754 .io_open_drain_ena = 0x0,
2755 .io_polarity = 0,
2756 .irq_summary = -1,
2757 },
2758};
2759
2760static struct i2c_board_info sx150x_gpio_exp_info[] = {
2761 {
2762 I2C_BOARD_INFO("sx1509q", 0x70),
2763 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP1],
2764 },
2765 {
2766 I2C_BOARD_INFO("sx1508q", 0x23),
2767 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP2],
2768 },
2769 {
2770 I2C_BOARD_INFO("sx1508q", 0x22),
2771 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP3],
2772 },
2773 {
2774 I2C_BOARD_INFO("sx1509q", 0x3E),
2775 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP4],
2776 },
2777};
2778
2779#define MPQ8064_I2C_GSBI5_BUS_ID 5
2780
2781static struct i2c_registry mpq8064_i2c_devices[] __initdata = {
2782 {
2783 I2C_MPQ_CDP,
2784 MPQ8064_I2C_GSBI5_BUS_ID,
2785 sx150x_gpio_exp_info,
2786 ARRAY_SIZE(sx150x_gpio_exp_info),
2787 },
2788};
2789
Jing Lin417fa452012-02-05 14:31:06 -08002790static void __init register_i2c_devices(void)
2791{
2792 u8 mach_mask = 0;
2793 int i;
2794
Kevin Chand07220e2012-02-13 15:52:22 -08002795#ifdef CONFIG_MSM_CAMERA
2796 struct i2c_registry apq8064_camera_i2c_devices = {
2797 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_RUMI,
2798 APQ_8064_GSBI4_QUP_I2C_BUS_ID,
2799 apq8064_camera_board_info.board_info,
2800 apq8064_camera_board_info.num_i2c_board_info,
2801 };
2802#endif
Jing Lin417fa452012-02-05 14:31:06 -08002803 /* Build the matching 'supported_machs' bitmask */
2804 if (machine_is_apq8064_cdp())
2805 mach_mask = I2C_SURF;
2806 else if (machine_is_apq8064_mtp())
2807 mach_mask = I2C_FFA;
2808 else if (machine_is_apq8064_liquid())
2809 mach_mask = I2C_LIQUID;
2810 else if (machine_is_apq8064_rumi3())
2811 mach_mask = I2C_RUMI;
2812 else if (machine_is_apq8064_sim())
2813 mach_mask = I2C_SIM;
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002814 else if (PLATFORM_IS_MPQ8064())
2815 mach_mask = I2C_MPQ_CDP;
Jing Lin417fa452012-02-05 14:31:06 -08002816 else
2817 pr_err("unmatched machine ID in register_i2c_devices\n");
2818
2819 /* Run the array and install devices as appropriate */
2820 for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) {
2821 if (apq8064_i2c_devices[i].machs & mach_mask)
2822 i2c_register_board_info(apq8064_i2c_devices[i].bus,
2823 apq8064_i2c_devices[i].info,
2824 apq8064_i2c_devices[i].len);
2825 }
Kevin Chand07220e2012-02-13 15:52:22 -08002826#ifdef CONFIG_MSM_CAMERA
2827 if (apq8064_camera_i2c_devices.machs & mach_mask)
2828 i2c_register_board_info(apq8064_camera_i2c_devices.bus,
2829 apq8064_camera_i2c_devices.info,
2830 apq8064_camera_i2c_devices.len);
2831#endif
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002832
2833 for (i = 0; i < ARRAY_SIZE(mpq8064_i2c_devices); ++i) {
2834 if (mpq8064_i2c_devices[i].machs & mach_mask)
2835 i2c_register_board_info(
2836 mpq8064_i2c_devices[i].bus,
2837 mpq8064_i2c_devices[i].info,
2838 mpq8064_i2c_devices[i].len);
2839 }
Jing Lin417fa452012-02-05 14:31:06 -08002840}
2841
Jay Chokshi994ff122012-03-27 15:43:48 -07002842static void enable_ddr3_regulator(void)
2843{
2844 static struct regulator *ext_ddr3;
2845
2846 /* Use MPP7 output state as a flag for PCDDR3 presence. */
2847 if (gpio_get_value_cansleep(PM8921_MPP_PM_TO_SYS(7)) > 0) {
2848 ext_ddr3 = regulator_get(NULL, "ext_ddr3");
2849 if (IS_ERR(ext_ddr3) || ext_ddr3 == NULL)
2850 pr_err("Could not get MPP7 regulator\n");
2851 else
2852 regulator_enable(ext_ddr3);
2853 }
2854}
2855
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002856static void enable_avc_i2c_bus(void)
2857{
2858 int avc_i2c_en_mpp = PM8921_MPP_PM_TO_SYS(8);
2859 int rc;
2860
2861 rc = gpio_request(avc_i2c_en_mpp, "avc_i2c_en");
2862 if (rc)
2863 pr_err("request for avc_i2c_en mpp failed,"
2864 "rc=%d\n", rc);
2865 else
2866 gpio_set_value_cansleep(avc_i2c_en_mpp, 1);
2867}
2868
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002869static void __init apq8064_common_init(void)
2870{
Joel King8f839b92012-04-01 14:37:46 -07002871 msm_tsens_early_init(&apq_tsens_pdata);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002872 if (socinfo_init() < 0)
2873 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06002874 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
2875 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
David Collins2782b5c2012-02-06 10:02:42 -08002876 regulator_suppress_info_printing();
2877 platform_device_register(&apq8064_device_rpm_regulator);
Stephen Boyd4d0d2582012-02-10 14:49:40 -08002878 if (msm_xo_init())
2879 pr_err("Failed to initialize XO votes\n");
Matt Wagantallc51e5602012-02-27 17:25:25 -08002880 msm_clock_init(&apq8064_clock_init_data);
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08002881 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06002882 apq8064_i2c_init();
Jing Lin417fa452012-02-05 14:31:06 -08002883 register_i2c_devices();
Kenneth Heitke36920d32011-07-20 16:44:30 -06002884
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002885 apq8064_device_qup_spi_gsbi5.dev.platform_data =
2886 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08002887 apq8064_init_pmic();
Hemant Kumar94e7da22012-02-03 16:52:29 -08002888 if (machine_is_apq8064_liquid())
2889 msm_otg_pdata.mhl_enable = true;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07002890
Ofir Cohen94213a72012-05-03 14:26:32 +03002891 android_usb_pdata.swfi_latency =
2892 msm_rpmrs_levels[0].latency_us;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07002893
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002894 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Manu Gautam91223e02011-11-08 15:27:22 +05302895 apq8064_ehci_host_init();
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002896 apq8064_init_buses();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002897 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Terence Hampson36b70722012-05-10 13:18:16 -04002898 if (!(machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
2899 machine_is_mpq8064_dtv()))
2900 platform_add_devices(common_not_mpq_devices,
2901 ARRAY_SIZE(common_not_mpq_devices));
Jay Chokshi994ff122012-03-27 15:43:48 -07002902 enable_ddr3_regulator();
Hemant Kumarf1ca9192012-02-07 18:59:33 -08002903 if (machine_is_apq8064_mtp()) {
2904 apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
2905 device_initialize(&apq8064_device_hsic_host.dev);
2906 }
Jay Chokshie8741282012-01-25 15:22:55 -08002907 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05302908 apq8064_init_mmc();
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08002909
2910 if (machine_is_apq8064_mtp()) {
2911 mdm_8064_device.dev.platform_data = &mdm_platform_data;
2912 platform_device_register(&mdm_8064_device);
2913 }
2914 platform_device_register(&apq8064_slim_ctrl);
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002915 slim_register_board_info(apq8064_slim_devices,
2916 ARRAY_SIZE(apq8064_slim_devices));
Jin Hongd3024e62012-02-09 16:13:32 -08002917 apq8064_init_dsps();
Praveen Chidambaram78499012011-11-01 17:15:17 -06002918 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Mahesh Sivasubramaniancbce1ec2012-01-24 10:32:44 -07002919 acpuclk_init(&acpuclk_8064_soc_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002920 msm_spm_l2_init(msm_spm_l2_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002921 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Praveen Chidambaram4d19be42012-04-03 18:05:52 -06002922 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002923 apq8064_epm_adc_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002924}
2925
Huaibin Yang4a084e32011-12-15 15:25:52 -08002926static void __init apq8064_allocate_memory_regions(void)
2927{
2928 apq8064_allocate_fb_region();
2929}
2930
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002931static void __init apq8064_sim_init(void)
2932{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002933 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
2934 &msm8064_device_watchdog.dev.platform_data;
2935
2936 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002937 apq8064_common_init();
Joel King4e7ad222011-08-17 15:47:38 -07002938 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
2939}
2940
2941static void __init apq8064_rumi3_init(void)
2942{
2943 apq8064_common_init();
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002944 ethernet_init();
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002945 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002946 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002947}
2948
Joel King82b7e3f2012-01-05 10:03:27 -08002949static void __init apq8064_cdp_init(void)
2950{
Hanumant Singh50440d42012-04-23 19:27:16 -07002951 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2952 pr_err("meminfo_init() failed!\n");
Joel King82b7e3f2012-01-05 10:03:27 -08002953 apq8064_common_init();
Joel King8f839b92012-04-01 14:37:46 -07002954 if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
2955 machine_is_mpq8064_dtv()) {
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002956 enable_avc_i2c_bus();
Joel King8f839b92012-04-01 14:37:46 -07002957 platform_add_devices(mpq_devices, ARRAY_SIZE(mpq_devices));
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002958 mpq8064_pcie_init();
Joel King8f839b92012-04-01 14:37:46 -07002959 } else {
2960 ethernet_init();
2961 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
2962 spi_register_board_info(spi_board_info,
2963 ARRAY_SIZE(spi_board_info));
2964 }
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002965 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07002966 apq8064_init_gpu();
Matt Wagantall1f65d9d2012-04-25 14:24:20 -07002967 platform_add_devices(apq8064_footswitch, apq8064_num_footswitch);
Kevin Chand07220e2012-02-13 15:52:22 -08002968 apq8064_init_cam();
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302969
2970 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
2971 platform_device_register(&cdp_kp_pdev);
2972
2973 if (machine_is_apq8064_mtp())
2974 platform_device_register(&mtp_kp_pdev);
Hanumant Singh50440d42012-04-23 19:27:16 -07002975
2976 change_memory_power = &apq8064_change_memory_power;
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05302977
2978 if (machine_is_mpq8064_cdp()) {
2979 platform_device_register(&mpq_gpio_keys_pdev);
2980 platform_device_register(&mpq_keypad_device);
2981 }
Joel King82b7e3f2012-01-05 10:03:27 -08002982}
2983
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002984MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
2985 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002986 .reserve = apq8064_reserve,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002987 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302988 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002989 .timer = &msm_timer,
2990 .init_machine = apq8064_sim_init,
2991MACHINE_END
2992
Joel King4e7ad222011-08-17 15:47:38 -07002993MACHINE_START(APQ8064_RUMI3, "QCT APQ8064 RUMI3")
2994 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002995 .reserve = apq8064_reserve,
Joel King4e7ad222011-08-17 15:47:38 -07002996 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302997 .handle_irq = gic_handle_irq,
Joel King4e7ad222011-08-17 15:47:38 -07002998 .timer = &msm_timer,
2999 .init_machine = apq8064_rumi3_init,
Huaibin Yang4a084e32011-12-15 15:25:52 -08003000 .init_early = apq8064_allocate_memory_regions,
Joel King4e7ad222011-08-17 15:47:38 -07003001MACHINE_END
3002
Joel King82b7e3f2012-01-05 10:03:27 -08003003MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
3004 .map_io = apq8064_map_io,
3005 .reserve = apq8064_reserve,
3006 .init_irq = apq8064_init_irq,
3007 .handle_irq = gic_handle_irq,
3008 .timer = &msm_timer,
3009 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003010 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003011 .init_very_early = apq8064_early_reserve,
Joel King82b7e3f2012-01-05 10:03:27 -08003012MACHINE_END
3013
3014MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
3015 .map_io = apq8064_map_io,
3016 .reserve = apq8064_reserve,
3017 .init_irq = apq8064_init_irq,
3018 .handle_irq = gic_handle_irq,
3019 .timer = &msm_timer,
3020 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003021 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003022 .init_very_early = apq8064_early_reserve,
Joel King82b7e3f2012-01-05 10:03:27 -08003023MACHINE_END
3024
3025MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
3026 .map_io = apq8064_map_io,
3027 .reserve = apq8064_reserve,
3028 .init_irq = apq8064_init_irq,
3029 .handle_irq = gic_handle_irq,
3030 .timer = &msm_timer,
3031 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003032 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003033 .init_very_early = apq8064_early_reserve,
Joel King82b7e3f2012-01-05 10:03:27 -08003034MACHINE_END
3035
Joel King064bbf82012-04-01 13:23:39 -07003036MACHINE_START(MPQ8064_CDP, "QCT MPQ8064 CDP")
3037 .map_io = apq8064_map_io,
3038 .reserve = apq8064_reserve,
3039 .init_irq = apq8064_init_irq,
3040 .handle_irq = gic_handle_irq,
3041 .timer = &msm_timer,
3042 .init_machine = apq8064_cdp_init,
3043 .init_early = apq8064_allocate_memory_regions,
3044 .init_very_early = apq8064_early_reserve,
3045MACHINE_END
3046
Joel King11ca8202012-02-13 16:19:03 -08003047MACHINE_START(MPQ8064_HRD, "QCT MPQ8064 HRD")
3048 .map_io = apq8064_map_io,
3049 .reserve = apq8064_reserve,
3050 .init_irq = apq8064_init_irq,
3051 .handle_irq = gic_handle_irq,
3052 .timer = &msm_timer,
3053 .init_machine = apq8064_cdp_init,
Joel King3a57e772012-05-28 11:22:55 -07003054 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003055 .init_very_early = apq8064_early_reserve,
Joel King11ca8202012-02-13 16:19:03 -08003056MACHINE_END
3057
3058MACHINE_START(MPQ8064_DTV, "QCT MPQ8064 DTV")
3059 .map_io = apq8064_map_io,
3060 .reserve = apq8064_reserve,
3061 .init_irq = apq8064_init_irq,
3062 .handle_irq = gic_handle_irq,
3063 .timer = &msm_timer,
3064 .init_machine = apq8064_cdp_init,
Joel King3a57e772012-05-28 11:22:55 -07003065 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003066 .init_very_early = apq8064_early_reserve,
Joel King11ca8202012-02-13 16:19:03 -08003067MACHINE_END
3068