blob: 6d228e44d9bb0f699639b59778bb166e02279ff4 [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{
868 if (machine_is_apq8064_liquid()) {
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800869 msm_ehci_host_pdata3.dock_connect_irq =
Hemant Kumar56925352012-02-13 16:59:52 -0800870 PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9);
871
Manu Gautam91223e02011-11-08 15:27:22 +0530872 apq8064_device_ehci_host3.dev.platform_data =
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800873 &msm_ehci_host_pdata3;
Manu Gautam91223e02011-11-08 15:27:22 +0530874 platform_device_register(&apq8064_device_ehci_host3);
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800875
876#ifdef CONFIG_USB_EHCI_MSM_HOST4
877 apq8064_device_ehci_host4.dev.platform_data =
878 &msm_ehci_host_pdata4;
879 platform_device_register(&apq8064_device_ehci_host4);
880#endif
Manu Gautam91223e02011-11-08 15:27:22 +0530881 }
882}
883
David Keitel2f613d92012-02-15 11:29:16 -0800884static struct smb349_platform_data smb349_data __initdata = {
885 .en_n_gpio = PM8921_GPIO_PM_TO_SYS(37),
886 .chg_susp_gpio = PM8921_GPIO_PM_TO_SYS(30),
887 .chg_current_ma = 2200,
888};
889
890static struct i2c_board_info smb349_charger_i2c_info[] __initdata = {
891 {
892 I2C_BOARD_INFO(SMB349_NAME, 0x1B),
893 .platform_data = &smb349_data,
894 },
895};
896
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -0800897struct sx150x_platform_data apq8064_sx150x_data[] = {
898 [SX150X_EPM] = {
899 .gpio_base = GPIO_EPM_EXPANDER_BASE,
900 .oscio_is_gpo = false,
901 .io_pullup_ena = 0x0,
902 .io_pulldn_ena = 0x0,
903 .io_open_drain_ena = 0x0,
904 .io_polarity = 0,
905 .irq_summary = -1,
906 },
907};
908
909static struct epm_chan_properties ads_adc_channel_data[] = {
910 {10, 100}, {500, 50}, {1, 1}, {1, 1},
911 {20, 50}, {10, 100}, {1, 1}, {1, 1},
912 {10, 100}, {10, 100}, {100, 100}, {200, 100},
913 {100, 50}, {2000, 50}, {1000, 50}, {200, 50},
914 {200, 100}, {1, 1}, {20, 50}, {500, 50},
915 {50, 50}, {200, 100}, {500, 100}, {20, 50},
916 {200, 50}, {2000, 100}, {1000, 50}, {100, 50},
917 {200, 100}, {500, 50}, {1000, 100}, {200, 50},
918 {1000, 50}, {50, 50}, {100, 50}, {100, 50},
919 {1, 1}, {1, 1}, {20, 100}, {20, 50},
920 {500, 100}, {1000, 100}, {100, 50}, {1000, 50},
921 {100, 50}, {1000, 100}, {100, 50}, {100, 50},
922};
923
924static struct epm_adc_platform_data epm_adc_pdata = {
925 .channel = ads_adc_channel_data,
926 .bus_id = 0x0,
927 .epm_i2c_board_info = {
928 .type = "sx1509q",
929 .addr = 0x3e,
930 .platform_data = &apq8064_sx150x_data[SX150X_EPM],
931 },
932 .gpio_expander_base_addr = GPIO_EPM_EXPANDER_BASE,
933};
934
935static struct platform_device epm_adc_device = {
936 .name = "epm_adc",
937 .id = -1,
938 .dev = {
939 .platform_data = &epm_adc_pdata,
940 },
941};
942
943static void __init apq8064_epm_adc_init(void)
944{
945 epm_adc_pdata.num_channels = 32;
946 epm_adc_pdata.num_adc = 2;
947 epm_adc_pdata.chan_per_adc = 16;
948 epm_adc_pdata.chan_per_mux = 8;
949};
950
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800951/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
952 * 4 micbiases are used to power various analog and digital
953 * microphones operating at 1800 mV. Technically, all micbiases
954 * can source from single cfilter since all microphones operate
955 * at the same voltage level. The arrangement below is to make
956 * sure all cfilters are exercised. LDO_H regulator ouput level
957 * does not need to be as high as 2.85V. It is choosen for
958 * microphone sensitivity purpose.
959 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530960static struct wcd9xxx_pdata apq8064_tabla_platform_data = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800961 .slimbus_slave_device = {
962 .name = "tabla-slave",
963 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
964 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800965 .irq = MSM_GPIO_TO_INT(42),
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800966 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530967 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800968 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
969 .micbias = {
970 .ldoh_v = TABLA_LDOH_2P85_V,
971 .cfilt1_mv = 1800,
972 .cfilt2_mv = 1800,
973 .cfilt3_mv = 1800,
974 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
975 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
976 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
977 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530978 },
979 .regulator = {
980 {
981 .name = "CDC_VDD_CP",
982 .min_uV = 1800000,
983 .max_uV = 1800000,
984 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
985 },
986 {
987 .name = "CDC_VDDA_RX",
988 .min_uV = 1800000,
989 .max_uV = 1800000,
990 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
991 },
992 {
993 .name = "CDC_VDDA_TX",
994 .min_uV = 1800000,
995 .max_uV = 1800000,
996 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
997 },
998 {
999 .name = "VDDIO_CDC",
1000 .min_uV = 1800000,
1001 .max_uV = 1800000,
1002 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1003 },
1004 {
1005 .name = "VDDD_CDC_D",
1006 .min_uV = 1225000,
1007 .max_uV = 1225000,
1008 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1009 },
1010 {
1011 .name = "CDC_VDDA_A_1P2V",
1012 .min_uV = 1225000,
1013 .max_uV = 1225000,
1014 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1015 },
1016 },
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001017};
1018
1019static struct slim_device apq8064_slim_tabla = {
1020 .name = "tabla-slim",
1021 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
1022 .dev = {
1023 .platform_data = &apq8064_tabla_platform_data,
1024 },
1025};
1026
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301027static struct wcd9xxx_pdata apq8064_tabla20_platform_data = {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001028 .slimbus_slave_device = {
1029 .name = "tabla-slave",
1030 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
1031 },
1032 .irq = MSM_GPIO_TO_INT(42),
1033 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301034 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001035 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
1036 .micbias = {
1037 .ldoh_v = TABLA_LDOH_2P85_V,
1038 .cfilt1_mv = 1800,
1039 .cfilt2_mv = 1800,
1040 .cfilt3_mv = 1800,
1041 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
1042 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
1043 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
1044 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301045 },
1046 .regulator = {
1047 {
1048 .name = "CDC_VDD_CP",
1049 .min_uV = 1800000,
1050 .max_uV = 1800000,
1051 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
1052 },
1053 {
1054 .name = "CDC_VDDA_RX",
1055 .min_uV = 1800000,
1056 .max_uV = 1800000,
1057 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
1058 },
1059 {
1060 .name = "CDC_VDDA_TX",
1061 .min_uV = 1800000,
1062 .max_uV = 1800000,
1063 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
1064 },
1065 {
1066 .name = "VDDIO_CDC",
1067 .min_uV = 1800000,
1068 .max_uV = 1800000,
1069 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1070 },
1071 {
1072 .name = "VDDD_CDC_D",
1073 .min_uV = 1225000,
1074 .max_uV = 1225000,
1075 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1076 },
1077 {
1078 .name = "CDC_VDDA_A_1P2V",
1079 .min_uV = 1225000,
1080 .max_uV = 1225000,
1081 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1082 },
1083 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001084};
1085
1086static struct slim_device apq8064_slim_tabla20 = {
1087 .name = "tabla2x-slim",
1088 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
1089 .dev = {
1090 .platform_data = &apq8064_tabla20_platform_data,
1091 },
1092};
1093
Santosh Mardi695be0d2012-04-10 23:21:12 +05301094/* enable the level shifter for cs8427 to make sure the I2C
1095 * clock is running at 100KHz and voltage levels are at 3.3
1096 * and 5 volts
1097 */
1098static int enable_100KHz_ls(int enable)
1099{
1100 int ret = 0;
1101 if (enable) {
1102 ret = gpio_request(SX150X_GPIO(1, 10),
1103 "cs8427_100KHZ_ENABLE");
1104 if (ret) {
1105 pr_err("%s: Failed to request gpio %d\n", __func__,
1106 SX150X_GPIO(1, 10));
1107 return ret;
1108 }
1109 gpio_direction_output(SX150X_GPIO(1, 10), 1);
1110 } else
1111 gpio_free(SX150X_GPIO(1, 10));
1112 return ret;
1113}
1114
Santosh Mardieff9a742012-04-09 23:23:39 +05301115static struct cs8427_platform_data cs8427_i2c_platform_data = {
1116 .irq = SX150X_GPIO(1, 4),
1117 .reset_gpio = SX150X_GPIO(1, 6),
Santosh Mardi695be0d2012-04-10 23:21:12 +05301118 .enable = enable_100KHz_ls,
Santosh Mardieff9a742012-04-09 23:23:39 +05301119};
1120
1121static struct i2c_board_info cs8427_device_info[] __initdata = {
1122 {
1123 I2C_BOARD_INFO("cs8427", CS8427_ADDR4),
1124 .platform_data = &cs8427_i2c_platform_data,
1125 },
1126};
1127
Amy Maloche70090f992012-02-16 16:35:26 -08001128#define HAP_SHIFT_LVL_OE_GPIO PM8921_MPP_PM_TO_SYS(8)
1129#define ISA1200_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1130#define ISA1200_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
1131#define ISA1200_HAP_CLK PM8921_GPIO_PM_TO_SYS(44)
1132
Mohan Pallaka2d877602012-05-11 13:07:30 +05301133static int isa1200_clk_enable(bool on)
Amy Maloche70090f992012-02-16 16:35:26 -08001134{
Amy Maloche8f973892012-03-26 14:53:13 -07001135 int rc = 0;
1136
Mohan Pallaka2d877602012-05-11 13:07:30 +05301137 gpio_set_value_cansleep(ISA1200_HAP_CLK, on);
Amy Maloche70090f992012-02-16 16:35:26 -08001138
Mohan Pallaka2d877602012-05-11 13:07:30 +05301139 if (on) {
Amy Maloche8f973892012-03-26 14:53:13 -07001140 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_1, true);
Mohan Pallaka2d877602012-05-11 13:07:30 +05301141 if (rc) {
1142 pr_err("%s: unable to write aux clock register(%d)\n",
1143 __func__, rc);
1144 goto err_gpio_dis;
1145 }
1146 } else {
Amy Maloche8f973892012-03-26 14:53:13 -07001147 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_NONE, true);
Mohan Pallaka2d877602012-05-11 13:07:30 +05301148 if (rc)
1149 pr_err("%s: unable to write aux clock register(%d)\n",
1150 __func__, rc);
Amy Maloche8f973892012-03-26 14:53:13 -07001151 }
1152
1153 return rc;
Mohan Pallaka2d877602012-05-11 13:07:30 +05301154
1155err_gpio_dis:
1156 gpio_set_value_cansleep(ISA1200_HAP_CLK, !on);
1157 return rc;
Amy Maloche70090f992012-02-16 16:35:26 -08001158}
1159
1160static int isa1200_dev_setup(bool enable)
1161{
1162 int rc = 0;
1163
Amy Maloche70090f992012-02-16 16:35:26 -08001164 if (!enable)
1165 goto free_gpio;
1166
1167 rc = gpio_request(ISA1200_HAP_CLK, "haptics_clk");
1168 if (rc) {
1169 pr_err("%s: unable to request gpio %d config(%d)\n",
1170 __func__, ISA1200_HAP_CLK, rc);
1171 return rc;
1172 }
1173
1174 rc = gpio_direction_output(ISA1200_HAP_CLK, 0);
1175 if (rc) {
1176 pr_err("%s: unable to set direction\n", __func__);
1177 goto free_gpio;
1178 }
1179
1180 return 0;
1181
1182free_gpio:
1183 gpio_free(ISA1200_HAP_CLK);
1184 return rc;
1185}
1186
1187static struct isa1200_regulator isa1200_reg_data[] = {
1188 {
1189 .name = "vddp",
1190 .min_uV = ISA_I2C_VTG_MIN_UV,
1191 .max_uV = ISA_I2C_VTG_MAX_UV,
1192 .load_uA = ISA_I2C_CURR_UA,
1193 },
1194};
1195
1196static struct isa1200_platform_data isa1200_1_pdata = {
1197 .name = "vibrator",
1198 .dev_setup = isa1200_dev_setup,
Mohan Pallaka2d877602012-05-11 13:07:30 +05301199 .clk_enable = isa1200_clk_enable,
Amy Maloche70090f992012-02-16 16:35:26 -08001200 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
1201 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
1202 .max_timeout = 15000,
1203 .mode_ctrl = PWM_GEN_MODE,
1204 .pwm_fd = {
1205 .pwm_div = 256,
1206 },
1207 .is_erm = false,
1208 .smart_en = true,
1209 .ext_clk_en = true,
1210 .chip_en = 1,
1211 .regulator_info = isa1200_reg_data,
1212 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1213};
1214
1215static struct i2c_board_info isa1200_board_info[] __initdata = {
1216 {
1217 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1218 .platform_data = &isa1200_1_pdata,
1219 },
1220};
Jing Lin21ed4de2012-02-05 15:53:28 -08001221/* configuration data for mxt1386e using V2.1 firmware */
1222static const u8 mxt1386e_config_data_v2_1[] = {
1223 /* T6 Object */
1224 0, 0, 0, 0, 0, 0,
1225 /* T38 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001226 14, 1, 0, 22, 2, 12, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001227 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1228 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1229 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,
1233 /* T7 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001234 100, 10, 50,
Jing Lin21ed4de2012-02-05 15:53:28 -08001235 /* T8 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001236 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001237 /* T9 Object */
1238 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
1239 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
Jing Linf1208fd2012-02-23 11:15:42 -08001240 85, 5, 0, 5, 9, 5, 12, 35, 70, 40,
1241 20, 5, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001242 /* T18 Object */
1243 0, 0,
1244 /* T24 Object */
1245 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1246 0, 0, 0, 0, 0, 0, 0, 0, 0,
1247 /* T25 Object */
1248 3, 0, 60, 115, 156, 99,
1249 /* T27 Object */
1250 0, 0, 0, 0, 0, 0, 0,
1251 /* T40 Object */
1252 0, 0, 0, 0, 0,
1253 /* T42 Object */
1254 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
1255 /* T43 Object */
1256 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
1257 16,
1258 /* T46 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001259 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001260 /* T47 Object */
1261 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
1262 /* T48 Object */
1263 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001264 32, 40, 0, 10, 10, 0, 0, 100, 10, 90,
1265 0, 0, 0, 0, 0, 0, 0, 10, 1, 10,
1266 52, 10, 12, 0, 33, 0, 1, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001267 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1268 0, 0, 0, 0,
1269 /* T56 Object */
1270 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1271 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1272 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1273 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001274 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1275 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001276};
1277
1278#define MXT_TS_GPIO_IRQ 6
1279#define MXT_TS_PWR_EN_GPIO PM8921_GPIO_PM_TO_SYS(23)
1280#define MXT_TS_RESET_GPIO 33
1281
1282static struct mxt_config_info mxt_config_array[] = {
1283 {
1284 .config = mxt1386e_config_data_v2_1,
1285 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1286 .family_id = 0xA0,
1287 .variant_id = 0x7,
1288 .version = 0x21,
1289 .build = 0xAA,
Jing Linef4aa9b2012-03-26 12:01:41 -07001290 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
1291 .fw_name = "atmel_8064_liquid_v2_2_AA.hex",
1292 },
1293 {
1294 /* The config data for V2.2.AA is the same as for V2.1.AA */
1295 .config = mxt1386e_config_data_v2_1,
1296 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1297 .family_id = 0xA0,
1298 .variant_id = 0x7,
1299 .version = 0x22,
1300 .build = 0xAA,
1301 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin21ed4de2012-02-05 15:53:28 -08001302 },
1303};
1304
1305static struct mxt_platform_data mxt_platform_data = {
1306 .config_array = mxt_config_array,
1307 .config_array_size = ARRAY_SIZE(mxt_config_array),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08001308 .panel_minx = 0,
1309 .panel_maxx = 1365,
1310 .panel_miny = 0,
1311 .panel_maxy = 767,
1312 .disp_minx = 0,
1313 .disp_maxx = 1365,
1314 .disp_miny = 0,
1315 .disp_maxy = 767,
Anirudh Ghayal39dbe3f2012-04-13 15:43:16 +05301316 .irqflags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
Jing Lin21ed4de2012-02-05 15:53:28 -08001317 .i2c_pull_up = true,
1318 .reset_gpio = MXT_TS_RESET_GPIO,
1319 .irq_gpio = MXT_TS_GPIO_IRQ,
1320};
1321
1322static struct i2c_board_info mxt_device_info[] __initdata = {
1323 {
1324 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
1325 .platform_data = &mxt_platform_data,
1326 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1327 },
1328};
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001329#define CYTTSP_TS_GPIO_IRQ 6
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001330#define CYTTSP_TS_GPIO_SLEEP 33
1331
1332static ssize_t tma340_vkeys_show(struct kobject *kobj,
1333 struct kobj_attribute *attr, char *buf)
1334{
1335 return snprintf(buf, 200,
1336 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1337 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1338 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1339 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1340 "\n");
1341}
1342
1343static struct kobj_attribute tma340_vkeys_attr = {
1344 .attr = {
1345 .mode = S_IRUGO,
1346 },
1347 .show = &tma340_vkeys_show,
1348};
1349
1350static struct attribute *tma340_properties_attrs[] = {
1351 &tma340_vkeys_attr.attr,
1352 NULL
1353};
1354
1355static struct attribute_group tma340_properties_attr_group = {
1356 .attrs = tma340_properties_attrs,
1357};
1358
1359static int cyttsp_platform_init(struct i2c_client *client)
1360{
1361 int rc = 0;
1362 static struct kobject *tma340_properties_kobj;
1363
1364 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1365 tma340_properties_kobj = kobject_create_and_add("board_properties",
1366 NULL);
1367 if (tma340_properties_kobj)
1368 rc = sysfs_create_group(tma340_properties_kobj,
1369 &tma340_properties_attr_group);
1370 if (!tma340_properties_kobj || rc)
1371 pr_err("%s: failed to create board_properties\n",
1372 __func__);
1373
1374 return 0;
1375}
1376
1377static struct cyttsp_regulator cyttsp_regulator_data[] = {
1378 {
1379 .name = "vdd",
1380 .min_uV = CY_TMA300_VTG_MIN_UV,
1381 .max_uV = CY_TMA300_VTG_MAX_UV,
1382 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1383 .lpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1384 },
1385 {
1386 .name = "vcc_i2c",
1387 .min_uV = CY_I2C_VTG_MIN_UV,
1388 .max_uV = CY_I2C_VTG_MAX_UV,
1389 .hpm_load_uA = CY_I2C_CURR_UA,
1390 .lpm_load_uA = CY_I2C_CURR_UA,
1391 },
1392};
1393
1394static struct cyttsp_platform_data cyttsp_pdata = {
1395 .panel_maxx = 634,
1396 .panel_maxy = 1166,
1397 .disp_maxx = 599,
1398 .disp_maxy = 1023,
1399 .disp_minx = 0,
1400 .disp_miny = 0,
1401 .flags = 0x01,
1402 .gen = CY_GEN3,
1403 .use_st = CY_USE_ST,
1404 .use_mt = CY_USE_MT,
1405 .use_hndshk = CY_SEND_HNDSHK,
1406 .use_trk_id = CY_USE_TRACKING_ID,
1407 .use_sleep = CY_USE_DEEP_SLEEP_SEL,
1408 .use_gestures = CY_USE_GESTURES,
1409 .fw_fname = "cyttsp_8064_mtp.hex",
1410 /* change act_intrvl to customize the Active power state
1411 * scanning/processing refresh interval for Operating mode
1412 */
1413 .act_intrvl = CY_ACT_INTRVL_DFLT,
1414 /* change tch_tmout to customize the touch timeout for the
1415 * Active power state for Operating mode
1416 */
1417 .tch_tmout = CY_TCH_TMOUT_DFLT,
1418 /* change lp_intrvl to customize the Low Power power state
1419 * scanning/processing refresh interval for Operating mode
1420 */
1421 .lp_intrvl = CY_LP_INTRVL_DFLT,
1422 .sleep_gpio = CYTTSP_TS_GPIO_SLEEP,
Amy Maloche9ba3ffe2012-04-26 10:31:20 -07001423 .resout_gpio = -1,
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001424 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1425 .regulator_info = cyttsp_regulator_data,
1426 .num_regulators = ARRAY_SIZE(cyttsp_regulator_data),
1427 .init = cyttsp_platform_init,
1428 .correct_fw_ver = 17,
1429};
1430
1431static struct i2c_board_info cyttsp_info[] __initdata = {
1432 {
1433 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1434 .platform_data = &cyttsp_pdata,
1435 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1436 },
1437};
Jing Lin21ed4de2012-02-05 15:53:28 -08001438
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001439#define MSM_WCNSS_PHYS 0x03000000
1440#define MSM_WCNSS_SIZE 0x280000
1441
1442static struct resource resources_wcnss_wlan[] = {
1443 {
1444 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1445 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1446 .name = "wcnss_wlanrx_irq",
1447 .flags = IORESOURCE_IRQ,
1448 },
1449 {
1450 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1451 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1452 .name = "wcnss_wlantx_irq",
1453 .flags = IORESOURCE_IRQ,
1454 },
1455 {
1456 .start = MSM_WCNSS_PHYS,
1457 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1458 .name = "wcnss_mmio",
1459 .flags = IORESOURCE_MEM,
1460 },
1461 {
1462 .start = 64,
1463 .end = 68,
1464 .name = "wcnss_gpios_5wire",
1465 .flags = IORESOURCE_IO,
1466 },
1467};
1468
1469static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1470 .has_48mhz_xo = 1,
1471};
1472
1473static struct platform_device msm_device_wcnss_wlan = {
1474 .name = "wcnss_wlan",
1475 .id = 0,
1476 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1477 .resource = resources_wcnss_wlan,
1478 .dev = {.platform_data = &qcom_wcnss_pdata},
1479};
1480
Ankit Vermab7c26e62012-02-28 15:04:15 -08001481static struct platform_device msm_device_iris_fm __devinitdata = {
1482 .name = "iris_fm",
1483 .id = -1,
1484};
1485
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001486#ifdef CONFIG_QSEECOM
1487/* qseecom bus scaling */
1488static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
1489 {
1490 .src = MSM_BUS_MASTER_SPS,
1491 .dst = MSM_BUS_SLAVE_EBI_CH0,
1492 .ib = 0,
1493 .ab = 0,
1494 },
1495 {
1496 .src = MSM_BUS_MASTER_SPDM,
1497 .dst = MSM_BUS_SLAVE_SPDM,
1498 .ib = 0,
1499 .ab = 0,
1500 },
1501};
1502
1503static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
1504 {
1505 .src = MSM_BUS_MASTER_SPS,
1506 .dst = MSM_BUS_SLAVE_EBI_CH0,
1507 .ib = (492 * 8) * 1000000UL,
1508 .ab = (492 * 8) * 100000UL,
1509 },
1510 {
1511 .src = MSM_BUS_MASTER_SPDM,
1512 .dst = MSM_BUS_SLAVE_SPDM,
1513 .ib = 0,
1514 .ab = 0,
1515 },
1516};
1517
1518static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1519 {
1520 .src = MSM_BUS_MASTER_SPS,
1521 .dst = MSM_BUS_SLAVE_EBI_CH0,
1522 .ib = 0,
1523 .ab = 0,
1524 },
1525 {
1526 .src = MSM_BUS_MASTER_SPDM,
1527 .dst = MSM_BUS_SLAVE_SPDM,
1528 .ib = (64 * 8) * 1000000UL,
1529 .ab = (64 * 8) * 100000UL,
1530 },
1531};
1532
1533static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1534 {
1535 ARRAY_SIZE(qseecom_clks_init_vectors),
1536 qseecom_clks_init_vectors,
1537 },
1538 {
1539 ARRAY_SIZE(qseecom_enable_dfab_vectors),
1540 qseecom_enable_sfpb_vectors,
1541 },
1542 {
1543 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1544 qseecom_enable_sfpb_vectors,
1545 },
1546};
1547
1548static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1549 qseecom_hw_bus_scale_usecases,
1550 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1551 .name = "qsee",
1552};
1553
1554static struct platform_device qseecom_device = {
1555 .name = "qseecom",
1556 .id = 0,
1557 .dev = {
1558 .platform_data = &qseecom_bus_pdata,
1559 },
1560};
1561#endif
1562
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001563#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1564 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1565 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1566 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1567
1568#define QCE_SIZE 0x10000
1569#define QCE_0_BASE 0x11000000
1570
1571#define QCE_HW_KEY_SUPPORT 0
1572#define QCE_SHA_HMAC_SUPPORT 1
1573#define QCE_SHARE_CE_RESOURCE 3
1574#define QCE_CE_SHARED 0
1575
1576static struct resource qcrypto_resources[] = {
1577 [0] = {
1578 .start = QCE_0_BASE,
1579 .end = QCE_0_BASE + QCE_SIZE - 1,
1580 .flags = IORESOURCE_MEM,
1581 },
1582 [1] = {
1583 .name = "crypto_channels",
1584 .start = DMOV8064_CE_IN_CHAN,
1585 .end = DMOV8064_CE_OUT_CHAN,
1586 .flags = IORESOURCE_DMA,
1587 },
1588 [2] = {
1589 .name = "crypto_crci_in",
1590 .start = DMOV8064_CE_IN_CRCI,
1591 .end = DMOV8064_CE_IN_CRCI,
1592 .flags = IORESOURCE_DMA,
1593 },
1594 [3] = {
1595 .name = "crypto_crci_out",
1596 .start = DMOV8064_CE_OUT_CRCI,
1597 .end = DMOV8064_CE_OUT_CRCI,
1598 .flags = IORESOURCE_DMA,
1599 },
1600};
1601
1602static struct resource qcedev_resources[] = {
1603 [0] = {
1604 .start = QCE_0_BASE,
1605 .end = QCE_0_BASE + QCE_SIZE - 1,
1606 .flags = IORESOURCE_MEM,
1607 },
1608 [1] = {
1609 .name = "crypto_channels",
1610 .start = DMOV8064_CE_IN_CHAN,
1611 .end = DMOV8064_CE_OUT_CHAN,
1612 .flags = IORESOURCE_DMA,
1613 },
1614 [2] = {
1615 .name = "crypto_crci_in",
1616 .start = DMOV8064_CE_IN_CRCI,
1617 .end = DMOV8064_CE_IN_CRCI,
1618 .flags = IORESOURCE_DMA,
1619 },
1620 [3] = {
1621 .name = "crypto_crci_out",
1622 .start = DMOV8064_CE_OUT_CRCI,
1623 .end = DMOV8064_CE_OUT_CRCI,
1624 .flags = IORESOURCE_DMA,
1625 },
1626};
1627
1628#endif
1629
1630#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1631 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1632
1633static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1634 .ce_shared = QCE_CE_SHARED,
1635 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1636 .hw_key_support = QCE_HW_KEY_SUPPORT,
1637 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001638 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001639};
1640
1641static struct platform_device qcrypto_device = {
1642 .name = "qcrypto",
1643 .id = 0,
1644 .num_resources = ARRAY_SIZE(qcrypto_resources),
1645 .resource = qcrypto_resources,
1646 .dev = {
1647 .coherent_dma_mask = DMA_BIT_MASK(32),
1648 .platform_data = &qcrypto_ce_hw_suppport,
1649 },
1650};
1651#endif
1652
1653#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1654 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1655
1656static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1657 .ce_shared = QCE_CE_SHARED,
1658 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1659 .hw_key_support = QCE_HW_KEY_SUPPORT,
1660 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001661 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001662};
1663
1664static struct platform_device qcedev_device = {
1665 .name = "qce",
1666 .id = 0,
1667 .num_resources = ARRAY_SIZE(qcedev_resources),
1668 .resource = qcedev_resources,
1669 .dev = {
1670 .coherent_dma_mask = DMA_BIT_MASK(32),
1671 .platform_data = &qcedev_ce_hw_suppport,
1672 },
1673};
1674#endif
1675
Joel Kingdacbc822012-01-25 13:30:57 -08001676static struct mdm_platform_data mdm_platform_data = {
1677 .mdm_version = "3.0",
1678 .ramdump_delay_ms = 2000,
Hemant Kumara945b472012-01-25 15:08:06 -08001679 .peripheral_platform_device = &apq8064_device_hsic_host,
Joel Kingdacbc822012-01-25 13:30:57 -08001680};
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001681
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001682static struct tsens_platform_data apq_tsens_pdata = {
1683 .tsens_factor = 1000,
1684 .hw_type = APQ_8064,
1685 .tsens_num_sensor = 11,
1686 .slope = {1176, 1176, 1154, 1176, 1111,
1687 1132, 1132, 1199, 1132, 1199, 1132},
1688};
1689
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07001690static struct platform_device msm_tsens_device = {
1691 .name = "tsens8960-tm",
1692 .id = -1,
1693};
1694
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001695#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001696static void __init apq8064_map_io(void)
1697{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001698 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001699 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001700 if (socinfo_init() < 0)
1701 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001702}
1703
1704static void __init apq8064_init_irq(void)
1705{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001706 struct msm_mpm_device_data *data = NULL;
1707
1708#ifdef CONFIG_MSM_MPM
1709 data = &apq8064_mpm_dev_data;
1710#endif
1711
1712 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001713 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1714 (void *)MSM_QGIC_CPU_BASE);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001715}
1716
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001717static struct platform_device msm8064_device_saw_regulator_core0 = {
1718 .name = "saw-regulator",
1719 .id = 0,
1720 .dev = {
1721 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
1722 },
1723};
1724
1725static struct platform_device msm8064_device_saw_regulator_core1 = {
1726 .name = "saw-regulator",
1727 .id = 1,
1728 .dev = {
1729 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
1730 },
1731};
1732
1733static struct platform_device msm8064_device_saw_regulator_core2 = {
1734 .name = "saw-regulator",
1735 .id = 2,
1736 .dev = {
1737 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
1738 },
1739};
1740
1741static struct platform_device msm8064_device_saw_regulator_core3 = {
1742 .name = "saw-regulator",
1743 .id = 3,
1744 .dev = {
1745 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001746
1747 },
1748};
1749
Oluwafemi Adeyemif5a31422012-03-08 16:58:45 -08001750static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001751 {
1752 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1753 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1754 true,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001755 100, 650, 801, 200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001756 },
1757
1758 {
1759 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1760 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1761 true,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001762 2000, 200, 576000, 2000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001763 },
1764
1765 {
1766 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1767 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1768 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001769 8500, 51, 1122000, 8500,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001770 },
1771
1772 {
1773 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1774 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
1775 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001776 9000, 51, 1130300, 9000,
1777 },
1778 {
1779 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1780 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
1781 false,
1782 10000, 51, 1130300, 10000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001783 },
1784
1785 {
1786 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1787 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1788 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001789 12000, 14, 2205900, 12000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001790 },
1791
1792 {
1793 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1794 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1795 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001796 18000, 12, 2364250, 18000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001797 },
1798
1799 {
1800 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1801 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1802 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001803 23500, 10, 2667000, 23500,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001804 },
1805
1806 {
1807 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1808 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1809 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001810 29700, 5, 2867000, 30000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001811 },
1812};
1813
1814static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1815 .mode = MSM_PM_BOOT_CONFIG_TZ,
1816};
1817
1818static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
1819 .levels = &msm_rpmrs_levels[0],
1820 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
1821 .vdd_mem_levels = {
1822 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
1823 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
1824 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
1825 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
1826 },
1827 .vdd_dig_levels = {
1828 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
1829 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
1830 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
1831 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
1832 },
1833 .vdd_mask = 0x7FFFFF,
1834 .rpmrs_target_id = {
1835 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
1836 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
1837 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
1838 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
1839 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
1840 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
1841 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
1842 },
1843};
1844
Praveen Chidambaram78499012011-11-01 17:15:17 -06001845static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1846 0x03, 0x0f,
1847};
1848
1849static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1850 0x00, 0x24, 0x54, 0x10,
1851 0x09, 0x03, 0x01,
1852 0x10, 0x54, 0x30, 0x0C,
1853 0x24, 0x30, 0x0f,
1854};
1855
1856static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1857 0x00, 0x24, 0x54, 0x10,
1858 0x09, 0x07, 0x01, 0x0B,
1859 0x10, 0x54, 0x30, 0x0C,
1860 0x24, 0x30, 0x0f,
1861};
1862
1863static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1864 [0] = {
1865 .mode = MSM_SPM_MODE_CLOCK_GATING,
1866 .notify_rpm = false,
1867 .cmd = spm_wfi_cmd_sequence,
1868 },
1869 [1] = {
1870 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1871 .notify_rpm = false,
1872 .cmd = spm_power_collapse_without_rpm,
1873 },
1874 [2] = {
1875 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1876 .notify_rpm = true,
1877 .cmd = spm_power_collapse_with_rpm,
1878 },
1879};
1880
1881static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1882 0x00, 0x20, 0x03, 0x20,
1883 0x00, 0x0f,
1884};
1885
1886static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1887 0x00, 0x20, 0x34, 0x64,
1888 0x48, 0x07, 0x48, 0x20,
1889 0x50, 0x64, 0x04, 0x34,
1890 0x50, 0x0f,
1891};
1892static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1893 0x00, 0x10, 0x34, 0x64,
1894 0x48, 0x07, 0x48, 0x10,
1895 0x50, 0x64, 0x04, 0x34,
1896 0x50, 0x0F,
1897};
1898
1899static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1900 [0] = {
1901 .mode = MSM_SPM_L2_MODE_RETENTION,
1902 .notify_rpm = false,
1903 .cmd = l2_spm_wfi_cmd_sequence,
1904 },
1905 [1] = {
1906 .mode = MSM_SPM_L2_MODE_GDHS,
1907 .notify_rpm = true,
1908 .cmd = l2_spm_gdhs_cmd_sequence,
1909 },
1910 [2] = {
1911 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1912 .notify_rpm = true,
1913 .cmd = l2_spm_power_off_cmd_sequence,
1914 },
1915};
1916
1917
1918static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1919 [0] = {
1920 .reg_base_addr = MSM_SAW_L2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001921 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001922 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001923 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1924 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1925 .modes = msm_spm_l2_seq_list,
1926 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1927 },
1928};
1929
1930static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1931 [0] = {
1932 .reg_base_addr = MSM_SAW0_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001933 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001934#if defined(CONFIG_MSM_AVS_HW)
1935 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1936 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1937#endif
1938 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001939 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001940 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1941 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1942 .vctl_timeout_us = 50,
1943 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1944 .modes = msm_spm_seq_list,
1945 },
1946 [1] = {
1947 .reg_base_addr = MSM_SAW1_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001948 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001949#if defined(CONFIG_MSM_AVS_HW)
1950 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1951 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1952#endif
1953 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001954 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001955 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1956 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1957 .vctl_timeout_us = 50,
1958 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1959 .modes = msm_spm_seq_list,
1960 },
1961 [2] = {
1962 .reg_base_addr = MSM_SAW2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001963 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001964#if defined(CONFIG_MSM_AVS_HW)
1965 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1966 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1967#endif
1968 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001969 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001970 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1971 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1972 .vctl_timeout_us = 50,
1973 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1974 .modes = msm_spm_seq_list,
1975 },
1976 [3] = {
1977 .reg_base_addr = MSM_SAW3_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001978 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001979#if defined(CONFIG_MSM_AVS_HW)
1980 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1981 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1982#endif
1983 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001984 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001985 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1986 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1987 .vctl_timeout_us = 50,
1988 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1989 .modes = msm_spm_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001990 },
1991};
1992
Praveen Chidambaram4d19be42012-04-03 18:05:52 -06001993static struct msm_pm_sleep_status_data msm_pm_slp_sts_data = {
1994 .base_addr = MSM_ACC0_BASE + 0x08,
1995 .cpu_offset = MSM_ACC1_BASE - MSM_ACC0_BASE,
1996 .mask = 1UL << 13,
1997};
1998
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001999static void __init apq8064_init_buses(void)
2000{
2001 msm_bus_rpm_set_mt_mask();
2002 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
2003 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
2004 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
2005 msm_bus_8064_apps_fabric.dev.platform_data =
2006 &msm_bus_8064_apps_fabric_pdata;
2007 msm_bus_8064_sys_fabric.dev.platform_data =
2008 &msm_bus_8064_sys_fabric_pdata;
2009 msm_bus_8064_mm_fabric.dev.platform_data =
2010 &msm_bus_8064_mm_fabric_pdata;
2011 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
2012 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
2013}
2014
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002015/* PCIe gpios */
2016static struct msm_pcie_gpio_info_t msm_pcie_gpio_info[MSM_PCIE_MAX_GPIO] = {
2017 {"rst_n", PM8921_MPP_PM_TO_SYS(PCIE_RST_N_PMIC_MPP), 0},
2018 {"pwr_en", PM8921_GPIO_PM_TO_SYS(PCIE_PWR_EN_PMIC_GPIO), 1},
2019};
2020
2021static struct msm_pcie_platform msm_pcie_platform_data = {
2022 .gpio = msm_pcie_gpio_info,
2023};
2024
2025static void __init mpq8064_pcie_init(void)
2026{
2027 msm_device_pcie.dev.platform_data = &msm_pcie_platform_data;
2028 platform_device_register(&msm_device_pcie);
2029}
2030
David Collinsf0d00732012-01-25 15:46:50 -08002031static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
2032 .name = GPIO_REGULATOR_DEV_NAME,
2033 .id = PM8921_MPP_PM_TO_SYS(7),
2034 .dev = {
2035 .platform_data
2036 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2037 },
2038};
2039
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08002040static struct platform_device apq8064_device_ext_mpp8_vreg __devinitdata = {
2041 .name = GPIO_REGULATOR_DEV_NAME,
2042 .id = PM8921_MPP_PM_TO_SYS(8),
2043 .dev = {
2044 .platform_data
2045 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_MPP8],
2046 },
2047};
2048
David Collinsf0d00732012-01-25 15:46:50 -08002049static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
2050 .name = GPIO_REGULATOR_DEV_NAME,
2051 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
2052 .dev = {
2053 .platform_data =
2054 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2055 },
2056};
2057
David Collins390fc332012-02-07 14:38:16 -08002058static struct platform_device apq8064_device_ext_ts_sw_vreg __devinitdata = {
2059 .name = GPIO_REGULATOR_DEV_NAME,
2060 .id = PM8921_GPIO_PM_TO_SYS(23),
2061 .dev = {
2062 .platform_data
2063 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_TS_SW],
2064 },
2065};
2066
David Collins2782b5c2012-02-06 10:02:42 -08002067static struct platform_device apq8064_device_rpm_regulator __devinitdata = {
2068 .name = "rpm-regulator",
2069 .id = -1,
2070 .dev = {
2071 .platform_data = &apq8064_rpm_regulator_pdata,
2072 },
2073};
2074
Ravi Kumar V05931a22012-04-04 17:09:37 +05302075static struct gpio_ir_recv_platform_data gpio_ir_recv_pdata = {
2076 .gpio_nr = 88,
2077 .active_low = 1,
2078};
2079
2080static struct platform_device gpio_ir_recv_pdev = {
2081 .name = "gpio-rc-recv",
2082 .dev = {
2083 .platform_data = &gpio_ir_recv_pdata,
2084 },
2085};
2086
Terence Hampson36b70722012-05-10 13:18:16 -04002087static struct platform_device *common_not_mpq_devices[] __initdata = {
David Keitel3c40fc52012-02-09 17:53:52 -08002088 &apq8064_device_qup_i2c_gsbi1,
Jing Lin04601f92012-02-05 15:36:07 -08002089 &apq8064_device_qup_i2c_gsbi3,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002090 &apq8064_device_qup_i2c_gsbi4,
Terence Hampson36b70722012-05-10 13:18:16 -04002091};
2092
2093static struct platform_device *common_devices[] __initdata = {
2094 &apq8064_device_dmov,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002095 &apq8064_device_qup_spi_gsbi5,
David Collinsf0d00732012-01-25 15:46:50 -08002096 &apq8064_device_ext_5v_vreg,
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08002097 &apq8064_device_ext_mpp8_vreg,
David Collinsf0d00732012-01-25 15:46:50 -08002098 &apq8064_device_ext_3p3v_vreg,
David Collins390fc332012-02-07 14:38:16 -08002099 &apq8064_device_ext_ts_sw_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07002100 &apq8064_device_ssbi_pmic1,
2101 &apq8064_device_ssbi_pmic2,
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06002102 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07002103 &apq8064_device_otg,
2104 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08002105 &apq8064_device_hsusb_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07002106 &android_usb_device,
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08002107 &msm_device_wcnss_wlan,
Ankit Vermab7c26e62012-02-28 15:04:15 -08002108 &msm_device_iris_fm,
Larry Bassel67b921d2012-04-06 10:23:27 -07002109 &apq8064_fmem_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08002110#ifdef CONFIG_ANDROID_PMEM
2111#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002112 &apq8064_android_pmem_device,
2113 &apq8064_android_pmem_adsp_device,
2114 &apq8064_android_pmem_audio_device,
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -07002115#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
2116#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -08002117#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002118 &apq8064_ion_dev,
Olav Haugan7c6aa742012-01-16 16:47:37 -08002119#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002120 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08002121 &msm8064_device_saw_regulator_core0,
2122 &msm8064_device_saw_regulator_core1,
2123 &msm8064_device_saw_regulator_core2,
2124 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002125#if defined(CONFIG_QSEECOM)
2126 &qseecom_device,
2127#endif
2128
Ramesh Masavarapu28311912011-10-27 11:04:12 -07002129#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2130 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2131 &qcrypto_device,
2132#endif
2133
2134#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2135 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2136 &qcedev_device,
2137#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07002138
2139#ifdef CONFIG_HW_RANDOM_MSM
2140 &apq8064_device_rng,
2141#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002142 &apq_pcm,
2143 &apq_pcm_routing,
2144 &apq_cpudai0,
2145 &apq_cpudai1,
Santosh Mardieff9a742012-04-09 23:23:39 +05302146 &mpq_cpudai_sec_i2s_rx,
Kuirong Wangf23f8c52012-03-31 12:34:51 -07002147 &mpq_cpudai_mi2s_tx,
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002148 &apq_cpudai_hdmi_rx,
2149 &apq_cpudai_bt_rx,
2150 &apq_cpudai_bt_tx,
2151 &apq_cpudai_fm_rx,
2152 &apq_cpudai_fm_tx,
2153 &apq_cpu_fe,
2154 &apq_stub_codec,
2155 &apq_voice,
2156 &apq_voip,
2157 &apq_lpa_pcm,
Krishnankutty Kolathappilly4374e332012-03-18 22:27:30 -07002158 &apq_compr_dsp,
2159 &apq_multi_ch_pcm,
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002160 &apq_pcm_hostless,
2161 &apq_cpudai_afe_01_rx,
2162 &apq_cpudai_afe_01_tx,
2163 &apq_cpudai_afe_02_rx,
2164 &apq_cpudai_afe_02_tx,
2165 &apq_pcm_afe,
2166 &apq_cpudai_auxpcm_rx,
2167 &apq_cpudai_auxpcm_tx,
Neema Shetty8427c262012-02-16 11:23:43 -08002168 &apq_cpudai_stub,
Neema Shetty3c9d2862012-03-11 01:25:32 -08002169 &apq_cpudai_slimbus_1_rx,
2170 &apq_cpudai_slimbus_1_tx,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002171 &apq_cpudai_slimbus_2_tx,
Neema Shettyc9d86c32012-05-09 12:01:39 -07002172 &apq_cpudai_slimbus_3_rx,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002173 &apq8064_rpm_device,
2174 &apq8064_rpm_log_device,
2175 &apq8064_rpm_stat_device,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002176 &msm_bus_8064_apps_fabric,
2177 &msm_bus_8064_sys_fabric,
2178 &msm_bus_8064_mm_fabric,
2179 &msm_bus_8064_sys_fpb,
2180 &msm_bus_8064_cpss_fpb,
Mohan Kumar Gubbihalli Lachma Naik7f72edd2012-02-06 17:26:47 -08002181 &apq8064_msm_device_vidc,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07002182 &msm_pil_dsps,
Matt Wagantalled832652012-02-02 19:23:17 -08002183 &msm_8960_riva,
Matt Wagantallb94b9a52012-02-02 21:59:54 -08002184 &msm_8960_q6_lpass,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002185 &msm_pil_vidc,
Matt Wagantall292aace2012-01-26 19:12:34 -08002186 &msm_gss,
Laura Abbottb93525f2012-04-12 09:57:19 -07002187 &apq8064_rtb_device,
Praveen Chidambaram8ea3dcd2011-12-07 14:46:31 -07002188 &apq8064_cpu_idle_device,
Praveen Chidambaram5c8adf22012-02-23 18:44:37 -07002189 &apq8064_msm_gov_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002190 &apq8064_device_cache_erp,
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002191 &epm_adc_device,
Pratik Patel212ab362012-03-16 12:30:07 -07002192 &apq8064_qdss_device,
2193 &msm_etb_device,
2194 &msm_tpiu_device,
2195 &msm_funnel_device,
2196 &apq8064_etm_device,
Helen Zeng8f925502012-03-05 16:50:17 -08002197 &apq_cpudai_slim_4_rx,
2198 &apq_cpudai_slim_4_tx,
Jignesh Mehta921649d2012-04-19 06:57:23 -07002199 &msm8960_gemini_device,
Laura Abbott0577d7b2012-04-17 11:14:30 -07002200 &apq8064_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002201 &msm_tsens_device,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002202};
2203
Joel King4e7ad222011-08-17 15:47:38 -07002204static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002205 &apq8064_device_uart_gsbi3,
Yan He06913ce2011-08-26 16:33:46 -07002206 &msm_device_sps_apq8064,
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002207};
2208
2209static struct platform_device *rumi3_devices[] __initdata = {
2210 &apq8064_device_uart_gsbi1,
Yan He435ed612011-11-23 17:34:59 -08002211 &msm_device_sps_apq8064,
Huaibin Yang4a084e32011-12-15 15:25:52 -08002212#ifdef CONFIG_MSM_ROTATOR
2213 &msm_rotator_device,
2214#endif
Joel King4e7ad222011-08-17 15:47:38 -07002215};
2216
Joel King82b7e3f2012-01-05 10:03:27 -08002217static struct platform_device *cdp_devices[] __initdata = {
2218 &apq8064_device_uart_gsbi1,
Jin Hong4bbbfba2012-02-02 21:48:07 -08002219 &apq8064_device_uart_gsbi7,
Joel King82b7e3f2012-01-05 10:03:27 -08002220 &msm_device_sps_apq8064,
Aravind Venkateswaran4ca27532012-02-16 14:27:05 -08002221#ifdef CONFIG_MSM_ROTATOR
2222 &msm_rotator_device,
2223#endif
Joel King82b7e3f2012-01-05 10:03:27 -08002224};
2225
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002226static struct platform_device
2227mpq8064_device_ext_5v_frc_vreg __devinitdata = {
2228 .name = GPIO_REGULATOR_DEV_NAME,
2229 .id = SX150X_GPIO(4, 10),
2230 .dev = {
2231 .platform_data =
2232 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_FRC_5V],
2233 },
2234};
2235
2236static struct platform_device
2237mpq8064_device_ext_1p2_buck_vreg __devinitdata = {
2238 .name = GPIO_REGULATOR_DEV_NAME,
2239 .id = SX150X_GPIO(4, 2),
2240 .dev = {
2241 .platform_data =
2242 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P2V],
2243 },
2244};
2245
2246static struct platform_device
2247mpq8064_device_ext_1p8_buck_vreg __devinitdata = {
2248 .name = GPIO_REGULATOR_DEV_NAME,
2249 .id = SX150X_GPIO(4, 4),
2250 .dev = {
2251 .platform_data =
2252 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P8V],
2253 },
2254};
2255
2256static struct platform_device
2257mpq8064_device_ext_2p2_buck_vreg __devinitdata = {
2258 .name = GPIO_REGULATOR_DEV_NAME,
2259 .id = SX150X_GPIO(4, 14),
2260 .dev = {
2261 .platform_data =
2262 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_2P2V],
2263 },
2264};
2265
2266static struct platform_device
2267mpq8064_device_ext_5v_buck_vreg __devinitdata = {
2268 .name = GPIO_REGULATOR_DEV_NAME,
2269 .id = SX150X_GPIO(4, 3),
2270 .dev = {
2271 .platform_data =
2272 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_5V],
2273 },
2274};
2275
2276static struct platform_device
2277mpq8064_device_ext_3p3v_ldo_vreg __devinitdata = {
2278 .name = GPIO_REGULATOR_DEV_NAME,
2279 .id = SX150X_GPIO(4, 15),
2280 .dev = {
2281 .platform_data =
2282 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_3P3V],
2283 },
2284};
2285
Ravi Kumar V1c903012012-05-15 16:11:35 +05302286static struct platform_device rc_input_loopback_pdev = {
2287 .name = "rc-user-input",
2288 .id = -1,
2289};
2290
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002291static struct platform_device *mpq_devices[] __initdata = {
2292 &msm_device_sps_apq8064,
2293 &mpq8064_device_qup_i2c_gsbi5,
2294#ifdef CONFIG_MSM_ROTATOR
2295 &msm_rotator_device,
2296#endif
Ravi Kumar V05931a22012-04-04 17:09:37 +05302297 &gpio_ir_recv_pdev,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002298 &mpq8064_device_ext_5v_frc_vreg,
2299 &mpq8064_device_ext_1p2_buck_vreg,
2300 &mpq8064_device_ext_1p8_buck_vreg,
2301 &mpq8064_device_ext_2p2_buck_vreg,
2302 &mpq8064_device_ext_5v_buck_vreg,
2303 &mpq8064_device_ext_3p3v_ldo_vreg,
Terence Hampson2e1705f2012-04-11 19:55:29 -04002304#ifdef CONFIG_MSM_VCAP
2305 &msm8064_device_vcap,
2306#endif
Ravi Kumar V1c903012012-05-15 16:11:35 +05302307 &rc_input_loopback_pdev,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002308};
2309
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002310static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002311 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002312};
2313
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002314#define KS8851_IRQ_GPIO 43
2315
2316static struct spi_board_info spi_board_info[] __initdata = {
2317 {
2318 .modalias = "ks8851",
2319 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2320 .max_speed_hz = 19200000,
2321 .bus_num = 0,
2322 .chip_select = 2,
2323 .mode = SPI_MODE_0,
2324 },
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002325 {
2326 .modalias = "epm_adc",
2327 .max_speed_hz = 1100000,
2328 .bus_num = 0,
2329 .chip_select = 3,
2330 .mode = SPI_MODE_0,
2331 },
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002332};
2333
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002334static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002335 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08002336 .bus_num = 1,
2337 .slim_slave = &apq8064_slim_tabla,
2338 },
2339 {
2340 .bus_num = 1,
2341 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002342 },
2343 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002344};
2345
David Keitel3c40fc52012-02-09 17:53:52 -08002346static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi1_pdata = {
2347 .clk_freq = 100000,
2348 .src_clk_rate = 24000000,
2349};
2350
Jing Lin04601f92012-02-05 15:36:07 -08002351static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi3_pdata = {
Anirudh Ghayalc2163472012-04-10 14:58:14 +05302352 .clk_freq = 384000,
Jing Lin04601f92012-02-05 15:36:07 -08002353 .src_clk_rate = 24000000,
2354};
2355
Kenneth Heitke748593a2011-07-15 15:45:11 -06002356static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
2357 .clk_freq = 100000,
2358 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002359};
2360
Joel King8f839b92012-04-01 14:37:46 -07002361static struct msm_i2c_platform_data mpq8064_i2c_qup_gsbi5_pdata = {
2362 .clk_freq = 100000,
2363 .src_clk_rate = 24000000,
2364};
2365
David Keitel3c40fc52012-02-09 17:53:52 -08002366#define GSBI_DUAL_MODE_CODE 0x60
2367#define MSM_GSBI1_PHYS 0x12440000
Kenneth Heitke748593a2011-07-15 15:45:11 -06002368static void __init apq8064_i2c_init(void)
2369{
David Keitel3c40fc52012-02-09 17:53:52 -08002370 void __iomem *gsbi_mem;
2371
2372 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2373 &apq8064_i2c_qup_gsbi1_pdata;
2374 gsbi_mem = ioremap_nocache(MSM_GSBI1_PHYS, 4);
2375 writel_relaxed(GSBI_DUAL_MODE_CODE, gsbi_mem);
2376 /* Ensure protocol code is written before proceeding */
2377 wmb();
2378 iounmap(gsbi_mem);
2379 apq8064_i2c_qup_gsbi1_pdata.use_gsbi_shared_mode = 1;
Jing Lin04601f92012-02-05 15:36:07 -08002380 apq8064_device_qup_i2c_gsbi3.dev.platform_data =
2381 &apq8064_i2c_qup_gsbi3_pdata;
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002382 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2383 &apq8064_i2c_qup_gsbi1_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002384 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
2385 &apq8064_i2c_qup_gsbi4_pdata;
Joel King8f839b92012-04-01 14:37:46 -07002386 mpq8064_device_qup_i2c_gsbi5.dev.platform_data =
2387 &mpq8064_i2c_qup_gsbi5_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002388}
2389
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002390#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002391static int ethernet_init(void)
2392{
2393 int ret;
2394 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
2395 if (ret) {
2396 pr_err("ks8851 gpio_request failed: %d\n", ret);
2397 goto fail;
2398 }
2399
2400 return 0;
2401fail:
2402 return ret;
2403}
2404#else
2405static int ethernet_init(void)
2406{
2407 return 0;
2408}
2409#endif
2410
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302411#define GPIO_KEY_HOME PM8921_GPIO_PM_TO_SYS(27)
2412#define GPIO_KEY_VOLUME_UP PM8921_GPIO_PM_TO_SYS(35)
2413#define GPIO_KEY_VOLUME_DOWN PM8921_GPIO_PM_TO_SYS(38)
2414#define GPIO_KEY_CAM_FOCUS PM8921_GPIO_PM_TO_SYS(3)
2415#define GPIO_KEY_CAM_SNAP PM8921_GPIO_PM_TO_SYS(4)
Jing Lin3f8f8422012-03-05 09:32:11 -08002416#define GPIO_KEY_ROTATION PM8921_GPIO_PM_TO_SYS(42)
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302417
2418static struct gpio_keys_button cdp_keys[] = {
2419 {
2420 .code = KEY_HOME,
2421 .gpio = GPIO_KEY_HOME,
2422 .desc = "home_key",
2423 .active_low = 1,
2424 .type = EV_KEY,
2425 .wakeup = 1,
2426 .debounce_interval = 15,
2427 },
2428 {
2429 .code = KEY_VOLUMEUP,
2430 .gpio = GPIO_KEY_VOLUME_UP,
2431 .desc = "volume_up_key",
2432 .active_low = 1,
2433 .type = EV_KEY,
2434 .wakeup = 1,
2435 .debounce_interval = 15,
2436 },
2437 {
2438 .code = KEY_VOLUMEDOWN,
2439 .gpio = GPIO_KEY_VOLUME_DOWN,
2440 .desc = "volume_down_key",
2441 .active_low = 1,
2442 .type = EV_KEY,
2443 .wakeup = 1,
2444 .debounce_interval = 15,
2445 },
2446 {
2447 .code = SW_ROTATE_LOCK,
2448 .gpio = GPIO_KEY_ROTATION,
2449 .desc = "rotate_key",
2450 .active_low = 1,
2451 .type = EV_SW,
2452 .debounce_interval = 15,
2453 },
2454};
2455
2456static struct gpio_keys_platform_data cdp_keys_data = {
2457 .buttons = cdp_keys,
2458 .nbuttons = ARRAY_SIZE(cdp_keys),
2459};
2460
2461static struct platform_device cdp_kp_pdev = {
2462 .name = "gpio-keys",
2463 .id = -1,
2464 .dev = {
2465 .platform_data = &cdp_keys_data,
2466 },
2467};
2468
2469static struct gpio_keys_button mtp_keys[] = {
2470 {
2471 .code = KEY_CAMERA_FOCUS,
2472 .gpio = GPIO_KEY_CAM_FOCUS,
2473 .desc = "cam_focus_key",
2474 .active_low = 1,
2475 .type = EV_KEY,
2476 .wakeup = 1,
2477 .debounce_interval = 15,
2478 },
2479 {
2480 .code = KEY_VOLUMEUP,
2481 .gpio = GPIO_KEY_VOLUME_UP,
2482 .desc = "volume_up_key",
2483 .active_low = 1,
2484 .type = EV_KEY,
2485 .wakeup = 1,
2486 .debounce_interval = 15,
2487 },
2488 {
2489 .code = KEY_VOLUMEDOWN,
2490 .gpio = GPIO_KEY_VOLUME_DOWN,
2491 .desc = "volume_down_key",
2492 .active_low = 1,
2493 .type = EV_KEY,
2494 .wakeup = 1,
2495 .debounce_interval = 15,
2496 },
2497 {
2498 .code = KEY_CAMERA_SNAPSHOT,
2499 .gpio = GPIO_KEY_CAM_SNAP,
2500 .desc = "cam_snap_key",
2501 .active_low = 1,
2502 .type = EV_KEY,
2503 .debounce_interval = 15,
2504 },
2505};
2506
2507static struct gpio_keys_platform_data mtp_keys_data = {
2508 .buttons = mtp_keys,
2509 .nbuttons = ARRAY_SIZE(mtp_keys),
2510};
2511
2512static struct platform_device mtp_kp_pdev = {
2513 .name = "gpio-keys",
2514 .id = -1,
2515 .dev = {
2516 .platform_data = &mtp_keys_data,
2517 },
2518};
2519
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05302520static struct gpio_keys_button mpq_keys[] = {
2521 {
2522 .code = KEY_VOLUMEDOWN,
2523 .gpio = GPIO_KEY_VOLUME_DOWN,
2524 .desc = "volume_down_key",
2525 .active_low = 1,
2526 .type = EV_KEY,
2527 .wakeup = 1,
2528 .debounce_interval = 15,
2529 },
2530 {
2531 .code = KEY_VOLUMEUP,
2532 .gpio = GPIO_KEY_VOLUME_UP,
2533 .desc = "volume_up_key",
2534 .active_low = 1,
2535 .type = EV_KEY,
2536 .wakeup = 1,
2537 .debounce_interval = 15,
2538 },
2539};
2540
2541static struct gpio_keys_platform_data mpq_keys_data = {
2542 .buttons = mpq_keys,
2543 .nbuttons = ARRAY_SIZE(mpq_keys),
2544};
2545
2546static struct platform_device mpq_gpio_keys_pdev = {
2547 .name = "gpio-keys",
2548 .id = -1,
2549 .dev = {
2550 .platform_data = &mpq_keys_data,
2551 },
2552};
2553
2554#define MPQ_KP_ROW_BASE SX150X_EXP2_GPIO_BASE
2555#define MPQ_KP_COL_BASE (SX150X_EXP2_GPIO_BASE + 4)
2556
2557static unsigned int mpq_row_gpios[] = {MPQ_KP_ROW_BASE, MPQ_KP_ROW_BASE + 1,
2558 MPQ_KP_ROW_BASE + 2, MPQ_KP_ROW_BASE + 3};
2559static unsigned int mpq_col_gpios[] = {MPQ_KP_COL_BASE, MPQ_KP_COL_BASE + 1,
2560 MPQ_KP_COL_BASE + 2};
2561
2562static const unsigned int mpq_keymap[] = {
2563 KEY(0, 0, KEY_UP),
2564 KEY(0, 1, KEY_ENTER),
2565 KEY(0, 2, KEY_3),
2566
2567 KEY(1, 0, KEY_DOWN),
2568 KEY(1, 1, KEY_EXIT),
2569 KEY(1, 2, KEY_4),
2570
2571 KEY(2, 0, KEY_LEFT),
2572 KEY(2, 1, KEY_1),
2573 KEY(2, 2, KEY_5),
2574
2575 KEY(3, 0, KEY_RIGHT),
2576 KEY(3, 1, KEY_2),
2577 KEY(3, 2, KEY_6),
2578};
2579
2580static struct matrix_keymap_data mpq_keymap_data = {
2581 .keymap_size = ARRAY_SIZE(mpq_keymap),
2582 .keymap = mpq_keymap,
2583};
2584
2585static struct matrix_keypad_platform_data mpq_keypad_data = {
2586 .keymap_data = &mpq_keymap_data,
2587 .row_gpios = mpq_row_gpios,
2588 .col_gpios = mpq_col_gpios,
2589 .num_row_gpios = ARRAY_SIZE(mpq_row_gpios),
2590 .num_col_gpios = ARRAY_SIZE(mpq_col_gpios),
2591 .col_scan_delay_us = 32000,
2592 .debounce_ms = 20,
2593 .wakeup = 1,
2594 .active_low = 1,
2595 .no_autorepeat = 1,
2596};
2597
2598static struct platform_device mpq_keypad_device = {
2599 .name = "matrix-keypad",
2600 .id = -1,
2601 .dev = {
2602 .platform_data = &mpq_keypad_data,
2603 },
2604};
2605
Jin Hongd3024e62012-02-09 16:13:32 -08002606/* Sensors DSPS platform data */
2607#define DSPS_PIL_GENERIC_NAME "dsps"
2608static void __init apq8064_init_dsps(void)
2609{
2610 struct msm_dsps_platform_data *pdata =
2611 msm_dsps_device_8064.dev.platform_data;
2612 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
2613 pdata->gpios = NULL;
2614 pdata->gpios_num = 0;
2615
2616 platform_device_register(&msm_dsps_device_8064);
2617}
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302618
Jing Lin417fa452012-02-05 14:31:06 -08002619#define I2C_SURF 1
2620#define I2C_FFA (1 << 1)
2621#define I2C_RUMI (1 << 2)
2622#define I2C_SIM (1 << 3)
2623#define I2C_LIQUID (1 << 4)
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002624#define I2C_MPQ_CDP BIT(5)
2625#define I2C_MPQ_HRD BIT(6)
2626#define I2C_MPQ_DTV BIT(7)
Jing Lin417fa452012-02-05 14:31:06 -08002627
2628struct i2c_registry {
2629 u8 machs;
2630 int bus;
2631 struct i2c_board_info *info;
2632 int len;
2633};
2634
2635static struct i2c_registry apq8064_i2c_devices[] __initdata = {
Jing Lin21ed4de2012-02-05 15:53:28 -08002636 {
David Keitel2f613d92012-02-15 11:29:16 -08002637 I2C_LIQUID,
2638 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
2639 smb349_charger_i2c_info,
2640 ARRAY_SIZE(smb349_charger_i2c_info)
2641 },
2642 {
Jing Lin21ed4de2012-02-05 15:53:28 -08002643 I2C_SURF | I2C_LIQUID,
2644 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
2645 mxt_device_info,
2646 ARRAY_SIZE(mxt_device_info),
2647 },
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08002648 {
2649 I2C_FFA,
2650 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
2651 cyttsp_info,
2652 ARRAY_SIZE(cyttsp_info),
2653 },
Amy Maloche70090f992012-02-16 16:35:26 -08002654 {
2655 I2C_FFA | I2C_LIQUID,
2656 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
2657 isa1200_board_info,
2658 ARRAY_SIZE(isa1200_board_info),
2659 },
Santosh Mardieff9a742012-04-09 23:23:39 +05302660 {
2661 I2C_MPQ_CDP,
2662 APQ_8064_GSBI5_QUP_I2C_BUS_ID,
2663 cs8427_device_info,
2664 ARRAY_SIZE(cs8427_device_info),
2665 },
Jing Lin417fa452012-02-05 14:31:06 -08002666};
2667
Jay Chokshi607f61b2012-04-25 18:21:21 -07002668#define SX150X_EXP1_INT_N PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9)
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05302669#define SX150X_EXP2_INT_N MSM_GPIO_TO_INT(81)
Jay Chokshi607f61b2012-04-25 18:21:21 -07002670
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002671struct sx150x_platform_data mpq8064_sx150x_pdata[] = {
2672 [SX150X_EXP1] = {
2673 .gpio_base = SX150X_EXP1_GPIO_BASE,
2674 .oscio_is_gpo = false,
2675 .io_pullup_ena = 0x0,
2676 .io_pulldn_ena = 0x0,
2677 .io_open_drain_ena = 0x0,
2678 .io_polarity = 0,
Jay Chokshi607f61b2012-04-25 18:21:21 -07002679 .irq_summary = SX150X_EXP1_INT_N,
2680 .irq_base = SX150X_EXP1_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002681 },
2682 [SX150X_EXP2] = {
2683 .gpio_base = SX150X_EXP2_GPIO_BASE,
2684 .oscio_is_gpo = false,
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05302685 .io_pullup_ena = 0x0f,
2686 .io_pulldn_ena = 0x70,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002687 .io_open_drain_ena = 0x0,
2688 .io_polarity = 0,
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05302689 .irq_summary = SX150X_EXP2_INT_N,
2690 .irq_base = SX150X_EXP2_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002691 },
2692 [SX150X_EXP3] = {
2693 .gpio_base = SX150X_EXP3_GPIO_BASE,
2694 .oscio_is_gpo = false,
2695 .io_pullup_ena = 0x0,
2696 .io_pulldn_ena = 0x0,
2697 .io_open_drain_ena = 0x0,
2698 .io_polarity = 0,
2699 .irq_summary = -1,
2700 },
2701 [SX150X_EXP4] = {
2702 .gpio_base = SX150X_EXP4_GPIO_BASE,
2703 .oscio_is_gpo = false,
2704 .io_pullup_ena = 0x0,
2705 .io_pulldn_ena = 0x0,
2706 .io_open_drain_ena = 0x0,
2707 .io_polarity = 0,
2708 .irq_summary = -1,
2709 },
2710};
2711
2712static struct i2c_board_info sx150x_gpio_exp_info[] = {
2713 {
2714 I2C_BOARD_INFO("sx1509q", 0x70),
2715 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP1],
2716 },
2717 {
2718 I2C_BOARD_INFO("sx1508q", 0x23),
2719 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP2],
2720 },
2721 {
2722 I2C_BOARD_INFO("sx1508q", 0x22),
2723 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP3],
2724 },
2725 {
2726 I2C_BOARD_INFO("sx1509q", 0x3E),
2727 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP4],
2728 },
2729};
2730
2731#define MPQ8064_I2C_GSBI5_BUS_ID 5
2732
2733static struct i2c_registry mpq8064_i2c_devices[] __initdata = {
2734 {
2735 I2C_MPQ_CDP,
2736 MPQ8064_I2C_GSBI5_BUS_ID,
2737 sx150x_gpio_exp_info,
2738 ARRAY_SIZE(sx150x_gpio_exp_info),
2739 },
2740};
2741
Jing Lin417fa452012-02-05 14:31:06 -08002742static void __init register_i2c_devices(void)
2743{
2744 u8 mach_mask = 0;
2745 int i;
2746
Kevin Chand07220e2012-02-13 15:52:22 -08002747#ifdef CONFIG_MSM_CAMERA
2748 struct i2c_registry apq8064_camera_i2c_devices = {
2749 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_RUMI,
2750 APQ_8064_GSBI4_QUP_I2C_BUS_ID,
2751 apq8064_camera_board_info.board_info,
2752 apq8064_camera_board_info.num_i2c_board_info,
2753 };
2754#endif
Jing Lin417fa452012-02-05 14:31:06 -08002755 /* Build the matching 'supported_machs' bitmask */
2756 if (machine_is_apq8064_cdp())
2757 mach_mask = I2C_SURF;
2758 else if (machine_is_apq8064_mtp())
2759 mach_mask = I2C_FFA;
2760 else if (machine_is_apq8064_liquid())
2761 mach_mask = I2C_LIQUID;
2762 else if (machine_is_apq8064_rumi3())
2763 mach_mask = I2C_RUMI;
2764 else if (machine_is_apq8064_sim())
2765 mach_mask = I2C_SIM;
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002766 else if (PLATFORM_IS_MPQ8064())
2767 mach_mask = I2C_MPQ_CDP;
Jing Lin417fa452012-02-05 14:31:06 -08002768 else
2769 pr_err("unmatched machine ID in register_i2c_devices\n");
2770
2771 /* Run the array and install devices as appropriate */
2772 for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) {
2773 if (apq8064_i2c_devices[i].machs & mach_mask)
2774 i2c_register_board_info(apq8064_i2c_devices[i].bus,
2775 apq8064_i2c_devices[i].info,
2776 apq8064_i2c_devices[i].len);
2777 }
Kevin Chand07220e2012-02-13 15:52:22 -08002778#ifdef CONFIG_MSM_CAMERA
2779 if (apq8064_camera_i2c_devices.machs & mach_mask)
2780 i2c_register_board_info(apq8064_camera_i2c_devices.bus,
2781 apq8064_camera_i2c_devices.info,
2782 apq8064_camera_i2c_devices.len);
2783#endif
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002784
2785 for (i = 0; i < ARRAY_SIZE(mpq8064_i2c_devices); ++i) {
2786 if (mpq8064_i2c_devices[i].machs & mach_mask)
2787 i2c_register_board_info(
2788 mpq8064_i2c_devices[i].bus,
2789 mpq8064_i2c_devices[i].info,
2790 mpq8064_i2c_devices[i].len);
2791 }
Jing Lin417fa452012-02-05 14:31:06 -08002792}
2793
Jay Chokshi994ff122012-03-27 15:43:48 -07002794static void enable_ddr3_regulator(void)
2795{
2796 static struct regulator *ext_ddr3;
2797
2798 /* Use MPP7 output state as a flag for PCDDR3 presence. */
2799 if (gpio_get_value_cansleep(PM8921_MPP_PM_TO_SYS(7)) > 0) {
2800 ext_ddr3 = regulator_get(NULL, "ext_ddr3");
2801 if (IS_ERR(ext_ddr3) || ext_ddr3 == NULL)
2802 pr_err("Could not get MPP7 regulator\n");
2803 else
2804 regulator_enable(ext_ddr3);
2805 }
2806}
2807
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002808static void enable_avc_i2c_bus(void)
2809{
2810 int avc_i2c_en_mpp = PM8921_MPP_PM_TO_SYS(8);
2811 int rc;
2812
2813 rc = gpio_request(avc_i2c_en_mpp, "avc_i2c_en");
2814 if (rc)
2815 pr_err("request for avc_i2c_en mpp failed,"
2816 "rc=%d\n", rc);
2817 else
2818 gpio_set_value_cansleep(avc_i2c_en_mpp, 1);
2819}
2820
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002821static void __init apq8064_common_init(void)
2822{
Joel King8f839b92012-04-01 14:37:46 -07002823 msm_tsens_early_init(&apq_tsens_pdata);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002824 if (socinfo_init() < 0)
2825 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06002826 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
2827 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
David Collins2782b5c2012-02-06 10:02:42 -08002828 regulator_suppress_info_printing();
2829 platform_device_register(&apq8064_device_rpm_regulator);
Stephen Boyd4d0d2582012-02-10 14:49:40 -08002830 if (msm_xo_init())
2831 pr_err("Failed to initialize XO votes\n");
Matt Wagantallc51e5602012-02-27 17:25:25 -08002832 msm_clock_init(&apq8064_clock_init_data);
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08002833 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06002834 apq8064_i2c_init();
Jing Lin417fa452012-02-05 14:31:06 -08002835 register_i2c_devices();
Kenneth Heitke36920d32011-07-20 16:44:30 -06002836
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002837 apq8064_device_qup_spi_gsbi5.dev.platform_data =
2838 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08002839 apq8064_init_pmic();
Hemant Kumar94e7da22012-02-03 16:52:29 -08002840 if (machine_is_apq8064_liquid())
2841 msm_otg_pdata.mhl_enable = true;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07002842
Ofir Cohen94213a72012-05-03 14:26:32 +03002843 android_usb_pdata.swfi_latency =
2844 msm_rpmrs_levels[0].latency_us;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07002845
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002846 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Manu Gautam91223e02011-11-08 15:27:22 +05302847 apq8064_ehci_host_init();
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002848 apq8064_init_buses();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002849 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Terence Hampson36b70722012-05-10 13:18:16 -04002850 if (!(machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
2851 machine_is_mpq8064_dtv()))
2852 platform_add_devices(common_not_mpq_devices,
2853 ARRAY_SIZE(common_not_mpq_devices));
Jay Chokshi994ff122012-03-27 15:43:48 -07002854 enable_ddr3_regulator();
Hemant Kumarf1ca9192012-02-07 18:59:33 -08002855 if (machine_is_apq8064_mtp()) {
2856 apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
2857 device_initialize(&apq8064_device_hsic_host.dev);
2858 }
Jay Chokshie8741282012-01-25 15:22:55 -08002859 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05302860 apq8064_init_mmc();
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08002861
2862 if (machine_is_apq8064_mtp()) {
2863 mdm_8064_device.dev.platform_data = &mdm_platform_data;
2864 platform_device_register(&mdm_8064_device);
2865 }
2866 platform_device_register(&apq8064_slim_ctrl);
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002867 slim_register_board_info(apq8064_slim_devices,
2868 ARRAY_SIZE(apq8064_slim_devices));
Jin Hongd3024e62012-02-09 16:13:32 -08002869 apq8064_init_dsps();
Praveen Chidambaram78499012011-11-01 17:15:17 -06002870 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Mahesh Sivasubramaniancbce1ec2012-01-24 10:32:44 -07002871 acpuclk_init(&acpuclk_8064_soc_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002872 msm_spm_l2_init(msm_spm_l2_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002873 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Praveen Chidambaram4d19be42012-04-03 18:05:52 -06002874 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002875 apq8064_epm_adc_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002876}
2877
Huaibin Yang4a084e32011-12-15 15:25:52 -08002878static void __init apq8064_allocate_memory_regions(void)
2879{
2880 apq8064_allocate_fb_region();
2881}
2882
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002883static void __init apq8064_sim_init(void)
2884{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002885 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
2886 &msm8064_device_watchdog.dev.platform_data;
2887
2888 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002889 apq8064_common_init();
Joel King4e7ad222011-08-17 15:47:38 -07002890 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
2891}
2892
2893static void __init apq8064_rumi3_init(void)
2894{
2895 apq8064_common_init();
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002896 ethernet_init();
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002897 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002898 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002899}
2900
Joel King82b7e3f2012-01-05 10:03:27 -08002901static void __init apq8064_cdp_init(void)
2902{
Hanumant Singh50440d42012-04-23 19:27:16 -07002903 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2904 pr_err("meminfo_init() failed!\n");
Joel King82b7e3f2012-01-05 10:03:27 -08002905 apq8064_common_init();
Joel King8f839b92012-04-01 14:37:46 -07002906 if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
2907 machine_is_mpq8064_dtv()) {
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002908 enable_avc_i2c_bus();
Joel King8f839b92012-04-01 14:37:46 -07002909 platform_add_devices(mpq_devices, ARRAY_SIZE(mpq_devices));
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002910 mpq8064_pcie_init();
Joel King8f839b92012-04-01 14:37:46 -07002911 } else {
2912 ethernet_init();
2913 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
2914 spi_register_board_info(spi_board_info,
2915 ARRAY_SIZE(spi_board_info));
2916 }
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002917 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07002918 apq8064_init_gpu();
Matt Wagantall1f65d9d2012-04-25 14:24:20 -07002919 platform_add_devices(apq8064_footswitch, apq8064_num_footswitch);
Kevin Chand07220e2012-02-13 15:52:22 -08002920 apq8064_init_cam();
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302921
2922 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
2923 platform_device_register(&cdp_kp_pdev);
2924
2925 if (machine_is_apq8064_mtp())
2926 platform_device_register(&mtp_kp_pdev);
Hanumant Singh50440d42012-04-23 19:27:16 -07002927
2928 change_memory_power = &apq8064_change_memory_power;
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05302929
2930 if (machine_is_mpq8064_cdp()) {
2931 platform_device_register(&mpq_gpio_keys_pdev);
2932 platform_device_register(&mpq_keypad_device);
2933 }
Joel King82b7e3f2012-01-05 10:03:27 -08002934}
2935
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002936MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
2937 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002938 .reserve = apq8064_reserve,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002939 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302940 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002941 .timer = &msm_timer,
2942 .init_machine = apq8064_sim_init,
2943MACHINE_END
2944
Joel King4e7ad222011-08-17 15:47:38 -07002945MACHINE_START(APQ8064_RUMI3, "QCT APQ8064 RUMI3")
2946 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002947 .reserve = apq8064_reserve,
Joel King4e7ad222011-08-17 15:47:38 -07002948 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302949 .handle_irq = gic_handle_irq,
Joel King4e7ad222011-08-17 15:47:38 -07002950 .timer = &msm_timer,
2951 .init_machine = apq8064_rumi3_init,
Huaibin Yang4a084e32011-12-15 15:25:52 -08002952 .init_early = apq8064_allocate_memory_regions,
Joel King4e7ad222011-08-17 15:47:38 -07002953MACHINE_END
2954
Joel King82b7e3f2012-01-05 10:03:27 -08002955MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
2956 .map_io = apq8064_map_io,
2957 .reserve = apq8064_reserve,
2958 .init_irq = apq8064_init_irq,
2959 .handle_irq = gic_handle_irq,
2960 .timer = &msm_timer,
2961 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002962 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07002963 .init_very_early = apq8064_early_reserve,
Joel King82b7e3f2012-01-05 10:03:27 -08002964MACHINE_END
2965
2966MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
2967 .map_io = apq8064_map_io,
2968 .reserve = apq8064_reserve,
2969 .init_irq = apq8064_init_irq,
2970 .handle_irq = gic_handle_irq,
2971 .timer = &msm_timer,
2972 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002973 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07002974 .init_very_early = apq8064_early_reserve,
Joel King82b7e3f2012-01-05 10:03:27 -08002975MACHINE_END
2976
2977MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
2978 .map_io = apq8064_map_io,
2979 .reserve = apq8064_reserve,
2980 .init_irq = apq8064_init_irq,
2981 .handle_irq = gic_handle_irq,
2982 .timer = &msm_timer,
2983 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002984 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07002985 .init_very_early = apq8064_early_reserve,
Joel King82b7e3f2012-01-05 10:03:27 -08002986MACHINE_END
2987
Joel King064bbf82012-04-01 13:23:39 -07002988MACHINE_START(MPQ8064_CDP, "QCT MPQ8064 CDP")
2989 .map_io = apq8064_map_io,
2990 .reserve = apq8064_reserve,
2991 .init_irq = apq8064_init_irq,
2992 .handle_irq = gic_handle_irq,
2993 .timer = &msm_timer,
2994 .init_machine = apq8064_cdp_init,
2995 .init_early = apq8064_allocate_memory_regions,
2996 .init_very_early = apq8064_early_reserve,
2997MACHINE_END
2998
Joel King11ca8202012-02-13 16:19:03 -08002999MACHINE_START(MPQ8064_HRD, "QCT MPQ8064 HRD")
3000 .map_io = apq8064_map_io,
3001 .reserve = apq8064_reserve,
3002 .init_irq = apq8064_init_irq,
3003 .handle_irq = gic_handle_irq,
3004 .timer = &msm_timer,
3005 .init_machine = apq8064_cdp_init,
Laura Abbott6988cef2012-03-15 14:27:13 -07003006 .init_very_early = apq8064_early_reserve,
Joel King11ca8202012-02-13 16:19:03 -08003007MACHINE_END
3008
3009MACHINE_START(MPQ8064_DTV, "QCT MPQ8064 DTV")
3010 .map_io = apq8064_map_io,
3011 .reserve = apq8064_reserve,
3012 .init_irq = apq8064_init_irq,
3013 .handle_irq = gic_handle_irq,
3014 .timer = &msm_timer,
3015 .init_machine = apq8064_cdp_init,
Laura Abbott6988cef2012-03-15 14:27:13 -07003016 .init_very_early = apq8064_early_reserve,
Joel King11ca8202012-02-13 16:19:03 -08003017MACHINE_END
3018