blob: 3a1965aabcac84a2a521e8078f14973345834a0a [file] [log] [blame]
Abhijeet Dharmapurikarfb4a2f82012-08-23 14:36:59 -07001/* Copyright (c) 2011-2012, The Linux Foundation. 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>
Niranjana Vishwanathapurac1edd402012-06-28 15:32:50 -060014#include <linux/bitops.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070015#include <linux/platform_device.h>
Steve Mucklef132c6c2012-06-06 18:30:57 -070016#include <linux/gpio.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070017#include <linux/io.h>
18#include <linux/irq.h>
Kenneth Heitke748593a2011-07-15 15:45:11 -060019#include <linux/i2c.h>
David Keitel2f613d92012-02-15 11:29:16 -080020#include <linux/i2c/smb349.h>
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -080021#include <linux/i2c/sx150x.h>
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -060022#include <linux/slimbus/slimbus.h>
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +053023#include <linux/mfd/wcd9xxx/core.h>
24#include <linux/mfd/wcd9xxx/pdata.h>
Amy Maloche70090f992012-02-16 16:35:26 -080025#include <linux/mfd/pm8xxx/misc.h>
Kenneth Heitke36920d32011-07-20 16:44:30 -060026#include <linux/msm_ssbi.h>
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -070027#include <linux/spi/spi.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070028#include <linux/dma-mapping.h>
29#include <linux/platform_data/qcom_crypto_device.h>
Mitchel Humpherysca983d82012-09-06 11:32:54 -070030#include <linux/msm_ion.h>
Jack Cheung46bfffa2012-01-19 15:26:24 -080031#include <linux/memory.h>
Larry Bassel67b921d2012-04-06 10:23:27 -070032#include <linux/memblock.h>
Praveen Chidambaram877d7a42012-06-05 14:33:20 -060033#include <linux/msm_thermal.h>
Jing Lin21ed4de2012-02-05 15:53:28 -080034#include <linux/i2c/atmel_mxt_ts.h>
Steve Mucklef132c6c2012-06-06 18:30:57 -070035#include <linux/cyttsp-qc.h>
Amy Maloche70090f992012-02-16 16:35:26 -080036#include <linux/i2c/isa1200.h>
Mohan Pallaka474b94b2012-01-25 12:59:58 +053037#include <linux/gpio_keys.h>
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -080038#include <linux/epm_adc.h>
Jay Chokshie7d8d4f2012-04-04 14:47:57 -070039#include <linux/i2c/sx150x.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070040#include <asm/mach-types.h>
41#include <asm/mach/arch.h>
42#include <asm/hardware/gic.h>
Sahitya Tummala3586ed92011-08-03 09:13:23 +053043#include <asm/mach/mmc.h>
Ankit Verma6b7e2ba2012-01-26 15:48:54 -080044#include <linux/platform_data/qcom_wcnss_device.h>
Bar Weinerf82c5872012-10-23 14:31:26 +020045#include <linux/ci-bridge-spi.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070046
47#include <mach/board.h>
48#include <mach/msm_iomap.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080049#include <mach/ion.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070050#include <linux/usb/msm_hsusb.h>
51#include <linux/usb/android.h>
52#include <mach/socinfo.h>
Harini Jayaramanc4c58692011-07-19 14:50:10 -060053#include <mach/msm_spi.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070054#include "timer.h"
55#include "devices.h"
Joel King4ebccc62011-07-22 09:43:22 -070056#include <mach/gpiomux.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060057#include <mach/rpm.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080058#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -070059#include <linux/android_pmem.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080060#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070061#include <mach/msm_memtypes.h>
62#include <linux/bootmem.h>
63#include <asm/setup.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070064#include <mach/dma.h>
Jin Hongd3024e62012-02-09 16:13:32 -080065#include <mach/msm_dsps.h>
Gagan Mac8a7a5d32011-11-11 16:43:06 -070066#include <mach/msm_bus_board.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060067#include <mach/cpuidle.h>
Joel Kingdacbc822012-01-25 13:30:57 -080068#include <mach/mdm2.h>
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -080069#include <linux/msm_tsens.h>
Stephen Boyd4d0d2582012-02-10 14:49:40 -080070#include <mach/msm_xo.h>
Laura Abbott350c8362012-02-28 14:46:52 -080071#include <mach/msm_rtb.h>
Mayank Rana262e9032012-05-10 15:14:00 -070072#include <mach/msm_serial_hs.h>
Santosh Mardieff9a742012-04-09 23:23:39 +053073#include <sound/cs8427.h>
Ravi Kumar V05931a22012-04-04 17:09:37 +053074#include <media/gpio-ir-recv.h>
Larry Bassel67b921d2012-04-06 10:23:27 -070075#include <linux/fmem.h>
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -060076#include <mach/msm_pcie.h>
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -070077#include <mach/restart.h>
Niranjana Vishwanathapurac1edd402012-06-28 15:32:50 -060078#include <mach/msm_iomap.h>
Joel King4ebccc62011-07-22 09:43:22 -070079
Jeff Ohlstein7e668552011-10-06 16:17:25 -070080#include "msm_watchdog.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080081#include "board-8064.h"
Matt Wagantall33d01f52012-02-23 23:27:44 -080082#include "clock.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060083#include "spm.h"
Subhash Jadavani909e04f2012-04-12 10:52:50 +053084#include <mach/mpm.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060085#include "rpm_resources.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080086#include "pm.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060087#include "pm-boot.h"
Rajesh Sastrulaaee8af32012-01-20 11:46:31 -080088#include "devices-msm8x60.h"
Hanumant Singh50440d42012-04-23 19:27:16 -070089#include "smd_private.h"
Jay Chokshiea67c622011-07-29 17:12:26 -070090
Abhishek Kharbanda72dc72e2012-06-07 13:41:37 -070091#define MHL_GPIO_INT 30
92#define MHL_GPIO_RESET 35
93
Olav Haugan7c6aa742012-01-16 16:47:37 -080094#define MSM_PMEM_ADSP_SIZE 0x7800000
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -070095#define MSM_PMEM_AUDIO_SIZE 0x4CF000
Olav Haugan7c6aa742012-01-16 16:47:37 -080096#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
97#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
98#else
Chetan Kalyan72aac4f2012-02-23 14:56:54 -080099#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800100#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700101
Olav Haugan7c6aa742012-01-16 16:47:37 -0800102#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Hanumant Singheadb7502012-05-15 18:14:04 -0700103#define HOLE_SIZE 0x20000
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700104#define MSM_CONTIG_MEM_SIZE 0x65000
Olav Haugan129992c2012-03-22 09:54:01 -0700105#ifdef CONFIG_MSM_IOMMU
106#define MSM_ION_MM_SIZE 0x3800000
107#define MSM_ION_SF_SIZE 0
Olav Haugan39477bb2012-05-14 16:05:36 -0700108#define MSM_ION_QSECOM_SIZE 0x780000 /* (7.5MB) */
Olav Haugan129992c2012-03-22 09:54:01 -0700109#define MSM_ION_HEAP_NUM 7
110#else
Olav Haugan7c6aa742012-01-16 16:47:37 -0800111#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Haugan129992c2012-03-22 09:54:01 -0700112#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Haugan39477bb2012-05-14 16:05:36 -0700113#define MSM_ION_QSECOM_SIZE 0x600000 /* (6MB) */
Olav Haugan129992c2012-03-22 09:54:01 -0700114#define MSM_ION_HEAP_NUM 8
115#endif
Hanumant Singheadb7502012-05-15 18:14:04 -0700116#define MSM_ION_MM_FW_SIZE (0x200000 - HOLE_SIZE) /* (2MB - 128KB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800117#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan2c43fac2012-01-19 11:06:37 -0800118#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Olav Haugan7c6aa742012-01-16 16:47:37 -0800119#else
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700120#define MSM_CONTIG_MEM_SIZE 0x110C000
Olav Haugan7c6aa742012-01-16 16:47:37 -0800121#define MSM_ION_HEAP_NUM 1
122#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700123
Hanumant Singheadb7502012-05-15 18:14:04 -0700124#define APQ8064_FIXED_AREA_START (0xa0000000 - (MSM_ION_MM_FW_SIZE + \
125 HOLE_SIZE))
Larry Bassel67b921d2012-04-06 10:23:27 -0700126#define MAX_FIXED_AREA_SIZE 0x10000000
Hanumant Singheadb7502012-05-15 18:14:04 -0700127#define MSM_MM_FW_SIZE (0x200000 - HOLE_SIZE)
128#define APQ8064_FW_START APQ8064_FIXED_AREA_START
Larry Bassel67b921d2012-04-06 10:23:27 -0700129
Niranjana Vishwanathapurac1edd402012-06-28 15:32:50 -0600130#define QFPROM_RAW_FEAT_CONFIG_ROW0_MSB (MSM_QFPROM_BASE + 0x23c)
131#define QFPROM_RAW_OEM_CONFIG_ROW0_LSB (MSM_QFPROM_BASE + 0x220)
132
Niranjana Vishwanathapura68210ff2012-06-24 18:03:49 -0600133/* PCIE AXI address space */
134#define PCIE_AXI_BAR_PHYS 0x08000000
135#define PCIE_AXI_BAR_SIZE SZ_128M
136
Niranjana Vishwanathapura459a27d2012-07-20 12:23:55 -0600137/* PCIe pmic gpios */
138#define PCIE_WAKE_N_PMIC_GPIO 12
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -0600139#define PCIE_PWR_EN_PMIC_GPIO 13
140#define PCIE_RST_N_PMIC_MPP 1
141
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700142#ifdef CONFIG_KERNEL_MSM_CONTIG_MEM_REGION
143static unsigned msm_contig_mem_size = MSM_CONTIG_MEM_SIZE;
144static int __init msm_contig_mem_size_setup(char *p)
Kevin Chan13be4e22011-10-20 11:30:32 -0700145{
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700146 msm_contig_mem_size = memparse(p, NULL);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800147 return 0;
Kevin Chan13be4e22011-10-20 11:30:32 -0700148}
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700149early_param("msm_contig_mem_size", msm_contig_mem_size_setup);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800150#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700151
Olav Haugan7c6aa742012-01-16 16:47:37 -0800152#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -0700153static unsigned pmem_size = MSM_PMEM_SIZE;
154static int __init pmem_size_setup(char *p)
155{
156 pmem_size = memparse(p, NULL);
157 return 0;
158}
159early_param("pmem_size", pmem_size_setup);
160
161static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
162
163static int __init pmem_adsp_size_setup(char *p)
164{
165 pmem_adsp_size = memparse(p, NULL);
166 return 0;
167}
168early_param("pmem_adsp_size", pmem_adsp_size_setup);
169
170static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
171
172static int __init pmem_audio_size_setup(char *p)
173{
174 pmem_audio_size = memparse(p, NULL);
175 return 0;
176}
177early_param("pmem_audio_size", pmem_audio_size_setup);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800178#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700179
Olav Haugan7c6aa742012-01-16 16:47:37 -0800180#ifdef CONFIG_ANDROID_PMEM
181#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700182static struct android_pmem_platform_data android_pmem_pdata = {
183 .name = "pmem",
184 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
185 .cached = 1,
186 .memory_type = MEMTYPE_EBI1,
187};
188
Laura Abbottb93525f2012-04-12 09:57:19 -0700189static struct platform_device apq8064_android_pmem_device = {
Kevin Chan13be4e22011-10-20 11:30:32 -0700190 .name = "android_pmem",
191 .id = 0,
192 .dev = {.platform_data = &android_pmem_pdata},
193};
194
195static struct android_pmem_platform_data android_pmem_adsp_pdata = {
196 .name = "pmem_adsp",
197 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
198 .cached = 0,
199 .memory_type = MEMTYPE_EBI1,
200};
Laura Abbottb93525f2012-04-12 09:57:19 -0700201static struct platform_device apq8064_android_pmem_adsp_device = {
Kevin Chan13be4e22011-10-20 11:30:32 -0700202 .name = "android_pmem",
203 .id = 2,
204 .dev = { .platform_data = &android_pmem_adsp_pdata },
205};
206
207static struct android_pmem_platform_data android_pmem_audio_pdata = {
208 .name = "pmem_audio",
209 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
210 .cached = 0,
211 .memory_type = MEMTYPE_EBI1,
212};
213
Laura Abbottb93525f2012-04-12 09:57:19 -0700214static struct platform_device apq8064_android_pmem_audio_device = {
Kevin Chan13be4e22011-10-20 11:30:32 -0700215 .name = "android_pmem",
216 .id = 4,
217 .dev = { .platform_data = &android_pmem_audio_pdata },
218};
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700219#endif /* CONFIG_MSM_MULTIMEDIA_USE_ION */
220#endif /* CONFIG_ANDROID_PMEM */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800221
Binqiang Qiuf165c922012-08-15 18:00:18 -0700222#ifdef CONFIG_BATTERY_BCL
223static struct platform_device battery_bcl_device = {
224 .name = "battery_current_limit",
225 .id = -1,
226};
227#endif
228
Larry Bassel67b921d2012-04-06 10:23:27 -0700229struct fmem_platform_data apq8064_fmem_pdata = {
230};
231
Olav Haugan7c6aa742012-01-16 16:47:37 -0800232static struct memtype_reserve apq8064_reserve_table[] __initdata = {
233 [MEMTYPE_SMI] = {
234 },
235 [MEMTYPE_EBI0] = {
236 .flags = MEMTYPE_FLAGS_1M_ALIGN,
237 },
238 [MEMTYPE_EBI1] = {
239 .flags = MEMTYPE_FLAGS_1M_ALIGN,
240 },
241};
Kevin Chan13be4e22011-10-20 11:30:32 -0700242
Laura Abbott350c8362012-02-28 14:46:52 -0800243static void __init reserve_rtb_memory(void)
244{
245#if defined(CONFIG_MSM_RTB)
Laura Abbottb93525f2012-04-12 09:57:19 -0700246 apq8064_reserve_table[MEMTYPE_EBI1].size += apq8064_rtb_pdata.size;
Laura Abbott350c8362012-02-28 14:46:52 -0800247#endif
248}
249
250
Kevin Chan13be4e22011-10-20 11:30:32 -0700251static void __init size_pmem_devices(void)
252{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800253#ifdef CONFIG_ANDROID_PMEM
254#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700255 android_pmem_adsp_pdata.size = pmem_adsp_size;
256 android_pmem_pdata.size = pmem_size;
257 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700258#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
259#endif /*CONFIG_ANDROID_PMEM*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700260}
261
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700262#ifdef CONFIG_ANDROID_PMEM
263#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700264static void __init reserve_memory_for(struct android_pmem_platform_data *p)
265{
266 apq8064_reserve_table[p->memory_type].size += p->size;
267}
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700268#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
269#endif /*CONFIG_ANDROID_PMEM*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700270
Kevin Chan13be4e22011-10-20 11:30:32 -0700271static void __init reserve_pmem_memory(void)
272{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800273#ifdef CONFIG_ANDROID_PMEM
274#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700275 reserve_memory_for(&android_pmem_adsp_pdata);
276 reserve_memory_for(&android_pmem_pdata);
277 reserve_memory_for(&android_pmem_audio_pdata);
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700278#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700279 apq8064_reserve_table[MEMTYPE_EBI1].size += msm_contig_mem_size;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700280#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -0800281}
282
283static int apq8064_paddr_to_memtype(unsigned int paddr)
284{
285 return MEMTYPE_EBI1;
286}
287
Steve Mucklef132c6c2012-06-06 18:30:57 -0700288#define FMEM_ENABLED 0
Larry Bassel67b921d2012-04-06 10:23:27 -0700289
Olav Haugan7c6aa742012-01-16 16:47:37 -0800290#ifdef CONFIG_ION_MSM
291#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -0700292static struct ion_cp_heap_pdata cp_mm_apq8064_ion_pdata = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800293 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugand3d29682012-01-19 10:57:07 -0800294 .align = PAGE_SIZE,
Larry Bassel67b921d2012-04-06 10:23:27 -0700295 .reusable = FMEM_ENABLED,
296 .mem_is_fmem = FMEM_ENABLED,
297 .fixed_position = FIXED_MIDDLE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800298};
299
Laura Abbottb93525f2012-04-12 09:57:19 -0700300static struct ion_cp_heap_pdata cp_mfc_apq8064_ion_pdata = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800301 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugand3d29682012-01-19 10:57:07 -0800302 .align = PAGE_SIZE,
Larry Bassel67b921d2012-04-06 10:23:27 -0700303 .reusable = 0,
304 .mem_is_fmem = FMEM_ENABLED,
305 .fixed_position = FIXED_HIGH,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800306};
307
Laura Abbottb93525f2012-04-12 09:57:19 -0700308static struct ion_co_heap_pdata co_apq8064_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800309 .adjacent_mem_id = INVALID_HEAP_ID,
310 .align = PAGE_SIZE,
Larry Bassel67b921d2012-04-06 10:23:27 -0700311 .mem_is_fmem = 0,
Olav Haugand3d29682012-01-19 10:57:07 -0800312};
313
Laura Abbottb93525f2012-04-12 09:57:19 -0700314static struct ion_co_heap_pdata fw_co_apq8064_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800315 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
316 .align = SZ_128K,
Larry Bassel67b921d2012-04-06 10:23:27 -0700317 .mem_is_fmem = FMEM_ENABLED,
318 .fixed_position = FIXED_LOW,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800319};
320#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800321
322/**
323 * These heaps are listed in the order they will be allocated. Due to
324 * video hardware restrictions and content protection the FW heap has to
325 * be allocated adjacent (below) the MM heap and the MFC heap has to be
326 * allocated after the MM heap to ensure MFC heap is not more than 256MB
327 * away from the base address of the FW heap.
328 * However, the order of FW heap and MM heap doesn't matter since these
329 * two heaps are taken care of by separate code to ensure they are adjacent
330 * to each other.
331 * Don't swap the order unless you know what you are doing!
332 */
Laura Abbottb93525f2012-04-12 09:57:19 -0700333static struct ion_platform_data apq8064_ion_pdata = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800334 .nr = MSM_ION_HEAP_NUM,
335 .heaps = {
336 {
337 .id = ION_SYSTEM_HEAP_ID,
338 .type = ION_HEAP_TYPE_SYSTEM,
339 .name = ION_VMALLOC_HEAP_NAME,
340 },
341#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
342 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800343 .id = ION_CP_MM_HEAP_ID,
344 .type = ION_HEAP_TYPE_CP,
345 .name = ION_MM_HEAP_NAME,
346 .size = MSM_ION_MM_SIZE,
347 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700348 .extra_data = (void *) &cp_mm_apq8064_ion_pdata,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800349 },
350 {
Olav Haugand3d29682012-01-19 10:57:07 -0800351 .id = ION_MM_FIRMWARE_HEAP_ID,
352 .type = ION_HEAP_TYPE_CARVEOUT,
353 .name = ION_MM_FIRMWARE_HEAP_NAME,
354 .size = MSM_ION_MM_FW_SIZE,
355 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700356 .extra_data = (void *) &fw_co_apq8064_ion_pdata,
Olav Haugand3d29682012-01-19 10:57:07 -0800357 },
358 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800359 .id = ION_CP_MFC_HEAP_ID,
360 .type = ION_HEAP_TYPE_CP,
361 .name = ION_MFC_HEAP_NAME,
362 .size = MSM_ION_MFC_SIZE,
363 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700364 .extra_data = (void *) &cp_mfc_apq8064_ion_pdata,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800365 },
Olav Haugan129992c2012-03-22 09:54:01 -0700366#ifndef CONFIG_MSM_IOMMU
Olav Haugan7c6aa742012-01-16 16:47:37 -0800367 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800368 .id = ION_SF_HEAP_ID,
369 .type = ION_HEAP_TYPE_CARVEOUT,
370 .name = ION_SF_HEAP_NAME,
371 .size = MSM_ION_SF_SIZE,
372 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700373 .extra_data = (void *) &co_apq8064_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800374 },
Olav Haugan129992c2012-03-22 09:54:01 -0700375#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800376 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800377 .id = ION_IOMMU_HEAP_ID,
378 .type = ION_HEAP_TYPE_IOMMU,
379 .name = ION_IOMMU_HEAP_NAME,
380 },
Olav Hauganf45e2142012-01-19 11:01:01 -0800381 {
382 .id = ION_QSECOM_HEAP_ID,
383 .type = ION_HEAP_TYPE_CARVEOUT,
384 .name = ION_QSECOM_HEAP_NAME,
385 .size = MSM_ION_QSECOM_SIZE,
386 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700387 .extra_data = (void *) &co_apq8064_ion_pdata,
Olav Hauganf45e2142012-01-19 11:01:01 -0800388 },
Olav Haugan2c43fac2012-01-19 11:06:37 -0800389 {
390 .id = ION_AUDIO_HEAP_ID,
391 .type = ION_HEAP_TYPE_CARVEOUT,
392 .name = ION_AUDIO_HEAP_NAME,
393 .size = MSM_ION_AUDIO_SIZE,
394 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700395 .extra_data = (void *) &co_apq8064_ion_pdata,
Olav Haugan2c43fac2012-01-19 11:06:37 -0800396 },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800397#endif
398 }
399};
400
Laura Abbottb93525f2012-04-12 09:57:19 -0700401static struct platform_device apq8064_ion_dev = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800402 .name = "ion-msm",
403 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700404 .dev = { .platform_data = &apq8064_ion_pdata },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800405};
406#endif
407
Larry Bassel67b921d2012-04-06 10:23:27 -0700408static struct platform_device apq8064_fmem_device = {
409 .name = "fmem",
410 .id = 1,
411 .dev = { .platform_data = &apq8064_fmem_pdata },
412};
413
414static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
415 unsigned long size)
416{
417 apq8064_reserve_table[mem_type].size += size;
418}
419
420static void __init apq8064_reserve_fixed_area(unsigned long fixed_area_size)
421{
422#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
423 int ret;
424
425 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
426 panic("fixed area size is larger than %dM\n",
427 MAX_FIXED_AREA_SIZE >> 20);
428
429 reserve_info->fixed_area_size = fixed_area_size;
430 reserve_info->fixed_area_start = APQ8064_FW_START;
431
432 ret = memblock_remove(reserve_info->fixed_area_start,
433 reserve_info->fixed_area_size);
434 BUG_ON(ret);
435#endif
436}
437
438/**
439 * Reserve memory for ION and calculate amount of reusable memory for fmem.
440 * We only reserve memory for heaps that are not reusable. However, we only
441 * support one reusable heap at the moment so we ignore the reusable flag for
442 * other than the first heap with reusable flag set. Also handle special case
443 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
444 * at a higher address than FW in addition to not more than 256MB away from the
445 * base address of the firmware. This means that if MM is reusable the other
446 * two heaps must be allocated in the same region as FW. This is handled by the
447 * mem_is_fmem flag in the platform data. In addition the MM heap must be
448 * adjacent to the FW heap for content protection purposes.
449 */
Stephen Boyd668d7652012-04-25 11:31:01 -0700450static void __init reserve_ion_memory(void)
Olav Haugan7c6aa742012-01-16 16:47:37 -0800451{
452#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Larry Bassel67b921d2012-04-06 10:23:27 -0700453 unsigned int i;
Larry Bassel67b921d2012-04-06 10:23:27 -0700454 unsigned int fixed_size = 0;
455 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
456 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
457
Larry Bassel67b921d2012-04-06 10:23:27 -0700458 fixed_low_size = 0;
459 fixed_middle_size = 0;
460 fixed_high_size = 0;
461
Larry Bassel67b921d2012-04-06 10:23:27 -0700462 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;
Larry Bassel67b921d2012-04-06 10:23:27 -0700468
Mitchel Humpherys362b52b2012-09-13 10:53:22 -0700469 switch ((int)heap->type) {
Larry Bassel67b921d2012-04-06 10:23:27 -0700470 case ION_HEAP_TYPE_CP:
Larry Bassel67b921d2012-04-06 10:23:27 -0700471 fixed_position = ((struct ion_cp_heap_pdata *)
472 heap->extra_data)->fixed_position;
473 break;
474 case ION_HEAP_TYPE_CARVEOUT:
Larry Bassel67b921d2012-04-06 10:23:27 -0700475 fixed_position = ((struct ion_co_heap_pdata *)
476 heap->extra_data)->fixed_position;
477 break;
478 default:
479 break;
480 }
481
482 if (fixed_position != NOT_FIXED)
483 fixed_size += heap->size;
484 else
485 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
486
487 if (fixed_position == FIXED_LOW)
488 fixed_low_size += heap->size;
489 else if (fixed_position == FIXED_MIDDLE)
490 fixed_middle_size += heap->size;
491 else if (fixed_position == FIXED_HIGH)
492 fixed_high_size += heap->size;
Larry Bassel67b921d2012-04-06 10:23:27 -0700493 }
494 }
495
496 if (!fixed_size)
497 return;
498
Larry Bassel67b921d2012-04-06 10:23:27 -0700499 /* Since the fixed area may be carved out of lowmem,
500 * make sure the length is a multiple of 1M.
501 */
Hanumant Singheadb7502012-05-15 18:14:04 -0700502 fixed_size = (fixed_size + HOLE_SIZE + SECTION_SIZE - 1)
Larry Bassel67b921d2012-04-06 10:23:27 -0700503 & SECTION_MASK;
504 apq8064_reserve_fixed_area(fixed_size);
505
506 fixed_low_start = APQ8064_FIXED_AREA_START;
Hanumant Singheadb7502012-05-15 18:14:04 -0700507 fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE;
Larry Bassel67b921d2012-04-06 10:23:27 -0700508 fixed_high_start = fixed_middle_start + fixed_middle_size;
509
510 for (i = 0; i < apq8064_ion_pdata.nr; ++i) {
511 struct ion_platform_heap *heap = &(apq8064_ion_pdata.heaps[i]);
512
513 if (heap->extra_data) {
514 int fixed_position = NOT_FIXED;
Steve Mucklef132c6c2012-06-06 18:30:57 -0700515 struct ion_cp_heap_pdata *pdata = NULL;
Larry Bassel67b921d2012-04-06 10:23:27 -0700516
Mitchel Humpherys362b52b2012-09-13 10:53:22 -0700517 switch ((int) heap->type) {
Larry Bassel67b921d2012-04-06 10:23:27 -0700518 case ION_HEAP_TYPE_CP:
Hanumant Singheadb7502012-05-15 18:14:04 -0700519 pdata =
520 (struct ion_cp_heap_pdata *)heap->extra_data;
521 fixed_position = pdata->fixed_position;
Larry Bassel67b921d2012-04-06 10:23:27 -0700522 break;
523 case ION_HEAP_TYPE_CARVEOUT:
524 fixed_position = ((struct ion_co_heap_pdata *)
525 heap->extra_data)->fixed_position;
526 break;
527 default:
528 break;
529 }
530
531 switch (fixed_position) {
532 case FIXED_LOW:
533 heap->base = fixed_low_start;
534 break;
535 case FIXED_MIDDLE:
536 heap->base = fixed_middle_start;
Hanumant Singheadb7502012-05-15 18:14:04 -0700537 pdata->secure_base = fixed_middle_start
538 - HOLE_SIZE;
539 pdata->secure_size = HOLE_SIZE + heap->size;
Larry Bassel67b921d2012-04-06 10:23:27 -0700540 break;
541 case FIXED_HIGH:
542 heap->base = fixed_high_start;
543 break;
544 default:
545 break;
546 }
547 }
548 }
Olav Haugan7c6aa742012-01-16 16:47:37 -0800549#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700550}
551
Huaibin Yang4a084e32011-12-15 15:25:52 -0800552static void __init reserve_mdp_memory(void)
553{
554 apq8064_mdp_writeback(apq8064_reserve_table);
555}
556
Laura Abbott93a4a352012-05-25 09:26:35 -0700557static void __init reserve_cache_dump_memory(void)
558{
559#ifdef CONFIG_MSM_CACHE_DUMP
560 unsigned int total;
561
562 total = apq8064_cache_dump_pdata.l1_size +
563 apq8064_cache_dump_pdata.l2_size;
564 apq8064_reserve_table[MEMTYPE_EBI1].size += total;
565#endif
566}
567
Abhijeet Dharmapurikardca26f72012-09-13 11:02:03 -0700568static void __init reserve_mpdcvs_memory(void)
569{
570 apq8064_reserve_table[MEMTYPE_EBI1].size += SZ_32K;
571}
572
Kevin Chan13be4e22011-10-20 11:30:32 -0700573static void __init apq8064_calculate_reserve_sizes(void)
574{
575 size_pmem_devices();
576 reserve_pmem_memory();
Olav Haugan7c6aa742012-01-16 16:47:37 -0800577 reserve_ion_memory();
Huaibin Yang4a084e32011-12-15 15:25:52 -0800578 reserve_mdp_memory();
Laura Abbott350c8362012-02-28 14:46:52 -0800579 reserve_rtb_memory();
Laura Abbott93a4a352012-05-25 09:26:35 -0700580 reserve_cache_dump_memory();
Abhijeet Dharmapurikardca26f72012-09-13 11:02:03 -0700581 reserve_mpdcvs_memory();
Kevin Chan13be4e22011-10-20 11:30:32 -0700582}
583
584static struct reserve_info apq8064_reserve_info __initdata = {
585 .memtype_reserve_table = apq8064_reserve_table,
586 .calculate_reserve_sizes = apq8064_calculate_reserve_sizes,
Larry Bassel67b921d2012-04-06 10:23:27 -0700587 .reserve_fixed_area = apq8064_reserve_fixed_area,
Kevin Chan13be4e22011-10-20 11:30:32 -0700588 .paddr_to_memtype = apq8064_paddr_to_memtype,
589};
590
591static int apq8064_memory_bank_size(void)
592{
593 return 1<<29;
594}
595
596static void __init locate_unstable_memory(void)
597{
598 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
599 unsigned long bank_size;
600 unsigned long low, high;
601
602 bank_size = apq8064_memory_bank_size();
603 low = meminfo.bank[0].start;
604 high = mb->start + mb->size;
Olav Haugand76e3a82012-01-16 16:55:07 -0800605
606 /* Check if 32 bit overflow occured */
607 if (high < mb->start)
Larry Bassel67b921d2012-04-06 10:23:27 -0700608 high = -PAGE_SIZE;
Olav Haugand76e3a82012-01-16 16:55:07 -0800609
Kevin Chan13be4e22011-10-20 11:30:32 -0700610 low &= ~(bank_size - 1);
611
612 if (high - low <= bank_size)
Larry Bassel67b921d2012-04-06 10:23:27 -0700613 goto no_dmm;
614
615#ifdef CONFIG_ENABLE_DMM
Jack Cheung46bfffa2012-01-19 15:26:24 -0800616 apq8064_reserve_info.low_unstable_address = mb->start -
617 MIN_MEMORY_BLOCK_SIZE + mb->size;
618 apq8064_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
619
Kevin Chan13be4e22011-10-20 11:30:32 -0700620 apq8064_reserve_info.bank_size = bank_size;
621 pr_info("low unstable address %lx max size %lx bank size %lx\n",
622 apq8064_reserve_info.low_unstable_address,
623 apq8064_reserve_info.max_unstable_size,
624 apq8064_reserve_info.bank_size);
Larry Bassel67b921d2012-04-06 10:23:27 -0700625 return;
626#endif
627no_dmm:
628 apq8064_reserve_info.low_unstable_address = high;
629 apq8064_reserve_info.max_unstable_size = 0;
Kevin Chan13be4e22011-10-20 11:30:32 -0700630}
631
Hanumant Singh50440d42012-04-23 19:27:16 -0700632static int apq8064_change_memory_power(u64 start, u64 size,
633 int change_type)
634{
635 return soc_change_memory_power(start, size, change_type);
636}
637
Aravind Venkateswaran8ac7f412012-03-16 17:57:30 -0700638static char prim_panel_name[PANEL_NAME_MAX_LEN];
639static char ext_panel_name[PANEL_NAME_MAX_LEN];
Ajay Singh Parmar6b82d2b2012-07-19 17:23:26 +0530640
641static int ext_resolution;
642
Aravind Venkateswaran8ac7f412012-03-16 17:57:30 -0700643static int __init prim_display_setup(char *param)
644{
645 if (strnlen(param, PANEL_NAME_MAX_LEN))
646 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
647 return 0;
648}
649early_param("prim_display", prim_display_setup);
650
651static int __init ext_display_setup(char *param)
652{
653 if (strnlen(param, PANEL_NAME_MAX_LEN))
654 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
655 return 0;
656}
657early_param("ext_display", ext_display_setup);
658
Ajay Singh Parmar6b82d2b2012-07-19 17:23:26 +0530659static int __init hdmi_resulution_setup(char *param)
660{
661 int ret;
662 ret = kstrtoint(param, 10, &ext_resolution);
663 return ret;
664}
665early_param("ext_resolution", hdmi_resulution_setup);
666
Kevin Chan13be4e22011-10-20 11:30:32 -0700667static void __init apq8064_reserve(void)
668{
Ajay Singh Parmar6b82d2b2012-07-19 17:23:26 +0530669 apq8064_set_display_params(prim_panel_name, ext_panel_name,
670 ext_resolution);
Kevin Chan13be4e22011-10-20 11:30:32 -0700671 msm_reserve();
672}
673
Laura Abbott6988cef2012-03-15 14:27:13 -0700674static void __init place_movable_zone(void)
675{
Larry Bassel67b921d2012-04-06 10:23:27 -0700676#ifdef CONFIG_ENABLE_DMM
Laura Abbott6988cef2012-03-15 14:27:13 -0700677 movable_reserved_start = apq8064_reserve_info.low_unstable_address;
678 movable_reserved_size = apq8064_reserve_info.max_unstable_size;
679 pr_info("movable zone start %lx size %lx\n",
680 movable_reserved_start, movable_reserved_size);
Larry Bassel67b921d2012-04-06 10:23:27 -0700681#endif
Laura Abbott6988cef2012-03-15 14:27:13 -0700682}
683
684static void __init apq8064_early_reserve(void)
685{
686 reserve_info = &apq8064_reserve_info;
687 locate_unstable_memory();
688 place_movable_zone();
689
690}
Hemant Kumara945b472012-01-25 15:08:06 -0800691#ifdef CONFIG_USB_EHCI_MSM_HSIC
Hemant Kumare6275972012-02-29 20:06:21 -0800692/* Bandwidth requests (zero) if no vote placed */
693static struct msm_bus_vectors hsic_init_vectors[] = {
694 {
695 .src = MSM_BUS_MASTER_SPS,
696 .dst = MSM_BUS_SLAVE_EBI_CH0,
697 .ab = 0,
698 .ib = 0,
699 },
700 {
701 .src = MSM_BUS_MASTER_SPS,
702 .dst = MSM_BUS_SLAVE_SPS,
703 .ab = 0,
704 .ib = 0,
705 },
706};
707
708/* Bus bandwidth requests in Bytes/sec */
709static struct msm_bus_vectors hsic_max_vectors[] = {
710 {
711 .src = MSM_BUS_MASTER_SPS,
712 .dst = MSM_BUS_SLAVE_EBI_CH0,
713 .ab = 60000000, /* At least 480Mbps on bus. */
714 .ib = 960000000, /* MAX bursts rate */
715 },
716 {
717 .src = MSM_BUS_MASTER_SPS,
718 .dst = MSM_BUS_SLAVE_SPS,
719 .ab = 0,
720 .ib = 512000000, /*vote for 64Mhz dfab clk rate*/
721 },
722};
723
724static struct msm_bus_paths hsic_bus_scale_usecases[] = {
725 {
726 ARRAY_SIZE(hsic_init_vectors),
727 hsic_init_vectors,
728 },
729 {
730 ARRAY_SIZE(hsic_max_vectors),
731 hsic_max_vectors,
732 },
733};
734
735static struct msm_bus_scale_pdata hsic_bus_scale_pdata = {
736 hsic_bus_scale_usecases,
737 ARRAY_SIZE(hsic_bus_scale_usecases),
738 .name = "hsic",
739};
740
Hemant Kumara945b472012-01-25 15:08:06 -0800741static struct msm_hsic_host_platform_data msm_hsic_pdata = {
Hemant Kumare6275972012-02-29 20:06:21 -0800742 .strobe = 88,
743 .data = 89,
744 .bus_scale_table = &hsic_bus_scale_pdata,
Hemant Kumara945b472012-01-25 15:08:06 -0800745};
746#else
747static struct msm_hsic_host_platform_data msm_hsic_pdata;
748#endif
749
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800750#define PID_MAGIC_ID 0x71432909
751#define SERIAL_NUM_MAGIC_ID 0x61945374
752#define SERIAL_NUMBER_LENGTH 127
753#define DLOAD_USB_BASE_ADD 0x2A03F0C8
754
755struct magic_num_struct {
756 uint32_t pid;
757 uint32_t serial_num;
758};
759
760struct dload_struct {
761 uint32_t reserved1;
762 uint32_t reserved2;
763 uint32_t reserved3;
764 uint16_t reserved4;
765 uint16_t pid;
766 char serial_number[SERIAL_NUMBER_LENGTH];
767 uint16_t reserved5;
768 struct magic_num_struct magic_struct;
769};
770
771static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
772{
773 struct dload_struct __iomem *dload = 0;
774
775 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
776 if (!dload) {
777 pr_err("%s: cannot remap I/O memory region: %08x\n",
778 __func__, DLOAD_USB_BASE_ADD);
779 return -ENXIO;
780 }
781
782 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
783 __func__, dload, pid, snum);
784 /* update pid */
785 dload->magic_struct.pid = PID_MAGIC_ID;
786 dload->pid = pid;
787
788 /* update serial number */
789 dload->magic_struct.serial_num = 0;
790 if (!snum) {
791 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
792 goto out;
793 }
794
795 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
796 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
797out:
798 iounmap(dload);
799 return 0;
800}
801
802static struct android_usb_platform_data android_usb_pdata = {
803 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
804};
805
Hemant Kumar4933b072011-10-17 23:43:11 -0700806static struct platform_device android_usb_device = {
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800807 .name = "android_usb",
808 .id = -1,
809 .dev = {
810 .platform_data = &android_usb_pdata,
811 },
Hemant Kumar4933b072011-10-17 23:43:11 -0700812};
813
Hemant Kumar7620eed2012-02-26 09:08:43 -0800814/* Bandwidth requests (zero) if no vote placed */
815static struct msm_bus_vectors usb_init_vectors[] = {
816 {
817 .src = MSM_BUS_MASTER_SPS,
818 .dst = MSM_BUS_SLAVE_EBI_CH0,
819 .ab = 0,
820 .ib = 0,
821 },
822};
823
824/* Bus bandwidth requests in Bytes/sec */
825static struct msm_bus_vectors usb_max_vectors[] = {
826 {
827 .src = MSM_BUS_MASTER_SPS,
828 .dst = MSM_BUS_SLAVE_EBI_CH0,
829 .ab = 60000000, /* At least 480Mbps on bus. */
830 .ib = 960000000, /* MAX bursts rate */
831 },
832};
833
834static struct msm_bus_paths usb_bus_scale_usecases[] = {
835 {
836 ARRAY_SIZE(usb_init_vectors),
837 usb_init_vectors,
838 },
839 {
840 ARRAY_SIZE(usb_max_vectors),
841 usb_max_vectors,
842 },
843};
844
845static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
846 usb_bus_scale_usecases,
847 ARRAY_SIZE(usb_bus_scale_usecases),
848 .name = "usb",
849};
850
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700851static int phy_init_seq[] = {
Chiranjeevi Velempatif983aeb2012-08-23 08:16:50 +0530852 0x68, 0x81, /* update DC voltage level */
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700853 0x24, 0x82, /* set pre-emphasis and rise/fall time */
854 -1
855};
856
Vijayavardhan Vennapusa4fa13692012-08-02 14:35:03 +0530857#define PMIC_GPIO_DP 27 /* PMIC GPIO for D+ change */
858#define PMIC_GPIO_DP_IRQ PM8921_GPIO_IRQ(PM8921_IRQ_BASE, PMIC_GPIO_DP)
Jack Pham87f202f2012-08-06 00:24:22 -0700859#define MSM_MPM_PIN_USB1_OTGSESSVLD 40
860
Hemant Kumar4933b072011-10-17 23:43:11 -0700861static struct msm_otg_platform_data msm_otg_pdata = {
Hemant Kumard86c4882012-01-24 19:39:37 -0800862 .mode = USB_OTG,
863 .otg_control = OTG_PMIC_CONTROL,
Hemant Kumar4933b072011-10-17 23:43:11 -0700864 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Hemant Kumard86c4882012-01-24 19:39:37 -0800865 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
866 .power_budget = 750,
Hemant Kumar7620eed2012-02-26 09:08:43 -0800867 .bus_scale_table = &usb_bus_scale_pdata,
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700868 .phy_init_seq = phy_init_seq,
Jack Pham87f202f2012-08-06 00:24:22 -0700869 .mpm_otgsessvld_int = MSM_MPM_PIN_USB1_OTGSESSVLD,
Hemant Kumar4933b072011-10-17 23:43:11 -0700870};
871
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800872static struct msm_usb_host_platform_data msm_ehci_host_pdata3 = {
Manu Gautam91223e02011-11-08 15:27:22 +0530873 .power_budget = 500,
874};
875
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800876#ifdef CONFIG_USB_EHCI_MSM_HOST4
877static struct msm_usb_host_platform_data msm_ehci_host_pdata4;
878#endif
879
Manu Gautam91223e02011-11-08 15:27:22 +0530880static void __init apq8064_ehci_host_init(void)
881{
Chiranjeevi Velempatib822fa32012-05-23 22:05:59 +0530882 if (machine_is_apq8064_liquid() || machine_is_mpq8064_cdp() ||
Chiranjeevi Velempatidd4dbaa2012-10-05 16:22:04 +0530883 machine_is_mpq8064_hrd() || machine_is_mpq8064_dtv() ||
884 machine_is_apq8064_cdp()) {
Chiranjeevi Velempatib822fa32012-05-23 22:05:59 +0530885 if (machine_is_apq8064_liquid())
886 msm_ehci_host_pdata3.dock_connect_irq =
887 PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9);
Vijayavardhan Vennapusa4fa13692012-08-02 14:35:03 +0530888 else
889 msm_ehci_host_pdata3.pmic_gpio_dp_irq =
890 PMIC_GPIO_DP_IRQ;
Hemant Kumar56925352012-02-13 16:59:52 -0800891
Manu Gautam91223e02011-11-08 15:27:22 +0530892 apq8064_device_ehci_host3.dev.platform_data =
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800893 &msm_ehci_host_pdata3;
Manu Gautam91223e02011-11-08 15:27:22 +0530894 platform_device_register(&apq8064_device_ehci_host3);
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800895
896#ifdef CONFIG_USB_EHCI_MSM_HOST4
897 apq8064_device_ehci_host4.dev.platform_data =
898 &msm_ehci_host_pdata4;
899 platform_device_register(&apq8064_device_ehci_host4);
900#endif
Manu Gautam91223e02011-11-08 15:27:22 +0530901 }
902}
903
David Keitel2f613d92012-02-15 11:29:16 -0800904static struct smb349_platform_data smb349_data __initdata = {
905 .en_n_gpio = PM8921_GPIO_PM_TO_SYS(37),
906 .chg_susp_gpio = PM8921_GPIO_PM_TO_SYS(30),
907 .chg_current_ma = 2200,
908};
909
910static struct i2c_board_info smb349_charger_i2c_info[] __initdata = {
911 {
912 I2C_BOARD_INFO(SMB349_NAME, 0x1B),
913 .platform_data = &smb349_data,
914 },
915};
916
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -0800917struct sx150x_platform_data apq8064_sx150x_data[] = {
918 [SX150X_EPM] = {
919 .gpio_base = GPIO_EPM_EXPANDER_BASE,
920 .oscio_is_gpo = false,
921 .io_pullup_ena = 0x0,
922 .io_pulldn_ena = 0x0,
923 .io_open_drain_ena = 0x0,
924 .io_polarity = 0,
925 .irq_summary = -1,
926 },
927};
928
929static struct epm_chan_properties ads_adc_channel_data[] = {
Yan He44c59962012-08-31 11:14:58 -0700930 {10, 100}, {1000, 1}, {10, 100}, {1000, 1},
931 {10, 100}, {1000, 1}, {10, 100}, {1000, 1},
932 {10, 100}, {20, 100}, {500, 100}, {5, 100},
933 {1000, 1}, {200, 100}, {50, 100}, {10, 100},
934 {510, 100}, {50, 100}, {20, 100}, {100, 100},
935 {510, 100}, {20, 100}, {50, 100}, {200, 100},
936 {10, 100}, {20, 100}, {1000, 1}, {10, 100},
937 {200, 100}, {510, 100}, {1000, 100}, {200, 100},
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -0800938};
939
940static struct epm_adc_platform_data epm_adc_pdata = {
941 .channel = ads_adc_channel_data,
942 .bus_id = 0x0,
943 .epm_i2c_board_info = {
944 .type = "sx1509q",
945 .addr = 0x3e,
946 .platform_data = &apq8064_sx150x_data[SX150X_EPM],
947 },
948 .gpio_expander_base_addr = GPIO_EPM_EXPANDER_BASE,
949};
950
951static struct platform_device epm_adc_device = {
952 .name = "epm_adc",
953 .id = -1,
954 .dev = {
955 .platform_data = &epm_adc_pdata,
956 },
957};
958
959static void __init apq8064_epm_adc_init(void)
960{
961 epm_adc_pdata.num_channels = 32;
962 epm_adc_pdata.num_adc = 2;
963 epm_adc_pdata.chan_per_adc = 16;
964 epm_adc_pdata.chan_per_mux = 8;
965};
966
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800967/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
968 * 4 micbiases are used to power various analog and digital
969 * microphones operating at 1800 mV. Technically, all micbiases
970 * can source from single cfilter since all microphones operate
971 * at the same voltage level. The arrangement below is to make
972 * sure all cfilters are exercised. LDO_H regulator ouput level
973 * does not need to be as high as 2.85V. It is choosen for
974 * microphone sensitivity purpose.
975 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530976static struct wcd9xxx_pdata apq8064_tabla_platform_data = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800977 .slimbus_slave_device = {
978 .name = "tabla-slave",
979 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
980 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800981 .irq = MSM_GPIO_TO_INT(42),
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800982 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530983 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800984 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
985 .micbias = {
986 .ldoh_v = TABLA_LDOH_2P85_V,
987 .cfilt1_mv = 1800,
Bhalchandra Gajare975c53a2012-08-10 12:16:49 -0700988 .cfilt2_mv = 2700,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800989 .cfilt3_mv = 1800,
990 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
991 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
992 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
993 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530994 },
995 .regulator = {
996 {
997 .name = "CDC_VDD_CP",
998 .min_uV = 1800000,
999 .max_uV = 1800000,
1000 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
1001 },
1002 {
1003 .name = "CDC_VDDA_RX",
1004 .min_uV = 1800000,
1005 .max_uV = 1800000,
1006 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
1007 },
1008 {
1009 .name = "CDC_VDDA_TX",
1010 .min_uV = 1800000,
1011 .max_uV = 1800000,
1012 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
1013 },
1014 {
1015 .name = "VDDIO_CDC",
1016 .min_uV = 1800000,
1017 .max_uV = 1800000,
1018 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1019 },
1020 {
1021 .name = "VDDD_CDC_D",
1022 .min_uV = 1225000,
David Collins62debe82012-06-06 17:01:03 -07001023 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301024 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1025 },
1026 {
1027 .name = "CDC_VDDA_A_1P2V",
1028 .min_uV = 1225000,
David Collins62debe82012-06-06 17:01:03 -07001029 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301030 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1031 },
1032 },
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001033};
1034
1035static struct slim_device apq8064_slim_tabla = {
1036 .name = "tabla-slim",
1037 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
1038 .dev = {
1039 .platform_data = &apq8064_tabla_platform_data,
1040 },
1041};
1042
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301043static struct wcd9xxx_pdata apq8064_tabla20_platform_data = {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001044 .slimbus_slave_device = {
1045 .name = "tabla-slave",
1046 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
1047 },
1048 .irq = MSM_GPIO_TO_INT(42),
1049 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301050 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001051 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
1052 .micbias = {
1053 .ldoh_v = TABLA_LDOH_2P85_V,
1054 .cfilt1_mv = 1800,
Bhalchandra Gajare975c53a2012-08-10 12:16:49 -07001055 .cfilt2_mv = 2700,
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001056 .cfilt3_mv = 1800,
1057 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
1058 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
1059 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
1060 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301061 },
1062 .regulator = {
1063 {
1064 .name = "CDC_VDD_CP",
1065 .min_uV = 1800000,
1066 .max_uV = 1800000,
1067 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
1068 },
1069 {
1070 .name = "CDC_VDDA_RX",
1071 .min_uV = 1800000,
1072 .max_uV = 1800000,
1073 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
1074 },
1075 {
1076 .name = "CDC_VDDA_TX",
1077 .min_uV = 1800000,
1078 .max_uV = 1800000,
1079 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
1080 },
1081 {
1082 .name = "VDDIO_CDC",
1083 .min_uV = 1800000,
1084 .max_uV = 1800000,
1085 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1086 },
1087 {
1088 .name = "VDDD_CDC_D",
1089 .min_uV = 1225000,
David Collins62debe82012-06-06 17:01:03 -07001090 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301091 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1092 },
1093 {
1094 .name = "CDC_VDDA_A_1P2V",
1095 .min_uV = 1225000,
David Collins62debe82012-06-06 17:01:03 -07001096 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301097 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1098 },
1099 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001100};
1101
1102static struct slim_device apq8064_slim_tabla20 = {
1103 .name = "tabla2x-slim",
1104 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
1105 .dev = {
1106 .platform_data = &apq8064_tabla20_platform_data,
1107 },
1108};
1109
Kuirong Wangf8c5e142012-06-21 16:17:32 -07001110static struct wcd9xxx_pdata apq8064_tabla_i2c_platform_data = {
1111 .irq = MSM_GPIO_TO_INT(77),
1112 .irq_base = TABLA_INTERRUPT_BASE,
1113 .num_irqs = NR_WCD9XXX_IRQS,
1114 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
1115 .micbias = {
1116 .ldoh_v = TABLA_LDOH_2P85_V,
1117 .cfilt1_mv = 1800,
1118 .cfilt2_mv = 1800,
1119 .cfilt3_mv = 1800,
1120 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
1121 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
1122 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
1123 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
1124 },
1125 .regulator = {
1126 {
1127 .name = "CDC_VDD_CP",
1128 .min_uV = 1800000,
1129 .max_uV = 1800000,
1130 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
1131 },
1132 {
1133 .name = "CDC_VDDA_RX",
1134 .min_uV = 1800000,
1135 .max_uV = 1800000,
1136 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
1137 },
1138 {
1139 .name = "CDC_VDDA_TX",
1140 .min_uV = 1800000,
1141 .max_uV = 1800000,
1142 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
1143 },
1144 {
1145 .name = "VDDIO_CDC",
1146 .min_uV = 1800000,
1147 .max_uV = 1800000,
1148 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1149 },
1150 {
1151 .name = "VDDD_CDC_D",
1152 .min_uV = 1225000,
1153 .max_uV = 1250000,
1154 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1155 },
1156 {
1157 .name = "CDC_VDDA_A_1P2V",
1158 .min_uV = 1225000,
1159 .max_uV = 1250000,
1160 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1161 },
1162 },
1163};
1164
1165static struct i2c_board_info apq8064_tabla_i2c_device_info[] __initdata = {
1166 {
1167 I2C_BOARD_INFO("tabla top level",
1168 APQ_8064_TABLA_I2C_SLAVE_ADDR),
1169 .platform_data = &apq8064_tabla_i2c_platform_data,
1170 },
1171 {
1172 I2C_BOARD_INFO("tabla analog",
1173 APQ_8064_TABLA_ANALOG_I2C_SLAVE_ADDR),
1174 .platform_data = &apq8064_tabla_i2c_platform_data,
1175 },
1176 {
1177 I2C_BOARD_INFO("tabla digital1",
1178 APQ_8064_TABLA_DIGITAL1_I2C_SLAVE_ADDR),
1179 .platform_data = &apq8064_tabla_i2c_platform_data,
1180 },
1181 {
1182 I2C_BOARD_INFO("tabla digital2",
1183 APQ_8064_TABLA_DIGITAL2_I2C_SLAVE_ADDR),
1184 .platform_data = &apq8064_tabla_i2c_platform_data,
1185 },
1186};
1187
Santosh Mardi344455a2012-09-07 13:22:16 +05301188static struct wcd9xxx_pdata mpq8064_ashiko20_platform_data = {
1189 .slimbus_slave_device = {
1190 .name = "tabla-slave",
1191 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
1192 },
1193 .irq = MSM_GPIO_TO_INT(42),
1194 .irq_base = TABLA_INTERRUPT_BASE,
1195 .num_irqs = NR_WCD9XXX_IRQS,
1196 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
1197 .micbias = {
1198 .ldoh_v = TABLA_LDOH_2P85_V,
1199 .cfilt1_mv = 1800,
1200 .cfilt2_mv = 1800,
1201 .cfilt3_mv = 1800,
1202 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
1203 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
1204 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
1205 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
1206 },
1207 .regulator = {
1208 {
1209 .name = "CDC_VDD_CP",
1210 .min_uV = 1800000,
1211 .max_uV = 1800000,
1212 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
1213 },
1214 {
1215 .name = "CDC_VDDA_RX",
1216 .min_uV = 1800000,
1217 .max_uV = 1800000,
1218 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
1219 },
1220 {
1221 .name = "CDC_VDDA_TX",
1222 .min_uV = 1800000,
1223 .max_uV = 1800000,
1224 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
1225 },
1226 {
1227 .name = "VDDIO_CDC",
1228 .min_uV = 1800000,
1229 .max_uV = 1800000,
1230 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1231 },
1232 {
1233 .name = "HRD_VDDD_CDC_D",
1234 .min_uV = 1200000,
1235 .max_uV = 1200000,
1236 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1237 },
1238 {
1239 .name = "HRD_CDC_VDDA_A_1P2V",
1240 .min_uV = 1200000,
1241 .max_uV = 1200000,
1242 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1243 },
1244 },
1245};
1246
1247static struct slim_device mpq8064_slim_ashiko20 = {
1248 .name = "tabla2x-slim",
1249 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
1250 .dev = {
1251 .platform_data = &mpq8064_ashiko20_platform_data,
1252 },
1253};
1254
1255
Santosh Mardi695be0d2012-04-10 23:21:12 +05301256/* enable the level shifter for cs8427 to make sure the I2C
1257 * clock is running at 100KHz and voltage levels are at 3.3
1258 * and 5 volts
1259 */
Aviral Gupta6bb723f2012-11-06 22:27:17 +05301260static int enable_100KHz_ls(int enable, int gpio)
Santosh Mardi695be0d2012-04-10 23:21:12 +05301261{
Aviral Gupta6bb723f2012-11-06 22:27:17 +05301262 if (enable)
1263 gpio_direction_output(gpio, 1);
1264 else
1265 gpio_direction_output(gpio, 0);
1266 return 0;
Santosh Mardi695be0d2012-04-10 23:21:12 +05301267}
1268
Santosh Mardieff9a742012-04-09 23:23:39 +05301269static struct cs8427_platform_data cs8427_i2c_platform_data = {
1270 .irq = SX150X_GPIO(1, 4),
1271 .reset_gpio = SX150X_GPIO(1, 6),
Santosh Mardi695be0d2012-04-10 23:21:12 +05301272 .enable = enable_100KHz_ls,
Aviral Gupta6bb723f2012-11-06 22:27:17 +05301273 .ls_gpio = SX150X_GPIO(1, 10),
Santosh Mardieff9a742012-04-09 23:23:39 +05301274};
1275
1276static struct i2c_board_info cs8427_device_info[] __initdata = {
1277 {
1278 I2C_BOARD_INFO("cs8427", CS8427_ADDR4),
1279 .platform_data = &cs8427_i2c_platform_data,
1280 },
1281};
1282
Amy Maloche70090f992012-02-16 16:35:26 -08001283#define HAP_SHIFT_LVL_OE_GPIO PM8921_MPP_PM_TO_SYS(8)
1284#define ISA1200_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1285#define ISA1200_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
David Collinsd49a1c52012-08-22 13:18:06 -07001286#define ISA1200_HAP_CLK_PM8921 PM8921_GPIO_PM_TO_SYS(44)
1287#define ISA1200_HAP_CLK_PM8917 PM8921_GPIO_PM_TO_SYS(38)
Amy Maloche70090f992012-02-16 16:35:26 -08001288
Mohan Pallaka2d877602012-05-11 13:07:30 +05301289static int isa1200_clk_enable(bool on)
Amy Maloche70090f992012-02-16 16:35:26 -08001290{
David Collinsd49a1c52012-08-22 13:18:06 -07001291 unsigned int gpio = ISA1200_HAP_CLK_PM8921;
Amy Maloche8f973892012-03-26 14:53:13 -07001292 int rc = 0;
1293
David Collinsd49a1c52012-08-22 13:18:06 -07001294 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
1295 gpio = ISA1200_HAP_CLK_PM8917;
1296
1297 gpio_set_value_cansleep(gpio, on);
Amy Maloche70090f992012-02-16 16:35:26 -08001298
Mohan Pallaka2d877602012-05-11 13:07:30 +05301299 if (on) {
Amy Maloche8f973892012-03-26 14:53:13 -07001300 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_1, true);
Mohan Pallaka2d877602012-05-11 13:07:30 +05301301 if (rc) {
1302 pr_err("%s: unable to write aux clock register(%d)\n",
1303 __func__, rc);
1304 goto err_gpio_dis;
1305 }
1306 } else {
Amy Maloche8f973892012-03-26 14:53:13 -07001307 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_NONE, true);
Mohan Pallaka2d877602012-05-11 13:07:30 +05301308 if (rc)
1309 pr_err("%s: unable to write aux clock register(%d)\n",
1310 __func__, rc);
Amy Maloche8f973892012-03-26 14:53:13 -07001311 }
1312
1313 return rc;
Mohan Pallaka2d877602012-05-11 13:07:30 +05301314
1315err_gpio_dis:
David Collinsd49a1c52012-08-22 13:18:06 -07001316 gpio_set_value_cansleep(gpio, !on);
Mohan Pallaka2d877602012-05-11 13:07:30 +05301317 return rc;
Amy Maloche70090f992012-02-16 16:35:26 -08001318}
1319
1320static int isa1200_dev_setup(bool enable)
1321{
David Collinsd49a1c52012-08-22 13:18:06 -07001322 unsigned int gpio = ISA1200_HAP_CLK_PM8921;
Amy Maloche70090f992012-02-16 16:35:26 -08001323 int rc = 0;
1324
David Collinsd49a1c52012-08-22 13:18:06 -07001325 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
1326 gpio = ISA1200_HAP_CLK_PM8917;
1327
Amy Maloche70090f992012-02-16 16:35:26 -08001328 if (!enable)
1329 goto free_gpio;
1330
David Collinsd49a1c52012-08-22 13:18:06 -07001331 rc = gpio_request(gpio, "haptics_clk");
Amy Maloche70090f992012-02-16 16:35:26 -08001332 if (rc) {
1333 pr_err("%s: unable to request gpio %d config(%d)\n",
David Collinsd49a1c52012-08-22 13:18:06 -07001334 __func__, gpio, rc);
Amy Maloche70090f992012-02-16 16:35:26 -08001335 return rc;
1336 }
1337
David Collinsd49a1c52012-08-22 13:18:06 -07001338 rc = gpio_direction_output(gpio, 0);
Amy Maloche70090f992012-02-16 16:35:26 -08001339 if (rc) {
1340 pr_err("%s: unable to set direction\n", __func__);
1341 goto free_gpio;
1342 }
1343
1344 return 0;
1345
1346free_gpio:
David Collinsd49a1c52012-08-22 13:18:06 -07001347 gpio_free(gpio);
Amy Maloche70090f992012-02-16 16:35:26 -08001348 return rc;
1349}
1350
1351static struct isa1200_regulator isa1200_reg_data[] = {
1352 {
1353 .name = "vddp",
1354 .min_uV = ISA_I2C_VTG_MIN_UV,
1355 .max_uV = ISA_I2C_VTG_MAX_UV,
1356 .load_uA = ISA_I2C_CURR_UA,
1357 },
1358};
1359
1360static struct isa1200_platform_data isa1200_1_pdata = {
1361 .name = "vibrator",
1362 .dev_setup = isa1200_dev_setup,
Mohan Pallaka2d877602012-05-11 13:07:30 +05301363 .clk_enable = isa1200_clk_enable,
Mohan Pallaka32f20a72012-06-14 14:41:11 +05301364 .need_pwm_clk = true,
Amy Maloche70090f992012-02-16 16:35:26 -08001365 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
1366 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
1367 .max_timeout = 15000,
1368 .mode_ctrl = PWM_GEN_MODE,
1369 .pwm_fd = {
1370 .pwm_div = 256,
1371 },
1372 .is_erm = false,
1373 .smart_en = true,
1374 .ext_clk_en = true,
1375 .chip_en = 1,
1376 .regulator_info = isa1200_reg_data,
1377 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1378};
1379
1380static struct i2c_board_info isa1200_board_info[] __initdata = {
1381 {
1382 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1383 .platform_data = &isa1200_1_pdata,
1384 },
1385};
Jing Lin21ed4de2012-02-05 15:53:28 -08001386/* configuration data for mxt1386e using V2.1 firmware */
1387static const u8 mxt1386e_config_data_v2_1[] = {
1388 /* T6 Object */
1389 0, 0, 0, 0, 0, 0,
1390 /* T38 Object */
Jing Linc6a55cfc2012-08-31 10:54:44 -07001391 14, 3, 0, 5, 7, 12, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001392 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1393 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1394 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1395 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1396 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1397 0, 0, 0, 0,
1398 /* T7 Object */
Jing Linc6a55cfc2012-08-31 10:54:44 -07001399 32, 10, 50,
Jing Lin21ed4de2012-02-05 15:53:28 -08001400 /* T8 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001401 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001402 /* T9 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001403 139, 0, 0, 26, 42, 0, 32, 80, 2, 5,
Jing Linc6a55cfc2012-08-31 10:54:44 -07001404 0, 5, 5, 79, 10, 30, 10, 10, 255, 2,
Jing Linf1208fd2012-02-23 11:15:42 -08001405 85, 5, 0, 5, 9, 5, 12, 35, 70, 40,
1406 20, 5, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001407 /* T18 Object */
1408 0, 0,
1409 /* T24 Object */
1410 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1411 0, 0, 0, 0, 0, 0, 0, 0, 0,
1412 /* T25 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001413 1, 0, 60, 115, 156, 99,
Jing Lin21ed4de2012-02-05 15:53:28 -08001414 /* T27 Object */
1415 0, 0, 0, 0, 0, 0, 0,
1416 /* T40 Object */
1417 0, 0, 0, 0, 0,
1418 /* T42 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001419 0, 0, 255, 0, 255, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001420 /* T43 Object */
1421 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
1422 16,
1423 /* T46 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001424 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001425 /* T47 Object */
1426 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
1427 /* T48 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001428 1, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001429 32, 40, 0, 10, 10, 0, 0, 100, 10, 90,
1430 0, 0, 0, 0, 0, 0, 0, 10, 1, 10,
1431 52, 10, 12, 0, 33, 0, 1, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001432 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1433 0, 0, 0, 0,
1434 /* T56 Object */
1435 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1436 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1437 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1438 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001439 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1440 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001441};
1442
1443#define MXT_TS_GPIO_IRQ 6
1444#define MXT_TS_PWR_EN_GPIO PM8921_GPIO_PM_TO_SYS(23)
1445#define MXT_TS_RESET_GPIO 33
1446
1447static struct mxt_config_info mxt_config_array[] = {
1448 {
1449 .config = mxt1386e_config_data_v2_1,
1450 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1451 .family_id = 0xA0,
1452 .variant_id = 0x7,
1453 .version = 0x21,
1454 .build = 0xAA,
Jing Linef4aa9b2012-03-26 12:01:41 -07001455 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
1456 .fw_name = "atmel_8064_liquid_v2_2_AA.hex",
1457 },
1458 {
1459 /* The config data for V2.2.AA is the same as for V2.1.AA */
1460 .config = mxt1386e_config_data_v2_1,
1461 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1462 .family_id = 0xA0,
1463 .variant_id = 0x7,
1464 .version = 0x22,
1465 .build = 0xAA,
1466 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin21ed4de2012-02-05 15:53:28 -08001467 },
1468};
1469
1470static struct mxt_platform_data mxt_platform_data = {
1471 .config_array = mxt_config_array,
1472 .config_array_size = ARRAY_SIZE(mxt_config_array),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08001473 .panel_minx = 0,
1474 .panel_maxx = 1365,
1475 .panel_miny = 0,
1476 .panel_maxy = 767,
1477 .disp_minx = 0,
1478 .disp_maxx = 1365,
1479 .disp_miny = 0,
1480 .disp_maxy = 767,
Anirudh Ghayal39dbe3f2012-04-13 15:43:16 +05301481 .irqflags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
Jing Lin21ed4de2012-02-05 15:53:28 -08001482 .i2c_pull_up = true,
1483 .reset_gpio = MXT_TS_RESET_GPIO,
1484 .irq_gpio = MXT_TS_GPIO_IRQ,
1485};
1486
1487static struct i2c_board_info mxt_device_info[] __initdata = {
1488 {
1489 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
1490 .platform_data = &mxt_platform_data,
1491 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1492 },
1493};
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001494#define CYTTSP_TS_GPIO_IRQ 6
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001495#define CYTTSP_TS_GPIO_SLEEP 33
Amy Maloche609bb5e2012-08-03 09:41:42 -07001496#define CYTTSP_TS_GPIO_SLEEP_ALT 12
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001497
1498static ssize_t tma340_vkeys_show(struct kobject *kobj,
1499 struct kobj_attribute *attr, char *buf)
1500{
1501 return snprintf(buf, 200,
1502 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1503 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1504 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1505 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1506 "\n");
1507}
1508
1509static struct kobj_attribute tma340_vkeys_attr = {
1510 .attr = {
1511 .mode = S_IRUGO,
1512 },
1513 .show = &tma340_vkeys_show,
1514};
1515
1516static struct attribute *tma340_properties_attrs[] = {
1517 &tma340_vkeys_attr.attr,
1518 NULL
1519};
1520
1521static struct attribute_group tma340_properties_attr_group = {
1522 .attrs = tma340_properties_attrs,
1523};
1524
1525static int cyttsp_platform_init(struct i2c_client *client)
1526{
1527 int rc = 0;
1528 static struct kobject *tma340_properties_kobj;
1529
1530 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1531 tma340_properties_kobj = kobject_create_and_add("board_properties",
1532 NULL);
1533 if (tma340_properties_kobj)
1534 rc = sysfs_create_group(tma340_properties_kobj,
1535 &tma340_properties_attr_group);
1536 if (!tma340_properties_kobj || rc)
1537 pr_err("%s: failed to create board_properties\n",
1538 __func__);
1539
1540 return 0;
1541}
1542
1543static struct cyttsp_regulator cyttsp_regulator_data[] = {
1544 {
1545 .name = "vdd",
1546 .min_uV = CY_TMA300_VTG_MIN_UV,
1547 .max_uV = CY_TMA300_VTG_MAX_UV,
1548 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1549 .lpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1550 },
1551 {
1552 .name = "vcc_i2c",
1553 .min_uV = CY_I2C_VTG_MIN_UV,
1554 .max_uV = CY_I2C_VTG_MAX_UV,
1555 .hpm_load_uA = CY_I2C_CURR_UA,
1556 .lpm_load_uA = CY_I2C_CURR_UA,
1557 },
1558};
1559
1560static struct cyttsp_platform_data cyttsp_pdata = {
1561 .panel_maxx = 634,
1562 .panel_maxy = 1166,
1563 .disp_maxx = 599,
1564 .disp_maxy = 1023,
1565 .disp_minx = 0,
1566 .disp_miny = 0,
1567 .flags = 0x01,
1568 .gen = CY_GEN3,
1569 .use_st = CY_USE_ST,
1570 .use_mt = CY_USE_MT,
1571 .use_hndshk = CY_SEND_HNDSHK,
1572 .use_trk_id = CY_USE_TRACKING_ID,
1573 .use_sleep = CY_USE_DEEP_SLEEP_SEL,
1574 .use_gestures = CY_USE_GESTURES,
1575 .fw_fname = "cyttsp_8064_mtp.hex",
1576 /* change act_intrvl to customize the Active power state
1577 * scanning/processing refresh interval for Operating mode
1578 */
1579 .act_intrvl = CY_ACT_INTRVL_DFLT,
1580 /* change tch_tmout to customize the touch timeout for the
1581 * Active power state for Operating mode
1582 */
1583 .tch_tmout = CY_TCH_TMOUT_DFLT,
1584 /* change lp_intrvl to customize the Low Power power state
1585 * scanning/processing refresh interval for Operating mode
1586 */
1587 .lp_intrvl = CY_LP_INTRVL_DFLT,
1588 .sleep_gpio = CYTTSP_TS_GPIO_SLEEP,
Amy Maloche9ba3ffe2012-04-26 10:31:20 -07001589 .resout_gpio = -1,
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001590 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1591 .regulator_info = cyttsp_regulator_data,
1592 .num_regulators = ARRAY_SIZE(cyttsp_regulator_data),
1593 .init = cyttsp_platform_init,
1594 .correct_fw_ver = 17,
1595};
1596
1597static struct i2c_board_info cyttsp_info[] __initdata = {
1598 {
1599 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1600 .platform_data = &cyttsp_pdata,
1601 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1602 },
1603};
Jing Lin21ed4de2012-02-05 15:53:28 -08001604
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001605#define MSM_WCNSS_PHYS 0x03000000
1606#define MSM_WCNSS_SIZE 0x280000
1607
1608static struct resource resources_wcnss_wlan[] = {
1609 {
1610 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1611 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1612 .name = "wcnss_wlanrx_irq",
1613 .flags = IORESOURCE_IRQ,
1614 },
1615 {
1616 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1617 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1618 .name = "wcnss_wlantx_irq",
1619 .flags = IORESOURCE_IRQ,
1620 },
1621 {
1622 .start = MSM_WCNSS_PHYS,
1623 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1624 .name = "wcnss_mmio",
1625 .flags = IORESOURCE_MEM,
1626 },
1627 {
1628 .start = 64,
1629 .end = 68,
1630 .name = "wcnss_gpios_5wire",
1631 .flags = IORESOURCE_IO,
1632 },
1633};
1634
1635static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1636 .has_48mhz_xo = 1,
1637};
1638
1639static struct platform_device msm_device_wcnss_wlan = {
1640 .name = "wcnss_wlan",
1641 .id = 0,
1642 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1643 .resource = resources_wcnss_wlan,
1644 .dev = {.platform_data = &qcom_wcnss_pdata},
1645};
1646
Ankit Vermab7c26e62012-02-28 15:04:15 -08001647static struct platform_device msm_device_iris_fm __devinitdata = {
1648 .name = "iris_fm",
1649 .id = -1,
1650};
1651
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001652#ifdef CONFIG_QSEECOM
1653/* qseecom bus scaling */
1654static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
1655 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001656 .src = MSM_BUS_MASTER_ADM_PORT0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001657 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001658 .ab = 0,
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001659 .ib = 0,
1660 },
1661 {
1662 .src = MSM_BUS_MASTER_ADM_PORT1,
1663 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1664 .ab = 0,
1665 .ib = 0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001666 },
1667 {
1668 .src = MSM_BUS_MASTER_SPDM,
1669 .dst = MSM_BUS_SLAVE_SPDM,
1670 .ib = 0,
1671 .ab = 0,
1672 },
1673};
1674
1675static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
1676 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001677 .src = MSM_BUS_MASTER_ADM_PORT0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001678 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001679 .ab = 70000000UL,
1680 .ib = 70000000UL,
1681 },
1682 {
1683 .src = MSM_BUS_MASTER_ADM_PORT1,
1684 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1685 .ab = 2480000000UL,
1686 .ib = 2480000000UL,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001687 },
1688 {
1689 .src = MSM_BUS_MASTER_SPDM,
1690 .dst = MSM_BUS_SLAVE_SPDM,
1691 .ib = 0,
1692 .ab = 0,
1693 },
1694};
1695
1696static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1697 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001698 .src = MSM_BUS_MASTER_ADM_PORT0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001699 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001700 .ab = 0,
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001701 .ib = 0,
1702 },
1703 {
1704 .src = MSM_BUS_MASTER_ADM_PORT1,
1705 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1706 .ab = 0,
1707 .ib = 0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001708 },
1709 {
1710 .src = MSM_BUS_MASTER_SPDM,
1711 .dst = MSM_BUS_SLAVE_SPDM,
1712 .ib = (64 * 8) * 1000000UL,
1713 .ab = (64 * 8) * 100000UL,
1714 },
1715};
1716
Ramesh Masavarapu8d756582012-10-03 10:18:06 -07001717static struct msm_bus_vectors qseecom_enable_dfab_sfpb_vectors[] = {
1718 {
1719 .src = MSM_BUS_MASTER_ADM_PORT0,
1720 .dst = MSM_BUS_SLAVE_EBI_CH0,
1721 .ab = 70000000UL,
1722 .ib = 70000000UL,
1723 },
1724 {
1725 .src = MSM_BUS_MASTER_ADM_PORT1,
1726 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1727 .ab = 2480000000UL,
1728 .ib = 2480000000UL,
1729 },
1730 {
1731 .src = MSM_BUS_MASTER_SPDM,
1732 .dst = MSM_BUS_SLAVE_SPDM,
1733 .ib = (64 * 8) * 1000000UL,
1734 .ab = (64 * 8) * 100000UL,
1735 },
1736};
1737
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001738static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1739 {
1740 ARRAY_SIZE(qseecom_clks_init_vectors),
1741 qseecom_clks_init_vectors,
1742 },
1743 {
1744 ARRAY_SIZE(qseecom_enable_dfab_vectors),
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001745 qseecom_enable_dfab_vectors,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001746 },
1747 {
1748 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1749 qseecom_enable_sfpb_vectors,
1750 },
Ramesh Masavarapu8d756582012-10-03 10:18:06 -07001751 {
1752 ARRAY_SIZE(qseecom_enable_dfab_sfpb_vectors),
1753 qseecom_enable_dfab_sfpb_vectors,
1754 },
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001755};
1756
1757static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1758 qseecom_hw_bus_scale_usecases,
1759 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1760 .name = "qsee",
1761};
1762
1763static struct platform_device qseecom_device = {
1764 .name = "qseecom",
1765 .id = 0,
1766 .dev = {
1767 .platform_data = &qseecom_bus_pdata,
1768 },
1769};
1770#endif
1771
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001772#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1773 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1774 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1775 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1776
1777#define QCE_SIZE 0x10000
1778#define QCE_0_BASE 0x11000000
1779
1780#define QCE_HW_KEY_SUPPORT 0
1781#define QCE_SHA_HMAC_SUPPORT 1
1782#define QCE_SHARE_CE_RESOURCE 3
1783#define QCE_CE_SHARED 0
1784
1785static struct resource qcrypto_resources[] = {
1786 [0] = {
1787 .start = QCE_0_BASE,
1788 .end = QCE_0_BASE + QCE_SIZE - 1,
1789 .flags = IORESOURCE_MEM,
1790 },
1791 [1] = {
1792 .name = "crypto_channels",
1793 .start = DMOV8064_CE_IN_CHAN,
1794 .end = DMOV8064_CE_OUT_CHAN,
1795 .flags = IORESOURCE_DMA,
1796 },
1797 [2] = {
1798 .name = "crypto_crci_in",
1799 .start = DMOV8064_CE_IN_CRCI,
1800 .end = DMOV8064_CE_IN_CRCI,
1801 .flags = IORESOURCE_DMA,
1802 },
1803 [3] = {
1804 .name = "crypto_crci_out",
1805 .start = DMOV8064_CE_OUT_CRCI,
1806 .end = DMOV8064_CE_OUT_CRCI,
1807 .flags = IORESOURCE_DMA,
1808 },
1809};
1810
1811static struct resource qcedev_resources[] = {
1812 [0] = {
1813 .start = QCE_0_BASE,
1814 .end = QCE_0_BASE + QCE_SIZE - 1,
1815 .flags = IORESOURCE_MEM,
1816 },
1817 [1] = {
1818 .name = "crypto_channels",
1819 .start = DMOV8064_CE_IN_CHAN,
1820 .end = DMOV8064_CE_OUT_CHAN,
1821 .flags = IORESOURCE_DMA,
1822 },
1823 [2] = {
1824 .name = "crypto_crci_in",
1825 .start = DMOV8064_CE_IN_CRCI,
1826 .end = DMOV8064_CE_IN_CRCI,
1827 .flags = IORESOURCE_DMA,
1828 },
1829 [3] = {
1830 .name = "crypto_crci_out",
1831 .start = DMOV8064_CE_OUT_CRCI,
1832 .end = DMOV8064_CE_OUT_CRCI,
1833 .flags = IORESOURCE_DMA,
1834 },
1835};
1836
1837#endif
1838
1839#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1840 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1841
1842static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1843 .ce_shared = QCE_CE_SHARED,
1844 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1845 .hw_key_support = QCE_HW_KEY_SUPPORT,
1846 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001847 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001848};
1849
1850static struct platform_device qcrypto_device = {
1851 .name = "qcrypto",
1852 .id = 0,
1853 .num_resources = ARRAY_SIZE(qcrypto_resources),
1854 .resource = qcrypto_resources,
1855 .dev = {
1856 .coherent_dma_mask = DMA_BIT_MASK(32),
1857 .platform_data = &qcrypto_ce_hw_suppport,
1858 },
1859};
1860#endif
1861
1862#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1863 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1864
1865static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1866 .ce_shared = QCE_CE_SHARED,
1867 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1868 .hw_key_support = QCE_HW_KEY_SUPPORT,
1869 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001870 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001871};
1872
1873static struct platform_device qcedev_device = {
1874 .name = "qce",
1875 .id = 0,
1876 .num_resources = ARRAY_SIZE(qcedev_resources),
1877 .resource = qcedev_resources,
1878 .dev = {
1879 .coherent_dma_mask = DMA_BIT_MASK(32),
1880 .platform_data = &qcedev_ce_hw_suppport,
1881 },
1882};
1883#endif
1884
Joel Kingef390842012-05-23 16:42:48 -07001885static struct mdm_vddmin_resource mdm_vddmin_rscs = {
1886 .rpm_id = MSM_RPM_ID_VDDMIN_GPIO,
1887 .ap2mdm_vddmin_gpio = 30,
1888 .modes = 0x03,
1889 .drive_strength = 8,
1890 .mdm2ap_vddmin_gpio = 80,
1891};
1892
Joel King269aa602012-07-23 08:07:35 -07001893static struct gpiomux_setting mdm2ap_status_gpio_run_cfg = {
1894 .func = GPIOMUX_FUNC_GPIO,
1895 .drv = GPIOMUX_DRV_8MA,
1896 .pull = GPIOMUX_PULL_NONE,
1897};
1898
Joel Kingdacbc822012-01-25 13:30:57 -08001899static struct mdm_platform_data mdm_platform_data = {
1900 .mdm_version = "3.0",
1901 .ramdump_delay_ms = 2000,
Joel King14fe7fa2012-05-27 14:26:11 -07001902 .early_power_on = 1,
1903 .sfr_query = 1,
Joel Kingbf3e4b52012-09-26 09:10:34 -07001904 .send_shdn = 1,
Joel Kingef390842012-05-23 16:42:48 -07001905 .vddmin_resource = &mdm_vddmin_rscs,
Hemant Kumara945b472012-01-25 15:08:06 -08001906 .peripheral_platform_device = &apq8064_device_hsic_host,
Ameya Thakurc9a7a842012-06-24 22:47:52 -07001907 .ramdump_timeout_ms = 120000,
Joel King269aa602012-07-23 08:07:35 -07001908 .mdm2ap_status_gpio_run_cfg = &mdm2ap_status_gpio_run_cfg,
Joel Kingdacbc822012-01-25 13:30:57 -08001909};
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001910
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001911static struct tsens_platform_data apq_tsens_pdata = {
1912 .tsens_factor = 1000,
1913 .hw_type = APQ_8064,
1914 .tsens_num_sensor = 11,
1915 .slope = {1176, 1176, 1154, 1176, 1111,
1916 1132, 1132, 1199, 1132, 1199, 1132},
1917};
1918
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07001919static struct platform_device msm_tsens_device = {
1920 .name = "tsens8960-tm",
1921 .id = -1,
1922};
1923
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06001924static struct msm_thermal_data msm_thermal_pdata = {
1925 .sensor_id = 7,
Eugene Seah2ee4a5d2012-06-25 18:16:41 -06001926 .poll_ms = 250,
1927 .limit_temp_degC = 60,
1928 .temp_hysteresis_degC = 10,
1929 .freq_step = 2,
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06001930};
1931
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001932#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001933static void __init apq8064_map_io(void)
1934{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001935 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001936 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001937 if (socinfo_init() < 0)
1938 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001939}
1940
1941static void __init apq8064_init_irq(void)
1942{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001943 struct msm_mpm_device_data *data = NULL;
1944
1945#ifdef CONFIG_MSM_MPM
1946 data = &apq8064_mpm_dev_data;
1947#endif
1948
1949 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001950 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1951 (void *)MSM_QGIC_CPU_BASE);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001952}
1953
Abhishek Kharbanda72dc72e2012-06-07 13:41:37 -07001954static struct msm_mhl_platform_data mhl_platform_data = {
1955 .irq = MSM_GPIO_TO_INT(MHL_GPIO_INT),
1956 .gpio_mhl_int = MHL_GPIO_INT,
1957 .gpio_mhl_reset = MHL_GPIO_RESET,
1958 .gpio_mhl_power = 0,
1959 .gpio_hdmi_mhl_mux = 0,
1960};
1961
1962static struct i2c_board_info sii_device_info[] __initdata = {
1963 {
1964 /*
1965 * keeps SI 8334 as the default
1966 * MHL TX
1967 */
1968 I2C_BOARD_INFO("sii8334", 0x39),
1969 .platform_data = &mhl_platform_data,
1970 .flags = I2C_CLIENT_WAKE,
1971 },
1972};
1973
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001974static struct platform_device msm8064_device_saw_regulator_core0 = {
1975 .name = "saw-regulator",
1976 .id = 0,
1977 .dev = {
1978 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
1979 },
1980};
1981
1982static struct platform_device msm8064_device_saw_regulator_core1 = {
1983 .name = "saw-regulator",
1984 .id = 1,
1985 .dev = {
1986 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
1987 },
1988};
1989
1990static struct platform_device msm8064_device_saw_regulator_core2 = {
1991 .name = "saw-regulator",
1992 .id = 2,
1993 .dev = {
1994 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
1995 },
1996};
1997
1998static struct platform_device msm8064_device_saw_regulator_core3 = {
1999 .name = "saw-regulator",
2000 .id = 3,
2001 .dev = {
2002 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002003
2004 },
2005};
2006
Oluwafemi Adeyemif5a31422012-03-08 16:58:45 -08002007static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06002008 {
2009 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2010 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2011 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002012 1, 784, 180000, 100,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002013 },
2014
2015 {
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002016 MSM_PM_SLEEP_MODE_RETENTION,
2017 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2018 true,
2019 415, 715, 340827, 475,
2020 },
2021
2022 {
Praveen Chidambaram78499012011-11-01 17:15:17 -06002023 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2024 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2025 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002026 1300, 228, 1200000, 2000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002027 },
2028
2029 {
2030 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2031 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2032 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002033 2000, 138, 1208400, 3200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002034 },
2035
2036 {
2037 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Praveen Chidambarame3380672012-02-08 10:32:27 -07002038 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2039 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002040 6000, 119, 1850300, 9000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002041 },
2042
2043 {
2044 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2045 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2046 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002047 9200, 68, 2839200, 16400,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002048 },
2049
2050 {
2051 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2052 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2053 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002054 10300, 63, 3128000, 18200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002055 },
2056
2057 {
2058 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2059 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2060 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002061 18000, 10, 4602600, 27000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002062 },
2063
2064 {
2065 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2066 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2067 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002068 20000, 2, 5752000, 32000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002069 },
2070};
2071
2072static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2073 .mode = MSM_PM_BOOT_CONFIG_TZ,
2074};
2075
2076static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2077 .levels = &msm_rpmrs_levels[0],
2078 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2079 .vdd_mem_levels = {
2080 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2081 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2082 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2083 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2084 },
2085 .vdd_dig_levels = {
2086 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
2087 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
2088 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
2089 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
2090 },
2091 .vdd_mask = 0x7FFFFF,
2092 .rpmrs_target_id = {
2093 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2094 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
2095 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
2096 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
2097 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
2098 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
2099 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2100 },
2101};
2102
Praveen Chidambaram78499012011-11-01 17:15:17 -06002103static uint8_t spm_wfi_cmd_sequence[] __initdata = {
2104 0x03, 0x0f,
2105};
2106
2107static uint8_t spm_power_collapse_without_rpm[] __initdata = {
2108 0x00, 0x24, 0x54, 0x10,
2109 0x09, 0x03, 0x01,
2110 0x10, 0x54, 0x30, 0x0C,
2111 0x24, 0x30, 0x0f,
2112};
2113
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002114static uint8_t spm_retention_cmd_sequence[] __initdata = {
2115 0x00, 0x05, 0x03, 0x0D,
2116 0x0B, 0x00, 0x0f,
2117};
2118
Praveen Chidambaram78499012011-11-01 17:15:17 -06002119static uint8_t spm_power_collapse_with_rpm[] __initdata = {
2120 0x00, 0x24, 0x54, 0x10,
2121 0x09, 0x07, 0x01, 0x0B,
2122 0x10, 0x54, 0x30, 0x0C,
2123 0x24, 0x30, 0x0f,
2124};
2125
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002126static struct msm_spm_seq_entry msm_spm_boot_cpu_seq_list[] __initdata = {
2127 [0] = {
2128 .mode = MSM_SPM_MODE_CLOCK_GATING,
2129 .notify_rpm = false,
2130 .cmd = spm_wfi_cmd_sequence,
2131 },
2132 [1] = {
2133 .mode = MSM_SPM_MODE_POWER_RETENTION,
2134 .notify_rpm = false,
2135 .cmd = spm_retention_cmd_sequence,
2136 },
2137 [2] = {
2138 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2139 .notify_rpm = false,
2140 .cmd = spm_power_collapse_without_rpm,
2141 },
2142 [3] = {
2143 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2144 .notify_rpm = true,
2145 .cmd = spm_power_collapse_with_rpm,
2146 },
2147};
2148static struct msm_spm_seq_entry msm_spm_nonboot_cpu_seq_list[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06002149 [0] = {
2150 .mode = MSM_SPM_MODE_CLOCK_GATING,
2151 .notify_rpm = false,
2152 .cmd = spm_wfi_cmd_sequence,
2153 },
2154 [1] = {
2155 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2156 .notify_rpm = false,
2157 .cmd = spm_power_collapse_without_rpm,
2158 },
2159 [2] = {
2160 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2161 .notify_rpm = true,
2162 .cmd = spm_power_collapse_with_rpm,
2163 },
2164};
2165
2166static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
2167 0x00, 0x20, 0x03, 0x20,
2168 0x00, 0x0f,
2169};
2170
2171static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
2172 0x00, 0x20, 0x34, 0x64,
2173 0x48, 0x07, 0x48, 0x20,
2174 0x50, 0x64, 0x04, 0x34,
2175 0x50, 0x0f,
2176};
2177static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
2178 0x00, 0x10, 0x34, 0x64,
2179 0x48, 0x07, 0x48, 0x10,
2180 0x50, 0x64, 0x04, 0x34,
2181 0x50, 0x0F,
2182};
2183
2184static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
2185 [0] = {
2186 .mode = MSM_SPM_L2_MODE_RETENTION,
2187 .notify_rpm = false,
2188 .cmd = l2_spm_wfi_cmd_sequence,
2189 },
2190 [1] = {
2191 .mode = MSM_SPM_L2_MODE_GDHS,
2192 .notify_rpm = true,
2193 .cmd = l2_spm_gdhs_cmd_sequence,
2194 },
2195 [2] = {
2196 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
2197 .notify_rpm = true,
2198 .cmd = l2_spm_power_off_cmd_sequence,
2199 },
2200};
2201
2202
2203static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
2204 [0] = {
2205 .reg_base_addr = MSM_SAW_L2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002206 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07002207 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002208 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
2209 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
2210 .modes = msm_spm_l2_seq_list,
2211 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
2212 },
2213};
2214
2215static struct msm_spm_platform_data msm_spm_data[] __initdata = {
2216 [0] = {
2217 .reg_base_addr = MSM_SAW0_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002218 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002219#if defined(CONFIG_MSM_AVS_HW)
2220 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2221 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2222#endif
2223 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002224 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004,
2225 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C,
2226 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002227 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002228 .num_modes = ARRAY_SIZE(msm_spm_boot_cpu_seq_list),
2229 .modes = msm_spm_boot_cpu_seq_list,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002230 },
2231 [1] = {
2232 .reg_base_addr = MSM_SAW1_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002233 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002234#if defined(CONFIG_MSM_AVS_HW)
2235 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2236 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2237#endif
2238 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07002239 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002240 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2241 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2242 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002243 .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
2244 .modes = msm_spm_nonboot_cpu_seq_list,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002245 },
2246 [2] = {
2247 .reg_base_addr = MSM_SAW2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002248 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002249#if defined(CONFIG_MSM_AVS_HW)
2250 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2251 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2252#endif
2253 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07002254 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002255 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2256 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2257 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002258 .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
2259 .modes = msm_spm_nonboot_cpu_seq_list,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002260 },
2261 [3] = {
2262 .reg_base_addr = MSM_SAW3_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002263 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002264#if defined(CONFIG_MSM_AVS_HW)
2265 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2266 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2267#endif
2268 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07002269 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002270 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2271 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2272 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002273 .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
2274 .modes = msm_spm_nonboot_cpu_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08002275 },
2276};
2277
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002278static void __init apq8064_init_buses(void)
2279{
2280 msm_bus_rpm_set_mt_mask();
2281 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
2282 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
2283 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
2284 msm_bus_8064_apps_fabric.dev.platform_data =
2285 &msm_bus_8064_apps_fabric_pdata;
2286 msm_bus_8064_sys_fabric.dev.platform_data =
2287 &msm_bus_8064_sys_fabric_pdata;
2288 msm_bus_8064_mm_fabric.dev.platform_data =
2289 &msm_bus_8064_mm_fabric_pdata;
2290 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
2291 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
2292}
2293
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002294/* PCIe gpios */
2295static struct msm_pcie_gpio_info_t msm_pcie_gpio_info[MSM_PCIE_MAX_GPIO] = {
2296 {"rst_n", PM8921_MPP_PM_TO_SYS(PCIE_RST_N_PMIC_MPP), 0},
2297 {"pwr_en", PM8921_GPIO_PM_TO_SYS(PCIE_PWR_EN_PMIC_GPIO), 1},
2298};
2299
2300static struct msm_pcie_platform msm_pcie_platform_data = {
2301 .gpio = msm_pcie_gpio_info,
Niranjana Vishwanathapura68210ff2012-06-24 18:03:49 -06002302 .axi_addr = PCIE_AXI_BAR_PHYS,
2303 .axi_size = PCIE_AXI_BAR_SIZE,
Niranjana Vishwanathapura459a27d2012-07-20 12:23:55 -06002304 .wake_n = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, PCIE_WAKE_N_PMIC_GPIO),
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002305};
2306
Niranjana Vishwanathapurac1edd402012-06-28 15:32:50 -06002307static int __init mpq8064_pcie_enabled(void)
2308{
2309 return !((readl_relaxed(QFPROM_RAW_FEAT_CONFIG_ROW0_MSB) & BIT(21)) ||
2310 (readl_relaxed(QFPROM_RAW_OEM_CONFIG_ROW0_LSB) & BIT(4)));
2311}
2312
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002313static void __init mpq8064_pcie_init(void)
2314{
Niranjana Vishwanathapurac1edd402012-06-28 15:32:50 -06002315 if (mpq8064_pcie_enabled()) {
2316 msm_device_pcie.dev.platform_data = &msm_pcie_platform_data;
2317 platform_device_register(&msm_device_pcie);
2318 }
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002319}
2320
David Collinsf0d00732012-01-25 15:46:50 -08002321static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
2322 .name = GPIO_REGULATOR_DEV_NAME,
2323 .id = PM8921_MPP_PM_TO_SYS(7),
2324 .dev = {
2325 .platform_data
2326 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2327 },
2328};
2329
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08002330static struct platform_device apq8064_device_ext_mpp8_vreg __devinitdata = {
2331 .name = GPIO_REGULATOR_DEV_NAME,
2332 .id = PM8921_MPP_PM_TO_SYS(8),
2333 .dev = {
2334 .platform_data
2335 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_MPP8],
2336 },
2337};
2338
David Collinsf0d00732012-01-25 15:46:50 -08002339static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
2340 .name = GPIO_REGULATOR_DEV_NAME,
2341 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
2342 .dev = {
2343 .platform_data =
2344 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2345 },
2346};
2347
David Collins390fc332012-02-07 14:38:16 -08002348static struct platform_device apq8064_device_ext_ts_sw_vreg __devinitdata = {
2349 .name = GPIO_REGULATOR_DEV_NAME,
2350 .id = PM8921_GPIO_PM_TO_SYS(23),
2351 .dev = {
2352 .platform_data
2353 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_TS_SW],
2354 },
2355};
2356
David Collins2782b5c2012-02-06 10:02:42 -08002357static struct platform_device apq8064_device_rpm_regulator __devinitdata = {
2358 .name = "rpm-regulator",
David Collins793793b2012-08-21 15:43:02 -07002359 .id = 0,
David Collins2782b5c2012-02-06 10:02:42 -08002360 .dev = {
2361 .platform_data = &apq8064_rpm_regulator_pdata,
2362 },
2363};
2364
David Collins793793b2012-08-21 15:43:02 -07002365static struct platform_device
2366apq8064_pm8921_device_rpm_regulator __devinitdata = {
2367 .name = "rpm-regulator",
2368 .id = 1,
2369 .dev = {
2370 .platform_data = &apq8064_rpm_regulator_pm8921_pdata,
2371 },
2372};
2373
Ravi Kumar V05931a22012-04-04 17:09:37 +05302374static struct gpio_ir_recv_platform_data gpio_ir_recv_pdata = {
2375 .gpio_nr = 88,
2376 .active_low = 1,
Ravi Kumar V16a614c2012-10-12 20:59:56 +05302377 .can_wakeup = true,
Ravi Kumar V05931a22012-04-04 17:09:37 +05302378};
2379
2380static struct platform_device gpio_ir_recv_pdev = {
2381 .name = "gpio-rc-recv",
2382 .dev = {
2383 .platform_data = &gpio_ir_recv_pdata,
2384 },
2385};
2386
Terence Hampson36b70722012-05-10 13:18:16 -04002387static struct platform_device *common_not_mpq_devices[] __initdata = {
David Keitel3c40fc52012-02-09 17:53:52 -08002388 &apq8064_device_qup_i2c_gsbi1,
Jing Lin04601f92012-02-05 15:36:07 -08002389 &apq8064_device_qup_i2c_gsbi3,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002390 &apq8064_device_qup_i2c_gsbi4,
Terence Hampson36b70722012-05-10 13:18:16 -04002391};
2392
Kuirong Wangf8c5e142012-06-21 16:17:32 -07002393static struct platform_device *common_mpq_devices[] __initdata = {
2394 &mpq_cpudai_sec_i2s_rx,
2395 &mpq_cpudai_mi2s_tx,
Aviral Guptabfa97882012-10-16 12:15:59 +05302396 &mpq_cpudai_pseudo,
Kuirong Wangf8c5e142012-06-21 16:17:32 -07002397};
2398
2399static struct platform_device *common_i2s_devices[] __initdata = {
2400 &apq_cpudai_mi2s,
2401 &apq_cpudai_i2s_rx,
2402 &apq_cpudai_i2s_tx,
2403};
2404
David Collins793793b2012-08-21 15:43:02 -07002405static struct platform_device *early_common_devices[] __initdata = {
Matt Wagantallf5cc3892012-06-07 19:47:02 -07002406 &apq8064_device_acpuclk,
Terence Hampson36b70722012-05-10 13:18:16 -04002407 &apq8064_device_dmov,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002408 &apq8064_device_qup_spi_gsbi5,
David Collins793793b2012-08-21 15:43:02 -07002409};
2410
2411static struct platform_device *pm8921_common_devices[] __initdata = {
David Collinsf0d00732012-01-25 15:46:50 -08002412 &apq8064_device_ext_5v_vreg,
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08002413 &apq8064_device_ext_mpp8_vreg,
David Collinsf0d00732012-01-25 15:46:50 -08002414 &apq8064_device_ext_3p3v_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07002415 &apq8064_device_ssbi_pmic1,
2416 &apq8064_device_ssbi_pmic2,
David Collins793793b2012-08-21 15:43:02 -07002417};
2418
2419static struct platform_device *pm8917_common_devices[] __initdata = {
2420 &apq8064_device_ext_mpp8_vreg,
2421 &apq8064_device_ext_3p3v_vreg,
2422 &apq8064_device_ssbi_pmic1,
2423 &apq8064_device_ssbi_pmic2,
David Collins793793b2012-08-21 15:43:02 -07002424};
2425
2426static struct platform_device *common_devices[] __initdata = {
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06002427 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07002428 &apq8064_device_otg,
2429 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08002430 &apq8064_device_hsusb_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07002431 &android_usb_device,
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08002432 &msm_device_wcnss_wlan,
Ankit Vermab7c26e62012-02-28 15:04:15 -08002433 &msm_device_iris_fm,
Larry Bassel67b921d2012-04-06 10:23:27 -07002434 &apq8064_fmem_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08002435#ifdef CONFIG_ANDROID_PMEM
2436#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002437 &apq8064_android_pmem_device,
2438 &apq8064_android_pmem_adsp_device,
2439 &apq8064_android_pmem_audio_device,
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -07002440#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
2441#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -08002442#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002443 &apq8064_ion_dev,
Olav Haugan7c6aa742012-01-16 16:47:37 -08002444#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002445 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08002446 &msm8064_device_saw_regulator_core0,
2447 &msm8064_device_saw_regulator_core1,
2448 &msm8064_device_saw_regulator_core2,
2449 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002450#if defined(CONFIG_QSEECOM)
2451 &qseecom_device,
2452#endif
2453
Joel Nider6b9a7bc2012-06-26 11:19:19 +03002454 &msm_8064_device_tsif[0],
2455 &msm_8064_device_tsif[1],
2456
Ramesh Masavarapu28311912011-10-27 11:04:12 -07002457#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2458 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2459 &qcrypto_device,
2460#endif
2461
2462#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2463 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2464 &qcedev_device,
2465#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07002466
2467#ifdef CONFIG_HW_RANDOM_MSM
2468 &apq8064_device_rng,
2469#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002470 &apq_pcm,
2471 &apq_pcm_routing,
2472 &apq_cpudai0,
2473 &apq_cpudai1,
2474 &apq_cpudai_hdmi_rx,
2475 &apq_cpudai_bt_rx,
2476 &apq_cpudai_bt_tx,
2477 &apq_cpudai_fm_rx,
2478 &apq_cpudai_fm_tx,
2479 &apq_cpu_fe,
2480 &apq_stub_codec,
2481 &apq_voice,
2482 &apq_voip,
2483 &apq_lpa_pcm,
Krishnankutty Kolathappilly4374e332012-03-18 22:27:30 -07002484 &apq_compr_dsp,
2485 &apq_multi_ch_pcm,
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -07002486 &apq_lowlatency_pcm,
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002487 &apq_pcm_hostless,
2488 &apq_cpudai_afe_01_rx,
2489 &apq_cpudai_afe_01_tx,
2490 &apq_cpudai_afe_02_rx,
2491 &apq_cpudai_afe_02_tx,
2492 &apq_pcm_afe,
2493 &apq_cpudai_auxpcm_rx,
2494 &apq_cpudai_auxpcm_tx,
Neema Shetty8427c262012-02-16 11:23:43 -08002495 &apq_cpudai_stub,
Neema Shetty3c9d2862012-03-11 01:25:32 -08002496 &apq_cpudai_slimbus_1_rx,
2497 &apq_cpudai_slimbus_1_tx,
Kiran Kandi97fe19d2012-05-20 22:34:04 -07002498 &apq_cpudai_slimbus_2_rx,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002499 &apq_cpudai_slimbus_2_tx,
Neema Shettyc9d86c32012-05-09 12:01:39 -07002500 &apq_cpudai_slimbus_3_rx,
Helen Zeng38c3c962012-05-17 14:56:20 -07002501 &apq_cpudai_slimbus_3_tx,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002502 &apq8064_rpm_device,
2503 &apq8064_rpm_log_device,
2504 &apq8064_rpm_stat_device,
Anji Jonnala93129922012-10-09 20:57:53 +05302505 &apq8064_rpm_master_stat_device,
Ramesh Masavarapuf31ff242012-05-10 18:55:21 -07002506 &apq_device_tz_log,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002507 &msm_bus_8064_apps_fabric,
2508 &msm_bus_8064_sys_fabric,
2509 &msm_bus_8064_mm_fabric,
2510 &msm_bus_8064_sys_fpb,
2511 &msm_bus_8064_cpss_fpb,
Mohan Kumar Gubbihalli Lachma Naik7f72edd2012-02-06 17:26:47 -08002512 &apq8064_msm_device_vidc,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07002513 &msm_pil_dsps,
Matt Wagantallb94b9a52012-02-02 21:59:54 -08002514 &msm_8960_q6_lpass,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002515 &msm_pil_vidc,
Matt Wagantall292aace2012-01-26 19:12:34 -08002516 &msm_gss,
Laura Abbottb93525f2012-04-12 09:57:19 -07002517 &apq8064_rtb_device,
Abhijeet Dharmapurikarfb4a2f82012-08-23 14:36:59 -07002518 &apq8064_msm_gov_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002519 &apq8064_device_cache_erp,
Stepan Moskovchenko0f3de112012-06-08 18:11:46 -07002520 &msm8960_device_ebi1_ch0_erp,
2521 &msm8960_device_ebi1_ch1_erp,
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002522 &epm_adc_device,
Pratik Patel3b0ca882012-06-01 16:54:14 -07002523 &coresight_tpiu_device,
2524 &coresight_etb_device,
2525 &apq8064_coresight_funnel_device,
2526 &coresight_etm0_device,
2527 &coresight_etm1_device,
2528 &coresight_etm2_device,
2529 &coresight_etm3_device,
Helen Zeng8f925502012-03-05 16:50:17 -08002530 &apq_cpudai_slim_4_rx,
2531 &apq_cpudai_slim_4_tx,
Steve Mucklef132c6c2012-06-06 18:30:57 -07002532#ifdef CONFIG_MSM_GEMINI
Jignesh Mehta921649d2012-04-19 06:57:23 -07002533 &msm8960_gemini_device,
Steve Mucklef132c6c2012-06-06 18:30:57 -07002534#endif
Laura Abbott0577d7b2012-04-17 11:14:30 -07002535 &apq8064_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002536 &msm_tsens_device,
Laura Abbott93a4a352012-05-25 09:26:35 -07002537 &apq8064_cache_dump_device,
Joel Nider0e4a16d2012-08-05 14:20:11 +03002538 &msm_8064_device_tspp,
Binqiang Qiuf165c922012-08-15 18:00:18 -07002539#ifdef CONFIG_BATTERY_BCL
2540 &battery_bcl_device,
2541#endif
Abhijeet Dharmapurikarfb4a2f82012-08-23 14:36:59 -07002542 &apq8064_msm_mpd_device,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002543};
2544
Joel King82b7e3f2012-01-05 10:03:27 -08002545static struct platform_device *cdp_devices[] __initdata = {
2546 &apq8064_device_uart_gsbi1,
Jin Hong4bbbfba2012-02-02 21:48:07 -08002547 &apq8064_device_uart_gsbi7,
Joel King82b7e3f2012-01-05 10:03:27 -08002548 &msm_device_sps_apq8064,
Aravind Venkateswaran4ca27532012-02-16 14:27:05 -08002549#ifdef CONFIG_MSM_ROTATOR
2550 &msm_rotator_device,
2551#endif
Anji Jonnala6c2b6852012-09-21 13:34:44 +05302552 &msm8064_pc_cntr,
Joel King82b7e3f2012-01-05 10:03:27 -08002553};
2554
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002555static struct platform_device
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002556mpq8064_device_ext_1p2_buck_vreg __devinitdata = {
2557 .name = GPIO_REGULATOR_DEV_NAME,
2558 .id = SX150X_GPIO(4, 2),
2559 .dev = {
2560 .platform_data =
2561 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P2V],
2562 },
2563};
2564
2565static struct platform_device
2566mpq8064_device_ext_1p8_buck_vreg __devinitdata = {
2567 .name = GPIO_REGULATOR_DEV_NAME,
2568 .id = SX150X_GPIO(4, 4),
2569 .dev = {
2570 .platform_data =
2571 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P8V],
2572 },
2573};
2574
2575static struct platform_device
2576mpq8064_device_ext_2p2_buck_vreg __devinitdata = {
2577 .name = GPIO_REGULATOR_DEV_NAME,
2578 .id = SX150X_GPIO(4, 14),
2579 .dev = {
2580 .platform_data =
2581 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_2P2V],
2582 },
2583};
2584
2585static struct platform_device
2586mpq8064_device_ext_5v_buck_vreg __devinitdata = {
2587 .name = GPIO_REGULATOR_DEV_NAME,
2588 .id = SX150X_GPIO(4, 3),
2589 .dev = {
2590 .platform_data =
2591 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_5V],
2592 },
2593};
2594
2595static struct platform_device
2596mpq8064_device_ext_3p3v_ldo_vreg __devinitdata = {
2597 .name = GPIO_REGULATOR_DEV_NAME,
2598 .id = SX150X_GPIO(4, 15),
2599 .dev = {
2600 .platform_data =
2601 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_3P3V],
2602 },
2603};
2604
Ravi Kumar V1c903012012-05-15 16:11:35 +05302605static struct platform_device rc_input_loopback_pdev = {
2606 .name = "rc-user-input",
2607 .id = -1,
2608};
2609
Ravi Kumar V040eeff2012-05-23 21:29:23 +05302610static int rf4ce_gpio_init(void)
2611{
Ravi Kumar V92b2b6c2012-08-14 17:18:11 +05302612 if (!machine_is_mpq8064_cdp() &&
2613 !machine_is_mpq8064_hrd() &&
2614 !machine_is_mpq8064_dtv())
Ravi Kumar V040eeff2012-05-23 21:29:23 +05302615 return -EINVAL;
2616
2617 /* CC2533 SRDY Input */
2618 if (!gpio_request(SX150X_GPIO(4, 6), "rf4ce_srdy")) {
2619 gpio_direction_input(SX150X_GPIO(4, 6));
2620 gpio_export(SX150X_GPIO(4, 6), true);
2621 }
2622
2623 /* CC2533 MRDY Output */
2624 if (!gpio_request(SX150X_GPIO(4, 5), "rf4ce_mrdy")) {
2625 gpio_direction_output(SX150X_GPIO(4, 5), 1);
2626 gpio_export(SX150X_GPIO(4, 5), true);
2627 }
2628
2629 /* CC2533 Reset Output */
2630 if (!gpio_request(SX150X_GPIO(4, 7), "rf4ce_reset")) {
2631 gpio_direction_output(SX150X_GPIO(4, 7), 0);
2632 gpio_export(SX150X_GPIO(4, 7), true);
2633 }
2634
2635 return 0;
2636}
2637late_initcall(rf4ce_gpio_init);
2638
Mayank Rana262e9032012-05-10 15:14:00 -07002639#ifdef CONFIG_SERIAL_MSM_HS
2640static int configure_uart_gpios(int on)
2641{
2642 int ret = 0, i;
2643 int uart_gpios[] = {14, 15, 16, 17};
2644
2645 for (i = 0; i < ARRAY_SIZE(uart_gpios); i++) {
2646 if (on) {
2647 ret = gpio_request(uart_gpios[i], NULL);
2648 if (ret) {
2649 pr_err("%s:unable to request uart gpio[%d]\n",
2650 __func__, uart_gpios[i]);
2651 break;
2652 }
2653 } else {
2654 gpio_free(uart_gpios[i]);
2655 }
2656 }
2657
2658 if (ret && on && i)
2659 for (; i >= 0; i--)
2660 gpio_free(uart_gpios[i]);
2661 return ret;
2662}
2663
2664static struct msm_serial_hs_platform_data mpq8064_gsbi6_uartdm_pdata = {
2665 .inject_rx_on_wakeup = 1,
2666 .rx_to_inject = 0xFD,
2667 .gpio_config = configure_uart_gpios,
2668};
2669#else
2670static struct msm_serial_hs_platform_data msm_uart_dm9_pdata;
2671#endif
2672
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002673static struct platform_device *mpq_devices[] __initdata = {
2674 &msm_device_sps_apq8064,
2675 &mpq8064_device_qup_i2c_gsbi5,
2676#ifdef CONFIG_MSM_ROTATOR
2677 &msm_rotator_device,
2678#endif
Ravi Kumar V05931a22012-04-04 17:09:37 +05302679 &gpio_ir_recv_pdev,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002680 &mpq8064_device_ext_1p2_buck_vreg,
2681 &mpq8064_device_ext_1p8_buck_vreg,
2682 &mpq8064_device_ext_2p2_buck_vreg,
2683 &mpq8064_device_ext_5v_buck_vreg,
2684 &mpq8064_device_ext_3p3v_ldo_vreg,
Terence Hampson2e1705f2012-04-11 19:55:29 -04002685#ifdef CONFIG_MSM_VCAP
2686 &msm8064_device_vcap,
2687#endif
Ravi Kumar V1c903012012-05-15 16:11:35 +05302688 &rc_input_loopback_pdev,
Bar Weinerf82c5872012-10-23 14:31:26 +02002689 &mpq8064_device_qup_spi_gsbi6,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002690};
2691
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002692static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002693 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002694};
2695
Bar Weinerf82c5872012-10-23 14:31:26 +02002696static struct msm_spi_platform_data mpq8064_qup_spi_gsbi6_pdata = {
2697 .max_clock_speed = 1100000,
2698};
2699
2700static struct ci_bridge_platform_data mpq8064_ci_bridge_pdata = {
2701 .reset_pin = 260,
2702 .interrupt_pin = 261,
2703};
2704
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002705#define KS8851_IRQ_GPIO 43
2706
2707static struct spi_board_info spi_board_info[] __initdata = {
2708 {
2709 .modalias = "ks8851",
2710 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2711 .max_speed_hz = 19200000,
2712 .bus_num = 0,
2713 .chip_select = 2,
2714 .mode = SPI_MODE_0,
2715 },
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002716 {
2717 .modalias = "epm_adc",
2718 .max_speed_hz = 1100000,
2719 .bus_num = 0,
2720 .chip_select = 3,
2721 .mode = SPI_MODE_0,
Bar Weinerf82c5872012-10-23 14:31:26 +02002722 }
2723};
2724
2725static struct spi_board_info mpq8064_spi_board_info[] __initdata = {
2726 {
2727 .modalias = "ci_bridge_spi",
2728 .max_speed_hz = 1000000,
2729 .bus_num = 1,
2730 .chip_select = 0,
2731 .mode = SPI_MODE_0,
2732 .platform_data = &mpq8064_ci_bridge_pdata,
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002733 },
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002734};
2735
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002736static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002737 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08002738 .bus_num = 1,
2739 .slim_slave = &apq8064_slim_tabla,
2740 },
2741 {
2742 .bus_num = 1,
2743 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002744 },
2745 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002746};
2747
David Keitel3c40fc52012-02-09 17:53:52 -08002748static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi1_pdata = {
2749 .clk_freq = 100000,
2750 .src_clk_rate = 24000000,
2751};
2752
Jing Lin04601f92012-02-05 15:36:07 -08002753static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi3_pdata = {
Anirudh Ghayalc2163472012-04-10 14:58:14 +05302754 .clk_freq = 384000,
Jing Lin04601f92012-02-05 15:36:07 -08002755 .src_clk_rate = 24000000,
2756};
2757
Kenneth Heitke748593a2011-07-15 15:45:11 -06002758static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
2759 .clk_freq = 100000,
2760 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002761};
2762
Joel King8f839b92012-04-01 14:37:46 -07002763static struct msm_i2c_platform_data mpq8064_i2c_qup_gsbi5_pdata = {
2764 .clk_freq = 100000,
2765 .src_clk_rate = 24000000,
2766};
2767
David Keitel3c40fc52012-02-09 17:53:52 -08002768#define GSBI_DUAL_MODE_CODE 0x60
2769#define MSM_GSBI1_PHYS 0x12440000
Kenneth Heitke748593a2011-07-15 15:45:11 -06002770static void __init apq8064_i2c_init(void)
2771{
David Keitel3c40fc52012-02-09 17:53:52 -08002772 void __iomem *gsbi_mem;
2773
2774 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2775 &apq8064_i2c_qup_gsbi1_pdata;
2776 gsbi_mem = ioremap_nocache(MSM_GSBI1_PHYS, 4);
2777 writel_relaxed(GSBI_DUAL_MODE_CODE, gsbi_mem);
2778 /* Ensure protocol code is written before proceeding */
2779 wmb();
2780 iounmap(gsbi_mem);
2781 apq8064_i2c_qup_gsbi1_pdata.use_gsbi_shared_mode = 1;
Jing Lin04601f92012-02-05 15:36:07 -08002782 apq8064_device_qup_i2c_gsbi3.dev.platform_data =
2783 &apq8064_i2c_qup_gsbi3_pdata;
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002784 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2785 &apq8064_i2c_qup_gsbi1_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002786 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
2787 &apq8064_i2c_qup_gsbi4_pdata;
Joel King8f839b92012-04-01 14:37:46 -07002788 mpq8064_device_qup_i2c_gsbi5.dev.platform_data =
2789 &mpq8064_i2c_qup_gsbi5_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002790}
2791
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002792#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002793static int ethernet_init(void)
2794{
2795 int ret;
2796 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
2797 if (ret) {
2798 pr_err("ks8851 gpio_request failed: %d\n", ret);
2799 goto fail;
2800 }
2801
2802 return 0;
2803fail:
2804 return ret;
2805}
2806#else
2807static int ethernet_init(void)
2808{
2809 return 0;
2810}
2811#endif
2812
David Collinsd49a1c52012-08-22 13:18:06 -07002813#define GPIO_KEY_HOME PM8921_GPIO_PM_TO_SYS(27)
2814#define GPIO_KEY_VOLUME_UP PM8921_GPIO_PM_TO_SYS(35)
2815#define GPIO_KEY_VOLUME_DOWN_PM8921 PM8921_GPIO_PM_TO_SYS(38)
2816#define GPIO_KEY_VOLUME_DOWN_PM8917 PM8921_GPIO_PM_TO_SYS(30)
2817#define GPIO_KEY_CAM_FOCUS PM8921_GPIO_PM_TO_SYS(3)
2818#define GPIO_KEY_CAM_SNAP PM8921_GPIO_PM_TO_SYS(4)
2819#define GPIO_KEY_ROTATION_PM8921 PM8921_GPIO_PM_TO_SYS(42)
2820#define GPIO_KEY_ROTATION_PM8917 PM8921_GPIO_PM_TO_SYS(8)
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302821
David Collinsd49a1c52012-08-22 13:18:06 -07002822static struct gpio_keys_button cdp_keys_pm8921[] = {
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302823 {
2824 .code = KEY_HOME,
2825 .gpio = GPIO_KEY_HOME,
2826 .desc = "home_key",
2827 .active_low = 1,
2828 .type = EV_KEY,
2829 .wakeup = 1,
2830 .debounce_interval = 15,
2831 },
2832 {
2833 .code = KEY_VOLUMEUP,
2834 .gpio = GPIO_KEY_VOLUME_UP,
2835 .desc = "volume_up_key",
2836 .active_low = 1,
2837 .type = EV_KEY,
2838 .wakeup = 1,
2839 .debounce_interval = 15,
2840 },
2841 {
2842 .code = KEY_VOLUMEDOWN,
David Collinsd49a1c52012-08-22 13:18:06 -07002843 .gpio = GPIO_KEY_VOLUME_DOWN_PM8921,
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302844 .desc = "volume_down_key",
2845 .active_low = 1,
2846 .type = EV_KEY,
2847 .wakeup = 1,
2848 .debounce_interval = 15,
2849 },
2850 {
2851 .code = SW_ROTATE_LOCK,
David Collinsd49a1c52012-08-22 13:18:06 -07002852 .gpio = GPIO_KEY_ROTATION_PM8921,
2853 .desc = "rotate_key",
2854 .active_low = 1,
2855 .type = EV_SW,
2856 .debounce_interval = 15,
2857 },
2858};
2859
2860static struct gpio_keys_button cdp_keys_pm8917[] = {
2861 {
2862 .code = KEY_HOME,
2863 .gpio = GPIO_KEY_HOME,
2864 .desc = "home_key",
2865 .active_low = 1,
2866 .type = EV_KEY,
2867 .wakeup = 1,
2868 .debounce_interval = 15,
2869 },
2870 {
2871 .code = KEY_VOLUMEUP,
2872 .gpio = GPIO_KEY_VOLUME_UP,
2873 .desc = "volume_up_key",
2874 .active_low = 1,
2875 .type = EV_KEY,
2876 .wakeup = 1,
2877 .debounce_interval = 15,
2878 },
2879 {
2880 .code = KEY_VOLUMEDOWN,
2881 .gpio = GPIO_KEY_VOLUME_DOWN_PM8917,
2882 .desc = "volume_down_key",
2883 .active_low = 1,
2884 .type = EV_KEY,
2885 .wakeup = 1,
2886 .debounce_interval = 15,
2887 },
2888 {
2889 .code = SW_ROTATE_LOCK,
2890 .gpio = GPIO_KEY_ROTATION_PM8917,
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302891 .desc = "rotate_key",
2892 .active_low = 1,
2893 .type = EV_SW,
2894 .debounce_interval = 15,
2895 },
2896};
2897
2898static struct gpio_keys_platform_data cdp_keys_data = {
David Collinsd49a1c52012-08-22 13:18:06 -07002899 .buttons = cdp_keys_pm8921,
2900 .nbuttons = ARRAY_SIZE(cdp_keys_pm8921),
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302901};
2902
2903static struct platform_device cdp_kp_pdev = {
2904 .name = "gpio-keys",
2905 .id = -1,
2906 .dev = {
2907 .platform_data = &cdp_keys_data,
2908 },
2909};
2910
2911static struct gpio_keys_button mtp_keys[] = {
2912 {
2913 .code = KEY_CAMERA_FOCUS,
2914 .gpio = GPIO_KEY_CAM_FOCUS,
2915 .desc = "cam_focus_key",
2916 .active_low = 1,
2917 .type = EV_KEY,
2918 .wakeup = 1,
2919 .debounce_interval = 15,
2920 },
2921 {
2922 .code = KEY_VOLUMEUP,
2923 .gpio = GPIO_KEY_VOLUME_UP,
2924 .desc = "volume_up_key",
2925 .active_low = 1,
2926 .type = EV_KEY,
2927 .wakeup = 1,
2928 .debounce_interval = 15,
2929 },
2930 {
2931 .code = KEY_VOLUMEDOWN,
David Collinsd49a1c52012-08-22 13:18:06 -07002932 .gpio = GPIO_KEY_VOLUME_DOWN_PM8921,
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302933 .desc = "volume_down_key",
2934 .active_low = 1,
2935 .type = EV_KEY,
2936 .wakeup = 1,
2937 .debounce_interval = 15,
2938 },
2939 {
2940 .code = KEY_CAMERA_SNAPSHOT,
2941 .gpio = GPIO_KEY_CAM_SNAP,
2942 .desc = "cam_snap_key",
2943 .active_low = 1,
2944 .type = EV_KEY,
2945 .debounce_interval = 15,
2946 },
2947};
2948
2949static struct gpio_keys_platform_data mtp_keys_data = {
2950 .buttons = mtp_keys,
2951 .nbuttons = ARRAY_SIZE(mtp_keys),
2952};
2953
2954static struct platform_device mtp_kp_pdev = {
2955 .name = "gpio-keys",
2956 .id = -1,
2957 .dev = {
2958 .platform_data = &mtp_keys_data,
2959 },
2960};
2961
Mohan Pallakab8aa8282012-10-04 14:26:21 +05302962#define MPQ_HRD_HOME_GPIO SX150X_EXP2_GPIO_BASE
2963#define MPQ_HRD_VOL_UP_GPIO (SX150X_EXP2_GPIO_BASE + 1)
2964#define MPQ_HRD_VOL_DOWN_GPIO (SX150X_EXP2_GPIO_BASE + 2)
2965#define MPQ_HRD_RIGHT_GPIO (SX150X_EXP2_GPIO_BASE + 3)
2966#define MPQ_HRD_LEFT_GPIO (SX150X_EXP2_GPIO_BASE + 4)
2967#define MPQ_HRD_ENTER_GPIO (SX150X_EXP2_GPIO_BASE + 5)
2968
2969static struct gpio_keys_button mpq_hrd_keys[] = {
2970 {
2971 .code = KEY_HOME,
2972 .gpio = MPQ_HRD_HOME_GPIO,
2973 .desc = "home_key",
2974 .active_low = 1,
2975 .type = EV_KEY,
2976 .wakeup = 1,
2977 .debounce_interval = 15,
2978 },
2979 {
2980 .code = KEY_VOLUMEUP,
2981 .gpio = MPQ_HRD_VOL_UP_GPIO,
2982 .desc = "volume_up_key",
2983 .active_low = 1,
2984 .type = EV_KEY,
2985 .wakeup = 1,
2986 .debounce_interval = 15,
2987 },
2988 {
2989 .code = KEY_VOLUMEDOWN,
2990 .gpio = MPQ_HRD_VOL_DOWN_GPIO,
2991 .desc = "volume_down_key",
2992 .active_low = 1,
2993 .type = EV_KEY,
2994 .wakeup = 1,
2995 .debounce_interval = 15,
2996 },
2997 {
2998 .code = KEY_RIGHT,
2999 .gpio = MPQ_HRD_RIGHT_GPIO,
3000 .desc = "right_key",
3001 .active_low = 1,
3002 .type = EV_KEY,
3003 .wakeup = 1,
3004 .debounce_interval = 15,
3005 },
3006 {
3007 .code = KEY_LEFT,
3008 .gpio = MPQ_HRD_LEFT_GPIO,
3009 .desc = "left_key",
3010 .active_low = 1,
3011 .type = EV_KEY,
3012 .wakeup = 1,
3013 .debounce_interval = 15,
3014 },
3015 {
3016 .code = KEY_ENTER,
3017 .gpio = MPQ_HRD_ENTER_GPIO,
3018 .desc = "enter_key",
3019 .active_low = 1,
3020 .type = EV_KEY,
3021 .wakeup = 1,
3022 .debounce_interval = 15,
3023 },
3024};
3025
3026static struct gpio_keys_platform_data mpq_hrd_keys_pdata = {
3027 .buttons = mpq_hrd_keys,
3028 .nbuttons = ARRAY_SIZE(mpq_hrd_keys),
3029};
3030
3031static struct platform_device mpq_hrd_keys_pdev = {
3032 .name = "gpio-keys",
3033 .id = -1,
3034 .dev = {
3035 .platform_data = &mpq_hrd_keys_pdata,
3036 },
3037};
3038
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05303039static struct gpio_keys_button mpq_keys[] = {
3040 {
3041 .code = KEY_VOLUMEDOWN,
David Collinsd49a1c52012-08-22 13:18:06 -07003042 .gpio = GPIO_KEY_VOLUME_DOWN_PM8921,
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05303043 .desc = "volume_down_key",
3044 .active_low = 1,
3045 .type = EV_KEY,
3046 .wakeup = 1,
3047 .debounce_interval = 15,
3048 },
3049 {
3050 .code = KEY_VOLUMEUP,
3051 .gpio = GPIO_KEY_VOLUME_UP,
3052 .desc = "volume_up_key",
3053 .active_low = 1,
3054 .type = EV_KEY,
3055 .wakeup = 1,
3056 .debounce_interval = 15,
3057 },
3058};
3059
3060static struct gpio_keys_platform_data mpq_keys_data = {
3061 .buttons = mpq_keys,
3062 .nbuttons = ARRAY_SIZE(mpq_keys),
3063};
3064
3065static struct platform_device mpq_gpio_keys_pdev = {
3066 .name = "gpio-keys",
3067 .id = -1,
3068 .dev = {
3069 .platform_data = &mpq_keys_data,
3070 },
3071};
3072
3073#define MPQ_KP_ROW_BASE SX150X_EXP2_GPIO_BASE
3074#define MPQ_KP_COL_BASE (SX150X_EXP2_GPIO_BASE + 4)
3075
3076static unsigned int mpq_row_gpios[] = {MPQ_KP_ROW_BASE, MPQ_KP_ROW_BASE + 1,
3077 MPQ_KP_ROW_BASE + 2, MPQ_KP_ROW_BASE + 3};
3078static unsigned int mpq_col_gpios[] = {MPQ_KP_COL_BASE, MPQ_KP_COL_BASE + 1,
3079 MPQ_KP_COL_BASE + 2};
3080
3081static const unsigned int mpq_keymap[] = {
3082 KEY(0, 0, KEY_UP),
3083 KEY(0, 1, KEY_ENTER),
3084 KEY(0, 2, KEY_3),
3085
3086 KEY(1, 0, KEY_DOWN),
3087 KEY(1, 1, KEY_EXIT),
3088 KEY(1, 2, KEY_4),
3089
3090 KEY(2, 0, KEY_LEFT),
3091 KEY(2, 1, KEY_1),
3092 KEY(2, 2, KEY_5),
3093
3094 KEY(3, 0, KEY_RIGHT),
3095 KEY(3, 1, KEY_2),
3096 KEY(3, 2, KEY_6),
3097};
3098
3099static struct matrix_keymap_data mpq_keymap_data = {
3100 .keymap_size = ARRAY_SIZE(mpq_keymap),
3101 .keymap = mpq_keymap,
3102};
3103
3104static struct matrix_keypad_platform_data mpq_keypad_data = {
3105 .keymap_data = &mpq_keymap_data,
3106 .row_gpios = mpq_row_gpios,
3107 .col_gpios = mpq_col_gpios,
3108 .num_row_gpios = ARRAY_SIZE(mpq_row_gpios),
3109 .num_col_gpios = ARRAY_SIZE(mpq_col_gpios),
3110 .col_scan_delay_us = 32000,
3111 .debounce_ms = 20,
3112 .wakeup = 1,
3113 .active_low = 1,
3114 .no_autorepeat = 1,
3115};
3116
3117static struct platform_device mpq_keypad_device = {
3118 .name = "matrix-keypad",
3119 .id = -1,
3120 .dev = {
3121 .platform_data = &mpq_keypad_data,
3122 },
3123};
3124
Jin Hongd3024e62012-02-09 16:13:32 -08003125/* Sensors DSPS platform data */
3126#define DSPS_PIL_GENERIC_NAME "dsps"
3127static void __init apq8064_init_dsps(void)
3128{
3129 struct msm_dsps_platform_data *pdata =
3130 msm_dsps_device_8064.dev.platform_data;
3131 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
3132 pdata->gpios = NULL;
3133 pdata->gpios_num = 0;
3134
3135 platform_device_register(&msm_dsps_device_8064);
3136}
Mohan Pallaka474b94b2012-01-25 12:59:58 +05303137
Jing Lin417fa452012-02-05 14:31:06 -08003138#define I2C_SURF 1
3139#define I2C_FFA (1 << 1)
3140#define I2C_RUMI (1 << 2)
3141#define I2C_SIM (1 << 3)
3142#define I2C_LIQUID (1 << 4)
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003143#define I2C_MPQ_CDP BIT(5)
3144#define I2C_MPQ_HRD BIT(6)
3145#define I2C_MPQ_DTV BIT(7)
Jing Lin417fa452012-02-05 14:31:06 -08003146
3147struct i2c_registry {
3148 u8 machs;
3149 int bus;
3150 struct i2c_board_info *info;
3151 int len;
3152};
3153
3154static struct i2c_registry apq8064_i2c_devices[] __initdata = {
Jing Lin21ed4de2012-02-05 15:53:28 -08003155 {
David Keitel2f613d92012-02-15 11:29:16 -08003156 I2C_LIQUID,
3157 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
3158 smb349_charger_i2c_info,
3159 ARRAY_SIZE(smb349_charger_i2c_info)
3160 },
3161 {
Jing Lin21ed4de2012-02-05 15:53:28 -08003162 I2C_SURF | I2C_LIQUID,
3163 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
3164 mxt_device_info,
3165 ARRAY_SIZE(mxt_device_info),
3166 },
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08003167 {
3168 I2C_FFA,
3169 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
3170 cyttsp_info,
3171 ARRAY_SIZE(cyttsp_info),
3172 },
Amy Maloche70090f992012-02-16 16:35:26 -08003173 {
3174 I2C_FFA | I2C_LIQUID,
3175 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
3176 isa1200_board_info,
3177 ARRAY_SIZE(isa1200_board_info),
3178 },
Santosh Mardieff9a742012-04-09 23:23:39 +05303179 {
3180 I2C_MPQ_CDP,
3181 APQ_8064_GSBI5_QUP_I2C_BUS_ID,
3182 cs8427_device_info,
3183 ARRAY_SIZE(cs8427_device_info),
3184 },
Abhishek Kharbanda72dc72e2012-06-07 13:41:37 -07003185 {
3186 I2C_SURF | I2C_FFA | I2C_LIQUID,
3187 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
3188 sii_device_info,
3189 ARRAY_SIZE(sii_device_info),
3190 }
Jing Lin417fa452012-02-05 14:31:06 -08003191};
3192
Kuirong Wangf8c5e142012-06-21 16:17:32 -07003193static struct i2c_registry apq8064_tabla_i2c_devices[] __initdata = {
3194 {
3195 .bus = APQ_8064_GSBI1_QUP_I2C_BUS_ID,
3196 .info = apq8064_tabla_i2c_device_info,
3197 .len = ARRAY_SIZE(apq8064_tabla_i2c_device_info),
3198 },
3199};
3200
Jay Chokshi607f61b2012-04-25 18:21:21 -07003201#define SX150X_EXP1_INT_N PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9)
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05303202#define SX150X_EXP2_INT_N MSM_GPIO_TO_INT(81)
Jay Chokshi607f61b2012-04-25 18:21:21 -07003203
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003204struct sx150x_platform_data mpq8064_sx150x_pdata[] = {
3205 [SX150X_EXP1] = {
3206 .gpio_base = SX150X_EXP1_GPIO_BASE,
3207 .oscio_is_gpo = false,
3208 .io_pullup_ena = 0x0,
3209 .io_pulldn_ena = 0x0,
3210 .io_open_drain_ena = 0x0,
3211 .io_polarity = 0,
Jay Chokshi607f61b2012-04-25 18:21:21 -07003212 .irq_summary = SX150X_EXP1_INT_N,
3213 .irq_base = SX150X_EXP1_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003214 },
3215 [SX150X_EXP2] = {
3216 .gpio_base = SX150X_EXP2_GPIO_BASE,
3217 .oscio_is_gpo = false,
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05303218 .io_pullup_ena = 0x0f,
3219 .io_pulldn_ena = 0x70,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003220 .io_open_drain_ena = 0x0,
3221 .io_polarity = 0,
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05303222 .irq_summary = SX150X_EXP2_INT_N,
3223 .irq_base = SX150X_EXP2_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003224 },
3225 [SX150X_EXP3] = {
3226 .gpio_base = SX150X_EXP3_GPIO_BASE,
3227 .oscio_is_gpo = false,
3228 .io_pullup_ena = 0x0,
3229 .io_pulldn_ena = 0x0,
3230 .io_open_drain_ena = 0x0,
3231 .io_polarity = 0,
3232 .irq_summary = -1,
3233 },
3234 [SX150X_EXP4] = {
3235 .gpio_base = SX150X_EXP4_GPIO_BASE,
3236 .oscio_is_gpo = false,
3237 .io_pullup_ena = 0x0,
3238 .io_pulldn_ena = 0x0,
3239 .io_open_drain_ena = 0x0,
3240 .io_polarity = 0,
3241 .irq_summary = -1,
3242 },
3243};
3244
3245static struct i2c_board_info sx150x_gpio_exp_info[] = {
3246 {
3247 I2C_BOARD_INFO("sx1509q", 0x70),
3248 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP1],
3249 },
3250 {
3251 I2C_BOARD_INFO("sx1508q", 0x23),
3252 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP2],
3253 },
3254 {
3255 I2C_BOARD_INFO("sx1508q", 0x22),
3256 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP3],
3257 },
3258 {
3259 I2C_BOARD_INFO("sx1509q", 0x3E),
3260 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP4],
3261 },
3262};
3263
3264#define MPQ8064_I2C_GSBI5_BUS_ID 5
3265
3266static struct i2c_registry mpq8064_i2c_devices[] __initdata = {
3267 {
3268 I2C_MPQ_CDP,
3269 MPQ8064_I2C_GSBI5_BUS_ID,
3270 sx150x_gpio_exp_info,
3271 ARRAY_SIZE(sx150x_gpio_exp_info),
3272 },
3273};
3274
Jing Lin417fa452012-02-05 14:31:06 -08003275static void __init register_i2c_devices(void)
3276{
3277 u8 mach_mask = 0;
3278 int i;
Kuirong Wangf8c5e142012-06-21 16:17:32 -07003279 u32 version;
Jing Lin417fa452012-02-05 14:31:06 -08003280
Kevin Chand07220e2012-02-13 15:52:22 -08003281#ifdef CONFIG_MSM_CAMERA
3282 struct i2c_registry apq8064_camera_i2c_devices = {
3283 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_RUMI,
3284 APQ_8064_GSBI4_QUP_I2C_BUS_ID,
3285 apq8064_camera_board_info.board_info,
3286 apq8064_camera_board_info.num_i2c_board_info,
3287 };
3288#endif
Jing Lin417fa452012-02-05 14:31:06 -08003289 /* Build the matching 'supported_machs' bitmask */
3290 if (machine_is_apq8064_cdp())
3291 mach_mask = I2C_SURF;
3292 else if (machine_is_apq8064_mtp())
3293 mach_mask = I2C_FFA;
3294 else if (machine_is_apq8064_liquid())
3295 mach_mask = I2C_LIQUID;
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003296 else if (PLATFORM_IS_MPQ8064())
3297 mach_mask = I2C_MPQ_CDP;
Jing Lin417fa452012-02-05 14:31:06 -08003298 else
3299 pr_err("unmatched machine ID in register_i2c_devices\n");
3300
3301 /* Run the array and install devices as appropriate */
3302 for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) {
3303 if (apq8064_i2c_devices[i].machs & mach_mask)
3304 i2c_register_board_info(apq8064_i2c_devices[i].bus,
3305 apq8064_i2c_devices[i].info,
3306 apq8064_i2c_devices[i].len);
3307 }
Kevin Chand07220e2012-02-13 15:52:22 -08003308#ifdef CONFIG_MSM_CAMERA
3309 if (apq8064_camera_i2c_devices.machs & mach_mask)
3310 i2c_register_board_info(apq8064_camera_i2c_devices.bus,
3311 apq8064_camera_i2c_devices.info,
3312 apq8064_camera_i2c_devices.len);
3313#endif
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003314
3315 for (i = 0; i < ARRAY_SIZE(mpq8064_i2c_devices); ++i) {
3316 if (mpq8064_i2c_devices[i].machs & mach_mask)
3317 i2c_register_board_info(
3318 mpq8064_i2c_devices[i].bus,
3319 mpq8064_i2c_devices[i].info,
3320 mpq8064_i2c_devices[i].len);
3321 }
Kuirong Wangf8c5e142012-06-21 16:17:32 -07003322
3323 if (machine_is_apq8064_mtp()) {
3324 version = socinfo_get_platform_version();
3325 if (SOCINFO_VERSION_MINOR(version) == 1)
3326 for (i = 0; i < ARRAY_SIZE(apq8064_tabla_i2c_devices);
3327 ++i)
3328 i2c_register_board_info(
3329 apq8064_tabla_i2c_devices[i].bus,
3330 apq8064_tabla_i2c_devices[i].info,
3331 apq8064_tabla_i2c_devices[i].len);
3332 }
3333
Jing Lin417fa452012-02-05 14:31:06 -08003334}
3335
Jay Chokshi994ff122012-03-27 15:43:48 -07003336static void enable_ddr3_regulator(void)
3337{
3338 static struct regulator *ext_ddr3;
3339
3340 /* Use MPP7 output state as a flag for PCDDR3 presence. */
3341 if (gpio_get_value_cansleep(PM8921_MPP_PM_TO_SYS(7)) > 0) {
3342 ext_ddr3 = regulator_get(NULL, "ext_ddr3");
3343 if (IS_ERR(ext_ddr3) || ext_ddr3 == NULL)
3344 pr_err("Could not get MPP7 regulator\n");
3345 else
3346 regulator_enable(ext_ddr3);
3347 }
3348}
3349
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003350static void enable_avc_i2c_bus(void)
3351{
3352 int avc_i2c_en_mpp = PM8921_MPP_PM_TO_SYS(8);
3353 int rc;
3354
3355 rc = gpio_request(avc_i2c_en_mpp, "avc_i2c_en");
3356 if (rc)
3357 pr_err("request for avc_i2c_en mpp failed,"
3358 "rc=%d\n", rc);
3359 else
3360 gpio_set_value_cansleep(avc_i2c_en_mpp, 1);
3361}
3362
David Collinsd49a1c52012-08-22 13:18:06 -07003363/* Modify platform data values to match requirements for PM8917. */
3364static void __init apq8064_pm8917_pdata_fixup(void)
3365{
3366 cdp_keys_data.buttons = cdp_keys_pm8917;
3367 cdp_keys_data.nbuttons = ARRAY_SIZE(cdp_keys_pm8917);
3368}
3369
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003370static void __init apq8064_common_init(void)
3371{
Kuirong Wangf8c5e142012-06-21 16:17:32 -07003372 u32 platform_version = socinfo_get_platform_version();
David Collinsd49a1c52012-08-22 13:18:06 -07003373
3374 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
3375 apq8064_pm8917_pdata_fixup();
Rohit Vaswanib1cc4932012-07-23 21:30:11 -07003376 platform_device_register(&msm_gpio_device);
Joel King8f839b92012-04-01 14:37:46 -07003377 msm_tsens_early_init(&apq_tsens_pdata);
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06003378 msm_thermal_init(&msm_thermal_pdata);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003379 if (socinfo_init() < 0)
3380 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06003381 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
3382 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
David Collins2782b5c2012-02-06 10:02:42 -08003383 regulator_suppress_info_printing();
David Collins793793b2012-08-21 15:43:02 -07003384 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
3385 configure_apq8064_pm8917_power_grid();
David Collins2782b5c2012-02-06 10:02:42 -08003386 platform_device_register(&apq8064_device_rpm_regulator);
David Collins793793b2012-08-21 15:43:02 -07003387 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917)
3388 platform_device_register(&apq8064_pm8921_device_rpm_regulator);
Stephen Boyd4d0d2582012-02-10 14:49:40 -08003389 if (msm_xo_init())
3390 pr_err("Failed to initialize XO votes\n");
Matt Wagantallc51e5602012-02-27 17:25:25 -08003391 msm_clock_init(&apq8064_clock_init_data);
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08003392 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06003393 apq8064_i2c_init();
Mohan Pallakab8aa8282012-10-04 14:26:21 +05303394
3395 /* configure sx150x parameters for HRD */
3396 if (machine_is_mpq8064_hrd()) {
3397 mpq8064_sx150x_pdata[SX150X_EXP2].irq_summary =
3398 PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 40);
3399 mpq8064_sx150x_pdata[SX150X_EXP2].io_pullup_ena = 0xff;
3400 mpq8064_sx150x_pdata[SX150X_EXP2].io_pulldn_ena = 0x00;
3401 }
3402
Jing Lin417fa452012-02-05 14:31:06 -08003403 register_i2c_devices();
Kenneth Heitke36920d32011-07-20 16:44:30 -06003404
Harini Jayaramanc4c58692011-07-19 14:50:10 -06003405 apq8064_device_qup_spi_gsbi5.dev.platform_data =
3406 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08003407 apq8064_init_pmic();
Hemant Kumar94e7da22012-02-03 16:52:29 -08003408 if (machine_is_apq8064_liquid())
3409 msm_otg_pdata.mhl_enable = true;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07003410
Abhishek Kharbanda72dc72e2012-06-07 13:41:37 -07003411 if (apq8064_mhl_display_enabled())
3412 mhl_platform_data.mhl_enabled = true;
3413
Ofir Cohen94213a72012-05-03 14:26:32 +03003414 android_usb_pdata.swfi_latency =
3415 msm_rpmrs_levels[0].latency_us;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07003416
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003417 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Manu Gautam91223e02011-11-08 15:27:22 +05303418 apq8064_ehci_host_init();
Gagan Mac8a7a5d32011-11-11 16:43:06 -07003419 apq8064_init_buses();
David Collins793793b2012-08-21 15:43:02 -07003420
3421 platform_add_devices(early_common_devices,
3422 ARRAY_SIZE(early_common_devices));
3423 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917)
3424 platform_add_devices(pm8921_common_devices,
3425 ARRAY_SIZE(pm8921_common_devices));
3426 else
3427 platform_add_devices(pm8917_common_devices,
3428 ARRAY_SIZE(pm8917_common_devices));
David Collins03c16372012-10-04 15:57:28 -07003429 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
3430 platform_device_register(&apq8064_device_ext_ts_sw_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003431 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Terence Hampson36b70722012-05-10 13:18:16 -04003432 if (!(machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
3433 machine_is_mpq8064_dtv()))
3434 platform_add_devices(common_not_mpq_devices,
3435 ARRAY_SIZE(common_not_mpq_devices));
Kuirong Wangf8c5e142012-06-21 16:17:32 -07003436
3437 if ((machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
3438 machine_is_mpq8064_dtv()))
3439 platform_add_devices(common_mpq_devices,
3440 ARRAY_SIZE(common_mpq_devices));
3441
3442 if (machine_is_apq8064_mtp()) {
3443 if (SOCINFO_VERSION_MINOR(platform_version) == 1)
3444 platform_add_devices(common_i2s_devices,
3445 ARRAY_SIZE(common_i2s_devices));
3446 }
3447
Jay Chokshi994ff122012-03-27 15:43:48 -07003448 enable_ddr3_regulator();
Pavankumar Kondeti4f5dc3b2012-09-07 15:33:09 +05303449 msm_hsic_pdata.swfi_latency =
3450 msm_rpmrs_levels[0].latency_us;
Hemant Kumarf1ca9192012-02-07 18:59:33 -08003451 if (machine_is_apq8064_mtp()) {
Hemant Kumar30d361c2012-08-20 14:44:40 -07003452 msm_hsic_pdata.log2_irq_thresh = 5,
Hemant Kumarf1ca9192012-02-07 18:59:33 -08003453 apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
3454 device_initialize(&apq8064_device_hsic_host.dev);
3455 }
Jay Chokshie8741282012-01-25 15:22:55 -08003456 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05303457 apq8064_init_mmc();
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08003458
3459 if (machine_is_apq8064_mtp()) {
3460 mdm_8064_device.dev.platform_data = &mdm_platform_data;
Ameya Thakure155ece2012-07-09 12:08:37 -07003461 if (SOCINFO_VERSION_MINOR(platform_version) == 1) {
3462 i2s_mdm_8064_device.dev.platform_data =
3463 &mdm_platform_data;
3464 platform_device_register(&i2s_mdm_8064_device);
3465 } else {
3466 mdm_8064_device.dev.platform_data = &mdm_platform_data;
3467 platform_device_register(&mdm_8064_device);
3468 }
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08003469 }
3470 platform_device_register(&apq8064_slim_ctrl);
Santosh Mardi344455a2012-09-07 13:22:16 +05303471 if (machine_is_mpq8064_hrd() || machine_is_mpq8064_dtv()) {
3472 apq8064_slim_devices[ARRAY_SIZE(apq8064_slim_devices) - 1].\
3473 slim_slave = &mpq8064_slim_ashiko20;
3474 }
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06003475 slim_register_board_info(apq8064_slim_devices,
3476 ARRAY_SIZE(apq8064_slim_devices));
Taniya Dasbbf633d2012-07-31 16:07:47 +05303477 if (!PLATFORM_IS_MPQ8064()) {
Taniya Das30cae292012-07-31 15:56:12 +05303478 apq8064_init_dsps();
Taniya Dasbbf633d2012-07-31 16:07:47 +05303479 platform_device_register(&msm_8960_riva);
3480 }
Praveen Chidambaram78499012011-11-01 17:15:17 -06003481 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3482 msm_spm_l2_init(msm_spm_l2_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06003483 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08003484 apq8064_epm_adc_init();
Girish Mahadevan3bc98772012-08-15 10:01:27 -06003485 msm_pm_set_tz_retention_flag(1);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003486}
3487
Huaibin Yang4a084e32011-12-15 15:25:52 -08003488static void __init apq8064_allocate_memory_regions(void)
3489{
3490 apq8064_allocate_fb_region();
3491}
3492
Joel King82b7e3f2012-01-05 10:03:27 -08003493static void __init apq8064_cdp_init(void)
3494{
Hanumant Singh50440d42012-04-23 19:27:16 -07003495 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
3496 pr_err("meminfo_init() failed!\n");
Amy Maloche609bb5e2012-08-03 09:41:42 -07003497 if (machine_is_apq8064_mtp() &&
3498 SOCINFO_VERSION_MINOR(socinfo_get_platform_version()) == 1)
3499 cyttsp_pdata.sleep_gpio = CYTTSP_TS_GPIO_SLEEP_ALT;
Joel King82b7e3f2012-01-05 10:03:27 -08003500 apq8064_common_init();
Joel King8f839b92012-04-01 14:37:46 -07003501 if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
3502 machine_is_mpq8064_dtv()) {
Ravi Kumar V16a614c2012-10-12 20:59:56 +05303503 gpio_ir_recv_pdata.swfi_latency =
3504 msm_rpmrs_levels[0].latency_us;
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003505 enable_avc_i2c_bus();
Olav Hauganef95ae32012-05-15 09:50:30 -07003506 msm_rotator_set_split_iommu_domain();
Bar Weinerf82c5872012-10-23 14:31:26 +02003507
3508 mpq8064_device_qup_spi_gsbi6.dev.platform_data =
3509 &mpq8064_qup_spi_gsbi6_pdata;
3510
Joel King8f839b92012-04-01 14:37:46 -07003511 platform_add_devices(mpq_devices, ARRAY_SIZE(mpq_devices));
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06003512 mpq8064_pcie_init();
Bar Weinerf82c5872012-10-23 14:31:26 +02003513 spi_register_board_info(mpq8064_spi_board_info,
3514 ARRAY_SIZE(mpq8064_spi_board_info));
Joel King8f839b92012-04-01 14:37:46 -07003515 } else {
3516 ethernet_init();
Olav Hauganef95ae32012-05-15 09:50:30 -07003517 msm_rotator_set_split_iommu_domain();
Joel King8f839b92012-04-01 14:37:46 -07003518 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
3519 spi_register_board_info(spi_board_info,
3520 ARRAY_SIZE(spi_board_info));
3521 }
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003522 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07003523 apq8064_init_gpu();
Matt Wagantall1f65d9d2012-04-25 14:24:20 -07003524 platform_add_devices(apq8064_footswitch, apq8064_num_footswitch);
Steve Mucklef132c6c2012-06-06 18:30:57 -07003525#ifdef CONFIG_MSM_CAMERA
Kevin Chand07220e2012-02-13 15:52:22 -08003526 apq8064_init_cam();
Steve Mucklef132c6c2012-06-06 18:30:57 -07003527#endif
Mohan Pallaka474b94b2012-01-25 12:59:58 +05303528
Mayank Rana262e9032012-05-10 15:14:00 -07003529 if (machine_is_mpq8064_hrd() || machine_is_mpq8064_dtv()) {
3530 platform_device_register(&mpq8064_device_uartdm_gsbi6);
3531#ifdef CONFIG_SERIAL_MSM_HS
3532 /* GSBI6(2) - UARTDM_RX */
3533 mpq8064_gsbi6_uartdm_pdata.wakeup_irq = gpio_to_irq(15);
3534 mpq8064_device_uartdm_gsbi6.dev.platform_data =
3535 &mpq8064_gsbi6_uartdm_pdata;
3536#endif
3537 }
3538
Ankit Verma6fe41b02012-09-13 16:12:11 +05303539#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
3540 if (machine_is_mpq8064_hrd())
3541 apq8064_bt_power_init();
3542#endif
3543
Mohan Pallaka474b94b2012-01-25 12:59:58 +05303544 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
3545 platform_device_register(&cdp_kp_pdev);
3546
3547 if (machine_is_apq8064_mtp())
3548 platform_device_register(&mtp_kp_pdev);
Hanumant Singh50440d42012-04-23 19:27:16 -07003549
3550 change_memory_power = &apq8064_change_memory_power;
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05303551
3552 if (machine_is_mpq8064_cdp()) {
3553 platform_device_register(&mpq_gpio_keys_pdev);
3554 platform_device_register(&mpq_keypad_device);
Mohan Pallakab8aa8282012-10-04 14:26:21 +05303555 } else if (machine_is_mpq8064_hrd())
3556 platform_device_register(&mpq_hrd_keys_pdev);
Joel King82b7e3f2012-01-05 10:03:27 -08003557}
3558
Joel King82b7e3f2012-01-05 10:03:27 -08003559MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
3560 .map_io = apq8064_map_io,
3561 .reserve = apq8064_reserve,
3562 .init_irq = apq8064_init_irq,
3563 .handle_irq = gic_handle_irq,
3564 .timer = &msm_timer,
3565 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003566 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003567 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003568 .restart = msm_restart,
Joel King82b7e3f2012-01-05 10:03:27 -08003569MACHINE_END
3570
3571MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
3572 .map_io = apq8064_map_io,
3573 .reserve = apq8064_reserve,
3574 .init_irq = apq8064_init_irq,
3575 .handle_irq = gic_handle_irq,
3576 .timer = &msm_timer,
3577 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003578 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003579 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003580 .restart = msm_restart,
Joel King82b7e3f2012-01-05 10:03:27 -08003581MACHINE_END
3582
3583MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
3584 .map_io = apq8064_map_io,
3585 .reserve = apq8064_reserve,
3586 .init_irq = apq8064_init_irq,
3587 .handle_irq = gic_handle_irq,
3588 .timer = &msm_timer,
3589 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003590 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003591 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003592 .restart = msm_restart,
Joel King82b7e3f2012-01-05 10:03:27 -08003593MACHINE_END
3594
Joel King064bbf82012-04-01 13:23:39 -07003595MACHINE_START(MPQ8064_CDP, "QCT MPQ8064 CDP")
3596 .map_io = apq8064_map_io,
3597 .reserve = apq8064_reserve,
3598 .init_irq = apq8064_init_irq,
3599 .handle_irq = gic_handle_irq,
3600 .timer = &msm_timer,
3601 .init_machine = apq8064_cdp_init,
3602 .init_early = apq8064_allocate_memory_regions,
3603 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003604 .restart = msm_restart,
Joel King064bbf82012-04-01 13:23:39 -07003605MACHINE_END
3606
Joel King11ca8202012-02-13 16:19:03 -08003607MACHINE_START(MPQ8064_HRD, "QCT MPQ8064 HRD")
3608 .map_io = apq8064_map_io,
3609 .reserve = apq8064_reserve,
3610 .init_irq = apq8064_init_irq,
3611 .handle_irq = gic_handle_irq,
3612 .timer = &msm_timer,
3613 .init_machine = apq8064_cdp_init,
Joel King3a57e772012-05-28 11:22:55 -07003614 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003615 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003616 .restart = msm_restart,
Joel King11ca8202012-02-13 16:19:03 -08003617MACHINE_END
3618
3619MACHINE_START(MPQ8064_DTV, "QCT MPQ8064 DTV")
3620 .map_io = apq8064_map_io,
3621 .reserve = apq8064_reserve,
3622 .init_irq = apq8064_init_irq,
3623 .handle_irq = gic_handle_irq,
3624 .timer = &msm_timer,
3625 .init_machine = apq8064_cdp_init,
Joel King3a57e772012-05-28 11:22:55 -07003626 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003627 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003628 .restart = msm_restart,
Joel King11ca8202012-02-13 16:19:03 -08003629MACHINE_END