blob: dc65c8c7326df5dee9145d42e89c1143dd5c7786 [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 Linf1208fd2012-02-23 11:15:42 -08001228 14, 1, 0, 22, 2, 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 */
1240 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
1241 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 */
1250 3, 0, 60, 115, 156, 99,
1251 /* T27 Object */
1252 0, 0, 0, 0, 0, 0, 0,
1253 /* T40 Object */
1254 0, 0, 0, 0, 0,
1255 /* T42 Object */
1256 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
1257 /* 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 */
1265 31, 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,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001759 100, 650, 801, 200,
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,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001766 2000, 200, 576000, 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,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001773 8500, 51, 1122000, 8500,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001774 },
1775
1776 {
1777 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1778 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
1779 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001780 9000, 51, 1130300, 9000,
1781 },
1782 {
1783 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1784 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
1785 false,
1786 10000, 51, 1130300, 10000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001787 },
1788
1789 {
1790 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1791 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1792 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001793 12000, 14, 2205900, 12000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001794 },
1795
1796 {
1797 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1798 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1799 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001800 18000, 12, 2364250, 18000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001801 },
1802
1803 {
1804 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1805 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1806 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001807 23500, 10, 2667000, 23500,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001808 },
1809
1810 {
1811 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1812 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1813 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001814 29700, 5, 2867000, 30000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001815 },
1816};
1817
1818static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1819 .mode = MSM_PM_BOOT_CONFIG_TZ,
1820};
1821
1822static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
1823 .levels = &msm_rpmrs_levels[0],
1824 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
1825 .vdd_mem_levels = {
1826 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
1827 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
1828 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
1829 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
1830 },
1831 .vdd_dig_levels = {
1832 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
1833 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
1834 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
1835 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
1836 },
1837 .vdd_mask = 0x7FFFFF,
1838 .rpmrs_target_id = {
1839 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
1840 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
1841 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
1842 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
1843 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
1844 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
1845 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
1846 },
1847};
1848
Praveen Chidambaram78499012011-11-01 17:15:17 -06001849static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1850 0x03, 0x0f,
1851};
1852
1853static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1854 0x00, 0x24, 0x54, 0x10,
1855 0x09, 0x03, 0x01,
1856 0x10, 0x54, 0x30, 0x0C,
1857 0x24, 0x30, 0x0f,
1858};
1859
1860static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1861 0x00, 0x24, 0x54, 0x10,
1862 0x09, 0x07, 0x01, 0x0B,
1863 0x10, 0x54, 0x30, 0x0C,
1864 0x24, 0x30, 0x0f,
1865};
1866
1867static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1868 [0] = {
1869 .mode = MSM_SPM_MODE_CLOCK_GATING,
1870 .notify_rpm = false,
1871 .cmd = spm_wfi_cmd_sequence,
1872 },
1873 [1] = {
1874 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1875 .notify_rpm = false,
1876 .cmd = spm_power_collapse_without_rpm,
1877 },
1878 [2] = {
1879 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1880 .notify_rpm = true,
1881 .cmd = spm_power_collapse_with_rpm,
1882 },
1883};
1884
1885static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1886 0x00, 0x20, 0x03, 0x20,
1887 0x00, 0x0f,
1888};
1889
1890static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1891 0x00, 0x20, 0x34, 0x64,
1892 0x48, 0x07, 0x48, 0x20,
1893 0x50, 0x64, 0x04, 0x34,
1894 0x50, 0x0f,
1895};
1896static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1897 0x00, 0x10, 0x34, 0x64,
1898 0x48, 0x07, 0x48, 0x10,
1899 0x50, 0x64, 0x04, 0x34,
1900 0x50, 0x0F,
1901};
1902
1903static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1904 [0] = {
1905 .mode = MSM_SPM_L2_MODE_RETENTION,
1906 .notify_rpm = false,
1907 .cmd = l2_spm_wfi_cmd_sequence,
1908 },
1909 [1] = {
1910 .mode = MSM_SPM_L2_MODE_GDHS,
1911 .notify_rpm = true,
1912 .cmd = l2_spm_gdhs_cmd_sequence,
1913 },
1914 [2] = {
1915 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1916 .notify_rpm = true,
1917 .cmd = l2_spm_power_off_cmd_sequence,
1918 },
1919};
1920
1921
1922static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1923 [0] = {
1924 .reg_base_addr = MSM_SAW_L2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001925 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001926 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001927 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1928 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1929 .modes = msm_spm_l2_seq_list,
1930 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1931 },
1932};
1933
1934static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1935 [0] = {
1936 .reg_base_addr = MSM_SAW0_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001937 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001938#if defined(CONFIG_MSM_AVS_HW)
1939 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1940 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1941#endif
1942 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001943 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001944 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1945 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1946 .vctl_timeout_us = 50,
1947 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1948 .modes = msm_spm_seq_list,
1949 },
1950 [1] = {
1951 .reg_base_addr = MSM_SAW1_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001952 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001953#if defined(CONFIG_MSM_AVS_HW)
1954 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1955 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1956#endif
1957 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001958 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001959 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1960 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1961 .vctl_timeout_us = 50,
1962 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1963 .modes = msm_spm_seq_list,
1964 },
1965 [2] = {
1966 .reg_base_addr = MSM_SAW2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001967 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001968#if defined(CONFIG_MSM_AVS_HW)
1969 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1970 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1971#endif
1972 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001973 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001974 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1975 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1976 .vctl_timeout_us = 50,
1977 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1978 .modes = msm_spm_seq_list,
1979 },
1980 [3] = {
1981 .reg_base_addr = MSM_SAW3_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001982 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001983#if defined(CONFIG_MSM_AVS_HW)
1984 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1985 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1986#endif
1987 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001988 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001989 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1990 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1991 .vctl_timeout_us = 50,
1992 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1993 .modes = msm_spm_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001994 },
1995};
1996
Praveen Chidambaram4d19be42012-04-03 18:05:52 -06001997static struct msm_pm_sleep_status_data msm_pm_slp_sts_data = {
1998 .base_addr = MSM_ACC0_BASE + 0x08,
1999 .cpu_offset = MSM_ACC1_BASE - MSM_ACC0_BASE,
2000 .mask = 1UL << 13,
2001};
2002
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002003static void __init apq8064_init_buses(void)
2004{
2005 msm_bus_rpm_set_mt_mask();
2006 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
2007 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
2008 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
2009 msm_bus_8064_apps_fabric.dev.platform_data =
2010 &msm_bus_8064_apps_fabric_pdata;
2011 msm_bus_8064_sys_fabric.dev.platform_data =
2012 &msm_bus_8064_sys_fabric_pdata;
2013 msm_bus_8064_mm_fabric.dev.platform_data =
2014 &msm_bus_8064_mm_fabric_pdata;
2015 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
2016 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
2017}
2018
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002019/* PCIe gpios */
2020static struct msm_pcie_gpio_info_t msm_pcie_gpio_info[MSM_PCIE_MAX_GPIO] = {
2021 {"rst_n", PM8921_MPP_PM_TO_SYS(PCIE_RST_N_PMIC_MPP), 0},
2022 {"pwr_en", PM8921_GPIO_PM_TO_SYS(PCIE_PWR_EN_PMIC_GPIO), 1},
2023};
2024
2025static struct msm_pcie_platform msm_pcie_platform_data = {
2026 .gpio = msm_pcie_gpio_info,
2027};
2028
2029static void __init mpq8064_pcie_init(void)
2030{
2031 msm_device_pcie.dev.platform_data = &msm_pcie_platform_data;
2032 platform_device_register(&msm_device_pcie);
2033}
2034
David Collinsf0d00732012-01-25 15:46:50 -08002035static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
2036 .name = GPIO_REGULATOR_DEV_NAME,
2037 .id = PM8921_MPP_PM_TO_SYS(7),
2038 .dev = {
2039 .platform_data
2040 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2041 },
2042};
2043
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08002044static struct platform_device apq8064_device_ext_mpp8_vreg __devinitdata = {
2045 .name = GPIO_REGULATOR_DEV_NAME,
2046 .id = PM8921_MPP_PM_TO_SYS(8),
2047 .dev = {
2048 .platform_data
2049 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_MPP8],
2050 },
2051};
2052
David Collinsf0d00732012-01-25 15:46:50 -08002053static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
2054 .name = GPIO_REGULATOR_DEV_NAME,
2055 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
2056 .dev = {
2057 .platform_data =
2058 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2059 },
2060};
2061
David Collins390fc332012-02-07 14:38:16 -08002062static struct platform_device apq8064_device_ext_ts_sw_vreg __devinitdata = {
2063 .name = GPIO_REGULATOR_DEV_NAME,
2064 .id = PM8921_GPIO_PM_TO_SYS(23),
2065 .dev = {
2066 .platform_data
2067 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_TS_SW],
2068 },
2069};
2070
David Collins2782b5c2012-02-06 10:02:42 -08002071static struct platform_device apq8064_device_rpm_regulator __devinitdata = {
2072 .name = "rpm-regulator",
2073 .id = -1,
2074 .dev = {
2075 .platform_data = &apq8064_rpm_regulator_pdata,
2076 },
2077};
2078
Ravi Kumar V05931a22012-04-04 17:09:37 +05302079static struct gpio_ir_recv_platform_data gpio_ir_recv_pdata = {
2080 .gpio_nr = 88,
2081 .active_low = 1,
2082};
2083
2084static struct platform_device gpio_ir_recv_pdev = {
2085 .name = "gpio-rc-recv",
2086 .dev = {
2087 .platform_data = &gpio_ir_recv_pdata,
2088 },
2089};
2090
Terence Hampson36b70722012-05-10 13:18:16 -04002091static struct platform_device *common_not_mpq_devices[] __initdata = {
David Keitel3c40fc52012-02-09 17:53:52 -08002092 &apq8064_device_qup_i2c_gsbi1,
Jing Lin04601f92012-02-05 15:36:07 -08002093 &apq8064_device_qup_i2c_gsbi3,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002094 &apq8064_device_qup_i2c_gsbi4,
Terence Hampson36b70722012-05-10 13:18:16 -04002095};
2096
2097static struct platform_device *common_devices[] __initdata = {
2098 &apq8064_device_dmov,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002099 &apq8064_device_qup_spi_gsbi5,
David Collinsf0d00732012-01-25 15:46:50 -08002100 &apq8064_device_ext_5v_vreg,
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08002101 &apq8064_device_ext_mpp8_vreg,
David Collinsf0d00732012-01-25 15:46:50 -08002102 &apq8064_device_ext_3p3v_vreg,
David Collins390fc332012-02-07 14:38:16 -08002103 &apq8064_device_ext_ts_sw_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07002104 &apq8064_device_ssbi_pmic1,
2105 &apq8064_device_ssbi_pmic2,
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06002106 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07002107 &apq8064_device_otg,
2108 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08002109 &apq8064_device_hsusb_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07002110 &android_usb_device,
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08002111 &msm_device_wcnss_wlan,
Ankit Vermab7c26e62012-02-28 15:04:15 -08002112 &msm_device_iris_fm,
Larry Bassel67b921d2012-04-06 10:23:27 -07002113 &apq8064_fmem_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08002114#ifdef CONFIG_ANDROID_PMEM
2115#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002116 &apq8064_android_pmem_device,
2117 &apq8064_android_pmem_adsp_device,
2118 &apq8064_android_pmem_audio_device,
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -07002119#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
2120#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -08002121#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002122 &apq8064_ion_dev,
Olav Haugan7c6aa742012-01-16 16:47:37 -08002123#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002124 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08002125 &msm8064_device_saw_regulator_core0,
2126 &msm8064_device_saw_regulator_core1,
2127 &msm8064_device_saw_regulator_core2,
2128 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002129#if defined(CONFIG_QSEECOM)
2130 &qseecom_device,
2131#endif
2132
Ramesh Masavarapu28311912011-10-27 11:04:12 -07002133#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2134 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2135 &qcrypto_device,
2136#endif
2137
2138#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2139 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2140 &qcedev_device,
2141#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07002142
2143#ifdef CONFIG_HW_RANDOM_MSM
2144 &apq8064_device_rng,
2145#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002146 &apq_pcm,
2147 &apq_pcm_routing,
2148 &apq_cpudai0,
2149 &apq_cpudai1,
Santosh Mardieff9a742012-04-09 23:23:39 +05302150 &mpq_cpudai_sec_i2s_rx,
Kuirong Wangf23f8c52012-03-31 12:34:51 -07002151 &mpq_cpudai_mi2s_tx,
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002152 &apq_cpudai_hdmi_rx,
2153 &apq_cpudai_bt_rx,
2154 &apq_cpudai_bt_tx,
2155 &apq_cpudai_fm_rx,
2156 &apq_cpudai_fm_tx,
2157 &apq_cpu_fe,
2158 &apq_stub_codec,
2159 &apq_voice,
2160 &apq_voip,
2161 &apq_lpa_pcm,
Krishnankutty Kolathappilly4374e332012-03-18 22:27:30 -07002162 &apq_compr_dsp,
2163 &apq_multi_ch_pcm,
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002164 &apq_pcm_hostless,
2165 &apq_cpudai_afe_01_rx,
2166 &apq_cpudai_afe_01_tx,
2167 &apq_cpudai_afe_02_rx,
2168 &apq_cpudai_afe_02_tx,
2169 &apq_pcm_afe,
2170 &apq_cpudai_auxpcm_rx,
2171 &apq_cpudai_auxpcm_tx,
Neema Shetty8427c262012-02-16 11:23:43 -08002172 &apq_cpudai_stub,
Neema Shetty3c9d2862012-03-11 01:25:32 -08002173 &apq_cpudai_slimbus_1_rx,
2174 &apq_cpudai_slimbus_1_tx,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002175 &apq_cpudai_slimbus_2_tx,
Neema Shettyc9d86c32012-05-09 12:01:39 -07002176 &apq_cpudai_slimbus_3_rx,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002177 &apq8064_rpm_device,
2178 &apq8064_rpm_log_device,
2179 &apq8064_rpm_stat_device,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002180 &msm_bus_8064_apps_fabric,
2181 &msm_bus_8064_sys_fabric,
2182 &msm_bus_8064_mm_fabric,
2183 &msm_bus_8064_sys_fpb,
2184 &msm_bus_8064_cpss_fpb,
Mohan Kumar Gubbihalli Lachma Naik7f72edd2012-02-06 17:26:47 -08002185 &apq8064_msm_device_vidc,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07002186 &msm_pil_dsps,
Matt Wagantalled832652012-02-02 19:23:17 -08002187 &msm_8960_riva,
Matt Wagantallb94b9a52012-02-02 21:59:54 -08002188 &msm_8960_q6_lpass,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002189 &msm_pil_vidc,
Matt Wagantall292aace2012-01-26 19:12:34 -08002190 &msm_gss,
Laura Abbottb93525f2012-04-12 09:57:19 -07002191 &apq8064_rtb_device,
Praveen Chidambaram8ea3dcd2011-12-07 14:46:31 -07002192 &apq8064_cpu_idle_device,
Praveen Chidambaram5c8adf22012-02-23 18:44:37 -07002193 &apq8064_msm_gov_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002194 &apq8064_device_cache_erp,
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002195 &epm_adc_device,
Pratik Patel212ab362012-03-16 12:30:07 -07002196 &apq8064_qdss_device,
2197 &msm_etb_device,
2198 &msm_tpiu_device,
2199 &msm_funnel_device,
2200 &apq8064_etm_device,
Helen Zeng8f925502012-03-05 16:50:17 -08002201 &apq_cpudai_slim_4_rx,
2202 &apq_cpudai_slim_4_tx,
Jignesh Mehta921649d2012-04-19 06:57:23 -07002203 &msm8960_gemini_device,
Laura Abbott0577d7b2012-04-17 11:14:30 -07002204 &apq8064_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002205 &msm_tsens_device,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002206};
2207
Joel King4e7ad222011-08-17 15:47:38 -07002208static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002209 &apq8064_device_uart_gsbi3,
Yan He06913ce2011-08-26 16:33:46 -07002210 &msm_device_sps_apq8064,
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002211};
2212
2213static struct platform_device *rumi3_devices[] __initdata = {
2214 &apq8064_device_uart_gsbi1,
Yan He435ed612011-11-23 17:34:59 -08002215 &msm_device_sps_apq8064,
Huaibin Yang4a084e32011-12-15 15:25:52 -08002216#ifdef CONFIG_MSM_ROTATOR
2217 &msm_rotator_device,
2218#endif
Joel King4e7ad222011-08-17 15:47:38 -07002219};
2220
Joel King82b7e3f2012-01-05 10:03:27 -08002221static struct platform_device *cdp_devices[] __initdata = {
2222 &apq8064_device_uart_gsbi1,
Jin Hong4bbbfba2012-02-02 21:48:07 -08002223 &apq8064_device_uart_gsbi7,
Joel King82b7e3f2012-01-05 10:03:27 -08002224 &msm_device_sps_apq8064,
Aravind Venkateswaran4ca27532012-02-16 14:27:05 -08002225#ifdef CONFIG_MSM_ROTATOR
2226 &msm_rotator_device,
2227#endif
Joel King82b7e3f2012-01-05 10:03:27 -08002228};
2229
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002230static struct platform_device
2231mpq8064_device_ext_5v_frc_vreg __devinitdata = {
2232 .name = GPIO_REGULATOR_DEV_NAME,
2233 .id = SX150X_GPIO(4, 10),
2234 .dev = {
2235 .platform_data =
2236 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_FRC_5V],
2237 },
2238};
2239
2240static struct platform_device
2241mpq8064_device_ext_1p2_buck_vreg __devinitdata = {
2242 .name = GPIO_REGULATOR_DEV_NAME,
2243 .id = SX150X_GPIO(4, 2),
2244 .dev = {
2245 .platform_data =
2246 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P2V],
2247 },
2248};
2249
2250static struct platform_device
2251mpq8064_device_ext_1p8_buck_vreg __devinitdata = {
2252 .name = GPIO_REGULATOR_DEV_NAME,
2253 .id = SX150X_GPIO(4, 4),
2254 .dev = {
2255 .platform_data =
2256 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P8V],
2257 },
2258};
2259
2260static struct platform_device
2261mpq8064_device_ext_2p2_buck_vreg __devinitdata = {
2262 .name = GPIO_REGULATOR_DEV_NAME,
2263 .id = SX150X_GPIO(4, 14),
2264 .dev = {
2265 .platform_data =
2266 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_2P2V],
2267 },
2268};
2269
2270static struct platform_device
2271mpq8064_device_ext_5v_buck_vreg __devinitdata = {
2272 .name = GPIO_REGULATOR_DEV_NAME,
2273 .id = SX150X_GPIO(4, 3),
2274 .dev = {
2275 .platform_data =
2276 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_5V],
2277 },
2278};
2279
2280static struct platform_device
2281mpq8064_device_ext_3p3v_ldo_vreg __devinitdata = {
2282 .name = GPIO_REGULATOR_DEV_NAME,
2283 .id = SX150X_GPIO(4, 15),
2284 .dev = {
2285 .platform_data =
2286 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_3P3V],
2287 },
2288};
2289
Ravi Kumar V1c903012012-05-15 16:11:35 +05302290static struct platform_device rc_input_loopback_pdev = {
2291 .name = "rc-user-input",
2292 .id = -1,
2293};
2294
Ravi Kumar V040eeff2012-05-23 21:29:23 +05302295static int rf4ce_gpio_init(void)
2296{
2297 if (!machine_is_mpq8064_cdp())
2298 return -EINVAL;
2299
2300 /* CC2533 SRDY Input */
2301 if (!gpio_request(SX150X_GPIO(4, 6), "rf4ce_srdy")) {
2302 gpio_direction_input(SX150X_GPIO(4, 6));
2303 gpio_export(SX150X_GPIO(4, 6), true);
2304 }
2305
2306 /* CC2533 MRDY Output */
2307 if (!gpio_request(SX150X_GPIO(4, 5), "rf4ce_mrdy")) {
2308 gpio_direction_output(SX150X_GPIO(4, 5), 1);
2309 gpio_export(SX150X_GPIO(4, 5), true);
2310 }
2311
2312 /* CC2533 Reset Output */
2313 if (!gpio_request(SX150X_GPIO(4, 7), "rf4ce_reset")) {
2314 gpio_direction_output(SX150X_GPIO(4, 7), 0);
2315 gpio_export(SX150X_GPIO(4, 7), true);
2316 }
2317
2318 return 0;
2319}
2320late_initcall(rf4ce_gpio_init);
2321
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002322static struct platform_device *mpq_devices[] __initdata = {
2323 &msm_device_sps_apq8064,
2324 &mpq8064_device_qup_i2c_gsbi5,
2325#ifdef CONFIG_MSM_ROTATOR
2326 &msm_rotator_device,
2327#endif
Ravi Kumar V05931a22012-04-04 17:09:37 +05302328 &gpio_ir_recv_pdev,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002329 &mpq8064_device_ext_5v_frc_vreg,
2330 &mpq8064_device_ext_1p2_buck_vreg,
2331 &mpq8064_device_ext_1p8_buck_vreg,
2332 &mpq8064_device_ext_2p2_buck_vreg,
2333 &mpq8064_device_ext_5v_buck_vreg,
2334 &mpq8064_device_ext_3p3v_ldo_vreg,
Terence Hampson2e1705f2012-04-11 19:55:29 -04002335#ifdef CONFIG_MSM_VCAP
2336 &msm8064_device_vcap,
2337#endif
Ravi Kumar V1c903012012-05-15 16:11:35 +05302338 &rc_input_loopback_pdev,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002339};
2340
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002341static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002342 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002343};
2344
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002345#define KS8851_IRQ_GPIO 43
2346
2347static struct spi_board_info spi_board_info[] __initdata = {
2348 {
2349 .modalias = "ks8851",
2350 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2351 .max_speed_hz = 19200000,
2352 .bus_num = 0,
2353 .chip_select = 2,
2354 .mode = SPI_MODE_0,
2355 },
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002356 {
2357 .modalias = "epm_adc",
2358 .max_speed_hz = 1100000,
2359 .bus_num = 0,
2360 .chip_select = 3,
2361 .mode = SPI_MODE_0,
2362 },
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002363};
2364
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002365static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002366 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08002367 .bus_num = 1,
2368 .slim_slave = &apq8064_slim_tabla,
2369 },
2370 {
2371 .bus_num = 1,
2372 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002373 },
2374 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002375};
2376
David Keitel3c40fc52012-02-09 17:53:52 -08002377static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi1_pdata = {
2378 .clk_freq = 100000,
2379 .src_clk_rate = 24000000,
2380};
2381
Jing Lin04601f92012-02-05 15:36:07 -08002382static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi3_pdata = {
Anirudh Ghayalc2163472012-04-10 14:58:14 +05302383 .clk_freq = 384000,
Jing Lin04601f92012-02-05 15:36:07 -08002384 .src_clk_rate = 24000000,
2385};
2386
Kenneth Heitke748593a2011-07-15 15:45:11 -06002387static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
2388 .clk_freq = 100000,
2389 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002390};
2391
Joel King8f839b92012-04-01 14:37:46 -07002392static struct msm_i2c_platform_data mpq8064_i2c_qup_gsbi5_pdata = {
2393 .clk_freq = 100000,
2394 .src_clk_rate = 24000000,
2395};
2396
David Keitel3c40fc52012-02-09 17:53:52 -08002397#define GSBI_DUAL_MODE_CODE 0x60
2398#define MSM_GSBI1_PHYS 0x12440000
Kenneth Heitke748593a2011-07-15 15:45:11 -06002399static void __init apq8064_i2c_init(void)
2400{
David Keitel3c40fc52012-02-09 17:53:52 -08002401 void __iomem *gsbi_mem;
2402
2403 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2404 &apq8064_i2c_qup_gsbi1_pdata;
2405 gsbi_mem = ioremap_nocache(MSM_GSBI1_PHYS, 4);
2406 writel_relaxed(GSBI_DUAL_MODE_CODE, gsbi_mem);
2407 /* Ensure protocol code is written before proceeding */
2408 wmb();
2409 iounmap(gsbi_mem);
2410 apq8064_i2c_qup_gsbi1_pdata.use_gsbi_shared_mode = 1;
Jing Lin04601f92012-02-05 15:36:07 -08002411 apq8064_device_qup_i2c_gsbi3.dev.platform_data =
2412 &apq8064_i2c_qup_gsbi3_pdata;
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002413 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2414 &apq8064_i2c_qup_gsbi1_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002415 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
2416 &apq8064_i2c_qup_gsbi4_pdata;
Joel King8f839b92012-04-01 14:37:46 -07002417 mpq8064_device_qup_i2c_gsbi5.dev.platform_data =
2418 &mpq8064_i2c_qup_gsbi5_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002419}
2420
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002421#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002422static int ethernet_init(void)
2423{
2424 int ret;
2425 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
2426 if (ret) {
2427 pr_err("ks8851 gpio_request failed: %d\n", ret);
2428 goto fail;
2429 }
2430
2431 return 0;
2432fail:
2433 return ret;
2434}
2435#else
2436static int ethernet_init(void)
2437{
2438 return 0;
2439}
2440#endif
2441
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302442#define GPIO_KEY_HOME PM8921_GPIO_PM_TO_SYS(27)
2443#define GPIO_KEY_VOLUME_UP PM8921_GPIO_PM_TO_SYS(35)
2444#define GPIO_KEY_VOLUME_DOWN PM8921_GPIO_PM_TO_SYS(38)
2445#define GPIO_KEY_CAM_FOCUS PM8921_GPIO_PM_TO_SYS(3)
2446#define GPIO_KEY_CAM_SNAP PM8921_GPIO_PM_TO_SYS(4)
Jing Lin3f8f8422012-03-05 09:32:11 -08002447#define GPIO_KEY_ROTATION PM8921_GPIO_PM_TO_SYS(42)
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302448
2449static struct gpio_keys_button cdp_keys[] = {
2450 {
2451 .code = KEY_HOME,
2452 .gpio = GPIO_KEY_HOME,
2453 .desc = "home_key",
2454 .active_low = 1,
2455 .type = EV_KEY,
2456 .wakeup = 1,
2457 .debounce_interval = 15,
2458 },
2459 {
2460 .code = KEY_VOLUMEUP,
2461 .gpio = GPIO_KEY_VOLUME_UP,
2462 .desc = "volume_up_key",
2463 .active_low = 1,
2464 .type = EV_KEY,
2465 .wakeup = 1,
2466 .debounce_interval = 15,
2467 },
2468 {
2469 .code = KEY_VOLUMEDOWN,
2470 .gpio = GPIO_KEY_VOLUME_DOWN,
2471 .desc = "volume_down_key",
2472 .active_low = 1,
2473 .type = EV_KEY,
2474 .wakeup = 1,
2475 .debounce_interval = 15,
2476 },
2477 {
2478 .code = SW_ROTATE_LOCK,
2479 .gpio = GPIO_KEY_ROTATION,
2480 .desc = "rotate_key",
2481 .active_low = 1,
2482 .type = EV_SW,
2483 .debounce_interval = 15,
2484 },
2485};
2486
2487static struct gpio_keys_platform_data cdp_keys_data = {
2488 .buttons = cdp_keys,
2489 .nbuttons = ARRAY_SIZE(cdp_keys),
2490};
2491
2492static struct platform_device cdp_kp_pdev = {
2493 .name = "gpio-keys",
2494 .id = -1,
2495 .dev = {
2496 .platform_data = &cdp_keys_data,
2497 },
2498};
2499
2500static struct gpio_keys_button mtp_keys[] = {
2501 {
2502 .code = KEY_CAMERA_FOCUS,
2503 .gpio = GPIO_KEY_CAM_FOCUS,
2504 .desc = "cam_focus_key",
2505 .active_low = 1,
2506 .type = EV_KEY,
2507 .wakeup = 1,
2508 .debounce_interval = 15,
2509 },
2510 {
2511 .code = KEY_VOLUMEUP,
2512 .gpio = GPIO_KEY_VOLUME_UP,
2513 .desc = "volume_up_key",
2514 .active_low = 1,
2515 .type = EV_KEY,
2516 .wakeup = 1,
2517 .debounce_interval = 15,
2518 },
2519 {
2520 .code = KEY_VOLUMEDOWN,
2521 .gpio = GPIO_KEY_VOLUME_DOWN,
2522 .desc = "volume_down_key",
2523 .active_low = 1,
2524 .type = EV_KEY,
2525 .wakeup = 1,
2526 .debounce_interval = 15,
2527 },
2528 {
2529 .code = KEY_CAMERA_SNAPSHOT,
2530 .gpio = GPIO_KEY_CAM_SNAP,
2531 .desc = "cam_snap_key",
2532 .active_low = 1,
2533 .type = EV_KEY,
2534 .debounce_interval = 15,
2535 },
2536};
2537
2538static struct gpio_keys_platform_data mtp_keys_data = {
2539 .buttons = mtp_keys,
2540 .nbuttons = ARRAY_SIZE(mtp_keys),
2541};
2542
2543static struct platform_device mtp_kp_pdev = {
2544 .name = "gpio-keys",
2545 .id = -1,
2546 .dev = {
2547 .platform_data = &mtp_keys_data,
2548 },
2549};
2550
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05302551static struct gpio_keys_button mpq_keys[] = {
2552 {
2553 .code = KEY_VOLUMEDOWN,
2554 .gpio = GPIO_KEY_VOLUME_DOWN,
2555 .desc = "volume_down_key",
2556 .active_low = 1,
2557 .type = EV_KEY,
2558 .wakeup = 1,
2559 .debounce_interval = 15,
2560 },
2561 {
2562 .code = KEY_VOLUMEUP,
2563 .gpio = GPIO_KEY_VOLUME_UP,
2564 .desc = "volume_up_key",
2565 .active_low = 1,
2566 .type = EV_KEY,
2567 .wakeup = 1,
2568 .debounce_interval = 15,
2569 },
2570};
2571
2572static struct gpio_keys_platform_data mpq_keys_data = {
2573 .buttons = mpq_keys,
2574 .nbuttons = ARRAY_SIZE(mpq_keys),
2575};
2576
2577static struct platform_device mpq_gpio_keys_pdev = {
2578 .name = "gpio-keys",
2579 .id = -1,
2580 .dev = {
2581 .platform_data = &mpq_keys_data,
2582 },
2583};
2584
2585#define MPQ_KP_ROW_BASE SX150X_EXP2_GPIO_BASE
2586#define MPQ_KP_COL_BASE (SX150X_EXP2_GPIO_BASE + 4)
2587
2588static unsigned int mpq_row_gpios[] = {MPQ_KP_ROW_BASE, MPQ_KP_ROW_BASE + 1,
2589 MPQ_KP_ROW_BASE + 2, MPQ_KP_ROW_BASE + 3};
2590static unsigned int mpq_col_gpios[] = {MPQ_KP_COL_BASE, MPQ_KP_COL_BASE + 1,
2591 MPQ_KP_COL_BASE + 2};
2592
2593static const unsigned int mpq_keymap[] = {
2594 KEY(0, 0, KEY_UP),
2595 KEY(0, 1, KEY_ENTER),
2596 KEY(0, 2, KEY_3),
2597
2598 KEY(1, 0, KEY_DOWN),
2599 KEY(1, 1, KEY_EXIT),
2600 KEY(1, 2, KEY_4),
2601
2602 KEY(2, 0, KEY_LEFT),
2603 KEY(2, 1, KEY_1),
2604 KEY(2, 2, KEY_5),
2605
2606 KEY(3, 0, KEY_RIGHT),
2607 KEY(3, 1, KEY_2),
2608 KEY(3, 2, KEY_6),
2609};
2610
2611static struct matrix_keymap_data mpq_keymap_data = {
2612 .keymap_size = ARRAY_SIZE(mpq_keymap),
2613 .keymap = mpq_keymap,
2614};
2615
2616static struct matrix_keypad_platform_data mpq_keypad_data = {
2617 .keymap_data = &mpq_keymap_data,
2618 .row_gpios = mpq_row_gpios,
2619 .col_gpios = mpq_col_gpios,
2620 .num_row_gpios = ARRAY_SIZE(mpq_row_gpios),
2621 .num_col_gpios = ARRAY_SIZE(mpq_col_gpios),
2622 .col_scan_delay_us = 32000,
2623 .debounce_ms = 20,
2624 .wakeup = 1,
2625 .active_low = 1,
2626 .no_autorepeat = 1,
2627};
2628
2629static struct platform_device mpq_keypad_device = {
2630 .name = "matrix-keypad",
2631 .id = -1,
2632 .dev = {
2633 .platform_data = &mpq_keypad_data,
2634 },
2635};
2636
Jin Hongd3024e62012-02-09 16:13:32 -08002637/* Sensors DSPS platform data */
2638#define DSPS_PIL_GENERIC_NAME "dsps"
2639static void __init apq8064_init_dsps(void)
2640{
2641 struct msm_dsps_platform_data *pdata =
2642 msm_dsps_device_8064.dev.platform_data;
2643 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
2644 pdata->gpios = NULL;
2645 pdata->gpios_num = 0;
2646
2647 platform_device_register(&msm_dsps_device_8064);
2648}
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302649
Jing Lin417fa452012-02-05 14:31:06 -08002650#define I2C_SURF 1
2651#define I2C_FFA (1 << 1)
2652#define I2C_RUMI (1 << 2)
2653#define I2C_SIM (1 << 3)
2654#define I2C_LIQUID (1 << 4)
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002655#define I2C_MPQ_CDP BIT(5)
2656#define I2C_MPQ_HRD BIT(6)
2657#define I2C_MPQ_DTV BIT(7)
Jing Lin417fa452012-02-05 14:31:06 -08002658
2659struct i2c_registry {
2660 u8 machs;
2661 int bus;
2662 struct i2c_board_info *info;
2663 int len;
2664};
2665
2666static struct i2c_registry apq8064_i2c_devices[] __initdata = {
Jing Lin21ed4de2012-02-05 15:53:28 -08002667 {
David Keitel2f613d92012-02-15 11:29:16 -08002668 I2C_LIQUID,
2669 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
2670 smb349_charger_i2c_info,
2671 ARRAY_SIZE(smb349_charger_i2c_info)
2672 },
2673 {
Jing Lin21ed4de2012-02-05 15:53:28 -08002674 I2C_SURF | I2C_LIQUID,
2675 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
2676 mxt_device_info,
2677 ARRAY_SIZE(mxt_device_info),
2678 },
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08002679 {
2680 I2C_FFA,
2681 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
2682 cyttsp_info,
2683 ARRAY_SIZE(cyttsp_info),
2684 },
Amy Maloche70090f992012-02-16 16:35:26 -08002685 {
2686 I2C_FFA | I2C_LIQUID,
2687 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
2688 isa1200_board_info,
2689 ARRAY_SIZE(isa1200_board_info),
2690 },
Santosh Mardieff9a742012-04-09 23:23:39 +05302691 {
2692 I2C_MPQ_CDP,
2693 APQ_8064_GSBI5_QUP_I2C_BUS_ID,
2694 cs8427_device_info,
2695 ARRAY_SIZE(cs8427_device_info),
2696 },
Jing Lin417fa452012-02-05 14:31:06 -08002697};
2698
Jay Chokshi607f61b2012-04-25 18:21:21 -07002699#define SX150X_EXP1_INT_N PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9)
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05302700#define SX150X_EXP2_INT_N MSM_GPIO_TO_INT(81)
Jay Chokshi607f61b2012-04-25 18:21:21 -07002701
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002702struct sx150x_platform_data mpq8064_sx150x_pdata[] = {
2703 [SX150X_EXP1] = {
2704 .gpio_base = SX150X_EXP1_GPIO_BASE,
2705 .oscio_is_gpo = false,
2706 .io_pullup_ena = 0x0,
2707 .io_pulldn_ena = 0x0,
2708 .io_open_drain_ena = 0x0,
2709 .io_polarity = 0,
Jay Chokshi607f61b2012-04-25 18:21:21 -07002710 .irq_summary = SX150X_EXP1_INT_N,
2711 .irq_base = SX150X_EXP1_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002712 },
2713 [SX150X_EXP2] = {
2714 .gpio_base = SX150X_EXP2_GPIO_BASE,
2715 .oscio_is_gpo = false,
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05302716 .io_pullup_ena = 0x0f,
2717 .io_pulldn_ena = 0x70,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002718 .io_open_drain_ena = 0x0,
2719 .io_polarity = 0,
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05302720 .irq_summary = SX150X_EXP2_INT_N,
2721 .irq_base = SX150X_EXP2_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002722 },
2723 [SX150X_EXP3] = {
2724 .gpio_base = SX150X_EXP3_GPIO_BASE,
2725 .oscio_is_gpo = false,
2726 .io_pullup_ena = 0x0,
2727 .io_pulldn_ena = 0x0,
2728 .io_open_drain_ena = 0x0,
2729 .io_polarity = 0,
2730 .irq_summary = -1,
2731 },
2732 [SX150X_EXP4] = {
2733 .gpio_base = SX150X_EXP4_GPIO_BASE,
2734 .oscio_is_gpo = false,
2735 .io_pullup_ena = 0x0,
2736 .io_pulldn_ena = 0x0,
2737 .io_open_drain_ena = 0x0,
2738 .io_polarity = 0,
2739 .irq_summary = -1,
2740 },
2741};
2742
2743static struct i2c_board_info sx150x_gpio_exp_info[] = {
2744 {
2745 I2C_BOARD_INFO("sx1509q", 0x70),
2746 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP1],
2747 },
2748 {
2749 I2C_BOARD_INFO("sx1508q", 0x23),
2750 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP2],
2751 },
2752 {
2753 I2C_BOARD_INFO("sx1508q", 0x22),
2754 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP3],
2755 },
2756 {
2757 I2C_BOARD_INFO("sx1509q", 0x3E),
2758 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP4],
2759 },
2760};
2761
2762#define MPQ8064_I2C_GSBI5_BUS_ID 5
2763
2764static struct i2c_registry mpq8064_i2c_devices[] __initdata = {
2765 {
2766 I2C_MPQ_CDP,
2767 MPQ8064_I2C_GSBI5_BUS_ID,
2768 sx150x_gpio_exp_info,
2769 ARRAY_SIZE(sx150x_gpio_exp_info),
2770 },
2771};
2772
Jing Lin417fa452012-02-05 14:31:06 -08002773static void __init register_i2c_devices(void)
2774{
2775 u8 mach_mask = 0;
2776 int i;
2777
Kevin Chand07220e2012-02-13 15:52:22 -08002778#ifdef CONFIG_MSM_CAMERA
2779 struct i2c_registry apq8064_camera_i2c_devices = {
2780 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_RUMI,
2781 APQ_8064_GSBI4_QUP_I2C_BUS_ID,
2782 apq8064_camera_board_info.board_info,
2783 apq8064_camera_board_info.num_i2c_board_info,
2784 };
2785#endif
Jing Lin417fa452012-02-05 14:31:06 -08002786 /* Build the matching 'supported_machs' bitmask */
2787 if (machine_is_apq8064_cdp())
2788 mach_mask = I2C_SURF;
2789 else if (machine_is_apq8064_mtp())
2790 mach_mask = I2C_FFA;
2791 else if (machine_is_apq8064_liquid())
2792 mach_mask = I2C_LIQUID;
2793 else if (machine_is_apq8064_rumi3())
2794 mach_mask = I2C_RUMI;
2795 else if (machine_is_apq8064_sim())
2796 mach_mask = I2C_SIM;
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002797 else if (PLATFORM_IS_MPQ8064())
2798 mach_mask = I2C_MPQ_CDP;
Jing Lin417fa452012-02-05 14:31:06 -08002799 else
2800 pr_err("unmatched machine ID in register_i2c_devices\n");
2801
2802 /* Run the array and install devices as appropriate */
2803 for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) {
2804 if (apq8064_i2c_devices[i].machs & mach_mask)
2805 i2c_register_board_info(apq8064_i2c_devices[i].bus,
2806 apq8064_i2c_devices[i].info,
2807 apq8064_i2c_devices[i].len);
2808 }
Kevin Chand07220e2012-02-13 15:52:22 -08002809#ifdef CONFIG_MSM_CAMERA
2810 if (apq8064_camera_i2c_devices.machs & mach_mask)
2811 i2c_register_board_info(apq8064_camera_i2c_devices.bus,
2812 apq8064_camera_i2c_devices.info,
2813 apq8064_camera_i2c_devices.len);
2814#endif
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002815
2816 for (i = 0; i < ARRAY_SIZE(mpq8064_i2c_devices); ++i) {
2817 if (mpq8064_i2c_devices[i].machs & mach_mask)
2818 i2c_register_board_info(
2819 mpq8064_i2c_devices[i].bus,
2820 mpq8064_i2c_devices[i].info,
2821 mpq8064_i2c_devices[i].len);
2822 }
Jing Lin417fa452012-02-05 14:31:06 -08002823}
2824
Jay Chokshi994ff122012-03-27 15:43:48 -07002825static void enable_ddr3_regulator(void)
2826{
2827 static struct regulator *ext_ddr3;
2828
2829 /* Use MPP7 output state as a flag for PCDDR3 presence. */
2830 if (gpio_get_value_cansleep(PM8921_MPP_PM_TO_SYS(7)) > 0) {
2831 ext_ddr3 = regulator_get(NULL, "ext_ddr3");
2832 if (IS_ERR(ext_ddr3) || ext_ddr3 == NULL)
2833 pr_err("Could not get MPP7 regulator\n");
2834 else
2835 regulator_enable(ext_ddr3);
2836 }
2837}
2838
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002839static void enable_avc_i2c_bus(void)
2840{
2841 int avc_i2c_en_mpp = PM8921_MPP_PM_TO_SYS(8);
2842 int rc;
2843
2844 rc = gpio_request(avc_i2c_en_mpp, "avc_i2c_en");
2845 if (rc)
2846 pr_err("request for avc_i2c_en mpp failed,"
2847 "rc=%d\n", rc);
2848 else
2849 gpio_set_value_cansleep(avc_i2c_en_mpp, 1);
2850}
2851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002852static void __init apq8064_common_init(void)
2853{
Joel King8f839b92012-04-01 14:37:46 -07002854 msm_tsens_early_init(&apq_tsens_pdata);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002855 if (socinfo_init() < 0)
2856 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06002857 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
2858 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
David Collins2782b5c2012-02-06 10:02:42 -08002859 regulator_suppress_info_printing();
2860 platform_device_register(&apq8064_device_rpm_regulator);
Stephen Boyd4d0d2582012-02-10 14:49:40 -08002861 if (msm_xo_init())
2862 pr_err("Failed to initialize XO votes\n");
Matt Wagantallc51e5602012-02-27 17:25:25 -08002863 msm_clock_init(&apq8064_clock_init_data);
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08002864 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06002865 apq8064_i2c_init();
Jing Lin417fa452012-02-05 14:31:06 -08002866 register_i2c_devices();
Kenneth Heitke36920d32011-07-20 16:44:30 -06002867
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002868 apq8064_device_qup_spi_gsbi5.dev.platform_data =
2869 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08002870 apq8064_init_pmic();
Hemant Kumar94e7da22012-02-03 16:52:29 -08002871 if (machine_is_apq8064_liquid())
2872 msm_otg_pdata.mhl_enable = true;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07002873
Ofir Cohen94213a72012-05-03 14:26:32 +03002874 android_usb_pdata.swfi_latency =
2875 msm_rpmrs_levels[0].latency_us;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07002876
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002877 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Manu Gautam91223e02011-11-08 15:27:22 +05302878 apq8064_ehci_host_init();
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002879 apq8064_init_buses();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002880 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Terence Hampson36b70722012-05-10 13:18:16 -04002881 if (!(machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
2882 machine_is_mpq8064_dtv()))
2883 platform_add_devices(common_not_mpq_devices,
2884 ARRAY_SIZE(common_not_mpq_devices));
Jay Chokshi994ff122012-03-27 15:43:48 -07002885 enable_ddr3_regulator();
Hemant Kumarf1ca9192012-02-07 18:59:33 -08002886 if (machine_is_apq8064_mtp()) {
2887 apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
2888 device_initialize(&apq8064_device_hsic_host.dev);
2889 }
Jay Chokshie8741282012-01-25 15:22:55 -08002890 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05302891 apq8064_init_mmc();
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08002892
2893 if (machine_is_apq8064_mtp()) {
2894 mdm_8064_device.dev.platform_data = &mdm_platform_data;
2895 platform_device_register(&mdm_8064_device);
2896 }
2897 platform_device_register(&apq8064_slim_ctrl);
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002898 slim_register_board_info(apq8064_slim_devices,
2899 ARRAY_SIZE(apq8064_slim_devices));
Jin Hongd3024e62012-02-09 16:13:32 -08002900 apq8064_init_dsps();
Praveen Chidambaram78499012011-11-01 17:15:17 -06002901 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Mahesh Sivasubramaniancbce1ec2012-01-24 10:32:44 -07002902 acpuclk_init(&acpuclk_8064_soc_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002903 msm_spm_l2_init(msm_spm_l2_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002904 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Praveen Chidambaram4d19be42012-04-03 18:05:52 -06002905 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002906 apq8064_epm_adc_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002907}
2908
Huaibin Yang4a084e32011-12-15 15:25:52 -08002909static void __init apq8064_allocate_memory_regions(void)
2910{
2911 apq8064_allocate_fb_region();
2912}
2913
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002914static void __init apq8064_sim_init(void)
2915{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002916 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
2917 &msm8064_device_watchdog.dev.platform_data;
2918
2919 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002920 apq8064_common_init();
Joel King4e7ad222011-08-17 15:47:38 -07002921 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
2922}
2923
2924static void __init apq8064_rumi3_init(void)
2925{
2926 apq8064_common_init();
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002927 ethernet_init();
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002928 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002929 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002930}
2931
Joel King82b7e3f2012-01-05 10:03:27 -08002932static void __init apq8064_cdp_init(void)
2933{
Hanumant Singh50440d42012-04-23 19:27:16 -07002934 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2935 pr_err("meminfo_init() failed!\n");
Joel King82b7e3f2012-01-05 10:03:27 -08002936 apq8064_common_init();
Joel King8f839b92012-04-01 14:37:46 -07002937 if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
2938 machine_is_mpq8064_dtv()) {
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002939 enable_avc_i2c_bus();
Joel King8f839b92012-04-01 14:37:46 -07002940 platform_add_devices(mpq_devices, ARRAY_SIZE(mpq_devices));
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002941 mpq8064_pcie_init();
Joel King8f839b92012-04-01 14:37:46 -07002942 } else {
2943 ethernet_init();
2944 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
2945 spi_register_board_info(spi_board_info,
2946 ARRAY_SIZE(spi_board_info));
2947 }
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002948 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07002949 apq8064_init_gpu();
Matt Wagantall1f65d9d2012-04-25 14:24:20 -07002950 platform_add_devices(apq8064_footswitch, apq8064_num_footswitch);
Kevin Chand07220e2012-02-13 15:52:22 -08002951 apq8064_init_cam();
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302952
2953 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
2954 platform_device_register(&cdp_kp_pdev);
2955
2956 if (machine_is_apq8064_mtp())
2957 platform_device_register(&mtp_kp_pdev);
Hanumant Singh50440d42012-04-23 19:27:16 -07002958
2959 change_memory_power = &apq8064_change_memory_power;
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05302960
2961 if (machine_is_mpq8064_cdp()) {
2962 platform_device_register(&mpq_gpio_keys_pdev);
2963 platform_device_register(&mpq_keypad_device);
2964 }
Joel King82b7e3f2012-01-05 10:03:27 -08002965}
2966
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002967MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
2968 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002969 .reserve = apq8064_reserve,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002970 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302971 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002972 .timer = &msm_timer,
2973 .init_machine = apq8064_sim_init,
2974MACHINE_END
2975
Joel King4e7ad222011-08-17 15:47:38 -07002976MACHINE_START(APQ8064_RUMI3, "QCT APQ8064 RUMI3")
2977 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002978 .reserve = apq8064_reserve,
Joel King4e7ad222011-08-17 15:47:38 -07002979 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302980 .handle_irq = gic_handle_irq,
Joel King4e7ad222011-08-17 15:47:38 -07002981 .timer = &msm_timer,
2982 .init_machine = apq8064_rumi3_init,
Huaibin Yang4a084e32011-12-15 15:25:52 -08002983 .init_early = apq8064_allocate_memory_regions,
Joel King4e7ad222011-08-17 15:47:38 -07002984MACHINE_END
2985
Joel King82b7e3f2012-01-05 10:03:27 -08002986MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
2987 .map_io = apq8064_map_io,
2988 .reserve = apq8064_reserve,
2989 .init_irq = apq8064_init_irq,
2990 .handle_irq = gic_handle_irq,
2991 .timer = &msm_timer,
2992 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002993 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07002994 .init_very_early = apq8064_early_reserve,
Joel King82b7e3f2012-01-05 10:03:27 -08002995MACHINE_END
2996
2997MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
2998 .map_io = apq8064_map_io,
2999 .reserve = apq8064_reserve,
3000 .init_irq = apq8064_init_irq,
3001 .handle_irq = gic_handle_irq,
3002 .timer = &msm_timer,
3003 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003004 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003005 .init_very_early = apq8064_early_reserve,
Joel King82b7e3f2012-01-05 10:03:27 -08003006MACHINE_END
3007
3008MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
3009 .map_io = apq8064_map_io,
3010 .reserve = apq8064_reserve,
3011 .init_irq = apq8064_init_irq,
3012 .handle_irq = gic_handle_irq,
3013 .timer = &msm_timer,
3014 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003015 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003016 .init_very_early = apq8064_early_reserve,
Joel King82b7e3f2012-01-05 10:03:27 -08003017MACHINE_END
3018
Joel King064bbf82012-04-01 13:23:39 -07003019MACHINE_START(MPQ8064_CDP, "QCT MPQ8064 CDP")
3020 .map_io = apq8064_map_io,
3021 .reserve = apq8064_reserve,
3022 .init_irq = apq8064_init_irq,
3023 .handle_irq = gic_handle_irq,
3024 .timer = &msm_timer,
3025 .init_machine = apq8064_cdp_init,
3026 .init_early = apq8064_allocate_memory_regions,
3027 .init_very_early = apq8064_early_reserve,
3028MACHINE_END
3029
Joel King11ca8202012-02-13 16:19:03 -08003030MACHINE_START(MPQ8064_HRD, "QCT MPQ8064 HRD")
3031 .map_io = apq8064_map_io,
3032 .reserve = apq8064_reserve,
3033 .init_irq = apq8064_init_irq,
3034 .handle_irq = gic_handle_irq,
3035 .timer = &msm_timer,
3036 .init_machine = apq8064_cdp_init,
Joel King3a57e772012-05-28 11:22:55 -07003037 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003038 .init_very_early = apq8064_early_reserve,
Joel King11ca8202012-02-13 16:19:03 -08003039MACHINE_END
3040
3041MACHINE_START(MPQ8064_DTV, "QCT MPQ8064 DTV")
3042 .map_io = apq8064_map_io,
3043 .reserve = apq8064_reserve,
3044 .init_irq = apq8064_init_irq,
3045 .handle_irq = gic_handle_irq,
3046 .timer = &msm_timer,
3047 .init_machine = apq8064_cdp_init,
Joel King3a57e772012-05-28 11:22:55 -07003048 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003049 .init_very_early = apq8064_early_reserve,
Joel King11ca8202012-02-13 16:19:03 -08003050MACHINE_END
3051