blob: 50505b9055f08aed334c43a550498da5f3aa6afe [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,
Hemant Kumare6275972012-02-29 20:06:21 -0800696 .dst = MSM_BUS_SLAVE_SPS,
697 .ab = 0,
698 .ib = 0,
699 },
700};
701
702/* Bus bandwidth requests in Bytes/sec */
703static struct msm_bus_vectors hsic_max_vectors[] = {
704 {
705 .src = MSM_BUS_MASTER_SPS,
Hemant Kumare6275972012-02-29 20:06:21 -0800706 .dst = MSM_BUS_SLAVE_SPS,
707 .ab = 0,
Hemant Kumar3b743cd2012-10-17 13:48:10 -0700708 .ib = 256000000, /*vote for 32Mhz dfab clk rate*/
Hemant Kumare6275972012-02-29 20:06:21 -0800709 },
710};
711
712static struct msm_bus_paths hsic_bus_scale_usecases[] = {
713 {
714 ARRAY_SIZE(hsic_init_vectors),
715 hsic_init_vectors,
716 },
717 {
718 ARRAY_SIZE(hsic_max_vectors),
719 hsic_max_vectors,
720 },
721};
722
723static struct msm_bus_scale_pdata hsic_bus_scale_pdata = {
724 hsic_bus_scale_usecases,
725 ARRAY_SIZE(hsic_bus_scale_usecases),
726 .name = "hsic",
727};
728
Hemant Kumara945b472012-01-25 15:08:06 -0800729static struct msm_hsic_host_platform_data msm_hsic_pdata = {
Hemant Kumare6275972012-02-29 20:06:21 -0800730 .strobe = 88,
731 .data = 89,
732 .bus_scale_table = &hsic_bus_scale_pdata,
Hemant Kumara945b472012-01-25 15:08:06 -0800733};
734#else
735static struct msm_hsic_host_platform_data msm_hsic_pdata;
736#endif
737
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800738#define PID_MAGIC_ID 0x71432909
739#define SERIAL_NUM_MAGIC_ID 0x61945374
740#define SERIAL_NUMBER_LENGTH 127
741#define DLOAD_USB_BASE_ADD 0x2A03F0C8
742
743struct magic_num_struct {
744 uint32_t pid;
745 uint32_t serial_num;
746};
747
748struct dload_struct {
749 uint32_t reserved1;
750 uint32_t reserved2;
751 uint32_t reserved3;
752 uint16_t reserved4;
753 uint16_t pid;
754 char serial_number[SERIAL_NUMBER_LENGTH];
755 uint16_t reserved5;
756 struct magic_num_struct magic_struct;
757};
758
759static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
760{
761 struct dload_struct __iomem *dload = 0;
762
763 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
764 if (!dload) {
765 pr_err("%s: cannot remap I/O memory region: %08x\n",
766 __func__, DLOAD_USB_BASE_ADD);
767 return -ENXIO;
768 }
769
770 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
771 __func__, dload, pid, snum);
772 /* update pid */
773 dload->magic_struct.pid = PID_MAGIC_ID;
774 dload->pid = pid;
775
776 /* update serial number */
777 dload->magic_struct.serial_num = 0;
778 if (!snum) {
779 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
780 goto out;
781 }
782
783 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
784 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
785out:
786 iounmap(dload);
787 return 0;
788}
789
790static struct android_usb_platform_data android_usb_pdata = {
791 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
792};
793
Hemant Kumar4933b072011-10-17 23:43:11 -0700794static struct platform_device android_usb_device = {
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800795 .name = "android_usb",
796 .id = -1,
797 .dev = {
798 .platform_data = &android_usb_pdata,
799 },
Hemant Kumar4933b072011-10-17 23:43:11 -0700800};
801
Hemant Kumar7620eed2012-02-26 09:08:43 -0800802/* Bandwidth requests (zero) if no vote placed */
803static struct msm_bus_vectors usb_init_vectors[] = {
804 {
805 .src = MSM_BUS_MASTER_SPS,
806 .dst = MSM_BUS_SLAVE_EBI_CH0,
807 .ab = 0,
808 .ib = 0,
809 },
810};
811
812/* Bus bandwidth requests in Bytes/sec */
813static struct msm_bus_vectors usb_max_vectors[] = {
814 {
815 .src = MSM_BUS_MASTER_SPS,
816 .dst = MSM_BUS_SLAVE_EBI_CH0,
817 .ab = 60000000, /* At least 480Mbps on bus. */
818 .ib = 960000000, /* MAX bursts rate */
819 },
820};
821
822static struct msm_bus_paths usb_bus_scale_usecases[] = {
823 {
824 ARRAY_SIZE(usb_init_vectors),
825 usb_init_vectors,
826 },
827 {
828 ARRAY_SIZE(usb_max_vectors),
829 usb_max_vectors,
830 },
831};
832
833static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
834 usb_bus_scale_usecases,
835 ARRAY_SIZE(usb_bus_scale_usecases),
836 .name = "usb",
837};
838
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700839static int phy_init_seq[] = {
Chiranjeevi Velempatif983aeb2012-08-23 08:16:50 +0530840 0x68, 0x81, /* update DC voltage level */
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700841 0x24, 0x82, /* set pre-emphasis and rise/fall time */
842 -1
843};
844
Vijayavardhan Vennapusa4fa13692012-08-02 14:35:03 +0530845#define PMIC_GPIO_DP 27 /* PMIC GPIO for D+ change */
846#define PMIC_GPIO_DP_IRQ PM8921_GPIO_IRQ(PM8921_IRQ_BASE, PMIC_GPIO_DP)
Jack Pham87f202f2012-08-06 00:24:22 -0700847#define MSM_MPM_PIN_USB1_OTGSESSVLD 40
848
Hemant Kumar4933b072011-10-17 23:43:11 -0700849static struct msm_otg_platform_data msm_otg_pdata = {
Hemant Kumard86c4882012-01-24 19:39:37 -0800850 .mode = USB_OTG,
851 .otg_control = OTG_PMIC_CONTROL,
Hemant Kumar4933b072011-10-17 23:43:11 -0700852 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Hemant Kumard86c4882012-01-24 19:39:37 -0800853 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
854 .power_budget = 750,
Hemant Kumar7620eed2012-02-26 09:08:43 -0800855 .bus_scale_table = &usb_bus_scale_pdata,
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700856 .phy_init_seq = phy_init_seq,
Jack Pham87f202f2012-08-06 00:24:22 -0700857 .mpm_otgsessvld_int = MSM_MPM_PIN_USB1_OTGSESSVLD,
Hemant Kumar4933b072011-10-17 23:43:11 -0700858};
859
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800860static struct msm_usb_host_platform_data msm_ehci_host_pdata3 = {
Manu Gautam91223e02011-11-08 15:27:22 +0530861 .power_budget = 500,
862};
863
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800864#ifdef CONFIG_USB_EHCI_MSM_HOST4
865static struct msm_usb_host_platform_data msm_ehci_host_pdata4;
866#endif
867
Manu Gautam91223e02011-11-08 15:27:22 +0530868static void __init apq8064_ehci_host_init(void)
869{
Chiranjeevi Velempatib822fa32012-05-23 22:05:59 +0530870 if (machine_is_apq8064_liquid() || machine_is_mpq8064_cdp() ||
Chiranjeevi Velempatidd4dbaa2012-10-05 16:22:04 +0530871 machine_is_mpq8064_hrd() || machine_is_mpq8064_dtv() ||
872 machine_is_apq8064_cdp()) {
Chiranjeevi Velempatib822fa32012-05-23 22:05:59 +0530873 if (machine_is_apq8064_liquid())
874 msm_ehci_host_pdata3.dock_connect_irq =
875 PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9);
Vijayavardhan Vennapusa4fa13692012-08-02 14:35:03 +0530876 else
877 msm_ehci_host_pdata3.pmic_gpio_dp_irq =
878 PMIC_GPIO_DP_IRQ;
Hemant Kumar56925352012-02-13 16:59:52 -0800879
Manu Gautam91223e02011-11-08 15:27:22 +0530880 apq8064_device_ehci_host3.dev.platform_data =
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800881 &msm_ehci_host_pdata3;
Manu Gautam91223e02011-11-08 15:27:22 +0530882 platform_device_register(&apq8064_device_ehci_host3);
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800883
884#ifdef CONFIG_USB_EHCI_MSM_HOST4
885 apq8064_device_ehci_host4.dev.platform_data =
886 &msm_ehci_host_pdata4;
887 platform_device_register(&apq8064_device_ehci_host4);
888#endif
Manu Gautam91223e02011-11-08 15:27:22 +0530889 }
890}
891
David Keitel2f613d92012-02-15 11:29:16 -0800892static struct smb349_platform_data smb349_data __initdata = {
893 .en_n_gpio = PM8921_GPIO_PM_TO_SYS(37),
894 .chg_susp_gpio = PM8921_GPIO_PM_TO_SYS(30),
895 .chg_current_ma = 2200,
896};
897
898static struct i2c_board_info smb349_charger_i2c_info[] __initdata = {
899 {
900 I2C_BOARD_INFO(SMB349_NAME, 0x1B),
901 .platform_data = &smb349_data,
902 },
903};
904
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -0800905struct sx150x_platform_data apq8064_sx150x_data[] = {
906 [SX150X_EPM] = {
907 .gpio_base = GPIO_EPM_EXPANDER_BASE,
908 .oscio_is_gpo = false,
909 .io_pullup_ena = 0x0,
910 .io_pulldn_ena = 0x0,
911 .io_open_drain_ena = 0x0,
912 .io_polarity = 0,
913 .irq_summary = -1,
914 },
915};
916
917static struct epm_chan_properties ads_adc_channel_data[] = {
Yan He44c59962012-08-31 11:14:58 -0700918 {10, 100}, {1000, 1}, {10, 100}, {1000, 1},
919 {10, 100}, {1000, 1}, {10, 100}, {1000, 1},
920 {10, 100}, {20, 100}, {500, 100}, {5, 100},
921 {1000, 1}, {200, 100}, {50, 100}, {10, 100},
922 {510, 100}, {50, 100}, {20, 100}, {100, 100},
923 {510, 100}, {20, 100}, {50, 100}, {200, 100},
924 {10, 100}, {20, 100}, {1000, 1}, {10, 100},
925 {200, 100}, {510, 100}, {1000, 100}, {200, 100},
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -0800926};
927
928static struct epm_adc_platform_data epm_adc_pdata = {
929 .channel = ads_adc_channel_data,
930 .bus_id = 0x0,
931 .epm_i2c_board_info = {
932 .type = "sx1509q",
933 .addr = 0x3e,
934 .platform_data = &apq8064_sx150x_data[SX150X_EPM],
935 },
936 .gpio_expander_base_addr = GPIO_EPM_EXPANDER_BASE,
937};
938
939static struct platform_device epm_adc_device = {
940 .name = "epm_adc",
941 .id = -1,
942 .dev = {
943 .platform_data = &epm_adc_pdata,
944 },
945};
946
947static void __init apq8064_epm_adc_init(void)
948{
949 epm_adc_pdata.num_channels = 32;
950 epm_adc_pdata.num_adc = 2;
951 epm_adc_pdata.chan_per_adc = 16;
952 epm_adc_pdata.chan_per_mux = 8;
953};
954
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800955/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
956 * 4 micbiases are used to power various analog and digital
957 * microphones operating at 1800 mV. Technically, all micbiases
958 * can source from single cfilter since all microphones operate
959 * at the same voltage level. The arrangement below is to make
960 * sure all cfilters are exercised. LDO_H regulator ouput level
961 * does not need to be as high as 2.85V. It is choosen for
962 * microphone sensitivity purpose.
963 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530964static struct wcd9xxx_pdata apq8064_tabla_platform_data = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800965 .slimbus_slave_device = {
966 .name = "tabla-slave",
967 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
968 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800969 .irq = MSM_GPIO_TO_INT(42),
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800970 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530971 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800972 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
973 .micbias = {
974 .ldoh_v = TABLA_LDOH_2P85_V,
975 .cfilt1_mv = 1800,
Bhalchandra Gajare975c53a2012-08-10 12:16:49 -0700976 .cfilt2_mv = 2700,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800977 .cfilt3_mv = 1800,
978 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
979 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
980 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
981 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530982 },
983 .regulator = {
984 {
985 .name = "CDC_VDD_CP",
986 .min_uV = 1800000,
987 .max_uV = 1800000,
988 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
989 },
990 {
991 .name = "CDC_VDDA_RX",
992 .min_uV = 1800000,
993 .max_uV = 1800000,
994 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
995 },
996 {
997 .name = "CDC_VDDA_TX",
998 .min_uV = 1800000,
999 .max_uV = 1800000,
1000 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
1001 },
1002 {
1003 .name = "VDDIO_CDC",
1004 .min_uV = 1800000,
1005 .max_uV = 1800000,
1006 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1007 },
1008 {
1009 .name = "VDDD_CDC_D",
1010 .min_uV = 1225000,
David Collins62debe82012-06-06 17:01:03 -07001011 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301012 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1013 },
1014 {
1015 .name = "CDC_VDDA_A_1P2V",
1016 .min_uV = 1225000,
David Collins62debe82012-06-06 17:01:03 -07001017 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301018 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1019 },
1020 },
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001021};
1022
1023static struct slim_device apq8064_slim_tabla = {
1024 .name = "tabla-slim",
1025 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
1026 .dev = {
1027 .platform_data = &apq8064_tabla_platform_data,
1028 },
1029};
1030
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301031static struct wcd9xxx_pdata apq8064_tabla20_platform_data = {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001032 .slimbus_slave_device = {
1033 .name = "tabla-slave",
1034 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
1035 },
1036 .irq = MSM_GPIO_TO_INT(42),
1037 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301038 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001039 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
1040 .micbias = {
1041 .ldoh_v = TABLA_LDOH_2P85_V,
1042 .cfilt1_mv = 1800,
Bhalchandra Gajare975c53a2012-08-10 12:16:49 -07001043 .cfilt2_mv = 2700,
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001044 .cfilt3_mv = 1800,
1045 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
1046 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
1047 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
1048 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301049 },
1050 .regulator = {
1051 {
1052 .name = "CDC_VDD_CP",
1053 .min_uV = 1800000,
1054 .max_uV = 1800000,
1055 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
1056 },
1057 {
1058 .name = "CDC_VDDA_RX",
1059 .min_uV = 1800000,
1060 .max_uV = 1800000,
1061 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
1062 },
1063 {
1064 .name = "CDC_VDDA_TX",
1065 .min_uV = 1800000,
1066 .max_uV = 1800000,
1067 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
1068 },
1069 {
1070 .name = "VDDIO_CDC",
1071 .min_uV = 1800000,
1072 .max_uV = 1800000,
1073 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1074 },
1075 {
1076 .name = "VDDD_CDC_D",
1077 .min_uV = 1225000,
David Collins62debe82012-06-06 17:01:03 -07001078 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301079 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1080 },
1081 {
1082 .name = "CDC_VDDA_A_1P2V",
1083 .min_uV = 1225000,
David Collins62debe82012-06-06 17:01:03 -07001084 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301085 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1086 },
1087 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001088};
1089
1090static struct slim_device apq8064_slim_tabla20 = {
1091 .name = "tabla2x-slim",
1092 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
1093 .dev = {
1094 .platform_data = &apq8064_tabla20_platform_data,
1095 },
1096};
1097
Kuirong Wangf8c5e142012-06-21 16:17:32 -07001098static struct wcd9xxx_pdata apq8064_tabla_i2c_platform_data = {
1099 .irq = MSM_GPIO_TO_INT(77),
1100 .irq_base = TABLA_INTERRUPT_BASE,
1101 .num_irqs = NR_WCD9XXX_IRQS,
1102 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
1103 .micbias = {
1104 .ldoh_v = TABLA_LDOH_2P85_V,
1105 .cfilt1_mv = 1800,
1106 .cfilt2_mv = 1800,
1107 .cfilt3_mv = 1800,
1108 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
1109 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
1110 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
1111 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
1112 },
1113 .regulator = {
1114 {
1115 .name = "CDC_VDD_CP",
1116 .min_uV = 1800000,
1117 .max_uV = 1800000,
1118 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
1119 },
1120 {
1121 .name = "CDC_VDDA_RX",
1122 .min_uV = 1800000,
1123 .max_uV = 1800000,
1124 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
1125 },
1126 {
1127 .name = "CDC_VDDA_TX",
1128 .min_uV = 1800000,
1129 .max_uV = 1800000,
1130 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
1131 },
1132 {
1133 .name = "VDDIO_CDC",
1134 .min_uV = 1800000,
1135 .max_uV = 1800000,
1136 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1137 },
1138 {
1139 .name = "VDDD_CDC_D",
1140 .min_uV = 1225000,
1141 .max_uV = 1250000,
1142 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1143 },
1144 {
1145 .name = "CDC_VDDA_A_1P2V",
1146 .min_uV = 1225000,
1147 .max_uV = 1250000,
1148 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1149 },
1150 },
1151};
1152
1153static struct i2c_board_info apq8064_tabla_i2c_device_info[] __initdata = {
1154 {
1155 I2C_BOARD_INFO("tabla top level",
1156 APQ_8064_TABLA_I2C_SLAVE_ADDR),
1157 .platform_data = &apq8064_tabla_i2c_platform_data,
1158 },
1159 {
1160 I2C_BOARD_INFO("tabla analog",
1161 APQ_8064_TABLA_ANALOG_I2C_SLAVE_ADDR),
1162 .platform_data = &apq8064_tabla_i2c_platform_data,
1163 },
1164 {
1165 I2C_BOARD_INFO("tabla digital1",
1166 APQ_8064_TABLA_DIGITAL1_I2C_SLAVE_ADDR),
1167 .platform_data = &apq8064_tabla_i2c_platform_data,
1168 },
1169 {
1170 I2C_BOARD_INFO("tabla digital2",
1171 APQ_8064_TABLA_DIGITAL2_I2C_SLAVE_ADDR),
1172 .platform_data = &apq8064_tabla_i2c_platform_data,
1173 },
1174};
1175
Santosh Mardi344455a2012-09-07 13:22:16 +05301176static struct wcd9xxx_pdata mpq8064_ashiko20_platform_data = {
1177 .slimbus_slave_device = {
1178 .name = "tabla-slave",
1179 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
1180 },
1181 .irq = MSM_GPIO_TO_INT(42),
1182 .irq_base = TABLA_INTERRUPT_BASE,
1183 .num_irqs = NR_WCD9XXX_IRQS,
1184 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
1185 .micbias = {
1186 .ldoh_v = TABLA_LDOH_2P85_V,
1187 .cfilt1_mv = 1800,
1188 .cfilt2_mv = 1800,
1189 .cfilt3_mv = 1800,
1190 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
1191 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
1192 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
1193 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
1194 },
1195 .regulator = {
1196 {
1197 .name = "CDC_VDD_CP",
1198 .min_uV = 1800000,
1199 .max_uV = 1800000,
1200 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
1201 },
1202 {
1203 .name = "CDC_VDDA_RX",
1204 .min_uV = 1800000,
1205 .max_uV = 1800000,
1206 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
1207 },
1208 {
1209 .name = "CDC_VDDA_TX",
1210 .min_uV = 1800000,
1211 .max_uV = 1800000,
1212 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
1213 },
1214 {
1215 .name = "VDDIO_CDC",
1216 .min_uV = 1800000,
1217 .max_uV = 1800000,
1218 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1219 },
1220 {
1221 .name = "HRD_VDDD_CDC_D",
1222 .min_uV = 1200000,
1223 .max_uV = 1200000,
1224 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1225 },
1226 {
1227 .name = "HRD_CDC_VDDA_A_1P2V",
1228 .min_uV = 1200000,
1229 .max_uV = 1200000,
1230 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1231 },
1232 },
1233};
1234
1235static struct slim_device mpq8064_slim_ashiko20 = {
1236 .name = "tabla2x-slim",
1237 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
1238 .dev = {
1239 .platform_data = &mpq8064_ashiko20_platform_data,
1240 },
1241};
1242
1243
Santosh Mardi695be0d2012-04-10 23:21:12 +05301244/* enable the level shifter for cs8427 to make sure the I2C
1245 * clock is running at 100KHz and voltage levels are at 3.3
1246 * and 5 volts
1247 */
Aviral Gupta6bb723f2012-11-06 22:27:17 +05301248static int enable_100KHz_ls(int enable, int gpio)
Santosh Mardi695be0d2012-04-10 23:21:12 +05301249{
Aviral Gupta6bb723f2012-11-06 22:27:17 +05301250 if (enable)
1251 gpio_direction_output(gpio, 1);
1252 else
1253 gpio_direction_output(gpio, 0);
1254 return 0;
Santosh Mardi695be0d2012-04-10 23:21:12 +05301255}
1256
Santosh Mardieff9a742012-04-09 23:23:39 +05301257static struct cs8427_platform_data cs8427_i2c_platform_data = {
1258 .irq = SX150X_GPIO(1, 4),
1259 .reset_gpio = SX150X_GPIO(1, 6),
Santosh Mardi695be0d2012-04-10 23:21:12 +05301260 .enable = enable_100KHz_ls,
Aviral Gupta6bb723f2012-11-06 22:27:17 +05301261 .ls_gpio = SX150X_GPIO(1, 10),
Santosh Mardieff9a742012-04-09 23:23:39 +05301262};
1263
1264static struct i2c_board_info cs8427_device_info[] __initdata = {
1265 {
1266 I2C_BOARD_INFO("cs8427", CS8427_ADDR4),
1267 .platform_data = &cs8427_i2c_platform_data,
1268 },
1269};
1270
Amy Maloche70090f992012-02-16 16:35:26 -08001271#define HAP_SHIFT_LVL_OE_GPIO PM8921_MPP_PM_TO_SYS(8)
1272#define ISA1200_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1273#define ISA1200_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
David Collinsd49a1c52012-08-22 13:18:06 -07001274#define ISA1200_HAP_CLK_PM8921 PM8921_GPIO_PM_TO_SYS(44)
1275#define ISA1200_HAP_CLK_PM8917 PM8921_GPIO_PM_TO_SYS(38)
Amy Maloche70090f992012-02-16 16:35:26 -08001276
Mohan Pallaka2d877602012-05-11 13:07:30 +05301277static int isa1200_clk_enable(bool on)
Amy Maloche70090f992012-02-16 16:35:26 -08001278{
David Collinsd49a1c52012-08-22 13:18:06 -07001279 unsigned int gpio = ISA1200_HAP_CLK_PM8921;
Amy Maloche8f973892012-03-26 14:53:13 -07001280 int rc = 0;
1281
David Collinsd49a1c52012-08-22 13:18:06 -07001282 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
1283 gpio = ISA1200_HAP_CLK_PM8917;
1284
1285 gpio_set_value_cansleep(gpio, on);
Amy Maloche70090f992012-02-16 16:35:26 -08001286
Mohan Pallaka2d877602012-05-11 13:07:30 +05301287 if (on) {
Amy Maloche8f973892012-03-26 14:53:13 -07001288 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_1, true);
Mohan Pallaka2d877602012-05-11 13:07:30 +05301289 if (rc) {
1290 pr_err("%s: unable to write aux clock register(%d)\n",
1291 __func__, rc);
1292 goto err_gpio_dis;
1293 }
1294 } else {
Amy Maloche8f973892012-03-26 14:53:13 -07001295 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_NONE, true);
Mohan Pallaka2d877602012-05-11 13:07:30 +05301296 if (rc)
1297 pr_err("%s: unable to write aux clock register(%d)\n",
1298 __func__, rc);
Amy Maloche8f973892012-03-26 14:53:13 -07001299 }
1300
1301 return rc;
Mohan Pallaka2d877602012-05-11 13:07:30 +05301302
1303err_gpio_dis:
David Collinsd49a1c52012-08-22 13:18:06 -07001304 gpio_set_value_cansleep(gpio, !on);
Mohan Pallaka2d877602012-05-11 13:07:30 +05301305 return rc;
Amy Maloche70090f992012-02-16 16:35:26 -08001306}
1307
1308static int isa1200_dev_setup(bool enable)
1309{
David Collinsd49a1c52012-08-22 13:18:06 -07001310 unsigned int gpio = ISA1200_HAP_CLK_PM8921;
Amy Maloche70090f992012-02-16 16:35:26 -08001311 int rc = 0;
1312
David Collinsd49a1c52012-08-22 13:18:06 -07001313 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
1314 gpio = ISA1200_HAP_CLK_PM8917;
1315
Amy Maloche70090f992012-02-16 16:35:26 -08001316 if (!enable)
1317 goto free_gpio;
1318
David Collinsd49a1c52012-08-22 13:18:06 -07001319 rc = gpio_request(gpio, "haptics_clk");
Amy Maloche70090f992012-02-16 16:35:26 -08001320 if (rc) {
1321 pr_err("%s: unable to request gpio %d config(%d)\n",
David Collinsd49a1c52012-08-22 13:18:06 -07001322 __func__, gpio, rc);
Amy Maloche70090f992012-02-16 16:35:26 -08001323 return rc;
1324 }
1325
David Collinsd49a1c52012-08-22 13:18:06 -07001326 rc = gpio_direction_output(gpio, 0);
Amy Maloche70090f992012-02-16 16:35:26 -08001327 if (rc) {
1328 pr_err("%s: unable to set direction\n", __func__);
1329 goto free_gpio;
1330 }
1331
1332 return 0;
1333
1334free_gpio:
David Collinsd49a1c52012-08-22 13:18:06 -07001335 gpio_free(gpio);
Amy Maloche70090f992012-02-16 16:35:26 -08001336 return rc;
1337}
1338
1339static struct isa1200_regulator isa1200_reg_data[] = {
1340 {
1341 .name = "vddp",
1342 .min_uV = ISA_I2C_VTG_MIN_UV,
1343 .max_uV = ISA_I2C_VTG_MAX_UV,
1344 .load_uA = ISA_I2C_CURR_UA,
1345 },
1346};
1347
1348static struct isa1200_platform_data isa1200_1_pdata = {
1349 .name = "vibrator",
1350 .dev_setup = isa1200_dev_setup,
Mohan Pallaka2d877602012-05-11 13:07:30 +05301351 .clk_enable = isa1200_clk_enable,
Mohan Pallaka32f20a72012-06-14 14:41:11 +05301352 .need_pwm_clk = true,
Amy Maloche70090f992012-02-16 16:35:26 -08001353 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
1354 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
1355 .max_timeout = 15000,
1356 .mode_ctrl = PWM_GEN_MODE,
1357 .pwm_fd = {
1358 .pwm_div = 256,
1359 },
1360 .is_erm = false,
1361 .smart_en = true,
1362 .ext_clk_en = true,
1363 .chip_en = 1,
1364 .regulator_info = isa1200_reg_data,
1365 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1366};
1367
1368static struct i2c_board_info isa1200_board_info[] __initdata = {
1369 {
1370 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1371 .platform_data = &isa1200_1_pdata,
1372 },
1373};
Jing Lin21ed4de2012-02-05 15:53:28 -08001374/* configuration data for mxt1386e using V2.1 firmware */
1375static const u8 mxt1386e_config_data_v2_1[] = {
1376 /* T6 Object */
1377 0, 0, 0, 0, 0, 0,
1378 /* T38 Object */
Jing Lin164f69a2012-09-21 13:26:34 -07001379 14, 4, 0, 5, 11, 12, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001380 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1381 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1382 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1383 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1384 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1385 0, 0, 0, 0,
1386 /* T7 Object */
Jing Lin164f69a2012-09-21 13:26:34 -07001387 32, 8, 50,
Jing Lin21ed4de2012-02-05 15:53:28 -08001388 /* T8 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001389 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001390 /* T9 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001391 139, 0, 0, 26, 42, 0, 32, 80, 2, 5,
Jing Linc6a55cfc2012-08-31 10:54:44 -07001392 0, 5, 5, 79, 10, 30, 10, 10, 255, 2,
Jing Linf1208fd2012-02-23 11:15:42 -08001393 85, 5, 0, 5, 9, 5, 12, 35, 70, 40,
1394 20, 5, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001395 /* T18 Object */
1396 0, 0,
1397 /* T24 Object */
1398 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1399 0, 0, 0, 0, 0, 0, 0, 0, 0,
1400 /* T25 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001401 1, 0, 60, 115, 156, 99,
Jing Lin21ed4de2012-02-05 15:53:28 -08001402 /* T27 Object */
1403 0, 0, 0, 0, 0, 0, 0,
1404 /* T40 Object */
1405 0, 0, 0, 0, 0,
1406 /* T42 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001407 0, 0, 255, 0, 255, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001408 /* T43 Object */
1409 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
1410 16,
1411 /* T46 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001412 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001413 /* T47 Object */
1414 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
1415 /* T48 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001416 1, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001417 32, 40, 0, 10, 10, 0, 0, 100, 10, 90,
1418 0, 0, 0, 0, 0, 0, 0, 10, 1, 10,
1419 52, 10, 12, 0, 33, 0, 1, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001420 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1421 0, 0, 0, 0,
1422 /* T56 Object */
1423 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1424 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1425 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1426 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001427 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1428 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001429};
1430
Jing Lin03cc5b42012-11-28 15:00:55 -08001431/* configuration data for mxt1386e using V2.4.AB firmware */
1432static const u8 mxt1386e_config_data_v2_4_AB[] = {
1433 /* T6 Object */
1434 0, 0, 0, 0, 0, 0,
1435 /* Object 38, Instance = 0 */
1436 14, 5, 0, 0,
1437 /* Object 7, Instance = 0 */
1438 32, 8, 50, 0,
1439 /* Object 8, Instance = 0 */
1440 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
1441 /* Object 9, Instance = 0 */
1442 139, 0, 0, 26, 42, 0, 32, 80, 2, 5,
1443 0, 5, 5, 79, 10, 30, 10, 10, 255, 2,
1444 85, 5, 0, 5, 9, 5, 12, 35, 70, 40,
1445 20, 5, 0, 0, 0, 0,
1446 /* Object 18, Instance = 0 */
1447 0, 0,
1448 /* Object 24, Instance = 0 */
1449 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1450 0, 0, 0, 0, 0, 0, 0, 0, 0,
1451 /* Object 25, Instance = 0 */
1452 1, 0, 60, 115, 156, 99,
1453 /* Object 27, Instance = 0 */
1454 0, 0, 0, 0, 0, 0, 0,
1455 /* Object 40, Instance = 0 */
1456 0, 0, 0, 0, 0,
1457 /* Object 42, Instance = 0 */
1458 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1459 /* Object 43, Instance = 0 */
1460 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1461 0, 0,
1462 /* Object 46, Instance = 0 */
1463 68, 0, 16, 16, 0, 0, 0, 0, 0,
1464 /* Object 47, Instance = 0 */
1465 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1466 /* Object 56, Instance = 0 */
1467 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1468 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1469 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1470 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1471 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1472 0, 0,
1473 /* Object 62, Instance = 0 */
1474 1, 0, 0, 2, 0, 0, 0, 0, 10, 0,
1475 0, 0, 0, 0, 0, 0, 0, 0, 0, 32,
1476 40, 10, 52, 10, 100, 10, 10, 10, 90, 0,
1477 0, 0, 0, 0, 33, 0, 1, 0, 0, 0,
1478 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1479 0, 0, 0, 0,
1480};
1481
Jing Lin21ed4de2012-02-05 15:53:28 -08001482#define MXT_TS_GPIO_IRQ 6
1483#define MXT_TS_PWR_EN_GPIO PM8921_GPIO_PM_TO_SYS(23)
1484#define MXT_TS_RESET_GPIO 33
1485
1486static struct mxt_config_info mxt_config_array[] = {
1487 {
1488 .config = mxt1386e_config_data_v2_1,
1489 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1490 .family_id = 0xA0,
1491 .variant_id = 0x7,
1492 .version = 0x21,
1493 .build = 0xAA,
Jing Linef4aa9b2012-03-26 12:01:41 -07001494 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin03cc5b42012-11-28 15:00:55 -08001495 .fw_name = "atmel_8064_liquid_v2_4_AB.hex",
Jing Linef4aa9b2012-03-26 12:01:41 -07001496 },
1497 {
1498 /* The config data for V2.2.AA is the same as for V2.1.AA */
1499 .config = mxt1386e_config_data_v2_1,
1500 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1501 .family_id = 0xA0,
1502 .variant_id = 0x7,
1503 .version = 0x22,
1504 .build = 0xAA,
1505 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin03cc5b42012-11-28 15:00:55 -08001506 .fw_name = "atmel_8064_liquid_v2_4_AB.hex",
1507 },
1508 {
1509 .config = mxt1386e_config_data_v2_4_AB,
1510 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_4_AB),
1511 .family_id = 0xA0,
1512 .variant_id = 0x7,
1513 .version = 0x24,
1514 .build = 0xAB,
1515 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin21ed4de2012-02-05 15:53:28 -08001516 },
1517};
1518
1519static struct mxt_platform_data mxt_platform_data = {
1520 .config_array = mxt_config_array,
1521 .config_array_size = ARRAY_SIZE(mxt_config_array),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08001522 .panel_minx = 0,
1523 .panel_maxx = 1365,
1524 .panel_miny = 0,
1525 .panel_maxy = 767,
1526 .disp_minx = 0,
1527 .disp_maxx = 1365,
1528 .disp_miny = 0,
1529 .disp_maxy = 767,
Anirudh Ghayal39dbe3f2012-04-13 15:43:16 +05301530 .irqflags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
Jing Lin21ed4de2012-02-05 15:53:28 -08001531 .i2c_pull_up = true,
1532 .reset_gpio = MXT_TS_RESET_GPIO,
1533 .irq_gpio = MXT_TS_GPIO_IRQ,
1534};
1535
1536static struct i2c_board_info mxt_device_info[] __initdata = {
1537 {
1538 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
1539 .platform_data = &mxt_platform_data,
1540 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1541 },
1542};
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001543#define CYTTSP_TS_GPIO_IRQ 6
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001544#define CYTTSP_TS_GPIO_SLEEP 33
Amy Maloche609bb5e2012-08-03 09:41:42 -07001545#define CYTTSP_TS_GPIO_SLEEP_ALT 12
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001546
1547static ssize_t tma340_vkeys_show(struct kobject *kobj,
1548 struct kobj_attribute *attr, char *buf)
1549{
1550 return snprintf(buf, 200,
1551 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1552 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1553 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1554 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1555 "\n");
1556}
1557
1558static struct kobj_attribute tma340_vkeys_attr = {
1559 .attr = {
1560 .mode = S_IRUGO,
1561 },
1562 .show = &tma340_vkeys_show,
1563};
1564
1565static struct attribute *tma340_properties_attrs[] = {
1566 &tma340_vkeys_attr.attr,
1567 NULL
1568};
1569
1570static struct attribute_group tma340_properties_attr_group = {
1571 .attrs = tma340_properties_attrs,
1572};
1573
1574static int cyttsp_platform_init(struct i2c_client *client)
1575{
1576 int rc = 0;
1577 static struct kobject *tma340_properties_kobj;
1578
1579 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1580 tma340_properties_kobj = kobject_create_and_add("board_properties",
1581 NULL);
1582 if (tma340_properties_kobj)
1583 rc = sysfs_create_group(tma340_properties_kobj,
1584 &tma340_properties_attr_group);
1585 if (!tma340_properties_kobj || rc)
1586 pr_err("%s: failed to create board_properties\n",
1587 __func__);
1588
1589 return 0;
1590}
1591
1592static struct cyttsp_regulator cyttsp_regulator_data[] = {
1593 {
1594 .name = "vdd",
1595 .min_uV = CY_TMA300_VTG_MIN_UV,
1596 .max_uV = CY_TMA300_VTG_MAX_UV,
1597 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1598 .lpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1599 },
1600 {
1601 .name = "vcc_i2c",
1602 .min_uV = CY_I2C_VTG_MIN_UV,
1603 .max_uV = CY_I2C_VTG_MAX_UV,
1604 .hpm_load_uA = CY_I2C_CURR_UA,
1605 .lpm_load_uA = CY_I2C_CURR_UA,
1606 },
1607};
1608
1609static struct cyttsp_platform_data cyttsp_pdata = {
1610 .panel_maxx = 634,
1611 .panel_maxy = 1166,
1612 .disp_maxx = 599,
1613 .disp_maxy = 1023,
1614 .disp_minx = 0,
1615 .disp_miny = 0,
1616 .flags = 0x01,
1617 .gen = CY_GEN3,
1618 .use_st = CY_USE_ST,
1619 .use_mt = CY_USE_MT,
1620 .use_hndshk = CY_SEND_HNDSHK,
1621 .use_trk_id = CY_USE_TRACKING_ID,
1622 .use_sleep = CY_USE_DEEP_SLEEP_SEL,
1623 .use_gestures = CY_USE_GESTURES,
1624 .fw_fname = "cyttsp_8064_mtp.hex",
1625 /* change act_intrvl to customize the Active power state
1626 * scanning/processing refresh interval for Operating mode
1627 */
1628 .act_intrvl = CY_ACT_INTRVL_DFLT,
1629 /* change tch_tmout to customize the touch timeout for the
1630 * Active power state for Operating mode
1631 */
1632 .tch_tmout = CY_TCH_TMOUT_DFLT,
1633 /* change lp_intrvl to customize the Low Power power state
1634 * scanning/processing refresh interval for Operating mode
1635 */
1636 .lp_intrvl = CY_LP_INTRVL_DFLT,
1637 .sleep_gpio = CYTTSP_TS_GPIO_SLEEP,
Amy Maloche9ba3ffe2012-04-26 10:31:20 -07001638 .resout_gpio = -1,
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001639 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1640 .regulator_info = cyttsp_regulator_data,
1641 .num_regulators = ARRAY_SIZE(cyttsp_regulator_data),
1642 .init = cyttsp_platform_init,
1643 .correct_fw_ver = 17,
1644};
1645
1646static struct i2c_board_info cyttsp_info[] __initdata = {
1647 {
1648 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1649 .platform_data = &cyttsp_pdata,
1650 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1651 },
1652};
Jing Lin21ed4de2012-02-05 15:53:28 -08001653
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001654#define MSM_WCNSS_PHYS 0x03000000
1655#define MSM_WCNSS_SIZE 0x280000
1656
1657static struct resource resources_wcnss_wlan[] = {
1658 {
1659 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1660 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1661 .name = "wcnss_wlanrx_irq",
1662 .flags = IORESOURCE_IRQ,
1663 },
1664 {
1665 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1666 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1667 .name = "wcnss_wlantx_irq",
1668 .flags = IORESOURCE_IRQ,
1669 },
1670 {
1671 .start = MSM_WCNSS_PHYS,
1672 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1673 .name = "wcnss_mmio",
1674 .flags = IORESOURCE_MEM,
1675 },
1676 {
1677 .start = 64,
1678 .end = 68,
1679 .name = "wcnss_gpios_5wire",
1680 .flags = IORESOURCE_IO,
1681 },
1682};
1683
1684static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1685 .has_48mhz_xo = 1,
1686};
1687
1688static struct platform_device msm_device_wcnss_wlan = {
1689 .name = "wcnss_wlan",
1690 .id = 0,
1691 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1692 .resource = resources_wcnss_wlan,
1693 .dev = {.platform_data = &qcom_wcnss_pdata},
1694};
1695
Ankit Vermab7c26e62012-02-28 15:04:15 -08001696static struct platform_device msm_device_iris_fm __devinitdata = {
1697 .name = "iris_fm",
1698 .id = -1,
1699};
1700
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001701#ifdef CONFIG_QSEECOM
1702/* qseecom bus scaling */
1703static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
1704 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001705 .src = MSM_BUS_MASTER_ADM_PORT0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001706 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001707 .ab = 0,
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001708 .ib = 0,
1709 },
1710 {
1711 .src = MSM_BUS_MASTER_ADM_PORT1,
1712 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1713 .ab = 0,
1714 .ib = 0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001715 },
1716 {
1717 .src = MSM_BUS_MASTER_SPDM,
1718 .dst = MSM_BUS_SLAVE_SPDM,
1719 .ib = 0,
1720 .ab = 0,
1721 },
1722};
1723
1724static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
1725 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001726 .src = MSM_BUS_MASTER_ADM_PORT0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001727 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001728 .ab = 70000000UL,
1729 .ib = 70000000UL,
1730 },
1731 {
1732 .src = MSM_BUS_MASTER_ADM_PORT1,
1733 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1734 .ab = 2480000000UL,
1735 .ib = 2480000000UL,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001736 },
1737 {
1738 .src = MSM_BUS_MASTER_SPDM,
1739 .dst = MSM_BUS_SLAVE_SPDM,
1740 .ib = 0,
1741 .ab = 0,
1742 },
1743};
1744
1745static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1746 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001747 .src = MSM_BUS_MASTER_ADM_PORT0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001748 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001749 .ab = 0,
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001750 .ib = 0,
1751 },
1752 {
1753 .src = MSM_BUS_MASTER_ADM_PORT1,
1754 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1755 .ab = 0,
1756 .ib = 0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001757 },
1758 {
1759 .src = MSM_BUS_MASTER_SPDM,
1760 .dst = MSM_BUS_SLAVE_SPDM,
1761 .ib = (64 * 8) * 1000000UL,
1762 .ab = (64 * 8) * 100000UL,
1763 },
1764};
1765
Ramesh Masavarapu8d756582012-10-03 10:18:06 -07001766static struct msm_bus_vectors qseecom_enable_dfab_sfpb_vectors[] = {
1767 {
1768 .src = MSM_BUS_MASTER_ADM_PORT0,
1769 .dst = MSM_BUS_SLAVE_EBI_CH0,
1770 .ab = 70000000UL,
1771 .ib = 70000000UL,
1772 },
1773 {
1774 .src = MSM_BUS_MASTER_ADM_PORT1,
1775 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1776 .ab = 2480000000UL,
1777 .ib = 2480000000UL,
1778 },
1779 {
1780 .src = MSM_BUS_MASTER_SPDM,
1781 .dst = MSM_BUS_SLAVE_SPDM,
1782 .ib = (64 * 8) * 1000000UL,
1783 .ab = (64 * 8) * 100000UL,
1784 },
1785};
1786
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001787static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1788 {
1789 ARRAY_SIZE(qseecom_clks_init_vectors),
1790 qseecom_clks_init_vectors,
1791 },
1792 {
1793 ARRAY_SIZE(qseecom_enable_dfab_vectors),
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001794 qseecom_enable_dfab_vectors,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001795 },
1796 {
1797 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1798 qseecom_enable_sfpb_vectors,
1799 },
Ramesh Masavarapu8d756582012-10-03 10:18:06 -07001800 {
1801 ARRAY_SIZE(qseecom_enable_dfab_sfpb_vectors),
1802 qseecom_enable_dfab_sfpb_vectors,
1803 },
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001804};
1805
1806static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1807 qseecom_hw_bus_scale_usecases,
1808 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1809 .name = "qsee",
1810};
1811
1812static struct platform_device qseecom_device = {
1813 .name = "qseecom",
1814 .id = 0,
1815 .dev = {
1816 .platform_data = &qseecom_bus_pdata,
1817 },
1818};
1819#endif
1820
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001821#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1822 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1823 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1824 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1825
1826#define QCE_SIZE 0x10000
1827#define QCE_0_BASE 0x11000000
1828
1829#define QCE_HW_KEY_SUPPORT 0
1830#define QCE_SHA_HMAC_SUPPORT 1
1831#define QCE_SHARE_CE_RESOURCE 3
1832#define QCE_CE_SHARED 0
1833
1834static struct resource qcrypto_resources[] = {
1835 [0] = {
1836 .start = QCE_0_BASE,
1837 .end = QCE_0_BASE + QCE_SIZE - 1,
1838 .flags = IORESOURCE_MEM,
1839 },
1840 [1] = {
1841 .name = "crypto_channels",
1842 .start = DMOV8064_CE_IN_CHAN,
1843 .end = DMOV8064_CE_OUT_CHAN,
1844 .flags = IORESOURCE_DMA,
1845 },
1846 [2] = {
1847 .name = "crypto_crci_in",
1848 .start = DMOV8064_CE_IN_CRCI,
1849 .end = DMOV8064_CE_IN_CRCI,
1850 .flags = IORESOURCE_DMA,
1851 },
1852 [3] = {
1853 .name = "crypto_crci_out",
1854 .start = DMOV8064_CE_OUT_CRCI,
1855 .end = DMOV8064_CE_OUT_CRCI,
1856 .flags = IORESOURCE_DMA,
1857 },
1858};
1859
1860static struct resource qcedev_resources[] = {
1861 [0] = {
1862 .start = QCE_0_BASE,
1863 .end = QCE_0_BASE + QCE_SIZE - 1,
1864 .flags = IORESOURCE_MEM,
1865 },
1866 [1] = {
1867 .name = "crypto_channels",
1868 .start = DMOV8064_CE_IN_CHAN,
1869 .end = DMOV8064_CE_OUT_CHAN,
1870 .flags = IORESOURCE_DMA,
1871 },
1872 [2] = {
1873 .name = "crypto_crci_in",
1874 .start = DMOV8064_CE_IN_CRCI,
1875 .end = DMOV8064_CE_IN_CRCI,
1876 .flags = IORESOURCE_DMA,
1877 },
1878 [3] = {
1879 .name = "crypto_crci_out",
1880 .start = DMOV8064_CE_OUT_CRCI,
1881 .end = DMOV8064_CE_OUT_CRCI,
1882 .flags = IORESOURCE_DMA,
1883 },
1884};
1885
1886#endif
1887
1888#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1889 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1890
1891static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1892 .ce_shared = QCE_CE_SHARED,
1893 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1894 .hw_key_support = QCE_HW_KEY_SUPPORT,
1895 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001896 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001897};
1898
1899static struct platform_device qcrypto_device = {
1900 .name = "qcrypto",
1901 .id = 0,
1902 .num_resources = ARRAY_SIZE(qcrypto_resources),
1903 .resource = qcrypto_resources,
1904 .dev = {
1905 .coherent_dma_mask = DMA_BIT_MASK(32),
1906 .platform_data = &qcrypto_ce_hw_suppport,
1907 },
1908};
1909#endif
1910
1911#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1912 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1913
1914static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1915 .ce_shared = QCE_CE_SHARED,
1916 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1917 .hw_key_support = QCE_HW_KEY_SUPPORT,
1918 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001919 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001920};
1921
1922static struct platform_device qcedev_device = {
1923 .name = "qce",
1924 .id = 0,
1925 .num_resources = ARRAY_SIZE(qcedev_resources),
1926 .resource = qcedev_resources,
1927 .dev = {
1928 .coherent_dma_mask = DMA_BIT_MASK(32),
1929 .platform_data = &qcedev_ce_hw_suppport,
1930 },
1931};
1932#endif
1933
Joel Kingef390842012-05-23 16:42:48 -07001934static struct mdm_vddmin_resource mdm_vddmin_rscs = {
1935 .rpm_id = MSM_RPM_ID_VDDMIN_GPIO,
1936 .ap2mdm_vddmin_gpio = 30,
1937 .modes = 0x03,
1938 .drive_strength = 8,
1939 .mdm2ap_vddmin_gpio = 80,
1940};
1941
Joel King269aa602012-07-23 08:07:35 -07001942static struct gpiomux_setting mdm2ap_status_gpio_run_cfg = {
1943 .func = GPIOMUX_FUNC_GPIO,
1944 .drv = GPIOMUX_DRV_8MA,
1945 .pull = GPIOMUX_PULL_NONE,
1946};
1947
Joel Kingdacbc822012-01-25 13:30:57 -08001948static struct mdm_platform_data mdm_platform_data = {
1949 .mdm_version = "3.0",
1950 .ramdump_delay_ms = 2000,
Joel King14fe7fa2012-05-27 14:26:11 -07001951 .early_power_on = 1,
1952 .sfr_query = 1,
Joel Kingbf3e4b52012-09-26 09:10:34 -07001953 .send_shdn = 1,
Joel Kingef390842012-05-23 16:42:48 -07001954 .vddmin_resource = &mdm_vddmin_rscs,
Hemant Kumara945b472012-01-25 15:08:06 -08001955 .peripheral_platform_device = &apq8064_device_hsic_host,
Ameya Thakurc9a7a842012-06-24 22:47:52 -07001956 .ramdump_timeout_ms = 120000,
Joel King269aa602012-07-23 08:07:35 -07001957 .mdm2ap_status_gpio_run_cfg = &mdm2ap_status_gpio_run_cfg,
Joel Kingdacbc822012-01-25 13:30:57 -08001958};
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001959
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001960static struct tsens_platform_data apq_tsens_pdata = {
1961 .tsens_factor = 1000,
1962 .hw_type = APQ_8064,
1963 .tsens_num_sensor = 11,
1964 .slope = {1176, 1176, 1154, 1176, 1111,
1965 1132, 1132, 1199, 1132, 1199, 1132},
1966};
1967
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07001968static struct platform_device msm_tsens_device = {
1969 .name = "tsens8960-tm",
1970 .id = -1,
1971};
1972
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06001973static struct msm_thermal_data msm_thermal_pdata = {
1974 .sensor_id = 7,
Eugene Seah2ee4a5d2012-06-25 18:16:41 -06001975 .poll_ms = 250,
1976 .limit_temp_degC = 60,
1977 .temp_hysteresis_degC = 10,
1978 .freq_step = 2,
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06001979};
1980
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001981#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001982static void __init apq8064_map_io(void)
1983{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001984 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001985 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001986 if (socinfo_init() < 0)
1987 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001988}
1989
1990static void __init apq8064_init_irq(void)
1991{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001992 struct msm_mpm_device_data *data = NULL;
1993
1994#ifdef CONFIG_MSM_MPM
1995 data = &apq8064_mpm_dev_data;
1996#endif
1997
1998 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001999 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
2000 (void *)MSM_QGIC_CPU_BASE);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002001}
2002
Abhishek Kharbanda72dc72e2012-06-07 13:41:37 -07002003static struct msm_mhl_platform_data mhl_platform_data = {
2004 .irq = MSM_GPIO_TO_INT(MHL_GPIO_INT),
2005 .gpio_mhl_int = MHL_GPIO_INT,
2006 .gpio_mhl_reset = MHL_GPIO_RESET,
2007 .gpio_mhl_power = 0,
2008 .gpio_hdmi_mhl_mux = 0,
2009};
2010
2011static struct i2c_board_info sii_device_info[] __initdata = {
2012 {
2013 /*
2014 * keeps SI 8334 as the default
2015 * MHL TX
2016 */
2017 I2C_BOARD_INFO("sii8334", 0x39),
2018 .platform_data = &mhl_platform_data,
2019 .flags = I2C_CLIENT_WAKE,
2020 },
2021};
2022
Jay Chokshi7805b5a2011-11-07 15:55:30 -08002023static struct platform_device msm8064_device_saw_regulator_core0 = {
2024 .name = "saw-regulator",
2025 .id = 0,
2026 .dev = {
2027 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
2028 },
2029};
2030
2031static struct platform_device msm8064_device_saw_regulator_core1 = {
2032 .name = "saw-regulator",
2033 .id = 1,
2034 .dev = {
2035 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
2036 },
2037};
2038
2039static struct platform_device msm8064_device_saw_regulator_core2 = {
2040 .name = "saw-regulator",
2041 .id = 2,
2042 .dev = {
2043 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
2044 },
2045};
2046
2047static struct platform_device msm8064_device_saw_regulator_core3 = {
2048 .name = "saw-regulator",
2049 .id = 3,
2050 .dev = {
2051 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002052
2053 },
2054};
2055
Oluwafemi Adeyemif5a31422012-03-08 16:58:45 -08002056static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06002057 {
2058 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2059 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2060 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002061 1, 784, 180000, 100,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002062 },
2063
2064 {
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002065 MSM_PM_SLEEP_MODE_RETENTION,
2066 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2067 true,
2068 415, 715, 340827, 475,
2069 },
2070
2071 {
Praveen Chidambaram78499012011-11-01 17:15:17 -06002072 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2073 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2074 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002075 1300, 228, 1200000, 2000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002076 },
2077
2078 {
2079 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2080 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2081 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002082 2000, 138, 1208400, 3200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002083 },
2084
2085 {
2086 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Praveen Chidambarame3380672012-02-08 10:32:27 -07002087 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2088 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002089 6000, 119, 1850300, 9000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002090 },
2091
2092 {
2093 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2094 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2095 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002096 9200, 68, 2839200, 16400,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002097 },
2098
2099 {
2100 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2101 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2102 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002103 10300, 63, 3128000, 18200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002104 },
2105
2106 {
2107 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2108 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2109 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002110 18000, 10, 4602600, 27000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002111 },
2112
2113 {
2114 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2115 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2116 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002117 20000, 2, 5752000, 32000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002118 },
2119};
2120
2121static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2122 .mode = MSM_PM_BOOT_CONFIG_TZ,
2123};
2124
2125static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2126 .levels = &msm_rpmrs_levels[0],
2127 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2128 .vdd_mem_levels = {
2129 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2130 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2131 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2132 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2133 },
2134 .vdd_dig_levels = {
2135 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
2136 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
2137 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
2138 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
2139 },
2140 .vdd_mask = 0x7FFFFF,
2141 .rpmrs_target_id = {
2142 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2143 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
2144 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
2145 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
2146 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
2147 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
2148 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2149 },
2150};
2151
Praveen Chidambaram78499012011-11-01 17:15:17 -06002152static uint8_t spm_wfi_cmd_sequence[] __initdata = {
2153 0x03, 0x0f,
2154};
2155
2156static uint8_t spm_power_collapse_without_rpm[] __initdata = {
2157 0x00, 0x24, 0x54, 0x10,
2158 0x09, 0x03, 0x01,
2159 0x10, 0x54, 0x30, 0x0C,
2160 0x24, 0x30, 0x0f,
2161};
2162
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002163static uint8_t spm_retention_cmd_sequence[] __initdata = {
2164 0x00, 0x05, 0x03, 0x0D,
2165 0x0B, 0x00, 0x0f,
2166};
2167
Praveen Chidambaram78499012011-11-01 17:15:17 -06002168static uint8_t spm_power_collapse_with_rpm[] __initdata = {
2169 0x00, 0x24, 0x54, 0x10,
2170 0x09, 0x07, 0x01, 0x0B,
2171 0x10, 0x54, 0x30, 0x0C,
2172 0x24, 0x30, 0x0f,
2173};
2174
Praveen Chidambaramc3c90822012-11-07 15:43:49 -07002175/* 8064AB has a different command to assert apc_pdn */
2176static uint8_t spm_power_collapse_without_rpm_krait_v3[] __initdata = {
2177 0x00, 0x24, 0x84, 0x10,
2178 0x09, 0x03, 0x01,
2179 0x10, 0x84, 0x30, 0x0C,
2180 0x24, 0x30, 0x0f,
2181};
2182
2183static uint8_t spm_power_collapse_with_rpm_krait_v3[] __initdata = {
2184 0x00, 0x24, 0x84, 0x10,
2185 0x09, 0x07, 0x01, 0x0B,
2186 0x10, 0x84, 0x30, 0x0C,
2187 0x24, 0x30, 0x0f,
2188};
2189
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002190static struct msm_spm_seq_entry msm_spm_boot_cpu_seq_list[] __initdata = {
2191 [0] = {
2192 .mode = MSM_SPM_MODE_CLOCK_GATING,
2193 .notify_rpm = false,
2194 .cmd = spm_wfi_cmd_sequence,
2195 },
2196 [1] = {
2197 .mode = MSM_SPM_MODE_POWER_RETENTION,
2198 .notify_rpm = false,
2199 .cmd = spm_retention_cmd_sequence,
2200 },
2201 [2] = {
2202 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2203 .notify_rpm = false,
2204 .cmd = spm_power_collapse_without_rpm,
2205 },
2206 [3] = {
2207 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2208 .notify_rpm = true,
2209 .cmd = spm_power_collapse_with_rpm,
2210 },
2211};
2212static struct msm_spm_seq_entry msm_spm_nonboot_cpu_seq_list[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06002213 [0] = {
2214 .mode = MSM_SPM_MODE_CLOCK_GATING,
2215 .notify_rpm = false,
2216 .cmd = spm_wfi_cmd_sequence,
2217 },
2218 [1] = {
2219 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2220 .notify_rpm = false,
2221 .cmd = spm_power_collapse_without_rpm,
2222 },
2223 [2] = {
2224 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2225 .notify_rpm = true,
2226 .cmd = spm_power_collapse_with_rpm,
2227 },
2228};
2229
2230static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
2231 0x00, 0x20, 0x03, 0x20,
2232 0x00, 0x0f,
2233};
2234
2235static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
2236 0x00, 0x20, 0x34, 0x64,
2237 0x48, 0x07, 0x48, 0x20,
2238 0x50, 0x64, 0x04, 0x34,
2239 0x50, 0x0f,
2240};
2241static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
2242 0x00, 0x10, 0x34, 0x64,
2243 0x48, 0x07, 0x48, 0x10,
2244 0x50, 0x64, 0x04, 0x34,
2245 0x50, 0x0F,
2246};
2247
2248static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
2249 [0] = {
2250 .mode = MSM_SPM_L2_MODE_RETENTION,
2251 .notify_rpm = false,
2252 .cmd = l2_spm_wfi_cmd_sequence,
2253 },
2254 [1] = {
2255 .mode = MSM_SPM_L2_MODE_GDHS,
2256 .notify_rpm = true,
2257 .cmd = l2_spm_gdhs_cmd_sequence,
2258 },
2259 [2] = {
2260 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
2261 .notify_rpm = true,
2262 .cmd = l2_spm_power_off_cmd_sequence,
2263 },
2264};
2265
2266
2267static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
2268 [0] = {
2269 .reg_base_addr = MSM_SAW_L2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002270 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07002271 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002272 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
2273 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
2274 .modes = msm_spm_l2_seq_list,
2275 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
2276 },
2277};
2278
2279static struct msm_spm_platform_data msm_spm_data[] __initdata = {
2280 [0] = {
2281 .reg_base_addr = MSM_SAW0_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002282 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002283#if defined(CONFIG_MSM_AVS_HW)
2284 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2285 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2286#endif
2287 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002288 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004,
2289 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C,
2290 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002291 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002292 .num_modes = ARRAY_SIZE(msm_spm_boot_cpu_seq_list),
2293 .modes = msm_spm_boot_cpu_seq_list,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002294 },
2295 [1] = {
2296 .reg_base_addr = MSM_SAW1_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002297 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002298#if defined(CONFIG_MSM_AVS_HW)
2299 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2300 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2301#endif
2302 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07002303 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002304 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2305 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2306 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002307 .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
2308 .modes = msm_spm_nonboot_cpu_seq_list,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002309 },
2310 [2] = {
2311 .reg_base_addr = MSM_SAW2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002312 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002313#if defined(CONFIG_MSM_AVS_HW)
2314 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2315 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2316#endif
2317 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07002318 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002319 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2320 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2321 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002322 .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
2323 .modes = msm_spm_nonboot_cpu_seq_list,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002324 },
2325 [3] = {
2326 .reg_base_addr = MSM_SAW3_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002327 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002328#if defined(CONFIG_MSM_AVS_HW)
2329 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2330 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2331#endif
2332 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07002333 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002334 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2335 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2336 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002337 .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
2338 .modes = msm_spm_nonboot_cpu_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08002339 },
2340};
2341
Praveen Chidambaramc3c90822012-11-07 15:43:49 -07002342static void __init apq8064ab_update_krait_spm(void)
2343{
2344 int i;
2345
2346 /* Update the SPM sequences for SPC and PC */
2347 for (i = 0; i < ARRAY_SIZE(msm_spm_data); i++) {
2348 int j;
2349 struct msm_spm_platform_data *pdata = &msm_spm_data[i];
2350 for (j = 0; j < pdata->num_modes; j++) {
2351 if (pdata->modes[j].cmd ==
2352 spm_power_collapse_without_rpm)
2353 pdata->modes[j].cmd =
2354 spm_power_collapse_without_rpm_krait_v3;
2355 else if (pdata->modes[j].cmd ==
2356 spm_power_collapse_with_rpm)
2357 pdata->modes[j].cmd =
2358 spm_power_collapse_with_rpm_krait_v3;
2359 }
2360 }
2361}
2362
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002363static void __init apq8064_init_buses(void)
2364{
2365 msm_bus_rpm_set_mt_mask();
2366 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
2367 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
2368 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
2369 msm_bus_8064_apps_fabric.dev.platform_data =
2370 &msm_bus_8064_apps_fabric_pdata;
2371 msm_bus_8064_sys_fabric.dev.platform_data =
2372 &msm_bus_8064_sys_fabric_pdata;
2373 msm_bus_8064_mm_fabric.dev.platform_data =
2374 &msm_bus_8064_mm_fabric_pdata;
2375 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
2376 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
2377}
2378
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002379/* PCIe gpios */
2380static struct msm_pcie_gpio_info_t msm_pcie_gpio_info[MSM_PCIE_MAX_GPIO] = {
2381 {"rst_n", PM8921_MPP_PM_TO_SYS(PCIE_RST_N_PMIC_MPP), 0},
2382 {"pwr_en", PM8921_GPIO_PM_TO_SYS(PCIE_PWR_EN_PMIC_GPIO), 1},
2383};
2384
2385static struct msm_pcie_platform msm_pcie_platform_data = {
2386 .gpio = msm_pcie_gpio_info,
Niranjana Vishwanathapura68210ff2012-06-24 18:03:49 -06002387 .axi_addr = PCIE_AXI_BAR_PHYS,
2388 .axi_size = PCIE_AXI_BAR_SIZE,
Niranjana Vishwanathapura459a27d2012-07-20 12:23:55 -06002389 .wake_n = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, PCIE_WAKE_N_PMIC_GPIO),
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002390};
2391
Niranjana Vishwanathapurac1edd402012-06-28 15:32:50 -06002392static int __init mpq8064_pcie_enabled(void)
2393{
2394 return !((readl_relaxed(QFPROM_RAW_FEAT_CONFIG_ROW0_MSB) & BIT(21)) ||
2395 (readl_relaxed(QFPROM_RAW_OEM_CONFIG_ROW0_LSB) & BIT(4)));
2396}
2397
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002398static void __init mpq8064_pcie_init(void)
2399{
Niranjana Vishwanathapurac1edd402012-06-28 15:32:50 -06002400 if (mpq8064_pcie_enabled()) {
2401 msm_device_pcie.dev.platform_data = &msm_pcie_platform_data;
2402 platform_device_register(&msm_device_pcie);
2403 }
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002404}
2405
David Collinsf0d00732012-01-25 15:46:50 -08002406static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
2407 .name = GPIO_REGULATOR_DEV_NAME,
2408 .id = PM8921_MPP_PM_TO_SYS(7),
2409 .dev = {
2410 .platform_data
2411 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2412 },
2413};
2414
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08002415static struct platform_device apq8064_device_ext_mpp8_vreg __devinitdata = {
2416 .name = GPIO_REGULATOR_DEV_NAME,
2417 .id = PM8921_MPP_PM_TO_SYS(8),
2418 .dev = {
2419 .platform_data
2420 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_MPP8],
2421 },
2422};
2423
David Collinsf0d00732012-01-25 15:46:50 -08002424static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
2425 .name = GPIO_REGULATOR_DEV_NAME,
2426 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
2427 .dev = {
2428 .platform_data =
2429 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2430 },
2431};
2432
David Collins390fc332012-02-07 14:38:16 -08002433static struct platform_device apq8064_device_ext_ts_sw_vreg __devinitdata = {
2434 .name = GPIO_REGULATOR_DEV_NAME,
2435 .id = PM8921_GPIO_PM_TO_SYS(23),
2436 .dev = {
2437 .platform_data
2438 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_TS_SW],
2439 },
2440};
2441
David Collins2782b5c2012-02-06 10:02:42 -08002442static struct platform_device apq8064_device_rpm_regulator __devinitdata = {
2443 .name = "rpm-regulator",
David Collins793793b2012-08-21 15:43:02 -07002444 .id = 0,
David Collins2782b5c2012-02-06 10:02:42 -08002445 .dev = {
2446 .platform_data = &apq8064_rpm_regulator_pdata,
2447 },
2448};
2449
David Collins793793b2012-08-21 15:43:02 -07002450static struct platform_device
2451apq8064_pm8921_device_rpm_regulator __devinitdata = {
2452 .name = "rpm-regulator",
2453 .id = 1,
2454 .dev = {
2455 .platform_data = &apq8064_rpm_regulator_pm8921_pdata,
2456 },
2457};
2458
Ravi Kumar V05931a22012-04-04 17:09:37 +05302459static struct gpio_ir_recv_platform_data gpio_ir_recv_pdata = {
2460 .gpio_nr = 88,
2461 .active_low = 1,
Ravi Kumar V16a614c2012-10-12 20:59:56 +05302462 .can_wakeup = true,
Ravi Kumar V05931a22012-04-04 17:09:37 +05302463};
2464
2465static struct platform_device gpio_ir_recv_pdev = {
2466 .name = "gpio-rc-recv",
2467 .dev = {
2468 .platform_data = &gpio_ir_recv_pdata,
2469 },
2470};
2471
Terence Hampson36b70722012-05-10 13:18:16 -04002472static struct platform_device *common_not_mpq_devices[] __initdata = {
David Keitel3c40fc52012-02-09 17:53:52 -08002473 &apq8064_device_qup_i2c_gsbi1,
Jing Lin04601f92012-02-05 15:36:07 -08002474 &apq8064_device_qup_i2c_gsbi3,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002475 &apq8064_device_qup_i2c_gsbi4,
Terence Hampson36b70722012-05-10 13:18:16 -04002476};
2477
Kuirong Wangf8c5e142012-06-21 16:17:32 -07002478static struct platform_device *common_mpq_devices[] __initdata = {
2479 &mpq_cpudai_sec_i2s_rx,
2480 &mpq_cpudai_mi2s_tx,
Aviral Guptabfa97882012-10-16 12:15:59 +05302481 &mpq_cpudai_pseudo,
Kuirong Wangf8c5e142012-06-21 16:17:32 -07002482};
2483
2484static struct platform_device *common_i2s_devices[] __initdata = {
2485 &apq_cpudai_mi2s,
2486 &apq_cpudai_i2s_rx,
2487 &apq_cpudai_i2s_tx,
2488};
2489
David Collins793793b2012-08-21 15:43:02 -07002490static struct platform_device *early_common_devices[] __initdata = {
Matt Wagantallf5cc3892012-06-07 19:47:02 -07002491 &apq8064_device_acpuclk,
Terence Hampson36b70722012-05-10 13:18:16 -04002492 &apq8064_device_dmov,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002493 &apq8064_device_qup_spi_gsbi5,
David Collins793793b2012-08-21 15:43:02 -07002494};
2495
2496static struct platform_device *pm8921_common_devices[] __initdata = {
David Collinsf0d00732012-01-25 15:46:50 -08002497 &apq8064_device_ext_5v_vreg,
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08002498 &apq8064_device_ext_mpp8_vreg,
David Collinsf0d00732012-01-25 15:46:50 -08002499 &apq8064_device_ext_3p3v_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07002500 &apq8064_device_ssbi_pmic1,
2501 &apq8064_device_ssbi_pmic2,
David Collins793793b2012-08-21 15:43:02 -07002502};
2503
2504static struct platform_device *pm8917_common_devices[] __initdata = {
2505 &apq8064_device_ext_mpp8_vreg,
2506 &apq8064_device_ext_3p3v_vreg,
2507 &apq8064_device_ssbi_pmic1,
2508 &apq8064_device_ssbi_pmic2,
David Collins793793b2012-08-21 15:43:02 -07002509};
2510
2511static struct platform_device *common_devices[] __initdata = {
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06002512 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07002513 &apq8064_device_otg,
2514 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08002515 &apq8064_device_hsusb_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07002516 &android_usb_device,
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08002517 &msm_device_wcnss_wlan,
Ankit Vermab7c26e62012-02-28 15:04:15 -08002518 &msm_device_iris_fm,
Larry Bassel67b921d2012-04-06 10:23:27 -07002519 &apq8064_fmem_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08002520#ifdef CONFIG_ANDROID_PMEM
2521#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002522 &apq8064_android_pmem_device,
2523 &apq8064_android_pmem_adsp_device,
2524 &apq8064_android_pmem_audio_device,
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -07002525#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
2526#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -08002527#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002528 &apq8064_ion_dev,
Olav Haugan7c6aa742012-01-16 16:47:37 -08002529#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002530 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08002531 &msm8064_device_saw_regulator_core0,
2532 &msm8064_device_saw_regulator_core1,
2533 &msm8064_device_saw_regulator_core2,
2534 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002535#if defined(CONFIG_QSEECOM)
2536 &qseecom_device,
2537#endif
2538
Joel Nider6b9a7bc2012-06-26 11:19:19 +03002539 &msm_8064_device_tsif[0],
2540 &msm_8064_device_tsif[1],
2541
Ramesh Masavarapu28311912011-10-27 11:04:12 -07002542#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2543 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2544 &qcrypto_device,
2545#endif
2546
2547#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2548 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2549 &qcedev_device,
2550#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07002551
2552#ifdef CONFIG_HW_RANDOM_MSM
2553 &apq8064_device_rng,
2554#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002555 &apq_pcm,
2556 &apq_pcm_routing,
2557 &apq_cpudai0,
2558 &apq_cpudai1,
2559 &apq_cpudai_hdmi_rx,
2560 &apq_cpudai_bt_rx,
2561 &apq_cpudai_bt_tx,
2562 &apq_cpudai_fm_rx,
2563 &apq_cpudai_fm_tx,
2564 &apq_cpu_fe,
2565 &apq_stub_codec,
2566 &apq_voice,
2567 &apq_voip,
2568 &apq_lpa_pcm,
Krishnankutty Kolathappilly4374e332012-03-18 22:27:30 -07002569 &apq_compr_dsp,
2570 &apq_multi_ch_pcm,
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -07002571 &apq_lowlatency_pcm,
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002572 &apq_pcm_hostless,
2573 &apq_cpudai_afe_01_rx,
2574 &apq_cpudai_afe_01_tx,
2575 &apq_cpudai_afe_02_rx,
2576 &apq_cpudai_afe_02_tx,
2577 &apq_pcm_afe,
2578 &apq_cpudai_auxpcm_rx,
2579 &apq_cpudai_auxpcm_tx,
Neema Shetty8427c262012-02-16 11:23:43 -08002580 &apq_cpudai_stub,
Neema Shetty3c9d2862012-03-11 01:25:32 -08002581 &apq_cpudai_slimbus_1_rx,
2582 &apq_cpudai_slimbus_1_tx,
Kiran Kandi97fe19d2012-05-20 22:34:04 -07002583 &apq_cpudai_slimbus_2_rx,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002584 &apq_cpudai_slimbus_2_tx,
Neema Shettyc9d86c32012-05-09 12:01:39 -07002585 &apq_cpudai_slimbus_3_rx,
Helen Zeng38c3c962012-05-17 14:56:20 -07002586 &apq_cpudai_slimbus_3_tx,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002587 &apq8064_rpm_device,
2588 &apq8064_rpm_log_device,
2589 &apq8064_rpm_stat_device,
Anji Jonnala93129922012-10-09 20:57:53 +05302590 &apq8064_rpm_master_stat_device,
Ramesh Masavarapuf31ff242012-05-10 18:55:21 -07002591 &apq_device_tz_log,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002592 &msm_bus_8064_apps_fabric,
2593 &msm_bus_8064_sys_fabric,
2594 &msm_bus_8064_mm_fabric,
2595 &msm_bus_8064_sys_fpb,
2596 &msm_bus_8064_cpss_fpb,
Mohan Kumar Gubbihalli Lachma Naik7f72edd2012-02-06 17:26:47 -08002597 &apq8064_msm_device_vidc,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07002598 &msm_pil_dsps,
Matt Wagantallb94b9a52012-02-02 21:59:54 -08002599 &msm_8960_q6_lpass,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002600 &msm_pil_vidc,
Matt Wagantall292aace2012-01-26 19:12:34 -08002601 &msm_gss,
Laura Abbottb93525f2012-04-12 09:57:19 -07002602 &apq8064_rtb_device,
Steve Mucklef9a87492012-11-02 15:41:00 -07002603 &apq8064_dcvs_device,
Abhijeet Dharmapurikarfb4a2f82012-08-23 14:36:59 -07002604 &apq8064_msm_gov_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002605 &apq8064_device_cache_erp,
Stepan Moskovchenko0f3de112012-06-08 18:11:46 -07002606 &msm8960_device_ebi1_ch0_erp,
2607 &msm8960_device_ebi1_ch1_erp,
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002608 &epm_adc_device,
Pratik Patel3b0ca882012-06-01 16:54:14 -07002609 &coresight_tpiu_device,
2610 &coresight_etb_device,
2611 &apq8064_coresight_funnel_device,
2612 &coresight_etm0_device,
2613 &coresight_etm1_device,
2614 &coresight_etm2_device,
2615 &coresight_etm3_device,
Helen Zeng8f925502012-03-05 16:50:17 -08002616 &apq_cpudai_slim_4_rx,
2617 &apq_cpudai_slim_4_tx,
Steve Mucklef132c6c2012-06-06 18:30:57 -07002618#ifdef CONFIG_MSM_GEMINI
Jignesh Mehta921649d2012-04-19 06:57:23 -07002619 &msm8960_gemini_device,
Steve Mucklef132c6c2012-06-06 18:30:57 -07002620#endif
Laura Abbott0577d7b2012-04-17 11:14:30 -07002621 &apq8064_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002622 &msm_tsens_device,
Laura Abbott93a4a352012-05-25 09:26:35 -07002623 &apq8064_cache_dump_device,
Joel Nider0e4a16d2012-08-05 14:20:11 +03002624 &msm_8064_device_tspp,
Binqiang Qiuf165c922012-08-15 18:00:18 -07002625#ifdef CONFIG_BATTERY_BCL
2626 &battery_bcl_device,
2627#endif
Abhijeet Dharmapurikarfb4a2f82012-08-23 14:36:59 -07002628 &apq8064_msm_mpd_device,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002629};
2630
Joel King82b7e3f2012-01-05 10:03:27 -08002631static struct platform_device *cdp_devices[] __initdata = {
2632 &apq8064_device_uart_gsbi1,
Jin Hong4bbbfba2012-02-02 21:48:07 -08002633 &apq8064_device_uart_gsbi7,
Joel King82b7e3f2012-01-05 10:03:27 -08002634 &msm_device_sps_apq8064,
Aravind Venkateswaran4ca27532012-02-16 14:27:05 -08002635#ifdef CONFIG_MSM_ROTATOR
2636 &msm_rotator_device,
2637#endif
Anji Jonnala6c2b6852012-09-21 13:34:44 +05302638 &msm8064_pc_cntr,
Joel King82b7e3f2012-01-05 10:03:27 -08002639};
2640
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002641static struct platform_device
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002642mpq8064_device_ext_1p2_buck_vreg __devinitdata = {
2643 .name = GPIO_REGULATOR_DEV_NAME,
2644 .id = SX150X_GPIO(4, 2),
2645 .dev = {
2646 .platform_data =
2647 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P2V],
2648 },
2649};
2650
2651static struct platform_device
2652mpq8064_device_ext_1p8_buck_vreg __devinitdata = {
2653 .name = GPIO_REGULATOR_DEV_NAME,
2654 .id = SX150X_GPIO(4, 4),
2655 .dev = {
2656 .platform_data =
2657 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P8V],
2658 },
2659};
2660
2661static struct platform_device
2662mpq8064_device_ext_2p2_buck_vreg __devinitdata = {
2663 .name = GPIO_REGULATOR_DEV_NAME,
2664 .id = SX150X_GPIO(4, 14),
2665 .dev = {
2666 .platform_data =
2667 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_2P2V],
2668 },
2669};
2670
2671static struct platform_device
2672mpq8064_device_ext_5v_buck_vreg __devinitdata = {
2673 .name = GPIO_REGULATOR_DEV_NAME,
2674 .id = SX150X_GPIO(4, 3),
2675 .dev = {
2676 .platform_data =
2677 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_5V],
2678 },
2679};
2680
2681static struct platform_device
2682mpq8064_device_ext_3p3v_ldo_vreg __devinitdata = {
2683 .name = GPIO_REGULATOR_DEV_NAME,
2684 .id = SX150X_GPIO(4, 15),
2685 .dev = {
2686 .platform_data =
2687 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_3P3V],
2688 },
2689};
2690
Ravi Kumar V1c903012012-05-15 16:11:35 +05302691static struct platform_device rc_input_loopback_pdev = {
2692 .name = "rc-user-input",
2693 .id = -1,
2694};
2695
Ravi Kumar V040eeff2012-05-23 21:29:23 +05302696static int rf4ce_gpio_init(void)
2697{
Ravi Kumar V92b2b6c2012-08-14 17:18:11 +05302698 if (!machine_is_mpq8064_cdp() &&
2699 !machine_is_mpq8064_hrd() &&
2700 !machine_is_mpq8064_dtv())
Ravi Kumar V040eeff2012-05-23 21:29:23 +05302701 return -EINVAL;
2702
2703 /* CC2533 SRDY Input */
2704 if (!gpio_request(SX150X_GPIO(4, 6), "rf4ce_srdy")) {
2705 gpio_direction_input(SX150X_GPIO(4, 6));
2706 gpio_export(SX150X_GPIO(4, 6), true);
2707 }
2708
2709 /* CC2533 MRDY Output */
2710 if (!gpio_request(SX150X_GPIO(4, 5), "rf4ce_mrdy")) {
2711 gpio_direction_output(SX150X_GPIO(4, 5), 1);
2712 gpio_export(SX150X_GPIO(4, 5), true);
2713 }
2714
2715 /* CC2533 Reset Output */
2716 if (!gpio_request(SX150X_GPIO(4, 7), "rf4ce_reset")) {
2717 gpio_direction_output(SX150X_GPIO(4, 7), 0);
2718 gpio_export(SX150X_GPIO(4, 7), true);
2719 }
2720
2721 return 0;
2722}
2723late_initcall(rf4ce_gpio_init);
2724
Mayank Rana262e9032012-05-10 15:14:00 -07002725#ifdef CONFIG_SERIAL_MSM_HS
2726static int configure_uart_gpios(int on)
2727{
2728 int ret = 0, i;
2729 int uart_gpios[] = {14, 15, 16, 17};
2730
2731 for (i = 0; i < ARRAY_SIZE(uart_gpios); i++) {
2732 if (on) {
2733 ret = gpio_request(uart_gpios[i], NULL);
2734 if (ret) {
2735 pr_err("%s:unable to request uart gpio[%d]\n",
2736 __func__, uart_gpios[i]);
2737 break;
2738 }
2739 } else {
2740 gpio_free(uart_gpios[i]);
2741 }
2742 }
2743
2744 if (ret && on && i)
2745 for (; i >= 0; i--)
2746 gpio_free(uart_gpios[i]);
2747 return ret;
2748}
2749
2750static struct msm_serial_hs_platform_data mpq8064_gsbi6_uartdm_pdata = {
2751 .inject_rx_on_wakeup = 1,
2752 .rx_to_inject = 0xFD,
2753 .gpio_config = configure_uart_gpios,
2754};
2755#else
2756static struct msm_serial_hs_platform_data msm_uart_dm9_pdata;
2757#endif
2758
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002759static struct platform_device *mpq_devices[] __initdata = {
2760 &msm_device_sps_apq8064,
2761 &mpq8064_device_qup_i2c_gsbi5,
2762#ifdef CONFIG_MSM_ROTATOR
2763 &msm_rotator_device,
2764#endif
Ravi Kumar V05931a22012-04-04 17:09:37 +05302765 &gpio_ir_recv_pdev,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002766 &mpq8064_device_ext_1p2_buck_vreg,
2767 &mpq8064_device_ext_1p8_buck_vreg,
2768 &mpq8064_device_ext_2p2_buck_vreg,
2769 &mpq8064_device_ext_5v_buck_vreg,
2770 &mpq8064_device_ext_3p3v_ldo_vreg,
Terence Hampson2e1705f2012-04-11 19:55:29 -04002771#ifdef CONFIG_MSM_VCAP
2772 &msm8064_device_vcap,
2773#endif
Ravi Kumar V1c903012012-05-15 16:11:35 +05302774 &rc_input_loopback_pdev,
Bar Weinerf82c5872012-10-23 14:31:26 +02002775 &mpq8064_device_qup_spi_gsbi6,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002776};
2777
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002778static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002779 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002780};
2781
Bar Weinerf82c5872012-10-23 14:31:26 +02002782static struct msm_spi_platform_data mpq8064_qup_spi_gsbi6_pdata = {
Bar Weinerbb315492012-10-30 15:02:37 +02002783 .max_clock_speed = 10800000,
Bar Weinerf82c5872012-10-23 14:31:26 +02002784};
2785
2786static struct ci_bridge_platform_data mpq8064_ci_bridge_pdata = {
2787 .reset_pin = 260,
2788 .interrupt_pin = 261,
2789};
2790
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002791#define KS8851_IRQ_GPIO 43
2792
2793static struct spi_board_info spi_board_info[] __initdata = {
2794 {
2795 .modalias = "ks8851",
2796 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2797 .max_speed_hz = 19200000,
2798 .bus_num = 0,
2799 .chip_select = 2,
2800 .mode = SPI_MODE_0,
2801 },
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002802 {
2803 .modalias = "epm_adc",
2804 .max_speed_hz = 1100000,
2805 .bus_num = 0,
2806 .chip_select = 3,
2807 .mode = SPI_MODE_0,
Bar Weinerf82c5872012-10-23 14:31:26 +02002808 }
2809};
2810
2811static struct spi_board_info mpq8064_spi_board_info[] __initdata = {
2812 {
2813 .modalias = "ci_bridge_spi",
2814 .max_speed_hz = 1000000,
2815 .bus_num = 1,
2816 .chip_select = 0,
2817 .mode = SPI_MODE_0,
2818 .platform_data = &mpq8064_ci_bridge_pdata,
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002819 },
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002820};
2821
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002822static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002823 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08002824 .bus_num = 1,
2825 .slim_slave = &apq8064_slim_tabla,
2826 },
2827 {
2828 .bus_num = 1,
2829 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002830 },
2831 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002832};
2833
David Keitel3c40fc52012-02-09 17:53:52 -08002834static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi1_pdata = {
2835 .clk_freq = 100000,
2836 .src_clk_rate = 24000000,
2837};
2838
Jing Lin04601f92012-02-05 15:36:07 -08002839static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi3_pdata = {
Anirudh Ghayalc2163472012-04-10 14:58:14 +05302840 .clk_freq = 384000,
Jing Lin04601f92012-02-05 15:36:07 -08002841 .src_clk_rate = 24000000,
2842};
2843
Kenneth Heitke748593a2011-07-15 15:45:11 -06002844static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
2845 .clk_freq = 100000,
2846 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002847};
2848
Joel King8f839b92012-04-01 14:37:46 -07002849static struct msm_i2c_platform_data mpq8064_i2c_qup_gsbi5_pdata = {
2850 .clk_freq = 100000,
2851 .src_clk_rate = 24000000,
2852};
2853
David Keitel3c40fc52012-02-09 17:53:52 -08002854#define GSBI_DUAL_MODE_CODE 0x60
2855#define MSM_GSBI1_PHYS 0x12440000
Kenneth Heitke748593a2011-07-15 15:45:11 -06002856static void __init apq8064_i2c_init(void)
2857{
David Keitel3c40fc52012-02-09 17:53:52 -08002858 void __iomem *gsbi_mem;
2859
2860 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2861 &apq8064_i2c_qup_gsbi1_pdata;
2862 gsbi_mem = ioremap_nocache(MSM_GSBI1_PHYS, 4);
2863 writel_relaxed(GSBI_DUAL_MODE_CODE, gsbi_mem);
2864 /* Ensure protocol code is written before proceeding */
2865 wmb();
2866 iounmap(gsbi_mem);
2867 apq8064_i2c_qup_gsbi1_pdata.use_gsbi_shared_mode = 1;
Jing Lin04601f92012-02-05 15:36:07 -08002868 apq8064_device_qup_i2c_gsbi3.dev.platform_data =
2869 &apq8064_i2c_qup_gsbi3_pdata;
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002870 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2871 &apq8064_i2c_qup_gsbi1_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002872 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
2873 &apq8064_i2c_qup_gsbi4_pdata;
Joel King8f839b92012-04-01 14:37:46 -07002874 mpq8064_device_qup_i2c_gsbi5.dev.platform_data =
2875 &mpq8064_i2c_qup_gsbi5_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002876}
2877
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002878#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002879static int ethernet_init(void)
2880{
2881 int ret;
2882 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
2883 if (ret) {
2884 pr_err("ks8851 gpio_request failed: %d\n", ret);
2885 goto fail;
2886 }
2887
2888 return 0;
2889fail:
2890 return ret;
2891}
2892#else
2893static int ethernet_init(void)
2894{
2895 return 0;
2896}
2897#endif
2898
David Collinsd49a1c52012-08-22 13:18:06 -07002899#define GPIO_KEY_HOME PM8921_GPIO_PM_TO_SYS(27)
2900#define GPIO_KEY_VOLUME_UP PM8921_GPIO_PM_TO_SYS(35)
2901#define GPIO_KEY_VOLUME_DOWN_PM8921 PM8921_GPIO_PM_TO_SYS(38)
2902#define GPIO_KEY_VOLUME_DOWN_PM8917 PM8921_GPIO_PM_TO_SYS(30)
2903#define GPIO_KEY_CAM_FOCUS PM8921_GPIO_PM_TO_SYS(3)
2904#define GPIO_KEY_CAM_SNAP PM8921_GPIO_PM_TO_SYS(4)
2905#define GPIO_KEY_ROTATION_PM8921 PM8921_GPIO_PM_TO_SYS(42)
2906#define GPIO_KEY_ROTATION_PM8917 PM8921_GPIO_PM_TO_SYS(8)
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302907
David Collinsd49a1c52012-08-22 13:18:06 -07002908static struct gpio_keys_button cdp_keys_pm8921[] = {
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302909 {
2910 .code = KEY_HOME,
2911 .gpio = GPIO_KEY_HOME,
2912 .desc = "home_key",
2913 .active_low = 1,
2914 .type = EV_KEY,
2915 .wakeup = 1,
2916 .debounce_interval = 15,
2917 },
2918 {
2919 .code = KEY_VOLUMEUP,
2920 .gpio = GPIO_KEY_VOLUME_UP,
2921 .desc = "volume_up_key",
2922 .active_low = 1,
2923 .type = EV_KEY,
2924 .wakeup = 1,
2925 .debounce_interval = 15,
2926 },
2927 {
2928 .code = KEY_VOLUMEDOWN,
David Collinsd49a1c52012-08-22 13:18:06 -07002929 .gpio = GPIO_KEY_VOLUME_DOWN_PM8921,
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302930 .desc = "volume_down_key",
2931 .active_low = 1,
2932 .type = EV_KEY,
2933 .wakeup = 1,
2934 .debounce_interval = 15,
2935 },
2936 {
2937 .code = SW_ROTATE_LOCK,
David Collinsd49a1c52012-08-22 13:18:06 -07002938 .gpio = GPIO_KEY_ROTATION_PM8921,
2939 .desc = "rotate_key",
2940 .active_low = 1,
2941 .type = EV_SW,
2942 .debounce_interval = 15,
2943 },
2944};
2945
2946static struct gpio_keys_button cdp_keys_pm8917[] = {
2947 {
2948 .code = KEY_HOME,
2949 .gpio = GPIO_KEY_HOME,
2950 .desc = "home_key",
2951 .active_low = 1,
2952 .type = EV_KEY,
2953 .wakeup = 1,
2954 .debounce_interval = 15,
2955 },
2956 {
2957 .code = KEY_VOLUMEUP,
2958 .gpio = GPIO_KEY_VOLUME_UP,
2959 .desc = "volume_up_key",
2960 .active_low = 1,
2961 .type = EV_KEY,
2962 .wakeup = 1,
2963 .debounce_interval = 15,
2964 },
2965 {
2966 .code = KEY_VOLUMEDOWN,
2967 .gpio = GPIO_KEY_VOLUME_DOWN_PM8917,
2968 .desc = "volume_down_key",
2969 .active_low = 1,
2970 .type = EV_KEY,
2971 .wakeup = 1,
2972 .debounce_interval = 15,
2973 },
2974 {
2975 .code = SW_ROTATE_LOCK,
2976 .gpio = GPIO_KEY_ROTATION_PM8917,
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302977 .desc = "rotate_key",
2978 .active_low = 1,
2979 .type = EV_SW,
2980 .debounce_interval = 15,
2981 },
2982};
2983
2984static struct gpio_keys_platform_data cdp_keys_data = {
David Collinsd49a1c52012-08-22 13:18:06 -07002985 .buttons = cdp_keys_pm8921,
2986 .nbuttons = ARRAY_SIZE(cdp_keys_pm8921),
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302987};
2988
2989static struct platform_device cdp_kp_pdev = {
2990 .name = "gpio-keys",
2991 .id = -1,
2992 .dev = {
2993 .platform_data = &cdp_keys_data,
2994 },
2995};
2996
2997static struct gpio_keys_button mtp_keys[] = {
2998 {
2999 .code = KEY_CAMERA_FOCUS,
3000 .gpio = GPIO_KEY_CAM_FOCUS,
3001 .desc = "cam_focus_key",
3002 .active_low = 1,
3003 .type = EV_KEY,
3004 .wakeup = 1,
3005 .debounce_interval = 15,
3006 },
3007 {
3008 .code = KEY_VOLUMEUP,
3009 .gpio = GPIO_KEY_VOLUME_UP,
3010 .desc = "volume_up_key",
3011 .active_low = 1,
3012 .type = EV_KEY,
3013 .wakeup = 1,
3014 .debounce_interval = 15,
3015 },
3016 {
3017 .code = KEY_VOLUMEDOWN,
David Collinsd49a1c52012-08-22 13:18:06 -07003018 .gpio = GPIO_KEY_VOLUME_DOWN_PM8921,
Mohan Pallaka474b94b2012-01-25 12:59:58 +05303019 .desc = "volume_down_key",
3020 .active_low = 1,
3021 .type = EV_KEY,
3022 .wakeup = 1,
3023 .debounce_interval = 15,
3024 },
3025 {
3026 .code = KEY_CAMERA_SNAPSHOT,
3027 .gpio = GPIO_KEY_CAM_SNAP,
3028 .desc = "cam_snap_key",
3029 .active_low = 1,
3030 .type = EV_KEY,
3031 .debounce_interval = 15,
3032 },
3033};
3034
3035static struct gpio_keys_platform_data mtp_keys_data = {
3036 .buttons = mtp_keys,
3037 .nbuttons = ARRAY_SIZE(mtp_keys),
3038};
3039
3040static struct platform_device mtp_kp_pdev = {
3041 .name = "gpio-keys",
3042 .id = -1,
3043 .dev = {
3044 .platform_data = &mtp_keys_data,
3045 },
3046};
3047
Mohan Pallakab8aa8282012-10-04 14:26:21 +05303048#define MPQ_HRD_HOME_GPIO SX150X_EXP2_GPIO_BASE
3049#define MPQ_HRD_VOL_UP_GPIO (SX150X_EXP2_GPIO_BASE + 1)
3050#define MPQ_HRD_VOL_DOWN_GPIO (SX150X_EXP2_GPIO_BASE + 2)
3051#define MPQ_HRD_RIGHT_GPIO (SX150X_EXP2_GPIO_BASE + 3)
3052#define MPQ_HRD_LEFT_GPIO (SX150X_EXP2_GPIO_BASE + 4)
3053#define MPQ_HRD_ENTER_GPIO (SX150X_EXP2_GPIO_BASE + 5)
3054
3055static struct gpio_keys_button mpq_hrd_keys[] = {
3056 {
3057 .code = KEY_HOME,
3058 .gpio = MPQ_HRD_HOME_GPIO,
3059 .desc = "home_key",
3060 .active_low = 1,
3061 .type = EV_KEY,
3062 .wakeup = 1,
3063 .debounce_interval = 15,
3064 },
3065 {
3066 .code = KEY_VOLUMEUP,
3067 .gpio = MPQ_HRD_VOL_UP_GPIO,
3068 .desc = "volume_up_key",
3069 .active_low = 1,
3070 .type = EV_KEY,
3071 .wakeup = 1,
3072 .debounce_interval = 15,
3073 },
3074 {
3075 .code = KEY_VOLUMEDOWN,
3076 .gpio = MPQ_HRD_VOL_DOWN_GPIO,
3077 .desc = "volume_down_key",
3078 .active_low = 1,
3079 .type = EV_KEY,
3080 .wakeup = 1,
3081 .debounce_interval = 15,
3082 },
3083 {
3084 .code = KEY_RIGHT,
3085 .gpio = MPQ_HRD_RIGHT_GPIO,
3086 .desc = "right_key",
3087 .active_low = 1,
3088 .type = EV_KEY,
3089 .wakeup = 1,
3090 .debounce_interval = 15,
3091 },
3092 {
3093 .code = KEY_LEFT,
3094 .gpio = MPQ_HRD_LEFT_GPIO,
3095 .desc = "left_key",
3096 .active_low = 1,
3097 .type = EV_KEY,
3098 .wakeup = 1,
3099 .debounce_interval = 15,
3100 },
3101 {
3102 .code = KEY_ENTER,
3103 .gpio = MPQ_HRD_ENTER_GPIO,
3104 .desc = "enter_key",
3105 .active_low = 1,
3106 .type = EV_KEY,
3107 .wakeup = 1,
3108 .debounce_interval = 15,
3109 },
3110};
3111
3112static struct gpio_keys_platform_data mpq_hrd_keys_pdata = {
3113 .buttons = mpq_hrd_keys,
3114 .nbuttons = ARRAY_SIZE(mpq_hrd_keys),
3115};
3116
3117static struct platform_device mpq_hrd_keys_pdev = {
3118 .name = "gpio-keys",
3119 .id = -1,
3120 .dev = {
3121 .platform_data = &mpq_hrd_keys_pdata,
3122 },
3123};
3124
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05303125static struct gpio_keys_button mpq_keys[] = {
3126 {
3127 .code = KEY_VOLUMEDOWN,
David Collinsd49a1c52012-08-22 13:18:06 -07003128 .gpio = GPIO_KEY_VOLUME_DOWN_PM8921,
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05303129 .desc = "volume_down_key",
3130 .active_low = 1,
3131 .type = EV_KEY,
3132 .wakeup = 1,
3133 .debounce_interval = 15,
3134 },
3135 {
3136 .code = KEY_VOLUMEUP,
3137 .gpio = GPIO_KEY_VOLUME_UP,
3138 .desc = "volume_up_key",
3139 .active_low = 1,
3140 .type = EV_KEY,
3141 .wakeup = 1,
3142 .debounce_interval = 15,
3143 },
3144};
3145
3146static struct gpio_keys_platform_data mpq_keys_data = {
3147 .buttons = mpq_keys,
3148 .nbuttons = ARRAY_SIZE(mpq_keys),
3149};
3150
3151static struct platform_device mpq_gpio_keys_pdev = {
3152 .name = "gpio-keys",
3153 .id = -1,
3154 .dev = {
3155 .platform_data = &mpq_keys_data,
3156 },
3157};
3158
3159#define MPQ_KP_ROW_BASE SX150X_EXP2_GPIO_BASE
3160#define MPQ_KP_COL_BASE (SX150X_EXP2_GPIO_BASE + 4)
3161
3162static unsigned int mpq_row_gpios[] = {MPQ_KP_ROW_BASE, MPQ_KP_ROW_BASE + 1,
3163 MPQ_KP_ROW_BASE + 2, MPQ_KP_ROW_BASE + 3};
3164static unsigned int mpq_col_gpios[] = {MPQ_KP_COL_BASE, MPQ_KP_COL_BASE + 1,
3165 MPQ_KP_COL_BASE + 2};
3166
3167static const unsigned int mpq_keymap[] = {
3168 KEY(0, 0, KEY_UP),
3169 KEY(0, 1, KEY_ENTER),
3170 KEY(0, 2, KEY_3),
3171
3172 KEY(1, 0, KEY_DOWN),
3173 KEY(1, 1, KEY_EXIT),
3174 KEY(1, 2, KEY_4),
3175
3176 KEY(2, 0, KEY_LEFT),
3177 KEY(2, 1, KEY_1),
3178 KEY(2, 2, KEY_5),
3179
3180 KEY(3, 0, KEY_RIGHT),
3181 KEY(3, 1, KEY_2),
3182 KEY(3, 2, KEY_6),
3183};
3184
3185static struct matrix_keymap_data mpq_keymap_data = {
3186 .keymap_size = ARRAY_SIZE(mpq_keymap),
3187 .keymap = mpq_keymap,
3188};
3189
3190static struct matrix_keypad_platform_data mpq_keypad_data = {
3191 .keymap_data = &mpq_keymap_data,
3192 .row_gpios = mpq_row_gpios,
3193 .col_gpios = mpq_col_gpios,
3194 .num_row_gpios = ARRAY_SIZE(mpq_row_gpios),
3195 .num_col_gpios = ARRAY_SIZE(mpq_col_gpios),
3196 .col_scan_delay_us = 32000,
3197 .debounce_ms = 20,
3198 .wakeup = 1,
3199 .active_low = 1,
3200 .no_autorepeat = 1,
3201};
3202
3203static struct platform_device mpq_keypad_device = {
3204 .name = "matrix-keypad",
3205 .id = -1,
3206 .dev = {
3207 .platform_data = &mpq_keypad_data,
3208 },
3209};
3210
Jin Hongd3024e62012-02-09 16:13:32 -08003211/* Sensors DSPS platform data */
3212#define DSPS_PIL_GENERIC_NAME "dsps"
3213static void __init apq8064_init_dsps(void)
3214{
3215 struct msm_dsps_platform_data *pdata =
3216 msm_dsps_device_8064.dev.platform_data;
3217 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
3218 pdata->gpios = NULL;
3219 pdata->gpios_num = 0;
3220
3221 platform_device_register(&msm_dsps_device_8064);
3222}
Mohan Pallaka474b94b2012-01-25 12:59:58 +05303223
Jing Lin417fa452012-02-05 14:31:06 -08003224#define I2C_SURF 1
3225#define I2C_FFA (1 << 1)
3226#define I2C_RUMI (1 << 2)
3227#define I2C_SIM (1 << 3)
3228#define I2C_LIQUID (1 << 4)
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003229#define I2C_MPQ_CDP BIT(5)
3230#define I2C_MPQ_HRD BIT(6)
3231#define I2C_MPQ_DTV BIT(7)
Jing Lin417fa452012-02-05 14:31:06 -08003232
3233struct i2c_registry {
3234 u8 machs;
3235 int bus;
3236 struct i2c_board_info *info;
3237 int len;
3238};
3239
3240static struct i2c_registry apq8064_i2c_devices[] __initdata = {
Jing Lin21ed4de2012-02-05 15:53:28 -08003241 {
David Keitel2f613d92012-02-15 11:29:16 -08003242 I2C_LIQUID,
3243 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
3244 smb349_charger_i2c_info,
3245 ARRAY_SIZE(smb349_charger_i2c_info)
3246 },
3247 {
Jing Lin21ed4de2012-02-05 15:53:28 -08003248 I2C_SURF | I2C_LIQUID,
3249 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
3250 mxt_device_info,
3251 ARRAY_SIZE(mxt_device_info),
3252 },
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08003253 {
3254 I2C_FFA,
3255 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
3256 cyttsp_info,
3257 ARRAY_SIZE(cyttsp_info),
3258 },
Amy Maloche70090f992012-02-16 16:35:26 -08003259 {
3260 I2C_FFA | I2C_LIQUID,
3261 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
3262 isa1200_board_info,
3263 ARRAY_SIZE(isa1200_board_info),
3264 },
Santosh Mardieff9a742012-04-09 23:23:39 +05303265 {
3266 I2C_MPQ_CDP,
3267 APQ_8064_GSBI5_QUP_I2C_BUS_ID,
3268 cs8427_device_info,
3269 ARRAY_SIZE(cs8427_device_info),
3270 },
Abhishek Kharbanda72dc72e2012-06-07 13:41:37 -07003271 {
3272 I2C_SURF | I2C_FFA | I2C_LIQUID,
3273 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
3274 sii_device_info,
3275 ARRAY_SIZE(sii_device_info),
3276 }
Jing Lin417fa452012-02-05 14:31:06 -08003277};
3278
Kuirong Wangf8c5e142012-06-21 16:17:32 -07003279static struct i2c_registry apq8064_tabla_i2c_devices[] __initdata = {
3280 {
3281 .bus = APQ_8064_GSBI1_QUP_I2C_BUS_ID,
3282 .info = apq8064_tabla_i2c_device_info,
3283 .len = ARRAY_SIZE(apq8064_tabla_i2c_device_info),
3284 },
3285};
3286
Jay Chokshi607f61b2012-04-25 18:21:21 -07003287#define SX150X_EXP1_INT_N PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9)
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05303288#define SX150X_EXP2_INT_N MSM_GPIO_TO_INT(81)
Jay Chokshi607f61b2012-04-25 18:21:21 -07003289
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003290struct sx150x_platform_data mpq8064_sx150x_pdata[] = {
3291 [SX150X_EXP1] = {
3292 .gpio_base = SX150X_EXP1_GPIO_BASE,
3293 .oscio_is_gpo = false,
3294 .io_pullup_ena = 0x0,
3295 .io_pulldn_ena = 0x0,
3296 .io_open_drain_ena = 0x0,
3297 .io_polarity = 0,
Jay Chokshi607f61b2012-04-25 18:21:21 -07003298 .irq_summary = SX150X_EXP1_INT_N,
3299 .irq_base = SX150X_EXP1_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003300 },
3301 [SX150X_EXP2] = {
3302 .gpio_base = SX150X_EXP2_GPIO_BASE,
3303 .oscio_is_gpo = false,
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05303304 .io_pullup_ena = 0x0f,
3305 .io_pulldn_ena = 0x70,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003306 .io_open_drain_ena = 0x0,
3307 .io_polarity = 0,
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05303308 .irq_summary = SX150X_EXP2_INT_N,
3309 .irq_base = SX150X_EXP2_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003310 },
3311 [SX150X_EXP3] = {
3312 .gpio_base = SX150X_EXP3_GPIO_BASE,
3313 .oscio_is_gpo = false,
3314 .io_pullup_ena = 0x0,
3315 .io_pulldn_ena = 0x0,
3316 .io_open_drain_ena = 0x0,
3317 .io_polarity = 0,
3318 .irq_summary = -1,
3319 },
3320 [SX150X_EXP4] = {
3321 .gpio_base = SX150X_EXP4_GPIO_BASE,
3322 .oscio_is_gpo = false,
3323 .io_pullup_ena = 0x0,
3324 .io_pulldn_ena = 0x0,
3325 .io_open_drain_ena = 0x0,
3326 .io_polarity = 0,
3327 .irq_summary = -1,
3328 },
3329};
3330
3331static struct i2c_board_info sx150x_gpio_exp_info[] = {
3332 {
3333 I2C_BOARD_INFO("sx1509q", 0x70),
3334 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP1],
3335 },
3336 {
3337 I2C_BOARD_INFO("sx1508q", 0x23),
3338 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP2],
3339 },
3340 {
3341 I2C_BOARD_INFO("sx1508q", 0x22),
3342 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP3],
3343 },
3344 {
3345 I2C_BOARD_INFO("sx1509q", 0x3E),
3346 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP4],
3347 },
3348};
3349
3350#define MPQ8064_I2C_GSBI5_BUS_ID 5
3351
3352static struct i2c_registry mpq8064_i2c_devices[] __initdata = {
3353 {
3354 I2C_MPQ_CDP,
3355 MPQ8064_I2C_GSBI5_BUS_ID,
3356 sx150x_gpio_exp_info,
3357 ARRAY_SIZE(sx150x_gpio_exp_info),
3358 },
3359};
3360
Jing Lin417fa452012-02-05 14:31:06 -08003361static void __init register_i2c_devices(void)
3362{
3363 u8 mach_mask = 0;
3364 int i;
Kuirong Wangf8c5e142012-06-21 16:17:32 -07003365 u32 version;
Jing Lin417fa452012-02-05 14:31:06 -08003366
Kevin Chand07220e2012-02-13 15:52:22 -08003367#ifdef CONFIG_MSM_CAMERA
3368 struct i2c_registry apq8064_camera_i2c_devices = {
3369 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_RUMI,
3370 APQ_8064_GSBI4_QUP_I2C_BUS_ID,
3371 apq8064_camera_board_info.board_info,
3372 apq8064_camera_board_info.num_i2c_board_info,
3373 };
3374#endif
Jing Lin417fa452012-02-05 14:31:06 -08003375 /* Build the matching 'supported_machs' bitmask */
3376 if (machine_is_apq8064_cdp())
3377 mach_mask = I2C_SURF;
3378 else if (machine_is_apq8064_mtp())
3379 mach_mask = I2C_FFA;
3380 else if (machine_is_apq8064_liquid())
3381 mach_mask = I2C_LIQUID;
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003382 else if (PLATFORM_IS_MPQ8064())
3383 mach_mask = I2C_MPQ_CDP;
Jing Lin417fa452012-02-05 14:31:06 -08003384 else
3385 pr_err("unmatched machine ID in register_i2c_devices\n");
3386
3387 /* Run the array and install devices as appropriate */
3388 for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) {
3389 if (apq8064_i2c_devices[i].machs & mach_mask)
3390 i2c_register_board_info(apq8064_i2c_devices[i].bus,
3391 apq8064_i2c_devices[i].info,
3392 apq8064_i2c_devices[i].len);
3393 }
Kevin Chand07220e2012-02-13 15:52:22 -08003394#ifdef CONFIG_MSM_CAMERA
3395 if (apq8064_camera_i2c_devices.machs & mach_mask)
3396 i2c_register_board_info(apq8064_camera_i2c_devices.bus,
3397 apq8064_camera_i2c_devices.info,
3398 apq8064_camera_i2c_devices.len);
3399#endif
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003400
3401 for (i = 0; i < ARRAY_SIZE(mpq8064_i2c_devices); ++i) {
3402 if (mpq8064_i2c_devices[i].machs & mach_mask)
3403 i2c_register_board_info(
3404 mpq8064_i2c_devices[i].bus,
3405 mpq8064_i2c_devices[i].info,
3406 mpq8064_i2c_devices[i].len);
3407 }
Kuirong Wangf8c5e142012-06-21 16:17:32 -07003408
3409 if (machine_is_apq8064_mtp()) {
3410 version = socinfo_get_platform_version();
3411 if (SOCINFO_VERSION_MINOR(version) == 1)
3412 for (i = 0; i < ARRAY_SIZE(apq8064_tabla_i2c_devices);
3413 ++i)
3414 i2c_register_board_info(
3415 apq8064_tabla_i2c_devices[i].bus,
3416 apq8064_tabla_i2c_devices[i].info,
3417 apq8064_tabla_i2c_devices[i].len);
3418 }
3419
Jing Lin417fa452012-02-05 14:31:06 -08003420}
3421
Jay Chokshi994ff122012-03-27 15:43:48 -07003422static void enable_ddr3_regulator(void)
3423{
3424 static struct regulator *ext_ddr3;
3425
3426 /* Use MPP7 output state as a flag for PCDDR3 presence. */
3427 if (gpio_get_value_cansleep(PM8921_MPP_PM_TO_SYS(7)) > 0) {
3428 ext_ddr3 = regulator_get(NULL, "ext_ddr3");
3429 if (IS_ERR(ext_ddr3) || ext_ddr3 == NULL)
3430 pr_err("Could not get MPP7 regulator\n");
3431 else
3432 regulator_enable(ext_ddr3);
3433 }
3434}
3435
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003436static void enable_avc_i2c_bus(void)
3437{
3438 int avc_i2c_en_mpp = PM8921_MPP_PM_TO_SYS(8);
3439 int rc;
3440
3441 rc = gpio_request(avc_i2c_en_mpp, "avc_i2c_en");
3442 if (rc)
3443 pr_err("request for avc_i2c_en mpp failed,"
3444 "rc=%d\n", rc);
3445 else
3446 gpio_set_value_cansleep(avc_i2c_en_mpp, 1);
3447}
3448
David Collinsd49a1c52012-08-22 13:18:06 -07003449/* Modify platform data values to match requirements for PM8917. */
3450static void __init apq8064_pm8917_pdata_fixup(void)
3451{
3452 cdp_keys_data.buttons = cdp_keys_pm8917;
3453 cdp_keys_data.nbuttons = ARRAY_SIZE(cdp_keys_pm8917);
3454}
3455
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003456static void __init apq8064_common_init(void)
3457{
Kuirong Wangf8c5e142012-06-21 16:17:32 -07003458 u32 platform_version = socinfo_get_platform_version();
Hemant Kumarbc8bdf62012-10-17 12:29:51 -07003459 struct msm_rpmrs_level rpmrs_level;
David Collinsd49a1c52012-08-22 13:18:06 -07003460
3461 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
3462 apq8064_pm8917_pdata_fixup();
Rohit Vaswanib1cc4932012-07-23 21:30:11 -07003463 platform_device_register(&msm_gpio_device);
Joel King8f839b92012-04-01 14:37:46 -07003464 msm_tsens_early_init(&apq_tsens_pdata);
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06003465 msm_thermal_init(&msm_thermal_pdata);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003466 if (socinfo_init() < 0)
3467 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06003468 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
3469 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
David Collins2782b5c2012-02-06 10:02:42 -08003470 regulator_suppress_info_printing();
David Collins793793b2012-08-21 15:43:02 -07003471 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
3472 configure_apq8064_pm8917_power_grid();
David Collins2782b5c2012-02-06 10:02:42 -08003473 platform_device_register(&apq8064_device_rpm_regulator);
David Collins793793b2012-08-21 15:43:02 -07003474 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917)
3475 platform_device_register(&apq8064_pm8921_device_rpm_regulator);
Stephen Boyd4d0d2582012-02-10 14:49:40 -08003476 if (msm_xo_init())
3477 pr_err("Failed to initialize XO votes\n");
Matt Wagantallc51e5602012-02-27 17:25:25 -08003478 msm_clock_init(&apq8064_clock_init_data);
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08003479 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06003480 apq8064_i2c_init();
Mohan Pallakab8aa8282012-10-04 14:26:21 +05303481
3482 /* configure sx150x parameters for HRD */
3483 if (machine_is_mpq8064_hrd()) {
3484 mpq8064_sx150x_pdata[SX150X_EXP2].irq_summary =
3485 PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 40);
3486 mpq8064_sx150x_pdata[SX150X_EXP2].io_pullup_ena = 0xff;
3487 mpq8064_sx150x_pdata[SX150X_EXP2].io_pulldn_ena = 0x00;
3488 }
3489
Jing Lin417fa452012-02-05 14:31:06 -08003490 register_i2c_devices();
Kenneth Heitke36920d32011-07-20 16:44:30 -06003491
Harini Jayaramanc4c58692011-07-19 14:50:10 -06003492 apq8064_device_qup_spi_gsbi5.dev.platform_data =
3493 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08003494 apq8064_init_pmic();
Hemant Kumar94e7da22012-02-03 16:52:29 -08003495 if (machine_is_apq8064_liquid())
3496 msm_otg_pdata.mhl_enable = true;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07003497
Abhishek Kharbanda72dc72e2012-06-07 13:41:37 -07003498 if (apq8064_mhl_display_enabled())
3499 mhl_platform_data.mhl_enabled = true;
3500
Ofir Cohen94213a72012-05-03 14:26:32 +03003501 android_usb_pdata.swfi_latency =
3502 msm_rpmrs_levels[0].latency_us;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07003503
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003504 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Manu Gautam91223e02011-11-08 15:27:22 +05303505 apq8064_ehci_host_init();
Gagan Mac8a7a5d32011-11-11 16:43:06 -07003506 apq8064_init_buses();
David Collins793793b2012-08-21 15:43:02 -07003507
3508 platform_add_devices(early_common_devices,
3509 ARRAY_SIZE(early_common_devices));
3510 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917)
3511 platform_add_devices(pm8921_common_devices,
3512 ARRAY_SIZE(pm8921_common_devices));
3513 else
3514 platform_add_devices(pm8917_common_devices,
3515 ARRAY_SIZE(pm8917_common_devices));
David Collins03c16372012-10-04 15:57:28 -07003516 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
3517 platform_device_register(&apq8064_device_ext_ts_sw_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003518 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Terence Hampson36b70722012-05-10 13:18:16 -04003519 if (!(machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
3520 machine_is_mpq8064_dtv()))
3521 platform_add_devices(common_not_mpq_devices,
3522 ARRAY_SIZE(common_not_mpq_devices));
Kuirong Wangf8c5e142012-06-21 16:17:32 -07003523
3524 if ((machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
3525 machine_is_mpq8064_dtv()))
3526 platform_add_devices(common_mpq_devices,
3527 ARRAY_SIZE(common_mpq_devices));
3528
3529 if (machine_is_apq8064_mtp()) {
3530 if (SOCINFO_VERSION_MINOR(platform_version) == 1)
3531 platform_add_devices(common_i2s_devices,
3532 ARRAY_SIZE(common_i2s_devices));
3533 }
3534
Jay Chokshi994ff122012-03-27 15:43:48 -07003535 enable_ddr3_regulator();
Hemant Kumarbc8bdf62012-10-17 12:29:51 -07003536 rpmrs_level =
3537 msm_rpmrs_levels[MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT];
3538 msm_hsic_pdata.swfi_latency = rpmrs_level.latency_us;
3539 rpmrs_level =
3540 msm_rpmrs_levels[MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE];
3541 msm_hsic_pdata.standalone_latency = rpmrs_level.latency_us;
Hemant Kumarf1ca9192012-02-07 18:59:33 -08003542 if (machine_is_apq8064_mtp()) {
Hemant Kumar30d361c2012-08-20 14:44:40 -07003543 msm_hsic_pdata.log2_irq_thresh = 5,
Hemant Kumarf1ca9192012-02-07 18:59:33 -08003544 apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
3545 device_initialize(&apq8064_device_hsic_host.dev);
3546 }
Jay Chokshie8741282012-01-25 15:22:55 -08003547 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05303548 apq8064_init_mmc();
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08003549
3550 if (machine_is_apq8064_mtp()) {
3551 mdm_8064_device.dev.platform_data = &mdm_platform_data;
Ameya Thakure155ece2012-07-09 12:08:37 -07003552 if (SOCINFO_VERSION_MINOR(platform_version) == 1) {
3553 i2s_mdm_8064_device.dev.platform_data =
3554 &mdm_platform_data;
3555 platform_device_register(&i2s_mdm_8064_device);
3556 } else {
3557 mdm_8064_device.dev.platform_data = &mdm_platform_data;
3558 platform_device_register(&mdm_8064_device);
3559 }
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08003560 }
3561 platform_device_register(&apq8064_slim_ctrl);
Santosh Mardi344455a2012-09-07 13:22:16 +05303562 if (machine_is_mpq8064_hrd() || machine_is_mpq8064_dtv()) {
3563 apq8064_slim_devices[ARRAY_SIZE(apq8064_slim_devices) - 1].\
3564 slim_slave = &mpq8064_slim_ashiko20;
3565 }
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06003566 slim_register_board_info(apq8064_slim_devices,
3567 ARRAY_SIZE(apq8064_slim_devices));
Taniya Dasbbf633d2012-07-31 16:07:47 +05303568 if (!PLATFORM_IS_MPQ8064()) {
Taniya Das30cae292012-07-31 15:56:12 +05303569 apq8064_init_dsps();
Taniya Dasbbf633d2012-07-31 16:07:47 +05303570 platform_device_register(&msm_8960_riva);
3571 }
Praveen Chidambaramc3c90822012-11-07 15:43:49 -07003572 if (cpu_is_apq8064ab())
3573 apq8064ab_update_krait_spm();
Praveen Chidambaram78499012011-11-01 17:15:17 -06003574 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3575 msm_spm_l2_init(msm_spm_l2_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06003576 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08003577 apq8064_epm_adc_init();
Girish Mahadevan3bc98772012-08-15 10:01:27 -06003578 msm_pm_set_tz_retention_flag(1);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003579}
3580
Huaibin Yang4a084e32011-12-15 15:25:52 -08003581static void __init apq8064_allocate_memory_regions(void)
3582{
3583 apq8064_allocate_fb_region();
3584}
3585
Joel King82b7e3f2012-01-05 10:03:27 -08003586static void __init apq8064_cdp_init(void)
3587{
Hanumant Singh50440d42012-04-23 19:27:16 -07003588 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
3589 pr_err("meminfo_init() failed!\n");
Amy Maloche609bb5e2012-08-03 09:41:42 -07003590 if (machine_is_apq8064_mtp() &&
3591 SOCINFO_VERSION_MINOR(socinfo_get_platform_version()) == 1)
3592 cyttsp_pdata.sleep_gpio = CYTTSP_TS_GPIO_SLEEP_ALT;
Joel King82b7e3f2012-01-05 10:03:27 -08003593 apq8064_common_init();
Joel King8f839b92012-04-01 14:37:46 -07003594 if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
3595 machine_is_mpq8064_dtv()) {
Ravi Kumar V16a614c2012-10-12 20:59:56 +05303596 gpio_ir_recv_pdata.swfi_latency =
3597 msm_rpmrs_levels[0].latency_us;
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003598 enable_avc_i2c_bus();
Olav Hauganef95ae32012-05-15 09:50:30 -07003599 msm_rotator_set_split_iommu_domain();
Bar Weinerf82c5872012-10-23 14:31:26 +02003600
3601 mpq8064_device_qup_spi_gsbi6.dev.platform_data =
3602 &mpq8064_qup_spi_gsbi6_pdata;
3603
Joel King8f839b92012-04-01 14:37:46 -07003604 platform_add_devices(mpq_devices, ARRAY_SIZE(mpq_devices));
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06003605 mpq8064_pcie_init();
Bar Weinerf82c5872012-10-23 14:31:26 +02003606 spi_register_board_info(mpq8064_spi_board_info,
3607 ARRAY_SIZE(mpq8064_spi_board_info));
Joel King8f839b92012-04-01 14:37:46 -07003608 } else {
3609 ethernet_init();
Olav Hauganef95ae32012-05-15 09:50:30 -07003610 msm_rotator_set_split_iommu_domain();
Joel King8f839b92012-04-01 14:37:46 -07003611 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
3612 spi_register_board_info(spi_board_info,
3613 ARRAY_SIZE(spi_board_info));
3614 }
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003615 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07003616 apq8064_init_gpu();
Matt Wagantall1f65d9d2012-04-25 14:24:20 -07003617 platform_add_devices(apq8064_footswitch, apq8064_num_footswitch);
Steve Mucklef132c6c2012-06-06 18:30:57 -07003618#ifdef CONFIG_MSM_CAMERA
Kevin Chand07220e2012-02-13 15:52:22 -08003619 apq8064_init_cam();
Steve Mucklef132c6c2012-06-06 18:30:57 -07003620#endif
Mohan Pallaka474b94b2012-01-25 12:59:58 +05303621
Mayank Rana262e9032012-05-10 15:14:00 -07003622 if (machine_is_mpq8064_hrd() || machine_is_mpq8064_dtv()) {
3623 platform_device_register(&mpq8064_device_uartdm_gsbi6);
3624#ifdef CONFIG_SERIAL_MSM_HS
3625 /* GSBI6(2) - UARTDM_RX */
3626 mpq8064_gsbi6_uartdm_pdata.wakeup_irq = gpio_to_irq(15);
3627 mpq8064_device_uartdm_gsbi6.dev.platform_data =
3628 &mpq8064_gsbi6_uartdm_pdata;
3629#endif
3630 }
3631
Ankit Verma6fe41b02012-09-13 16:12:11 +05303632#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
3633 if (machine_is_mpq8064_hrd())
3634 apq8064_bt_power_init();
3635#endif
3636
Mohan Pallaka474b94b2012-01-25 12:59:58 +05303637 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
3638 platform_device_register(&cdp_kp_pdev);
3639
3640 if (machine_is_apq8064_mtp())
3641 platform_device_register(&mtp_kp_pdev);
Hanumant Singh50440d42012-04-23 19:27:16 -07003642
3643 change_memory_power = &apq8064_change_memory_power;
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05303644
3645 if (machine_is_mpq8064_cdp()) {
3646 platform_device_register(&mpq_gpio_keys_pdev);
3647 platform_device_register(&mpq_keypad_device);
Mohan Pallakab8aa8282012-10-04 14:26:21 +05303648 } else if (machine_is_mpq8064_hrd())
3649 platform_device_register(&mpq_hrd_keys_pdev);
Joel King82b7e3f2012-01-05 10:03:27 -08003650}
3651
Joel King82b7e3f2012-01-05 10:03:27 -08003652MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
3653 .map_io = apq8064_map_io,
3654 .reserve = apq8064_reserve,
3655 .init_irq = apq8064_init_irq,
3656 .handle_irq = gic_handle_irq,
3657 .timer = &msm_timer,
3658 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003659 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003660 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003661 .restart = msm_restart,
Joel King82b7e3f2012-01-05 10:03:27 -08003662MACHINE_END
3663
3664MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
3665 .map_io = apq8064_map_io,
3666 .reserve = apq8064_reserve,
3667 .init_irq = apq8064_init_irq,
3668 .handle_irq = gic_handle_irq,
3669 .timer = &msm_timer,
3670 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003671 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003672 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003673 .restart = msm_restart,
Joel King82b7e3f2012-01-05 10:03:27 -08003674MACHINE_END
3675
3676MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
3677 .map_io = apq8064_map_io,
3678 .reserve = apq8064_reserve,
3679 .init_irq = apq8064_init_irq,
3680 .handle_irq = gic_handle_irq,
3681 .timer = &msm_timer,
3682 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003683 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003684 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003685 .restart = msm_restart,
Joel King82b7e3f2012-01-05 10:03:27 -08003686MACHINE_END
3687
Joel King064bbf82012-04-01 13:23:39 -07003688MACHINE_START(MPQ8064_CDP, "QCT MPQ8064 CDP")
3689 .map_io = apq8064_map_io,
3690 .reserve = apq8064_reserve,
3691 .init_irq = apq8064_init_irq,
3692 .handle_irq = gic_handle_irq,
3693 .timer = &msm_timer,
3694 .init_machine = apq8064_cdp_init,
3695 .init_early = apq8064_allocate_memory_regions,
3696 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003697 .restart = msm_restart,
Joel King064bbf82012-04-01 13:23:39 -07003698MACHINE_END
3699
Joel King11ca8202012-02-13 16:19:03 -08003700MACHINE_START(MPQ8064_HRD, "QCT MPQ8064 HRD")
3701 .map_io = apq8064_map_io,
3702 .reserve = apq8064_reserve,
3703 .init_irq = apq8064_init_irq,
3704 .handle_irq = gic_handle_irq,
3705 .timer = &msm_timer,
3706 .init_machine = apq8064_cdp_init,
Joel King3a57e772012-05-28 11:22:55 -07003707 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003708 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003709 .restart = msm_restart,
Joel King11ca8202012-02-13 16:19:03 -08003710MACHINE_END
3711
3712MACHINE_START(MPQ8064_DTV, "QCT MPQ8064 DTV")
3713 .map_io = apq8064_map_io,
3714 .reserve = apq8064_reserve,
3715 .init_irq = apq8064_init_irq,
3716 .handle_irq = gic_handle_irq,
3717 .timer = &msm_timer,
3718 .init_machine = apq8064_cdp_init,
Joel King3a57e772012-05-28 11:22:55 -07003719 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003720 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003721 .restart = msm_restart,
Joel King11ca8202012-02-13 16:19:03 -08003722MACHINE_END