blob: a8e17fdabd92e953348f3af6c0ba62e71b518acf [file] [log] [blame]
Manu Gautam5143b252012-01-05 19:25:23 -08001/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13#include <linux/kernel.h>
14#include <linux/platform_device.h>
15#include <linux/io.h>
16#include <linux/irq.h>
Kenneth Heitke748593a2011-07-15 15:45:11 -060017#include <linux/i2c.h>
David Keitel2f613d92012-02-15 11:29:16 -080018#include <linux/i2c/smb349.h>
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -080019#include <linux/i2c/sx150x.h>
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -060020#include <linux/slimbus/slimbus.h>
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +053021#include <linux/mfd/wcd9xxx/core.h>
22#include <linux/mfd/wcd9xxx/pdata.h>
Amy Maloche70090f992012-02-16 16:35:26 -080023#include <linux/mfd/pm8xxx/misc.h>
Kenneth Heitke36920d32011-07-20 16:44:30 -060024#include <linux/msm_ssbi.h>
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -070025#include <linux/spi/spi.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070026#include <linux/dma-mapping.h>
27#include <linux/platform_data/qcom_crypto_device.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080028#include <linux/ion.h>
Jack Cheung46bfffa2012-01-19 15:26:24 -080029#include <linux/memory.h>
Larry Bassel67b921d2012-04-06 10:23:27 -070030#include <linux/memblock.h>
Jing Lin21ed4de2012-02-05 15:53:28 -080031#include <linux/i2c/atmel_mxt_ts.h>
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -080032#include <linux/cyttsp.h>
Amy Maloche70090f992012-02-16 16:35:26 -080033#include <linux/i2c/isa1200.h>
Mohan Pallaka474b94b2012-01-25 12:59:58 +053034#include <linux/gpio_keys.h>
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -080035#include <linux/epm_adc.h>
Jay Chokshie7d8d4f2012-04-04 14:47:57 -070036#include <linux/i2c/sx150x.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070037#include <asm/mach-types.h>
38#include <asm/mach/arch.h>
39#include <asm/hardware/gic.h>
Sahitya Tummala3586ed92011-08-03 09:13:23 +053040#include <asm/mach/mmc.h>
Ankit Verma6b7e2ba2012-01-26 15:48:54 -080041#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070042
43#include <mach/board.h>
44#include <mach/msm_iomap.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080045#include <mach/ion.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070046#include <linux/usb/msm_hsusb.h>
47#include <linux/usb/android.h>
48#include <mach/socinfo.h>
Harini Jayaramanc4c58692011-07-19 14:50:10 -060049#include <mach/msm_spi.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070050#include "timer.h"
51#include "devices.h"
Joel King4ebccc62011-07-22 09:43:22 -070052#include <mach/gpio.h>
53#include <mach/gpiomux.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060054#include <mach/rpm.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080055#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -070056#include <linux/android_pmem.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080057#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070058#include <mach/msm_memtypes.h>
59#include <linux/bootmem.h>
60#include <asm/setup.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070061#include <mach/dma.h>
Jin Hongd3024e62012-02-09 16:13:32 -080062#include <mach/msm_dsps.h>
Gagan Mac8a7a5d32011-11-11 16:43:06 -070063#include <mach/msm_bus_board.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060064#include <mach/cpuidle.h>
Joel Kingdacbc822012-01-25 13:30:57 -080065#include <mach/mdm2.h>
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -080066#include <linux/msm_tsens.h>
Stephen Boyd4d0d2582012-02-10 14:49:40 -080067#include <mach/msm_xo.h>
Laura Abbott350c8362012-02-28 14:46:52 -080068#include <mach/msm_rtb.h>
Santosh Mardieff9a742012-04-09 23:23:39 +053069#include <sound/cs8427.h>
Ravi Kumar V05931a22012-04-04 17:09:37 +053070#include <media/gpio-ir-recv.h>
Larry Bassel67b921d2012-04-06 10:23:27 -070071#include <linux/fmem.h>
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -060072#include <mach/msm_pcie.h>
Joel King4ebccc62011-07-22 09:43:22 -070073
Jeff Ohlstein7e668552011-10-06 16:17:25 -070074#include "msm_watchdog.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080075#include "board-8064.h"
Vikram Mulukutlabc2e9572011-11-04 03:41:38 -070076#include "acpuclock.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060077#include "spm.h"
Subhash Jadavani909e04f2012-04-12 10:52:50 +053078#include <mach/mpm.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060079#include "rpm_resources.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080080#include "pm.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060081#include "pm-boot.h"
Rajesh Sastrulaaee8af32012-01-20 11:46:31 -080082#include "devices-msm8x60.h"
Hanumant Singh50440d42012-04-23 19:27:16 -070083#include "smd_private.h"
Jay Chokshiea67c622011-07-29 17:12:26 -070084
Olav Haugan7c6aa742012-01-16 16:47:37 -080085#define MSM_PMEM_ADSP_SIZE 0x7800000
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -070086#define MSM_PMEM_AUDIO_SIZE 0x4CF000
Olav Haugan7c6aa742012-01-16 16:47:37 -080087#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
88#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
89#else
Chetan Kalyan72aac4f2012-02-23 14:56:54 -080090#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Olav Haugan7c6aa742012-01-16 16:47:37 -080091#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070092
Olav Haugan7c6aa742012-01-16 16:47:37 -080093#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -070094#define MSM_PMEM_KERNEL_EBI1_SIZE 0x65000
Olav Haugan129992c2012-03-22 09:54:01 -070095#ifdef CONFIG_MSM_IOMMU
96#define MSM_ION_MM_SIZE 0x3800000
97#define MSM_ION_SF_SIZE 0
Olav Haugan39477bb2012-05-14 16:05:36 -070098#define MSM_ION_QSECOM_SIZE 0x780000 /* (7.5MB) */
Olav Haugan129992c2012-03-22 09:54:01 -070099#define MSM_ION_HEAP_NUM 7
100#else
Olav Haugan7c6aa742012-01-16 16:47:37 -0800101#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Haugan129992c2012-03-22 09:54:01 -0700102#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Haugan39477bb2012-05-14 16:05:36 -0700103#define MSM_ION_QSECOM_SIZE 0x600000 /* (6MB) */
Olav Haugan129992c2012-03-22 09:54:01 -0700104#define MSM_ION_HEAP_NUM 8
105#endif
106#define MSM_ION_MM_FW_SIZE 0x200000 /* (2MB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800107#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan2c43fac2012-01-19 11:06:37 -0800108#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Olav Haugan7c6aa742012-01-16 16:47:37 -0800109#else
110#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
111#define MSM_ION_HEAP_NUM 1
112#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700113
Larry Bassel67b921d2012-04-06 10:23:27 -0700114#define APQ8064_FIXED_AREA_START 0xa0000000
115#define MAX_FIXED_AREA_SIZE 0x10000000
116#define MSM_MM_FW_SIZE 0x200000
117#define APQ8064_FW_START (APQ8064_FIXED_AREA_START - MSM_MM_FW_SIZE)
118
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -0600119/* PCIe power enable pmic gpio */
120#define PCIE_PWR_EN_PMIC_GPIO 13
121#define PCIE_RST_N_PMIC_MPP 1
122
Olav Haugan7c6aa742012-01-16 16:47:37 -0800123#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
124static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
125static int __init pmem_kernel_ebi1_size_setup(char *p)
Kevin Chan13be4e22011-10-20 11:30:32 -0700126{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800127 pmem_kernel_ebi1_size = memparse(p, NULL);
128 return 0;
Kevin Chan13be4e22011-10-20 11:30:32 -0700129}
Olav Haugan7c6aa742012-01-16 16:47:37 -0800130early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
131#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700132
Olav Haugan7c6aa742012-01-16 16:47:37 -0800133#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -0700134static unsigned pmem_size = MSM_PMEM_SIZE;
135static int __init pmem_size_setup(char *p)
136{
137 pmem_size = memparse(p, NULL);
138 return 0;
139}
140early_param("pmem_size", pmem_size_setup);
141
142static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
143
144static int __init pmem_adsp_size_setup(char *p)
145{
146 pmem_adsp_size = memparse(p, NULL);
147 return 0;
148}
149early_param("pmem_adsp_size", pmem_adsp_size_setup);
150
151static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
152
153static int __init pmem_audio_size_setup(char *p)
154{
155 pmem_audio_size = memparse(p, NULL);
156 return 0;
157}
158early_param("pmem_audio_size", pmem_audio_size_setup);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800159#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700160
Olav Haugan7c6aa742012-01-16 16:47:37 -0800161#ifdef CONFIG_ANDROID_PMEM
162#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700163static struct android_pmem_platform_data android_pmem_pdata = {
164 .name = "pmem",
165 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
166 .cached = 1,
167 .memory_type = MEMTYPE_EBI1,
168};
169
Laura Abbottb93525f2012-04-12 09:57:19 -0700170static struct platform_device apq8064_android_pmem_device = {
Kevin Chan13be4e22011-10-20 11:30:32 -0700171 .name = "android_pmem",
172 .id = 0,
173 .dev = {.platform_data = &android_pmem_pdata},
174};
175
176static struct android_pmem_platform_data android_pmem_adsp_pdata = {
177 .name = "pmem_adsp",
178 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
179 .cached = 0,
180 .memory_type = MEMTYPE_EBI1,
181};
Laura Abbottb93525f2012-04-12 09:57:19 -0700182static struct platform_device apq8064_android_pmem_adsp_device = {
Kevin Chan13be4e22011-10-20 11:30:32 -0700183 .name = "android_pmem",
184 .id = 2,
185 .dev = { .platform_data = &android_pmem_adsp_pdata },
186};
187
188static struct android_pmem_platform_data android_pmem_audio_pdata = {
189 .name = "pmem_audio",
190 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
191 .cached = 0,
192 .memory_type = MEMTYPE_EBI1,
193};
194
Laura Abbottb93525f2012-04-12 09:57:19 -0700195static struct platform_device apq8064_android_pmem_audio_device = {
Kevin Chan13be4e22011-10-20 11:30:32 -0700196 .name = "android_pmem",
197 .id = 4,
198 .dev = { .platform_data = &android_pmem_audio_pdata },
199};
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700200#endif /* CONFIG_MSM_MULTIMEDIA_USE_ION */
201#endif /* CONFIG_ANDROID_PMEM */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800202
Larry Bassel67b921d2012-04-06 10:23:27 -0700203struct fmem_platform_data apq8064_fmem_pdata = {
204};
205
Olav Haugan7c6aa742012-01-16 16:47:37 -0800206static struct memtype_reserve apq8064_reserve_table[] __initdata = {
207 [MEMTYPE_SMI] = {
208 },
209 [MEMTYPE_EBI0] = {
210 .flags = MEMTYPE_FLAGS_1M_ALIGN,
211 },
212 [MEMTYPE_EBI1] = {
213 .flags = MEMTYPE_FLAGS_1M_ALIGN,
214 },
215};
Kevin Chan13be4e22011-10-20 11:30:32 -0700216
Laura Abbott350c8362012-02-28 14:46:52 -0800217static void __init reserve_rtb_memory(void)
218{
219#if defined(CONFIG_MSM_RTB)
Laura Abbottb93525f2012-04-12 09:57:19 -0700220 apq8064_reserve_table[MEMTYPE_EBI1].size += apq8064_rtb_pdata.size;
Laura Abbott350c8362012-02-28 14:46:52 -0800221#endif
222}
223
224
Kevin Chan13be4e22011-10-20 11:30:32 -0700225static void __init size_pmem_devices(void)
226{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800227#ifdef CONFIG_ANDROID_PMEM
228#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700229 android_pmem_adsp_pdata.size = pmem_adsp_size;
230 android_pmem_pdata.size = pmem_size;
231 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700232#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
233#endif /*CONFIG_ANDROID_PMEM*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700234}
235
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700236#ifdef CONFIG_ANDROID_PMEM
237#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700238static void __init reserve_memory_for(struct android_pmem_platform_data *p)
239{
240 apq8064_reserve_table[p->memory_type].size += p->size;
241}
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700242#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
243#endif /*CONFIG_ANDROID_PMEM*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700244
Kevin Chan13be4e22011-10-20 11:30:32 -0700245static void __init reserve_pmem_memory(void)
246{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800247#ifdef CONFIG_ANDROID_PMEM
248#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700249 reserve_memory_for(&android_pmem_adsp_pdata);
250 reserve_memory_for(&android_pmem_pdata);
251 reserve_memory_for(&android_pmem_audio_pdata);
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700252#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700253 apq8064_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700254#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -0800255}
256
257static int apq8064_paddr_to_memtype(unsigned int paddr)
258{
259 return MEMTYPE_EBI1;
260}
261
Larry Bassel67b921d2012-04-06 10:23:27 -0700262#define FMEM_ENABLED 1
263
Olav Haugan7c6aa742012-01-16 16:47:37 -0800264#ifdef CONFIG_ION_MSM
265#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -0700266static struct ion_cp_heap_pdata cp_mm_apq8064_ion_pdata = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800267 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugand3d29682012-01-19 10:57:07 -0800268 .align = PAGE_SIZE,
Larry Bassel67b921d2012-04-06 10:23:27 -0700269 .reusable = FMEM_ENABLED,
270 .mem_is_fmem = FMEM_ENABLED,
271 .fixed_position = FIXED_MIDDLE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800272};
273
Laura Abbottb93525f2012-04-12 09:57:19 -0700274static struct ion_cp_heap_pdata cp_mfc_apq8064_ion_pdata = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800275 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugand3d29682012-01-19 10:57:07 -0800276 .align = PAGE_SIZE,
Larry Bassel67b921d2012-04-06 10:23:27 -0700277 .reusable = 0,
278 .mem_is_fmem = FMEM_ENABLED,
279 .fixed_position = FIXED_HIGH,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800280};
281
Laura Abbottb93525f2012-04-12 09:57:19 -0700282static struct ion_co_heap_pdata co_apq8064_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800283 .adjacent_mem_id = INVALID_HEAP_ID,
284 .align = PAGE_SIZE,
Larry Bassel67b921d2012-04-06 10:23:27 -0700285 .mem_is_fmem = 0,
Olav Haugand3d29682012-01-19 10:57:07 -0800286};
287
Laura Abbottb93525f2012-04-12 09:57:19 -0700288static struct ion_co_heap_pdata fw_co_apq8064_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800289 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
290 .align = SZ_128K,
Larry Bassel67b921d2012-04-06 10:23:27 -0700291 .mem_is_fmem = FMEM_ENABLED,
292 .fixed_position = FIXED_LOW,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800293};
294#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800295
296/**
297 * These heaps are listed in the order they will be allocated. Due to
298 * video hardware restrictions and content protection the FW heap has to
299 * be allocated adjacent (below) the MM heap and the MFC heap has to be
300 * allocated after the MM heap to ensure MFC heap is not more than 256MB
301 * away from the base address of the FW heap.
302 * However, the order of FW heap and MM heap doesn't matter since these
303 * two heaps are taken care of by separate code to ensure they are adjacent
304 * to each other.
305 * Don't swap the order unless you know what you are doing!
306 */
Laura Abbottb93525f2012-04-12 09:57:19 -0700307static struct ion_platform_data apq8064_ion_pdata = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800308 .nr = MSM_ION_HEAP_NUM,
309 .heaps = {
310 {
311 .id = ION_SYSTEM_HEAP_ID,
312 .type = ION_HEAP_TYPE_SYSTEM,
313 .name = ION_VMALLOC_HEAP_NAME,
314 },
315#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
316 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800317 .id = ION_CP_MM_HEAP_ID,
318 .type = ION_HEAP_TYPE_CP,
319 .name = ION_MM_HEAP_NAME,
320 .size = MSM_ION_MM_SIZE,
321 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700322 .extra_data = (void *) &cp_mm_apq8064_ion_pdata,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800323 },
324 {
Olav Haugand3d29682012-01-19 10:57:07 -0800325 .id = ION_MM_FIRMWARE_HEAP_ID,
326 .type = ION_HEAP_TYPE_CARVEOUT,
327 .name = ION_MM_FIRMWARE_HEAP_NAME,
328 .size = MSM_ION_MM_FW_SIZE,
329 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700330 .extra_data = (void *) &fw_co_apq8064_ion_pdata,
Olav Haugand3d29682012-01-19 10:57:07 -0800331 },
332 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800333 .id = ION_CP_MFC_HEAP_ID,
334 .type = ION_HEAP_TYPE_CP,
335 .name = ION_MFC_HEAP_NAME,
336 .size = MSM_ION_MFC_SIZE,
337 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700338 .extra_data = (void *) &cp_mfc_apq8064_ion_pdata,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800339 },
Olav Haugan129992c2012-03-22 09:54:01 -0700340#ifndef CONFIG_MSM_IOMMU
Olav Haugan7c6aa742012-01-16 16:47:37 -0800341 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800342 .id = ION_SF_HEAP_ID,
343 .type = ION_HEAP_TYPE_CARVEOUT,
344 .name = ION_SF_HEAP_NAME,
345 .size = MSM_ION_SF_SIZE,
346 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700347 .extra_data = (void *) &co_apq8064_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800348 },
Olav Haugan129992c2012-03-22 09:54:01 -0700349#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800350 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800351 .id = ION_IOMMU_HEAP_ID,
352 .type = ION_HEAP_TYPE_IOMMU,
353 .name = ION_IOMMU_HEAP_NAME,
354 },
Olav Hauganf45e2142012-01-19 11:01:01 -0800355 {
356 .id = ION_QSECOM_HEAP_ID,
357 .type = ION_HEAP_TYPE_CARVEOUT,
358 .name = ION_QSECOM_HEAP_NAME,
359 .size = MSM_ION_QSECOM_SIZE,
360 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700361 .extra_data = (void *) &co_apq8064_ion_pdata,
Olav Hauganf45e2142012-01-19 11:01:01 -0800362 },
Olav Haugan2c43fac2012-01-19 11:06:37 -0800363 {
364 .id = ION_AUDIO_HEAP_ID,
365 .type = ION_HEAP_TYPE_CARVEOUT,
366 .name = ION_AUDIO_HEAP_NAME,
367 .size = MSM_ION_AUDIO_SIZE,
368 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700369 .extra_data = (void *) &co_apq8064_ion_pdata,
Olav Haugan2c43fac2012-01-19 11:06:37 -0800370 },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800371#endif
372 }
373};
374
Laura Abbottb93525f2012-04-12 09:57:19 -0700375static struct platform_device apq8064_ion_dev = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800376 .name = "ion-msm",
377 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700378 .dev = { .platform_data = &apq8064_ion_pdata },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800379};
380#endif
381
Larry Bassel67b921d2012-04-06 10:23:27 -0700382static struct platform_device apq8064_fmem_device = {
383 .name = "fmem",
384 .id = 1,
385 .dev = { .platform_data = &apq8064_fmem_pdata },
386};
387
388static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
389 unsigned long size)
390{
391 apq8064_reserve_table[mem_type].size += size;
392}
393
394static void __init apq8064_reserve_fixed_area(unsigned long fixed_area_size)
395{
396#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
397 int ret;
398
399 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
400 panic("fixed area size is larger than %dM\n",
401 MAX_FIXED_AREA_SIZE >> 20);
402
403 reserve_info->fixed_area_size = fixed_area_size;
404 reserve_info->fixed_area_start = APQ8064_FW_START;
405
406 ret = memblock_remove(reserve_info->fixed_area_start,
407 reserve_info->fixed_area_size);
408 BUG_ON(ret);
409#endif
410}
411
412/**
413 * Reserve memory for ION and calculate amount of reusable memory for fmem.
414 * We only reserve memory for heaps that are not reusable. However, we only
415 * support one reusable heap at the moment so we ignore the reusable flag for
416 * other than the first heap with reusable flag set. Also handle special case
417 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
418 * at a higher address than FW in addition to not more than 256MB away from the
419 * base address of the firmware. This means that if MM is reusable the other
420 * two heaps must be allocated in the same region as FW. This is handled by the
421 * mem_is_fmem flag in the platform data. In addition the MM heap must be
422 * adjacent to the FW heap for content protection purposes.
423 */
Stephen Boyd668d7652012-04-25 11:31:01 -0700424static void __init reserve_ion_memory(void)
Olav Haugan7c6aa742012-01-16 16:47:37 -0800425{
426#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Larry Bassel67b921d2012-04-06 10:23:27 -0700427 unsigned int i;
428 unsigned int reusable_count = 0;
429 unsigned int fixed_size = 0;
430 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
431 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
432
433 apq8064_fmem_pdata.size = 0;
434 apq8064_fmem_pdata.reserved_size_low = 0;
435 apq8064_fmem_pdata.reserved_size_high = 0;
Olav Haugan62436252012-05-16 09:09:43 -0700436 apq8064_fmem_pdata.align = PAGE_SIZE;
Larry Bassel67b921d2012-04-06 10:23:27 -0700437 fixed_low_size = 0;
438 fixed_middle_size = 0;
439 fixed_high_size = 0;
440
441 /* We only support 1 reusable heap. Check if more than one heap
442 * is specified as reusable and set as non-reusable if found.
443 */
444 for (i = 0; i < apq8064_ion_pdata.nr; ++i) {
445 const struct ion_platform_heap *heap =
446 &(apq8064_ion_pdata.heaps[i]);
447
448 if (heap->type == ION_HEAP_TYPE_CP && heap->extra_data) {
449 struct ion_cp_heap_pdata *data = heap->extra_data;
450
451 reusable_count += (data->reusable) ? 1 : 0;
452
453 if (data->reusable && reusable_count > 1) {
454 pr_err("%s: Too many heaps specified as "
455 "reusable. Heap %s was not configured "
456 "as reusable.\n", __func__, heap->name);
457 data->reusable = 0;
458 }
459 }
460 }
461
462 for (i = 0; i < apq8064_ion_pdata.nr; ++i) {
463 const struct ion_platform_heap *heap =
464 &(apq8064_ion_pdata.heaps[i]);
465
466 if (heap->extra_data) {
467 int fixed_position = NOT_FIXED;
468 int mem_is_fmem = 0;
469
470 switch (heap->type) {
471 case ION_HEAP_TYPE_CP:
472 mem_is_fmem = ((struct ion_cp_heap_pdata *)
473 heap->extra_data)->mem_is_fmem;
474 fixed_position = ((struct ion_cp_heap_pdata *)
475 heap->extra_data)->fixed_position;
476 break;
477 case ION_HEAP_TYPE_CARVEOUT:
478 mem_is_fmem = ((struct ion_co_heap_pdata *)
479 heap->extra_data)->mem_is_fmem;
480 fixed_position = ((struct ion_co_heap_pdata *)
481 heap->extra_data)->fixed_position;
482 break;
483 default:
484 break;
485 }
486
487 if (fixed_position != NOT_FIXED)
488 fixed_size += heap->size;
489 else
490 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
491
492 if (fixed_position == FIXED_LOW)
493 fixed_low_size += heap->size;
494 else if (fixed_position == FIXED_MIDDLE)
495 fixed_middle_size += heap->size;
496 else if (fixed_position == FIXED_HIGH)
497 fixed_high_size += heap->size;
498
499 if (mem_is_fmem)
500 apq8064_fmem_pdata.size += heap->size;
501 }
502 }
503
504 if (!fixed_size)
505 return;
506
507 if (apq8064_fmem_pdata.size) {
508 apq8064_fmem_pdata.reserved_size_low = fixed_low_size;
509 apq8064_fmem_pdata.reserved_size_high = fixed_high_size;
510 }
511
512 /* Since the fixed area may be carved out of lowmem,
513 * make sure the length is a multiple of 1M.
514 */
515 fixed_size = (fixed_size + MSM_MM_FW_SIZE + SECTION_SIZE - 1)
516 & SECTION_MASK;
517 apq8064_reserve_fixed_area(fixed_size);
518
519 fixed_low_start = APQ8064_FIXED_AREA_START;
520 fixed_middle_start = fixed_low_start + fixed_low_size;
521 fixed_high_start = fixed_middle_start + fixed_middle_size;
522
523 for (i = 0; i < apq8064_ion_pdata.nr; ++i) {
524 struct ion_platform_heap *heap = &(apq8064_ion_pdata.heaps[i]);
525
526 if (heap->extra_data) {
527 int fixed_position = NOT_FIXED;
528
529 switch (heap->type) {
530 case ION_HEAP_TYPE_CP:
531 fixed_position = ((struct ion_cp_heap_pdata *)
532 heap->extra_data)->fixed_position;
533 break;
534 case ION_HEAP_TYPE_CARVEOUT:
535 fixed_position = ((struct ion_co_heap_pdata *)
536 heap->extra_data)->fixed_position;
537 break;
538 default:
539 break;
540 }
541
542 switch (fixed_position) {
543 case FIXED_LOW:
544 heap->base = fixed_low_start;
545 break;
546 case FIXED_MIDDLE:
547 heap->base = fixed_middle_start;
548 break;
549 case FIXED_HIGH:
550 heap->base = fixed_high_start;
551 break;
552 default:
553 break;
554 }
555 }
556 }
Olav Haugan7c6aa742012-01-16 16:47:37 -0800557#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700558}
559
Huaibin Yang4a084e32011-12-15 15:25:52 -0800560static void __init reserve_mdp_memory(void)
561{
562 apq8064_mdp_writeback(apq8064_reserve_table);
563}
564
Kevin Chan13be4e22011-10-20 11:30:32 -0700565static void __init apq8064_calculate_reserve_sizes(void)
566{
567 size_pmem_devices();
568 reserve_pmem_memory();
Olav Haugan7c6aa742012-01-16 16:47:37 -0800569 reserve_ion_memory();
Huaibin Yang4a084e32011-12-15 15:25:52 -0800570 reserve_mdp_memory();
Laura Abbott350c8362012-02-28 14:46:52 -0800571 reserve_rtb_memory();
Kevin Chan13be4e22011-10-20 11:30:32 -0700572}
573
574static struct reserve_info apq8064_reserve_info __initdata = {
575 .memtype_reserve_table = apq8064_reserve_table,
576 .calculate_reserve_sizes = apq8064_calculate_reserve_sizes,
Larry Bassel67b921d2012-04-06 10:23:27 -0700577 .reserve_fixed_area = apq8064_reserve_fixed_area,
Kevin Chan13be4e22011-10-20 11:30:32 -0700578 .paddr_to_memtype = apq8064_paddr_to_memtype,
579};
580
581static int apq8064_memory_bank_size(void)
582{
583 return 1<<29;
584}
585
586static void __init locate_unstable_memory(void)
587{
588 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
589 unsigned long bank_size;
590 unsigned long low, high;
591
592 bank_size = apq8064_memory_bank_size();
593 low = meminfo.bank[0].start;
594 high = mb->start + mb->size;
Olav Haugand76e3a82012-01-16 16:55:07 -0800595
596 /* Check if 32 bit overflow occured */
597 if (high < mb->start)
Larry Bassel67b921d2012-04-06 10:23:27 -0700598 high = -PAGE_SIZE;
Olav Haugand76e3a82012-01-16 16:55:07 -0800599
Kevin Chan13be4e22011-10-20 11:30:32 -0700600 low &= ~(bank_size - 1);
601
602 if (high - low <= bank_size)
Larry Bassel67b921d2012-04-06 10:23:27 -0700603 goto no_dmm;
604
605#ifdef CONFIG_ENABLE_DMM
Jack Cheung46bfffa2012-01-19 15:26:24 -0800606 apq8064_reserve_info.low_unstable_address = mb->start -
607 MIN_MEMORY_BLOCK_SIZE + mb->size;
608 apq8064_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
609
Kevin Chan13be4e22011-10-20 11:30:32 -0700610 apq8064_reserve_info.bank_size = bank_size;
611 pr_info("low unstable address %lx max size %lx bank size %lx\n",
612 apq8064_reserve_info.low_unstable_address,
613 apq8064_reserve_info.max_unstable_size,
614 apq8064_reserve_info.bank_size);
Larry Bassel67b921d2012-04-06 10:23:27 -0700615 return;
616#endif
617no_dmm:
618 apq8064_reserve_info.low_unstable_address = high;
619 apq8064_reserve_info.max_unstable_size = 0;
Kevin Chan13be4e22011-10-20 11:30:32 -0700620}
621
Hanumant Singh50440d42012-04-23 19:27:16 -0700622static int apq8064_change_memory_power(u64 start, u64 size,
623 int change_type)
624{
625 return soc_change_memory_power(start, size, change_type);
626}
627
Aravind Venkateswaran8ac7f412012-03-16 17:57:30 -0700628static char prim_panel_name[PANEL_NAME_MAX_LEN];
629static char ext_panel_name[PANEL_NAME_MAX_LEN];
630static int __init prim_display_setup(char *param)
631{
632 if (strnlen(param, PANEL_NAME_MAX_LEN))
633 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
634 return 0;
635}
636early_param("prim_display", prim_display_setup);
637
638static int __init ext_display_setup(char *param)
639{
640 if (strnlen(param, PANEL_NAME_MAX_LEN))
641 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
642 return 0;
643}
644early_param("ext_display", ext_display_setup);
645
Kevin Chan13be4e22011-10-20 11:30:32 -0700646static void __init apq8064_reserve(void)
647{
Aravind Venkateswaran8ac7f412012-03-16 17:57:30 -0700648 apq8064_set_display_params(prim_panel_name, ext_panel_name);
Kevin Chan13be4e22011-10-20 11:30:32 -0700649 msm_reserve();
Larry Bassel67b921d2012-04-06 10:23:27 -0700650 if (apq8064_fmem_pdata.size) {
651#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
652 if (reserve_info->fixed_area_size) {
653 apq8064_fmem_pdata.phys =
654 reserve_info->fixed_area_start + MSM_MM_FW_SIZE;
655 pr_info("mm fw at %lx (fixed) size %x\n",
656 reserve_info->fixed_area_start, MSM_MM_FW_SIZE);
657 pr_info("fmem start %lx (fixed) size %lx\n",
658 apq8064_fmem_pdata.phys,
659 apq8064_fmem_pdata.size);
660 }
661#endif
662 }
Kevin Chan13be4e22011-10-20 11:30:32 -0700663}
664
Laura Abbott6988cef2012-03-15 14:27:13 -0700665static void __init place_movable_zone(void)
666{
Larry Bassel67b921d2012-04-06 10:23:27 -0700667#ifdef CONFIG_ENABLE_DMM
Laura Abbott6988cef2012-03-15 14:27:13 -0700668 movable_reserved_start = apq8064_reserve_info.low_unstable_address;
669 movable_reserved_size = apq8064_reserve_info.max_unstable_size;
670 pr_info("movable zone start %lx size %lx\n",
671 movable_reserved_start, movable_reserved_size);
Larry Bassel67b921d2012-04-06 10:23:27 -0700672#endif
Laura Abbott6988cef2012-03-15 14:27:13 -0700673}
674
675static void __init apq8064_early_reserve(void)
676{
677 reserve_info = &apq8064_reserve_info;
678 locate_unstable_memory();
679 place_movable_zone();
680
681}
Hemant Kumara945b472012-01-25 15:08:06 -0800682#ifdef CONFIG_USB_EHCI_MSM_HSIC
Hemant Kumare6275972012-02-29 20:06:21 -0800683/* Bandwidth requests (zero) if no vote placed */
684static struct msm_bus_vectors hsic_init_vectors[] = {
685 {
686 .src = MSM_BUS_MASTER_SPS,
687 .dst = MSM_BUS_SLAVE_EBI_CH0,
688 .ab = 0,
689 .ib = 0,
690 },
691 {
692 .src = MSM_BUS_MASTER_SPS,
693 .dst = MSM_BUS_SLAVE_SPS,
694 .ab = 0,
695 .ib = 0,
696 },
697};
698
699/* Bus bandwidth requests in Bytes/sec */
700static struct msm_bus_vectors hsic_max_vectors[] = {
701 {
702 .src = MSM_BUS_MASTER_SPS,
703 .dst = MSM_BUS_SLAVE_EBI_CH0,
704 .ab = 60000000, /* At least 480Mbps on bus. */
705 .ib = 960000000, /* MAX bursts rate */
706 },
707 {
708 .src = MSM_BUS_MASTER_SPS,
709 .dst = MSM_BUS_SLAVE_SPS,
710 .ab = 0,
711 .ib = 512000000, /*vote for 64Mhz dfab clk rate*/
712 },
713};
714
715static struct msm_bus_paths hsic_bus_scale_usecases[] = {
716 {
717 ARRAY_SIZE(hsic_init_vectors),
718 hsic_init_vectors,
719 },
720 {
721 ARRAY_SIZE(hsic_max_vectors),
722 hsic_max_vectors,
723 },
724};
725
726static struct msm_bus_scale_pdata hsic_bus_scale_pdata = {
727 hsic_bus_scale_usecases,
728 ARRAY_SIZE(hsic_bus_scale_usecases),
729 .name = "hsic",
730};
731
Hemant Kumara945b472012-01-25 15:08:06 -0800732static struct msm_hsic_host_platform_data msm_hsic_pdata = {
Hemant Kumare6275972012-02-29 20:06:21 -0800733 .strobe = 88,
734 .data = 89,
735 .bus_scale_table = &hsic_bus_scale_pdata,
Hemant Kumara945b472012-01-25 15:08:06 -0800736};
737#else
738static struct msm_hsic_host_platform_data msm_hsic_pdata;
739#endif
740
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800741#define PID_MAGIC_ID 0x71432909
742#define SERIAL_NUM_MAGIC_ID 0x61945374
743#define SERIAL_NUMBER_LENGTH 127
744#define DLOAD_USB_BASE_ADD 0x2A03F0C8
745
746struct magic_num_struct {
747 uint32_t pid;
748 uint32_t serial_num;
749};
750
751struct dload_struct {
752 uint32_t reserved1;
753 uint32_t reserved2;
754 uint32_t reserved3;
755 uint16_t reserved4;
756 uint16_t pid;
757 char serial_number[SERIAL_NUMBER_LENGTH];
758 uint16_t reserved5;
759 struct magic_num_struct magic_struct;
760};
761
762static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
763{
764 struct dload_struct __iomem *dload = 0;
765
766 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
767 if (!dload) {
768 pr_err("%s: cannot remap I/O memory region: %08x\n",
769 __func__, DLOAD_USB_BASE_ADD);
770 return -ENXIO;
771 }
772
773 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
774 __func__, dload, pid, snum);
775 /* update pid */
776 dload->magic_struct.pid = PID_MAGIC_ID;
777 dload->pid = pid;
778
779 /* update serial number */
780 dload->magic_struct.serial_num = 0;
781 if (!snum) {
782 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
783 goto out;
784 }
785
786 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
787 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
788out:
789 iounmap(dload);
790 return 0;
791}
792
793static struct android_usb_platform_data android_usb_pdata = {
794 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
795};
796
Hemant Kumar4933b072011-10-17 23:43:11 -0700797static struct platform_device android_usb_device = {
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800798 .name = "android_usb",
799 .id = -1,
800 .dev = {
801 .platform_data = &android_usb_pdata,
802 },
Hemant Kumar4933b072011-10-17 23:43:11 -0700803};
804
Hemant Kumar7620eed2012-02-26 09:08:43 -0800805/* Bandwidth requests (zero) if no vote placed */
806static struct msm_bus_vectors usb_init_vectors[] = {
807 {
808 .src = MSM_BUS_MASTER_SPS,
809 .dst = MSM_BUS_SLAVE_EBI_CH0,
810 .ab = 0,
811 .ib = 0,
812 },
813};
814
815/* Bus bandwidth requests in Bytes/sec */
816static struct msm_bus_vectors usb_max_vectors[] = {
817 {
818 .src = MSM_BUS_MASTER_SPS,
819 .dst = MSM_BUS_SLAVE_EBI_CH0,
820 .ab = 60000000, /* At least 480Mbps on bus. */
821 .ib = 960000000, /* MAX bursts rate */
822 },
823};
824
825static struct msm_bus_paths usb_bus_scale_usecases[] = {
826 {
827 ARRAY_SIZE(usb_init_vectors),
828 usb_init_vectors,
829 },
830 {
831 ARRAY_SIZE(usb_max_vectors),
832 usb_max_vectors,
833 },
834};
835
836static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
837 usb_bus_scale_usecases,
838 ARRAY_SIZE(usb_bus_scale_usecases),
839 .name = "usb",
840};
841
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700842static int phy_init_seq[] = {
843 0x38, 0x81, /* update DC voltage level */
844 0x24, 0x82, /* set pre-emphasis and rise/fall time */
845 -1
846};
847
Hemant Kumar4933b072011-10-17 23:43:11 -0700848static struct msm_otg_platform_data msm_otg_pdata = {
Hemant Kumard86c4882012-01-24 19:39:37 -0800849 .mode = USB_OTG,
850 .otg_control = OTG_PMIC_CONTROL,
Hemant Kumar4933b072011-10-17 23:43:11 -0700851 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Hemant Kumard86c4882012-01-24 19:39:37 -0800852 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
853 .power_budget = 750,
Hemant Kumar7620eed2012-02-26 09:08:43 -0800854 .bus_scale_table = &usb_bus_scale_pdata,
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700855 .phy_init_seq = phy_init_seq,
Hemant Kumar4933b072011-10-17 23:43:11 -0700856};
857
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800858static struct msm_usb_host_platform_data msm_ehci_host_pdata3 = {
Manu Gautam91223e02011-11-08 15:27:22 +0530859 .power_budget = 500,
860};
861
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800862#ifdef CONFIG_USB_EHCI_MSM_HOST4
863static struct msm_usb_host_platform_data msm_ehci_host_pdata4;
864#endif
865
Manu Gautam91223e02011-11-08 15:27:22 +0530866static void __init apq8064_ehci_host_init(void)
867{
Chiranjeevi Velempatib822fa32012-05-23 22:05:59 +0530868 if (machine_is_apq8064_liquid() || machine_is_mpq8064_cdp() ||
869 machine_is_mpq8064_hrd() || machine_is_mpq8064_dtv()) {
870 if (machine_is_apq8064_liquid())
871 msm_ehci_host_pdata3.dock_connect_irq =
872 PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9);
Hemant Kumar56925352012-02-13 16:59:52 -0800873
Manu Gautam91223e02011-11-08 15:27:22 +0530874 apq8064_device_ehci_host3.dev.platform_data =
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800875 &msm_ehci_host_pdata3;
Manu Gautam91223e02011-11-08 15:27:22 +0530876 platform_device_register(&apq8064_device_ehci_host3);
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800877
878#ifdef CONFIG_USB_EHCI_MSM_HOST4
879 apq8064_device_ehci_host4.dev.platform_data =
880 &msm_ehci_host_pdata4;
881 platform_device_register(&apq8064_device_ehci_host4);
882#endif
Manu Gautam91223e02011-11-08 15:27:22 +0530883 }
884}
885
David Keitel2f613d92012-02-15 11:29:16 -0800886static struct smb349_platform_data smb349_data __initdata = {
887 .en_n_gpio = PM8921_GPIO_PM_TO_SYS(37),
888 .chg_susp_gpio = PM8921_GPIO_PM_TO_SYS(30),
889 .chg_current_ma = 2200,
890};
891
892static struct i2c_board_info smb349_charger_i2c_info[] __initdata = {
893 {
894 I2C_BOARD_INFO(SMB349_NAME, 0x1B),
895 .platform_data = &smb349_data,
896 },
897};
898
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -0800899struct sx150x_platform_data apq8064_sx150x_data[] = {
900 [SX150X_EPM] = {
901 .gpio_base = GPIO_EPM_EXPANDER_BASE,
902 .oscio_is_gpo = false,
903 .io_pullup_ena = 0x0,
904 .io_pulldn_ena = 0x0,
905 .io_open_drain_ena = 0x0,
906 .io_polarity = 0,
907 .irq_summary = -1,
908 },
909};
910
911static struct epm_chan_properties ads_adc_channel_data[] = {
912 {10, 100}, {500, 50}, {1, 1}, {1, 1},
913 {20, 50}, {10, 100}, {1, 1}, {1, 1},
914 {10, 100}, {10, 100}, {100, 100}, {200, 100},
915 {100, 50}, {2000, 50}, {1000, 50}, {200, 50},
916 {200, 100}, {1, 1}, {20, 50}, {500, 50},
917 {50, 50}, {200, 100}, {500, 100}, {20, 50},
918 {200, 50}, {2000, 100}, {1000, 50}, {100, 50},
919 {200, 100}, {500, 50}, {1000, 100}, {200, 50},
920 {1000, 50}, {50, 50}, {100, 50}, {100, 50},
921 {1, 1}, {1, 1}, {20, 100}, {20, 50},
922 {500, 100}, {1000, 100}, {100, 50}, {1000, 50},
923 {100, 50}, {1000, 100}, {100, 50}, {100, 50},
924};
925
926static struct epm_adc_platform_data epm_adc_pdata = {
927 .channel = ads_adc_channel_data,
928 .bus_id = 0x0,
929 .epm_i2c_board_info = {
930 .type = "sx1509q",
931 .addr = 0x3e,
932 .platform_data = &apq8064_sx150x_data[SX150X_EPM],
933 },
934 .gpio_expander_base_addr = GPIO_EPM_EXPANDER_BASE,
935};
936
937static struct platform_device epm_adc_device = {
938 .name = "epm_adc",
939 .id = -1,
940 .dev = {
941 .platform_data = &epm_adc_pdata,
942 },
943};
944
945static void __init apq8064_epm_adc_init(void)
946{
947 epm_adc_pdata.num_channels = 32;
948 epm_adc_pdata.num_adc = 2;
949 epm_adc_pdata.chan_per_adc = 16;
950 epm_adc_pdata.chan_per_mux = 8;
951};
952
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800953/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
954 * 4 micbiases are used to power various analog and digital
955 * microphones operating at 1800 mV. Technically, all micbiases
956 * can source from single cfilter since all microphones operate
957 * at the same voltage level. The arrangement below is to make
958 * sure all cfilters are exercised. LDO_H regulator ouput level
959 * does not need to be as high as 2.85V. It is choosen for
960 * microphone sensitivity purpose.
961 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530962static struct wcd9xxx_pdata apq8064_tabla_platform_data = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800963 .slimbus_slave_device = {
964 .name = "tabla-slave",
965 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
966 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800967 .irq = MSM_GPIO_TO_INT(42),
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800968 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530969 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800970 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
971 .micbias = {
972 .ldoh_v = TABLA_LDOH_2P85_V,
973 .cfilt1_mv = 1800,
974 .cfilt2_mv = 1800,
975 .cfilt3_mv = 1800,
976 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
977 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
978 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
979 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530980 },
981 .regulator = {
982 {
983 .name = "CDC_VDD_CP",
984 .min_uV = 1800000,
985 .max_uV = 1800000,
986 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
987 },
988 {
989 .name = "CDC_VDDA_RX",
990 .min_uV = 1800000,
991 .max_uV = 1800000,
992 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
993 },
994 {
995 .name = "CDC_VDDA_TX",
996 .min_uV = 1800000,
997 .max_uV = 1800000,
998 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
999 },
1000 {
1001 .name = "VDDIO_CDC",
1002 .min_uV = 1800000,
1003 .max_uV = 1800000,
1004 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1005 },
1006 {
1007 .name = "VDDD_CDC_D",
1008 .min_uV = 1225000,
1009 .max_uV = 1225000,
1010 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1011 },
1012 {
1013 .name = "CDC_VDDA_A_1P2V",
1014 .min_uV = 1225000,
1015 .max_uV = 1225000,
1016 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1017 },
1018 },
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001019};
1020
1021static struct slim_device apq8064_slim_tabla = {
1022 .name = "tabla-slim",
1023 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
1024 .dev = {
1025 .platform_data = &apq8064_tabla_platform_data,
1026 },
1027};
1028
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301029static struct wcd9xxx_pdata apq8064_tabla20_platform_data = {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001030 .slimbus_slave_device = {
1031 .name = "tabla-slave",
1032 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
1033 },
1034 .irq = MSM_GPIO_TO_INT(42),
1035 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301036 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001037 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
1038 .micbias = {
1039 .ldoh_v = TABLA_LDOH_2P85_V,
1040 .cfilt1_mv = 1800,
1041 .cfilt2_mv = 1800,
1042 .cfilt3_mv = 1800,
1043 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
1044 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
1045 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
1046 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301047 },
1048 .regulator = {
1049 {
1050 .name = "CDC_VDD_CP",
1051 .min_uV = 1800000,
1052 .max_uV = 1800000,
1053 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
1054 },
1055 {
1056 .name = "CDC_VDDA_RX",
1057 .min_uV = 1800000,
1058 .max_uV = 1800000,
1059 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
1060 },
1061 {
1062 .name = "CDC_VDDA_TX",
1063 .min_uV = 1800000,
1064 .max_uV = 1800000,
1065 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
1066 },
1067 {
1068 .name = "VDDIO_CDC",
1069 .min_uV = 1800000,
1070 .max_uV = 1800000,
1071 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1072 },
1073 {
1074 .name = "VDDD_CDC_D",
1075 .min_uV = 1225000,
1076 .max_uV = 1225000,
1077 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1078 },
1079 {
1080 .name = "CDC_VDDA_A_1P2V",
1081 .min_uV = 1225000,
1082 .max_uV = 1225000,
1083 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1084 },
1085 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001086};
1087
1088static struct slim_device apq8064_slim_tabla20 = {
1089 .name = "tabla2x-slim",
1090 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
1091 .dev = {
1092 .platform_data = &apq8064_tabla20_platform_data,
1093 },
1094};
1095
Santosh Mardi695be0d2012-04-10 23:21:12 +05301096/* enable the level shifter for cs8427 to make sure the I2C
1097 * clock is running at 100KHz and voltage levels are at 3.3
1098 * and 5 volts
1099 */
1100static int enable_100KHz_ls(int enable)
1101{
1102 int ret = 0;
1103 if (enable) {
1104 ret = gpio_request(SX150X_GPIO(1, 10),
1105 "cs8427_100KHZ_ENABLE");
1106 if (ret) {
1107 pr_err("%s: Failed to request gpio %d\n", __func__,
1108 SX150X_GPIO(1, 10));
1109 return ret;
1110 }
1111 gpio_direction_output(SX150X_GPIO(1, 10), 1);
1112 } else
1113 gpio_free(SX150X_GPIO(1, 10));
1114 return ret;
1115}
1116
Santosh Mardieff9a742012-04-09 23:23:39 +05301117static struct cs8427_platform_data cs8427_i2c_platform_data = {
1118 .irq = SX150X_GPIO(1, 4),
1119 .reset_gpio = SX150X_GPIO(1, 6),
Santosh Mardi695be0d2012-04-10 23:21:12 +05301120 .enable = enable_100KHz_ls,
Santosh Mardieff9a742012-04-09 23:23:39 +05301121};
1122
1123static struct i2c_board_info cs8427_device_info[] __initdata = {
1124 {
1125 I2C_BOARD_INFO("cs8427", CS8427_ADDR4),
1126 .platform_data = &cs8427_i2c_platform_data,
1127 },
1128};
1129
Amy Maloche70090f992012-02-16 16:35:26 -08001130#define HAP_SHIFT_LVL_OE_GPIO PM8921_MPP_PM_TO_SYS(8)
1131#define ISA1200_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1132#define ISA1200_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
1133#define ISA1200_HAP_CLK PM8921_GPIO_PM_TO_SYS(44)
1134
Mohan Pallaka2d877602012-05-11 13:07:30 +05301135static int isa1200_clk_enable(bool on)
Amy Maloche70090f992012-02-16 16:35:26 -08001136{
Amy Maloche8f973892012-03-26 14:53:13 -07001137 int rc = 0;
1138
Mohan Pallaka2d877602012-05-11 13:07:30 +05301139 gpio_set_value_cansleep(ISA1200_HAP_CLK, on);
Amy Maloche70090f992012-02-16 16:35:26 -08001140
Mohan Pallaka2d877602012-05-11 13:07:30 +05301141 if (on) {
Amy Maloche8f973892012-03-26 14:53:13 -07001142 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_1, true);
Mohan Pallaka2d877602012-05-11 13:07:30 +05301143 if (rc) {
1144 pr_err("%s: unable to write aux clock register(%d)\n",
1145 __func__, rc);
1146 goto err_gpio_dis;
1147 }
1148 } else {
Amy Maloche8f973892012-03-26 14:53:13 -07001149 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_NONE, true);
Mohan Pallaka2d877602012-05-11 13:07:30 +05301150 if (rc)
1151 pr_err("%s: unable to write aux clock register(%d)\n",
1152 __func__, rc);
Amy Maloche8f973892012-03-26 14:53:13 -07001153 }
1154
1155 return rc;
Mohan Pallaka2d877602012-05-11 13:07:30 +05301156
1157err_gpio_dis:
1158 gpio_set_value_cansleep(ISA1200_HAP_CLK, !on);
1159 return rc;
Amy Maloche70090f992012-02-16 16:35:26 -08001160}
1161
1162static int isa1200_dev_setup(bool enable)
1163{
1164 int rc = 0;
1165
Amy Maloche70090f992012-02-16 16:35:26 -08001166 if (!enable)
1167 goto free_gpio;
1168
1169 rc = gpio_request(ISA1200_HAP_CLK, "haptics_clk");
1170 if (rc) {
1171 pr_err("%s: unable to request gpio %d config(%d)\n",
1172 __func__, ISA1200_HAP_CLK, rc);
1173 return rc;
1174 }
1175
1176 rc = gpio_direction_output(ISA1200_HAP_CLK, 0);
1177 if (rc) {
1178 pr_err("%s: unable to set direction\n", __func__);
1179 goto free_gpio;
1180 }
1181
1182 return 0;
1183
1184free_gpio:
1185 gpio_free(ISA1200_HAP_CLK);
1186 return rc;
1187}
1188
1189static struct isa1200_regulator isa1200_reg_data[] = {
1190 {
1191 .name = "vddp",
1192 .min_uV = ISA_I2C_VTG_MIN_UV,
1193 .max_uV = ISA_I2C_VTG_MAX_UV,
1194 .load_uA = ISA_I2C_CURR_UA,
1195 },
1196};
1197
1198static struct isa1200_platform_data isa1200_1_pdata = {
1199 .name = "vibrator",
1200 .dev_setup = isa1200_dev_setup,
Mohan Pallaka2d877602012-05-11 13:07:30 +05301201 .clk_enable = isa1200_clk_enable,
Amy Maloche70090f992012-02-16 16:35:26 -08001202 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
1203 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
1204 .max_timeout = 15000,
1205 .mode_ctrl = PWM_GEN_MODE,
1206 .pwm_fd = {
1207 .pwm_div = 256,
1208 },
1209 .is_erm = false,
1210 .smart_en = true,
1211 .ext_clk_en = true,
1212 .chip_en = 1,
1213 .regulator_info = isa1200_reg_data,
1214 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1215};
1216
1217static struct i2c_board_info isa1200_board_info[] __initdata = {
1218 {
1219 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1220 .platform_data = &isa1200_1_pdata,
1221 },
1222};
Jing Lin21ed4de2012-02-05 15:53:28 -08001223/* configuration data for mxt1386e using V2.1 firmware */
1224static const u8 mxt1386e_config_data_v2_1[] = {
1225 /* T6 Object */
1226 0, 0, 0, 0, 0, 0,
1227 /* T38 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001228 14, 2, 0, 24, 5, 12, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001229 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1230 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1231 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1232 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1233 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1234 0, 0, 0, 0,
1235 /* T7 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001236 100, 10, 50,
Jing Lin21ed4de2012-02-05 15:53:28 -08001237 /* T8 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001238 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001239 /* T9 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001240 139, 0, 0, 26, 42, 0, 32, 80, 2, 5,
Jing Lin21ed4de2012-02-05 15:53:28 -08001241 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
Jing Linf1208fd2012-02-23 11:15:42 -08001242 85, 5, 0, 5, 9, 5, 12, 35, 70, 40,
1243 20, 5, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001244 /* T18 Object */
1245 0, 0,
1246 /* T24 Object */
1247 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1248 0, 0, 0, 0, 0, 0, 0, 0, 0,
1249 /* T25 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001250 1, 0, 60, 115, 156, 99,
Jing Lin21ed4de2012-02-05 15:53:28 -08001251 /* T27 Object */
1252 0, 0, 0, 0, 0, 0, 0,
1253 /* T40 Object */
1254 0, 0, 0, 0, 0,
1255 /* T42 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001256 0, 0, 255, 0, 255, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001257 /* T43 Object */
1258 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
1259 16,
1260 /* T46 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001261 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001262 /* T47 Object */
1263 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
1264 /* T48 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001265 1, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001266 32, 40, 0, 10, 10, 0, 0, 100, 10, 90,
1267 0, 0, 0, 0, 0, 0, 0, 10, 1, 10,
1268 52, 10, 12, 0, 33, 0, 1, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001269 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1270 0, 0, 0, 0,
1271 /* T56 Object */
1272 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1273 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1274 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1275 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001276 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1277 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001278};
1279
1280#define MXT_TS_GPIO_IRQ 6
1281#define MXT_TS_PWR_EN_GPIO PM8921_GPIO_PM_TO_SYS(23)
1282#define MXT_TS_RESET_GPIO 33
1283
1284static struct mxt_config_info mxt_config_array[] = {
1285 {
1286 .config = mxt1386e_config_data_v2_1,
1287 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1288 .family_id = 0xA0,
1289 .variant_id = 0x7,
1290 .version = 0x21,
1291 .build = 0xAA,
Jing Linef4aa9b2012-03-26 12:01:41 -07001292 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
1293 .fw_name = "atmel_8064_liquid_v2_2_AA.hex",
1294 },
1295 {
1296 /* The config data for V2.2.AA is the same as for V2.1.AA */
1297 .config = mxt1386e_config_data_v2_1,
1298 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1299 .family_id = 0xA0,
1300 .variant_id = 0x7,
1301 .version = 0x22,
1302 .build = 0xAA,
1303 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin21ed4de2012-02-05 15:53:28 -08001304 },
1305};
1306
1307static struct mxt_platform_data mxt_platform_data = {
1308 .config_array = mxt_config_array,
1309 .config_array_size = ARRAY_SIZE(mxt_config_array),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08001310 .panel_minx = 0,
1311 .panel_maxx = 1365,
1312 .panel_miny = 0,
1313 .panel_maxy = 767,
1314 .disp_minx = 0,
1315 .disp_maxx = 1365,
1316 .disp_miny = 0,
1317 .disp_maxy = 767,
Anirudh Ghayal39dbe3f2012-04-13 15:43:16 +05301318 .irqflags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
Jing Lin21ed4de2012-02-05 15:53:28 -08001319 .i2c_pull_up = true,
1320 .reset_gpio = MXT_TS_RESET_GPIO,
1321 .irq_gpio = MXT_TS_GPIO_IRQ,
1322};
1323
1324static struct i2c_board_info mxt_device_info[] __initdata = {
1325 {
1326 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
1327 .platform_data = &mxt_platform_data,
1328 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1329 },
1330};
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001331#define CYTTSP_TS_GPIO_IRQ 6
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001332#define CYTTSP_TS_GPIO_SLEEP 33
1333
1334static ssize_t tma340_vkeys_show(struct kobject *kobj,
1335 struct kobj_attribute *attr, char *buf)
1336{
1337 return snprintf(buf, 200,
1338 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1339 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1340 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1341 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1342 "\n");
1343}
1344
1345static struct kobj_attribute tma340_vkeys_attr = {
1346 .attr = {
1347 .mode = S_IRUGO,
1348 },
1349 .show = &tma340_vkeys_show,
1350};
1351
1352static struct attribute *tma340_properties_attrs[] = {
1353 &tma340_vkeys_attr.attr,
1354 NULL
1355};
1356
1357static struct attribute_group tma340_properties_attr_group = {
1358 .attrs = tma340_properties_attrs,
1359};
1360
1361static int cyttsp_platform_init(struct i2c_client *client)
1362{
1363 int rc = 0;
1364 static struct kobject *tma340_properties_kobj;
1365
1366 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1367 tma340_properties_kobj = kobject_create_and_add("board_properties",
1368 NULL);
1369 if (tma340_properties_kobj)
1370 rc = sysfs_create_group(tma340_properties_kobj,
1371 &tma340_properties_attr_group);
1372 if (!tma340_properties_kobj || rc)
1373 pr_err("%s: failed to create board_properties\n",
1374 __func__);
1375
1376 return 0;
1377}
1378
1379static struct cyttsp_regulator cyttsp_regulator_data[] = {
1380 {
1381 .name = "vdd",
1382 .min_uV = CY_TMA300_VTG_MIN_UV,
1383 .max_uV = CY_TMA300_VTG_MAX_UV,
1384 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1385 .lpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1386 },
1387 {
1388 .name = "vcc_i2c",
1389 .min_uV = CY_I2C_VTG_MIN_UV,
1390 .max_uV = CY_I2C_VTG_MAX_UV,
1391 .hpm_load_uA = CY_I2C_CURR_UA,
1392 .lpm_load_uA = CY_I2C_CURR_UA,
1393 },
1394};
1395
1396static struct cyttsp_platform_data cyttsp_pdata = {
1397 .panel_maxx = 634,
1398 .panel_maxy = 1166,
1399 .disp_maxx = 599,
1400 .disp_maxy = 1023,
1401 .disp_minx = 0,
1402 .disp_miny = 0,
1403 .flags = 0x01,
1404 .gen = CY_GEN3,
1405 .use_st = CY_USE_ST,
1406 .use_mt = CY_USE_MT,
1407 .use_hndshk = CY_SEND_HNDSHK,
1408 .use_trk_id = CY_USE_TRACKING_ID,
1409 .use_sleep = CY_USE_DEEP_SLEEP_SEL,
1410 .use_gestures = CY_USE_GESTURES,
1411 .fw_fname = "cyttsp_8064_mtp.hex",
1412 /* change act_intrvl to customize the Active power state
1413 * scanning/processing refresh interval for Operating mode
1414 */
1415 .act_intrvl = CY_ACT_INTRVL_DFLT,
1416 /* change tch_tmout to customize the touch timeout for the
1417 * Active power state for Operating mode
1418 */
1419 .tch_tmout = CY_TCH_TMOUT_DFLT,
1420 /* change lp_intrvl to customize the Low Power power state
1421 * scanning/processing refresh interval for Operating mode
1422 */
1423 .lp_intrvl = CY_LP_INTRVL_DFLT,
1424 .sleep_gpio = CYTTSP_TS_GPIO_SLEEP,
Amy Maloche9ba3ffe2012-04-26 10:31:20 -07001425 .resout_gpio = -1,
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001426 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1427 .regulator_info = cyttsp_regulator_data,
1428 .num_regulators = ARRAY_SIZE(cyttsp_regulator_data),
1429 .init = cyttsp_platform_init,
1430 .correct_fw_ver = 17,
1431};
1432
1433static struct i2c_board_info cyttsp_info[] __initdata = {
1434 {
1435 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1436 .platform_data = &cyttsp_pdata,
1437 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1438 },
1439};
Jing Lin21ed4de2012-02-05 15:53:28 -08001440
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001441#define MSM_WCNSS_PHYS 0x03000000
1442#define MSM_WCNSS_SIZE 0x280000
1443
1444static struct resource resources_wcnss_wlan[] = {
1445 {
1446 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1447 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1448 .name = "wcnss_wlanrx_irq",
1449 .flags = IORESOURCE_IRQ,
1450 },
1451 {
1452 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1453 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1454 .name = "wcnss_wlantx_irq",
1455 .flags = IORESOURCE_IRQ,
1456 },
1457 {
1458 .start = MSM_WCNSS_PHYS,
1459 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1460 .name = "wcnss_mmio",
1461 .flags = IORESOURCE_MEM,
1462 },
1463 {
1464 .start = 64,
1465 .end = 68,
1466 .name = "wcnss_gpios_5wire",
1467 .flags = IORESOURCE_IO,
1468 },
1469};
1470
1471static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1472 .has_48mhz_xo = 1,
1473};
1474
1475static struct platform_device msm_device_wcnss_wlan = {
1476 .name = "wcnss_wlan",
1477 .id = 0,
1478 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1479 .resource = resources_wcnss_wlan,
1480 .dev = {.platform_data = &qcom_wcnss_pdata},
1481};
1482
Ankit Vermab7c26e62012-02-28 15:04:15 -08001483static struct platform_device msm_device_iris_fm __devinitdata = {
1484 .name = "iris_fm",
1485 .id = -1,
1486};
1487
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001488#ifdef CONFIG_QSEECOM
1489/* qseecom bus scaling */
1490static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
1491 {
1492 .src = MSM_BUS_MASTER_SPS,
1493 .dst = MSM_BUS_SLAVE_EBI_CH0,
1494 .ib = 0,
1495 .ab = 0,
1496 },
1497 {
1498 .src = MSM_BUS_MASTER_SPDM,
1499 .dst = MSM_BUS_SLAVE_SPDM,
1500 .ib = 0,
1501 .ab = 0,
1502 },
1503};
1504
1505static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
1506 {
1507 .src = MSM_BUS_MASTER_SPS,
1508 .dst = MSM_BUS_SLAVE_EBI_CH0,
1509 .ib = (492 * 8) * 1000000UL,
1510 .ab = (492 * 8) * 100000UL,
1511 },
1512 {
1513 .src = MSM_BUS_MASTER_SPDM,
1514 .dst = MSM_BUS_SLAVE_SPDM,
1515 .ib = 0,
1516 .ab = 0,
1517 },
1518};
1519
1520static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1521 {
1522 .src = MSM_BUS_MASTER_SPS,
1523 .dst = MSM_BUS_SLAVE_EBI_CH0,
1524 .ib = 0,
1525 .ab = 0,
1526 },
1527 {
1528 .src = MSM_BUS_MASTER_SPDM,
1529 .dst = MSM_BUS_SLAVE_SPDM,
1530 .ib = (64 * 8) * 1000000UL,
1531 .ab = (64 * 8) * 100000UL,
1532 },
1533};
1534
1535static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1536 {
1537 ARRAY_SIZE(qseecom_clks_init_vectors),
1538 qseecom_clks_init_vectors,
1539 },
1540 {
1541 ARRAY_SIZE(qseecom_enable_dfab_vectors),
1542 qseecom_enable_sfpb_vectors,
1543 },
1544 {
1545 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1546 qseecom_enable_sfpb_vectors,
1547 },
1548};
1549
1550static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1551 qseecom_hw_bus_scale_usecases,
1552 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1553 .name = "qsee",
1554};
1555
1556static struct platform_device qseecom_device = {
1557 .name = "qseecom",
1558 .id = 0,
1559 .dev = {
1560 .platform_data = &qseecom_bus_pdata,
1561 },
1562};
1563#endif
1564
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001565#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1566 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1567 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1568 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1569
1570#define QCE_SIZE 0x10000
1571#define QCE_0_BASE 0x11000000
1572
1573#define QCE_HW_KEY_SUPPORT 0
1574#define QCE_SHA_HMAC_SUPPORT 1
1575#define QCE_SHARE_CE_RESOURCE 3
1576#define QCE_CE_SHARED 0
1577
1578static struct resource qcrypto_resources[] = {
1579 [0] = {
1580 .start = QCE_0_BASE,
1581 .end = QCE_0_BASE + QCE_SIZE - 1,
1582 .flags = IORESOURCE_MEM,
1583 },
1584 [1] = {
1585 .name = "crypto_channels",
1586 .start = DMOV8064_CE_IN_CHAN,
1587 .end = DMOV8064_CE_OUT_CHAN,
1588 .flags = IORESOURCE_DMA,
1589 },
1590 [2] = {
1591 .name = "crypto_crci_in",
1592 .start = DMOV8064_CE_IN_CRCI,
1593 .end = DMOV8064_CE_IN_CRCI,
1594 .flags = IORESOURCE_DMA,
1595 },
1596 [3] = {
1597 .name = "crypto_crci_out",
1598 .start = DMOV8064_CE_OUT_CRCI,
1599 .end = DMOV8064_CE_OUT_CRCI,
1600 .flags = IORESOURCE_DMA,
1601 },
1602};
1603
1604static struct resource qcedev_resources[] = {
1605 [0] = {
1606 .start = QCE_0_BASE,
1607 .end = QCE_0_BASE + QCE_SIZE - 1,
1608 .flags = IORESOURCE_MEM,
1609 },
1610 [1] = {
1611 .name = "crypto_channels",
1612 .start = DMOV8064_CE_IN_CHAN,
1613 .end = DMOV8064_CE_OUT_CHAN,
1614 .flags = IORESOURCE_DMA,
1615 },
1616 [2] = {
1617 .name = "crypto_crci_in",
1618 .start = DMOV8064_CE_IN_CRCI,
1619 .end = DMOV8064_CE_IN_CRCI,
1620 .flags = IORESOURCE_DMA,
1621 },
1622 [3] = {
1623 .name = "crypto_crci_out",
1624 .start = DMOV8064_CE_OUT_CRCI,
1625 .end = DMOV8064_CE_OUT_CRCI,
1626 .flags = IORESOURCE_DMA,
1627 },
1628};
1629
1630#endif
1631
1632#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1633 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1634
1635static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1636 .ce_shared = QCE_CE_SHARED,
1637 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1638 .hw_key_support = QCE_HW_KEY_SUPPORT,
1639 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001640 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001641};
1642
1643static struct platform_device qcrypto_device = {
1644 .name = "qcrypto",
1645 .id = 0,
1646 .num_resources = ARRAY_SIZE(qcrypto_resources),
1647 .resource = qcrypto_resources,
1648 .dev = {
1649 .coherent_dma_mask = DMA_BIT_MASK(32),
1650 .platform_data = &qcrypto_ce_hw_suppport,
1651 },
1652};
1653#endif
1654
1655#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1656 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1657
1658static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1659 .ce_shared = QCE_CE_SHARED,
1660 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1661 .hw_key_support = QCE_HW_KEY_SUPPORT,
1662 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001663 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001664};
1665
1666static struct platform_device qcedev_device = {
1667 .name = "qce",
1668 .id = 0,
1669 .num_resources = ARRAY_SIZE(qcedev_resources),
1670 .resource = qcedev_resources,
1671 .dev = {
1672 .coherent_dma_mask = DMA_BIT_MASK(32),
1673 .platform_data = &qcedev_ce_hw_suppport,
1674 },
1675};
1676#endif
1677
Joel Kingdacbc822012-01-25 13:30:57 -08001678static struct mdm_platform_data mdm_platform_data = {
1679 .mdm_version = "3.0",
1680 .ramdump_delay_ms = 2000,
Joel King14fe7fa2012-05-27 14:26:11 -07001681 .early_power_on = 1,
1682 .sfr_query = 1,
Hemant Kumara945b472012-01-25 15:08:06 -08001683 .peripheral_platform_device = &apq8064_device_hsic_host,
Joel Kingdacbc822012-01-25 13:30:57 -08001684};
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001685
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001686static struct tsens_platform_data apq_tsens_pdata = {
1687 .tsens_factor = 1000,
1688 .hw_type = APQ_8064,
1689 .tsens_num_sensor = 11,
1690 .slope = {1176, 1176, 1154, 1176, 1111,
1691 1132, 1132, 1199, 1132, 1199, 1132},
1692};
1693
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07001694static struct platform_device msm_tsens_device = {
1695 .name = "tsens8960-tm",
1696 .id = -1,
1697};
1698
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001699#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001700static void __init apq8064_map_io(void)
1701{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001702 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001703 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001704 if (socinfo_init() < 0)
1705 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001706}
1707
1708static void __init apq8064_init_irq(void)
1709{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001710 struct msm_mpm_device_data *data = NULL;
1711
1712#ifdef CONFIG_MSM_MPM
1713 data = &apq8064_mpm_dev_data;
1714#endif
1715
1716 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001717 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1718 (void *)MSM_QGIC_CPU_BASE);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001719}
1720
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001721static struct platform_device msm8064_device_saw_regulator_core0 = {
1722 .name = "saw-regulator",
1723 .id = 0,
1724 .dev = {
1725 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
1726 },
1727};
1728
1729static struct platform_device msm8064_device_saw_regulator_core1 = {
1730 .name = "saw-regulator",
1731 .id = 1,
1732 .dev = {
1733 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
1734 },
1735};
1736
1737static struct platform_device msm8064_device_saw_regulator_core2 = {
1738 .name = "saw-regulator",
1739 .id = 2,
1740 .dev = {
1741 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
1742 },
1743};
1744
1745static struct platform_device msm8064_device_saw_regulator_core3 = {
1746 .name = "saw-regulator",
1747 .id = 3,
1748 .dev = {
1749 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001750
1751 },
1752};
1753
Oluwafemi Adeyemif5a31422012-03-08 16:58:45 -08001754static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001755 {
1756 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1757 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1758 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001759 1, 784, 180000, 100,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001760 },
1761
1762 {
1763 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1764 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1765 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001766 1300, 228, 1200000, 2000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001767 },
1768
1769 {
1770 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1771 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1772 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001773 2000, 138, 1208400, 3200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001774 },
1775
1776 {
1777 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001778 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
1779 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001780 6000, 119, 1850300, 9000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001781 },
1782
1783 {
1784 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1785 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1786 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001787 9200, 68, 2839200, 16400,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001788 },
1789
1790 {
1791 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1792 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1793 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001794 10300, 63, 3128000, 18200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001795 },
1796
1797 {
1798 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1799 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1800 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001801 18000, 10, 4602600, 27000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001802 },
1803
1804 {
1805 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1806 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1807 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001808 20000, 2, 5752000, 32000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001809 },
1810};
1811
1812static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1813 .mode = MSM_PM_BOOT_CONFIG_TZ,
1814};
1815
1816static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
1817 .levels = &msm_rpmrs_levels[0],
1818 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
1819 .vdd_mem_levels = {
1820 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
1821 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
1822 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
1823 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
1824 },
1825 .vdd_dig_levels = {
1826 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
1827 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
1828 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
1829 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
1830 },
1831 .vdd_mask = 0x7FFFFF,
1832 .rpmrs_target_id = {
1833 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
1834 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
1835 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
1836 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
1837 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
1838 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
1839 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
1840 },
1841};
1842
Praveen Chidambaram78499012011-11-01 17:15:17 -06001843static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1844 0x03, 0x0f,
1845};
1846
1847static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1848 0x00, 0x24, 0x54, 0x10,
1849 0x09, 0x03, 0x01,
1850 0x10, 0x54, 0x30, 0x0C,
1851 0x24, 0x30, 0x0f,
1852};
1853
1854static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1855 0x00, 0x24, 0x54, 0x10,
1856 0x09, 0x07, 0x01, 0x0B,
1857 0x10, 0x54, 0x30, 0x0C,
1858 0x24, 0x30, 0x0f,
1859};
1860
1861static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1862 [0] = {
1863 .mode = MSM_SPM_MODE_CLOCK_GATING,
1864 .notify_rpm = false,
1865 .cmd = spm_wfi_cmd_sequence,
1866 },
1867 [1] = {
1868 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1869 .notify_rpm = false,
1870 .cmd = spm_power_collapse_without_rpm,
1871 },
1872 [2] = {
1873 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1874 .notify_rpm = true,
1875 .cmd = spm_power_collapse_with_rpm,
1876 },
1877};
1878
1879static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1880 0x00, 0x20, 0x03, 0x20,
1881 0x00, 0x0f,
1882};
1883
1884static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1885 0x00, 0x20, 0x34, 0x64,
1886 0x48, 0x07, 0x48, 0x20,
1887 0x50, 0x64, 0x04, 0x34,
1888 0x50, 0x0f,
1889};
1890static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1891 0x00, 0x10, 0x34, 0x64,
1892 0x48, 0x07, 0x48, 0x10,
1893 0x50, 0x64, 0x04, 0x34,
1894 0x50, 0x0F,
1895};
1896
1897static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1898 [0] = {
1899 .mode = MSM_SPM_L2_MODE_RETENTION,
1900 .notify_rpm = false,
1901 .cmd = l2_spm_wfi_cmd_sequence,
1902 },
1903 [1] = {
1904 .mode = MSM_SPM_L2_MODE_GDHS,
1905 .notify_rpm = true,
1906 .cmd = l2_spm_gdhs_cmd_sequence,
1907 },
1908 [2] = {
1909 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1910 .notify_rpm = true,
1911 .cmd = l2_spm_power_off_cmd_sequence,
1912 },
1913};
1914
1915
1916static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1917 [0] = {
1918 .reg_base_addr = MSM_SAW_L2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001919 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001920 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001921 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1922 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1923 .modes = msm_spm_l2_seq_list,
1924 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1925 },
1926};
1927
1928static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1929 [0] = {
1930 .reg_base_addr = MSM_SAW0_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001931 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001932#if defined(CONFIG_MSM_AVS_HW)
1933 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1934 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1935#endif
1936 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001937 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001938 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1939 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1940 .vctl_timeout_us = 50,
1941 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1942 .modes = msm_spm_seq_list,
1943 },
1944 [1] = {
1945 .reg_base_addr = MSM_SAW1_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001946 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001947#if defined(CONFIG_MSM_AVS_HW)
1948 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1949 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1950#endif
1951 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001952 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001953 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1954 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1955 .vctl_timeout_us = 50,
1956 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1957 .modes = msm_spm_seq_list,
1958 },
1959 [2] = {
1960 .reg_base_addr = MSM_SAW2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001961 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001962#if defined(CONFIG_MSM_AVS_HW)
1963 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1964 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1965#endif
1966 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001967 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001968 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1969 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1970 .vctl_timeout_us = 50,
1971 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1972 .modes = msm_spm_seq_list,
1973 },
1974 [3] = {
1975 .reg_base_addr = MSM_SAW3_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001976 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001977#if defined(CONFIG_MSM_AVS_HW)
1978 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1979 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1980#endif
1981 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001982 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001983 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1984 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1985 .vctl_timeout_us = 50,
1986 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1987 .modes = msm_spm_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001988 },
1989};
1990
Praveen Chidambaram4d19be42012-04-03 18:05:52 -06001991static struct msm_pm_sleep_status_data msm_pm_slp_sts_data = {
1992 .base_addr = MSM_ACC0_BASE + 0x08,
1993 .cpu_offset = MSM_ACC1_BASE - MSM_ACC0_BASE,
1994 .mask = 1UL << 13,
1995};
1996
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001997static void __init apq8064_init_buses(void)
1998{
1999 msm_bus_rpm_set_mt_mask();
2000 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
2001 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
2002 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
2003 msm_bus_8064_apps_fabric.dev.platform_data =
2004 &msm_bus_8064_apps_fabric_pdata;
2005 msm_bus_8064_sys_fabric.dev.platform_data =
2006 &msm_bus_8064_sys_fabric_pdata;
2007 msm_bus_8064_mm_fabric.dev.platform_data =
2008 &msm_bus_8064_mm_fabric_pdata;
2009 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
2010 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
2011}
2012
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002013/* PCIe gpios */
2014static struct msm_pcie_gpio_info_t msm_pcie_gpio_info[MSM_PCIE_MAX_GPIO] = {
2015 {"rst_n", PM8921_MPP_PM_TO_SYS(PCIE_RST_N_PMIC_MPP), 0},
2016 {"pwr_en", PM8921_GPIO_PM_TO_SYS(PCIE_PWR_EN_PMIC_GPIO), 1},
2017};
2018
2019static struct msm_pcie_platform msm_pcie_platform_data = {
2020 .gpio = msm_pcie_gpio_info,
2021};
2022
2023static void __init mpq8064_pcie_init(void)
2024{
2025 msm_device_pcie.dev.platform_data = &msm_pcie_platform_data;
2026 platform_device_register(&msm_device_pcie);
2027}
2028
David Collinsf0d00732012-01-25 15:46:50 -08002029static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
2030 .name = GPIO_REGULATOR_DEV_NAME,
2031 .id = PM8921_MPP_PM_TO_SYS(7),
2032 .dev = {
2033 .platform_data
2034 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2035 },
2036};
2037
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08002038static struct platform_device apq8064_device_ext_mpp8_vreg __devinitdata = {
2039 .name = GPIO_REGULATOR_DEV_NAME,
2040 .id = PM8921_MPP_PM_TO_SYS(8),
2041 .dev = {
2042 .platform_data
2043 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_MPP8],
2044 },
2045};
2046
David Collinsf0d00732012-01-25 15:46:50 -08002047static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
2048 .name = GPIO_REGULATOR_DEV_NAME,
2049 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
2050 .dev = {
2051 .platform_data =
2052 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2053 },
2054};
2055
David Collins390fc332012-02-07 14:38:16 -08002056static struct platform_device apq8064_device_ext_ts_sw_vreg __devinitdata = {
2057 .name = GPIO_REGULATOR_DEV_NAME,
2058 .id = PM8921_GPIO_PM_TO_SYS(23),
2059 .dev = {
2060 .platform_data
2061 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_TS_SW],
2062 },
2063};
2064
David Collins2782b5c2012-02-06 10:02:42 -08002065static struct platform_device apq8064_device_rpm_regulator __devinitdata = {
2066 .name = "rpm-regulator",
2067 .id = -1,
2068 .dev = {
2069 .platform_data = &apq8064_rpm_regulator_pdata,
2070 },
2071};
2072
Ravi Kumar V05931a22012-04-04 17:09:37 +05302073static struct gpio_ir_recv_platform_data gpio_ir_recv_pdata = {
2074 .gpio_nr = 88,
2075 .active_low = 1,
2076};
2077
2078static struct platform_device gpio_ir_recv_pdev = {
2079 .name = "gpio-rc-recv",
2080 .dev = {
2081 .platform_data = &gpio_ir_recv_pdata,
2082 },
2083};
2084
Terence Hampson36b70722012-05-10 13:18:16 -04002085static struct platform_device *common_not_mpq_devices[] __initdata = {
David Keitel3c40fc52012-02-09 17:53:52 -08002086 &apq8064_device_qup_i2c_gsbi1,
Jing Lin04601f92012-02-05 15:36:07 -08002087 &apq8064_device_qup_i2c_gsbi3,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002088 &apq8064_device_qup_i2c_gsbi4,
Terence Hampson36b70722012-05-10 13:18:16 -04002089};
2090
2091static struct platform_device *common_devices[] __initdata = {
2092 &apq8064_device_dmov,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002093 &apq8064_device_qup_spi_gsbi5,
David Collinsf0d00732012-01-25 15:46:50 -08002094 &apq8064_device_ext_5v_vreg,
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08002095 &apq8064_device_ext_mpp8_vreg,
David Collinsf0d00732012-01-25 15:46:50 -08002096 &apq8064_device_ext_3p3v_vreg,
David Collins390fc332012-02-07 14:38:16 -08002097 &apq8064_device_ext_ts_sw_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07002098 &apq8064_device_ssbi_pmic1,
2099 &apq8064_device_ssbi_pmic2,
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06002100 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07002101 &apq8064_device_otg,
2102 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08002103 &apq8064_device_hsusb_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07002104 &android_usb_device,
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08002105 &msm_device_wcnss_wlan,
Ankit Vermab7c26e62012-02-28 15:04:15 -08002106 &msm_device_iris_fm,
Larry Bassel67b921d2012-04-06 10:23:27 -07002107 &apq8064_fmem_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08002108#ifdef CONFIG_ANDROID_PMEM
2109#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002110 &apq8064_android_pmem_device,
2111 &apq8064_android_pmem_adsp_device,
2112 &apq8064_android_pmem_audio_device,
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -07002113#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
2114#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -08002115#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002116 &apq8064_ion_dev,
Olav Haugan7c6aa742012-01-16 16:47:37 -08002117#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002118 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08002119 &msm8064_device_saw_regulator_core0,
2120 &msm8064_device_saw_regulator_core1,
2121 &msm8064_device_saw_regulator_core2,
2122 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002123#if defined(CONFIG_QSEECOM)
2124 &qseecom_device,
2125#endif
2126
Ramesh Masavarapu28311912011-10-27 11:04:12 -07002127#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2128 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2129 &qcrypto_device,
2130#endif
2131
2132#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2133 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2134 &qcedev_device,
2135#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07002136
2137#ifdef CONFIG_HW_RANDOM_MSM
2138 &apq8064_device_rng,
2139#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002140 &apq_pcm,
2141 &apq_pcm_routing,
2142 &apq_cpudai0,
2143 &apq_cpudai1,
Santosh Mardieff9a742012-04-09 23:23:39 +05302144 &mpq_cpudai_sec_i2s_rx,
Kuirong Wangf23f8c52012-03-31 12:34:51 -07002145 &mpq_cpudai_mi2s_tx,
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002146 &apq_cpudai_hdmi_rx,
2147 &apq_cpudai_bt_rx,
2148 &apq_cpudai_bt_tx,
2149 &apq_cpudai_fm_rx,
2150 &apq_cpudai_fm_tx,
2151 &apq_cpu_fe,
2152 &apq_stub_codec,
2153 &apq_voice,
2154 &apq_voip,
2155 &apq_lpa_pcm,
Krishnankutty Kolathappilly4374e332012-03-18 22:27:30 -07002156 &apq_compr_dsp,
2157 &apq_multi_ch_pcm,
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002158 &apq_pcm_hostless,
2159 &apq_cpudai_afe_01_rx,
2160 &apq_cpudai_afe_01_tx,
2161 &apq_cpudai_afe_02_rx,
2162 &apq_cpudai_afe_02_tx,
2163 &apq_pcm_afe,
2164 &apq_cpudai_auxpcm_rx,
2165 &apq_cpudai_auxpcm_tx,
Neema Shetty8427c262012-02-16 11:23:43 -08002166 &apq_cpudai_stub,
Neema Shetty3c9d2862012-03-11 01:25:32 -08002167 &apq_cpudai_slimbus_1_rx,
2168 &apq_cpudai_slimbus_1_tx,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002169 &apq_cpudai_slimbus_2_tx,
Neema Shettyc9d86c32012-05-09 12:01:39 -07002170 &apq_cpudai_slimbus_3_rx,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002171 &apq8064_rpm_device,
2172 &apq8064_rpm_log_device,
2173 &apq8064_rpm_stat_device,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002174 &msm_bus_8064_apps_fabric,
2175 &msm_bus_8064_sys_fabric,
2176 &msm_bus_8064_mm_fabric,
2177 &msm_bus_8064_sys_fpb,
2178 &msm_bus_8064_cpss_fpb,
Mohan Kumar Gubbihalli Lachma Naik7f72edd2012-02-06 17:26:47 -08002179 &apq8064_msm_device_vidc,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07002180 &msm_pil_dsps,
Matt Wagantalled832652012-02-02 19:23:17 -08002181 &msm_8960_riva,
Matt Wagantallb94b9a52012-02-02 21:59:54 -08002182 &msm_8960_q6_lpass,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002183 &msm_pil_vidc,
Matt Wagantall292aace2012-01-26 19:12:34 -08002184 &msm_gss,
Laura Abbottb93525f2012-04-12 09:57:19 -07002185 &apq8064_rtb_device,
Praveen Chidambaram8ea3dcd2011-12-07 14:46:31 -07002186 &apq8064_cpu_idle_device,
Praveen Chidambaram5c8adf22012-02-23 18:44:37 -07002187 &apq8064_msm_gov_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002188 &apq8064_device_cache_erp,
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002189 &epm_adc_device,
Pratik Patel212ab362012-03-16 12:30:07 -07002190 &apq8064_qdss_device,
2191 &msm_etb_device,
2192 &msm_tpiu_device,
2193 &msm_funnel_device,
2194 &apq8064_etm_device,
Helen Zeng8f925502012-03-05 16:50:17 -08002195 &apq_cpudai_slim_4_rx,
2196 &apq_cpudai_slim_4_tx,
Jignesh Mehta921649d2012-04-19 06:57:23 -07002197 &msm8960_gemini_device,
Laura Abbott0577d7b2012-04-17 11:14:30 -07002198 &apq8064_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002199 &msm_tsens_device,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002200};
2201
Joel King4e7ad222011-08-17 15:47:38 -07002202static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002203 &apq8064_device_uart_gsbi3,
Yan He06913ce2011-08-26 16:33:46 -07002204 &msm_device_sps_apq8064,
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002205};
2206
2207static struct platform_device *rumi3_devices[] __initdata = {
2208 &apq8064_device_uart_gsbi1,
Yan He435ed612011-11-23 17:34:59 -08002209 &msm_device_sps_apq8064,
Huaibin Yang4a084e32011-12-15 15:25:52 -08002210#ifdef CONFIG_MSM_ROTATOR
2211 &msm_rotator_device,
2212#endif
Joel King4e7ad222011-08-17 15:47:38 -07002213};
2214
Joel King82b7e3f2012-01-05 10:03:27 -08002215static struct platform_device *cdp_devices[] __initdata = {
2216 &apq8064_device_uart_gsbi1,
Jin Hong4bbbfba2012-02-02 21:48:07 -08002217 &apq8064_device_uart_gsbi7,
Joel King82b7e3f2012-01-05 10:03:27 -08002218 &msm_device_sps_apq8064,
Aravind Venkateswaran4ca27532012-02-16 14:27:05 -08002219#ifdef CONFIG_MSM_ROTATOR
2220 &msm_rotator_device,
2221#endif
Joel King82b7e3f2012-01-05 10:03:27 -08002222};
2223
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002224static struct platform_device
2225mpq8064_device_ext_5v_frc_vreg __devinitdata = {
2226 .name = GPIO_REGULATOR_DEV_NAME,
2227 .id = SX150X_GPIO(4, 10),
2228 .dev = {
2229 .platform_data =
2230 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_FRC_5V],
2231 },
2232};
2233
2234static struct platform_device
2235mpq8064_device_ext_1p2_buck_vreg __devinitdata = {
2236 .name = GPIO_REGULATOR_DEV_NAME,
2237 .id = SX150X_GPIO(4, 2),
2238 .dev = {
2239 .platform_data =
2240 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P2V],
2241 },
2242};
2243
2244static struct platform_device
2245mpq8064_device_ext_1p8_buck_vreg __devinitdata = {
2246 .name = GPIO_REGULATOR_DEV_NAME,
2247 .id = SX150X_GPIO(4, 4),
2248 .dev = {
2249 .platform_data =
2250 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P8V],
2251 },
2252};
2253
2254static struct platform_device
2255mpq8064_device_ext_2p2_buck_vreg __devinitdata = {
2256 .name = GPIO_REGULATOR_DEV_NAME,
2257 .id = SX150X_GPIO(4, 14),
2258 .dev = {
2259 .platform_data =
2260 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_2P2V],
2261 },
2262};
2263
2264static struct platform_device
2265mpq8064_device_ext_5v_buck_vreg __devinitdata = {
2266 .name = GPIO_REGULATOR_DEV_NAME,
2267 .id = SX150X_GPIO(4, 3),
2268 .dev = {
2269 .platform_data =
2270 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_5V],
2271 },
2272};
2273
2274static struct platform_device
2275mpq8064_device_ext_3p3v_ldo_vreg __devinitdata = {
2276 .name = GPIO_REGULATOR_DEV_NAME,
2277 .id = SX150X_GPIO(4, 15),
2278 .dev = {
2279 .platform_data =
2280 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_3P3V],
2281 },
2282};
2283
Ravi Kumar V1c903012012-05-15 16:11:35 +05302284static struct platform_device rc_input_loopback_pdev = {
2285 .name = "rc-user-input",
2286 .id = -1,
2287};
2288
Ravi Kumar V040eeff2012-05-23 21:29:23 +05302289static int rf4ce_gpio_init(void)
2290{
2291 if (!machine_is_mpq8064_cdp())
2292 return -EINVAL;
2293
2294 /* CC2533 SRDY Input */
2295 if (!gpio_request(SX150X_GPIO(4, 6), "rf4ce_srdy")) {
2296 gpio_direction_input(SX150X_GPIO(4, 6));
2297 gpio_export(SX150X_GPIO(4, 6), true);
2298 }
2299
2300 /* CC2533 MRDY Output */
2301 if (!gpio_request(SX150X_GPIO(4, 5), "rf4ce_mrdy")) {
2302 gpio_direction_output(SX150X_GPIO(4, 5), 1);
2303 gpio_export(SX150X_GPIO(4, 5), true);
2304 }
2305
2306 /* CC2533 Reset Output */
2307 if (!gpio_request(SX150X_GPIO(4, 7), "rf4ce_reset")) {
2308 gpio_direction_output(SX150X_GPIO(4, 7), 0);
2309 gpio_export(SX150X_GPIO(4, 7), true);
2310 }
2311
2312 return 0;
2313}
2314late_initcall(rf4ce_gpio_init);
2315
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002316static struct platform_device *mpq_devices[] __initdata = {
2317 &msm_device_sps_apq8064,
2318 &mpq8064_device_qup_i2c_gsbi5,
2319#ifdef CONFIG_MSM_ROTATOR
2320 &msm_rotator_device,
2321#endif
Ravi Kumar V05931a22012-04-04 17:09:37 +05302322 &gpio_ir_recv_pdev,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002323 &mpq8064_device_ext_5v_frc_vreg,
2324 &mpq8064_device_ext_1p2_buck_vreg,
2325 &mpq8064_device_ext_1p8_buck_vreg,
2326 &mpq8064_device_ext_2p2_buck_vreg,
2327 &mpq8064_device_ext_5v_buck_vreg,
2328 &mpq8064_device_ext_3p3v_ldo_vreg,
Terence Hampson2e1705f2012-04-11 19:55:29 -04002329#ifdef CONFIG_MSM_VCAP
2330 &msm8064_device_vcap,
2331#endif
Ravi Kumar V1c903012012-05-15 16:11:35 +05302332 &rc_input_loopback_pdev,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002333};
2334
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002335static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002336 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002337};
2338
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002339#define KS8851_IRQ_GPIO 43
2340
2341static struct spi_board_info spi_board_info[] __initdata = {
2342 {
2343 .modalias = "ks8851",
2344 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2345 .max_speed_hz = 19200000,
2346 .bus_num = 0,
2347 .chip_select = 2,
2348 .mode = SPI_MODE_0,
2349 },
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002350 {
2351 .modalias = "epm_adc",
2352 .max_speed_hz = 1100000,
2353 .bus_num = 0,
2354 .chip_select = 3,
2355 .mode = SPI_MODE_0,
2356 },
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002357};
2358
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002359static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002360 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08002361 .bus_num = 1,
2362 .slim_slave = &apq8064_slim_tabla,
2363 },
2364 {
2365 .bus_num = 1,
2366 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002367 },
2368 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002369};
2370
David Keitel3c40fc52012-02-09 17:53:52 -08002371static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi1_pdata = {
2372 .clk_freq = 100000,
2373 .src_clk_rate = 24000000,
2374};
2375
Jing Lin04601f92012-02-05 15:36:07 -08002376static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi3_pdata = {
Anirudh Ghayalc2163472012-04-10 14:58:14 +05302377 .clk_freq = 384000,
Jing Lin04601f92012-02-05 15:36:07 -08002378 .src_clk_rate = 24000000,
2379};
2380
Kenneth Heitke748593a2011-07-15 15:45:11 -06002381static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
2382 .clk_freq = 100000,
2383 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002384};
2385
Joel King8f839b92012-04-01 14:37:46 -07002386static struct msm_i2c_platform_data mpq8064_i2c_qup_gsbi5_pdata = {
2387 .clk_freq = 100000,
2388 .src_clk_rate = 24000000,
2389};
2390
David Keitel3c40fc52012-02-09 17:53:52 -08002391#define GSBI_DUAL_MODE_CODE 0x60
2392#define MSM_GSBI1_PHYS 0x12440000
Kenneth Heitke748593a2011-07-15 15:45:11 -06002393static void __init apq8064_i2c_init(void)
2394{
David Keitel3c40fc52012-02-09 17:53:52 -08002395 void __iomem *gsbi_mem;
2396
2397 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2398 &apq8064_i2c_qup_gsbi1_pdata;
2399 gsbi_mem = ioremap_nocache(MSM_GSBI1_PHYS, 4);
2400 writel_relaxed(GSBI_DUAL_MODE_CODE, gsbi_mem);
2401 /* Ensure protocol code is written before proceeding */
2402 wmb();
2403 iounmap(gsbi_mem);
2404 apq8064_i2c_qup_gsbi1_pdata.use_gsbi_shared_mode = 1;
Jing Lin04601f92012-02-05 15:36:07 -08002405 apq8064_device_qup_i2c_gsbi3.dev.platform_data =
2406 &apq8064_i2c_qup_gsbi3_pdata;
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002407 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2408 &apq8064_i2c_qup_gsbi1_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002409 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
2410 &apq8064_i2c_qup_gsbi4_pdata;
Joel King8f839b92012-04-01 14:37:46 -07002411 mpq8064_device_qup_i2c_gsbi5.dev.platform_data =
2412 &mpq8064_i2c_qup_gsbi5_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002413}
2414
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002415#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002416static int ethernet_init(void)
2417{
2418 int ret;
2419 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
2420 if (ret) {
2421 pr_err("ks8851 gpio_request failed: %d\n", ret);
2422 goto fail;
2423 }
2424
2425 return 0;
2426fail:
2427 return ret;
2428}
2429#else
2430static int ethernet_init(void)
2431{
2432 return 0;
2433}
2434#endif
2435
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302436#define GPIO_KEY_HOME PM8921_GPIO_PM_TO_SYS(27)
2437#define GPIO_KEY_VOLUME_UP PM8921_GPIO_PM_TO_SYS(35)
2438#define GPIO_KEY_VOLUME_DOWN PM8921_GPIO_PM_TO_SYS(38)
2439#define GPIO_KEY_CAM_FOCUS PM8921_GPIO_PM_TO_SYS(3)
2440#define GPIO_KEY_CAM_SNAP PM8921_GPIO_PM_TO_SYS(4)
Jing Lin3f8f8422012-03-05 09:32:11 -08002441#define GPIO_KEY_ROTATION PM8921_GPIO_PM_TO_SYS(42)
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302442
2443static struct gpio_keys_button cdp_keys[] = {
2444 {
2445 .code = KEY_HOME,
2446 .gpio = GPIO_KEY_HOME,
2447 .desc = "home_key",
2448 .active_low = 1,
2449 .type = EV_KEY,
2450 .wakeup = 1,
2451 .debounce_interval = 15,
2452 },
2453 {
2454 .code = KEY_VOLUMEUP,
2455 .gpio = GPIO_KEY_VOLUME_UP,
2456 .desc = "volume_up_key",
2457 .active_low = 1,
2458 .type = EV_KEY,
2459 .wakeup = 1,
2460 .debounce_interval = 15,
2461 },
2462 {
2463 .code = KEY_VOLUMEDOWN,
2464 .gpio = GPIO_KEY_VOLUME_DOWN,
2465 .desc = "volume_down_key",
2466 .active_low = 1,
2467 .type = EV_KEY,
2468 .wakeup = 1,
2469 .debounce_interval = 15,
2470 },
2471 {
2472 .code = SW_ROTATE_LOCK,
2473 .gpio = GPIO_KEY_ROTATION,
2474 .desc = "rotate_key",
2475 .active_low = 1,
2476 .type = EV_SW,
2477 .debounce_interval = 15,
2478 },
2479};
2480
2481static struct gpio_keys_platform_data cdp_keys_data = {
2482 .buttons = cdp_keys,
2483 .nbuttons = ARRAY_SIZE(cdp_keys),
2484};
2485
2486static struct platform_device cdp_kp_pdev = {
2487 .name = "gpio-keys",
2488 .id = -1,
2489 .dev = {
2490 .platform_data = &cdp_keys_data,
2491 },
2492};
2493
2494static struct gpio_keys_button mtp_keys[] = {
2495 {
2496 .code = KEY_CAMERA_FOCUS,
2497 .gpio = GPIO_KEY_CAM_FOCUS,
2498 .desc = "cam_focus_key",
2499 .active_low = 1,
2500 .type = EV_KEY,
2501 .wakeup = 1,
2502 .debounce_interval = 15,
2503 },
2504 {
2505 .code = KEY_VOLUMEUP,
2506 .gpio = GPIO_KEY_VOLUME_UP,
2507 .desc = "volume_up_key",
2508 .active_low = 1,
2509 .type = EV_KEY,
2510 .wakeup = 1,
2511 .debounce_interval = 15,
2512 },
2513 {
2514 .code = KEY_VOLUMEDOWN,
2515 .gpio = GPIO_KEY_VOLUME_DOWN,
2516 .desc = "volume_down_key",
2517 .active_low = 1,
2518 .type = EV_KEY,
2519 .wakeup = 1,
2520 .debounce_interval = 15,
2521 },
2522 {
2523 .code = KEY_CAMERA_SNAPSHOT,
2524 .gpio = GPIO_KEY_CAM_SNAP,
2525 .desc = "cam_snap_key",
2526 .active_low = 1,
2527 .type = EV_KEY,
2528 .debounce_interval = 15,
2529 },
2530};
2531
2532static struct gpio_keys_platform_data mtp_keys_data = {
2533 .buttons = mtp_keys,
2534 .nbuttons = ARRAY_SIZE(mtp_keys),
2535};
2536
2537static struct platform_device mtp_kp_pdev = {
2538 .name = "gpio-keys",
2539 .id = -1,
2540 .dev = {
2541 .platform_data = &mtp_keys_data,
2542 },
2543};
2544
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05302545static struct gpio_keys_button mpq_keys[] = {
2546 {
2547 .code = KEY_VOLUMEDOWN,
2548 .gpio = GPIO_KEY_VOLUME_DOWN,
2549 .desc = "volume_down_key",
2550 .active_low = 1,
2551 .type = EV_KEY,
2552 .wakeup = 1,
2553 .debounce_interval = 15,
2554 },
2555 {
2556 .code = KEY_VOLUMEUP,
2557 .gpio = GPIO_KEY_VOLUME_UP,
2558 .desc = "volume_up_key",
2559 .active_low = 1,
2560 .type = EV_KEY,
2561 .wakeup = 1,
2562 .debounce_interval = 15,
2563 },
2564};
2565
2566static struct gpio_keys_platform_data mpq_keys_data = {
2567 .buttons = mpq_keys,
2568 .nbuttons = ARRAY_SIZE(mpq_keys),
2569};
2570
2571static struct platform_device mpq_gpio_keys_pdev = {
2572 .name = "gpio-keys",
2573 .id = -1,
2574 .dev = {
2575 .platform_data = &mpq_keys_data,
2576 },
2577};
2578
2579#define MPQ_KP_ROW_BASE SX150X_EXP2_GPIO_BASE
2580#define MPQ_KP_COL_BASE (SX150X_EXP2_GPIO_BASE + 4)
2581
2582static unsigned int mpq_row_gpios[] = {MPQ_KP_ROW_BASE, MPQ_KP_ROW_BASE + 1,
2583 MPQ_KP_ROW_BASE + 2, MPQ_KP_ROW_BASE + 3};
2584static unsigned int mpq_col_gpios[] = {MPQ_KP_COL_BASE, MPQ_KP_COL_BASE + 1,
2585 MPQ_KP_COL_BASE + 2};
2586
2587static const unsigned int mpq_keymap[] = {
2588 KEY(0, 0, KEY_UP),
2589 KEY(0, 1, KEY_ENTER),
2590 KEY(0, 2, KEY_3),
2591
2592 KEY(1, 0, KEY_DOWN),
2593 KEY(1, 1, KEY_EXIT),
2594 KEY(1, 2, KEY_4),
2595
2596 KEY(2, 0, KEY_LEFT),
2597 KEY(2, 1, KEY_1),
2598 KEY(2, 2, KEY_5),
2599
2600 KEY(3, 0, KEY_RIGHT),
2601 KEY(3, 1, KEY_2),
2602 KEY(3, 2, KEY_6),
2603};
2604
2605static struct matrix_keymap_data mpq_keymap_data = {
2606 .keymap_size = ARRAY_SIZE(mpq_keymap),
2607 .keymap = mpq_keymap,
2608};
2609
2610static struct matrix_keypad_platform_data mpq_keypad_data = {
2611 .keymap_data = &mpq_keymap_data,
2612 .row_gpios = mpq_row_gpios,
2613 .col_gpios = mpq_col_gpios,
2614 .num_row_gpios = ARRAY_SIZE(mpq_row_gpios),
2615 .num_col_gpios = ARRAY_SIZE(mpq_col_gpios),
2616 .col_scan_delay_us = 32000,
2617 .debounce_ms = 20,
2618 .wakeup = 1,
2619 .active_low = 1,
2620 .no_autorepeat = 1,
2621};
2622
2623static struct platform_device mpq_keypad_device = {
2624 .name = "matrix-keypad",
2625 .id = -1,
2626 .dev = {
2627 .platform_data = &mpq_keypad_data,
2628 },
2629};
2630
Jin Hongd3024e62012-02-09 16:13:32 -08002631/* Sensors DSPS platform data */
2632#define DSPS_PIL_GENERIC_NAME "dsps"
2633static void __init apq8064_init_dsps(void)
2634{
2635 struct msm_dsps_platform_data *pdata =
2636 msm_dsps_device_8064.dev.platform_data;
2637 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
2638 pdata->gpios = NULL;
2639 pdata->gpios_num = 0;
2640
2641 platform_device_register(&msm_dsps_device_8064);
2642}
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302643
Jing Lin417fa452012-02-05 14:31:06 -08002644#define I2C_SURF 1
2645#define I2C_FFA (1 << 1)
2646#define I2C_RUMI (1 << 2)
2647#define I2C_SIM (1 << 3)
2648#define I2C_LIQUID (1 << 4)
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002649#define I2C_MPQ_CDP BIT(5)
2650#define I2C_MPQ_HRD BIT(6)
2651#define I2C_MPQ_DTV BIT(7)
Jing Lin417fa452012-02-05 14:31:06 -08002652
2653struct i2c_registry {
2654 u8 machs;
2655 int bus;
2656 struct i2c_board_info *info;
2657 int len;
2658};
2659
2660static struct i2c_registry apq8064_i2c_devices[] __initdata = {
Jing Lin21ed4de2012-02-05 15:53:28 -08002661 {
David Keitel2f613d92012-02-15 11:29:16 -08002662 I2C_LIQUID,
2663 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
2664 smb349_charger_i2c_info,
2665 ARRAY_SIZE(smb349_charger_i2c_info)
2666 },
2667 {
Jing Lin21ed4de2012-02-05 15:53:28 -08002668 I2C_SURF | I2C_LIQUID,
2669 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
2670 mxt_device_info,
2671 ARRAY_SIZE(mxt_device_info),
2672 },
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08002673 {
2674 I2C_FFA,
2675 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
2676 cyttsp_info,
2677 ARRAY_SIZE(cyttsp_info),
2678 },
Amy Maloche70090f992012-02-16 16:35:26 -08002679 {
2680 I2C_FFA | I2C_LIQUID,
2681 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
2682 isa1200_board_info,
2683 ARRAY_SIZE(isa1200_board_info),
2684 },
Santosh Mardieff9a742012-04-09 23:23:39 +05302685 {
2686 I2C_MPQ_CDP,
2687 APQ_8064_GSBI5_QUP_I2C_BUS_ID,
2688 cs8427_device_info,
2689 ARRAY_SIZE(cs8427_device_info),
2690 },
Jing Lin417fa452012-02-05 14:31:06 -08002691};
2692
Jay Chokshi607f61b2012-04-25 18:21:21 -07002693#define SX150X_EXP1_INT_N PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9)
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05302694#define SX150X_EXP2_INT_N MSM_GPIO_TO_INT(81)
Jay Chokshi607f61b2012-04-25 18:21:21 -07002695
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002696struct sx150x_platform_data mpq8064_sx150x_pdata[] = {
2697 [SX150X_EXP1] = {
2698 .gpio_base = SX150X_EXP1_GPIO_BASE,
2699 .oscio_is_gpo = false,
2700 .io_pullup_ena = 0x0,
2701 .io_pulldn_ena = 0x0,
2702 .io_open_drain_ena = 0x0,
2703 .io_polarity = 0,
Jay Chokshi607f61b2012-04-25 18:21:21 -07002704 .irq_summary = SX150X_EXP1_INT_N,
2705 .irq_base = SX150X_EXP1_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002706 },
2707 [SX150X_EXP2] = {
2708 .gpio_base = SX150X_EXP2_GPIO_BASE,
2709 .oscio_is_gpo = false,
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05302710 .io_pullup_ena = 0x0f,
2711 .io_pulldn_ena = 0x70,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002712 .io_open_drain_ena = 0x0,
2713 .io_polarity = 0,
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05302714 .irq_summary = SX150X_EXP2_INT_N,
2715 .irq_base = SX150X_EXP2_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002716 },
2717 [SX150X_EXP3] = {
2718 .gpio_base = SX150X_EXP3_GPIO_BASE,
2719 .oscio_is_gpo = false,
2720 .io_pullup_ena = 0x0,
2721 .io_pulldn_ena = 0x0,
2722 .io_open_drain_ena = 0x0,
2723 .io_polarity = 0,
2724 .irq_summary = -1,
2725 },
2726 [SX150X_EXP4] = {
2727 .gpio_base = SX150X_EXP4_GPIO_BASE,
2728 .oscio_is_gpo = false,
2729 .io_pullup_ena = 0x0,
2730 .io_pulldn_ena = 0x0,
2731 .io_open_drain_ena = 0x0,
2732 .io_polarity = 0,
2733 .irq_summary = -1,
2734 },
2735};
2736
2737static struct i2c_board_info sx150x_gpio_exp_info[] = {
2738 {
2739 I2C_BOARD_INFO("sx1509q", 0x70),
2740 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP1],
2741 },
2742 {
2743 I2C_BOARD_INFO("sx1508q", 0x23),
2744 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP2],
2745 },
2746 {
2747 I2C_BOARD_INFO("sx1508q", 0x22),
2748 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP3],
2749 },
2750 {
2751 I2C_BOARD_INFO("sx1509q", 0x3E),
2752 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP4],
2753 },
2754};
2755
2756#define MPQ8064_I2C_GSBI5_BUS_ID 5
2757
2758static struct i2c_registry mpq8064_i2c_devices[] __initdata = {
2759 {
2760 I2C_MPQ_CDP,
2761 MPQ8064_I2C_GSBI5_BUS_ID,
2762 sx150x_gpio_exp_info,
2763 ARRAY_SIZE(sx150x_gpio_exp_info),
2764 },
2765};
2766
Jing Lin417fa452012-02-05 14:31:06 -08002767static void __init register_i2c_devices(void)
2768{
2769 u8 mach_mask = 0;
2770 int i;
2771
Kevin Chand07220e2012-02-13 15:52:22 -08002772#ifdef CONFIG_MSM_CAMERA
2773 struct i2c_registry apq8064_camera_i2c_devices = {
2774 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_RUMI,
2775 APQ_8064_GSBI4_QUP_I2C_BUS_ID,
2776 apq8064_camera_board_info.board_info,
2777 apq8064_camera_board_info.num_i2c_board_info,
2778 };
2779#endif
Jing Lin417fa452012-02-05 14:31:06 -08002780 /* Build the matching 'supported_machs' bitmask */
2781 if (machine_is_apq8064_cdp())
2782 mach_mask = I2C_SURF;
2783 else if (machine_is_apq8064_mtp())
2784 mach_mask = I2C_FFA;
2785 else if (machine_is_apq8064_liquid())
2786 mach_mask = I2C_LIQUID;
2787 else if (machine_is_apq8064_rumi3())
2788 mach_mask = I2C_RUMI;
2789 else if (machine_is_apq8064_sim())
2790 mach_mask = I2C_SIM;
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002791 else if (PLATFORM_IS_MPQ8064())
2792 mach_mask = I2C_MPQ_CDP;
Jing Lin417fa452012-02-05 14:31:06 -08002793 else
2794 pr_err("unmatched machine ID in register_i2c_devices\n");
2795
2796 /* Run the array and install devices as appropriate */
2797 for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) {
2798 if (apq8064_i2c_devices[i].machs & mach_mask)
2799 i2c_register_board_info(apq8064_i2c_devices[i].bus,
2800 apq8064_i2c_devices[i].info,
2801 apq8064_i2c_devices[i].len);
2802 }
Kevin Chand07220e2012-02-13 15:52:22 -08002803#ifdef CONFIG_MSM_CAMERA
2804 if (apq8064_camera_i2c_devices.machs & mach_mask)
2805 i2c_register_board_info(apq8064_camera_i2c_devices.bus,
2806 apq8064_camera_i2c_devices.info,
2807 apq8064_camera_i2c_devices.len);
2808#endif
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002809
2810 for (i = 0; i < ARRAY_SIZE(mpq8064_i2c_devices); ++i) {
2811 if (mpq8064_i2c_devices[i].machs & mach_mask)
2812 i2c_register_board_info(
2813 mpq8064_i2c_devices[i].bus,
2814 mpq8064_i2c_devices[i].info,
2815 mpq8064_i2c_devices[i].len);
2816 }
Jing Lin417fa452012-02-05 14:31:06 -08002817}
2818
Jay Chokshi994ff122012-03-27 15:43:48 -07002819static void enable_ddr3_regulator(void)
2820{
2821 static struct regulator *ext_ddr3;
2822
2823 /* Use MPP7 output state as a flag for PCDDR3 presence. */
2824 if (gpio_get_value_cansleep(PM8921_MPP_PM_TO_SYS(7)) > 0) {
2825 ext_ddr3 = regulator_get(NULL, "ext_ddr3");
2826 if (IS_ERR(ext_ddr3) || ext_ddr3 == NULL)
2827 pr_err("Could not get MPP7 regulator\n");
2828 else
2829 regulator_enable(ext_ddr3);
2830 }
2831}
2832
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002833static void enable_avc_i2c_bus(void)
2834{
2835 int avc_i2c_en_mpp = PM8921_MPP_PM_TO_SYS(8);
2836 int rc;
2837
2838 rc = gpio_request(avc_i2c_en_mpp, "avc_i2c_en");
2839 if (rc)
2840 pr_err("request for avc_i2c_en mpp failed,"
2841 "rc=%d\n", rc);
2842 else
2843 gpio_set_value_cansleep(avc_i2c_en_mpp, 1);
2844}
2845
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002846static void __init apq8064_common_init(void)
2847{
Joel King8f839b92012-04-01 14:37:46 -07002848 msm_tsens_early_init(&apq_tsens_pdata);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002849 if (socinfo_init() < 0)
2850 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06002851 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
2852 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
David Collins2782b5c2012-02-06 10:02:42 -08002853 regulator_suppress_info_printing();
2854 platform_device_register(&apq8064_device_rpm_regulator);
Stephen Boyd4d0d2582012-02-10 14:49:40 -08002855 if (msm_xo_init())
2856 pr_err("Failed to initialize XO votes\n");
Matt Wagantallc51e5602012-02-27 17:25:25 -08002857 msm_clock_init(&apq8064_clock_init_data);
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08002858 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06002859 apq8064_i2c_init();
Jing Lin417fa452012-02-05 14:31:06 -08002860 register_i2c_devices();
Kenneth Heitke36920d32011-07-20 16:44:30 -06002861
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002862 apq8064_device_qup_spi_gsbi5.dev.platform_data =
2863 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08002864 apq8064_init_pmic();
Hemant Kumar94e7da22012-02-03 16:52:29 -08002865 if (machine_is_apq8064_liquid())
2866 msm_otg_pdata.mhl_enable = true;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07002867
Ofir Cohen94213a72012-05-03 14:26:32 +03002868 android_usb_pdata.swfi_latency =
2869 msm_rpmrs_levels[0].latency_us;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07002870
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002871 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Manu Gautam91223e02011-11-08 15:27:22 +05302872 apq8064_ehci_host_init();
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002873 apq8064_init_buses();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002874 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Terence Hampson36b70722012-05-10 13:18:16 -04002875 if (!(machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
2876 machine_is_mpq8064_dtv()))
2877 platform_add_devices(common_not_mpq_devices,
2878 ARRAY_SIZE(common_not_mpq_devices));
Jay Chokshi994ff122012-03-27 15:43:48 -07002879 enable_ddr3_regulator();
Hemant Kumarf1ca9192012-02-07 18:59:33 -08002880 if (machine_is_apq8064_mtp()) {
2881 apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
2882 device_initialize(&apq8064_device_hsic_host.dev);
2883 }
Jay Chokshie8741282012-01-25 15:22:55 -08002884 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05302885 apq8064_init_mmc();
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08002886
2887 if (machine_is_apq8064_mtp()) {
2888 mdm_8064_device.dev.platform_data = &mdm_platform_data;
2889 platform_device_register(&mdm_8064_device);
2890 }
2891 platform_device_register(&apq8064_slim_ctrl);
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002892 slim_register_board_info(apq8064_slim_devices,
2893 ARRAY_SIZE(apq8064_slim_devices));
Jin Hongd3024e62012-02-09 16:13:32 -08002894 apq8064_init_dsps();
Praveen Chidambaram78499012011-11-01 17:15:17 -06002895 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Mahesh Sivasubramaniancbce1ec2012-01-24 10:32:44 -07002896 acpuclk_init(&acpuclk_8064_soc_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002897 msm_spm_l2_init(msm_spm_l2_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002898 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Praveen Chidambaram4d19be42012-04-03 18:05:52 -06002899 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002900 apq8064_epm_adc_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002901}
2902
Huaibin Yang4a084e32011-12-15 15:25:52 -08002903static void __init apq8064_allocate_memory_regions(void)
2904{
2905 apq8064_allocate_fb_region();
2906}
2907
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002908static void __init apq8064_sim_init(void)
2909{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002910 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
2911 &msm8064_device_watchdog.dev.platform_data;
2912
2913 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002914 apq8064_common_init();
Joel King4e7ad222011-08-17 15:47:38 -07002915 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
2916}
2917
2918static void __init apq8064_rumi3_init(void)
2919{
2920 apq8064_common_init();
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002921 ethernet_init();
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002922 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002923 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002924}
2925
Joel King82b7e3f2012-01-05 10:03:27 -08002926static void __init apq8064_cdp_init(void)
2927{
Hanumant Singh50440d42012-04-23 19:27:16 -07002928 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2929 pr_err("meminfo_init() failed!\n");
Joel King82b7e3f2012-01-05 10:03:27 -08002930 apq8064_common_init();
Joel King8f839b92012-04-01 14:37:46 -07002931 if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
2932 machine_is_mpq8064_dtv()) {
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002933 enable_avc_i2c_bus();
Joel King8f839b92012-04-01 14:37:46 -07002934 platform_add_devices(mpq_devices, ARRAY_SIZE(mpq_devices));
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002935 mpq8064_pcie_init();
Joel King8f839b92012-04-01 14:37:46 -07002936 } else {
2937 ethernet_init();
2938 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
2939 spi_register_board_info(spi_board_info,
2940 ARRAY_SIZE(spi_board_info));
2941 }
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002942 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07002943 apq8064_init_gpu();
Matt Wagantall1f65d9d2012-04-25 14:24:20 -07002944 platform_add_devices(apq8064_footswitch, apq8064_num_footswitch);
Kevin Chand07220e2012-02-13 15:52:22 -08002945 apq8064_init_cam();
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302946
2947 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
2948 platform_device_register(&cdp_kp_pdev);
2949
2950 if (machine_is_apq8064_mtp())
2951 platform_device_register(&mtp_kp_pdev);
Hanumant Singh50440d42012-04-23 19:27:16 -07002952
2953 change_memory_power = &apq8064_change_memory_power;
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05302954
2955 if (machine_is_mpq8064_cdp()) {
2956 platform_device_register(&mpq_gpio_keys_pdev);
2957 platform_device_register(&mpq_keypad_device);
2958 }
Joel King82b7e3f2012-01-05 10:03:27 -08002959}
2960
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002961MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
2962 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002963 .reserve = apq8064_reserve,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002964 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302965 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002966 .timer = &msm_timer,
2967 .init_machine = apq8064_sim_init,
2968MACHINE_END
2969
Joel King4e7ad222011-08-17 15:47:38 -07002970MACHINE_START(APQ8064_RUMI3, "QCT APQ8064 RUMI3")
2971 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002972 .reserve = apq8064_reserve,
Joel King4e7ad222011-08-17 15:47:38 -07002973 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302974 .handle_irq = gic_handle_irq,
Joel King4e7ad222011-08-17 15:47:38 -07002975 .timer = &msm_timer,
2976 .init_machine = apq8064_rumi3_init,
Huaibin Yang4a084e32011-12-15 15:25:52 -08002977 .init_early = apq8064_allocate_memory_regions,
Joel King4e7ad222011-08-17 15:47:38 -07002978MACHINE_END
2979
Joel King82b7e3f2012-01-05 10:03:27 -08002980MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
2981 .map_io = apq8064_map_io,
2982 .reserve = apq8064_reserve,
2983 .init_irq = apq8064_init_irq,
2984 .handle_irq = gic_handle_irq,
2985 .timer = &msm_timer,
2986 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002987 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07002988 .init_very_early = apq8064_early_reserve,
Joel King82b7e3f2012-01-05 10:03:27 -08002989MACHINE_END
2990
2991MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
2992 .map_io = apq8064_map_io,
2993 .reserve = apq8064_reserve,
2994 .init_irq = apq8064_init_irq,
2995 .handle_irq = gic_handle_irq,
2996 .timer = &msm_timer,
2997 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002998 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07002999 .init_very_early = apq8064_early_reserve,
Joel King82b7e3f2012-01-05 10:03:27 -08003000MACHINE_END
3001
3002MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
3003 .map_io = apq8064_map_io,
3004 .reserve = apq8064_reserve,
3005 .init_irq = apq8064_init_irq,
3006 .handle_irq = gic_handle_irq,
3007 .timer = &msm_timer,
3008 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003009 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003010 .init_very_early = apq8064_early_reserve,
Joel King82b7e3f2012-01-05 10:03:27 -08003011MACHINE_END
3012
Joel King064bbf82012-04-01 13:23:39 -07003013MACHINE_START(MPQ8064_CDP, "QCT MPQ8064 CDP")
3014 .map_io = apq8064_map_io,
3015 .reserve = apq8064_reserve,
3016 .init_irq = apq8064_init_irq,
3017 .handle_irq = gic_handle_irq,
3018 .timer = &msm_timer,
3019 .init_machine = apq8064_cdp_init,
3020 .init_early = apq8064_allocate_memory_regions,
3021 .init_very_early = apq8064_early_reserve,
3022MACHINE_END
3023
Joel King11ca8202012-02-13 16:19:03 -08003024MACHINE_START(MPQ8064_HRD, "QCT MPQ8064 HRD")
3025 .map_io = apq8064_map_io,
3026 .reserve = apq8064_reserve,
3027 .init_irq = apq8064_init_irq,
3028 .handle_irq = gic_handle_irq,
3029 .timer = &msm_timer,
3030 .init_machine = apq8064_cdp_init,
Joel King3a57e772012-05-28 11:22:55 -07003031 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003032 .init_very_early = apq8064_early_reserve,
Joel King11ca8202012-02-13 16:19:03 -08003033MACHINE_END
3034
3035MACHINE_START(MPQ8064_DTV, "QCT MPQ8064 DTV")
3036 .map_io = apq8064_map_io,
3037 .reserve = apq8064_reserve,
3038 .init_irq = apq8064_init_irq,
3039 .handle_irq = gic_handle_irq,
3040 .timer = &msm_timer,
3041 .init_machine = apq8064_cdp_init,
Joel King3a57e772012-05-28 11:22:55 -07003042 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003043 .init_very_early = apq8064_early_reserve,
Joel King11ca8202012-02-13 16:19:03 -08003044MACHINE_END
3045