blob: 517ef9eda080be981397c4c7cf84c7e271b4acae [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 */
1260static int enable_100KHz_ls(int enable)
1261{
1262 int ret = 0;
1263 if (enable) {
1264 ret = gpio_request(SX150X_GPIO(1, 10),
1265 "cs8427_100KHZ_ENABLE");
1266 if (ret) {
1267 pr_err("%s: Failed to request gpio %d\n", __func__,
1268 SX150X_GPIO(1, 10));
1269 return ret;
1270 }
1271 gpio_direction_output(SX150X_GPIO(1, 10), 1);
Santosh Mardi3896ed32012-08-31 19:26:54 +05301272 } else {
1273 gpio_direction_output(SX150X_GPIO(1, 10), 0);
Santosh Mardi695be0d2012-04-10 23:21:12 +05301274 gpio_free(SX150X_GPIO(1, 10));
Santosh Mardi3896ed32012-08-31 19:26:54 +05301275 }
Santosh Mardi695be0d2012-04-10 23:21:12 +05301276 return ret;
1277}
1278
Santosh Mardieff9a742012-04-09 23:23:39 +05301279static struct cs8427_platform_data cs8427_i2c_platform_data = {
1280 .irq = SX150X_GPIO(1, 4),
1281 .reset_gpio = SX150X_GPIO(1, 6),
Santosh Mardi695be0d2012-04-10 23:21:12 +05301282 .enable = enable_100KHz_ls,
Santosh Mardieff9a742012-04-09 23:23:39 +05301283};
1284
1285static struct i2c_board_info cs8427_device_info[] __initdata = {
1286 {
1287 I2C_BOARD_INFO("cs8427", CS8427_ADDR4),
1288 .platform_data = &cs8427_i2c_platform_data,
1289 },
1290};
1291
Amy Maloche70090f992012-02-16 16:35:26 -08001292#define HAP_SHIFT_LVL_OE_GPIO PM8921_MPP_PM_TO_SYS(8)
1293#define ISA1200_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1294#define ISA1200_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
David Collinsd49a1c52012-08-22 13:18:06 -07001295#define ISA1200_HAP_CLK_PM8921 PM8921_GPIO_PM_TO_SYS(44)
1296#define ISA1200_HAP_CLK_PM8917 PM8921_GPIO_PM_TO_SYS(38)
Amy Maloche70090f992012-02-16 16:35:26 -08001297
Mohan Pallaka2d877602012-05-11 13:07:30 +05301298static int isa1200_clk_enable(bool on)
Amy Maloche70090f992012-02-16 16:35:26 -08001299{
David Collinsd49a1c52012-08-22 13:18:06 -07001300 unsigned int gpio = ISA1200_HAP_CLK_PM8921;
Amy Maloche8f973892012-03-26 14:53:13 -07001301 int rc = 0;
1302
David Collinsd49a1c52012-08-22 13:18:06 -07001303 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
1304 gpio = ISA1200_HAP_CLK_PM8917;
1305
1306 gpio_set_value_cansleep(gpio, on);
Amy Maloche70090f992012-02-16 16:35:26 -08001307
Mohan Pallaka2d877602012-05-11 13:07:30 +05301308 if (on) {
Amy Maloche8f973892012-03-26 14:53:13 -07001309 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_1, true);
Mohan Pallaka2d877602012-05-11 13:07:30 +05301310 if (rc) {
1311 pr_err("%s: unable to write aux clock register(%d)\n",
1312 __func__, rc);
1313 goto err_gpio_dis;
1314 }
1315 } else {
Amy Maloche8f973892012-03-26 14:53:13 -07001316 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_NONE, true);
Mohan Pallaka2d877602012-05-11 13:07:30 +05301317 if (rc)
1318 pr_err("%s: unable to write aux clock register(%d)\n",
1319 __func__, rc);
Amy Maloche8f973892012-03-26 14:53:13 -07001320 }
1321
1322 return rc;
Mohan Pallaka2d877602012-05-11 13:07:30 +05301323
1324err_gpio_dis:
David Collinsd49a1c52012-08-22 13:18:06 -07001325 gpio_set_value_cansleep(gpio, !on);
Mohan Pallaka2d877602012-05-11 13:07:30 +05301326 return rc;
Amy Maloche70090f992012-02-16 16:35:26 -08001327}
1328
1329static int isa1200_dev_setup(bool enable)
1330{
David Collinsd49a1c52012-08-22 13:18:06 -07001331 unsigned int gpio = ISA1200_HAP_CLK_PM8921;
Amy Maloche70090f992012-02-16 16:35:26 -08001332 int rc = 0;
1333
David Collinsd49a1c52012-08-22 13:18:06 -07001334 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
1335 gpio = ISA1200_HAP_CLK_PM8917;
1336
Amy Maloche70090f992012-02-16 16:35:26 -08001337 if (!enable)
1338 goto free_gpio;
1339
David Collinsd49a1c52012-08-22 13:18:06 -07001340 rc = gpio_request(gpio, "haptics_clk");
Amy Maloche70090f992012-02-16 16:35:26 -08001341 if (rc) {
1342 pr_err("%s: unable to request gpio %d config(%d)\n",
David Collinsd49a1c52012-08-22 13:18:06 -07001343 __func__, gpio, rc);
Amy Maloche70090f992012-02-16 16:35:26 -08001344 return rc;
1345 }
1346
David Collinsd49a1c52012-08-22 13:18:06 -07001347 rc = gpio_direction_output(gpio, 0);
Amy Maloche70090f992012-02-16 16:35:26 -08001348 if (rc) {
1349 pr_err("%s: unable to set direction\n", __func__);
1350 goto free_gpio;
1351 }
1352
1353 return 0;
1354
1355free_gpio:
David Collinsd49a1c52012-08-22 13:18:06 -07001356 gpio_free(gpio);
Amy Maloche70090f992012-02-16 16:35:26 -08001357 return rc;
1358}
1359
1360static struct isa1200_regulator isa1200_reg_data[] = {
1361 {
1362 .name = "vddp",
1363 .min_uV = ISA_I2C_VTG_MIN_UV,
1364 .max_uV = ISA_I2C_VTG_MAX_UV,
1365 .load_uA = ISA_I2C_CURR_UA,
1366 },
1367};
1368
1369static struct isa1200_platform_data isa1200_1_pdata = {
1370 .name = "vibrator",
1371 .dev_setup = isa1200_dev_setup,
Mohan Pallaka2d877602012-05-11 13:07:30 +05301372 .clk_enable = isa1200_clk_enable,
Mohan Pallaka32f20a72012-06-14 14:41:11 +05301373 .need_pwm_clk = true,
Amy Maloche70090f992012-02-16 16:35:26 -08001374 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
1375 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
1376 .max_timeout = 15000,
1377 .mode_ctrl = PWM_GEN_MODE,
1378 .pwm_fd = {
1379 .pwm_div = 256,
1380 },
1381 .is_erm = false,
1382 .smart_en = true,
1383 .ext_clk_en = true,
1384 .chip_en = 1,
1385 .regulator_info = isa1200_reg_data,
1386 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1387};
1388
1389static struct i2c_board_info isa1200_board_info[] __initdata = {
1390 {
1391 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1392 .platform_data = &isa1200_1_pdata,
1393 },
1394};
Jing Lin21ed4de2012-02-05 15:53:28 -08001395/* configuration data for mxt1386e using V2.1 firmware */
1396static const u8 mxt1386e_config_data_v2_1[] = {
1397 /* T6 Object */
1398 0, 0, 0, 0, 0, 0,
1399 /* T38 Object */
Jing Linc6a55cfc2012-08-31 10:54:44 -07001400 14, 3, 0, 5, 7, 12, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001401 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1402 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1403 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1404 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1405 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1406 0, 0, 0, 0,
1407 /* T7 Object */
Jing Linc6a55cfc2012-08-31 10:54:44 -07001408 32, 10, 50,
Jing Lin21ed4de2012-02-05 15:53:28 -08001409 /* T8 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001410 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001411 /* T9 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001412 139, 0, 0, 26, 42, 0, 32, 80, 2, 5,
Jing Linc6a55cfc2012-08-31 10:54:44 -07001413 0, 5, 5, 79, 10, 30, 10, 10, 255, 2,
Jing Linf1208fd2012-02-23 11:15:42 -08001414 85, 5, 0, 5, 9, 5, 12, 35, 70, 40,
1415 20, 5, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001416 /* T18 Object */
1417 0, 0,
1418 /* T24 Object */
1419 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1420 0, 0, 0, 0, 0, 0, 0, 0, 0,
1421 /* T25 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001422 1, 0, 60, 115, 156, 99,
Jing Lin21ed4de2012-02-05 15:53:28 -08001423 /* T27 Object */
1424 0, 0, 0, 0, 0, 0, 0,
1425 /* T40 Object */
1426 0, 0, 0, 0, 0,
1427 /* T42 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001428 0, 0, 255, 0, 255, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001429 /* T43 Object */
1430 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
1431 16,
1432 /* T46 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001433 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001434 /* T47 Object */
1435 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
1436 /* T48 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001437 1, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001438 32, 40, 0, 10, 10, 0, 0, 100, 10, 90,
1439 0, 0, 0, 0, 0, 0, 0, 10, 1, 10,
1440 52, 10, 12, 0, 33, 0, 1, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001441 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1442 0, 0, 0, 0,
1443 /* T56 Object */
1444 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1445 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1446 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1447 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001448 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1449 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001450};
1451
1452#define MXT_TS_GPIO_IRQ 6
1453#define MXT_TS_PWR_EN_GPIO PM8921_GPIO_PM_TO_SYS(23)
1454#define MXT_TS_RESET_GPIO 33
1455
1456static struct mxt_config_info mxt_config_array[] = {
1457 {
1458 .config = mxt1386e_config_data_v2_1,
1459 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1460 .family_id = 0xA0,
1461 .variant_id = 0x7,
1462 .version = 0x21,
1463 .build = 0xAA,
Jing Linef4aa9b2012-03-26 12:01:41 -07001464 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
1465 .fw_name = "atmel_8064_liquid_v2_2_AA.hex",
1466 },
1467 {
1468 /* The config data for V2.2.AA is the same as for V2.1.AA */
1469 .config = mxt1386e_config_data_v2_1,
1470 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1471 .family_id = 0xA0,
1472 .variant_id = 0x7,
1473 .version = 0x22,
1474 .build = 0xAA,
1475 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin21ed4de2012-02-05 15:53:28 -08001476 },
1477};
1478
1479static struct mxt_platform_data mxt_platform_data = {
1480 .config_array = mxt_config_array,
1481 .config_array_size = ARRAY_SIZE(mxt_config_array),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08001482 .panel_minx = 0,
1483 .panel_maxx = 1365,
1484 .panel_miny = 0,
1485 .panel_maxy = 767,
1486 .disp_minx = 0,
1487 .disp_maxx = 1365,
1488 .disp_miny = 0,
1489 .disp_maxy = 767,
Anirudh Ghayal39dbe3f2012-04-13 15:43:16 +05301490 .irqflags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
Jing Lin21ed4de2012-02-05 15:53:28 -08001491 .i2c_pull_up = true,
1492 .reset_gpio = MXT_TS_RESET_GPIO,
1493 .irq_gpio = MXT_TS_GPIO_IRQ,
1494};
1495
1496static struct i2c_board_info mxt_device_info[] __initdata = {
1497 {
1498 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
1499 .platform_data = &mxt_platform_data,
1500 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1501 },
1502};
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001503#define CYTTSP_TS_GPIO_IRQ 6
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001504#define CYTTSP_TS_GPIO_SLEEP 33
Amy Maloche609bb5e2012-08-03 09:41:42 -07001505#define CYTTSP_TS_GPIO_SLEEP_ALT 12
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001506
1507static ssize_t tma340_vkeys_show(struct kobject *kobj,
1508 struct kobj_attribute *attr, char *buf)
1509{
1510 return snprintf(buf, 200,
1511 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1512 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1513 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1514 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1515 "\n");
1516}
1517
1518static struct kobj_attribute tma340_vkeys_attr = {
1519 .attr = {
1520 .mode = S_IRUGO,
1521 },
1522 .show = &tma340_vkeys_show,
1523};
1524
1525static struct attribute *tma340_properties_attrs[] = {
1526 &tma340_vkeys_attr.attr,
1527 NULL
1528};
1529
1530static struct attribute_group tma340_properties_attr_group = {
1531 .attrs = tma340_properties_attrs,
1532};
1533
1534static int cyttsp_platform_init(struct i2c_client *client)
1535{
1536 int rc = 0;
1537 static struct kobject *tma340_properties_kobj;
1538
1539 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1540 tma340_properties_kobj = kobject_create_and_add("board_properties",
1541 NULL);
1542 if (tma340_properties_kobj)
1543 rc = sysfs_create_group(tma340_properties_kobj,
1544 &tma340_properties_attr_group);
1545 if (!tma340_properties_kobj || rc)
1546 pr_err("%s: failed to create board_properties\n",
1547 __func__);
1548
1549 return 0;
1550}
1551
1552static struct cyttsp_regulator cyttsp_regulator_data[] = {
1553 {
1554 .name = "vdd",
1555 .min_uV = CY_TMA300_VTG_MIN_UV,
1556 .max_uV = CY_TMA300_VTG_MAX_UV,
1557 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1558 .lpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1559 },
1560 {
1561 .name = "vcc_i2c",
1562 .min_uV = CY_I2C_VTG_MIN_UV,
1563 .max_uV = CY_I2C_VTG_MAX_UV,
1564 .hpm_load_uA = CY_I2C_CURR_UA,
1565 .lpm_load_uA = CY_I2C_CURR_UA,
1566 },
1567};
1568
1569static struct cyttsp_platform_data cyttsp_pdata = {
1570 .panel_maxx = 634,
1571 .panel_maxy = 1166,
1572 .disp_maxx = 599,
1573 .disp_maxy = 1023,
1574 .disp_minx = 0,
1575 .disp_miny = 0,
1576 .flags = 0x01,
1577 .gen = CY_GEN3,
1578 .use_st = CY_USE_ST,
1579 .use_mt = CY_USE_MT,
1580 .use_hndshk = CY_SEND_HNDSHK,
1581 .use_trk_id = CY_USE_TRACKING_ID,
1582 .use_sleep = CY_USE_DEEP_SLEEP_SEL,
1583 .use_gestures = CY_USE_GESTURES,
1584 .fw_fname = "cyttsp_8064_mtp.hex",
1585 /* change act_intrvl to customize the Active power state
1586 * scanning/processing refresh interval for Operating mode
1587 */
1588 .act_intrvl = CY_ACT_INTRVL_DFLT,
1589 /* change tch_tmout to customize the touch timeout for the
1590 * Active power state for Operating mode
1591 */
1592 .tch_tmout = CY_TCH_TMOUT_DFLT,
1593 /* change lp_intrvl to customize the Low Power power state
1594 * scanning/processing refresh interval for Operating mode
1595 */
1596 .lp_intrvl = CY_LP_INTRVL_DFLT,
1597 .sleep_gpio = CYTTSP_TS_GPIO_SLEEP,
Amy Maloche9ba3ffe2012-04-26 10:31:20 -07001598 .resout_gpio = -1,
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001599 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1600 .regulator_info = cyttsp_regulator_data,
1601 .num_regulators = ARRAY_SIZE(cyttsp_regulator_data),
1602 .init = cyttsp_platform_init,
1603 .correct_fw_ver = 17,
1604};
1605
1606static struct i2c_board_info cyttsp_info[] __initdata = {
1607 {
1608 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1609 .platform_data = &cyttsp_pdata,
1610 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1611 },
1612};
Jing Lin21ed4de2012-02-05 15:53:28 -08001613
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001614#define MSM_WCNSS_PHYS 0x03000000
1615#define MSM_WCNSS_SIZE 0x280000
1616
1617static struct resource resources_wcnss_wlan[] = {
1618 {
1619 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1620 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1621 .name = "wcnss_wlanrx_irq",
1622 .flags = IORESOURCE_IRQ,
1623 },
1624 {
1625 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1626 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1627 .name = "wcnss_wlantx_irq",
1628 .flags = IORESOURCE_IRQ,
1629 },
1630 {
1631 .start = MSM_WCNSS_PHYS,
1632 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1633 .name = "wcnss_mmio",
1634 .flags = IORESOURCE_MEM,
1635 },
1636 {
1637 .start = 64,
1638 .end = 68,
1639 .name = "wcnss_gpios_5wire",
1640 .flags = IORESOURCE_IO,
1641 },
1642};
1643
1644static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1645 .has_48mhz_xo = 1,
1646};
1647
1648static struct platform_device msm_device_wcnss_wlan = {
1649 .name = "wcnss_wlan",
1650 .id = 0,
1651 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1652 .resource = resources_wcnss_wlan,
1653 .dev = {.platform_data = &qcom_wcnss_pdata},
1654};
1655
Ankit Vermab7c26e62012-02-28 15:04:15 -08001656static struct platform_device msm_device_iris_fm __devinitdata = {
1657 .name = "iris_fm",
1658 .id = -1,
1659};
1660
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001661#ifdef CONFIG_QSEECOM
1662/* qseecom bus scaling */
1663static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
1664 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001665 .src = MSM_BUS_MASTER_ADM_PORT0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001666 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001667 .ab = 0,
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001668 .ib = 0,
1669 },
1670 {
1671 .src = MSM_BUS_MASTER_ADM_PORT1,
1672 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1673 .ab = 0,
1674 .ib = 0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001675 },
1676 {
1677 .src = MSM_BUS_MASTER_SPDM,
1678 .dst = MSM_BUS_SLAVE_SPDM,
1679 .ib = 0,
1680 .ab = 0,
1681 },
1682};
1683
1684static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
1685 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001686 .src = MSM_BUS_MASTER_ADM_PORT0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001687 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001688 .ab = 70000000UL,
1689 .ib = 70000000UL,
1690 },
1691 {
1692 .src = MSM_BUS_MASTER_ADM_PORT1,
1693 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1694 .ab = 2480000000UL,
1695 .ib = 2480000000UL,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001696 },
1697 {
1698 .src = MSM_BUS_MASTER_SPDM,
1699 .dst = MSM_BUS_SLAVE_SPDM,
1700 .ib = 0,
1701 .ab = 0,
1702 },
1703};
1704
1705static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1706 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001707 .src = MSM_BUS_MASTER_ADM_PORT0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001708 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001709 .ab = 0,
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001710 .ib = 0,
1711 },
1712 {
1713 .src = MSM_BUS_MASTER_ADM_PORT1,
1714 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1715 .ab = 0,
1716 .ib = 0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001717 },
1718 {
1719 .src = MSM_BUS_MASTER_SPDM,
1720 .dst = MSM_BUS_SLAVE_SPDM,
1721 .ib = (64 * 8) * 1000000UL,
1722 .ab = (64 * 8) * 100000UL,
1723 },
1724};
1725
Ramesh Masavarapu8d756582012-10-03 10:18:06 -07001726static struct msm_bus_vectors qseecom_enable_dfab_sfpb_vectors[] = {
1727 {
1728 .src = MSM_BUS_MASTER_ADM_PORT0,
1729 .dst = MSM_BUS_SLAVE_EBI_CH0,
1730 .ab = 70000000UL,
1731 .ib = 70000000UL,
1732 },
1733 {
1734 .src = MSM_BUS_MASTER_ADM_PORT1,
1735 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1736 .ab = 2480000000UL,
1737 .ib = 2480000000UL,
1738 },
1739 {
1740 .src = MSM_BUS_MASTER_SPDM,
1741 .dst = MSM_BUS_SLAVE_SPDM,
1742 .ib = (64 * 8) * 1000000UL,
1743 .ab = (64 * 8) * 100000UL,
1744 },
1745};
1746
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001747static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1748 {
1749 ARRAY_SIZE(qseecom_clks_init_vectors),
1750 qseecom_clks_init_vectors,
1751 },
1752 {
1753 ARRAY_SIZE(qseecom_enable_dfab_vectors),
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001754 qseecom_enable_dfab_vectors,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001755 },
1756 {
1757 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1758 qseecom_enable_sfpb_vectors,
1759 },
Ramesh Masavarapu8d756582012-10-03 10:18:06 -07001760 {
1761 ARRAY_SIZE(qseecom_enable_dfab_sfpb_vectors),
1762 qseecom_enable_dfab_sfpb_vectors,
1763 },
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001764};
1765
1766static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1767 qseecom_hw_bus_scale_usecases,
1768 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1769 .name = "qsee",
1770};
1771
1772static struct platform_device qseecom_device = {
1773 .name = "qseecom",
1774 .id = 0,
1775 .dev = {
1776 .platform_data = &qseecom_bus_pdata,
1777 },
1778};
1779#endif
1780
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001781#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1782 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1783 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1784 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1785
1786#define QCE_SIZE 0x10000
1787#define QCE_0_BASE 0x11000000
1788
1789#define QCE_HW_KEY_SUPPORT 0
1790#define QCE_SHA_HMAC_SUPPORT 1
1791#define QCE_SHARE_CE_RESOURCE 3
1792#define QCE_CE_SHARED 0
1793
1794static struct resource qcrypto_resources[] = {
1795 [0] = {
1796 .start = QCE_0_BASE,
1797 .end = QCE_0_BASE + QCE_SIZE - 1,
1798 .flags = IORESOURCE_MEM,
1799 },
1800 [1] = {
1801 .name = "crypto_channels",
1802 .start = DMOV8064_CE_IN_CHAN,
1803 .end = DMOV8064_CE_OUT_CHAN,
1804 .flags = IORESOURCE_DMA,
1805 },
1806 [2] = {
1807 .name = "crypto_crci_in",
1808 .start = DMOV8064_CE_IN_CRCI,
1809 .end = DMOV8064_CE_IN_CRCI,
1810 .flags = IORESOURCE_DMA,
1811 },
1812 [3] = {
1813 .name = "crypto_crci_out",
1814 .start = DMOV8064_CE_OUT_CRCI,
1815 .end = DMOV8064_CE_OUT_CRCI,
1816 .flags = IORESOURCE_DMA,
1817 },
1818};
1819
1820static struct resource qcedev_resources[] = {
1821 [0] = {
1822 .start = QCE_0_BASE,
1823 .end = QCE_0_BASE + QCE_SIZE - 1,
1824 .flags = IORESOURCE_MEM,
1825 },
1826 [1] = {
1827 .name = "crypto_channels",
1828 .start = DMOV8064_CE_IN_CHAN,
1829 .end = DMOV8064_CE_OUT_CHAN,
1830 .flags = IORESOURCE_DMA,
1831 },
1832 [2] = {
1833 .name = "crypto_crci_in",
1834 .start = DMOV8064_CE_IN_CRCI,
1835 .end = DMOV8064_CE_IN_CRCI,
1836 .flags = IORESOURCE_DMA,
1837 },
1838 [3] = {
1839 .name = "crypto_crci_out",
1840 .start = DMOV8064_CE_OUT_CRCI,
1841 .end = DMOV8064_CE_OUT_CRCI,
1842 .flags = IORESOURCE_DMA,
1843 },
1844};
1845
1846#endif
1847
1848#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1849 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1850
1851static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1852 .ce_shared = QCE_CE_SHARED,
1853 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1854 .hw_key_support = QCE_HW_KEY_SUPPORT,
1855 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001856 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001857};
1858
1859static struct platform_device qcrypto_device = {
1860 .name = "qcrypto",
1861 .id = 0,
1862 .num_resources = ARRAY_SIZE(qcrypto_resources),
1863 .resource = qcrypto_resources,
1864 .dev = {
1865 .coherent_dma_mask = DMA_BIT_MASK(32),
1866 .platform_data = &qcrypto_ce_hw_suppport,
1867 },
1868};
1869#endif
1870
1871#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1872 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1873
1874static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1875 .ce_shared = QCE_CE_SHARED,
1876 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1877 .hw_key_support = QCE_HW_KEY_SUPPORT,
1878 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001879 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001880};
1881
1882static struct platform_device qcedev_device = {
1883 .name = "qce",
1884 .id = 0,
1885 .num_resources = ARRAY_SIZE(qcedev_resources),
1886 .resource = qcedev_resources,
1887 .dev = {
1888 .coherent_dma_mask = DMA_BIT_MASK(32),
1889 .platform_data = &qcedev_ce_hw_suppport,
1890 },
1891};
1892#endif
1893
Joel Kingef390842012-05-23 16:42:48 -07001894static struct mdm_vddmin_resource mdm_vddmin_rscs = {
1895 .rpm_id = MSM_RPM_ID_VDDMIN_GPIO,
1896 .ap2mdm_vddmin_gpio = 30,
1897 .modes = 0x03,
1898 .drive_strength = 8,
1899 .mdm2ap_vddmin_gpio = 80,
1900};
1901
Joel King269aa602012-07-23 08:07:35 -07001902static struct gpiomux_setting mdm2ap_status_gpio_run_cfg = {
1903 .func = GPIOMUX_FUNC_GPIO,
1904 .drv = GPIOMUX_DRV_8MA,
1905 .pull = GPIOMUX_PULL_NONE,
1906};
1907
Joel Kingdacbc822012-01-25 13:30:57 -08001908static struct mdm_platform_data mdm_platform_data = {
1909 .mdm_version = "3.0",
1910 .ramdump_delay_ms = 2000,
Joel King14fe7fa2012-05-27 14:26:11 -07001911 .early_power_on = 1,
1912 .sfr_query = 1,
Joel Kingbf3e4b52012-09-26 09:10:34 -07001913 .send_shdn = 1,
Joel Kingef390842012-05-23 16:42:48 -07001914 .vddmin_resource = &mdm_vddmin_rscs,
Hemant Kumara945b472012-01-25 15:08:06 -08001915 .peripheral_platform_device = &apq8064_device_hsic_host,
Ameya Thakurc9a7a842012-06-24 22:47:52 -07001916 .ramdump_timeout_ms = 120000,
Joel King269aa602012-07-23 08:07:35 -07001917 .mdm2ap_status_gpio_run_cfg = &mdm2ap_status_gpio_run_cfg,
Joel Kingdacbc822012-01-25 13:30:57 -08001918};
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001919
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001920static struct tsens_platform_data apq_tsens_pdata = {
1921 .tsens_factor = 1000,
1922 .hw_type = APQ_8064,
1923 .tsens_num_sensor = 11,
1924 .slope = {1176, 1176, 1154, 1176, 1111,
1925 1132, 1132, 1199, 1132, 1199, 1132},
1926};
1927
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07001928static struct platform_device msm_tsens_device = {
1929 .name = "tsens8960-tm",
1930 .id = -1,
1931};
1932
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06001933static struct msm_thermal_data msm_thermal_pdata = {
1934 .sensor_id = 7,
Eugene Seah2ee4a5d2012-06-25 18:16:41 -06001935 .poll_ms = 250,
1936 .limit_temp_degC = 60,
1937 .temp_hysteresis_degC = 10,
1938 .freq_step = 2,
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06001939};
1940
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001941#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001942static void __init apq8064_map_io(void)
1943{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001944 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001945 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001946 if (socinfo_init() < 0)
1947 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001948}
1949
1950static void __init apq8064_init_irq(void)
1951{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001952 struct msm_mpm_device_data *data = NULL;
1953
1954#ifdef CONFIG_MSM_MPM
1955 data = &apq8064_mpm_dev_data;
1956#endif
1957
1958 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001959 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1960 (void *)MSM_QGIC_CPU_BASE);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001961}
1962
Abhishek Kharbanda72dc72e2012-06-07 13:41:37 -07001963static struct msm_mhl_platform_data mhl_platform_data = {
1964 .irq = MSM_GPIO_TO_INT(MHL_GPIO_INT),
1965 .gpio_mhl_int = MHL_GPIO_INT,
1966 .gpio_mhl_reset = MHL_GPIO_RESET,
1967 .gpio_mhl_power = 0,
1968 .gpio_hdmi_mhl_mux = 0,
1969};
1970
1971static struct i2c_board_info sii_device_info[] __initdata = {
1972 {
1973 /*
1974 * keeps SI 8334 as the default
1975 * MHL TX
1976 */
1977 I2C_BOARD_INFO("sii8334", 0x39),
1978 .platform_data = &mhl_platform_data,
1979 .flags = I2C_CLIENT_WAKE,
1980 },
1981};
1982
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001983static struct platform_device msm8064_device_saw_regulator_core0 = {
1984 .name = "saw-regulator",
1985 .id = 0,
1986 .dev = {
1987 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
1988 },
1989};
1990
1991static struct platform_device msm8064_device_saw_regulator_core1 = {
1992 .name = "saw-regulator",
1993 .id = 1,
1994 .dev = {
1995 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
1996 },
1997};
1998
1999static struct platform_device msm8064_device_saw_regulator_core2 = {
2000 .name = "saw-regulator",
2001 .id = 2,
2002 .dev = {
2003 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
2004 },
2005};
2006
2007static struct platform_device msm8064_device_saw_regulator_core3 = {
2008 .name = "saw-regulator",
2009 .id = 3,
2010 .dev = {
2011 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002012
2013 },
2014};
2015
Oluwafemi Adeyemif5a31422012-03-08 16:58:45 -08002016static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06002017 {
2018 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2019 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2020 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002021 1, 784, 180000, 100,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002022 },
2023
2024 {
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002025 MSM_PM_SLEEP_MODE_RETENTION,
2026 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2027 true,
2028 415, 715, 340827, 475,
2029 },
2030
2031 {
Praveen Chidambaram78499012011-11-01 17:15:17 -06002032 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2033 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2034 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002035 1300, 228, 1200000, 2000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002036 },
2037
2038 {
2039 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2040 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2041 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002042 2000, 138, 1208400, 3200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002043 },
2044
2045 {
2046 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Praveen Chidambarame3380672012-02-08 10:32:27 -07002047 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2048 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002049 6000, 119, 1850300, 9000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002050 },
2051
2052 {
2053 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2054 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2055 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002056 9200, 68, 2839200, 16400,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002057 },
2058
2059 {
2060 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2061 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2062 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002063 10300, 63, 3128000, 18200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002064 },
2065
2066 {
2067 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2068 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2069 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002070 18000, 10, 4602600, 27000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002071 },
2072
2073 {
2074 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2075 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2076 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002077 20000, 2, 5752000, 32000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002078 },
2079};
2080
2081static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2082 .mode = MSM_PM_BOOT_CONFIG_TZ,
2083};
2084
2085static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2086 .levels = &msm_rpmrs_levels[0],
2087 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2088 .vdd_mem_levels = {
2089 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2090 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2091 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2092 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2093 },
2094 .vdd_dig_levels = {
2095 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
2096 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
2097 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
2098 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
2099 },
2100 .vdd_mask = 0x7FFFFF,
2101 .rpmrs_target_id = {
2102 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2103 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
2104 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
2105 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
2106 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
2107 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
2108 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2109 },
2110};
2111
Praveen Chidambaram78499012011-11-01 17:15:17 -06002112static uint8_t spm_wfi_cmd_sequence[] __initdata = {
2113 0x03, 0x0f,
2114};
2115
2116static uint8_t spm_power_collapse_without_rpm[] __initdata = {
2117 0x00, 0x24, 0x54, 0x10,
2118 0x09, 0x03, 0x01,
2119 0x10, 0x54, 0x30, 0x0C,
2120 0x24, 0x30, 0x0f,
2121};
2122
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002123static uint8_t spm_retention_cmd_sequence[] __initdata = {
2124 0x00, 0x05, 0x03, 0x0D,
2125 0x0B, 0x00, 0x0f,
2126};
2127
Praveen Chidambaram78499012011-11-01 17:15:17 -06002128static uint8_t spm_power_collapse_with_rpm[] __initdata = {
2129 0x00, 0x24, 0x54, 0x10,
2130 0x09, 0x07, 0x01, 0x0B,
2131 0x10, 0x54, 0x30, 0x0C,
2132 0x24, 0x30, 0x0f,
2133};
2134
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002135static struct msm_spm_seq_entry msm_spm_boot_cpu_seq_list[] __initdata = {
2136 [0] = {
2137 .mode = MSM_SPM_MODE_CLOCK_GATING,
2138 .notify_rpm = false,
2139 .cmd = spm_wfi_cmd_sequence,
2140 },
2141 [1] = {
2142 .mode = MSM_SPM_MODE_POWER_RETENTION,
2143 .notify_rpm = false,
2144 .cmd = spm_retention_cmd_sequence,
2145 },
2146 [2] = {
2147 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2148 .notify_rpm = false,
2149 .cmd = spm_power_collapse_without_rpm,
2150 },
2151 [3] = {
2152 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2153 .notify_rpm = true,
2154 .cmd = spm_power_collapse_with_rpm,
2155 },
2156};
2157static struct msm_spm_seq_entry msm_spm_nonboot_cpu_seq_list[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06002158 [0] = {
2159 .mode = MSM_SPM_MODE_CLOCK_GATING,
2160 .notify_rpm = false,
2161 .cmd = spm_wfi_cmd_sequence,
2162 },
2163 [1] = {
2164 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2165 .notify_rpm = false,
2166 .cmd = spm_power_collapse_without_rpm,
2167 },
2168 [2] = {
2169 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2170 .notify_rpm = true,
2171 .cmd = spm_power_collapse_with_rpm,
2172 },
2173};
2174
2175static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
2176 0x00, 0x20, 0x03, 0x20,
2177 0x00, 0x0f,
2178};
2179
2180static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
2181 0x00, 0x20, 0x34, 0x64,
2182 0x48, 0x07, 0x48, 0x20,
2183 0x50, 0x64, 0x04, 0x34,
2184 0x50, 0x0f,
2185};
2186static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
2187 0x00, 0x10, 0x34, 0x64,
2188 0x48, 0x07, 0x48, 0x10,
2189 0x50, 0x64, 0x04, 0x34,
2190 0x50, 0x0F,
2191};
2192
2193static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
2194 [0] = {
2195 .mode = MSM_SPM_L2_MODE_RETENTION,
2196 .notify_rpm = false,
2197 .cmd = l2_spm_wfi_cmd_sequence,
2198 },
2199 [1] = {
2200 .mode = MSM_SPM_L2_MODE_GDHS,
2201 .notify_rpm = true,
2202 .cmd = l2_spm_gdhs_cmd_sequence,
2203 },
2204 [2] = {
2205 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
2206 .notify_rpm = true,
2207 .cmd = l2_spm_power_off_cmd_sequence,
2208 },
2209};
2210
2211
2212static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
2213 [0] = {
2214 .reg_base_addr = MSM_SAW_L2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002215 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07002216 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002217 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
2218 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
2219 .modes = msm_spm_l2_seq_list,
2220 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
2221 },
2222};
2223
2224static struct msm_spm_platform_data msm_spm_data[] __initdata = {
2225 [0] = {
2226 .reg_base_addr = MSM_SAW0_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002227 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002228#if defined(CONFIG_MSM_AVS_HW)
2229 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2230 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2231#endif
2232 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002233 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004,
2234 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C,
2235 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002236 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002237 .num_modes = ARRAY_SIZE(msm_spm_boot_cpu_seq_list),
2238 .modes = msm_spm_boot_cpu_seq_list,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002239 },
2240 [1] = {
2241 .reg_base_addr = MSM_SAW1_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002242 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002243#if defined(CONFIG_MSM_AVS_HW)
2244 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2245 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2246#endif
2247 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07002248 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002249 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2250 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2251 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002252 .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
2253 .modes = msm_spm_nonboot_cpu_seq_list,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002254 },
2255 [2] = {
2256 .reg_base_addr = MSM_SAW2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002257 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002258#if defined(CONFIG_MSM_AVS_HW)
2259 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2260 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2261#endif
2262 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07002263 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002264 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2265 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2266 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002267 .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
2268 .modes = msm_spm_nonboot_cpu_seq_list,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002269 },
2270 [3] = {
2271 .reg_base_addr = MSM_SAW3_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002272 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002273#if defined(CONFIG_MSM_AVS_HW)
2274 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2275 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2276#endif
2277 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07002278 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002279 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2280 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2281 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002282 .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
2283 .modes = msm_spm_nonboot_cpu_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08002284 },
2285};
2286
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002287static void __init apq8064_init_buses(void)
2288{
2289 msm_bus_rpm_set_mt_mask();
2290 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
2291 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
2292 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
2293 msm_bus_8064_apps_fabric.dev.platform_data =
2294 &msm_bus_8064_apps_fabric_pdata;
2295 msm_bus_8064_sys_fabric.dev.platform_data =
2296 &msm_bus_8064_sys_fabric_pdata;
2297 msm_bus_8064_mm_fabric.dev.platform_data =
2298 &msm_bus_8064_mm_fabric_pdata;
2299 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
2300 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
2301}
2302
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002303/* PCIe gpios */
2304static struct msm_pcie_gpio_info_t msm_pcie_gpio_info[MSM_PCIE_MAX_GPIO] = {
2305 {"rst_n", PM8921_MPP_PM_TO_SYS(PCIE_RST_N_PMIC_MPP), 0},
2306 {"pwr_en", PM8921_GPIO_PM_TO_SYS(PCIE_PWR_EN_PMIC_GPIO), 1},
2307};
2308
2309static struct msm_pcie_platform msm_pcie_platform_data = {
2310 .gpio = msm_pcie_gpio_info,
Niranjana Vishwanathapura68210ff2012-06-24 18:03:49 -06002311 .axi_addr = PCIE_AXI_BAR_PHYS,
2312 .axi_size = PCIE_AXI_BAR_SIZE,
Niranjana Vishwanathapura459a27d2012-07-20 12:23:55 -06002313 .wake_n = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, PCIE_WAKE_N_PMIC_GPIO),
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002314};
2315
Niranjana Vishwanathapurac1edd402012-06-28 15:32:50 -06002316static int __init mpq8064_pcie_enabled(void)
2317{
2318 return !((readl_relaxed(QFPROM_RAW_FEAT_CONFIG_ROW0_MSB) & BIT(21)) ||
2319 (readl_relaxed(QFPROM_RAW_OEM_CONFIG_ROW0_LSB) & BIT(4)));
2320}
2321
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002322static void __init mpq8064_pcie_init(void)
2323{
Niranjana Vishwanathapurac1edd402012-06-28 15:32:50 -06002324 if (mpq8064_pcie_enabled()) {
2325 msm_device_pcie.dev.platform_data = &msm_pcie_platform_data;
2326 platform_device_register(&msm_device_pcie);
2327 }
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002328}
2329
David Collinsf0d00732012-01-25 15:46:50 -08002330static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
2331 .name = GPIO_REGULATOR_DEV_NAME,
2332 .id = PM8921_MPP_PM_TO_SYS(7),
2333 .dev = {
2334 .platform_data
2335 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2336 },
2337};
2338
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08002339static struct platform_device apq8064_device_ext_mpp8_vreg __devinitdata = {
2340 .name = GPIO_REGULATOR_DEV_NAME,
2341 .id = PM8921_MPP_PM_TO_SYS(8),
2342 .dev = {
2343 .platform_data
2344 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_MPP8],
2345 },
2346};
2347
David Collinsf0d00732012-01-25 15:46:50 -08002348static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
2349 .name = GPIO_REGULATOR_DEV_NAME,
2350 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
2351 .dev = {
2352 .platform_data =
2353 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2354 },
2355};
2356
David Collins390fc332012-02-07 14:38:16 -08002357static struct platform_device apq8064_device_ext_ts_sw_vreg __devinitdata = {
2358 .name = GPIO_REGULATOR_DEV_NAME,
2359 .id = PM8921_GPIO_PM_TO_SYS(23),
2360 .dev = {
2361 .platform_data
2362 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_TS_SW],
2363 },
2364};
2365
David Collins2782b5c2012-02-06 10:02:42 -08002366static struct platform_device apq8064_device_rpm_regulator __devinitdata = {
2367 .name = "rpm-regulator",
David Collins793793b2012-08-21 15:43:02 -07002368 .id = 0,
David Collins2782b5c2012-02-06 10:02:42 -08002369 .dev = {
2370 .platform_data = &apq8064_rpm_regulator_pdata,
2371 },
2372};
2373
David Collins793793b2012-08-21 15:43:02 -07002374static struct platform_device
2375apq8064_pm8921_device_rpm_regulator __devinitdata = {
2376 .name = "rpm-regulator",
2377 .id = 1,
2378 .dev = {
2379 .platform_data = &apq8064_rpm_regulator_pm8921_pdata,
2380 },
2381};
2382
Ravi Kumar V05931a22012-04-04 17:09:37 +05302383static struct gpio_ir_recv_platform_data gpio_ir_recv_pdata = {
2384 .gpio_nr = 88,
2385 .active_low = 1,
Ravi Kumar V16a614c2012-10-12 20:59:56 +05302386 .can_wakeup = true,
Ravi Kumar V05931a22012-04-04 17:09:37 +05302387};
2388
2389static struct platform_device gpio_ir_recv_pdev = {
2390 .name = "gpio-rc-recv",
2391 .dev = {
2392 .platform_data = &gpio_ir_recv_pdata,
2393 },
2394};
2395
Terence Hampson36b70722012-05-10 13:18:16 -04002396static struct platform_device *common_not_mpq_devices[] __initdata = {
David Keitel3c40fc52012-02-09 17:53:52 -08002397 &apq8064_device_qup_i2c_gsbi1,
Jing Lin04601f92012-02-05 15:36:07 -08002398 &apq8064_device_qup_i2c_gsbi3,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002399 &apq8064_device_qup_i2c_gsbi4,
Terence Hampson36b70722012-05-10 13:18:16 -04002400};
2401
Kuirong Wangf8c5e142012-06-21 16:17:32 -07002402static struct platform_device *common_mpq_devices[] __initdata = {
2403 &mpq_cpudai_sec_i2s_rx,
2404 &mpq_cpudai_mi2s_tx,
Aviral Guptabfa97882012-10-16 12:15:59 +05302405 &mpq_cpudai_pseudo,
Kuirong Wangf8c5e142012-06-21 16:17:32 -07002406};
2407
2408static struct platform_device *common_i2s_devices[] __initdata = {
2409 &apq_cpudai_mi2s,
2410 &apq_cpudai_i2s_rx,
2411 &apq_cpudai_i2s_tx,
2412};
2413
David Collins793793b2012-08-21 15:43:02 -07002414static struct platform_device *early_common_devices[] __initdata = {
Matt Wagantallf5cc3892012-06-07 19:47:02 -07002415 &apq8064_device_acpuclk,
Terence Hampson36b70722012-05-10 13:18:16 -04002416 &apq8064_device_dmov,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002417 &apq8064_device_qup_spi_gsbi5,
David Collins793793b2012-08-21 15:43:02 -07002418};
2419
2420static struct platform_device *pm8921_common_devices[] __initdata = {
David Collinsf0d00732012-01-25 15:46:50 -08002421 &apq8064_device_ext_5v_vreg,
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08002422 &apq8064_device_ext_mpp8_vreg,
David Collinsf0d00732012-01-25 15:46:50 -08002423 &apq8064_device_ext_3p3v_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07002424 &apq8064_device_ssbi_pmic1,
2425 &apq8064_device_ssbi_pmic2,
David Collins793793b2012-08-21 15:43:02 -07002426};
2427
2428static struct platform_device *pm8917_common_devices[] __initdata = {
2429 &apq8064_device_ext_mpp8_vreg,
2430 &apq8064_device_ext_3p3v_vreg,
2431 &apq8064_device_ssbi_pmic1,
2432 &apq8064_device_ssbi_pmic2,
David Collins793793b2012-08-21 15:43:02 -07002433};
2434
2435static struct platform_device *common_devices[] __initdata = {
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06002436 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07002437 &apq8064_device_otg,
2438 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08002439 &apq8064_device_hsusb_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07002440 &android_usb_device,
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08002441 &msm_device_wcnss_wlan,
Ankit Vermab7c26e62012-02-28 15:04:15 -08002442 &msm_device_iris_fm,
Larry Bassel67b921d2012-04-06 10:23:27 -07002443 &apq8064_fmem_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08002444#ifdef CONFIG_ANDROID_PMEM
2445#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002446 &apq8064_android_pmem_device,
2447 &apq8064_android_pmem_adsp_device,
2448 &apq8064_android_pmem_audio_device,
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -07002449#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
2450#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -08002451#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002452 &apq8064_ion_dev,
Olav Haugan7c6aa742012-01-16 16:47:37 -08002453#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002454 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08002455 &msm8064_device_saw_regulator_core0,
2456 &msm8064_device_saw_regulator_core1,
2457 &msm8064_device_saw_regulator_core2,
2458 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002459#if defined(CONFIG_QSEECOM)
2460 &qseecom_device,
2461#endif
2462
Joel Nider6b9a7bc2012-06-26 11:19:19 +03002463 &msm_8064_device_tsif[0],
2464 &msm_8064_device_tsif[1],
2465
Ramesh Masavarapu28311912011-10-27 11:04:12 -07002466#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2467 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2468 &qcrypto_device,
2469#endif
2470
2471#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2472 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2473 &qcedev_device,
2474#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07002475
2476#ifdef CONFIG_HW_RANDOM_MSM
2477 &apq8064_device_rng,
2478#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002479 &apq_pcm,
2480 &apq_pcm_routing,
2481 &apq_cpudai0,
2482 &apq_cpudai1,
2483 &apq_cpudai_hdmi_rx,
2484 &apq_cpudai_bt_rx,
2485 &apq_cpudai_bt_tx,
2486 &apq_cpudai_fm_rx,
2487 &apq_cpudai_fm_tx,
2488 &apq_cpu_fe,
2489 &apq_stub_codec,
2490 &apq_voice,
2491 &apq_voip,
2492 &apq_lpa_pcm,
Krishnankutty Kolathappilly4374e332012-03-18 22:27:30 -07002493 &apq_compr_dsp,
2494 &apq_multi_ch_pcm,
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -07002495 &apq_lowlatency_pcm,
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002496 &apq_pcm_hostless,
2497 &apq_cpudai_afe_01_rx,
2498 &apq_cpudai_afe_01_tx,
2499 &apq_cpudai_afe_02_rx,
2500 &apq_cpudai_afe_02_tx,
2501 &apq_pcm_afe,
2502 &apq_cpudai_auxpcm_rx,
2503 &apq_cpudai_auxpcm_tx,
Neema Shetty8427c262012-02-16 11:23:43 -08002504 &apq_cpudai_stub,
Neema Shetty3c9d2862012-03-11 01:25:32 -08002505 &apq_cpudai_slimbus_1_rx,
2506 &apq_cpudai_slimbus_1_tx,
Kiran Kandi97fe19d2012-05-20 22:34:04 -07002507 &apq_cpudai_slimbus_2_rx,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002508 &apq_cpudai_slimbus_2_tx,
Neema Shettyc9d86c32012-05-09 12:01:39 -07002509 &apq_cpudai_slimbus_3_rx,
Helen Zeng38c3c962012-05-17 14:56:20 -07002510 &apq_cpudai_slimbus_3_tx,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002511 &apq8064_rpm_device,
2512 &apq8064_rpm_log_device,
2513 &apq8064_rpm_stat_device,
Anji Jonnala93129922012-10-09 20:57:53 +05302514 &apq8064_rpm_master_stat_device,
Ramesh Masavarapuf31ff242012-05-10 18:55:21 -07002515 &apq_device_tz_log,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002516 &msm_bus_8064_apps_fabric,
2517 &msm_bus_8064_sys_fabric,
2518 &msm_bus_8064_mm_fabric,
2519 &msm_bus_8064_sys_fpb,
2520 &msm_bus_8064_cpss_fpb,
Mohan Kumar Gubbihalli Lachma Naik7f72edd2012-02-06 17:26:47 -08002521 &apq8064_msm_device_vidc,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07002522 &msm_pil_dsps,
Matt Wagantallb94b9a52012-02-02 21:59:54 -08002523 &msm_8960_q6_lpass,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002524 &msm_pil_vidc,
Matt Wagantall292aace2012-01-26 19:12:34 -08002525 &msm_gss,
Laura Abbottb93525f2012-04-12 09:57:19 -07002526 &apq8064_rtb_device,
Abhijeet Dharmapurikarfb4a2f82012-08-23 14:36:59 -07002527 &apq8064_msm_gov_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002528 &apq8064_device_cache_erp,
Stepan Moskovchenko0f3de112012-06-08 18:11:46 -07002529 &msm8960_device_ebi1_ch0_erp,
2530 &msm8960_device_ebi1_ch1_erp,
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002531 &epm_adc_device,
Pratik Patel3b0ca882012-06-01 16:54:14 -07002532 &coresight_tpiu_device,
2533 &coresight_etb_device,
2534 &apq8064_coresight_funnel_device,
2535 &coresight_etm0_device,
2536 &coresight_etm1_device,
2537 &coresight_etm2_device,
2538 &coresight_etm3_device,
Helen Zeng8f925502012-03-05 16:50:17 -08002539 &apq_cpudai_slim_4_rx,
2540 &apq_cpudai_slim_4_tx,
Steve Mucklef132c6c2012-06-06 18:30:57 -07002541#ifdef CONFIG_MSM_GEMINI
Jignesh Mehta921649d2012-04-19 06:57:23 -07002542 &msm8960_gemini_device,
Steve Mucklef132c6c2012-06-06 18:30:57 -07002543#endif
Laura Abbott0577d7b2012-04-17 11:14:30 -07002544 &apq8064_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002545 &msm_tsens_device,
Laura Abbott93a4a352012-05-25 09:26:35 -07002546 &apq8064_cache_dump_device,
Joel Nider0e4a16d2012-08-05 14:20:11 +03002547 &msm_8064_device_tspp,
Binqiang Qiuf165c922012-08-15 18:00:18 -07002548#ifdef CONFIG_BATTERY_BCL
2549 &battery_bcl_device,
2550#endif
Abhijeet Dharmapurikarfb4a2f82012-08-23 14:36:59 -07002551 &apq8064_msm_mpd_device,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002552};
2553
Joel King82b7e3f2012-01-05 10:03:27 -08002554static struct platform_device *cdp_devices[] __initdata = {
2555 &apq8064_device_uart_gsbi1,
Jin Hong4bbbfba2012-02-02 21:48:07 -08002556 &apq8064_device_uart_gsbi7,
Joel King82b7e3f2012-01-05 10:03:27 -08002557 &msm_device_sps_apq8064,
Aravind Venkateswaran4ca27532012-02-16 14:27:05 -08002558#ifdef CONFIG_MSM_ROTATOR
2559 &msm_rotator_device,
2560#endif
Anji Jonnala6c2b6852012-09-21 13:34:44 +05302561 &msm8064_pc_cntr,
Joel King82b7e3f2012-01-05 10:03:27 -08002562};
2563
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002564static struct platform_device
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002565mpq8064_device_ext_1p2_buck_vreg __devinitdata = {
2566 .name = GPIO_REGULATOR_DEV_NAME,
2567 .id = SX150X_GPIO(4, 2),
2568 .dev = {
2569 .platform_data =
2570 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P2V],
2571 },
2572};
2573
2574static struct platform_device
2575mpq8064_device_ext_1p8_buck_vreg __devinitdata = {
2576 .name = GPIO_REGULATOR_DEV_NAME,
2577 .id = SX150X_GPIO(4, 4),
2578 .dev = {
2579 .platform_data =
2580 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P8V],
2581 },
2582};
2583
2584static struct platform_device
2585mpq8064_device_ext_2p2_buck_vreg __devinitdata = {
2586 .name = GPIO_REGULATOR_DEV_NAME,
2587 .id = SX150X_GPIO(4, 14),
2588 .dev = {
2589 .platform_data =
2590 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_2P2V],
2591 },
2592};
2593
2594static struct platform_device
2595mpq8064_device_ext_5v_buck_vreg __devinitdata = {
2596 .name = GPIO_REGULATOR_DEV_NAME,
2597 .id = SX150X_GPIO(4, 3),
2598 .dev = {
2599 .platform_data =
2600 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_5V],
2601 },
2602};
2603
2604static struct platform_device
2605mpq8064_device_ext_3p3v_ldo_vreg __devinitdata = {
2606 .name = GPIO_REGULATOR_DEV_NAME,
2607 .id = SX150X_GPIO(4, 15),
2608 .dev = {
2609 .platform_data =
2610 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_3P3V],
2611 },
2612};
2613
Ravi Kumar V1c903012012-05-15 16:11:35 +05302614static struct platform_device rc_input_loopback_pdev = {
2615 .name = "rc-user-input",
2616 .id = -1,
2617};
2618
Ravi Kumar V040eeff2012-05-23 21:29:23 +05302619static int rf4ce_gpio_init(void)
2620{
Ravi Kumar V92b2b6c2012-08-14 17:18:11 +05302621 if (!machine_is_mpq8064_cdp() &&
2622 !machine_is_mpq8064_hrd() &&
2623 !machine_is_mpq8064_dtv())
Ravi Kumar V040eeff2012-05-23 21:29:23 +05302624 return -EINVAL;
2625
2626 /* CC2533 SRDY Input */
2627 if (!gpio_request(SX150X_GPIO(4, 6), "rf4ce_srdy")) {
2628 gpio_direction_input(SX150X_GPIO(4, 6));
2629 gpio_export(SX150X_GPIO(4, 6), true);
2630 }
2631
2632 /* CC2533 MRDY Output */
2633 if (!gpio_request(SX150X_GPIO(4, 5), "rf4ce_mrdy")) {
2634 gpio_direction_output(SX150X_GPIO(4, 5), 1);
2635 gpio_export(SX150X_GPIO(4, 5), true);
2636 }
2637
2638 /* CC2533 Reset Output */
2639 if (!gpio_request(SX150X_GPIO(4, 7), "rf4ce_reset")) {
2640 gpio_direction_output(SX150X_GPIO(4, 7), 0);
2641 gpio_export(SX150X_GPIO(4, 7), true);
2642 }
2643
2644 return 0;
2645}
2646late_initcall(rf4ce_gpio_init);
2647
Mayank Rana262e9032012-05-10 15:14:00 -07002648#ifdef CONFIG_SERIAL_MSM_HS
2649static int configure_uart_gpios(int on)
2650{
2651 int ret = 0, i;
2652 int uart_gpios[] = {14, 15, 16, 17};
2653
2654 for (i = 0; i < ARRAY_SIZE(uart_gpios); i++) {
2655 if (on) {
2656 ret = gpio_request(uart_gpios[i], NULL);
2657 if (ret) {
2658 pr_err("%s:unable to request uart gpio[%d]\n",
2659 __func__, uart_gpios[i]);
2660 break;
2661 }
2662 } else {
2663 gpio_free(uart_gpios[i]);
2664 }
2665 }
2666
2667 if (ret && on && i)
2668 for (; i >= 0; i--)
2669 gpio_free(uart_gpios[i]);
2670 return ret;
2671}
2672
2673static struct msm_serial_hs_platform_data mpq8064_gsbi6_uartdm_pdata = {
2674 .inject_rx_on_wakeup = 1,
2675 .rx_to_inject = 0xFD,
2676 .gpio_config = configure_uart_gpios,
2677};
2678#else
2679static struct msm_serial_hs_platform_data msm_uart_dm9_pdata;
2680#endif
2681
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002682static struct platform_device *mpq_devices[] __initdata = {
Saket Saurabhd425a5d2012-11-06 16:08:28 +05302683 &mpq8064_device_uart_gsbi5,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002684 &msm_device_sps_apq8064,
2685 &mpq8064_device_qup_i2c_gsbi5,
2686#ifdef CONFIG_MSM_ROTATOR
2687 &msm_rotator_device,
2688#endif
Ravi Kumar V05931a22012-04-04 17:09:37 +05302689 &gpio_ir_recv_pdev,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002690 &mpq8064_device_ext_1p2_buck_vreg,
2691 &mpq8064_device_ext_1p8_buck_vreg,
2692 &mpq8064_device_ext_2p2_buck_vreg,
2693 &mpq8064_device_ext_5v_buck_vreg,
2694 &mpq8064_device_ext_3p3v_ldo_vreg,
Terence Hampson2e1705f2012-04-11 19:55:29 -04002695#ifdef CONFIG_MSM_VCAP
2696 &msm8064_device_vcap,
2697#endif
Ravi Kumar V1c903012012-05-15 16:11:35 +05302698 &rc_input_loopback_pdev,
Bar Weinerf82c5872012-10-23 14:31:26 +02002699 &mpq8064_device_qup_spi_gsbi6,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002700};
2701
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002702static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002703 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002704};
2705
Bar Weinerf82c5872012-10-23 14:31:26 +02002706static struct msm_spi_platform_data mpq8064_qup_spi_gsbi6_pdata = {
2707 .max_clock_speed = 1100000,
2708};
2709
2710static struct ci_bridge_platform_data mpq8064_ci_bridge_pdata = {
2711 .reset_pin = 260,
2712 .interrupt_pin = 261,
2713};
2714
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002715#define KS8851_IRQ_GPIO 43
2716
2717static struct spi_board_info spi_board_info[] __initdata = {
2718 {
2719 .modalias = "ks8851",
2720 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2721 .max_speed_hz = 19200000,
2722 .bus_num = 0,
2723 .chip_select = 2,
2724 .mode = SPI_MODE_0,
2725 },
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002726 {
2727 .modalias = "epm_adc",
2728 .max_speed_hz = 1100000,
2729 .bus_num = 0,
2730 .chip_select = 3,
2731 .mode = SPI_MODE_0,
Bar Weinerf82c5872012-10-23 14:31:26 +02002732 }
2733};
2734
2735static struct spi_board_info mpq8064_spi_board_info[] __initdata = {
2736 {
2737 .modalias = "ci_bridge_spi",
2738 .max_speed_hz = 1000000,
2739 .bus_num = 1,
2740 .chip_select = 0,
2741 .mode = SPI_MODE_0,
2742 .platform_data = &mpq8064_ci_bridge_pdata,
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002743 },
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002744};
2745
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002746static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002747 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08002748 .bus_num = 1,
2749 .slim_slave = &apq8064_slim_tabla,
2750 },
2751 {
2752 .bus_num = 1,
2753 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002754 },
2755 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002756};
2757
David Keitel3c40fc52012-02-09 17:53:52 -08002758static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi1_pdata = {
2759 .clk_freq = 100000,
2760 .src_clk_rate = 24000000,
2761};
2762
Jing Lin04601f92012-02-05 15:36:07 -08002763static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi3_pdata = {
Anirudh Ghayalc2163472012-04-10 14:58:14 +05302764 .clk_freq = 384000,
Jing Lin04601f92012-02-05 15:36:07 -08002765 .src_clk_rate = 24000000,
2766};
2767
Kenneth Heitke748593a2011-07-15 15:45:11 -06002768static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
2769 .clk_freq = 100000,
2770 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002771};
2772
Joel King8f839b92012-04-01 14:37:46 -07002773static struct msm_i2c_platform_data mpq8064_i2c_qup_gsbi5_pdata = {
2774 .clk_freq = 100000,
2775 .src_clk_rate = 24000000,
2776};
2777
David Keitel3c40fc52012-02-09 17:53:52 -08002778#define GSBI_DUAL_MODE_CODE 0x60
2779#define MSM_GSBI1_PHYS 0x12440000
Saket Saurabhd425a5d2012-11-06 16:08:28 +05302780#define MSM_GSBI5_PHYS 0x1A200000
Kenneth Heitke748593a2011-07-15 15:45:11 -06002781static void __init apq8064_i2c_init(void)
2782{
David Keitel3c40fc52012-02-09 17:53:52 -08002783 void __iomem *gsbi_mem;
Saket Saurabhd425a5d2012-11-06 16:08:28 +05302784 if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
2785 machine_is_mpq8064_dtv()) {
2786 gsbi_mem = ioremap_nocache(MSM_GSBI5_PHYS, 4);
2787 writel_relaxed(GSBI_DUAL_MODE_CODE, gsbi_mem);
2788 /* Ensure protocol code is written before proceeding */
2789 wmb();
2790 iounmap(gsbi_mem);
2791 mpq8064_i2c_qup_gsbi5_pdata.use_gsbi_shared_mode = 1;
2792 mpq8064_device_qup_i2c_gsbi5.dev.platform_data =
2793 &mpq8064_i2c_qup_gsbi5_pdata;
2794 }
David Keitel3c40fc52012-02-09 17:53:52 -08002795 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2796 &apq8064_i2c_qup_gsbi1_pdata;
2797 gsbi_mem = ioremap_nocache(MSM_GSBI1_PHYS, 4);
2798 writel_relaxed(GSBI_DUAL_MODE_CODE, gsbi_mem);
2799 /* Ensure protocol code is written before proceeding */
2800 wmb();
2801 iounmap(gsbi_mem);
2802 apq8064_i2c_qup_gsbi1_pdata.use_gsbi_shared_mode = 1;
Jing Lin04601f92012-02-05 15:36:07 -08002803 apq8064_device_qup_i2c_gsbi3.dev.platform_data =
2804 &apq8064_i2c_qup_gsbi3_pdata;
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002805 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2806 &apq8064_i2c_qup_gsbi1_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002807 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
2808 &apq8064_i2c_qup_gsbi4_pdata;
Joel King8f839b92012-04-01 14:37:46 -07002809 mpq8064_device_qup_i2c_gsbi5.dev.platform_data =
2810 &mpq8064_i2c_qup_gsbi5_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002811}
2812
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002813#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002814static int ethernet_init(void)
2815{
2816 int ret;
2817 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
2818 if (ret) {
2819 pr_err("ks8851 gpio_request failed: %d\n", ret);
2820 goto fail;
2821 }
2822
2823 return 0;
2824fail:
2825 return ret;
2826}
2827#else
2828static int ethernet_init(void)
2829{
2830 return 0;
2831}
2832#endif
2833
David Collinsd49a1c52012-08-22 13:18:06 -07002834#define GPIO_KEY_HOME PM8921_GPIO_PM_TO_SYS(27)
2835#define GPIO_KEY_VOLUME_UP PM8921_GPIO_PM_TO_SYS(35)
2836#define GPIO_KEY_VOLUME_DOWN_PM8921 PM8921_GPIO_PM_TO_SYS(38)
2837#define GPIO_KEY_VOLUME_DOWN_PM8917 PM8921_GPIO_PM_TO_SYS(30)
2838#define GPIO_KEY_CAM_FOCUS PM8921_GPIO_PM_TO_SYS(3)
2839#define GPIO_KEY_CAM_SNAP PM8921_GPIO_PM_TO_SYS(4)
2840#define GPIO_KEY_ROTATION_PM8921 PM8921_GPIO_PM_TO_SYS(42)
2841#define GPIO_KEY_ROTATION_PM8917 PM8921_GPIO_PM_TO_SYS(8)
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302842
David Collinsd49a1c52012-08-22 13:18:06 -07002843static struct gpio_keys_button cdp_keys_pm8921[] = {
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302844 {
2845 .code = KEY_HOME,
2846 .gpio = GPIO_KEY_HOME,
2847 .desc = "home_key",
2848 .active_low = 1,
2849 .type = EV_KEY,
2850 .wakeup = 1,
2851 .debounce_interval = 15,
2852 },
2853 {
2854 .code = KEY_VOLUMEUP,
2855 .gpio = GPIO_KEY_VOLUME_UP,
2856 .desc = "volume_up_key",
2857 .active_low = 1,
2858 .type = EV_KEY,
2859 .wakeup = 1,
2860 .debounce_interval = 15,
2861 },
2862 {
2863 .code = KEY_VOLUMEDOWN,
David Collinsd49a1c52012-08-22 13:18:06 -07002864 .gpio = GPIO_KEY_VOLUME_DOWN_PM8921,
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302865 .desc = "volume_down_key",
2866 .active_low = 1,
2867 .type = EV_KEY,
2868 .wakeup = 1,
2869 .debounce_interval = 15,
2870 },
2871 {
2872 .code = SW_ROTATE_LOCK,
David Collinsd49a1c52012-08-22 13:18:06 -07002873 .gpio = GPIO_KEY_ROTATION_PM8921,
2874 .desc = "rotate_key",
2875 .active_low = 1,
2876 .type = EV_SW,
2877 .debounce_interval = 15,
2878 },
2879};
2880
2881static struct gpio_keys_button cdp_keys_pm8917[] = {
2882 {
2883 .code = KEY_HOME,
2884 .gpio = GPIO_KEY_HOME,
2885 .desc = "home_key",
2886 .active_low = 1,
2887 .type = EV_KEY,
2888 .wakeup = 1,
2889 .debounce_interval = 15,
2890 },
2891 {
2892 .code = KEY_VOLUMEUP,
2893 .gpio = GPIO_KEY_VOLUME_UP,
2894 .desc = "volume_up_key",
2895 .active_low = 1,
2896 .type = EV_KEY,
2897 .wakeup = 1,
2898 .debounce_interval = 15,
2899 },
2900 {
2901 .code = KEY_VOLUMEDOWN,
2902 .gpio = GPIO_KEY_VOLUME_DOWN_PM8917,
2903 .desc = "volume_down_key",
2904 .active_low = 1,
2905 .type = EV_KEY,
2906 .wakeup = 1,
2907 .debounce_interval = 15,
2908 },
2909 {
2910 .code = SW_ROTATE_LOCK,
2911 .gpio = GPIO_KEY_ROTATION_PM8917,
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302912 .desc = "rotate_key",
2913 .active_low = 1,
2914 .type = EV_SW,
2915 .debounce_interval = 15,
2916 },
2917};
2918
2919static struct gpio_keys_platform_data cdp_keys_data = {
David Collinsd49a1c52012-08-22 13:18:06 -07002920 .buttons = cdp_keys_pm8921,
2921 .nbuttons = ARRAY_SIZE(cdp_keys_pm8921),
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302922};
2923
2924static struct platform_device cdp_kp_pdev = {
2925 .name = "gpio-keys",
2926 .id = -1,
2927 .dev = {
2928 .platform_data = &cdp_keys_data,
2929 },
2930};
2931
2932static struct gpio_keys_button mtp_keys[] = {
2933 {
2934 .code = KEY_CAMERA_FOCUS,
2935 .gpio = GPIO_KEY_CAM_FOCUS,
2936 .desc = "cam_focus_key",
2937 .active_low = 1,
2938 .type = EV_KEY,
2939 .wakeup = 1,
2940 .debounce_interval = 15,
2941 },
2942 {
2943 .code = KEY_VOLUMEUP,
2944 .gpio = GPIO_KEY_VOLUME_UP,
2945 .desc = "volume_up_key",
2946 .active_low = 1,
2947 .type = EV_KEY,
2948 .wakeup = 1,
2949 .debounce_interval = 15,
2950 },
2951 {
2952 .code = KEY_VOLUMEDOWN,
David Collinsd49a1c52012-08-22 13:18:06 -07002953 .gpio = GPIO_KEY_VOLUME_DOWN_PM8921,
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302954 .desc = "volume_down_key",
2955 .active_low = 1,
2956 .type = EV_KEY,
2957 .wakeup = 1,
2958 .debounce_interval = 15,
2959 },
2960 {
2961 .code = KEY_CAMERA_SNAPSHOT,
2962 .gpio = GPIO_KEY_CAM_SNAP,
2963 .desc = "cam_snap_key",
2964 .active_low = 1,
2965 .type = EV_KEY,
2966 .debounce_interval = 15,
2967 },
2968};
2969
2970static struct gpio_keys_platform_data mtp_keys_data = {
2971 .buttons = mtp_keys,
2972 .nbuttons = ARRAY_SIZE(mtp_keys),
2973};
2974
2975static struct platform_device mtp_kp_pdev = {
2976 .name = "gpio-keys",
2977 .id = -1,
2978 .dev = {
2979 .platform_data = &mtp_keys_data,
2980 },
2981};
2982
Mohan Pallakab8aa8282012-10-04 14:26:21 +05302983#define MPQ_HRD_HOME_GPIO SX150X_EXP2_GPIO_BASE
2984#define MPQ_HRD_VOL_UP_GPIO (SX150X_EXP2_GPIO_BASE + 1)
2985#define MPQ_HRD_VOL_DOWN_GPIO (SX150X_EXP2_GPIO_BASE + 2)
2986#define MPQ_HRD_RIGHT_GPIO (SX150X_EXP2_GPIO_BASE + 3)
2987#define MPQ_HRD_LEFT_GPIO (SX150X_EXP2_GPIO_BASE + 4)
2988#define MPQ_HRD_ENTER_GPIO (SX150X_EXP2_GPIO_BASE + 5)
2989
2990static struct gpio_keys_button mpq_hrd_keys[] = {
2991 {
2992 .code = KEY_HOME,
2993 .gpio = MPQ_HRD_HOME_GPIO,
2994 .desc = "home_key",
2995 .active_low = 1,
2996 .type = EV_KEY,
2997 .wakeup = 1,
2998 .debounce_interval = 15,
2999 },
3000 {
3001 .code = KEY_VOLUMEUP,
3002 .gpio = MPQ_HRD_VOL_UP_GPIO,
3003 .desc = "volume_up_key",
3004 .active_low = 1,
3005 .type = EV_KEY,
3006 .wakeup = 1,
3007 .debounce_interval = 15,
3008 },
3009 {
3010 .code = KEY_VOLUMEDOWN,
3011 .gpio = MPQ_HRD_VOL_DOWN_GPIO,
3012 .desc = "volume_down_key",
3013 .active_low = 1,
3014 .type = EV_KEY,
3015 .wakeup = 1,
3016 .debounce_interval = 15,
3017 },
3018 {
3019 .code = KEY_RIGHT,
3020 .gpio = MPQ_HRD_RIGHT_GPIO,
3021 .desc = "right_key",
3022 .active_low = 1,
3023 .type = EV_KEY,
3024 .wakeup = 1,
3025 .debounce_interval = 15,
3026 },
3027 {
3028 .code = KEY_LEFT,
3029 .gpio = MPQ_HRD_LEFT_GPIO,
3030 .desc = "left_key",
3031 .active_low = 1,
3032 .type = EV_KEY,
3033 .wakeup = 1,
3034 .debounce_interval = 15,
3035 },
3036 {
3037 .code = KEY_ENTER,
3038 .gpio = MPQ_HRD_ENTER_GPIO,
3039 .desc = "enter_key",
3040 .active_low = 1,
3041 .type = EV_KEY,
3042 .wakeup = 1,
3043 .debounce_interval = 15,
3044 },
3045};
3046
3047static struct gpio_keys_platform_data mpq_hrd_keys_pdata = {
3048 .buttons = mpq_hrd_keys,
3049 .nbuttons = ARRAY_SIZE(mpq_hrd_keys),
3050};
3051
3052static struct platform_device mpq_hrd_keys_pdev = {
3053 .name = "gpio-keys",
3054 .id = -1,
3055 .dev = {
3056 .platform_data = &mpq_hrd_keys_pdata,
3057 },
3058};
3059
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05303060static struct gpio_keys_button mpq_keys[] = {
3061 {
3062 .code = KEY_VOLUMEDOWN,
David Collinsd49a1c52012-08-22 13:18:06 -07003063 .gpio = GPIO_KEY_VOLUME_DOWN_PM8921,
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05303064 .desc = "volume_down_key",
3065 .active_low = 1,
3066 .type = EV_KEY,
3067 .wakeup = 1,
3068 .debounce_interval = 15,
3069 },
3070 {
3071 .code = KEY_VOLUMEUP,
3072 .gpio = GPIO_KEY_VOLUME_UP,
3073 .desc = "volume_up_key",
3074 .active_low = 1,
3075 .type = EV_KEY,
3076 .wakeup = 1,
3077 .debounce_interval = 15,
3078 },
3079};
3080
3081static struct gpio_keys_platform_data mpq_keys_data = {
3082 .buttons = mpq_keys,
3083 .nbuttons = ARRAY_SIZE(mpq_keys),
3084};
3085
3086static struct platform_device mpq_gpio_keys_pdev = {
3087 .name = "gpio-keys",
3088 .id = -1,
3089 .dev = {
3090 .platform_data = &mpq_keys_data,
3091 },
3092};
3093
3094#define MPQ_KP_ROW_BASE SX150X_EXP2_GPIO_BASE
3095#define MPQ_KP_COL_BASE (SX150X_EXP2_GPIO_BASE + 4)
3096
3097static unsigned int mpq_row_gpios[] = {MPQ_KP_ROW_BASE, MPQ_KP_ROW_BASE + 1,
3098 MPQ_KP_ROW_BASE + 2, MPQ_KP_ROW_BASE + 3};
3099static unsigned int mpq_col_gpios[] = {MPQ_KP_COL_BASE, MPQ_KP_COL_BASE + 1,
3100 MPQ_KP_COL_BASE + 2};
3101
3102static const unsigned int mpq_keymap[] = {
3103 KEY(0, 0, KEY_UP),
3104 KEY(0, 1, KEY_ENTER),
3105 KEY(0, 2, KEY_3),
3106
3107 KEY(1, 0, KEY_DOWN),
3108 KEY(1, 1, KEY_EXIT),
3109 KEY(1, 2, KEY_4),
3110
3111 KEY(2, 0, KEY_LEFT),
3112 KEY(2, 1, KEY_1),
3113 KEY(2, 2, KEY_5),
3114
3115 KEY(3, 0, KEY_RIGHT),
3116 KEY(3, 1, KEY_2),
3117 KEY(3, 2, KEY_6),
3118};
3119
3120static struct matrix_keymap_data mpq_keymap_data = {
3121 .keymap_size = ARRAY_SIZE(mpq_keymap),
3122 .keymap = mpq_keymap,
3123};
3124
3125static struct matrix_keypad_platform_data mpq_keypad_data = {
3126 .keymap_data = &mpq_keymap_data,
3127 .row_gpios = mpq_row_gpios,
3128 .col_gpios = mpq_col_gpios,
3129 .num_row_gpios = ARRAY_SIZE(mpq_row_gpios),
3130 .num_col_gpios = ARRAY_SIZE(mpq_col_gpios),
3131 .col_scan_delay_us = 32000,
3132 .debounce_ms = 20,
3133 .wakeup = 1,
3134 .active_low = 1,
3135 .no_autorepeat = 1,
3136};
3137
3138static struct platform_device mpq_keypad_device = {
3139 .name = "matrix-keypad",
3140 .id = -1,
3141 .dev = {
3142 .platform_data = &mpq_keypad_data,
3143 },
3144};
3145
Jin Hongd3024e62012-02-09 16:13:32 -08003146/* Sensors DSPS platform data */
3147#define DSPS_PIL_GENERIC_NAME "dsps"
3148static void __init apq8064_init_dsps(void)
3149{
3150 struct msm_dsps_platform_data *pdata =
3151 msm_dsps_device_8064.dev.platform_data;
3152 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
3153 pdata->gpios = NULL;
3154 pdata->gpios_num = 0;
3155
3156 platform_device_register(&msm_dsps_device_8064);
3157}
Mohan Pallaka474b94b2012-01-25 12:59:58 +05303158
Jing Lin417fa452012-02-05 14:31:06 -08003159#define I2C_SURF 1
3160#define I2C_FFA (1 << 1)
3161#define I2C_RUMI (1 << 2)
3162#define I2C_SIM (1 << 3)
3163#define I2C_LIQUID (1 << 4)
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003164#define I2C_MPQ_CDP BIT(5)
3165#define I2C_MPQ_HRD BIT(6)
3166#define I2C_MPQ_DTV BIT(7)
Jing Lin417fa452012-02-05 14:31:06 -08003167
3168struct i2c_registry {
3169 u8 machs;
3170 int bus;
3171 struct i2c_board_info *info;
3172 int len;
3173};
3174
3175static struct i2c_registry apq8064_i2c_devices[] __initdata = {
Jing Lin21ed4de2012-02-05 15:53:28 -08003176 {
David Keitel2f613d92012-02-15 11:29:16 -08003177 I2C_LIQUID,
3178 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
3179 smb349_charger_i2c_info,
3180 ARRAY_SIZE(smb349_charger_i2c_info)
3181 },
3182 {
Jing Lin21ed4de2012-02-05 15:53:28 -08003183 I2C_SURF | I2C_LIQUID,
3184 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
3185 mxt_device_info,
3186 ARRAY_SIZE(mxt_device_info),
3187 },
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08003188 {
3189 I2C_FFA,
3190 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
3191 cyttsp_info,
3192 ARRAY_SIZE(cyttsp_info),
3193 },
Amy Maloche70090f992012-02-16 16:35:26 -08003194 {
3195 I2C_FFA | I2C_LIQUID,
3196 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
3197 isa1200_board_info,
3198 ARRAY_SIZE(isa1200_board_info),
3199 },
Santosh Mardieff9a742012-04-09 23:23:39 +05303200 {
3201 I2C_MPQ_CDP,
3202 APQ_8064_GSBI5_QUP_I2C_BUS_ID,
3203 cs8427_device_info,
3204 ARRAY_SIZE(cs8427_device_info),
3205 },
Abhishek Kharbanda72dc72e2012-06-07 13:41:37 -07003206 {
3207 I2C_SURF | I2C_FFA | I2C_LIQUID,
3208 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
3209 sii_device_info,
3210 ARRAY_SIZE(sii_device_info),
3211 }
Jing Lin417fa452012-02-05 14:31:06 -08003212};
3213
Kuirong Wangf8c5e142012-06-21 16:17:32 -07003214static struct i2c_registry apq8064_tabla_i2c_devices[] __initdata = {
3215 {
3216 .bus = APQ_8064_GSBI1_QUP_I2C_BUS_ID,
3217 .info = apq8064_tabla_i2c_device_info,
3218 .len = ARRAY_SIZE(apq8064_tabla_i2c_device_info),
3219 },
3220};
3221
Jay Chokshi607f61b2012-04-25 18:21:21 -07003222#define SX150X_EXP1_INT_N PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9)
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05303223#define SX150X_EXP2_INT_N MSM_GPIO_TO_INT(81)
Jay Chokshi607f61b2012-04-25 18:21:21 -07003224
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003225struct sx150x_platform_data mpq8064_sx150x_pdata[] = {
3226 [SX150X_EXP1] = {
3227 .gpio_base = SX150X_EXP1_GPIO_BASE,
3228 .oscio_is_gpo = false,
3229 .io_pullup_ena = 0x0,
3230 .io_pulldn_ena = 0x0,
3231 .io_open_drain_ena = 0x0,
3232 .io_polarity = 0,
Jay Chokshi607f61b2012-04-25 18:21:21 -07003233 .irq_summary = SX150X_EXP1_INT_N,
3234 .irq_base = SX150X_EXP1_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003235 },
3236 [SX150X_EXP2] = {
3237 .gpio_base = SX150X_EXP2_GPIO_BASE,
3238 .oscio_is_gpo = false,
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05303239 .io_pullup_ena = 0x0f,
3240 .io_pulldn_ena = 0x70,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003241 .io_open_drain_ena = 0x0,
3242 .io_polarity = 0,
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05303243 .irq_summary = SX150X_EXP2_INT_N,
3244 .irq_base = SX150X_EXP2_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003245 },
3246 [SX150X_EXP3] = {
3247 .gpio_base = SX150X_EXP3_GPIO_BASE,
3248 .oscio_is_gpo = false,
3249 .io_pullup_ena = 0x0,
3250 .io_pulldn_ena = 0x0,
3251 .io_open_drain_ena = 0x0,
3252 .io_polarity = 0,
3253 .irq_summary = -1,
3254 },
3255 [SX150X_EXP4] = {
3256 .gpio_base = SX150X_EXP4_GPIO_BASE,
3257 .oscio_is_gpo = false,
3258 .io_pullup_ena = 0x0,
3259 .io_pulldn_ena = 0x0,
3260 .io_open_drain_ena = 0x0,
3261 .io_polarity = 0,
3262 .irq_summary = -1,
3263 },
3264};
3265
3266static struct i2c_board_info sx150x_gpio_exp_info[] = {
3267 {
3268 I2C_BOARD_INFO("sx1509q", 0x70),
3269 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP1],
3270 },
3271 {
3272 I2C_BOARD_INFO("sx1508q", 0x23),
3273 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP2],
3274 },
3275 {
3276 I2C_BOARD_INFO("sx1508q", 0x22),
3277 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP3],
3278 },
3279 {
3280 I2C_BOARD_INFO("sx1509q", 0x3E),
3281 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP4],
3282 },
3283};
3284
3285#define MPQ8064_I2C_GSBI5_BUS_ID 5
3286
3287static struct i2c_registry mpq8064_i2c_devices[] __initdata = {
3288 {
3289 I2C_MPQ_CDP,
3290 MPQ8064_I2C_GSBI5_BUS_ID,
3291 sx150x_gpio_exp_info,
3292 ARRAY_SIZE(sx150x_gpio_exp_info),
3293 },
3294};
3295
Jing Lin417fa452012-02-05 14:31:06 -08003296static void __init register_i2c_devices(void)
3297{
3298 u8 mach_mask = 0;
3299 int i;
Kuirong Wangf8c5e142012-06-21 16:17:32 -07003300 u32 version;
Jing Lin417fa452012-02-05 14:31:06 -08003301
Kevin Chand07220e2012-02-13 15:52:22 -08003302#ifdef CONFIG_MSM_CAMERA
3303 struct i2c_registry apq8064_camera_i2c_devices = {
3304 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_RUMI,
3305 APQ_8064_GSBI4_QUP_I2C_BUS_ID,
3306 apq8064_camera_board_info.board_info,
3307 apq8064_camera_board_info.num_i2c_board_info,
3308 };
3309#endif
Jing Lin417fa452012-02-05 14:31:06 -08003310 /* Build the matching 'supported_machs' bitmask */
3311 if (machine_is_apq8064_cdp())
3312 mach_mask = I2C_SURF;
3313 else if (machine_is_apq8064_mtp())
3314 mach_mask = I2C_FFA;
3315 else if (machine_is_apq8064_liquid())
3316 mach_mask = I2C_LIQUID;
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003317 else if (PLATFORM_IS_MPQ8064())
3318 mach_mask = I2C_MPQ_CDP;
Jing Lin417fa452012-02-05 14:31:06 -08003319 else
3320 pr_err("unmatched machine ID in register_i2c_devices\n");
3321
3322 /* Run the array and install devices as appropriate */
3323 for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) {
3324 if (apq8064_i2c_devices[i].machs & mach_mask)
3325 i2c_register_board_info(apq8064_i2c_devices[i].bus,
3326 apq8064_i2c_devices[i].info,
3327 apq8064_i2c_devices[i].len);
3328 }
Kevin Chand07220e2012-02-13 15:52:22 -08003329#ifdef CONFIG_MSM_CAMERA
3330 if (apq8064_camera_i2c_devices.machs & mach_mask)
3331 i2c_register_board_info(apq8064_camera_i2c_devices.bus,
3332 apq8064_camera_i2c_devices.info,
3333 apq8064_camera_i2c_devices.len);
3334#endif
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003335
3336 for (i = 0; i < ARRAY_SIZE(mpq8064_i2c_devices); ++i) {
3337 if (mpq8064_i2c_devices[i].machs & mach_mask)
3338 i2c_register_board_info(
3339 mpq8064_i2c_devices[i].bus,
3340 mpq8064_i2c_devices[i].info,
3341 mpq8064_i2c_devices[i].len);
3342 }
Kuirong Wangf8c5e142012-06-21 16:17:32 -07003343
3344 if (machine_is_apq8064_mtp()) {
3345 version = socinfo_get_platform_version();
3346 if (SOCINFO_VERSION_MINOR(version) == 1)
3347 for (i = 0; i < ARRAY_SIZE(apq8064_tabla_i2c_devices);
3348 ++i)
3349 i2c_register_board_info(
3350 apq8064_tabla_i2c_devices[i].bus,
3351 apq8064_tabla_i2c_devices[i].info,
3352 apq8064_tabla_i2c_devices[i].len);
3353 }
3354
Jing Lin417fa452012-02-05 14:31:06 -08003355}
3356
Jay Chokshi994ff122012-03-27 15:43:48 -07003357static void enable_ddr3_regulator(void)
3358{
3359 static struct regulator *ext_ddr3;
3360
3361 /* Use MPP7 output state as a flag for PCDDR3 presence. */
3362 if (gpio_get_value_cansleep(PM8921_MPP_PM_TO_SYS(7)) > 0) {
3363 ext_ddr3 = regulator_get(NULL, "ext_ddr3");
3364 if (IS_ERR(ext_ddr3) || ext_ddr3 == NULL)
3365 pr_err("Could not get MPP7 regulator\n");
3366 else
3367 regulator_enable(ext_ddr3);
3368 }
3369}
3370
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003371static void enable_avc_i2c_bus(void)
3372{
3373 int avc_i2c_en_mpp = PM8921_MPP_PM_TO_SYS(8);
3374 int rc;
3375
3376 rc = gpio_request(avc_i2c_en_mpp, "avc_i2c_en");
3377 if (rc)
3378 pr_err("request for avc_i2c_en mpp failed,"
3379 "rc=%d\n", rc);
3380 else
3381 gpio_set_value_cansleep(avc_i2c_en_mpp, 1);
3382}
3383
David Collinsd49a1c52012-08-22 13:18:06 -07003384/* Modify platform data values to match requirements for PM8917. */
3385static void __init apq8064_pm8917_pdata_fixup(void)
3386{
3387 cdp_keys_data.buttons = cdp_keys_pm8917;
3388 cdp_keys_data.nbuttons = ARRAY_SIZE(cdp_keys_pm8917);
3389}
3390
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003391static void __init apq8064_common_init(void)
3392{
Kuirong Wangf8c5e142012-06-21 16:17:32 -07003393 u32 platform_version = socinfo_get_platform_version();
David Collinsd49a1c52012-08-22 13:18:06 -07003394
3395 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
3396 apq8064_pm8917_pdata_fixup();
Rohit Vaswanib1cc4932012-07-23 21:30:11 -07003397 platform_device_register(&msm_gpio_device);
Joel King8f839b92012-04-01 14:37:46 -07003398 msm_tsens_early_init(&apq_tsens_pdata);
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06003399 msm_thermal_init(&msm_thermal_pdata);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003400 if (socinfo_init() < 0)
3401 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06003402 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
3403 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
David Collins2782b5c2012-02-06 10:02:42 -08003404 regulator_suppress_info_printing();
David Collins793793b2012-08-21 15:43:02 -07003405 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
3406 configure_apq8064_pm8917_power_grid();
David Collins2782b5c2012-02-06 10:02:42 -08003407 platform_device_register(&apq8064_device_rpm_regulator);
David Collins793793b2012-08-21 15:43:02 -07003408 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917)
3409 platform_device_register(&apq8064_pm8921_device_rpm_regulator);
Stephen Boyd4d0d2582012-02-10 14:49:40 -08003410 if (msm_xo_init())
3411 pr_err("Failed to initialize XO votes\n");
Matt Wagantallc51e5602012-02-27 17:25:25 -08003412 msm_clock_init(&apq8064_clock_init_data);
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08003413 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06003414 apq8064_i2c_init();
Mohan Pallakab8aa8282012-10-04 14:26:21 +05303415
3416 /* configure sx150x parameters for HRD */
3417 if (machine_is_mpq8064_hrd()) {
3418 mpq8064_sx150x_pdata[SX150X_EXP2].irq_summary =
3419 PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 40);
3420 mpq8064_sx150x_pdata[SX150X_EXP2].io_pullup_ena = 0xff;
3421 mpq8064_sx150x_pdata[SX150X_EXP2].io_pulldn_ena = 0x00;
3422 }
3423
Jing Lin417fa452012-02-05 14:31:06 -08003424 register_i2c_devices();
Kenneth Heitke36920d32011-07-20 16:44:30 -06003425
Harini Jayaramanc4c58692011-07-19 14:50:10 -06003426 apq8064_device_qup_spi_gsbi5.dev.platform_data =
3427 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08003428 apq8064_init_pmic();
Hemant Kumar94e7da22012-02-03 16:52:29 -08003429 if (machine_is_apq8064_liquid())
3430 msm_otg_pdata.mhl_enable = true;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07003431
Abhishek Kharbanda72dc72e2012-06-07 13:41:37 -07003432 if (apq8064_mhl_display_enabled())
3433 mhl_platform_data.mhl_enabled = true;
3434
Ofir Cohen94213a72012-05-03 14:26:32 +03003435 android_usb_pdata.swfi_latency =
3436 msm_rpmrs_levels[0].latency_us;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07003437
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003438 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Manu Gautam91223e02011-11-08 15:27:22 +05303439 apq8064_ehci_host_init();
Gagan Mac8a7a5d32011-11-11 16:43:06 -07003440 apq8064_init_buses();
David Collins793793b2012-08-21 15:43:02 -07003441
3442 platform_add_devices(early_common_devices,
3443 ARRAY_SIZE(early_common_devices));
3444 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917)
3445 platform_add_devices(pm8921_common_devices,
3446 ARRAY_SIZE(pm8921_common_devices));
3447 else
3448 platform_add_devices(pm8917_common_devices,
3449 ARRAY_SIZE(pm8917_common_devices));
David Collins03c16372012-10-04 15:57:28 -07003450 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
3451 platform_device_register(&apq8064_device_ext_ts_sw_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003452 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Terence Hampson36b70722012-05-10 13:18:16 -04003453 if (!(machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
3454 machine_is_mpq8064_dtv()))
3455 platform_add_devices(common_not_mpq_devices,
3456 ARRAY_SIZE(common_not_mpq_devices));
Kuirong Wangf8c5e142012-06-21 16:17:32 -07003457
3458 if ((machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
3459 machine_is_mpq8064_dtv()))
3460 platform_add_devices(common_mpq_devices,
3461 ARRAY_SIZE(common_mpq_devices));
3462
3463 if (machine_is_apq8064_mtp()) {
3464 if (SOCINFO_VERSION_MINOR(platform_version) == 1)
3465 platform_add_devices(common_i2s_devices,
3466 ARRAY_SIZE(common_i2s_devices));
3467 }
3468
Jay Chokshi994ff122012-03-27 15:43:48 -07003469 enable_ddr3_regulator();
Pavankumar Kondeti4f5dc3b2012-09-07 15:33:09 +05303470 msm_hsic_pdata.swfi_latency =
3471 msm_rpmrs_levels[0].latency_us;
Hemant Kumarf1ca9192012-02-07 18:59:33 -08003472 if (machine_is_apq8064_mtp()) {
Hemant Kumar30d361c2012-08-20 14:44:40 -07003473 msm_hsic_pdata.log2_irq_thresh = 5,
Hemant Kumarf1ca9192012-02-07 18:59:33 -08003474 apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
3475 device_initialize(&apq8064_device_hsic_host.dev);
3476 }
Jay Chokshie8741282012-01-25 15:22:55 -08003477 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05303478 apq8064_init_mmc();
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08003479
3480 if (machine_is_apq8064_mtp()) {
3481 mdm_8064_device.dev.platform_data = &mdm_platform_data;
Ameya Thakure155ece2012-07-09 12:08:37 -07003482 if (SOCINFO_VERSION_MINOR(platform_version) == 1) {
3483 i2s_mdm_8064_device.dev.platform_data =
3484 &mdm_platform_data;
3485 platform_device_register(&i2s_mdm_8064_device);
3486 } else {
3487 mdm_8064_device.dev.platform_data = &mdm_platform_data;
3488 platform_device_register(&mdm_8064_device);
3489 }
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08003490 }
3491 platform_device_register(&apq8064_slim_ctrl);
Santosh Mardi344455a2012-09-07 13:22:16 +05303492 if (machine_is_mpq8064_hrd() || machine_is_mpq8064_dtv()) {
3493 apq8064_slim_devices[ARRAY_SIZE(apq8064_slim_devices) - 1].\
3494 slim_slave = &mpq8064_slim_ashiko20;
3495 }
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06003496 slim_register_board_info(apq8064_slim_devices,
3497 ARRAY_SIZE(apq8064_slim_devices));
Taniya Dasbbf633d2012-07-31 16:07:47 +05303498 if (!PLATFORM_IS_MPQ8064()) {
Taniya Das30cae292012-07-31 15:56:12 +05303499 apq8064_init_dsps();
Taniya Dasbbf633d2012-07-31 16:07:47 +05303500 platform_device_register(&msm_8960_riva);
3501 }
Praveen Chidambaram78499012011-11-01 17:15:17 -06003502 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3503 msm_spm_l2_init(msm_spm_l2_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06003504 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08003505 apq8064_epm_adc_init();
Girish Mahadevan3bc98772012-08-15 10:01:27 -06003506 msm_pm_set_tz_retention_flag(1);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003507}
3508
Huaibin Yang4a084e32011-12-15 15:25:52 -08003509static void __init apq8064_allocate_memory_regions(void)
3510{
3511 apq8064_allocate_fb_region();
3512}
3513
Joel King82b7e3f2012-01-05 10:03:27 -08003514static void __init apq8064_cdp_init(void)
3515{
Hanumant Singh50440d42012-04-23 19:27:16 -07003516 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
3517 pr_err("meminfo_init() failed!\n");
Amy Maloche609bb5e2012-08-03 09:41:42 -07003518 if (machine_is_apq8064_mtp() &&
3519 SOCINFO_VERSION_MINOR(socinfo_get_platform_version()) == 1)
3520 cyttsp_pdata.sleep_gpio = CYTTSP_TS_GPIO_SLEEP_ALT;
Joel King82b7e3f2012-01-05 10:03:27 -08003521 apq8064_common_init();
Joel King8f839b92012-04-01 14:37:46 -07003522 if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
3523 machine_is_mpq8064_dtv()) {
Ravi Kumar V16a614c2012-10-12 20:59:56 +05303524 gpio_ir_recv_pdata.swfi_latency =
3525 msm_rpmrs_levels[0].latency_us;
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003526 enable_avc_i2c_bus();
Olav Hauganef95ae32012-05-15 09:50:30 -07003527 msm_rotator_set_split_iommu_domain();
Bar Weinerf82c5872012-10-23 14:31:26 +02003528
3529 mpq8064_device_qup_spi_gsbi6.dev.platform_data =
3530 &mpq8064_qup_spi_gsbi6_pdata;
3531
Joel King8f839b92012-04-01 14:37:46 -07003532 platform_add_devices(mpq_devices, ARRAY_SIZE(mpq_devices));
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06003533 mpq8064_pcie_init();
Bar Weinerf82c5872012-10-23 14:31:26 +02003534 spi_register_board_info(mpq8064_spi_board_info,
3535 ARRAY_SIZE(mpq8064_spi_board_info));
Joel King8f839b92012-04-01 14:37:46 -07003536 } else {
3537 ethernet_init();
Olav Hauganef95ae32012-05-15 09:50:30 -07003538 msm_rotator_set_split_iommu_domain();
Joel King8f839b92012-04-01 14:37:46 -07003539 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
3540 spi_register_board_info(spi_board_info,
3541 ARRAY_SIZE(spi_board_info));
3542 }
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003543 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07003544 apq8064_init_gpu();
Matt Wagantall1f65d9d2012-04-25 14:24:20 -07003545 platform_add_devices(apq8064_footswitch, apq8064_num_footswitch);
Steve Mucklef132c6c2012-06-06 18:30:57 -07003546#ifdef CONFIG_MSM_CAMERA
Kevin Chand07220e2012-02-13 15:52:22 -08003547 apq8064_init_cam();
Steve Mucklef132c6c2012-06-06 18:30:57 -07003548#endif
Mohan Pallaka474b94b2012-01-25 12:59:58 +05303549
Mayank Rana262e9032012-05-10 15:14:00 -07003550 if (machine_is_mpq8064_hrd() || machine_is_mpq8064_dtv()) {
3551 platform_device_register(&mpq8064_device_uartdm_gsbi6);
3552#ifdef CONFIG_SERIAL_MSM_HS
3553 /* GSBI6(2) - UARTDM_RX */
3554 mpq8064_gsbi6_uartdm_pdata.wakeup_irq = gpio_to_irq(15);
3555 mpq8064_device_uartdm_gsbi6.dev.platform_data =
3556 &mpq8064_gsbi6_uartdm_pdata;
3557#endif
3558 }
3559
Ankit Verma6fe41b02012-09-13 16:12:11 +05303560#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
3561 if (machine_is_mpq8064_hrd())
3562 apq8064_bt_power_init();
3563#endif
3564
Mohan Pallaka474b94b2012-01-25 12:59:58 +05303565 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
3566 platform_device_register(&cdp_kp_pdev);
3567
3568 if (machine_is_apq8064_mtp())
3569 platform_device_register(&mtp_kp_pdev);
Hanumant Singh50440d42012-04-23 19:27:16 -07003570
3571 change_memory_power = &apq8064_change_memory_power;
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05303572
3573 if (machine_is_mpq8064_cdp()) {
3574 platform_device_register(&mpq_gpio_keys_pdev);
3575 platform_device_register(&mpq_keypad_device);
Mohan Pallakab8aa8282012-10-04 14:26:21 +05303576 } else if (machine_is_mpq8064_hrd())
3577 platform_device_register(&mpq_hrd_keys_pdev);
Joel King82b7e3f2012-01-05 10:03:27 -08003578}
3579
Joel King82b7e3f2012-01-05 10:03:27 -08003580MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
3581 .map_io = apq8064_map_io,
3582 .reserve = apq8064_reserve,
3583 .init_irq = apq8064_init_irq,
3584 .handle_irq = gic_handle_irq,
3585 .timer = &msm_timer,
3586 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003587 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003588 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003589 .restart = msm_restart,
Joel King82b7e3f2012-01-05 10:03:27 -08003590MACHINE_END
3591
3592MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
3593 .map_io = apq8064_map_io,
3594 .reserve = apq8064_reserve,
3595 .init_irq = apq8064_init_irq,
3596 .handle_irq = gic_handle_irq,
3597 .timer = &msm_timer,
3598 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003599 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003600 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003601 .restart = msm_restart,
Joel King82b7e3f2012-01-05 10:03:27 -08003602MACHINE_END
3603
3604MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
3605 .map_io = apq8064_map_io,
3606 .reserve = apq8064_reserve,
3607 .init_irq = apq8064_init_irq,
3608 .handle_irq = gic_handle_irq,
3609 .timer = &msm_timer,
3610 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003611 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003612 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003613 .restart = msm_restart,
Joel King82b7e3f2012-01-05 10:03:27 -08003614MACHINE_END
3615
Joel King064bbf82012-04-01 13:23:39 -07003616MACHINE_START(MPQ8064_CDP, "QCT MPQ8064 CDP")
3617 .map_io = apq8064_map_io,
3618 .reserve = apq8064_reserve,
3619 .init_irq = apq8064_init_irq,
3620 .handle_irq = gic_handle_irq,
3621 .timer = &msm_timer,
3622 .init_machine = apq8064_cdp_init,
3623 .init_early = apq8064_allocate_memory_regions,
3624 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003625 .restart = msm_restart,
Joel King064bbf82012-04-01 13:23:39 -07003626MACHINE_END
3627
Joel King11ca8202012-02-13 16:19:03 -08003628MACHINE_START(MPQ8064_HRD, "QCT MPQ8064 HRD")
3629 .map_io = apq8064_map_io,
3630 .reserve = apq8064_reserve,
3631 .init_irq = apq8064_init_irq,
3632 .handle_irq = gic_handle_irq,
3633 .timer = &msm_timer,
3634 .init_machine = apq8064_cdp_init,
Joel King3a57e772012-05-28 11:22:55 -07003635 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003636 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003637 .restart = msm_restart,
Joel King11ca8202012-02-13 16:19:03 -08003638MACHINE_END
3639
3640MACHINE_START(MPQ8064_DTV, "QCT MPQ8064 DTV")
3641 .map_io = apq8064_map_io,
3642 .reserve = apq8064_reserve,
3643 .init_irq = apq8064_init_irq,
3644 .handle_irq = gic_handle_irq,
3645 .timer = &msm_timer,
3646 .init_machine = apq8064_cdp_init,
Joel King3a57e772012-05-28 11:22:55 -07003647 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003648 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003649 .restart = msm_restart,
Joel King11ca8202012-02-13 16:19:03 -08003650MACHINE_END