blob: f80ef980522f29698b1a0402851d0bf69704640a [file] [log] [blame]
Abhijeet Dharmapurikarfb4a2f82012-08-23 14:36:59 -07001/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13#include <linux/kernel.h>
Niranjana Vishwanathapurac1edd402012-06-28 15:32:50 -060014#include <linux/bitops.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070015#include <linux/platform_device.h>
Steve Mucklef132c6c2012-06-06 18:30:57 -070016#include <linux/gpio.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070017#include <linux/io.h>
18#include <linux/irq.h>
Kenneth Heitke748593a2011-07-15 15:45:11 -060019#include <linux/i2c.h>
David Keitel2f613d92012-02-15 11:29:16 -080020#include <linux/i2c/smb349.h>
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -080021#include <linux/i2c/sx150x.h>
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -060022#include <linux/slimbus/slimbus.h>
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +053023#include <linux/mfd/wcd9xxx/core.h>
24#include <linux/mfd/wcd9xxx/pdata.h>
Amy Maloche70090f992012-02-16 16:35:26 -080025#include <linux/mfd/pm8xxx/misc.h>
Kenneth Heitke36920d32011-07-20 16:44:30 -060026#include <linux/msm_ssbi.h>
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -070027#include <linux/spi/spi.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070028#include <linux/dma-mapping.h>
29#include <linux/platform_data/qcom_crypto_device.h>
Mitchel Humpherysca983d82012-09-06 11:32:54 -070030#include <linux/msm_ion.h>
Jack Cheung46bfffa2012-01-19 15:26:24 -080031#include <linux/memory.h>
Larry Bassel67b921d2012-04-06 10:23:27 -070032#include <linux/memblock.h>
Praveen Chidambaram877d7a42012-06-05 14:33:20 -060033#include <linux/msm_thermal.h>
Jing Lin21ed4de2012-02-05 15:53:28 -080034#include <linux/i2c/atmel_mxt_ts.h>
Steve Mucklef132c6c2012-06-06 18:30:57 -070035#include <linux/cyttsp-qc.h>
Amy Maloche70090f992012-02-16 16:35:26 -080036#include <linux/i2c/isa1200.h>
Mohan Pallaka474b94b2012-01-25 12:59:58 +053037#include <linux/gpio_keys.h>
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -080038#include <linux/epm_adc.h>
Jay Chokshie7d8d4f2012-04-04 14:47:57 -070039#include <linux/i2c/sx150x.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070040#include <asm/mach-types.h>
41#include <asm/mach/arch.h>
42#include <asm/hardware/gic.h>
Sahitya Tummala3586ed92011-08-03 09:13:23 +053043#include <asm/mach/mmc.h>
Ankit Verma6b7e2ba2012-01-26 15:48:54 -080044#include <linux/platform_data/qcom_wcnss_device.h>
Bar Weinerf82c5872012-10-23 14:31:26 +020045#include <linux/ci-bridge-spi.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070046
47#include <mach/board.h>
48#include <mach/msm_iomap.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080049#include <mach/ion.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070050#include <linux/usb/msm_hsusb.h>
51#include <linux/usb/android.h>
52#include <mach/socinfo.h>
Harini Jayaramanc4c58692011-07-19 14:50:10 -060053#include <mach/msm_spi.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070054#include "timer.h"
55#include "devices.h"
Joel King4ebccc62011-07-22 09:43:22 -070056#include <mach/gpiomux.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060057#include <mach/rpm.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080058#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -070059#include <linux/android_pmem.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080060#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070061#include <mach/msm_memtypes.h>
62#include <linux/bootmem.h>
63#include <asm/setup.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070064#include <mach/dma.h>
Jin Hongd3024e62012-02-09 16:13:32 -080065#include <mach/msm_dsps.h>
Gagan Mac8a7a5d32011-11-11 16:43:06 -070066#include <mach/msm_bus_board.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060067#include <mach/cpuidle.h>
Joel Kingdacbc822012-01-25 13:30:57 -080068#include <mach/mdm2.h>
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -080069#include <linux/msm_tsens.h>
Stephen Boyd4d0d2582012-02-10 14:49:40 -080070#include <mach/msm_xo.h>
Laura Abbott350c8362012-02-28 14:46:52 -080071#include <mach/msm_rtb.h>
Mayank Rana262e9032012-05-10 15:14:00 -070072#include <mach/msm_serial_hs.h>
Santosh Mardieff9a742012-04-09 23:23:39 +053073#include <sound/cs8427.h>
Ravi Kumar V05931a22012-04-04 17:09:37 +053074#include <media/gpio-ir-recv.h>
Larry Bassel67b921d2012-04-06 10:23:27 -070075#include <linux/fmem.h>
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -060076#include <mach/msm_pcie.h>
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -070077#include <mach/restart.h>
Niranjana Vishwanathapurac1edd402012-06-28 15:32:50 -060078#include <mach/msm_iomap.h>
Joel King4ebccc62011-07-22 09:43:22 -070079
Jeff Ohlstein7e668552011-10-06 16:17:25 -070080#include "msm_watchdog.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080081#include "board-8064.h"
Matt Wagantall33d01f52012-02-23 23:27:44 -080082#include "clock.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060083#include "spm.h"
Subhash Jadavani909e04f2012-04-12 10:52:50 +053084#include <mach/mpm.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060085#include "rpm_resources.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080086#include "pm.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060087#include "pm-boot.h"
Rajesh Sastrulaaee8af32012-01-20 11:46:31 -080088#include "devices-msm8x60.h"
Hanumant Singh50440d42012-04-23 19:27:16 -070089#include "smd_private.h"
Jay Chokshiea67c622011-07-29 17:12:26 -070090
Abhishek Kharbanda72dc72e2012-06-07 13:41:37 -070091#define MHL_GPIO_INT 30
92#define MHL_GPIO_RESET 35
93
Olav Haugan7c6aa742012-01-16 16:47:37 -080094#define MSM_PMEM_ADSP_SIZE 0x7800000
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -070095#define MSM_PMEM_AUDIO_SIZE 0x4CF000
Olav Haugan7c6aa742012-01-16 16:47:37 -080096#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
97#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
98#else
Chetan Kalyan72aac4f2012-02-23 14:56:54 -080099#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800100#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700101
Olav Haugan7c6aa742012-01-16 16:47:37 -0800102#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Hanumant Singheadb7502012-05-15 18:14:04 -0700103#define HOLE_SIZE 0x20000
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700104#define MSM_CONTIG_MEM_SIZE 0x65000
Olav Haugan129992c2012-03-22 09:54:01 -0700105#ifdef CONFIG_MSM_IOMMU
106#define MSM_ION_MM_SIZE 0x3800000
107#define MSM_ION_SF_SIZE 0
Olav Haugan39477bb2012-05-14 16:05:36 -0700108#define MSM_ION_QSECOM_SIZE 0x780000 /* (7.5MB) */
Olav Haugan129992c2012-03-22 09:54:01 -0700109#define MSM_ION_HEAP_NUM 7
110#else
Olav Haugan7c6aa742012-01-16 16:47:37 -0800111#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Haugan129992c2012-03-22 09:54:01 -0700112#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Haugan39477bb2012-05-14 16:05:36 -0700113#define MSM_ION_QSECOM_SIZE 0x600000 /* (6MB) */
Olav Haugan129992c2012-03-22 09:54:01 -0700114#define MSM_ION_HEAP_NUM 8
115#endif
Hanumant Singheadb7502012-05-15 18:14:04 -0700116#define MSM_ION_MM_FW_SIZE (0x200000 - HOLE_SIZE) /* (2MB - 128KB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800117#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan2c43fac2012-01-19 11:06:37 -0800118#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Olav Haugan7c6aa742012-01-16 16:47:37 -0800119#else
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700120#define MSM_CONTIG_MEM_SIZE 0x110C000
Olav Haugan7c6aa742012-01-16 16:47:37 -0800121#define MSM_ION_HEAP_NUM 1
122#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700123
Hanumant Singheadb7502012-05-15 18:14:04 -0700124#define APQ8064_FIXED_AREA_START (0xa0000000 - (MSM_ION_MM_FW_SIZE + \
125 HOLE_SIZE))
Larry Bassel67b921d2012-04-06 10:23:27 -0700126#define MAX_FIXED_AREA_SIZE 0x10000000
Hanumant Singheadb7502012-05-15 18:14:04 -0700127#define MSM_MM_FW_SIZE (0x200000 - HOLE_SIZE)
128#define APQ8064_FW_START APQ8064_FIXED_AREA_START
Larry Bassel67b921d2012-04-06 10:23:27 -0700129
Niranjana Vishwanathapurac1edd402012-06-28 15:32:50 -0600130#define QFPROM_RAW_FEAT_CONFIG_ROW0_MSB (MSM_QFPROM_BASE + 0x23c)
131#define QFPROM_RAW_OEM_CONFIG_ROW0_LSB (MSM_QFPROM_BASE + 0x220)
132
Niranjana Vishwanathapura68210ff2012-06-24 18:03:49 -0600133/* PCIE AXI address space */
134#define PCIE_AXI_BAR_PHYS 0x08000000
135#define PCIE_AXI_BAR_SIZE SZ_128M
136
Niranjana Vishwanathapura459a27d2012-07-20 12:23:55 -0600137/* PCIe pmic gpios */
138#define PCIE_WAKE_N_PMIC_GPIO 12
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -0600139#define PCIE_PWR_EN_PMIC_GPIO 13
140#define PCIE_RST_N_PMIC_MPP 1
141
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700142#ifdef CONFIG_KERNEL_MSM_CONTIG_MEM_REGION
143static unsigned msm_contig_mem_size = MSM_CONTIG_MEM_SIZE;
144static int __init msm_contig_mem_size_setup(char *p)
Kevin Chan13be4e22011-10-20 11:30:32 -0700145{
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700146 msm_contig_mem_size = memparse(p, NULL);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800147 return 0;
Kevin Chan13be4e22011-10-20 11:30:32 -0700148}
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700149early_param("msm_contig_mem_size", msm_contig_mem_size_setup);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800150#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700151
Olav Haugan7c6aa742012-01-16 16:47:37 -0800152#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -0700153static unsigned pmem_size = MSM_PMEM_SIZE;
154static int __init pmem_size_setup(char *p)
155{
156 pmem_size = memparse(p, NULL);
157 return 0;
158}
159early_param("pmem_size", pmem_size_setup);
160
161static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
162
163static int __init pmem_adsp_size_setup(char *p)
164{
165 pmem_adsp_size = memparse(p, NULL);
166 return 0;
167}
168early_param("pmem_adsp_size", pmem_adsp_size_setup);
169
170static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
171
172static int __init pmem_audio_size_setup(char *p)
173{
174 pmem_audio_size = memparse(p, NULL);
175 return 0;
176}
177early_param("pmem_audio_size", pmem_audio_size_setup);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800178#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700179
Olav Haugan7c6aa742012-01-16 16:47:37 -0800180#ifdef CONFIG_ANDROID_PMEM
181#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700182static struct android_pmem_platform_data android_pmem_pdata = {
183 .name = "pmem",
184 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
185 .cached = 1,
186 .memory_type = MEMTYPE_EBI1,
187};
188
Laura Abbottb93525f2012-04-12 09:57:19 -0700189static struct platform_device apq8064_android_pmem_device = {
Kevin Chan13be4e22011-10-20 11:30:32 -0700190 .name = "android_pmem",
191 .id = 0,
192 .dev = {.platform_data = &android_pmem_pdata},
193};
194
195static struct android_pmem_platform_data android_pmem_adsp_pdata = {
196 .name = "pmem_adsp",
197 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
198 .cached = 0,
199 .memory_type = MEMTYPE_EBI1,
200};
Laura Abbottb93525f2012-04-12 09:57:19 -0700201static struct platform_device apq8064_android_pmem_adsp_device = {
Kevin Chan13be4e22011-10-20 11:30:32 -0700202 .name = "android_pmem",
203 .id = 2,
204 .dev = { .platform_data = &android_pmem_adsp_pdata },
205};
206
207static struct android_pmem_platform_data android_pmem_audio_pdata = {
208 .name = "pmem_audio",
209 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
210 .cached = 0,
211 .memory_type = MEMTYPE_EBI1,
212};
213
Laura Abbottb93525f2012-04-12 09:57:19 -0700214static struct platform_device apq8064_android_pmem_audio_device = {
Kevin Chan13be4e22011-10-20 11:30:32 -0700215 .name = "android_pmem",
216 .id = 4,
217 .dev = { .platform_data = &android_pmem_audio_pdata },
218};
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700219#endif /* CONFIG_MSM_MULTIMEDIA_USE_ION */
220#endif /* CONFIG_ANDROID_PMEM */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800221
Binqiang Qiuf165c922012-08-15 18:00:18 -0700222#ifdef CONFIG_BATTERY_BCL
223static struct platform_device battery_bcl_device = {
224 .name = "battery_current_limit",
225 .id = -1,
226};
227#endif
228
Larry Bassel67b921d2012-04-06 10:23:27 -0700229struct fmem_platform_data apq8064_fmem_pdata = {
230};
231
Olav Haugan7c6aa742012-01-16 16:47:37 -0800232static struct memtype_reserve apq8064_reserve_table[] __initdata = {
233 [MEMTYPE_SMI] = {
234 },
235 [MEMTYPE_EBI0] = {
236 .flags = MEMTYPE_FLAGS_1M_ALIGN,
237 },
238 [MEMTYPE_EBI1] = {
239 .flags = MEMTYPE_FLAGS_1M_ALIGN,
240 },
241};
Kevin Chan13be4e22011-10-20 11:30:32 -0700242
Laura Abbott350c8362012-02-28 14:46:52 -0800243static void __init reserve_rtb_memory(void)
244{
245#if defined(CONFIG_MSM_RTB)
Laura Abbottb93525f2012-04-12 09:57:19 -0700246 apq8064_reserve_table[MEMTYPE_EBI1].size += apq8064_rtb_pdata.size;
Laura Abbott350c8362012-02-28 14:46:52 -0800247#endif
248}
249
250
Kevin Chan13be4e22011-10-20 11:30:32 -0700251static void __init size_pmem_devices(void)
252{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800253#ifdef CONFIG_ANDROID_PMEM
254#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700255 android_pmem_adsp_pdata.size = pmem_adsp_size;
256 android_pmem_pdata.size = pmem_size;
257 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700258#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
259#endif /*CONFIG_ANDROID_PMEM*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700260}
261
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700262#ifdef CONFIG_ANDROID_PMEM
263#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700264static void __init reserve_memory_for(struct android_pmem_platform_data *p)
265{
266 apq8064_reserve_table[p->memory_type].size += p->size;
267}
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700268#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
269#endif /*CONFIG_ANDROID_PMEM*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700270
Kevin Chan13be4e22011-10-20 11:30:32 -0700271static void __init reserve_pmem_memory(void)
272{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800273#ifdef CONFIG_ANDROID_PMEM
274#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700275 reserve_memory_for(&android_pmem_adsp_pdata);
276 reserve_memory_for(&android_pmem_pdata);
277 reserve_memory_for(&android_pmem_audio_pdata);
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700278#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700279 apq8064_reserve_table[MEMTYPE_EBI1].size += msm_contig_mem_size;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700280#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -0800281}
282
283static int apq8064_paddr_to_memtype(unsigned int paddr)
284{
285 return MEMTYPE_EBI1;
286}
287
Steve Mucklef132c6c2012-06-06 18:30:57 -0700288#define FMEM_ENABLED 0
Larry Bassel67b921d2012-04-06 10:23:27 -0700289
Olav Haugan7c6aa742012-01-16 16:47:37 -0800290#ifdef CONFIG_ION_MSM
291#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -0700292static struct ion_cp_heap_pdata cp_mm_apq8064_ion_pdata = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800293 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugand3d29682012-01-19 10:57:07 -0800294 .align = PAGE_SIZE,
Larry Bassel67b921d2012-04-06 10:23:27 -0700295 .reusable = FMEM_ENABLED,
296 .mem_is_fmem = FMEM_ENABLED,
297 .fixed_position = FIXED_MIDDLE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800298};
299
Laura Abbottb93525f2012-04-12 09:57:19 -0700300static struct ion_cp_heap_pdata cp_mfc_apq8064_ion_pdata = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800301 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugand3d29682012-01-19 10:57:07 -0800302 .align = PAGE_SIZE,
Larry Bassel67b921d2012-04-06 10:23:27 -0700303 .reusable = 0,
304 .mem_is_fmem = FMEM_ENABLED,
305 .fixed_position = FIXED_HIGH,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800306};
307
Laura Abbottb93525f2012-04-12 09:57:19 -0700308static struct ion_co_heap_pdata co_apq8064_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800309 .adjacent_mem_id = INVALID_HEAP_ID,
310 .align = PAGE_SIZE,
Larry Bassel67b921d2012-04-06 10:23:27 -0700311 .mem_is_fmem = 0,
Olav Haugand3d29682012-01-19 10:57:07 -0800312};
313
Laura Abbottb93525f2012-04-12 09:57:19 -0700314static struct ion_co_heap_pdata fw_co_apq8064_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800315 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
316 .align = SZ_128K,
Larry Bassel67b921d2012-04-06 10:23:27 -0700317 .mem_is_fmem = FMEM_ENABLED,
318 .fixed_position = FIXED_LOW,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800319};
320#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800321
322/**
323 * These heaps are listed in the order they will be allocated. Due to
324 * video hardware restrictions and content protection the FW heap has to
325 * be allocated adjacent (below) the MM heap and the MFC heap has to be
326 * allocated after the MM heap to ensure MFC heap is not more than 256MB
327 * away from the base address of the FW heap.
328 * However, the order of FW heap and MM heap doesn't matter since these
329 * two heaps are taken care of by separate code to ensure they are adjacent
330 * to each other.
331 * Don't swap the order unless you know what you are doing!
332 */
Laura Abbottb93525f2012-04-12 09:57:19 -0700333static struct ion_platform_data apq8064_ion_pdata = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800334 .nr = MSM_ION_HEAP_NUM,
335 .heaps = {
336 {
337 .id = ION_SYSTEM_HEAP_ID,
338 .type = ION_HEAP_TYPE_SYSTEM,
339 .name = ION_VMALLOC_HEAP_NAME,
340 },
341#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
342 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800343 .id = ION_CP_MM_HEAP_ID,
344 .type = ION_HEAP_TYPE_CP,
345 .name = ION_MM_HEAP_NAME,
346 .size = MSM_ION_MM_SIZE,
347 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700348 .extra_data = (void *) &cp_mm_apq8064_ion_pdata,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800349 },
350 {
Olav Haugand3d29682012-01-19 10:57:07 -0800351 .id = ION_MM_FIRMWARE_HEAP_ID,
352 .type = ION_HEAP_TYPE_CARVEOUT,
353 .name = ION_MM_FIRMWARE_HEAP_NAME,
354 .size = MSM_ION_MM_FW_SIZE,
355 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700356 .extra_data = (void *) &fw_co_apq8064_ion_pdata,
Olav Haugand3d29682012-01-19 10:57:07 -0800357 },
358 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800359 .id = ION_CP_MFC_HEAP_ID,
360 .type = ION_HEAP_TYPE_CP,
361 .name = ION_MFC_HEAP_NAME,
362 .size = MSM_ION_MFC_SIZE,
363 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700364 .extra_data = (void *) &cp_mfc_apq8064_ion_pdata,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800365 },
Olav Haugan129992c2012-03-22 09:54:01 -0700366#ifndef CONFIG_MSM_IOMMU
Olav Haugan7c6aa742012-01-16 16:47:37 -0800367 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800368 .id = ION_SF_HEAP_ID,
369 .type = ION_HEAP_TYPE_CARVEOUT,
370 .name = ION_SF_HEAP_NAME,
371 .size = MSM_ION_SF_SIZE,
372 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700373 .extra_data = (void *) &co_apq8064_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800374 },
Olav Haugan129992c2012-03-22 09:54:01 -0700375#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800376 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800377 .id = ION_IOMMU_HEAP_ID,
378 .type = ION_HEAP_TYPE_IOMMU,
379 .name = ION_IOMMU_HEAP_NAME,
380 },
Olav Hauganf45e2142012-01-19 11:01:01 -0800381 {
382 .id = ION_QSECOM_HEAP_ID,
383 .type = ION_HEAP_TYPE_CARVEOUT,
384 .name = ION_QSECOM_HEAP_NAME,
385 .size = MSM_ION_QSECOM_SIZE,
386 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700387 .extra_data = (void *) &co_apq8064_ion_pdata,
Olav Hauganf45e2142012-01-19 11:01:01 -0800388 },
Olav Haugan2c43fac2012-01-19 11:06:37 -0800389 {
390 .id = ION_AUDIO_HEAP_ID,
391 .type = ION_HEAP_TYPE_CARVEOUT,
392 .name = ION_AUDIO_HEAP_NAME,
393 .size = MSM_ION_AUDIO_SIZE,
394 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700395 .extra_data = (void *) &co_apq8064_ion_pdata,
Olav Haugan2c43fac2012-01-19 11:06:37 -0800396 },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800397#endif
398 }
399};
400
Laura Abbottb93525f2012-04-12 09:57:19 -0700401static struct platform_device apq8064_ion_dev = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800402 .name = "ion-msm",
403 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700404 .dev = { .platform_data = &apq8064_ion_pdata },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800405};
406#endif
407
Larry Bassel67b921d2012-04-06 10:23:27 -0700408static struct platform_device apq8064_fmem_device = {
409 .name = "fmem",
410 .id = 1,
411 .dev = { .platform_data = &apq8064_fmem_pdata },
412};
413
414static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
415 unsigned long size)
416{
417 apq8064_reserve_table[mem_type].size += size;
418}
419
420static void __init apq8064_reserve_fixed_area(unsigned long fixed_area_size)
421{
422#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
423 int ret;
424
425 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
426 panic("fixed area size is larger than %dM\n",
427 MAX_FIXED_AREA_SIZE >> 20);
428
429 reserve_info->fixed_area_size = fixed_area_size;
430 reserve_info->fixed_area_start = APQ8064_FW_START;
431
432 ret = memblock_remove(reserve_info->fixed_area_start,
433 reserve_info->fixed_area_size);
434 BUG_ON(ret);
435#endif
436}
437
438/**
439 * Reserve memory for ION and calculate amount of reusable memory for fmem.
440 * We only reserve memory for heaps that are not reusable. However, we only
441 * support one reusable heap at the moment so we ignore the reusable flag for
442 * other than the first heap with reusable flag set. Also handle special case
443 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
444 * at a higher address than FW in addition to not more than 256MB away from the
445 * base address of the firmware. This means that if MM is reusable the other
446 * two heaps must be allocated in the same region as FW. This is handled by the
447 * mem_is_fmem flag in the platform data. In addition the MM heap must be
448 * adjacent to the FW heap for content protection purposes.
449 */
Stephen Boyd668d7652012-04-25 11:31:01 -0700450static void __init reserve_ion_memory(void)
Olav Haugan7c6aa742012-01-16 16:47:37 -0800451{
452#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Larry Bassel67b921d2012-04-06 10:23:27 -0700453 unsigned int i;
Larry Bassel67b921d2012-04-06 10:23:27 -0700454 unsigned int fixed_size = 0;
455 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
456 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
457
Larry Bassel67b921d2012-04-06 10:23:27 -0700458 fixed_low_size = 0;
459 fixed_middle_size = 0;
460 fixed_high_size = 0;
461
Larry Bassel67b921d2012-04-06 10:23:27 -0700462 for (i = 0; i < apq8064_ion_pdata.nr; ++i) {
463 const struct ion_platform_heap *heap =
464 &(apq8064_ion_pdata.heaps[i]);
465
466 if (heap->extra_data) {
467 int fixed_position = NOT_FIXED;
Larry Bassel67b921d2012-04-06 10:23:27 -0700468
Mitchel Humpherys362b52b2012-09-13 10:53:22 -0700469 switch ((int)heap->type) {
Larry Bassel67b921d2012-04-06 10:23:27 -0700470 case ION_HEAP_TYPE_CP:
Larry Bassel67b921d2012-04-06 10:23:27 -0700471 fixed_position = ((struct ion_cp_heap_pdata *)
472 heap->extra_data)->fixed_position;
473 break;
474 case ION_HEAP_TYPE_CARVEOUT:
Larry Bassel67b921d2012-04-06 10:23:27 -0700475 fixed_position = ((struct ion_co_heap_pdata *)
476 heap->extra_data)->fixed_position;
477 break;
478 default:
479 break;
480 }
481
482 if (fixed_position != NOT_FIXED)
483 fixed_size += heap->size;
484 else
485 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
486
487 if (fixed_position == FIXED_LOW)
488 fixed_low_size += heap->size;
489 else if (fixed_position == FIXED_MIDDLE)
490 fixed_middle_size += heap->size;
491 else if (fixed_position == FIXED_HIGH)
492 fixed_high_size += heap->size;
Larry Bassel67b921d2012-04-06 10:23:27 -0700493 }
494 }
495
496 if (!fixed_size)
497 return;
498
Larry Bassel67b921d2012-04-06 10:23:27 -0700499 /* Since the fixed area may be carved out of lowmem,
500 * make sure the length is a multiple of 1M.
501 */
Hanumant Singheadb7502012-05-15 18:14:04 -0700502 fixed_size = (fixed_size + HOLE_SIZE + SECTION_SIZE - 1)
Larry Bassel67b921d2012-04-06 10:23:27 -0700503 & SECTION_MASK;
504 apq8064_reserve_fixed_area(fixed_size);
505
506 fixed_low_start = APQ8064_FIXED_AREA_START;
Hanumant Singheadb7502012-05-15 18:14:04 -0700507 fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE;
Larry Bassel67b921d2012-04-06 10:23:27 -0700508 fixed_high_start = fixed_middle_start + fixed_middle_size;
509
510 for (i = 0; i < apq8064_ion_pdata.nr; ++i) {
511 struct ion_platform_heap *heap = &(apq8064_ion_pdata.heaps[i]);
512
513 if (heap->extra_data) {
514 int fixed_position = NOT_FIXED;
Steve Mucklef132c6c2012-06-06 18:30:57 -0700515 struct ion_cp_heap_pdata *pdata = NULL;
Larry Bassel67b921d2012-04-06 10:23:27 -0700516
Mitchel Humpherys362b52b2012-09-13 10:53:22 -0700517 switch ((int) heap->type) {
Larry Bassel67b921d2012-04-06 10:23:27 -0700518 case ION_HEAP_TYPE_CP:
Hanumant Singheadb7502012-05-15 18:14:04 -0700519 pdata =
520 (struct ion_cp_heap_pdata *)heap->extra_data;
521 fixed_position = pdata->fixed_position;
Larry Bassel67b921d2012-04-06 10:23:27 -0700522 break;
523 case ION_HEAP_TYPE_CARVEOUT:
524 fixed_position = ((struct ion_co_heap_pdata *)
525 heap->extra_data)->fixed_position;
526 break;
527 default:
528 break;
529 }
530
531 switch (fixed_position) {
532 case FIXED_LOW:
533 heap->base = fixed_low_start;
534 break;
535 case FIXED_MIDDLE:
536 heap->base = fixed_middle_start;
Hanumant Singheadb7502012-05-15 18:14:04 -0700537 pdata->secure_base = fixed_middle_start
538 - HOLE_SIZE;
539 pdata->secure_size = HOLE_SIZE + heap->size;
Larry Bassel67b921d2012-04-06 10:23:27 -0700540 break;
541 case FIXED_HIGH:
542 heap->base = fixed_high_start;
543 break;
544 default:
545 break;
546 }
547 }
548 }
Olav Haugan7c6aa742012-01-16 16:47:37 -0800549#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700550}
551
Huaibin Yang4a084e32011-12-15 15:25:52 -0800552static void __init reserve_mdp_memory(void)
553{
554 apq8064_mdp_writeback(apq8064_reserve_table);
555}
556
Laura Abbott93a4a352012-05-25 09:26:35 -0700557static void __init reserve_cache_dump_memory(void)
558{
559#ifdef CONFIG_MSM_CACHE_DUMP
560 unsigned int total;
561
562 total = apq8064_cache_dump_pdata.l1_size +
563 apq8064_cache_dump_pdata.l2_size;
564 apq8064_reserve_table[MEMTYPE_EBI1].size += total;
565#endif
566}
567
Abhijeet Dharmapurikardca26f72012-09-13 11:02:03 -0700568static void __init reserve_mpdcvs_memory(void)
569{
570 apq8064_reserve_table[MEMTYPE_EBI1].size += SZ_32K;
571}
572
Kevin Chan13be4e22011-10-20 11:30:32 -0700573static void __init apq8064_calculate_reserve_sizes(void)
574{
575 size_pmem_devices();
576 reserve_pmem_memory();
Olav Haugan7c6aa742012-01-16 16:47:37 -0800577 reserve_ion_memory();
Huaibin Yang4a084e32011-12-15 15:25:52 -0800578 reserve_mdp_memory();
Laura Abbott350c8362012-02-28 14:46:52 -0800579 reserve_rtb_memory();
Laura Abbott93a4a352012-05-25 09:26:35 -0700580 reserve_cache_dump_memory();
Abhijeet Dharmapurikardca26f72012-09-13 11:02:03 -0700581 reserve_mpdcvs_memory();
Kevin Chan13be4e22011-10-20 11:30:32 -0700582}
583
584static struct reserve_info apq8064_reserve_info __initdata = {
585 .memtype_reserve_table = apq8064_reserve_table,
586 .calculate_reserve_sizes = apq8064_calculate_reserve_sizes,
Larry Bassel67b921d2012-04-06 10:23:27 -0700587 .reserve_fixed_area = apq8064_reserve_fixed_area,
Kevin Chan13be4e22011-10-20 11:30:32 -0700588 .paddr_to_memtype = apq8064_paddr_to_memtype,
589};
590
591static int apq8064_memory_bank_size(void)
592{
593 return 1<<29;
594}
595
596static void __init locate_unstable_memory(void)
597{
598 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
599 unsigned long bank_size;
600 unsigned long low, high;
601
602 bank_size = apq8064_memory_bank_size();
603 low = meminfo.bank[0].start;
604 high = mb->start + mb->size;
Olav Haugand76e3a82012-01-16 16:55:07 -0800605
606 /* Check if 32 bit overflow occured */
607 if (high < mb->start)
Larry Bassel67b921d2012-04-06 10:23:27 -0700608 high = -PAGE_SIZE;
Olav Haugand76e3a82012-01-16 16:55:07 -0800609
Kevin Chan13be4e22011-10-20 11:30:32 -0700610 low &= ~(bank_size - 1);
611
612 if (high - low <= bank_size)
Larry Bassel67b921d2012-04-06 10:23:27 -0700613 goto no_dmm;
614
615#ifdef CONFIG_ENABLE_DMM
Jack Cheung46bfffa2012-01-19 15:26:24 -0800616 apq8064_reserve_info.low_unstable_address = mb->start -
617 MIN_MEMORY_BLOCK_SIZE + mb->size;
618 apq8064_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
619
Kevin Chan13be4e22011-10-20 11:30:32 -0700620 apq8064_reserve_info.bank_size = bank_size;
621 pr_info("low unstable address %lx max size %lx bank size %lx\n",
622 apq8064_reserve_info.low_unstable_address,
623 apq8064_reserve_info.max_unstable_size,
624 apq8064_reserve_info.bank_size);
Larry Bassel67b921d2012-04-06 10:23:27 -0700625 return;
626#endif
627no_dmm:
628 apq8064_reserve_info.low_unstable_address = high;
629 apq8064_reserve_info.max_unstable_size = 0;
Kevin Chan13be4e22011-10-20 11:30:32 -0700630}
631
Hanumant Singh50440d42012-04-23 19:27:16 -0700632static int apq8064_change_memory_power(u64 start, u64 size,
633 int change_type)
634{
635 return soc_change_memory_power(start, size, change_type);
636}
637
Aravind Venkateswaran8ac7f412012-03-16 17:57:30 -0700638static char prim_panel_name[PANEL_NAME_MAX_LEN];
639static char ext_panel_name[PANEL_NAME_MAX_LEN];
Ajay Singh Parmar6b82d2b2012-07-19 17:23:26 +0530640
641static int ext_resolution;
642
Aravind Venkateswaran8ac7f412012-03-16 17:57:30 -0700643static int __init prim_display_setup(char *param)
644{
645 if (strnlen(param, PANEL_NAME_MAX_LEN))
646 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
647 return 0;
648}
649early_param("prim_display", prim_display_setup);
650
651static int __init ext_display_setup(char *param)
652{
653 if (strnlen(param, PANEL_NAME_MAX_LEN))
654 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
655 return 0;
656}
657early_param("ext_display", ext_display_setup);
658
Ajay Singh Parmar6b82d2b2012-07-19 17:23:26 +0530659static int __init hdmi_resulution_setup(char *param)
660{
661 int ret;
662 ret = kstrtoint(param, 10, &ext_resolution);
663 return ret;
664}
665early_param("ext_resolution", hdmi_resulution_setup);
666
Kevin Chan13be4e22011-10-20 11:30:32 -0700667static void __init apq8064_reserve(void)
668{
Ajay Singh Parmar6b82d2b2012-07-19 17:23:26 +0530669 apq8064_set_display_params(prim_panel_name, ext_panel_name,
670 ext_resolution);
Kevin Chan13be4e22011-10-20 11:30:32 -0700671 msm_reserve();
672}
673
Laura Abbott6988cef2012-03-15 14:27:13 -0700674static void __init place_movable_zone(void)
675{
Larry Bassel67b921d2012-04-06 10:23:27 -0700676#ifdef CONFIG_ENABLE_DMM
Laura Abbott6988cef2012-03-15 14:27:13 -0700677 movable_reserved_start = apq8064_reserve_info.low_unstable_address;
678 movable_reserved_size = apq8064_reserve_info.max_unstable_size;
679 pr_info("movable zone start %lx size %lx\n",
680 movable_reserved_start, movable_reserved_size);
Larry Bassel67b921d2012-04-06 10:23:27 -0700681#endif
Laura Abbott6988cef2012-03-15 14:27:13 -0700682}
683
684static void __init apq8064_early_reserve(void)
685{
686 reserve_info = &apq8064_reserve_info;
687 locate_unstable_memory();
688 place_movable_zone();
689
690}
Hemant Kumara945b472012-01-25 15:08:06 -0800691#ifdef CONFIG_USB_EHCI_MSM_HSIC
Hemant Kumare6275972012-02-29 20:06:21 -0800692/* Bandwidth requests (zero) if no vote placed */
693static struct msm_bus_vectors hsic_init_vectors[] = {
694 {
695 .src = MSM_BUS_MASTER_SPS,
696 .dst = MSM_BUS_SLAVE_EBI_CH0,
697 .ab = 0,
698 .ib = 0,
699 },
700 {
701 .src = MSM_BUS_MASTER_SPS,
702 .dst = MSM_BUS_SLAVE_SPS,
703 .ab = 0,
704 .ib = 0,
705 },
706};
707
708/* Bus bandwidth requests in Bytes/sec */
709static struct msm_bus_vectors hsic_max_vectors[] = {
710 {
711 .src = MSM_BUS_MASTER_SPS,
712 .dst = MSM_BUS_SLAVE_EBI_CH0,
713 .ab = 60000000, /* At least 480Mbps on bus. */
714 .ib = 960000000, /* MAX bursts rate */
715 },
716 {
717 .src = MSM_BUS_MASTER_SPS,
718 .dst = MSM_BUS_SLAVE_SPS,
719 .ab = 0,
720 .ib = 512000000, /*vote for 64Mhz dfab clk rate*/
721 },
722};
723
724static struct msm_bus_paths hsic_bus_scale_usecases[] = {
725 {
726 ARRAY_SIZE(hsic_init_vectors),
727 hsic_init_vectors,
728 },
729 {
730 ARRAY_SIZE(hsic_max_vectors),
731 hsic_max_vectors,
732 },
733};
734
735static struct msm_bus_scale_pdata hsic_bus_scale_pdata = {
736 hsic_bus_scale_usecases,
737 ARRAY_SIZE(hsic_bus_scale_usecases),
738 .name = "hsic",
739};
740
Hemant Kumara945b472012-01-25 15:08:06 -0800741static struct msm_hsic_host_platform_data msm_hsic_pdata = {
Hemant Kumare6275972012-02-29 20:06:21 -0800742 .strobe = 88,
743 .data = 89,
744 .bus_scale_table = &hsic_bus_scale_pdata,
Hemant Kumara945b472012-01-25 15:08:06 -0800745};
746#else
747static struct msm_hsic_host_platform_data msm_hsic_pdata;
748#endif
749
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800750#define PID_MAGIC_ID 0x71432909
751#define SERIAL_NUM_MAGIC_ID 0x61945374
752#define SERIAL_NUMBER_LENGTH 127
753#define DLOAD_USB_BASE_ADD 0x2A03F0C8
754
755struct magic_num_struct {
756 uint32_t pid;
757 uint32_t serial_num;
758};
759
760struct dload_struct {
761 uint32_t reserved1;
762 uint32_t reserved2;
763 uint32_t reserved3;
764 uint16_t reserved4;
765 uint16_t pid;
766 char serial_number[SERIAL_NUMBER_LENGTH];
767 uint16_t reserved5;
768 struct magic_num_struct magic_struct;
769};
770
771static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
772{
773 struct dload_struct __iomem *dload = 0;
774
775 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
776 if (!dload) {
777 pr_err("%s: cannot remap I/O memory region: %08x\n",
778 __func__, DLOAD_USB_BASE_ADD);
779 return -ENXIO;
780 }
781
782 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
783 __func__, dload, pid, snum);
784 /* update pid */
785 dload->magic_struct.pid = PID_MAGIC_ID;
786 dload->pid = pid;
787
788 /* update serial number */
789 dload->magic_struct.serial_num = 0;
790 if (!snum) {
791 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
792 goto out;
793 }
794
795 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
796 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
797out:
798 iounmap(dload);
799 return 0;
800}
801
802static struct android_usb_platform_data android_usb_pdata = {
803 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
804};
805
Hemant Kumar4933b072011-10-17 23:43:11 -0700806static struct platform_device android_usb_device = {
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800807 .name = "android_usb",
808 .id = -1,
809 .dev = {
810 .platform_data = &android_usb_pdata,
811 },
Hemant Kumar4933b072011-10-17 23:43:11 -0700812};
813
Hemant Kumar7620eed2012-02-26 09:08:43 -0800814/* Bandwidth requests (zero) if no vote placed */
815static struct msm_bus_vectors usb_init_vectors[] = {
816 {
817 .src = MSM_BUS_MASTER_SPS,
818 .dst = MSM_BUS_SLAVE_EBI_CH0,
819 .ab = 0,
820 .ib = 0,
821 },
822};
823
824/* Bus bandwidth requests in Bytes/sec */
825static struct msm_bus_vectors usb_max_vectors[] = {
826 {
827 .src = MSM_BUS_MASTER_SPS,
828 .dst = MSM_BUS_SLAVE_EBI_CH0,
829 .ab = 60000000, /* At least 480Mbps on bus. */
830 .ib = 960000000, /* MAX bursts rate */
831 },
832};
833
834static struct msm_bus_paths usb_bus_scale_usecases[] = {
835 {
836 ARRAY_SIZE(usb_init_vectors),
837 usb_init_vectors,
838 },
839 {
840 ARRAY_SIZE(usb_max_vectors),
841 usb_max_vectors,
842 },
843};
844
845static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
846 usb_bus_scale_usecases,
847 ARRAY_SIZE(usb_bus_scale_usecases),
848 .name = "usb",
849};
850
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700851static int phy_init_seq[] = {
Chiranjeevi Velempatif983aeb2012-08-23 08:16:50 +0530852 0x68, 0x81, /* update DC voltage level */
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700853 0x24, 0x82, /* set pre-emphasis and rise/fall time */
854 -1
855};
856
Vijayavardhan Vennapusa4fa13692012-08-02 14:35:03 +0530857#define PMIC_GPIO_DP 27 /* PMIC GPIO for D+ change */
858#define PMIC_GPIO_DP_IRQ PM8921_GPIO_IRQ(PM8921_IRQ_BASE, PMIC_GPIO_DP)
Jack Pham87f202f2012-08-06 00:24:22 -0700859#define MSM_MPM_PIN_USB1_OTGSESSVLD 40
860
Hemant Kumar4933b072011-10-17 23:43:11 -0700861static struct msm_otg_platform_data msm_otg_pdata = {
Hemant Kumard86c4882012-01-24 19:39:37 -0800862 .mode = USB_OTG,
863 .otg_control = OTG_PMIC_CONTROL,
Hemant Kumar4933b072011-10-17 23:43:11 -0700864 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Hemant Kumard86c4882012-01-24 19:39:37 -0800865 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
866 .power_budget = 750,
Hemant Kumar7620eed2012-02-26 09:08:43 -0800867 .bus_scale_table = &usb_bus_scale_pdata,
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700868 .phy_init_seq = phy_init_seq,
Jack Pham87f202f2012-08-06 00:24:22 -0700869 .mpm_otgsessvld_int = MSM_MPM_PIN_USB1_OTGSESSVLD,
Hemant Kumar4933b072011-10-17 23:43:11 -0700870};
871
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800872static struct msm_usb_host_platform_data msm_ehci_host_pdata3 = {
Manu Gautam91223e02011-11-08 15:27:22 +0530873 .power_budget = 500,
874};
875
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800876#ifdef CONFIG_USB_EHCI_MSM_HOST4
877static struct msm_usb_host_platform_data msm_ehci_host_pdata4;
878#endif
879
Manu Gautam91223e02011-11-08 15:27:22 +0530880static void __init apq8064_ehci_host_init(void)
881{
Chiranjeevi Velempatib822fa32012-05-23 22:05:59 +0530882 if (machine_is_apq8064_liquid() || machine_is_mpq8064_cdp() ||
Chiranjeevi Velempatidd4dbaa2012-10-05 16:22:04 +0530883 machine_is_mpq8064_hrd() || machine_is_mpq8064_dtv() ||
884 machine_is_apq8064_cdp()) {
Chiranjeevi Velempatib822fa32012-05-23 22:05:59 +0530885 if (machine_is_apq8064_liquid())
886 msm_ehci_host_pdata3.dock_connect_irq =
887 PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9);
Vijayavardhan Vennapusa4fa13692012-08-02 14:35:03 +0530888 else
889 msm_ehci_host_pdata3.pmic_gpio_dp_irq =
890 PMIC_GPIO_DP_IRQ;
Hemant Kumar56925352012-02-13 16:59:52 -0800891
Manu Gautam91223e02011-11-08 15:27:22 +0530892 apq8064_device_ehci_host3.dev.platform_data =
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800893 &msm_ehci_host_pdata3;
Manu Gautam91223e02011-11-08 15:27:22 +0530894 platform_device_register(&apq8064_device_ehci_host3);
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800895
896#ifdef CONFIG_USB_EHCI_MSM_HOST4
897 apq8064_device_ehci_host4.dev.platform_data =
898 &msm_ehci_host_pdata4;
899 platform_device_register(&apq8064_device_ehci_host4);
900#endif
Manu Gautam91223e02011-11-08 15:27:22 +0530901 }
902}
903
David Keitel2f613d92012-02-15 11:29:16 -0800904static struct smb349_platform_data smb349_data __initdata = {
905 .en_n_gpio = PM8921_GPIO_PM_TO_SYS(37),
906 .chg_susp_gpio = PM8921_GPIO_PM_TO_SYS(30),
907 .chg_current_ma = 2200,
908};
909
910static struct i2c_board_info smb349_charger_i2c_info[] __initdata = {
911 {
912 I2C_BOARD_INFO(SMB349_NAME, 0x1B),
913 .platform_data = &smb349_data,
914 },
915};
916
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -0800917struct sx150x_platform_data apq8064_sx150x_data[] = {
918 [SX150X_EPM] = {
919 .gpio_base = GPIO_EPM_EXPANDER_BASE,
920 .oscio_is_gpo = false,
921 .io_pullup_ena = 0x0,
922 .io_pulldn_ena = 0x0,
923 .io_open_drain_ena = 0x0,
924 .io_polarity = 0,
925 .irq_summary = -1,
926 },
927};
928
929static struct epm_chan_properties ads_adc_channel_data[] = {
Yan He44c59962012-08-31 11:14:58 -0700930 {10, 100}, {1000, 1}, {10, 100}, {1000, 1},
931 {10, 100}, {1000, 1}, {10, 100}, {1000, 1},
932 {10, 100}, {20, 100}, {500, 100}, {5, 100},
933 {1000, 1}, {200, 100}, {50, 100}, {10, 100},
934 {510, 100}, {50, 100}, {20, 100}, {100, 100},
935 {510, 100}, {20, 100}, {50, 100}, {200, 100},
936 {10, 100}, {20, 100}, {1000, 1}, {10, 100},
937 {200, 100}, {510, 100}, {1000, 100}, {200, 100},
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -0800938};
939
940static struct epm_adc_platform_data epm_adc_pdata = {
941 .channel = ads_adc_channel_data,
942 .bus_id = 0x0,
943 .epm_i2c_board_info = {
944 .type = "sx1509q",
945 .addr = 0x3e,
946 .platform_data = &apq8064_sx150x_data[SX150X_EPM],
947 },
948 .gpio_expander_base_addr = GPIO_EPM_EXPANDER_BASE,
949};
950
951static struct platform_device epm_adc_device = {
952 .name = "epm_adc",
953 .id = -1,
954 .dev = {
955 .platform_data = &epm_adc_pdata,
956 },
957};
958
959static void __init apq8064_epm_adc_init(void)
960{
961 epm_adc_pdata.num_channels = 32;
962 epm_adc_pdata.num_adc = 2;
963 epm_adc_pdata.chan_per_adc = 16;
964 epm_adc_pdata.chan_per_mux = 8;
965};
966
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800967/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
968 * 4 micbiases are used to power various analog and digital
969 * microphones operating at 1800 mV. Technically, all micbiases
970 * can source from single cfilter since all microphones operate
971 * at the same voltage level. The arrangement below is to make
972 * sure all cfilters are exercised. LDO_H regulator ouput level
973 * does not need to be as high as 2.85V. It is choosen for
974 * microphone sensitivity purpose.
975 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530976static struct wcd9xxx_pdata apq8064_tabla_platform_data = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800977 .slimbus_slave_device = {
978 .name = "tabla-slave",
979 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
980 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800981 .irq = MSM_GPIO_TO_INT(42),
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800982 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530983 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800984 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
985 .micbias = {
986 .ldoh_v = TABLA_LDOH_2P85_V,
987 .cfilt1_mv = 1800,
Bhalchandra Gajare975c53a2012-08-10 12:16:49 -0700988 .cfilt2_mv = 2700,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800989 .cfilt3_mv = 1800,
990 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
991 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
992 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
993 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530994 },
995 .regulator = {
996 {
997 .name = "CDC_VDD_CP",
998 .min_uV = 1800000,
999 .max_uV = 1800000,
1000 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
1001 },
1002 {
1003 .name = "CDC_VDDA_RX",
1004 .min_uV = 1800000,
1005 .max_uV = 1800000,
1006 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
1007 },
1008 {
1009 .name = "CDC_VDDA_TX",
1010 .min_uV = 1800000,
1011 .max_uV = 1800000,
1012 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
1013 },
1014 {
1015 .name = "VDDIO_CDC",
1016 .min_uV = 1800000,
1017 .max_uV = 1800000,
1018 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1019 },
1020 {
1021 .name = "VDDD_CDC_D",
1022 .min_uV = 1225000,
David Collins62debe82012-06-06 17:01:03 -07001023 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301024 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1025 },
1026 {
1027 .name = "CDC_VDDA_A_1P2V",
1028 .min_uV = 1225000,
David Collins62debe82012-06-06 17:01:03 -07001029 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301030 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1031 },
1032 },
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001033};
1034
1035static struct slim_device apq8064_slim_tabla = {
1036 .name = "tabla-slim",
1037 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
1038 .dev = {
1039 .platform_data = &apq8064_tabla_platform_data,
1040 },
1041};
1042
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301043static struct wcd9xxx_pdata apq8064_tabla20_platform_data = {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001044 .slimbus_slave_device = {
1045 .name = "tabla-slave",
1046 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
1047 },
1048 .irq = MSM_GPIO_TO_INT(42),
1049 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301050 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001051 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
1052 .micbias = {
1053 .ldoh_v = TABLA_LDOH_2P85_V,
1054 .cfilt1_mv = 1800,
Bhalchandra Gajare975c53a2012-08-10 12:16:49 -07001055 .cfilt2_mv = 2700,
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001056 .cfilt3_mv = 1800,
1057 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
1058 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
1059 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
1060 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301061 },
1062 .regulator = {
1063 {
1064 .name = "CDC_VDD_CP",
1065 .min_uV = 1800000,
1066 .max_uV = 1800000,
1067 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
1068 },
1069 {
1070 .name = "CDC_VDDA_RX",
1071 .min_uV = 1800000,
1072 .max_uV = 1800000,
1073 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
1074 },
1075 {
1076 .name = "CDC_VDDA_TX",
1077 .min_uV = 1800000,
1078 .max_uV = 1800000,
1079 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
1080 },
1081 {
1082 .name = "VDDIO_CDC",
1083 .min_uV = 1800000,
1084 .max_uV = 1800000,
1085 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1086 },
1087 {
1088 .name = "VDDD_CDC_D",
1089 .min_uV = 1225000,
David Collins62debe82012-06-06 17:01:03 -07001090 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301091 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1092 },
1093 {
1094 .name = "CDC_VDDA_A_1P2V",
1095 .min_uV = 1225000,
David Collins62debe82012-06-06 17:01:03 -07001096 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301097 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1098 },
1099 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001100};
1101
1102static struct slim_device apq8064_slim_tabla20 = {
1103 .name = "tabla2x-slim",
1104 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
1105 .dev = {
1106 .platform_data = &apq8064_tabla20_platform_data,
1107 },
1108};
1109
Kuirong Wangf8c5e142012-06-21 16:17:32 -07001110static struct wcd9xxx_pdata apq8064_tabla_i2c_platform_data = {
1111 .irq = MSM_GPIO_TO_INT(77),
1112 .irq_base = TABLA_INTERRUPT_BASE,
1113 .num_irqs = NR_WCD9XXX_IRQS,
1114 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
1115 .micbias = {
1116 .ldoh_v = TABLA_LDOH_2P85_V,
1117 .cfilt1_mv = 1800,
1118 .cfilt2_mv = 1800,
1119 .cfilt3_mv = 1800,
1120 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
1121 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
1122 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
1123 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
1124 },
1125 .regulator = {
1126 {
1127 .name = "CDC_VDD_CP",
1128 .min_uV = 1800000,
1129 .max_uV = 1800000,
1130 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
1131 },
1132 {
1133 .name = "CDC_VDDA_RX",
1134 .min_uV = 1800000,
1135 .max_uV = 1800000,
1136 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
1137 },
1138 {
1139 .name = "CDC_VDDA_TX",
1140 .min_uV = 1800000,
1141 .max_uV = 1800000,
1142 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
1143 },
1144 {
1145 .name = "VDDIO_CDC",
1146 .min_uV = 1800000,
1147 .max_uV = 1800000,
1148 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1149 },
1150 {
1151 .name = "VDDD_CDC_D",
1152 .min_uV = 1225000,
1153 .max_uV = 1250000,
1154 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1155 },
1156 {
1157 .name = "CDC_VDDA_A_1P2V",
1158 .min_uV = 1225000,
1159 .max_uV = 1250000,
1160 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1161 },
1162 },
1163};
1164
1165static struct i2c_board_info apq8064_tabla_i2c_device_info[] __initdata = {
1166 {
1167 I2C_BOARD_INFO("tabla top level",
1168 APQ_8064_TABLA_I2C_SLAVE_ADDR),
1169 .platform_data = &apq8064_tabla_i2c_platform_data,
1170 },
1171 {
1172 I2C_BOARD_INFO("tabla analog",
1173 APQ_8064_TABLA_ANALOG_I2C_SLAVE_ADDR),
1174 .platform_data = &apq8064_tabla_i2c_platform_data,
1175 },
1176 {
1177 I2C_BOARD_INFO("tabla digital1",
1178 APQ_8064_TABLA_DIGITAL1_I2C_SLAVE_ADDR),
1179 .platform_data = &apq8064_tabla_i2c_platform_data,
1180 },
1181 {
1182 I2C_BOARD_INFO("tabla digital2",
1183 APQ_8064_TABLA_DIGITAL2_I2C_SLAVE_ADDR),
1184 .platform_data = &apq8064_tabla_i2c_platform_data,
1185 },
1186};
1187
Santosh Mardi344455a2012-09-07 13:22:16 +05301188static struct wcd9xxx_pdata mpq8064_ashiko20_platform_data = {
1189 .slimbus_slave_device = {
1190 .name = "tabla-slave",
1191 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
1192 },
1193 .irq = MSM_GPIO_TO_INT(42),
1194 .irq_base = TABLA_INTERRUPT_BASE,
1195 .num_irqs = NR_WCD9XXX_IRQS,
1196 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
1197 .micbias = {
1198 .ldoh_v = TABLA_LDOH_2P85_V,
1199 .cfilt1_mv = 1800,
1200 .cfilt2_mv = 1800,
1201 .cfilt3_mv = 1800,
1202 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
1203 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
1204 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
1205 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
1206 },
1207 .regulator = {
1208 {
1209 .name = "CDC_VDD_CP",
1210 .min_uV = 1800000,
1211 .max_uV = 1800000,
1212 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
1213 },
1214 {
1215 .name = "CDC_VDDA_RX",
1216 .min_uV = 1800000,
1217 .max_uV = 1800000,
1218 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
1219 },
1220 {
1221 .name = "CDC_VDDA_TX",
1222 .min_uV = 1800000,
1223 .max_uV = 1800000,
1224 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
1225 },
1226 {
1227 .name = "VDDIO_CDC",
1228 .min_uV = 1800000,
1229 .max_uV = 1800000,
1230 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1231 },
1232 {
1233 .name = "HRD_VDDD_CDC_D",
1234 .min_uV = 1200000,
1235 .max_uV = 1200000,
1236 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1237 },
1238 {
1239 .name = "HRD_CDC_VDDA_A_1P2V",
1240 .min_uV = 1200000,
1241 .max_uV = 1200000,
1242 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1243 },
1244 },
1245};
1246
1247static struct slim_device mpq8064_slim_ashiko20 = {
1248 .name = "tabla2x-slim",
1249 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
1250 .dev = {
1251 .platform_data = &mpq8064_ashiko20_platform_data,
1252 },
1253};
1254
1255
Santosh Mardi695be0d2012-04-10 23:21:12 +05301256/* enable the level shifter for cs8427 to make sure the I2C
1257 * clock is running at 100KHz and voltage levels are at 3.3
1258 * and 5 volts
1259 */
1260static int enable_100KHz_ls(int enable)
1261{
1262 int ret = 0;
1263 if (enable) {
1264 ret = gpio_request(SX150X_GPIO(1, 10),
1265 "cs8427_100KHZ_ENABLE");
1266 if (ret) {
1267 pr_err("%s: Failed to request gpio %d\n", __func__,
1268 SX150X_GPIO(1, 10));
1269 return ret;
1270 }
1271 gpio_direction_output(SX150X_GPIO(1, 10), 1);
Santosh Mardi3896ed32012-08-31 19:26:54 +05301272 } else {
1273 gpio_direction_output(SX150X_GPIO(1, 10), 0);
Santosh Mardi695be0d2012-04-10 23:21:12 +05301274 gpio_free(SX150X_GPIO(1, 10));
Santosh Mardi3896ed32012-08-31 19:26:54 +05301275 }
Santosh Mardi695be0d2012-04-10 23:21:12 +05301276 return ret;
1277}
1278
Santosh Mardieff9a742012-04-09 23:23:39 +05301279static struct cs8427_platform_data cs8427_i2c_platform_data = {
1280 .irq = SX150X_GPIO(1, 4),
1281 .reset_gpio = SX150X_GPIO(1, 6),
Santosh Mardi695be0d2012-04-10 23:21:12 +05301282 .enable = enable_100KHz_ls,
Santosh Mardieff9a742012-04-09 23:23:39 +05301283};
1284
1285static struct i2c_board_info cs8427_device_info[] __initdata = {
1286 {
1287 I2C_BOARD_INFO("cs8427", CS8427_ADDR4),
1288 .platform_data = &cs8427_i2c_platform_data,
1289 },
1290};
1291
Amy Maloche70090f992012-02-16 16:35:26 -08001292#define HAP_SHIFT_LVL_OE_GPIO PM8921_MPP_PM_TO_SYS(8)
1293#define ISA1200_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1294#define ISA1200_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
David Collinsd49a1c52012-08-22 13:18:06 -07001295#define ISA1200_HAP_CLK_PM8921 PM8921_GPIO_PM_TO_SYS(44)
1296#define ISA1200_HAP_CLK_PM8917 PM8921_GPIO_PM_TO_SYS(38)
Amy Maloche70090f992012-02-16 16:35:26 -08001297
Mohan Pallaka2d877602012-05-11 13:07:30 +05301298static int isa1200_clk_enable(bool on)
Amy Maloche70090f992012-02-16 16:35:26 -08001299{
David Collinsd49a1c52012-08-22 13:18:06 -07001300 unsigned int gpio = ISA1200_HAP_CLK_PM8921;
Amy Maloche8f973892012-03-26 14:53:13 -07001301 int rc = 0;
1302
David Collinsd49a1c52012-08-22 13:18:06 -07001303 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
1304 gpio = ISA1200_HAP_CLK_PM8917;
1305
1306 gpio_set_value_cansleep(gpio, on);
Amy Maloche70090f992012-02-16 16:35:26 -08001307
Mohan Pallaka2d877602012-05-11 13:07:30 +05301308 if (on) {
Amy Maloche8f973892012-03-26 14:53:13 -07001309 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_1, true);
Mohan Pallaka2d877602012-05-11 13:07:30 +05301310 if (rc) {
1311 pr_err("%s: unable to write aux clock register(%d)\n",
1312 __func__, rc);
1313 goto err_gpio_dis;
1314 }
1315 } else {
Amy Maloche8f973892012-03-26 14:53:13 -07001316 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_NONE, true);
Mohan Pallaka2d877602012-05-11 13:07:30 +05301317 if (rc)
1318 pr_err("%s: unable to write aux clock register(%d)\n",
1319 __func__, rc);
Amy Maloche8f973892012-03-26 14:53:13 -07001320 }
1321
1322 return rc;
Mohan Pallaka2d877602012-05-11 13:07:30 +05301323
1324err_gpio_dis:
David Collinsd49a1c52012-08-22 13:18:06 -07001325 gpio_set_value_cansleep(gpio, !on);
Mohan Pallaka2d877602012-05-11 13:07:30 +05301326 return rc;
Amy Maloche70090f992012-02-16 16:35:26 -08001327}
1328
1329static int isa1200_dev_setup(bool enable)
1330{
David Collinsd49a1c52012-08-22 13:18:06 -07001331 unsigned int gpio = ISA1200_HAP_CLK_PM8921;
Amy Maloche70090f992012-02-16 16:35:26 -08001332 int rc = 0;
1333
David Collinsd49a1c52012-08-22 13:18:06 -07001334 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
1335 gpio = ISA1200_HAP_CLK_PM8917;
1336
Amy Maloche70090f992012-02-16 16:35:26 -08001337 if (!enable)
1338 goto free_gpio;
1339
David Collinsd49a1c52012-08-22 13:18:06 -07001340 rc = gpio_request(gpio, "haptics_clk");
Amy Maloche70090f992012-02-16 16:35:26 -08001341 if (rc) {
1342 pr_err("%s: unable to request gpio %d config(%d)\n",
David Collinsd49a1c52012-08-22 13:18:06 -07001343 __func__, gpio, rc);
Amy Maloche70090f992012-02-16 16:35:26 -08001344 return rc;
1345 }
1346
David Collinsd49a1c52012-08-22 13:18:06 -07001347 rc = gpio_direction_output(gpio, 0);
Amy Maloche70090f992012-02-16 16:35:26 -08001348 if (rc) {
1349 pr_err("%s: unable to set direction\n", __func__);
1350 goto free_gpio;
1351 }
1352
1353 return 0;
1354
1355free_gpio:
David Collinsd49a1c52012-08-22 13:18:06 -07001356 gpio_free(gpio);
Amy Maloche70090f992012-02-16 16:35:26 -08001357 return rc;
1358}
1359
1360static struct isa1200_regulator isa1200_reg_data[] = {
1361 {
1362 .name = "vddp",
1363 .min_uV = ISA_I2C_VTG_MIN_UV,
1364 .max_uV = ISA_I2C_VTG_MAX_UV,
1365 .load_uA = ISA_I2C_CURR_UA,
1366 },
1367};
1368
1369static struct isa1200_platform_data isa1200_1_pdata = {
1370 .name = "vibrator",
1371 .dev_setup = isa1200_dev_setup,
Mohan Pallaka2d877602012-05-11 13:07:30 +05301372 .clk_enable = isa1200_clk_enable,
Mohan Pallaka32f20a72012-06-14 14:41:11 +05301373 .need_pwm_clk = true,
Amy Maloche70090f992012-02-16 16:35:26 -08001374 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
1375 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
1376 .max_timeout = 15000,
1377 .mode_ctrl = PWM_GEN_MODE,
1378 .pwm_fd = {
1379 .pwm_div = 256,
1380 },
1381 .is_erm = false,
1382 .smart_en = true,
1383 .ext_clk_en = true,
1384 .chip_en = 1,
1385 .regulator_info = isa1200_reg_data,
1386 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1387};
1388
1389static struct i2c_board_info isa1200_board_info[] __initdata = {
1390 {
1391 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1392 .platform_data = &isa1200_1_pdata,
1393 },
1394};
Jing Lin21ed4de2012-02-05 15:53:28 -08001395/* configuration data for mxt1386e using V2.1 firmware */
1396static const u8 mxt1386e_config_data_v2_1[] = {
1397 /* T6 Object */
1398 0, 0, 0, 0, 0, 0,
1399 /* T38 Object */
Jing Linc6a55cfc2012-08-31 10:54:44 -07001400 14, 3, 0, 5, 7, 12, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001401 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1402 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1403 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1404 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1405 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1406 0, 0, 0, 0,
1407 /* T7 Object */
Jing Linc6a55cfc2012-08-31 10:54:44 -07001408 32, 10, 50,
Jing Lin21ed4de2012-02-05 15:53:28 -08001409 /* T8 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001410 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001411 /* T9 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001412 139, 0, 0, 26, 42, 0, 32, 80, 2, 5,
Jing Linc6a55cfc2012-08-31 10:54:44 -07001413 0, 5, 5, 79, 10, 30, 10, 10, 255, 2,
Jing Linf1208fd2012-02-23 11:15:42 -08001414 85, 5, 0, 5, 9, 5, 12, 35, 70, 40,
1415 20, 5, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001416 /* T18 Object */
1417 0, 0,
1418 /* T24 Object */
1419 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1420 0, 0, 0, 0, 0, 0, 0, 0, 0,
1421 /* T25 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001422 1, 0, 60, 115, 156, 99,
Jing Lin21ed4de2012-02-05 15:53:28 -08001423 /* T27 Object */
1424 0, 0, 0, 0, 0, 0, 0,
1425 /* T40 Object */
1426 0, 0, 0, 0, 0,
1427 /* T42 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001428 0, 0, 255, 0, 255, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001429 /* T43 Object */
1430 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
1431 16,
1432 /* T46 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001433 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001434 /* T47 Object */
1435 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
1436 /* T48 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001437 1, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001438 32, 40, 0, 10, 10, 0, 0, 100, 10, 90,
1439 0, 0, 0, 0, 0, 0, 0, 10, 1, 10,
1440 52, 10, 12, 0, 33, 0, 1, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001441 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1442 0, 0, 0, 0,
1443 /* T56 Object */
1444 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1445 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1446 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1447 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001448 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1449 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001450};
1451
1452#define MXT_TS_GPIO_IRQ 6
1453#define MXT_TS_PWR_EN_GPIO PM8921_GPIO_PM_TO_SYS(23)
1454#define MXT_TS_RESET_GPIO 33
1455
1456static struct mxt_config_info mxt_config_array[] = {
1457 {
1458 .config = mxt1386e_config_data_v2_1,
1459 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1460 .family_id = 0xA0,
1461 .variant_id = 0x7,
1462 .version = 0x21,
1463 .build = 0xAA,
Jing Linef4aa9b2012-03-26 12:01:41 -07001464 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
1465 .fw_name = "atmel_8064_liquid_v2_2_AA.hex",
1466 },
1467 {
1468 /* The config data for V2.2.AA is the same as for V2.1.AA */
1469 .config = mxt1386e_config_data_v2_1,
1470 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1471 .family_id = 0xA0,
1472 .variant_id = 0x7,
1473 .version = 0x22,
1474 .build = 0xAA,
1475 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin21ed4de2012-02-05 15:53:28 -08001476 },
1477};
1478
1479static struct mxt_platform_data mxt_platform_data = {
1480 .config_array = mxt_config_array,
1481 .config_array_size = ARRAY_SIZE(mxt_config_array),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08001482 .panel_minx = 0,
1483 .panel_maxx = 1365,
1484 .panel_miny = 0,
1485 .panel_maxy = 767,
1486 .disp_minx = 0,
1487 .disp_maxx = 1365,
1488 .disp_miny = 0,
1489 .disp_maxy = 767,
Anirudh Ghayal39dbe3f2012-04-13 15:43:16 +05301490 .irqflags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
Jing Lin21ed4de2012-02-05 15:53:28 -08001491 .i2c_pull_up = true,
1492 .reset_gpio = MXT_TS_RESET_GPIO,
1493 .irq_gpio = MXT_TS_GPIO_IRQ,
1494};
1495
1496static struct i2c_board_info mxt_device_info[] __initdata = {
1497 {
1498 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
1499 .platform_data = &mxt_platform_data,
1500 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1501 },
1502};
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001503#define CYTTSP_TS_GPIO_IRQ 6
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001504#define CYTTSP_TS_GPIO_SLEEP 33
Amy Maloche609bb5e2012-08-03 09:41:42 -07001505#define CYTTSP_TS_GPIO_SLEEP_ALT 12
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001506
1507static ssize_t tma340_vkeys_show(struct kobject *kobj,
1508 struct kobj_attribute *attr, char *buf)
1509{
1510 return snprintf(buf, 200,
1511 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1512 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1513 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1514 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1515 "\n");
1516}
1517
1518static struct kobj_attribute tma340_vkeys_attr = {
1519 .attr = {
1520 .mode = S_IRUGO,
1521 },
1522 .show = &tma340_vkeys_show,
1523};
1524
1525static struct attribute *tma340_properties_attrs[] = {
1526 &tma340_vkeys_attr.attr,
1527 NULL
1528};
1529
1530static struct attribute_group tma340_properties_attr_group = {
1531 .attrs = tma340_properties_attrs,
1532};
1533
1534static int cyttsp_platform_init(struct i2c_client *client)
1535{
1536 int rc = 0;
1537 static struct kobject *tma340_properties_kobj;
1538
1539 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1540 tma340_properties_kobj = kobject_create_and_add("board_properties",
1541 NULL);
1542 if (tma340_properties_kobj)
1543 rc = sysfs_create_group(tma340_properties_kobj,
1544 &tma340_properties_attr_group);
1545 if (!tma340_properties_kobj || rc)
1546 pr_err("%s: failed to create board_properties\n",
1547 __func__);
1548
1549 return 0;
1550}
1551
1552static struct cyttsp_regulator cyttsp_regulator_data[] = {
1553 {
1554 .name = "vdd",
1555 .min_uV = CY_TMA300_VTG_MIN_UV,
1556 .max_uV = CY_TMA300_VTG_MAX_UV,
1557 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1558 .lpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1559 },
1560 {
1561 .name = "vcc_i2c",
1562 .min_uV = CY_I2C_VTG_MIN_UV,
1563 .max_uV = CY_I2C_VTG_MAX_UV,
1564 .hpm_load_uA = CY_I2C_CURR_UA,
1565 .lpm_load_uA = CY_I2C_CURR_UA,
1566 },
1567};
1568
1569static struct cyttsp_platform_data cyttsp_pdata = {
1570 .panel_maxx = 634,
1571 .panel_maxy = 1166,
1572 .disp_maxx = 599,
1573 .disp_maxy = 1023,
1574 .disp_minx = 0,
1575 .disp_miny = 0,
1576 .flags = 0x01,
1577 .gen = CY_GEN3,
1578 .use_st = CY_USE_ST,
1579 .use_mt = CY_USE_MT,
1580 .use_hndshk = CY_SEND_HNDSHK,
1581 .use_trk_id = CY_USE_TRACKING_ID,
1582 .use_sleep = CY_USE_DEEP_SLEEP_SEL,
1583 .use_gestures = CY_USE_GESTURES,
1584 .fw_fname = "cyttsp_8064_mtp.hex",
1585 /* change act_intrvl to customize the Active power state
1586 * scanning/processing refresh interval for Operating mode
1587 */
1588 .act_intrvl = CY_ACT_INTRVL_DFLT,
1589 /* change tch_tmout to customize the touch timeout for the
1590 * Active power state for Operating mode
1591 */
1592 .tch_tmout = CY_TCH_TMOUT_DFLT,
1593 /* change lp_intrvl to customize the Low Power power state
1594 * scanning/processing refresh interval for Operating mode
1595 */
1596 .lp_intrvl = CY_LP_INTRVL_DFLT,
1597 .sleep_gpio = CYTTSP_TS_GPIO_SLEEP,
Amy Maloche9ba3ffe2012-04-26 10:31:20 -07001598 .resout_gpio = -1,
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001599 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1600 .regulator_info = cyttsp_regulator_data,
1601 .num_regulators = ARRAY_SIZE(cyttsp_regulator_data),
1602 .init = cyttsp_platform_init,
1603 .correct_fw_ver = 17,
1604};
1605
1606static struct i2c_board_info cyttsp_info[] __initdata = {
1607 {
1608 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1609 .platform_data = &cyttsp_pdata,
1610 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1611 },
1612};
Jing Lin21ed4de2012-02-05 15:53:28 -08001613
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001614#define MSM_WCNSS_PHYS 0x03000000
1615#define MSM_WCNSS_SIZE 0x280000
1616
1617static struct resource resources_wcnss_wlan[] = {
1618 {
1619 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1620 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1621 .name = "wcnss_wlanrx_irq",
1622 .flags = IORESOURCE_IRQ,
1623 },
1624 {
1625 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1626 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1627 .name = "wcnss_wlantx_irq",
1628 .flags = IORESOURCE_IRQ,
1629 },
1630 {
1631 .start = MSM_WCNSS_PHYS,
1632 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1633 .name = "wcnss_mmio",
1634 .flags = IORESOURCE_MEM,
1635 },
1636 {
1637 .start = 64,
1638 .end = 68,
1639 .name = "wcnss_gpios_5wire",
1640 .flags = IORESOURCE_IO,
1641 },
1642};
1643
1644static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1645 .has_48mhz_xo = 1,
1646};
1647
1648static struct platform_device msm_device_wcnss_wlan = {
1649 .name = "wcnss_wlan",
1650 .id = 0,
1651 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1652 .resource = resources_wcnss_wlan,
1653 .dev = {.platform_data = &qcom_wcnss_pdata},
1654};
1655
Ankit Vermab7c26e62012-02-28 15:04:15 -08001656static struct platform_device msm_device_iris_fm __devinitdata = {
1657 .name = "iris_fm",
1658 .id = -1,
1659};
1660
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001661#ifdef CONFIG_QSEECOM
1662/* qseecom bus scaling */
1663static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
1664 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001665 .src = MSM_BUS_MASTER_ADM_PORT0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001666 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001667 .ab = 0,
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001668 .ib = 0,
1669 },
1670 {
1671 .src = MSM_BUS_MASTER_ADM_PORT1,
1672 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1673 .ab = 0,
1674 .ib = 0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001675 },
1676 {
1677 .src = MSM_BUS_MASTER_SPDM,
1678 .dst = MSM_BUS_SLAVE_SPDM,
1679 .ib = 0,
1680 .ab = 0,
1681 },
1682};
1683
1684static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
1685 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001686 .src = MSM_BUS_MASTER_ADM_PORT0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001687 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001688 .ab = 70000000UL,
1689 .ib = 70000000UL,
1690 },
1691 {
1692 .src = MSM_BUS_MASTER_ADM_PORT1,
1693 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1694 .ab = 2480000000UL,
1695 .ib = 2480000000UL,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001696 },
1697 {
1698 .src = MSM_BUS_MASTER_SPDM,
1699 .dst = MSM_BUS_SLAVE_SPDM,
1700 .ib = 0,
1701 .ab = 0,
1702 },
1703};
1704
1705static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1706 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001707 .src = MSM_BUS_MASTER_ADM_PORT0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001708 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001709 .ab = 0,
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001710 .ib = 0,
1711 },
1712 {
1713 .src = MSM_BUS_MASTER_ADM_PORT1,
1714 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1715 .ab = 0,
1716 .ib = 0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001717 },
1718 {
1719 .src = MSM_BUS_MASTER_SPDM,
1720 .dst = MSM_BUS_SLAVE_SPDM,
1721 .ib = (64 * 8) * 1000000UL,
1722 .ab = (64 * 8) * 100000UL,
1723 },
1724};
1725
Ramesh Masavarapu8d756582012-10-03 10:18:06 -07001726static struct msm_bus_vectors qseecom_enable_dfab_sfpb_vectors[] = {
1727 {
1728 .src = MSM_BUS_MASTER_ADM_PORT0,
1729 .dst = MSM_BUS_SLAVE_EBI_CH0,
1730 .ab = 70000000UL,
1731 .ib = 70000000UL,
1732 },
1733 {
1734 .src = MSM_BUS_MASTER_ADM_PORT1,
1735 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1736 .ab = 2480000000UL,
1737 .ib = 2480000000UL,
1738 },
1739 {
1740 .src = MSM_BUS_MASTER_SPDM,
1741 .dst = MSM_BUS_SLAVE_SPDM,
1742 .ib = (64 * 8) * 1000000UL,
1743 .ab = (64 * 8) * 100000UL,
1744 },
1745};
1746
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001747static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1748 {
1749 ARRAY_SIZE(qseecom_clks_init_vectors),
1750 qseecom_clks_init_vectors,
1751 },
1752 {
1753 ARRAY_SIZE(qseecom_enable_dfab_vectors),
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001754 qseecom_enable_dfab_vectors,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001755 },
1756 {
1757 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1758 qseecom_enable_sfpb_vectors,
1759 },
Ramesh Masavarapu8d756582012-10-03 10:18:06 -07001760 {
1761 ARRAY_SIZE(qseecom_enable_dfab_sfpb_vectors),
1762 qseecom_enable_dfab_sfpb_vectors,
1763 },
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001764};
1765
1766static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1767 qseecom_hw_bus_scale_usecases,
1768 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1769 .name = "qsee",
1770};
1771
1772static struct platform_device qseecom_device = {
1773 .name = "qseecom",
1774 .id = 0,
1775 .dev = {
1776 .platform_data = &qseecom_bus_pdata,
1777 },
1778};
1779#endif
1780
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001781#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1782 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1783 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1784 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1785
1786#define QCE_SIZE 0x10000
1787#define QCE_0_BASE 0x11000000
1788
1789#define QCE_HW_KEY_SUPPORT 0
1790#define QCE_SHA_HMAC_SUPPORT 1
1791#define QCE_SHARE_CE_RESOURCE 3
1792#define QCE_CE_SHARED 0
1793
1794static struct resource qcrypto_resources[] = {
1795 [0] = {
1796 .start = QCE_0_BASE,
1797 .end = QCE_0_BASE + QCE_SIZE - 1,
1798 .flags = IORESOURCE_MEM,
1799 },
1800 [1] = {
1801 .name = "crypto_channels",
1802 .start = DMOV8064_CE_IN_CHAN,
1803 .end = DMOV8064_CE_OUT_CHAN,
1804 .flags = IORESOURCE_DMA,
1805 },
1806 [2] = {
1807 .name = "crypto_crci_in",
1808 .start = DMOV8064_CE_IN_CRCI,
1809 .end = DMOV8064_CE_IN_CRCI,
1810 .flags = IORESOURCE_DMA,
1811 },
1812 [3] = {
1813 .name = "crypto_crci_out",
1814 .start = DMOV8064_CE_OUT_CRCI,
1815 .end = DMOV8064_CE_OUT_CRCI,
1816 .flags = IORESOURCE_DMA,
1817 },
1818};
1819
1820static struct resource qcedev_resources[] = {
1821 [0] = {
1822 .start = QCE_0_BASE,
1823 .end = QCE_0_BASE + QCE_SIZE - 1,
1824 .flags = IORESOURCE_MEM,
1825 },
1826 [1] = {
1827 .name = "crypto_channels",
1828 .start = DMOV8064_CE_IN_CHAN,
1829 .end = DMOV8064_CE_OUT_CHAN,
1830 .flags = IORESOURCE_DMA,
1831 },
1832 [2] = {
1833 .name = "crypto_crci_in",
1834 .start = DMOV8064_CE_IN_CRCI,
1835 .end = DMOV8064_CE_IN_CRCI,
1836 .flags = IORESOURCE_DMA,
1837 },
1838 [3] = {
1839 .name = "crypto_crci_out",
1840 .start = DMOV8064_CE_OUT_CRCI,
1841 .end = DMOV8064_CE_OUT_CRCI,
1842 .flags = IORESOURCE_DMA,
1843 },
1844};
1845
1846#endif
1847
1848#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1849 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1850
1851static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1852 .ce_shared = QCE_CE_SHARED,
1853 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1854 .hw_key_support = QCE_HW_KEY_SUPPORT,
1855 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001856 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001857};
1858
1859static struct platform_device qcrypto_device = {
1860 .name = "qcrypto",
1861 .id = 0,
1862 .num_resources = ARRAY_SIZE(qcrypto_resources),
1863 .resource = qcrypto_resources,
1864 .dev = {
1865 .coherent_dma_mask = DMA_BIT_MASK(32),
1866 .platform_data = &qcrypto_ce_hw_suppport,
1867 },
1868};
1869#endif
1870
1871#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1872 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1873
1874static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1875 .ce_shared = QCE_CE_SHARED,
1876 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1877 .hw_key_support = QCE_HW_KEY_SUPPORT,
1878 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001879 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001880};
1881
1882static struct platform_device qcedev_device = {
1883 .name = "qce",
1884 .id = 0,
1885 .num_resources = ARRAY_SIZE(qcedev_resources),
1886 .resource = qcedev_resources,
1887 .dev = {
1888 .coherent_dma_mask = DMA_BIT_MASK(32),
1889 .platform_data = &qcedev_ce_hw_suppport,
1890 },
1891};
1892#endif
1893
Joel Kingef390842012-05-23 16:42:48 -07001894static struct mdm_vddmin_resource mdm_vddmin_rscs = {
1895 .rpm_id = MSM_RPM_ID_VDDMIN_GPIO,
1896 .ap2mdm_vddmin_gpio = 30,
1897 .modes = 0x03,
1898 .drive_strength = 8,
1899 .mdm2ap_vddmin_gpio = 80,
1900};
1901
Joel King269aa602012-07-23 08:07:35 -07001902static struct gpiomux_setting mdm2ap_status_gpio_run_cfg = {
1903 .func = GPIOMUX_FUNC_GPIO,
1904 .drv = GPIOMUX_DRV_8MA,
1905 .pull = GPIOMUX_PULL_NONE,
1906};
1907
Joel Kingdacbc822012-01-25 13:30:57 -08001908static struct mdm_platform_data mdm_platform_data = {
1909 .mdm_version = "3.0",
1910 .ramdump_delay_ms = 2000,
Joel King14fe7fa2012-05-27 14:26:11 -07001911 .early_power_on = 1,
1912 .sfr_query = 1,
Joel Kingbf3e4b52012-09-26 09:10:34 -07001913 .send_shdn = 1,
Joel Kingef390842012-05-23 16:42:48 -07001914 .vddmin_resource = &mdm_vddmin_rscs,
Hemant Kumara945b472012-01-25 15:08:06 -08001915 .peripheral_platform_device = &apq8064_device_hsic_host,
Ameya Thakurc9a7a842012-06-24 22:47:52 -07001916 .ramdump_timeout_ms = 120000,
Joel King269aa602012-07-23 08:07:35 -07001917 .mdm2ap_status_gpio_run_cfg = &mdm2ap_status_gpio_run_cfg,
Joel Kingdacbc822012-01-25 13:30:57 -08001918};
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001919
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001920static struct tsens_platform_data apq_tsens_pdata = {
1921 .tsens_factor = 1000,
1922 .hw_type = APQ_8064,
1923 .tsens_num_sensor = 11,
1924 .slope = {1176, 1176, 1154, 1176, 1111,
1925 1132, 1132, 1199, 1132, 1199, 1132},
1926};
1927
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07001928static struct platform_device msm_tsens_device = {
1929 .name = "tsens8960-tm",
1930 .id = -1,
1931};
1932
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06001933static struct msm_thermal_data msm_thermal_pdata = {
1934 .sensor_id = 7,
Eugene Seah2ee4a5d2012-06-25 18:16:41 -06001935 .poll_ms = 250,
1936 .limit_temp_degC = 60,
1937 .temp_hysteresis_degC = 10,
1938 .freq_step = 2,
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06001939};
1940
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001941#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001942static void __init apq8064_map_io(void)
1943{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001944 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001945 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001946 if (socinfo_init() < 0)
1947 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001948}
1949
1950static void __init apq8064_init_irq(void)
1951{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001952 struct msm_mpm_device_data *data = NULL;
1953
1954#ifdef CONFIG_MSM_MPM
1955 data = &apq8064_mpm_dev_data;
1956#endif
1957
1958 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001959 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1960 (void *)MSM_QGIC_CPU_BASE);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001961}
1962
Abhishek Kharbanda72dc72e2012-06-07 13:41:37 -07001963static struct msm_mhl_platform_data mhl_platform_data = {
1964 .irq = MSM_GPIO_TO_INT(MHL_GPIO_INT),
1965 .gpio_mhl_int = MHL_GPIO_INT,
1966 .gpio_mhl_reset = MHL_GPIO_RESET,
1967 .gpio_mhl_power = 0,
1968 .gpio_hdmi_mhl_mux = 0,
1969};
1970
1971static struct i2c_board_info sii_device_info[] __initdata = {
1972 {
1973 /*
1974 * keeps SI 8334 as the default
1975 * MHL TX
1976 */
1977 I2C_BOARD_INFO("sii8334", 0x39),
1978 .platform_data = &mhl_platform_data,
1979 .flags = I2C_CLIENT_WAKE,
1980 },
1981};
1982
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001983static struct platform_device msm8064_device_saw_regulator_core0 = {
1984 .name = "saw-regulator",
1985 .id = 0,
1986 .dev = {
1987 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
1988 },
1989};
1990
1991static struct platform_device msm8064_device_saw_regulator_core1 = {
1992 .name = "saw-regulator",
1993 .id = 1,
1994 .dev = {
1995 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
1996 },
1997};
1998
1999static struct platform_device msm8064_device_saw_regulator_core2 = {
2000 .name = "saw-regulator",
2001 .id = 2,
2002 .dev = {
2003 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
2004 },
2005};
2006
2007static struct platform_device msm8064_device_saw_regulator_core3 = {
2008 .name = "saw-regulator",
2009 .id = 3,
2010 .dev = {
2011 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002012
2013 },
2014};
2015
Oluwafemi Adeyemif5a31422012-03-08 16:58:45 -08002016static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06002017 {
2018 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2019 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2020 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002021 1, 784, 180000, 100,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002022 },
2023
2024 {
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002025 MSM_PM_SLEEP_MODE_RETENTION,
2026 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2027 true,
2028 415, 715, 340827, 475,
2029 },
2030
2031 {
Praveen Chidambaram78499012011-11-01 17:15:17 -06002032 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2033 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2034 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002035 1300, 228, 1200000, 2000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002036 },
2037
2038 {
2039 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2040 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2041 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002042 2000, 138, 1208400, 3200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002043 },
2044
2045 {
2046 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Praveen Chidambarame3380672012-02-08 10:32:27 -07002047 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2048 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002049 6000, 119, 1850300, 9000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002050 },
2051
2052 {
2053 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2054 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2055 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002056 9200, 68, 2839200, 16400,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002057 },
2058
2059 {
2060 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2061 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2062 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002063 10300, 63, 3128000, 18200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002064 },
2065
2066 {
2067 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2068 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2069 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002070 18000, 10, 4602600, 27000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002071 },
2072
2073 {
2074 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2075 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2076 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002077 20000, 2, 5752000, 32000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002078 },
2079};
2080
2081static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2082 .mode = MSM_PM_BOOT_CONFIG_TZ,
2083};
2084
2085static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2086 .levels = &msm_rpmrs_levels[0],
2087 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2088 .vdd_mem_levels = {
2089 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2090 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2091 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2092 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2093 },
2094 .vdd_dig_levels = {
2095 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
2096 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
2097 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
2098 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
2099 },
2100 .vdd_mask = 0x7FFFFF,
2101 .rpmrs_target_id = {
2102 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2103 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
2104 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
2105 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
2106 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
2107 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
2108 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2109 },
2110};
2111
Praveen Chidambaram78499012011-11-01 17:15:17 -06002112static uint8_t spm_wfi_cmd_sequence[] __initdata = {
2113 0x03, 0x0f,
2114};
2115
2116static uint8_t spm_power_collapse_without_rpm[] __initdata = {
2117 0x00, 0x24, 0x54, 0x10,
2118 0x09, 0x03, 0x01,
2119 0x10, 0x54, 0x30, 0x0C,
2120 0x24, 0x30, 0x0f,
2121};
2122
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002123static uint8_t spm_retention_cmd_sequence[] __initdata = {
2124 0x00, 0x05, 0x03, 0x0D,
2125 0x0B, 0x00, 0x0f,
2126};
2127
Praveen Chidambaram78499012011-11-01 17:15:17 -06002128static uint8_t spm_power_collapse_with_rpm[] __initdata = {
2129 0x00, 0x24, 0x54, 0x10,
2130 0x09, 0x07, 0x01, 0x0B,
2131 0x10, 0x54, 0x30, 0x0C,
2132 0x24, 0x30, 0x0f,
2133};
2134
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002135static struct msm_spm_seq_entry msm_spm_boot_cpu_seq_list[] __initdata = {
2136 [0] = {
2137 .mode = MSM_SPM_MODE_CLOCK_GATING,
2138 .notify_rpm = false,
2139 .cmd = spm_wfi_cmd_sequence,
2140 },
2141 [1] = {
2142 .mode = MSM_SPM_MODE_POWER_RETENTION,
2143 .notify_rpm = false,
2144 .cmd = spm_retention_cmd_sequence,
2145 },
2146 [2] = {
2147 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2148 .notify_rpm = false,
2149 .cmd = spm_power_collapse_without_rpm,
2150 },
2151 [3] = {
2152 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2153 .notify_rpm = true,
2154 .cmd = spm_power_collapse_with_rpm,
2155 },
2156};
2157static struct msm_spm_seq_entry msm_spm_nonboot_cpu_seq_list[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06002158 [0] = {
2159 .mode = MSM_SPM_MODE_CLOCK_GATING,
2160 .notify_rpm = false,
2161 .cmd = spm_wfi_cmd_sequence,
2162 },
2163 [1] = {
2164 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2165 .notify_rpm = false,
2166 .cmd = spm_power_collapse_without_rpm,
2167 },
2168 [2] = {
2169 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2170 .notify_rpm = true,
2171 .cmd = spm_power_collapse_with_rpm,
2172 },
2173};
2174
2175static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
2176 0x00, 0x20, 0x03, 0x20,
2177 0x00, 0x0f,
2178};
2179
2180static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
2181 0x00, 0x20, 0x34, 0x64,
2182 0x48, 0x07, 0x48, 0x20,
2183 0x50, 0x64, 0x04, 0x34,
2184 0x50, 0x0f,
2185};
2186static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
2187 0x00, 0x10, 0x34, 0x64,
2188 0x48, 0x07, 0x48, 0x10,
2189 0x50, 0x64, 0x04, 0x34,
2190 0x50, 0x0F,
2191};
2192
2193static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
2194 [0] = {
2195 .mode = MSM_SPM_L2_MODE_RETENTION,
2196 .notify_rpm = false,
2197 .cmd = l2_spm_wfi_cmd_sequence,
2198 },
2199 [1] = {
2200 .mode = MSM_SPM_L2_MODE_GDHS,
2201 .notify_rpm = true,
2202 .cmd = l2_spm_gdhs_cmd_sequence,
2203 },
2204 [2] = {
2205 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
2206 .notify_rpm = true,
2207 .cmd = l2_spm_power_off_cmd_sequence,
2208 },
2209};
2210
2211
2212static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
2213 [0] = {
2214 .reg_base_addr = MSM_SAW_L2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002215 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07002216 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002217 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
2218 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
2219 .modes = msm_spm_l2_seq_list,
2220 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
2221 },
2222};
2223
2224static struct msm_spm_platform_data msm_spm_data[] __initdata = {
2225 [0] = {
2226 .reg_base_addr = MSM_SAW0_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002227 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002228#if defined(CONFIG_MSM_AVS_HW)
2229 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2230 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2231#endif
2232 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002233 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004,
2234 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C,
2235 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002236 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002237 .num_modes = ARRAY_SIZE(msm_spm_boot_cpu_seq_list),
2238 .modes = msm_spm_boot_cpu_seq_list,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002239 },
2240 [1] = {
2241 .reg_base_addr = MSM_SAW1_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002242 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002243#if defined(CONFIG_MSM_AVS_HW)
2244 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2245 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2246#endif
2247 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07002248 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002249 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2250 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2251 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002252 .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
2253 .modes = msm_spm_nonboot_cpu_seq_list,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002254 },
2255 [2] = {
2256 .reg_base_addr = MSM_SAW2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002257 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002258#if defined(CONFIG_MSM_AVS_HW)
2259 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2260 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2261#endif
2262 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07002263 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002264 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2265 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2266 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002267 .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
2268 .modes = msm_spm_nonboot_cpu_seq_list,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002269 },
2270 [3] = {
2271 .reg_base_addr = MSM_SAW3_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002272 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002273#if defined(CONFIG_MSM_AVS_HW)
2274 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2275 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2276#endif
2277 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07002278 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002279 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2280 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2281 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002282 .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
2283 .modes = msm_spm_nonboot_cpu_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08002284 },
2285};
2286
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002287static void __init apq8064_init_buses(void)
2288{
2289 msm_bus_rpm_set_mt_mask();
2290 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
2291 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
2292 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
2293 msm_bus_8064_apps_fabric.dev.platform_data =
2294 &msm_bus_8064_apps_fabric_pdata;
2295 msm_bus_8064_sys_fabric.dev.platform_data =
2296 &msm_bus_8064_sys_fabric_pdata;
2297 msm_bus_8064_mm_fabric.dev.platform_data =
2298 &msm_bus_8064_mm_fabric_pdata;
2299 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
2300 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
2301}
2302
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002303/* PCIe gpios */
2304static struct msm_pcie_gpio_info_t msm_pcie_gpio_info[MSM_PCIE_MAX_GPIO] = {
2305 {"rst_n", PM8921_MPP_PM_TO_SYS(PCIE_RST_N_PMIC_MPP), 0},
2306 {"pwr_en", PM8921_GPIO_PM_TO_SYS(PCIE_PWR_EN_PMIC_GPIO), 1},
2307};
2308
2309static struct msm_pcie_platform msm_pcie_platform_data = {
2310 .gpio = msm_pcie_gpio_info,
Niranjana Vishwanathapura68210ff2012-06-24 18:03:49 -06002311 .axi_addr = PCIE_AXI_BAR_PHYS,
2312 .axi_size = PCIE_AXI_BAR_SIZE,
Niranjana Vishwanathapura459a27d2012-07-20 12:23:55 -06002313 .wake_n = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, PCIE_WAKE_N_PMIC_GPIO),
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002314};
2315
Niranjana Vishwanathapurac1edd402012-06-28 15:32:50 -06002316static int __init mpq8064_pcie_enabled(void)
2317{
2318 return !((readl_relaxed(QFPROM_RAW_FEAT_CONFIG_ROW0_MSB) & BIT(21)) ||
2319 (readl_relaxed(QFPROM_RAW_OEM_CONFIG_ROW0_LSB) & BIT(4)));
2320}
2321
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002322static void __init mpq8064_pcie_init(void)
2323{
Niranjana Vishwanathapurac1edd402012-06-28 15:32:50 -06002324 if (mpq8064_pcie_enabled()) {
2325 msm_device_pcie.dev.platform_data = &msm_pcie_platform_data;
2326 platform_device_register(&msm_device_pcie);
2327 }
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002328}
2329
David Collinsf0d00732012-01-25 15:46:50 -08002330static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
2331 .name = GPIO_REGULATOR_DEV_NAME,
2332 .id = PM8921_MPP_PM_TO_SYS(7),
2333 .dev = {
2334 .platform_data
2335 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2336 },
2337};
2338
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08002339static struct platform_device apq8064_device_ext_mpp8_vreg __devinitdata = {
2340 .name = GPIO_REGULATOR_DEV_NAME,
2341 .id = PM8921_MPP_PM_TO_SYS(8),
2342 .dev = {
2343 .platform_data
2344 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_MPP8],
2345 },
2346};
2347
David Collinsf0d00732012-01-25 15:46:50 -08002348static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
2349 .name = GPIO_REGULATOR_DEV_NAME,
2350 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
2351 .dev = {
2352 .platform_data =
2353 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2354 },
2355};
2356
David Collins390fc332012-02-07 14:38:16 -08002357static struct platform_device apq8064_device_ext_ts_sw_vreg __devinitdata = {
2358 .name = GPIO_REGULATOR_DEV_NAME,
2359 .id = PM8921_GPIO_PM_TO_SYS(23),
2360 .dev = {
2361 .platform_data
2362 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_TS_SW],
2363 },
2364};
2365
David Collins2782b5c2012-02-06 10:02:42 -08002366static struct platform_device apq8064_device_rpm_regulator __devinitdata = {
2367 .name = "rpm-regulator",
David Collins793793b2012-08-21 15:43:02 -07002368 .id = 0,
David Collins2782b5c2012-02-06 10:02:42 -08002369 .dev = {
2370 .platform_data = &apq8064_rpm_regulator_pdata,
2371 },
2372};
2373
David Collins793793b2012-08-21 15:43:02 -07002374static struct platform_device
2375apq8064_pm8921_device_rpm_regulator __devinitdata = {
2376 .name = "rpm-regulator",
2377 .id = 1,
2378 .dev = {
2379 .platform_data = &apq8064_rpm_regulator_pm8921_pdata,
2380 },
2381};
2382
Ravi Kumar V05931a22012-04-04 17:09:37 +05302383static struct gpio_ir_recv_platform_data gpio_ir_recv_pdata = {
2384 .gpio_nr = 88,
2385 .active_low = 1,
Ravi Kumar V16a614c2012-10-12 20:59:56 +05302386 .can_wakeup = true,
Ravi Kumar V05931a22012-04-04 17:09:37 +05302387};
2388
2389static struct platform_device gpio_ir_recv_pdev = {
2390 .name = "gpio-rc-recv",
2391 .dev = {
2392 .platform_data = &gpio_ir_recv_pdata,
2393 },
2394};
2395
Terence Hampson36b70722012-05-10 13:18:16 -04002396static struct platform_device *common_not_mpq_devices[] __initdata = {
David Keitel3c40fc52012-02-09 17:53:52 -08002397 &apq8064_device_qup_i2c_gsbi1,
Jing Lin04601f92012-02-05 15:36:07 -08002398 &apq8064_device_qup_i2c_gsbi3,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002399 &apq8064_device_qup_i2c_gsbi4,
Terence Hampson36b70722012-05-10 13:18:16 -04002400};
2401
Kuirong Wangf8c5e142012-06-21 16:17:32 -07002402static struct platform_device *common_mpq_devices[] __initdata = {
2403 &mpq_cpudai_sec_i2s_rx,
2404 &mpq_cpudai_mi2s_tx,
2405};
2406
2407static struct platform_device *common_i2s_devices[] __initdata = {
2408 &apq_cpudai_mi2s,
2409 &apq_cpudai_i2s_rx,
2410 &apq_cpudai_i2s_tx,
2411};
2412
David Collins793793b2012-08-21 15:43:02 -07002413static struct platform_device *early_common_devices[] __initdata = {
Matt Wagantallf5cc3892012-06-07 19:47:02 -07002414 &apq8064_device_acpuclk,
Terence Hampson36b70722012-05-10 13:18:16 -04002415 &apq8064_device_dmov,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002416 &apq8064_device_qup_spi_gsbi5,
David Collins793793b2012-08-21 15:43:02 -07002417};
2418
2419static struct platform_device *pm8921_common_devices[] __initdata = {
David Collinsf0d00732012-01-25 15:46:50 -08002420 &apq8064_device_ext_5v_vreg,
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08002421 &apq8064_device_ext_mpp8_vreg,
David Collinsf0d00732012-01-25 15:46:50 -08002422 &apq8064_device_ext_3p3v_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07002423 &apq8064_device_ssbi_pmic1,
2424 &apq8064_device_ssbi_pmic2,
David Collins793793b2012-08-21 15:43:02 -07002425};
2426
2427static struct platform_device *pm8917_common_devices[] __initdata = {
2428 &apq8064_device_ext_mpp8_vreg,
2429 &apq8064_device_ext_3p3v_vreg,
2430 &apq8064_device_ssbi_pmic1,
2431 &apq8064_device_ssbi_pmic2,
David Collins793793b2012-08-21 15:43:02 -07002432};
2433
2434static struct platform_device *common_devices[] __initdata = {
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06002435 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07002436 &apq8064_device_otg,
2437 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08002438 &apq8064_device_hsusb_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07002439 &android_usb_device,
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08002440 &msm_device_wcnss_wlan,
Ankit Vermab7c26e62012-02-28 15:04:15 -08002441 &msm_device_iris_fm,
Larry Bassel67b921d2012-04-06 10:23:27 -07002442 &apq8064_fmem_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08002443#ifdef CONFIG_ANDROID_PMEM
2444#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002445 &apq8064_android_pmem_device,
2446 &apq8064_android_pmem_adsp_device,
2447 &apq8064_android_pmem_audio_device,
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -07002448#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
2449#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -08002450#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002451 &apq8064_ion_dev,
Olav Haugan7c6aa742012-01-16 16:47:37 -08002452#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002453 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08002454 &msm8064_device_saw_regulator_core0,
2455 &msm8064_device_saw_regulator_core1,
2456 &msm8064_device_saw_regulator_core2,
2457 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002458#if defined(CONFIG_QSEECOM)
2459 &qseecom_device,
2460#endif
2461
Joel Nider6b9a7bc2012-06-26 11:19:19 +03002462 &msm_8064_device_tsif[0],
2463 &msm_8064_device_tsif[1],
2464
Ramesh Masavarapu28311912011-10-27 11:04:12 -07002465#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2466 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2467 &qcrypto_device,
2468#endif
2469
2470#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2471 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2472 &qcedev_device,
2473#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07002474
2475#ifdef CONFIG_HW_RANDOM_MSM
2476 &apq8064_device_rng,
2477#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002478 &apq_pcm,
2479 &apq_pcm_routing,
2480 &apq_cpudai0,
2481 &apq_cpudai1,
2482 &apq_cpudai_hdmi_rx,
2483 &apq_cpudai_bt_rx,
2484 &apq_cpudai_bt_tx,
2485 &apq_cpudai_fm_rx,
2486 &apq_cpudai_fm_tx,
2487 &apq_cpu_fe,
2488 &apq_stub_codec,
2489 &apq_voice,
2490 &apq_voip,
2491 &apq_lpa_pcm,
Krishnankutty Kolathappilly4374e332012-03-18 22:27:30 -07002492 &apq_compr_dsp,
2493 &apq_multi_ch_pcm,
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -07002494 &apq_lowlatency_pcm,
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002495 &apq_pcm_hostless,
2496 &apq_cpudai_afe_01_rx,
2497 &apq_cpudai_afe_01_tx,
2498 &apq_cpudai_afe_02_rx,
2499 &apq_cpudai_afe_02_tx,
2500 &apq_pcm_afe,
2501 &apq_cpudai_auxpcm_rx,
2502 &apq_cpudai_auxpcm_tx,
Neema Shetty8427c262012-02-16 11:23:43 -08002503 &apq_cpudai_stub,
Neema Shetty3c9d2862012-03-11 01:25:32 -08002504 &apq_cpudai_slimbus_1_rx,
2505 &apq_cpudai_slimbus_1_tx,
Kiran Kandi97fe19d2012-05-20 22:34:04 -07002506 &apq_cpudai_slimbus_2_rx,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002507 &apq_cpudai_slimbus_2_tx,
Neema Shettyc9d86c32012-05-09 12:01:39 -07002508 &apq_cpudai_slimbus_3_rx,
Helen Zeng38c3c962012-05-17 14:56:20 -07002509 &apq_cpudai_slimbus_3_tx,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002510 &apq8064_rpm_device,
2511 &apq8064_rpm_log_device,
2512 &apq8064_rpm_stat_device,
Anji Jonnala93129922012-10-09 20:57:53 +05302513 &apq8064_rpm_master_stat_device,
Ramesh Masavarapuf31ff242012-05-10 18:55:21 -07002514 &apq_device_tz_log,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002515 &msm_bus_8064_apps_fabric,
2516 &msm_bus_8064_sys_fabric,
2517 &msm_bus_8064_mm_fabric,
2518 &msm_bus_8064_sys_fpb,
2519 &msm_bus_8064_cpss_fpb,
Mohan Kumar Gubbihalli Lachma Naik7f72edd2012-02-06 17:26:47 -08002520 &apq8064_msm_device_vidc,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07002521 &msm_pil_dsps,
Matt Wagantallb94b9a52012-02-02 21:59:54 -08002522 &msm_8960_q6_lpass,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002523 &msm_pil_vidc,
Matt Wagantall292aace2012-01-26 19:12:34 -08002524 &msm_gss,
Laura Abbottb93525f2012-04-12 09:57:19 -07002525 &apq8064_rtb_device,
Abhijeet Dharmapurikarfb4a2f82012-08-23 14:36:59 -07002526 &apq8064_msm_gov_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002527 &apq8064_device_cache_erp,
Stepan Moskovchenko0f3de112012-06-08 18:11:46 -07002528 &msm8960_device_ebi1_ch0_erp,
2529 &msm8960_device_ebi1_ch1_erp,
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002530 &epm_adc_device,
Pratik Patel3b0ca882012-06-01 16:54:14 -07002531 &coresight_tpiu_device,
2532 &coresight_etb_device,
2533 &apq8064_coresight_funnel_device,
2534 &coresight_etm0_device,
2535 &coresight_etm1_device,
2536 &coresight_etm2_device,
2537 &coresight_etm3_device,
Helen Zeng8f925502012-03-05 16:50:17 -08002538 &apq_cpudai_slim_4_rx,
2539 &apq_cpudai_slim_4_tx,
Steve Mucklef132c6c2012-06-06 18:30:57 -07002540#ifdef CONFIG_MSM_GEMINI
Jignesh Mehta921649d2012-04-19 06:57:23 -07002541 &msm8960_gemini_device,
Steve Mucklef132c6c2012-06-06 18:30:57 -07002542#endif
Laura Abbott0577d7b2012-04-17 11:14:30 -07002543 &apq8064_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002544 &msm_tsens_device,
Laura Abbott93a4a352012-05-25 09:26:35 -07002545 &apq8064_cache_dump_device,
Joel Nider0e4a16d2012-08-05 14:20:11 +03002546 &msm_8064_device_tspp,
Binqiang Qiuf165c922012-08-15 18:00:18 -07002547#ifdef CONFIG_BATTERY_BCL
2548 &battery_bcl_device,
2549#endif
Abhijeet Dharmapurikarfb4a2f82012-08-23 14:36:59 -07002550 &apq8064_msm_mpd_device,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002551};
2552
Joel King82b7e3f2012-01-05 10:03:27 -08002553static struct platform_device *cdp_devices[] __initdata = {
2554 &apq8064_device_uart_gsbi1,
Jin Hong4bbbfba2012-02-02 21:48:07 -08002555 &apq8064_device_uart_gsbi7,
Joel King82b7e3f2012-01-05 10:03:27 -08002556 &msm_device_sps_apq8064,
Aravind Venkateswaran4ca27532012-02-16 14:27:05 -08002557#ifdef CONFIG_MSM_ROTATOR
2558 &msm_rotator_device,
2559#endif
Anji Jonnala6c2b6852012-09-21 13:34:44 +05302560 &msm8064_pc_cntr,
Joel King82b7e3f2012-01-05 10:03:27 -08002561};
2562
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002563static struct platform_device
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002564mpq8064_device_ext_1p2_buck_vreg __devinitdata = {
2565 .name = GPIO_REGULATOR_DEV_NAME,
2566 .id = SX150X_GPIO(4, 2),
2567 .dev = {
2568 .platform_data =
2569 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P2V],
2570 },
2571};
2572
2573static struct platform_device
2574mpq8064_device_ext_1p8_buck_vreg __devinitdata = {
2575 .name = GPIO_REGULATOR_DEV_NAME,
2576 .id = SX150X_GPIO(4, 4),
2577 .dev = {
2578 .platform_data =
2579 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P8V],
2580 },
2581};
2582
2583static struct platform_device
2584mpq8064_device_ext_2p2_buck_vreg __devinitdata = {
2585 .name = GPIO_REGULATOR_DEV_NAME,
2586 .id = SX150X_GPIO(4, 14),
2587 .dev = {
2588 .platform_data =
2589 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_2P2V],
2590 },
2591};
2592
2593static struct platform_device
2594mpq8064_device_ext_5v_buck_vreg __devinitdata = {
2595 .name = GPIO_REGULATOR_DEV_NAME,
2596 .id = SX150X_GPIO(4, 3),
2597 .dev = {
2598 .platform_data =
2599 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_5V],
2600 },
2601};
2602
2603static struct platform_device
2604mpq8064_device_ext_3p3v_ldo_vreg __devinitdata = {
2605 .name = GPIO_REGULATOR_DEV_NAME,
2606 .id = SX150X_GPIO(4, 15),
2607 .dev = {
2608 .platform_data =
2609 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_3P3V],
2610 },
2611};
2612
Ravi Kumar V1c903012012-05-15 16:11:35 +05302613static struct platform_device rc_input_loopback_pdev = {
2614 .name = "rc-user-input",
2615 .id = -1,
2616};
2617
Ravi Kumar V040eeff2012-05-23 21:29:23 +05302618static int rf4ce_gpio_init(void)
2619{
Ravi Kumar V92b2b6c2012-08-14 17:18:11 +05302620 if (!machine_is_mpq8064_cdp() &&
2621 !machine_is_mpq8064_hrd() &&
2622 !machine_is_mpq8064_dtv())
Ravi Kumar V040eeff2012-05-23 21:29:23 +05302623 return -EINVAL;
2624
2625 /* CC2533 SRDY Input */
2626 if (!gpio_request(SX150X_GPIO(4, 6), "rf4ce_srdy")) {
2627 gpio_direction_input(SX150X_GPIO(4, 6));
2628 gpio_export(SX150X_GPIO(4, 6), true);
2629 }
2630
2631 /* CC2533 MRDY Output */
2632 if (!gpio_request(SX150X_GPIO(4, 5), "rf4ce_mrdy")) {
2633 gpio_direction_output(SX150X_GPIO(4, 5), 1);
2634 gpio_export(SX150X_GPIO(4, 5), true);
2635 }
2636
2637 /* CC2533 Reset Output */
2638 if (!gpio_request(SX150X_GPIO(4, 7), "rf4ce_reset")) {
2639 gpio_direction_output(SX150X_GPIO(4, 7), 0);
2640 gpio_export(SX150X_GPIO(4, 7), true);
2641 }
2642
2643 return 0;
2644}
2645late_initcall(rf4ce_gpio_init);
2646
Mayank Rana262e9032012-05-10 15:14:00 -07002647#ifdef CONFIG_SERIAL_MSM_HS
2648static int configure_uart_gpios(int on)
2649{
2650 int ret = 0, i;
2651 int uart_gpios[] = {14, 15, 16, 17};
2652
2653 for (i = 0; i < ARRAY_SIZE(uart_gpios); i++) {
2654 if (on) {
2655 ret = gpio_request(uart_gpios[i], NULL);
2656 if (ret) {
2657 pr_err("%s:unable to request uart gpio[%d]\n",
2658 __func__, uart_gpios[i]);
2659 break;
2660 }
2661 } else {
2662 gpio_free(uart_gpios[i]);
2663 }
2664 }
2665
2666 if (ret && on && i)
2667 for (; i >= 0; i--)
2668 gpio_free(uart_gpios[i]);
2669 return ret;
2670}
2671
2672static struct msm_serial_hs_platform_data mpq8064_gsbi6_uartdm_pdata = {
2673 .inject_rx_on_wakeup = 1,
2674 .rx_to_inject = 0xFD,
2675 .gpio_config = configure_uart_gpios,
2676};
2677#else
2678static struct msm_serial_hs_platform_data msm_uart_dm9_pdata;
2679#endif
2680
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002681static struct platform_device *mpq_devices[] __initdata = {
2682 &msm_device_sps_apq8064,
2683 &mpq8064_device_qup_i2c_gsbi5,
2684#ifdef CONFIG_MSM_ROTATOR
2685 &msm_rotator_device,
2686#endif
Ravi Kumar V05931a22012-04-04 17:09:37 +05302687 &gpio_ir_recv_pdev,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002688 &mpq8064_device_ext_1p2_buck_vreg,
2689 &mpq8064_device_ext_1p8_buck_vreg,
2690 &mpq8064_device_ext_2p2_buck_vreg,
2691 &mpq8064_device_ext_5v_buck_vreg,
2692 &mpq8064_device_ext_3p3v_ldo_vreg,
Terence Hampson2e1705f2012-04-11 19:55:29 -04002693#ifdef CONFIG_MSM_VCAP
2694 &msm8064_device_vcap,
2695#endif
Ravi Kumar V1c903012012-05-15 16:11:35 +05302696 &rc_input_loopback_pdev,
Bar Weinerf82c5872012-10-23 14:31:26 +02002697 &mpq8064_device_qup_spi_gsbi6,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002698};
2699
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002700static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002701 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002702};
2703
Bar Weinerf82c5872012-10-23 14:31:26 +02002704static struct msm_spi_platform_data mpq8064_qup_spi_gsbi6_pdata = {
2705 .max_clock_speed = 1100000,
2706};
2707
2708static struct ci_bridge_platform_data mpq8064_ci_bridge_pdata = {
2709 .reset_pin = 260,
2710 .interrupt_pin = 261,
2711};
2712
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002713#define KS8851_IRQ_GPIO 43
2714
2715static struct spi_board_info spi_board_info[] __initdata = {
2716 {
2717 .modalias = "ks8851",
2718 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2719 .max_speed_hz = 19200000,
2720 .bus_num = 0,
2721 .chip_select = 2,
2722 .mode = SPI_MODE_0,
2723 },
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002724 {
2725 .modalias = "epm_adc",
2726 .max_speed_hz = 1100000,
2727 .bus_num = 0,
2728 .chip_select = 3,
2729 .mode = SPI_MODE_0,
Bar Weinerf82c5872012-10-23 14:31:26 +02002730 }
2731};
2732
2733static struct spi_board_info mpq8064_spi_board_info[] __initdata = {
2734 {
2735 .modalias = "ci_bridge_spi",
2736 .max_speed_hz = 1000000,
2737 .bus_num = 1,
2738 .chip_select = 0,
2739 .mode = SPI_MODE_0,
2740 .platform_data = &mpq8064_ci_bridge_pdata,
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002741 },
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002742};
2743
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002744static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002745 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08002746 .bus_num = 1,
2747 .slim_slave = &apq8064_slim_tabla,
2748 },
2749 {
2750 .bus_num = 1,
2751 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002752 },
2753 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002754};
2755
David Keitel3c40fc52012-02-09 17:53:52 -08002756static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi1_pdata = {
2757 .clk_freq = 100000,
2758 .src_clk_rate = 24000000,
2759};
2760
Jing Lin04601f92012-02-05 15:36:07 -08002761static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi3_pdata = {
Anirudh Ghayalc2163472012-04-10 14:58:14 +05302762 .clk_freq = 384000,
Jing Lin04601f92012-02-05 15:36:07 -08002763 .src_clk_rate = 24000000,
2764};
2765
Kenneth Heitke748593a2011-07-15 15:45:11 -06002766static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
2767 .clk_freq = 100000,
2768 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002769};
2770
Joel King8f839b92012-04-01 14:37:46 -07002771static struct msm_i2c_platform_data mpq8064_i2c_qup_gsbi5_pdata = {
2772 .clk_freq = 100000,
2773 .src_clk_rate = 24000000,
2774};
2775
David Keitel3c40fc52012-02-09 17:53:52 -08002776#define GSBI_DUAL_MODE_CODE 0x60
2777#define MSM_GSBI1_PHYS 0x12440000
Kenneth Heitke748593a2011-07-15 15:45:11 -06002778static void __init apq8064_i2c_init(void)
2779{
David Keitel3c40fc52012-02-09 17:53:52 -08002780 void __iomem *gsbi_mem;
2781
2782 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2783 &apq8064_i2c_qup_gsbi1_pdata;
2784 gsbi_mem = ioremap_nocache(MSM_GSBI1_PHYS, 4);
2785 writel_relaxed(GSBI_DUAL_MODE_CODE, gsbi_mem);
2786 /* Ensure protocol code is written before proceeding */
2787 wmb();
2788 iounmap(gsbi_mem);
2789 apq8064_i2c_qup_gsbi1_pdata.use_gsbi_shared_mode = 1;
Jing Lin04601f92012-02-05 15:36:07 -08002790 apq8064_device_qup_i2c_gsbi3.dev.platform_data =
2791 &apq8064_i2c_qup_gsbi3_pdata;
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002792 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2793 &apq8064_i2c_qup_gsbi1_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002794 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
2795 &apq8064_i2c_qup_gsbi4_pdata;
Joel King8f839b92012-04-01 14:37:46 -07002796 mpq8064_device_qup_i2c_gsbi5.dev.platform_data =
2797 &mpq8064_i2c_qup_gsbi5_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002798}
2799
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002800#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002801static int ethernet_init(void)
2802{
2803 int ret;
2804 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
2805 if (ret) {
2806 pr_err("ks8851 gpio_request failed: %d\n", ret);
2807 goto fail;
2808 }
2809
2810 return 0;
2811fail:
2812 return ret;
2813}
2814#else
2815static int ethernet_init(void)
2816{
2817 return 0;
2818}
2819#endif
2820
David Collinsd49a1c52012-08-22 13:18:06 -07002821#define GPIO_KEY_HOME PM8921_GPIO_PM_TO_SYS(27)
2822#define GPIO_KEY_VOLUME_UP PM8921_GPIO_PM_TO_SYS(35)
2823#define GPIO_KEY_VOLUME_DOWN_PM8921 PM8921_GPIO_PM_TO_SYS(38)
2824#define GPIO_KEY_VOLUME_DOWN_PM8917 PM8921_GPIO_PM_TO_SYS(30)
2825#define GPIO_KEY_CAM_FOCUS PM8921_GPIO_PM_TO_SYS(3)
2826#define GPIO_KEY_CAM_SNAP PM8921_GPIO_PM_TO_SYS(4)
2827#define GPIO_KEY_ROTATION_PM8921 PM8921_GPIO_PM_TO_SYS(42)
2828#define GPIO_KEY_ROTATION_PM8917 PM8921_GPIO_PM_TO_SYS(8)
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302829
David Collinsd49a1c52012-08-22 13:18:06 -07002830static struct gpio_keys_button cdp_keys_pm8921[] = {
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302831 {
2832 .code = KEY_HOME,
2833 .gpio = GPIO_KEY_HOME,
2834 .desc = "home_key",
2835 .active_low = 1,
2836 .type = EV_KEY,
2837 .wakeup = 1,
2838 .debounce_interval = 15,
2839 },
2840 {
2841 .code = KEY_VOLUMEUP,
2842 .gpio = GPIO_KEY_VOLUME_UP,
2843 .desc = "volume_up_key",
2844 .active_low = 1,
2845 .type = EV_KEY,
2846 .wakeup = 1,
2847 .debounce_interval = 15,
2848 },
2849 {
2850 .code = KEY_VOLUMEDOWN,
David Collinsd49a1c52012-08-22 13:18:06 -07002851 .gpio = GPIO_KEY_VOLUME_DOWN_PM8921,
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302852 .desc = "volume_down_key",
2853 .active_low = 1,
2854 .type = EV_KEY,
2855 .wakeup = 1,
2856 .debounce_interval = 15,
2857 },
2858 {
2859 .code = SW_ROTATE_LOCK,
David Collinsd49a1c52012-08-22 13:18:06 -07002860 .gpio = GPIO_KEY_ROTATION_PM8921,
2861 .desc = "rotate_key",
2862 .active_low = 1,
2863 .type = EV_SW,
2864 .debounce_interval = 15,
2865 },
2866};
2867
2868static struct gpio_keys_button cdp_keys_pm8917[] = {
2869 {
2870 .code = KEY_HOME,
2871 .gpio = GPIO_KEY_HOME,
2872 .desc = "home_key",
2873 .active_low = 1,
2874 .type = EV_KEY,
2875 .wakeup = 1,
2876 .debounce_interval = 15,
2877 },
2878 {
2879 .code = KEY_VOLUMEUP,
2880 .gpio = GPIO_KEY_VOLUME_UP,
2881 .desc = "volume_up_key",
2882 .active_low = 1,
2883 .type = EV_KEY,
2884 .wakeup = 1,
2885 .debounce_interval = 15,
2886 },
2887 {
2888 .code = KEY_VOLUMEDOWN,
2889 .gpio = GPIO_KEY_VOLUME_DOWN_PM8917,
2890 .desc = "volume_down_key",
2891 .active_low = 1,
2892 .type = EV_KEY,
2893 .wakeup = 1,
2894 .debounce_interval = 15,
2895 },
2896 {
2897 .code = SW_ROTATE_LOCK,
2898 .gpio = GPIO_KEY_ROTATION_PM8917,
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302899 .desc = "rotate_key",
2900 .active_low = 1,
2901 .type = EV_SW,
2902 .debounce_interval = 15,
2903 },
2904};
2905
2906static struct gpio_keys_platform_data cdp_keys_data = {
David Collinsd49a1c52012-08-22 13:18:06 -07002907 .buttons = cdp_keys_pm8921,
2908 .nbuttons = ARRAY_SIZE(cdp_keys_pm8921),
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302909};
2910
2911static struct platform_device cdp_kp_pdev = {
2912 .name = "gpio-keys",
2913 .id = -1,
2914 .dev = {
2915 .platform_data = &cdp_keys_data,
2916 },
2917};
2918
2919static struct gpio_keys_button mtp_keys[] = {
2920 {
2921 .code = KEY_CAMERA_FOCUS,
2922 .gpio = GPIO_KEY_CAM_FOCUS,
2923 .desc = "cam_focus_key",
2924 .active_low = 1,
2925 .type = EV_KEY,
2926 .wakeup = 1,
2927 .debounce_interval = 15,
2928 },
2929 {
2930 .code = KEY_VOLUMEUP,
2931 .gpio = GPIO_KEY_VOLUME_UP,
2932 .desc = "volume_up_key",
2933 .active_low = 1,
2934 .type = EV_KEY,
2935 .wakeup = 1,
2936 .debounce_interval = 15,
2937 },
2938 {
2939 .code = KEY_VOLUMEDOWN,
David Collinsd49a1c52012-08-22 13:18:06 -07002940 .gpio = GPIO_KEY_VOLUME_DOWN_PM8921,
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302941 .desc = "volume_down_key",
2942 .active_low = 1,
2943 .type = EV_KEY,
2944 .wakeup = 1,
2945 .debounce_interval = 15,
2946 },
2947 {
2948 .code = KEY_CAMERA_SNAPSHOT,
2949 .gpio = GPIO_KEY_CAM_SNAP,
2950 .desc = "cam_snap_key",
2951 .active_low = 1,
2952 .type = EV_KEY,
2953 .debounce_interval = 15,
2954 },
2955};
2956
2957static struct gpio_keys_platform_data mtp_keys_data = {
2958 .buttons = mtp_keys,
2959 .nbuttons = ARRAY_SIZE(mtp_keys),
2960};
2961
2962static struct platform_device mtp_kp_pdev = {
2963 .name = "gpio-keys",
2964 .id = -1,
2965 .dev = {
2966 .platform_data = &mtp_keys_data,
2967 },
2968};
2969
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05302970static struct gpio_keys_button mpq_keys[] = {
2971 {
2972 .code = KEY_VOLUMEDOWN,
David Collinsd49a1c52012-08-22 13:18:06 -07002973 .gpio = GPIO_KEY_VOLUME_DOWN_PM8921,
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05302974 .desc = "volume_down_key",
2975 .active_low = 1,
2976 .type = EV_KEY,
2977 .wakeup = 1,
2978 .debounce_interval = 15,
2979 },
2980 {
2981 .code = KEY_VOLUMEUP,
2982 .gpio = GPIO_KEY_VOLUME_UP,
2983 .desc = "volume_up_key",
2984 .active_low = 1,
2985 .type = EV_KEY,
2986 .wakeup = 1,
2987 .debounce_interval = 15,
2988 },
2989};
2990
2991static struct gpio_keys_platform_data mpq_keys_data = {
2992 .buttons = mpq_keys,
2993 .nbuttons = ARRAY_SIZE(mpq_keys),
2994};
2995
2996static struct platform_device mpq_gpio_keys_pdev = {
2997 .name = "gpio-keys",
2998 .id = -1,
2999 .dev = {
3000 .platform_data = &mpq_keys_data,
3001 },
3002};
3003
3004#define MPQ_KP_ROW_BASE SX150X_EXP2_GPIO_BASE
3005#define MPQ_KP_COL_BASE (SX150X_EXP2_GPIO_BASE + 4)
3006
3007static unsigned int mpq_row_gpios[] = {MPQ_KP_ROW_BASE, MPQ_KP_ROW_BASE + 1,
3008 MPQ_KP_ROW_BASE + 2, MPQ_KP_ROW_BASE + 3};
3009static unsigned int mpq_col_gpios[] = {MPQ_KP_COL_BASE, MPQ_KP_COL_BASE + 1,
3010 MPQ_KP_COL_BASE + 2};
3011
3012static const unsigned int mpq_keymap[] = {
3013 KEY(0, 0, KEY_UP),
3014 KEY(0, 1, KEY_ENTER),
3015 KEY(0, 2, KEY_3),
3016
3017 KEY(1, 0, KEY_DOWN),
3018 KEY(1, 1, KEY_EXIT),
3019 KEY(1, 2, KEY_4),
3020
3021 KEY(2, 0, KEY_LEFT),
3022 KEY(2, 1, KEY_1),
3023 KEY(2, 2, KEY_5),
3024
3025 KEY(3, 0, KEY_RIGHT),
3026 KEY(3, 1, KEY_2),
3027 KEY(3, 2, KEY_6),
3028};
3029
3030static struct matrix_keymap_data mpq_keymap_data = {
3031 .keymap_size = ARRAY_SIZE(mpq_keymap),
3032 .keymap = mpq_keymap,
3033};
3034
3035static struct matrix_keypad_platform_data mpq_keypad_data = {
3036 .keymap_data = &mpq_keymap_data,
3037 .row_gpios = mpq_row_gpios,
3038 .col_gpios = mpq_col_gpios,
3039 .num_row_gpios = ARRAY_SIZE(mpq_row_gpios),
3040 .num_col_gpios = ARRAY_SIZE(mpq_col_gpios),
3041 .col_scan_delay_us = 32000,
3042 .debounce_ms = 20,
3043 .wakeup = 1,
3044 .active_low = 1,
3045 .no_autorepeat = 1,
3046};
3047
3048static struct platform_device mpq_keypad_device = {
3049 .name = "matrix-keypad",
3050 .id = -1,
3051 .dev = {
3052 .platform_data = &mpq_keypad_data,
3053 },
3054};
3055
Jin Hongd3024e62012-02-09 16:13:32 -08003056/* Sensors DSPS platform data */
3057#define DSPS_PIL_GENERIC_NAME "dsps"
3058static void __init apq8064_init_dsps(void)
3059{
3060 struct msm_dsps_platform_data *pdata =
3061 msm_dsps_device_8064.dev.platform_data;
3062 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
3063 pdata->gpios = NULL;
3064 pdata->gpios_num = 0;
3065
3066 platform_device_register(&msm_dsps_device_8064);
3067}
Mohan Pallaka474b94b2012-01-25 12:59:58 +05303068
Jing Lin417fa452012-02-05 14:31:06 -08003069#define I2C_SURF 1
3070#define I2C_FFA (1 << 1)
3071#define I2C_RUMI (1 << 2)
3072#define I2C_SIM (1 << 3)
3073#define I2C_LIQUID (1 << 4)
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003074#define I2C_MPQ_CDP BIT(5)
3075#define I2C_MPQ_HRD BIT(6)
3076#define I2C_MPQ_DTV BIT(7)
Jing Lin417fa452012-02-05 14:31:06 -08003077
3078struct i2c_registry {
3079 u8 machs;
3080 int bus;
3081 struct i2c_board_info *info;
3082 int len;
3083};
3084
3085static struct i2c_registry apq8064_i2c_devices[] __initdata = {
Jing Lin21ed4de2012-02-05 15:53:28 -08003086 {
David Keitel2f613d92012-02-15 11:29:16 -08003087 I2C_LIQUID,
3088 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
3089 smb349_charger_i2c_info,
3090 ARRAY_SIZE(smb349_charger_i2c_info)
3091 },
3092 {
Jing Lin21ed4de2012-02-05 15:53:28 -08003093 I2C_SURF | I2C_LIQUID,
3094 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
3095 mxt_device_info,
3096 ARRAY_SIZE(mxt_device_info),
3097 },
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08003098 {
3099 I2C_FFA,
3100 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
3101 cyttsp_info,
3102 ARRAY_SIZE(cyttsp_info),
3103 },
Amy Maloche70090f992012-02-16 16:35:26 -08003104 {
3105 I2C_FFA | I2C_LIQUID,
3106 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
3107 isa1200_board_info,
3108 ARRAY_SIZE(isa1200_board_info),
3109 },
Santosh Mardieff9a742012-04-09 23:23:39 +05303110 {
3111 I2C_MPQ_CDP,
3112 APQ_8064_GSBI5_QUP_I2C_BUS_ID,
3113 cs8427_device_info,
3114 ARRAY_SIZE(cs8427_device_info),
3115 },
Abhishek Kharbanda72dc72e2012-06-07 13:41:37 -07003116 {
3117 I2C_SURF | I2C_FFA | I2C_LIQUID,
3118 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
3119 sii_device_info,
3120 ARRAY_SIZE(sii_device_info),
3121 }
Jing Lin417fa452012-02-05 14:31:06 -08003122};
3123
Kuirong Wangf8c5e142012-06-21 16:17:32 -07003124static struct i2c_registry apq8064_tabla_i2c_devices[] __initdata = {
3125 {
3126 .bus = APQ_8064_GSBI1_QUP_I2C_BUS_ID,
3127 .info = apq8064_tabla_i2c_device_info,
3128 .len = ARRAY_SIZE(apq8064_tabla_i2c_device_info),
3129 },
3130};
3131
Jay Chokshi607f61b2012-04-25 18:21:21 -07003132#define SX150X_EXP1_INT_N PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9)
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05303133#define SX150X_EXP2_INT_N MSM_GPIO_TO_INT(81)
Jay Chokshi607f61b2012-04-25 18:21:21 -07003134
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003135struct sx150x_platform_data mpq8064_sx150x_pdata[] = {
3136 [SX150X_EXP1] = {
3137 .gpio_base = SX150X_EXP1_GPIO_BASE,
3138 .oscio_is_gpo = false,
3139 .io_pullup_ena = 0x0,
3140 .io_pulldn_ena = 0x0,
3141 .io_open_drain_ena = 0x0,
3142 .io_polarity = 0,
Jay Chokshi607f61b2012-04-25 18:21:21 -07003143 .irq_summary = SX150X_EXP1_INT_N,
3144 .irq_base = SX150X_EXP1_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003145 },
3146 [SX150X_EXP2] = {
3147 .gpio_base = SX150X_EXP2_GPIO_BASE,
3148 .oscio_is_gpo = false,
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05303149 .io_pullup_ena = 0x0f,
3150 .io_pulldn_ena = 0x70,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003151 .io_open_drain_ena = 0x0,
3152 .io_polarity = 0,
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05303153 .irq_summary = SX150X_EXP2_INT_N,
3154 .irq_base = SX150X_EXP2_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003155 },
3156 [SX150X_EXP3] = {
3157 .gpio_base = SX150X_EXP3_GPIO_BASE,
3158 .oscio_is_gpo = false,
3159 .io_pullup_ena = 0x0,
3160 .io_pulldn_ena = 0x0,
3161 .io_open_drain_ena = 0x0,
3162 .io_polarity = 0,
3163 .irq_summary = -1,
3164 },
3165 [SX150X_EXP4] = {
3166 .gpio_base = SX150X_EXP4_GPIO_BASE,
3167 .oscio_is_gpo = false,
3168 .io_pullup_ena = 0x0,
3169 .io_pulldn_ena = 0x0,
3170 .io_open_drain_ena = 0x0,
3171 .io_polarity = 0,
3172 .irq_summary = -1,
3173 },
3174};
3175
3176static struct i2c_board_info sx150x_gpio_exp_info[] = {
3177 {
3178 I2C_BOARD_INFO("sx1509q", 0x70),
3179 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP1],
3180 },
3181 {
3182 I2C_BOARD_INFO("sx1508q", 0x23),
3183 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP2],
3184 },
3185 {
3186 I2C_BOARD_INFO("sx1508q", 0x22),
3187 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP3],
3188 },
3189 {
3190 I2C_BOARD_INFO("sx1509q", 0x3E),
3191 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP4],
3192 },
3193};
3194
3195#define MPQ8064_I2C_GSBI5_BUS_ID 5
3196
3197static struct i2c_registry mpq8064_i2c_devices[] __initdata = {
3198 {
3199 I2C_MPQ_CDP,
3200 MPQ8064_I2C_GSBI5_BUS_ID,
3201 sx150x_gpio_exp_info,
3202 ARRAY_SIZE(sx150x_gpio_exp_info),
3203 },
3204};
3205
Jing Lin417fa452012-02-05 14:31:06 -08003206static void __init register_i2c_devices(void)
3207{
3208 u8 mach_mask = 0;
3209 int i;
Kuirong Wangf8c5e142012-06-21 16:17:32 -07003210 u32 version;
Jing Lin417fa452012-02-05 14:31:06 -08003211
Kevin Chand07220e2012-02-13 15:52:22 -08003212#ifdef CONFIG_MSM_CAMERA
3213 struct i2c_registry apq8064_camera_i2c_devices = {
3214 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_RUMI,
3215 APQ_8064_GSBI4_QUP_I2C_BUS_ID,
3216 apq8064_camera_board_info.board_info,
3217 apq8064_camera_board_info.num_i2c_board_info,
3218 };
3219#endif
Jing Lin417fa452012-02-05 14:31:06 -08003220 /* Build the matching 'supported_machs' bitmask */
3221 if (machine_is_apq8064_cdp())
3222 mach_mask = I2C_SURF;
3223 else if (machine_is_apq8064_mtp())
3224 mach_mask = I2C_FFA;
3225 else if (machine_is_apq8064_liquid())
3226 mach_mask = I2C_LIQUID;
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003227 else if (PLATFORM_IS_MPQ8064())
3228 mach_mask = I2C_MPQ_CDP;
Jing Lin417fa452012-02-05 14:31:06 -08003229 else
3230 pr_err("unmatched machine ID in register_i2c_devices\n");
3231
3232 /* Run the array and install devices as appropriate */
3233 for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) {
3234 if (apq8064_i2c_devices[i].machs & mach_mask)
3235 i2c_register_board_info(apq8064_i2c_devices[i].bus,
3236 apq8064_i2c_devices[i].info,
3237 apq8064_i2c_devices[i].len);
3238 }
Kevin Chand07220e2012-02-13 15:52:22 -08003239#ifdef CONFIG_MSM_CAMERA
3240 if (apq8064_camera_i2c_devices.machs & mach_mask)
3241 i2c_register_board_info(apq8064_camera_i2c_devices.bus,
3242 apq8064_camera_i2c_devices.info,
3243 apq8064_camera_i2c_devices.len);
3244#endif
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003245
3246 for (i = 0; i < ARRAY_SIZE(mpq8064_i2c_devices); ++i) {
3247 if (mpq8064_i2c_devices[i].machs & mach_mask)
3248 i2c_register_board_info(
3249 mpq8064_i2c_devices[i].bus,
3250 mpq8064_i2c_devices[i].info,
3251 mpq8064_i2c_devices[i].len);
3252 }
Kuirong Wangf8c5e142012-06-21 16:17:32 -07003253
3254 if (machine_is_apq8064_mtp()) {
3255 version = socinfo_get_platform_version();
3256 if (SOCINFO_VERSION_MINOR(version) == 1)
3257 for (i = 0; i < ARRAY_SIZE(apq8064_tabla_i2c_devices);
3258 ++i)
3259 i2c_register_board_info(
3260 apq8064_tabla_i2c_devices[i].bus,
3261 apq8064_tabla_i2c_devices[i].info,
3262 apq8064_tabla_i2c_devices[i].len);
3263 }
3264
Jing Lin417fa452012-02-05 14:31:06 -08003265}
3266
Jay Chokshi994ff122012-03-27 15:43:48 -07003267static void enable_ddr3_regulator(void)
3268{
3269 static struct regulator *ext_ddr3;
3270
3271 /* Use MPP7 output state as a flag for PCDDR3 presence. */
3272 if (gpio_get_value_cansleep(PM8921_MPP_PM_TO_SYS(7)) > 0) {
3273 ext_ddr3 = regulator_get(NULL, "ext_ddr3");
3274 if (IS_ERR(ext_ddr3) || ext_ddr3 == NULL)
3275 pr_err("Could not get MPP7 regulator\n");
3276 else
3277 regulator_enable(ext_ddr3);
3278 }
3279}
3280
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003281static void enable_avc_i2c_bus(void)
3282{
3283 int avc_i2c_en_mpp = PM8921_MPP_PM_TO_SYS(8);
3284 int rc;
3285
3286 rc = gpio_request(avc_i2c_en_mpp, "avc_i2c_en");
3287 if (rc)
3288 pr_err("request for avc_i2c_en mpp failed,"
3289 "rc=%d\n", rc);
3290 else
3291 gpio_set_value_cansleep(avc_i2c_en_mpp, 1);
3292}
3293
David Collinsd49a1c52012-08-22 13:18:06 -07003294/* Modify platform data values to match requirements for PM8917. */
3295static void __init apq8064_pm8917_pdata_fixup(void)
3296{
3297 cdp_keys_data.buttons = cdp_keys_pm8917;
3298 cdp_keys_data.nbuttons = ARRAY_SIZE(cdp_keys_pm8917);
3299}
3300
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003301static void __init apq8064_common_init(void)
3302{
Kuirong Wangf8c5e142012-06-21 16:17:32 -07003303 u32 platform_version = socinfo_get_platform_version();
David Collinsd49a1c52012-08-22 13:18:06 -07003304
3305 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
3306 apq8064_pm8917_pdata_fixup();
Rohit Vaswanib1cc4932012-07-23 21:30:11 -07003307 platform_device_register(&msm_gpio_device);
Joel King8f839b92012-04-01 14:37:46 -07003308 msm_tsens_early_init(&apq_tsens_pdata);
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06003309 msm_thermal_init(&msm_thermal_pdata);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003310 if (socinfo_init() < 0)
3311 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06003312 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
3313 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
David Collins2782b5c2012-02-06 10:02:42 -08003314 regulator_suppress_info_printing();
David Collins793793b2012-08-21 15:43:02 -07003315 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
3316 configure_apq8064_pm8917_power_grid();
David Collins2782b5c2012-02-06 10:02:42 -08003317 platform_device_register(&apq8064_device_rpm_regulator);
David Collins793793b2012-08-21 15:43:02 -07003318 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917)
3319 platform_device_register(&apq8064_pm8921_device_rpm_regulator);
Stephen Boyd4d0d2582012-02-10 14:49:40 -08003320 if (msm_xo_init())
3321 pr_err("Failed to initialize XO votes\n");
Matt Wagantallc51e5602012-02-27 17:25:25 -08003322 msm_clock_init(&apq8064_clock_init_data);
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08003323 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06003324 apq8064_i2c_init();
Jing Lin417fa452012-02-05 14:31:06 -08003325 register_i2c_devices();
Kenneth Heitke36920d32011-07-20 16:44:30 -06003326
Harini Jayaramanc4c58692011-07-19 14:50:10 -06003327 apq8064_device_qup_spi_gsbi5.dev.platform_data =
3328 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08003329 apq8064_init_pmic();
Hemant Kumar94e7da22012-02-03 16:52:29 -08003330 if (machine_is_apq8064_liquid())
3331 msm_otg_pdata.mhl_enable = true;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07003332
Abhishek Kharbanda72dc72e2012-06-07 13:41:37 -07003333 if (apq8064_mhl_display_enabled())
3334 mhl_platform_data.mhl_enabled = true;
3335
Ofir Cohen94213a72012-05-03 14:26:32 +03003336 android_usb_pdata.swfi_latency =
3337 msm_rpmrs_levels[0].latency_us;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07003338
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003339 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Manu Gautam91223e02011-11-08 15:27:22 +05303340 apq8064_ehci_host_init();
Gagan Mac8a7a5d32011-11-11 16:43:06 -07003341 apq8064_init_buses();
David Collins793793b2012-08-21 15:43:02 -07003342
3343 platform_add_devices(early_common_devices,
3344 ARRAY_SIZE(early_common_devices));
3345 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917)
3346 platform_add_devices(pm8921_common_devices,
3347 ARRAY_SIZE(pm8921_common_devices));
3348 else
3349 platform_add_devices(pm8917_common_devices,
3350 ARRAY_SIZE(pm8917_common_devices));
David Collins03c16372012-10-04 15:57:28 -07003351 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
3352 platform_device_register(&apq8064_device_ext_ts_sw_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003353 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Terence Hampson36b70722012-05-10 13:18:16 -04003354 if (!(machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
3355 machine_is_mpq8064_dtv()))
3356 platform_add_devices(common_not_mpq_devices,
3357 ARRAY_SIZE(common_not_mpq_devices));
Kuirong Wangf8c5e142012-06-21 16:17:32 -07003358
3359 if ((machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
3360 machine_is_mpq8064_dtv()))
3361 platform_add_devices(common_mpq_devices,
3362 ARRAY_SIZE(common_mpq_devices));
3363
3364 if (machine_is_apq8064_mtp()) {
3365 if (SOCINFO_VERSION_MINOR(platform_version) == 1)
3366 platform_add_devices(common_i2s_devices,
3367 ARRAY_SIZE(common_i2s_devices));
3368 }
3369
Jay Chokshi994ff122012-03-27 15:43:48 -07003370 enable_ddr3_regulator();
Pavankumar Kondeti4f5dc3b2012-09-07 15:33:09 +05303371 msm_hsic_pdata.swfi_latency =
3372 msm_rpmrs_levels[0].latency_us;
Hemant Kumarf1ca9192012-02-07 18:59:33 -08003373 if (machine_is_apq8064_mtp()) {
Hemant Kumar30d361c2012-08-20 14:44:40 -07003374 msm_hsic_pdata.log2_irq_thresh = 5,
Hemant Kumarf1ca9192012-02-07 18:59:33 -08003375 apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
3376 device_initialize(&apq8064_device_hsic_host.dev);
3377 }
Jay Chokshie8741282012-01-25 15:22:55 -08003378 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05303379 apq8064_init_mmc();
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08003380
3381 if (machine_is_apq8064_mtp()) {
3382 mdm_8064_device.dev.platform_data = &mdm_platform_data;
Ameya Thakure155ece2012-07-09 12:08:37 -07003383 if (SOCINFO_VERSION_MINOR(platform_version) == 1) {
3384 i2s_mdm_8064_device.dev.platform_data =
3385 &mdm_platform_data;
3386 platform_device_register(&i2s_mdm_8064_device);
3387 } else {
3388 mdm_8064_device.dev.platform_data = &mdm_platform_data;
3389 platform_device_register(&mdm_8064_device);
3390 }
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08003391 }
3392 platform_device_register(&apq8064_slim_ctrl);
Santosh Mardi344455a2012-09-07 13:22:16 +05303393 if (machine_is_mpq8064_hrd() || machine_is_mpq8064_dtv()) {
3394 apq8064_slim_devices[ARRAY_SIZE(apq8064_slim_devices) - 1].\
3395 slim_slave = &mpq8064_slim_ashiko20;
3396 }
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06003397 slim_register_board_info(apq8064_slim_devices,
3398 ARRAY_SIZE(apq8064_slim_devices));
Taniya Dasbbf633d2012-07-31 16:07:47 +05303399 if (!PLATFORM_IS_MPQ8064()) {
Taniya Das30cae292012-07-31 15:56:12 +05303400 apq8064_init_dsps();
Taniya Dasbbf633d2012-07-31 16:07:47 +05303401 platform_device_register(&msm_8960_riva);
3402 }
Praveen Chidambaram78499012011-11-01 17:15:17 -06003403 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3404 msm_spm_l2_init(msm_spm_l2_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06003405 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08003406 apq8064_epm_adc_init();
Girish Mahadevan3bc98772012-08-15 10:01:27 -06003407 msm_pm_set_tz_retention_flag(1);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003408}
3409
Huaibin Yang4a084e32011-12-15 15:25:52 -08003410static void __init apq8064_allocate_memory_regions(void)
3411{
3412 apq8064_allocate_fb_region();
3413}
3414
Joel King82b7e3f2012-01-05 10:03:27 -08003415static void __init apq8064_cdp_init(void)
3416{
Hanumant Singh50440d42012-04-23 19:27:16 -07003417 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
3418 pr_err("meminfo_init() failed!\n");
Amy Maloche609bb5e2012-08-03 09:41:42 -07003419 if (machine_is_apq8064_mtp() &&
3420 SOCINFO_VERSION_MINOR(socinfo_get_platform_version()) == 1)
3421 cyttsp_pdata.sleep_gpio = CYTTSP_TS_GPIO_SLEEP_ALT;
Joel King82b7e3f2012-01-05 10:03:27 -08003422 apq8064_common_init();
Joel King8f839b92012-04-01 14:37:46 -07003423 if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
3424 machine_is_mpq8064_dtv()) {
Ravi Kumar V16a614c2012-10-12 20:59:56 +05303425 gpio_ir_recv_pdata.swfi_latency =
3426 msm_rpmrs_levels[0].latency_us;
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003427 enable_avc_i2c_bus();
Olav Hauganef95ae32012-05-15 09:50:30 -07003428 msm_rotator_set_split_iommu_domain();
Bar Weinerf82c5872012-10-23 14:31:26 +02003429
3430 mpq8064_device_qup_spi_gsbi6.dev.platform_data =
3431 &mpq8064_qup_spi_gsbi6_pdata;
3432
Joel King8f839b92012-04-01 14:37:46 -07003433 platform_add_devices(mpq_devices, ARRAY_SIZE(mpq_devices));
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06003434 mpq8064_pcie_init();
Bar Weinerf82c5872012-10-23 14:31:26 +02003435 spi_register_board_info(mpq8064_spi_board_info,
3436 ARRAY_SIZE(mpq8064_spi_board_info));
Joel King8f839b92012-04-01 14:37:46 -07003437 } else {
3438 ethernet_init();
Olav Hauganef95ae32012-05-15 09:50:30 -07003439 msm_rotator_set_split_iommu_domain();
Joel King8f839b92012-04-01 14:37:46 -07003440 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
3441 spi_register_board_info(spi_board_info,
3442 ARRAY_SIZE(spi_board_info));
3443 }
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003444 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07003445 apq8064_init_gpu();
Matt Wagantall1f65d9d2012-04-25 14:24:20 -07003446 platform_add_devices(apq8064_footswitch, apq8064_num_footswitch);
Steve Mucklef132c6c2012-06-06 18:30:57 -07003447#ifdef CONFIG_MSM_CAMERA
Kevin Chand07220e2012-02-13 15:52:22 -08003448 apq8064_init_cam();
Steve Mucklef132c6c2012-06-06 18:30:57 -07003449#endif
Mohan Pallaka474b94b2012-01-25 12:59:58 +05303450
Mayank Rana262e9032012-05-10 15:14:00 -07003451 if (machine_is_mpq8064_hrd() || machine_is_mpq8064_dtv()) {
3452 platform_device_register(&mpq8064_device_uartdm_gsbi6);
3453#ifdef CONFIG_SERIAL_MSM_HS
3454 /* GSBI6(2) - UARTDM_RX */
3455 mpq8064_gsbi6_uartdm_pdata.wakeup_irq = gpio_to_irq(15);
3456 mpq8064_device_uartdm_gsbi6.dev.platform_data =
3457 &mpq8064_gsbi6_uartdm_pdata;
3458#endif
3459 }
3460
Ankit Verma6fe41b02012-09-13 16:12:11 +05303461#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
3462 if (machine_is_mpq8064_hrd())
3463 apq8064_bt_power_init();
3464#endif
3465
Mohan Pallaka474b94b2012-01-25 12:59:58 +05303466 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
3467 platform_device_register(&cdp_kp_pdev);
3468
3469 if (machine_is_apq8064_mtp())
3470 platform_device_register(&mtp_kp_pdev);
Hanumant Singh50440d42012-04-23 19:27:16 -07003471
3472 change_memory_power = &apq8064_change_memory_power;
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05303473
3474 if (machine_is_mpq8064_cdp()) {
3475 platform_device_register(&mpq_gpio_keys_pdev);
3476 platform_device_register(&mpq_keypad_device);
3477 }
Joel King82b7e3f2012-01-05 10:03:27 -08003478}
3479
Joel King82b7e3f2012-01-05 10:03:27 -08003480MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
3481 .map_io = apq8064_map_io,
3482 .reserve = apq8064_reserve,
3483 .init_irq = apq8064_init_irq,
3484 .handle_irq = gic_handle_irq,
3485 .timer = &msm_timer,
3486 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003487 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003488 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003489 .restart = msm_restart,
Joel King82b7e3f2012-01-05 10:03:27 -08003490MACHINE_END
3491
3492MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
3493 .map_io = apq8064_map_io,
3494 .reserve = apq8064_reserve,
3495 .init_irq = apq8064_init_irq,
3496 .handle_irq = gic_handle_irq,
3497 .timer = &msm_timer,
3498 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003499 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003500 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003501 .restart = msm_restart,
Joel King82b7e3f2012-01-05 10:03:27 -08003502MACHINE_END
3503
3504MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
3505 .map_io = apq8064_map_io,
3506 .reserve = apq8064_reserve,
3507 .init_irq = apq8064_init_irq,
3508 .handle_irq = gic_handle_irq,
3509 .timer = &msm_timer,
3510 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003511 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003512 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003513 .restart = msm_restart,
Joel King82b7e3f2012-01-05 10:03:27 -08003514MACHINE_END
3515
Joel King064bbf82012-04-01 13:23:39 -07003516MACHINE_START(MPQ8064_CDP, "QCT MPQ8064 CDP")
3517 .map_io = apq8064_map_io,
3518 .reserve = apq8064_reserve,
3519 .init_irq = apq8064_init_irq,
3520 .handle_irq = gic_handle_irq,
3521 .timer = &msm_timer,
3522 .init_machine = apq8064_cdp_init,
3523 .init_early = apq8064_allocate_memory_regions,
3524 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003525 .restart = msm_restart,
Joel King064bbf82012-04-01 13:23:39 -07003526MACHINE_END
3527
Joel King11ca8202012-02-13 16:19:03 -08003528MACHINE_START(MPQ8064_HRD, "QCT MPQ8064 HRD")
3529 .map_io = apq8064_map_io,
3530 .reserve = apq8064_reserve,
3531 .init_irq = apq8064_init_irq,
3532 .handle_irq = gic_handle_irq,
3533 .timer = &msm_timer,
3534 .init_machine = apq8064_cdp_init,
Joel King3a57e772012-05-28 11:22:55 -07003535 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003536 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003537 .restart = msm_restart,
Joel King11ca8202012-02-13 16:19:03 -08003538MACHINE_END
3539
3540MACHINE_START(MPQ8064_DTV, "QCT MPQ8064 DTV")
3541 .map_io = apq8064_map_io,
3542 .reserve = apq8064_reserve,
3543 .init_irq = apq8064_init_irq,
3544 .handle_irq = gic_handle_irq,
3545 .timer = &msm_timer,
3546 .init_machine = apq8064_cdp_init,
Joel King3a57e772012-05-28 11:22:55 -07003547 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003548 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003549 .restart = msm_restart,
Joel King11ca8202012-02-13 16:19:03 -08003550MACHINE_END