blob: eeb3ec6e3d1db9c87a2890bcf8c35daa2a6944d2 [file] [log] [blame]
Deepak Verma888204f2013-01-25 11:43:09 +05301/* Copyright (c) 2011-2013, 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>
Laura Abbott0ae40a02012-08-10 10:49:33 -070028#include <linux/dma-contiguous.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070029#include <linux/dma-mapping.h>
30#include <linux/platform_data/qcom_crypto_device.h>
Mitchel Humpherys6ff930c2012-09-06 11:32:54 -070031#include <linux/msm_ion.h>
Jack Cheung46bfffa2012-01-19 15:26:24 -080032#include <linux/memory.h>
Larry Bassel67b921d2012-04-06 10:23:27 -070033#include <linux/memblock.h>
Praveen Chidambaram877d7a42012-06-05 14:33:20 -060034#include <linux/msm_thermal.h>
Jing Lin21ed4de2012-02-05 15:53:28 -080035#include <linux/i2c/atmel_mxt_ts.h>
Steve Mucklef132c6c2012-06-06 18:30:57 -070036#include <linux/cyttsp-qc.h>
Amy Maloche70090f992012-02-16 16:35:26 -080037#include <linux/i2c/isa1200.h>
Mohan Pallaka474b94b2012-01-25 12:59:58 +053038#include <linux/gpio_keys.h>
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -080039#include <linux/epm_adc.h>
Jay Chokshie7d8d4f2012-04-04 14:47:57 -070040#include <linux/i2c/sx150x.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070041#include <asm/mach-types.h>
42#include <asm/mach/arch.h>
43#include <asm/hardware/gic.h>
Sahitya Tummala3586ed92011-08-03 09:13:23 +053044#include <asm/mach/mmc.h>
Ankit Verma6b7e2ba2012-01-26 15:48:54 -080045#include <linux/platform_data/qcom_wcnss_device.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>
Santosh Mardieff9a742012-04-09 23:23:39 +053072#include <sound/cs8427.h>
Ravi Kumar V05931a22012-04-04 17:09:37 +053073#include <media/gpio-ir-recv.h>
Larry Bassel67b921d2012-04-06 10:23:27 -070074#include <linux/fmem.h>
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -060075#include <mach/msm_pcie.h>
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -070076#include <mach/restart.h>
Niranjana Vishwanathapurac1edd402012-06-28 15:32:50 -060077#include <mach/msm_iomap.h>
Mayank Ranae98f1e42013-02-22 19:58:59 +053078#include <mach/msm_serial_hs.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 Wagantalld55b90f2012-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"
Ameya Thakurffd21b02013-01-30 11:33:22 -080090#include "sysmon.h"
Jay Chokshiea67c622011-07-29 17:12:26 -070091
Olav Haugan7c6aa742012-01-16 16:47:37 -080092#define MSM_PMEM_ADSP_SIZE 0x7800000
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -070093#define MSM_PMEM_AUDIO_SIZE 0x4CF000
Olav Haugan7c6aa742012-01-16 16:47:37 -080094#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
95#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
96#else
Chetan Kalyan72aac4f2012-02-23 14:56:54 -080097#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Olav Haugan7c6aa742012-01-16 16:47:37 -080098#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070099
Olav Haugan7c6aa742012-01-16 16:47:37 -0800100#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Hanumant Singheadb7502012-05-15 18:14:04 -0700101#define HOLE_SIZE 0x20000
Deepak Verma888204f2013-01-25 11:43:09 +0530102#define MSM_ION_MFC_META_SIZE 0x40000 /* 256 Kbytes */
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700103#define MSM_CONTIG_MEM_SIZE 0x65000
Olav Haugan129992c2012-03-22 09:54:01 -0700104#ifdef CONFIG_MSM_IOMMU
105#define MSM_ION_MM_SIZE 0x3800000
106#define MSM_ION_SF_SIZE 0
Olav Haugan39477bb2012-05-14 16:05:36 -0700107#define MSM_ION_QSECOM_SIZE 0x780000 /* (7.5MB) */
Laura Abbott03e3cd72013-02-09 09:35:30 -0800108#define MSM_ION_HEAP_NUM 8
Olav Haugan129992c2012-03-22 09:54:01 -0700109#else
Olav Haugan7c6aa742012-01-16 16:47:37 -0800110#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Haugan129992c2012-03-22 09:54:01 -0700111#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Haugan39477bb2012-05-14 16:05:36 -0700112#define MSM_ION_QSECOM_SIZE 0x600000 /* (6MB) */
Olav Haugan129992c2012-03-22 09:54:01 -0700113#define MSM_ION_HEAP_NUM 8
114#endif
Hanumant Singheadb7502012-05-15 18:14:04 -0700115#define MSM_ION_MM_FW_SIZE (0x200000 - HOLE_SIZE) /* (2MB - 128KB) */
Deepak Verma888204f2013-01-25 11:43:09 +0530116#define MSM_ION_MFC_SIZE (SZ_8K + MSM_ION_MFC_META_SIZE)
Olav Haugan2c43fac2012-01-19 11:06:37 -0800117#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Olav Haugan7c6aa742012-01-16 16:47:37 -0800118#else
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700119#define MSM_CONTIG_MEM_SIZE 0x110C000
Olav Haugan7c6aa742012-01-16 16:47:37 -0800120#define MSM_ION_HEAP_NUM 1
121#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700122
Hanumant Singheadb7502012-05-15 18:14:04 -0700123#define APQ8064_FIXED_AREA_START (0xa0000000 - (MSM_ION_MM_FW_SIZE + \
124 HOLE_SIZE))
Larry Bassel67b921d2012-04-06 10:23:27 -0700125#define MAX_FIXED_AREA_SIZE 0x10000000
Hanumant Singheadb7502012-05-15 18:14:04 -0700126#define MSM_MM_FW_SIZE (0x200000 - HOLE_SIZE)
127#define APQ8064_FW_START APQ8064_FIXED_AREA_START
Laura Abbott03e3cd72013-02-09 09:35:30 -0800128#define MSM_ION_ADSP_SIZE SZ_8M
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
Larry Bassel67b921d2012-04-06 10:23:27 -0700222struct fmem_platform_data apq8064_fmem_pdata = {
223};
224
Olav Haugan7c6aa742012-01-16 16:47:37 -0800225static struct memtype_reserve apq8064_reserve_table[] __initdata = {
226 [MEMTYPE_SMI] = {
227 },
228 [MEMTYPE_EBI0] = {
229 .flags = MEMTYPE_FLAGS_1M_ALIGN,
230 },
231 [MEMTYPE_EBI1] = {
232 .flags = MEMTYPE_FLAGS_1M_ALIGN,
233 },
234};
Kevin Chan13be4e22011-10-20 11:30:32 -0700235
Laura Abbott350c8362012-02-28 14:46:52 -0800236static void __init reserve_rtb_memory(void)
237{
238#if defined(CONFIG_MSM_RTB)
Laura Abbottb93525f2012-04-12 09:57:19 -0700239 apq8064_reserve_table[MEMTYPE_EBI1].size += apq8064_rtb_pdata.size;
Laura Abbott350c8362012-02-28 14:46:52 -0800240#endif
241}
242
243
Kevin Chan13be4e22011-10-20 11:30:32 -0700244static void __init size_pmem_devices(void)
245{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800246#ifdef CONFIG_ANDROID_PMEM
247#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700248 android_pmem_adsp_pdata.size = pmem_adsp_size;
249 android_pmem_pdata.size = pmem_size;
250 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700251#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
252#endif /*CONFIG_ANDROID_PMEM*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700253}
254
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700255#ifdef CONFIG_ANDROID_PMEM
256#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700257static void __init reserve_memory_for(struct android_pmem_platform_data *p)
258{
259 apq8064_reserve_table[p->memory_type].size += p->size;
260}
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700261#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
262#endif /*CONFIG_ANDROID_PMEM*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700263
Kevin Chan13be4e22011-10-20 11:30:32 -0700264static void __init reserve_pmem_memory(void)
265{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800266#ifdef CONFIG_ANDROID_PMEM
267#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700268 reserve_memory_for(&android_pmem_adsp_pdata);
269 reserve_memory_for(&android_pmem_pdata);
270 reserve_memory_for(&android_pmem_audio_pdata);
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700271#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700272 apq8064_reserve_table[MEMTYPE_EBI1].size += msm_contig_mem_size;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700273#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -0800274}
275
276static int apq8064_paddr_to_memtype(unsigned int paddr)
277{
278 return MEMTYPE_EBI1;
279}
280
Steve Mucklef132c6c2012-06-06 18:30:57 -0700281#define FMEM_ENABLED 0
Larry Bassel67b921d2012-04-06 10:23:27 -0700282
Olav Haugan7c6aa742012-01-16 16:47:37 -0800283#ifdef CONFIG_ION_MSM
284#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -0700285static struct ion_cp_heap_pdata cp_mm_apq8064_ion_pdata = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800286 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugand3d29682012-01-19 10:57:07 -0800287 .align = PAGE_SIZE,
Larry Bassel67b921d2012-04-06 10:23:27 -0700288 .reusable = FMEM_ENABLED,
289 .mem_is_fmem = FMEM_ENABLED,
290 .fixed_position = FIXED_MIDDLE,
Laura Abbottadec9c72012-12-05 11:49:59 -0800291 .is_cma = 1,
Laura Abbott5249a052012-12-11 15:09:03 -0800292 .no_nonsecure_alloc = 1,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800293};
294
Laura Abbottb93525f2012-04-12 09:57:19 -0700295static struct ion_cp_heap_pdata cp_mfc_apq8064_ion_pdata = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800296 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugand3d29682012-01-19 10:57:07 -0800297 .align = PAGE_SIZE,
Larry Bassel67b921d2012-04-06 10:23:27 -0700298 .reusable = 0,
299 .mem_is_fmem = FMEM_ENABLED,
300 .fixed_position = FIXED_HIGH,
Laura Abbott5249a052012-12-11 15:09:03 -0800301 .no_nonsecure_alloc = 1,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800302};
303
Laura Abbottb93525f2012-04-12 09:57:19 -0700304static struct ion_co_heap_pdata co_apq8064_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800305 .adjacent_mem_id = INVALID_HEAP_ID,
306 .align = PAGE_SIZE,
Larry Bassel67b921d2012-04-06 10:23:27 -0700307 .mem_is_fmem = 0,
Olav Haugand3d29682012-01-19 10:57:07 -0800308};
309
Laura Abbottb93525f2012-04-12 09:57:19 -0700310static struct ion_co_heap_pdata fw_co_apq8064_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800311 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
312 .align = SZ_128K,
Larry Bassel67b921d2012-04-06 10:23:27 -0700313 .mem_is_fmem = FMEM_ENABLED,
314 .fixed_position = FIXED_LOW,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800315};
316#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800317
Laura Abbott0ae40a02012-08-10 10:49:33 -0700318static u64 msm_dmamask = DMA_BIT_MASK(32);
319
320static struct platform_device ion_mm_heap_device = {
321 .name = "ion-mm-heap-device",
322 .id = -1,
323 .dev = {
324 .dma_mask = &msm_dmamask,
325 .coherent_dma_mask = DMA_BIT_MASK(32),
326 }
327};
328
Laura Abbott03e3cd72013-02-09 09:35:30 -0800329static struct platform_device ion_adsp_heap_device = {
330 .name = "ion-adsp-heap-device",
331 .id = -1,
332 .dev = {
333 .dma_mask = &msm_dmamask,
334 .coherent_dma_mask = DMA_BIT_MASK(32),
335 }
336};
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800337/**
338 * These heaps are listed in the order they will be allocated. Due to
339 * video hardware restrictions and content protection the FW heap has to
340 * be allocated adjacent (below) the MM heap and the MFC heap has to be
341 * allocated after the MM heap to ensure MFC heap is not more than 256MB
342 * away from the base address of the FW heap.
343 * However, the order of FW heap and MM heap doesn't matter since these
344 * two heaps are taken care of by separate code to ensure they are adjacent
345 * to each other.
346 * Don't swap the order unless you know what you are doing!
347 */
Benjamin Gaignardb2d367c2012-06-25 15:27:30 -0700348struct ion_platform_heap apq8064_heaps[] = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800349 {
350 .id = ION_SYSTEM_HEAP_ID,
351 .type = ION_HEAP_TYPE_SYSTEM,
352 .name = ION_VMALLOC_HEAP_NAME,
353 },
354#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
355 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800356 .id = ION_CP_MM_HEAP_ID,
357 .type = ION_HEAP_TYPE_CP,
358 .name = ION_MM_HEAP_NAME,
359 .size = MSM_ION_MM_SIZE,
360 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700361 .extra_data = (void *) &cp_mm_apq8064_ion_pdata,
Laura Abbott0ae40a02012-08-10 10:49:33 -0700362 .priv = &ion_mm_heap_device.dev
Olav Haugan7c6aa742012-01-16 16:47:37 -0800363 },
364 {
Olav Haugand3d29682012-01-19 10:57:07 -0800365 .id = ION_MM_FIRMWARE_HEAP_ID,
366 .type = ION_HEAP_TYPE_CARVEOUT,
367 .name = ION_MM_FIRMWARE_HEAP_NAME,
368 .size = MSM_ION_MM_FW_SIZE,
369 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700370 .extra_data = (void *) &fw_co_apq8064_ion_pdata,
Olav Haugand3d29682012-01-19 10:57:07 -0800371 },
372 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800373 .id = ION_CP_MFC_HEAP_ID,
374 .type = ION_HEAP_TYPE_CP,
375 .name = ION_MFC_HEAP_NAME,
376 .size = MSM_ION_MFC_SIZE,
377 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700378 .extra_data = (void *) &cp_mfc_apq8064_ion_pdata,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800379 },
Olav Haugan129992c2012-03-22 09:54:01 -0700380#ifndef CONFIG_MSM_IOMMU
Olav Haugan7c6aa742012-01-16 16:47:37 -0800381 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800382 .id = ION_SF_HEAP_ID,
383 .type = ION_HEAP_TYPE_CARVEOUT,
384 .name = ION_SF_HEAP_NAME,
385 .size = MSM_ION_SF_SIZE,
386 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700387 .extra_data = (void *) &co_apq8064_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800388 },
Olav Haugan129992c2012-03-22 09:54:01 -0700389#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800390 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800391 .id = ION_IOMMU_HEAP_ID,
392 .type = ION_HEAP_TYPE_IOMMU,
393 .name = ION_IOMMU_HEAP_NAME,
394 },
Olav Hauganf45e2142012-01-19 11:01:01 -0800395 {
396 .id = ION_QSECOM_HEAP_ID,
397 .type = ION_HEAP_TYPE_CARVEOUT,
398 .name = ION_QSECOM_HEAP_NAME,
399 .size = MSM_ION_QSECOM_SIZE,
400 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700401 .extra_data = (void *) &co_apq8064_ion_pdata,
Olav Hauganf45e2142012-01-19 11:01:01 -0800402 },
Olav Haugan2c43fac2012-01-19 11:06:37 -0800403 {
404 .id = ION_AUDIO_HEAP_ID,
405 .type = ION_HEAP_TYPE_CARVEOUT,
406 .name = ION_AUDIO_HEAP_NAME,
407 .size = MSM_ION_AUDIO_SIZE,
408 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700409 .extra_data = (void *) &co_apq8064_ion_pdata,
Olav Haugan2c43fac2012-01-19 11:06:37 -0800410 },
Laura Abbott03e3cd72013-02-09 09:35:30 -0800411 {
412 .id = ION_ADSP_HEAP_ID,
413 .type = ION_HEAP_TYPE_DMA,
414 .name = ION_ADSP_HEAP_NAME,
415 .size = MSM_ION_ADSP_SIZE,
416 .memory_type = ION_EBI_TYPE,
417 .extra_data = (void *) &co_apq8064_ion_pdata,
418 .priv = &ion_adsp_heap_device.dev,
419 },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800420#endif
Benjamin Gaignardb2d367c2012-06-25 15:27:30 -0700421};
422
423static struct ion_platform_data apq8064_ion_pdata = {
424 .nr = MSM_ION_HEAP_NUM,
425 .heaps = apq8064_heaps,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800426};
427
Laura Abbottb93525f2012-04-12 09:57:19 -0700428static struct platform_device apq8064_ion_dev = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800429 .name = "ion-msm",
430 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700431 .dev = { .platform_data = &apq8064_ion_pdata },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800432};
433#endif
434
Larry Bassel67b921d2012-04-06 10:23:27 -0700435static struct platform_device apq8064_fmem_device = {
436 .name = "fmem",
437 .id = 1,
438 .dev = { .platform_data = &apq8064_fmem_pdata },
439};
440
441static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
442 unsigned long size)
443{
444 apq8064_reserve_table[mem_type].size += size;
445}
446
447static void __init apq8064_reserve_fixed_area(unsigned long fixed_area_size)
448{
449#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
450 int ret;
451
452 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
453 panic("fixed area size is larger than %dM\n",
454 MAX_FIXED_AREA_SIZE >> 20);
455
456 reserve_info->fixed_area_size = fixed_area_size;
457 reserve_info->fixed_area_start = APQ8064_FW_START;
458
459 ret = memblock_remove(reserve_info->fixed_area_start,
460 reserve_info->fixed_area_size);
461 BUG_ON(ret);
462#endif
463}
464
465/**
466 * Reserve memory for ION and calculate amount of reusable memory for fmem.
467 * We only reserve memory for heaps that are not reusable. However, we only
468 * support one reusable heap at the moment so we ignore the reusable flag for
469 * other than the first heap with reusable flag set. Also handle special case
470 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
471 * at a higher address than FW in addition to not more than 256MB away from the
472 * base address of the firmware. This means that if MM is reusable the other
473 * two heaps must be allocated in the same region as FW. This is handled by the
474 * mem_is_fmem flag in the platform data. In addition the MM heap must be
475 * adjacent to the FW heap for content protection purposes.
476 */
Stephen Boyd668d7652012-04-25 11:31:01 -0700477static void __init reserve_ion_memory(void)
Olav Haugan7c6aa742012-01-16 16:47:37 -0800478{
479#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Larry Bassel67b921d2012-04-06 10:23:27 -0700480 unsigned int i;
Laura Abbott0ae40a02012-08-10 10:49:33 -0700481 unsigned int ret;
Larry Bassel67b921d2012-04-06 10:23:27 -0700482 unsigned int fixed_size = 0;
483 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
484 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
Laura Abbott0ae40a02012-08-10 10:49:33 -0700485 unsigned long cma_alignment;
486 unsigned int low_use_cma = 0;
487 unsigned int middle_use_cma = 0;
488 unsigned int high_use_cma = 0;
489
Larry Bassel67b921d2012-04-06 10:23:27 -0700490
Larry Bassel67b921d2012-04-06 10:23:27 -0700491 fixed_low_size = 0;
492 fixed_middle_size = 0;
493 fixed_high_size = 0;
494
Laura Abbott0ae40a02012-08-10 10:49:33 -0700495 cma_alignment = PAGE_SIZE << max(MAX_ORDER, pageblock_order);
496
Larry Bassel67b921d2012-04-06 10:23:27 -0700497 for (i = 0; i < apq8064_ion_pdata.nr; ++i) {
Laura Abbott0ae40a02012-08-10 10:49:33 -0700498 struct ion_platform_heap *heap =
Larry Bassel67b921d2012-04-06 10:23:27 -0700499 &(apq8064_ion_pdata.heaps[i]);
Laura Abbott0ae40a02012-08-10 10:49:33 -0700500 int use_cma = 0;
501
Larry Bassel67b921d2012-04-06 10:23:27 -0700502
503 if (heap->extra_data) {
504 int fixed_position = NOT_FIXED;
Larry Bassel67b921d2012-04-06 10:23:27 -0700505
Mitchel Humpherysdc4d01d2012-09-13 10:53:22 -0700506 switch ((int)heap->type) {
Larry Bassel67b921d2012-04-06 10:23:27 -0700507 case ION_HEAP_TYPE_CP:
Laura Abbott0ae40a02012-08-10 10:49:33 -0700508 if (((struct ion_cp_heap_pdata *)
509 heap->extra_data)->is_cma) {
510 heap->size = ALIGN(heap->size,
511 cma_alignment);
512 use_cma = 1;
513 }
Larry Bassel67b921d2012-04-06 10:23:27 -0700514 fixed_position = ((struct ion_cp_heap_pdata *)
515 heap->extra_data)->fixed_position;
516 break;
Laura Abbott0ae40a02012-08-10 10:49:33 -0700517 case ION_HEAP_TYPE_DMA:
518 use_cma = 1;
519 /* Purposely fall through here */
Larry Bassel67b921d2012-04-06 10:23:27 -0700520 case ION_HEAP_TYPE_CARVEOUT:
Larry Bassel67b921d2012-04-06 10:23:27 -0700521 fixed_position = ((struct ion_co_heap_pdata *)
522 heap->extra_data)->fixed_position;
523 break;
524 default:
525 break;
526 }
527
528 if (fixed_position != NOT_FIXED)
529 fixed_size += heap->size;
530 else
531 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
532
Laura Abbott0ae40a02012-08-10 10:49:33 -0700533 if (fixed_position == FIXED_LOW) {
Larry Bassel67b921d2012-04-06 10:23:27 -0700534 fixed_low_size += heap->size;
Laura Abbott0ae40a02012-08-10 10:49:33 -0700535 low_use_cma = use_cma;
536 } else if (fixed_position == FIXED_MIDDLE) {
Larry Bassel67b921d2012-04-06 10:23:27 -0700537 fixed_middle_size += heap->size;
Laura Abbott0ae40a02012-08-10 10:49:33 -0700538 middle_use_cma = use_cma;
539 } else if (fixed_position == FIXED_HIGH) {
Larry Bassel67b921d2012-04-06 10:23:27 -0700540 fixed_high_size += heap->size;
Laura Abbott0ae40a02012-08-10 10:49:33 -0700541 high_use_cma = use_cma;
542 } else if (use_cma) {
543 /*
544 * Heaps that use CMA but are not part of the
545 * fixed set. Create wherever.
546 */
547 dma_declare_contiguous(
548 heap->priv,
549 heap->size,
550 0,
551 0xb0000000);
552
553 }
Larry Bassel67b921d2012-04-06 10:23:27 -0700554 }
555 }
556
557 if (!fixed_size)
558 return;
559
Laura Abbott0ae40a02012-08-10 10:49:33 -0700560 /*
561 * Given the setup for the fixed area, we can't round up all sizes.
562 * Some sizes must be set up exactly and aligned correctly. Incorrect
563 * alignments are considered a configuration issue
Larry Bassel67b921d2012-04-06 10:23:27 -0700564 */
Larry Bassel67b921d2012-04-06 10:23:27 -0700565
566 fixed_low_start = APQ8064_FIXED_AREA_START;
Laura Abbott0ae40a02012-08-10 10:49:33 -0700567 if (low_use_cma) {
568 BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, cma_alignment));
569 BUG_ON(!IS_ALIGNED(fixed_low_start, cma_alignment));
570 } else {
571 BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, SECTION_SIZE));
572 ret = memblock_remove(fixed_low_start,
573 fixed_low_size + HOLE_SIZE);
574 BUG_ON(ret);
575 }
576
Hanumant Singheadb7502012-05-15 18:14:04 -0700577 fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE;
Laura Abbott0ae40a02012-08-10 10:49:33 -0700578 if (middle_use_cma) {
579 BUG_ON(!IS_ALIGNED(fixed_middle_start, cma_alignment));
580 BUG_ON(!IS_ALIGNED(fixed_middle_size, cma_alignment));
581 } else {
582 BUG_ON(!IS_ALIGNED(fixed_middle_size, SECTION_SIZE));
583 ret = memblock_remove(fixed_middle_start, fixed_middle_size);
584 BUG_ON(ret);
585 }
586
Larry Bassel67b921d2012-04-06 10:23:27 -0700587 fixed_high_start = fixed_middle_start + fixed_middle_size;
Laura Abbott0ae40a02012-08-10 10:49:33 -0700588 if (high_use_cma) {
589 fixed_high_size = ALIGN(fixed_high_size, cma_alignment);
590 BUG_ON(!IS_ALIGNED(fixed_high_start, cma_alignment));
591 } else {
592 /* This is the end of the fixed area so it's okay to round up */
593 fixed_high_size = ALIGN(fixed_high_size, SECTION_SIZE);
594 ret = memblock_remove(fixed_high_start, fixed_high_size);
595 BUG_ON(ret);
596 }
Larry Bassel67b921d2012-04-06 10:23:27 -0700597
598 for (i = 0; i < apq8064_ion_pdata.nr; ++i) {
599 struct ion_platform_heap *heap = &(apq8064_ion_pdata.heaps[i]);
600
601 if (heap->extra_data) {
602 int fixed_position = NOT_FIXED;
Steve Mucklef132c6c2012-06-06 18:30:57 -0700603 struct ion_cp_heap_pdata *pdata = NULL;
Larry Bassel67b921d2012-04-06 10:23:27 -0700604
Mitchel Humpherysdc4d01d2012-09-13 10:53:22 -0700605 switch ((int) heap->type) {
Larry Bassel67b921d2012-04-06 10:23:27 -0700606 case ION_HEAP_TYPE_CP:
Hanumant Singheadb7502012-05-15 18:14:04 -0700607 pdata =
608 (struct ion_cp_heap_pdata *)heap->extra_data;
609 fixed_position = pdata->fixed_position;
Larry Bassel67b921d2012-04-06 10:23:27 -0700610 break;
611 case ION_HEAP_TYPE_CARVEOUT:
Laura Abbott0ae40a02012-08-10 10:49:33 -0700612 case ION_HEAP_TYPE_DMA:
Larry Bassel67b921d2012-04-06 10:23:27 -0700613 fixed_position = ((struct ion_co_heap_pdata *)
614 heap->extra_data)->fixed_position;
615 break;
616 default:
617 break;
618 }
619
620 switch (fixed_position) {
621 case FIXED_LOW:
622 heap->base = fixed_low_start;
623 break;
624 case FIXED_MIDDLE:
625 heap->base = fixed_middle_start;
Laura Abbott0ae40a02012-08-10 10:49:33 -0700626 if (middle_use_cma) {
627 ret = dma_declare_contiguous(
628 heap->priv,
629 heap->size,
630 fixed_middle_start,
631 0xa0000000);
632 WARN_ON(ret);
633 }
Hanumant Singheadb7502012-05-15 18:14:04 -0700634 pdata->secure_base = fixed_middle_start
635 - HOLE_SIZE;
636 pdata->secure_size = HOLE_SIZE + heap->size;
Larry Bassel67b921d2012-04-06 10:23:27 -0700637 break;
638 case FIXED_HIGH:
639 heap->base = fixed_high_start;
640 break;
641 default:
642 break;
643 }
644 }
645 }
Olav Haugan7c6aa742012-01-16 16:47:37 -0800646#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700647}
648
Huaibin Yang4a084e32011-12-15 15:25:52 -0800649static void __init reserve_mdp_memory(void)
650{
651 apq8064_mdp_writeback(apq8064_reserve_table);
652}
653
Laura Abbott93a4a352012-05-25 09:26:35 -0700654static void __init reserve_cache_dump_memory(void)
655{
656#ifdef CONFIG_MSM_CACHE_DUMP
657 unsigned int total;
658
659 total = apq8064_cache_dump_pdata.l1_size +
660 apq8064_cache_dump_pdata.l2_size;
661 apq8064_reserve_table[MEMTYPE_EBI1].size += total;
662#endif
663}
664
Abhijeet Dharmapurikar3edb5de2012-09-13 11:02:03 -0700665static void __init reserve_mpdcvs_memory(void)
666{
667 apq8064_reserve_table[MEMTYPE_EBI1].size += SZ_32K;
668}
669
Kevin Chan13be4e22011-10-20 11:30:32 -0700670static void __init apq8064_calculate_reserve_sizes(void)
671{
672 size_pmem_devices();
673 reserve_pmem_memory();
Olav Haugan7c6aa742012-01-16 16:47:37 -0800674 reserve_ion_memory();
Huaibin Yang4a084e32011-12-15 15:25:52 -0800675 reserve_mdp_memory();
Laura Abbott350c8362012-02-28 14:46:52 -0800676 reserve_rtb_memory();
Laura Abbott93a4a352012-05-25 09:26:35 -0700677 reserve_cache_dump_memory();
Abhijeet Dharmapurikar3edb5de2012-09-13 11:02:03 -0700678 reserve_mpdcvs_memory();
Kevin Chan13be4e22011-10-20 11:30:32 -0700679}
680
681static struct reserve_info apq8064_reserve_info __initdata = {
682 .memtype_reserve_table = apq8064_reserve_table,
683 .calculate_reserve_sizes = apq8064_calculate_reserve_sizes,
Larry Bassel67b921d2012-04-06 10:23:27 -0700684 .reserve_fixed_area = apq8064_reserve_fixed_area,
Kevin Chan13be4e22011-10-20 11:30:32 -0700685 .paddr_to_memtype = apq8064_paddr_to_memtype,
686};
687
Aravind Venkateswaran8ac7f412012-03-16 17:57:30 -0700688static char prim_panel_name[PANEL_NAME_MAX_LEN];
689static char ext_panel_name[PANEL_NAME_MAX_LEN];
Ajay Singh Parmar6b82d2b2012-07-19 17:23:26 +0530690
691static int ext_resolution;
692
Aravind Venkateswaran8ac7f412012-03-16 17:57:30 -0700693static int __init prim_display_setup(char *param)
694{
695 if (strnlen(param, PANEL_NAME_MAX_LEN))
696 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
697 return 0;
698}
699early_param("prim_display", prim_display_setup);
700
701static int __init ext_display_setup(char *param)
702{
703 if (strnlen(param, PANEL_NAME_MAX_LEN))
704 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
705 return 0;
706}
707early_param("ext_display", ext_display_setup);
708
Ajay Singh Parmar6b82d2b2012-07-19 17:23:26 +0530709static int __init hdmi_resulution_setup(char *param)
710{
711 int ret;
712 ret = kstrtoint(param, 10, &ext_resolution);
713 return ret;
714}
715early_param("ext_resolution", hdmi_resulution_setup);
716
Kevin Chan13be4e22011-10-20 11:30:32 -0700717static void __init apq8064_reserve(void)
718{
Ajay Singh Parmar6b82d2b2012-07-19 17:23:26 +0530719 apq8064_set_display_params(prim_panel_name, ext_panel_name,
720 ext_resolution);
Kevin Chan13be4e22011-10-20 11:30:32 -0700721 msm_reserve();
722}
723
Laura Abbott6988cef2012-03-15 14:27:13 -0700724static void __init apq8064_early_reserve(void)
725{
726 reserve_info = &apq8064_reserve_info;
Laura Abbott6988cef2012-03-15 14:27:13 -0700727}
Hemant Kumara945b472012-01-25 15:08:06 -0800728#ifdef CONFIG_USB_EHCI_MSM_HSIC
Hemant Kumare6275972012-02-29 20:06:21 -0800729/* Bandwidth requests (zero) if no vote placed */
730static struct msm_bus_vectors hsic_init_vectors[] = {
731 {
732 .src = MSM_BUS_MASTER_SPS,
Hemant Kumare6275972012-02-29 20:06:21 -0800733 .dst = MSM_BUS_SLAVE_SPS,
734 .ab = 0,
735 .ib = 0,
736 },
737};
738
739/* Bus bandwidth requests in Bytes/sec */
740static struct msm_bus_vectors hsic_max_vectors[] = {
741 {
742 .src = MSM_BUS_MASTER_SPS,
Hemant Kumare6275972012-02-29 20:06:21 -0800743 .dst = MSM_BUS_SLAVE_SPS,
744 .ab = 0,
Hemant Kumar266d9d52012-10-17 13:48:10 -0700745 .ib = 256000000, /*vote for 32Mhz dfab clk rate*/
Hemant Kumare6275972012-02-29 20:06:21 -0800746 },
747};
748
749static struct msm_bus_paths hsic_bus_scale_usecases[] = {
750 {
751 ARRAY_SIZE(hsic_init_vectors),
752 hsic_init_vectors,
753 },
754 {
755 ARRAY_SIZE(hsic_max_vectors),
756 hsic_max_vectors,
757 },
758};
759
760static struct msm_bus_scale_pdata hsic_bus_scale_pdata = {
761 hsic_bus_scale_usecases,
762 ARRAY_SIZE(hsic_bus_scale_usecases),
763 .name = "hsic",
764};
765
Hemant Kumara945b472012-01-25 15:08:06 -0800766static struct msm_hsic_host_platform_data msm_hsic_pdata = {
Hemant Kumare6275972012-02-29 20:06:21 -0800767 .strobe = 88,
768 .data = 89,
769 .bus_scale_table = &hsic_bus_scale_pdata,
Hemant Kumara945b472012-01-25 15:08:06 -0800770};
771#else
772static struct msm_hsic_host_platform_data msm_hsic_pdata;
773#endif
774
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800775#define PID_MAGIC_ID 0x71432909
776#define SERIAL_NUM_MAGIC_ID 0x61945374
777#define SERIAL_NUMBER_LENGTH 127
778#define DLOAD_USB_BASE_ADD 0x2A03F0C8
779
780struct magic_num_struct {
781 uint32_t pid;
782 uint32_t serial_num;
783};
784
785struct dload_struct {
786 uint32_t reserved1;
787 uint32_t reserved2;
788 uint32_t reserved3;
789 uint16_t reserved4;
790 uint16_t pid;
791 char serial_number[SERIAL_NUMBER_LENGTH];
792 uint16_t reserved5;
793 struct magic_num_struct magic_struct;
794};
795
796static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
797{
798 struct dload_struct __iomem *dload = 0;
799
800 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
801 if (!dload) {
802 pr_err("%s: cannot remap I/O memory region: %08x\n",
803 __func__, DLOAD_USB_BASE_ADD);
804 return -ENXIO;
805 }
806
807 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
808 __func__, dload, pid, snum);
809 /* update pid */
810 dload->magic_struct.pid = PID_MAGIC_ID;
811 dload->pid = pid;
812
813 /* update serial number */
814 dload->magic_struct.serial_num = 0;
815 if (!snum) {
816 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
817 goto out;
818 }
819
820 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
821 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
822out:
823 iounmap(dload);
824 return 0;
825}
826
827static struct android_usb_platform_data android_usb_pdata = {
828 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
829};
830
Hemant Kumar4933b072011-10-17 23:43:11 -0700831static struct platform_device android_usb_device = {
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800832 .name = "android_usb",
833 .id = -1,
834 .dev = {
835 .platform_data = &android_usb_pdata,
836 },
Hemant Kumar4933b072011-10-17 23:43:11 -0700837};
838
Hemant Kumar7620eed2012-02-26 09:08:43 -0800839/* Bandwidth requests (zero) if no vote placed */
840static struct msm_bus_vectors usb_init_vectors[] = {
841 {
842 .src = MSM_BUS_MASTER_SPS,
843 .dst = MSM_BUS_SLAVE_EBI_CH0,
844 .ab = 0,
845 .ib = 0,
846 },
847};
848
849/* Bus bandwidth requests in Bytes/sec */
850static struct msm_bus_vectors usb_max_vectors[] = {
851 {
852 .src = MSM_BUS_MASTER_SPS,
853 .dst = MSM_BUS_SLAVE_EBI_CH0,
854 .ab = 60000000, /* At least 480Mbps on bus. */
855 .ib = 960000000, /* MAX bursts rate */
856 },
857};
858
859static struct msm_bus_paths usb_bus_scale_usecases[] = {
860 {
861 ARRAY_SIZE(usb_init_vectors),
862 usb_init_vectors,
863 },
864 {
865 ARRAY_SIZE(usb_max_vectors),
866 usb_max_vectors,
867 },
868};
869
870static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
871 usb_bus_scale_usecases,
872 ARRAY_SIZE(usb_bus_scale_usecases),
873 .name = "usb",
874};
875
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700876static int phy_init_seq[] = {
877 0x38, 0x81, /* update DC voltage level */
878 0x24, 0x82, /* set pre-emphasis and rise/fall time */
879 -1
880};
881
Vijayavardhan Vennapusa4fa13692012-08-02 14:35:03 +0530882#define PMIC_GPIO_DP 27 /* PMIC GPIO for D+ change */
883#define PMIC_GPIO_DP_IRQ PM8921_GPIO_IRQ(PM8921_IRQ_BASE, PMIC_GPIO_DP)
Jack Pham87f202f2012-08-06 00:24:22 -0700884#define MSM_MPM_PIN_USB1_OTGSESSVLD 40
885
Hemant Kumar4933b072011-10-17 23:43:11 -0700886static struct msm_otg_platform_data msm_otg_pdata = {
Hemant Kumard86c4882012-01-24 19:39:37 -0800887 .mode = USB_OTG,
888 .otg_control = OTG_PMIC_CONTROL,
Hemant Kumar4933b072011-10-17 23:43:11 -0700889 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Hemant Kumard86c4882012-01-24 19:39:37 -0800890 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
891 .power_budget = 750,
Hemant Kumar7620eed2012-02-26 09:08:43 -0800892 .bus_scale_table = &usb_bus_scale_pdata,
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700893 .phy_init_seq = phy_init_seq,
Jack Pham87f202f2012-08-06 00:24:22 -0700894 .mpm_otgsessvld_int = MSM_MPM_PIN_USB1_OTGSESSVLD,
Hemant Kumar4933b072011-10-17 23:43:11 -0700895};
896
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800897static struct msm_usb_host_platform_data msm_ehci_host_pdata3 = {
Manu Gautam91223e02011-11-08 15:27:22 +0530898 .power_budget = 500,
899};
900
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800901#ifdef CONFIG_USB_EHCI_MSM_HOST4
902static struct msm_usb_host_platform_data msm_ehci_host_pdata4;
903#endif
904
Manu Gautam91223e02011-11-08 15:27:22 +0530905static void __init apq8064_ehci_host_init(void)
906{
Chiranjeevi Velempatib822fa32012-05-23 22:05:59 +0530907 if (machine_is_apq8064_liquid() || machine_is_mpq8064_cdp() ||
908 machine_is_mpq8064_hrd() || machine_is_mpq8064_dtv()) {
909 if (machine_is_apq8064_liquid())
910 msm_ehci_host_pdata3.dock_connect_irq =
911 PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9);
Vijayavardhan Vennapusa4fa13692012-08-02 14:35:03 +0530912 else
913 msm_ehci_host_pdata3.pmic_gpio_dp_irq =
914 PMIC_GPIO_DP_IRQ;
Hemant Kumar56925352012-02-13 16:59:52 -0800915
Manu Gautam91223e02011-11-08 15:27:22 +0530916 apq8064_device_ehci_host3.dev.platform_data =
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800917 &msm_ehci_host_pdata3;
Manu Gautam91223e02011-11-08 15:27:22 +0530918 platform_device_register(&apq8064_device_ehci_host3);
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800919
920#ifdef CONFIG_USB_EHCI_MSM_HOST4
921 apq8064_device_ehci_host4.dev.platform_data =
922 &msm_ehci_host_pdata4;
923 platform_device_register(&apq8064_device_ehci_host4);
924#endif
Manu Gautam91223e02011-11-08 15:27:22 +0530925 }
926}
927
David Keitel2f613d92012-02-15 11:29:16 -0800928static struct smb349_platform_data smb349_data __initdata = {
929 .en_n_gpio = PM8921_GPIO_PM_TO_SYS(37),
930 .chg_susp_gpio = PM8921_GPIO_PM_TO_SYS(30),
931 .chg_current_ma = 2200,
932};
933
934static struct i2c_board_info smb349_charger_i2c_info[] __initdata = {
935 {
936 I2C_BOARD_INFO(SMB349_NAME, 0x1B),
937 .platform_data = &smb349_data,
938 },
939};
940
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -0800941struct sx150x_platform_data apq8064_sx150x_data[] = {
942 [SX150X_EPM] = {
943 .gpio_base = GPIO_EPM_EXPANDER_BASE,
944 .oscio_is_gpo = false,
945 .io_pullup_ena = 0x0,
946 .io_pulldn_ena = 0x0,
947 .io_open_drain_ena = 0x0,
948 .io_polarity = 0,
949 .irq_summary = -1,
950 },
951};
952
953static struct epm_chan_properties ads_adc_channel_data[] = {
Yan Hec942e402012-08-31 11:14:58 -0700954 {10, 100}, {1000, 1}, {10, 100}, {1000, 1},
955 {10, 100}, {1000, 1}, {10, 100}, {1000, 1},
956 {10, 100}, {20, 100}, {500, 100}, {5, 100},
957 {1000, 1}, {200, 100}, {50, 100}, {10, 100},
958 {510, 100}, {50, 100}, {20, 100}, {100, 100},
959 {510, 100}, {20, 100}, {50, 100}, {200, 100},
960 {10, 100}, {20, 100}, {1000, 1}, {10, 100},
961 {200, 100}, {510, 100}, {1000, 100}, {200, 100},
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -0800962};
963
964static struct epm_adc_platform_data epm_adc_pdata = {
965 .channel = ads_adc_channel_data,
966 .bus_id = 0x0,
967 .epm_i2c_board_info = {
968 .type = "sx1509q",
969 .addr = 0x3e,
970 .platform_data = &apq8064_sx150x_data[SX150X_EPM],
971 },
972 .gpio_expander_base_addr = GPIO_EPM_EXPANDER_BASE,
973};
974
975static struct platform_device epm_adc_device = {
976 .name = "epm_adc",
977 .id = -1,
978 .dev = {
979 .platform_data = &epm_adc_pdata,
980 },
981};
982
983static void __init apq8064_epm_adc_init(void)
984{
985 epm_adc_pdata.num_channels = 32;
986 epm_adc_pdata.num_adc = 2;
987 epm_adc_pdata.chan_per_adc = 16;
988 epm_adc_pdata.chan_per_mux = 8;
989};
990
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800991/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
992 * 4 micbiases are used to power various analog and digital
993 * microphones operating at 1800 mV. Technically, all micbiases
994 * can source from single cfilter since all microphones operate
995 * at the same voltage level. The arrangement below is to make
996 * sure all cfilters are exercised. LDO_H regulator ouput level
997 * does not need to be as high as 2.85V. It is choosen for
998 * microphone sensitivity purpose.
999 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301000static struct wcd9xxx_pdata apq8064_tabla_platform_data = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001001 .slimbus_slave_device = {
1002 .name = "tabla-slave",
1003 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
1004 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001005 .irq = MSM_GPIO_TO_INT(42),
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001006 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301007 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001008 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
1009 .micbias = {
1010 .ldoh_v = TABLA_LDOH_2P85_V,
1011 .cfilt1_mv = 1800,
Bhalchandra Gajare975c53a2012-08-10 12:16:49 -07001012 .cfilt2_mv = 2700,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001013 .cfilt3_mv = 1800,
1014 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
1015 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
1016 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
1017 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301018 },
1019 .regulator = {
1020 {
1021 .name = "CDC_VDD_CP",
1022 .min_uV = 1800000,
1023 .max_uV = 1800000,
1024 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
1025 },
1026 {
1027 .name = "CDC_VDDA_RX",
1028 .min_uV = 1800000,
1029 .max_uV = 1800000,
1030 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
1031 },
1032 {
1033 .name = "CDC_VDDA_TX",
1034 .min_uV = 1800000,
1035 .max_uV = 1800000,
1036 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
1037 },
1038 {
1039 .name = "VDDIO_CDC",
1040 .min_uV = 1800000,
1041 .max_uV = 1800000,
1042 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1043 },
1044 {
1045 .name = "VDDD_CDC_D",
1046 .min_uV = 1225000,
David Collins62debe82012-06-06 17:01:03 -07001047 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301048 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1049 },
1050 {
1051 .name = "CDC_VDDA_A_1P2V",
1052 .min_uV = 1225000,
David Collins62debe82012-06-06 17:01:03 -07001053 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301054 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1055 },
1056 },
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001057};
1058
1059static struct slim_device apq8064_slim_tabla = {
1060 .name = "tabla-slim",
1061 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
1062 .dev = {
1063 .platform_data = &apq8064_tabla_platform_data,
1064 },
1065};
1066
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301067static struct wcd9xxx_pdata apq8064_tabla20_platform_data = {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001068 .slimbus_slave_device = {
1069 .name = "tabla-slave",
1070 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
1071 },
1072 .irq = MSM_GPIO_TO_INT(42),
1073 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301074 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001075 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
1076 .micbias = {
1077 .ldoh_v = TABLA_LDOH_2P85_V,
1078 .cfilt1_mv = 1800,
Bhalchandra Gajare975c53a2012-08-10 12:16:49 -07001079 .cfilt2_mv = 2700,
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001080 .cfilt3_mv = 1800,
1081 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
1082 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
1083 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
1084 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301085 },
1086 .regulator = {
1087 {
1088 .name = "CDC_VDD_CP",
1089 .min_uV = 1800000,
1090 .max_uV = 1800000,
1091 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
1092 },
1093 {
1094 .name = "CDC_VDDA_RX",
1095 .min_uV = 1800000,
1096 .max_uV = 1800000,
1097 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
1098 },
1099 {
1100 .name = "CDC_VDDA_TX",
1101 .min_uV = 1800000,
1102 .max_uV = 1800000,
1103 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
1104 },
1105 {
1106 .name = "VDDIO_CDC",
1107 .min_uV = 1800000,
1108 .max_uV = 1800000,
1109 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1110 },
1111 {
1112 .name = "VDDD_CDC_D",
1113 .min_uV = 1225000,
David Collins62debe82012-06-06 17:01:03 -07001114 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301115 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1116 },
1117 {
1118 .name = "CDC_VDDA_A_1P2V",
1119 .min_uV = 1225000,
David Collins62debe82012-06-06 17:01:03 -07001120 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301121 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1122 },
1123 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001124};
1125
1126static struct slim_device apq8064_slim_tabla20 = {
1127 .name = "tabla2x-slim",
1128 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
1129 .dev = {
1130 .platform_data = &apq8064_tabla20_platform_data,
1131 },
1132};
1133
Santosh Mardi695be0d2012-04-10 23:21:12 +05301134/* enable the level shifter for cs8427 to make sure the I2C
1135 * clock is running at 100KHz and voltage levels are at 3.3
1136 * and 5 volts
1137 */
1138static int enable_100KHz_ls(int enable)
1139{
1140 int ret = 0;
1141 if (enable) {
1142 ret = gpio_request(SX150X_GPIO(1, 10),
1143 "cs8427_100KHZ_ENABLE");
1144 if (ret) {
1145 pr_err("%s: Failed to request gpio %d\n", __func__,
1146 SX150X_GPIO(1, 10));
1147 return ret;
1148 }
1149 gpio_direction_output(SX150X_GPIO(1, 10), 1);
Santosh Mardid706fcf2012-08-31 19:26:54 +05301150 } else {
1151 gpio_direction_output(SX150X_GPIO(1, 10), 0);
Santosh Mardi695be0d2012-04-10 23:21:12 +05301152 gpio_free(SX150X_GPIO(1, 10));
Santosh Mardid706fcf2012-08-31 19:26:54 +05301153 }
Santosh Mardi695be0d2012-04-10 23:21:12 +05301154 return ret;
1155}
1156
Santosh Mardieff9a742012-04-09 23:23:39 +05301157static struct cs8427_platform_data cs8427_i2c_platform_data = {
1158 .irq = SX150X_GPIO(1, 4),
1159 .reset_gpio = SX150X_GPIO(1, 6),
Santosh Mardi695be0d2012-04-10 23:21:12 +05301160 .enable = enable_100KHz_ls,
Santosh Mardieff9a742012-04-09 23:23:39 +05301161};
1162
1163static struct i2c_board_info cs8427_device_info[] __initdata = {
1164 {
1165 I2C_BOARD_INFO("cs8427", CS8427_ADDR4),
1166 .platform_data = &cs8427_i2c_platform_data,
1167 },
1168};
1169
Amy Maloche70090f992012-02-16 16:35:26 -08001170#define HAP_SHIFT_LVL_OE_GPIO PM8921_MPP_PM_TO_SYS(8)
1171#define ISA1200_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1172#define ISA1200_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
David Collins6f7c3472012-08-22 13:18:06 -07001173#define ISA1200_HAP_CLK_PM8921 PM8921_GPIO_PM_TO_SYS(44)
1174#define ISA1200_HAP_CLK_PM8917 PM8921_GPIO_PM_TO_SYS(38)
Amy Maloche70090f992012-02-16 16:35:26 -08001175
Mohan Pallaka2d877602012-05-11 13:07:30 +05301176static int isa1200_clk_enable(bool on)
Amy Maloche70090f992012-02-16 16:35:26 -08001177{
David Collins6f7c3472012-08-22 13:18:06 -07001178 unsigned int gpio = ISA1200_HAP_CLK_PM8921;
Amy Maloche8f973892012-03-26 14:53:13 -07001179 int rc = 0;
1180
David Collins6f7c3472012-08-22 13:18:06 -07001181 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
1182 gpio = ISA1200_HAP_CLK_PM8917;
1183
1184 gpio_set_value_cansleep(gpio, on);
Amy Maloche70090f992012-02-16 16:35:26 -08001185
Mohan Pallaka2d877602012-05-11 13:07:30 +05301186 if (on) {
Amy Maloche8f973892012-03-26 14:53:13 -07001187 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_1, true);
Mohan Pallaka2d877602012-05-11 13:07:30 +05301188 if (rc) {
1189 pr_err("%s: unable to write aux clock register(%d)\n",
1190 __func__, rc);
1191 goto err_gpio_dis;
1192 }
1193 } else {
Amy Maloche8f973892012-03-26 14:53:13 -07001194 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_NONE, true);
Mohan Pallaka2d877602012-05-11 13:07:30 +05301195 if (rc)
1196 pr_err("%s: unable to write aux clock register(%d)\n",
1197 __func__, rc);
Amy Maloche8f973892012-03-26 14:53:13 -07001198 }
1199
1200 return rc;
Mohan Pallaka2d877602012-05-11 13:07:30 +05301201
1202err_gpio_dis:
David Collins6f7c3472012-08-22 13:18:06 -07001203 gpio_set_value_cansleep(gpio, !on);
Mohan Pallaka2d877602012-05-11 13:07:30 +05301204 return rc;
Amy Maloche70090f992012-02-16 16:35:26 -08001205}
1206
1207static int isa1200_dev_setup(bool enable)
1208{
David Collins6f7c3472012-08-22 13:18:06 -07001209 unsigned int gpio = ISA1200_HAP_CLK_PM8921;
Amy Maloche70090f992012-02-16 16:35:26 -08001210 int rc = 0;
1211
David Collins6f7c3472012-08-22 13:18:06 -07001212 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
1213 gpio = ISA1200_HAP_CLK_PM8917;
1214
Amy Maloche70090f992012-02-16 16:35:26 -08001215 if (!enable)
1216 goto free_gpio;
1217
David Collins6f7c3472012-08-22 13:18:06 -07001218 rc = gpio_request(gpio, "haptics_clk");
Amy Maloche70090f992012-02-16 16:35:26 -08001219 if (rc) {
1220 pr_err("%s: unable to request gpio %d config(%d)\n",
David Collins6f7c3472012-08-22 13:18:06 -07001221 __func__, gpio, rc);
Amy Maloche70090f992012-02-16 16:35:26 -08001222 return rc;
1223 }
1224
David Collins6f7c3472012-08-22 13:18:06 -07001225 rc = gpio_direction_output(gpio, 0);
Amy Maloche70090f992012-02-16 16:35:26 -08001226 if (rc) {
1227 pr_err("%s: unable to set direction\n", __func__);
1228 goto free_gpio;
1229 }
1230
1231 return 0;
1232
1233free_gpio:
David Collins6f7c3472012-08-22 13:18:06 -07001234 gpio_free(gpio);
Amy Maloche70090f992012-02-16 16:35:26 -08001235 return rc;
1236}
1237
1238static struct isa1200_regulator isa1200_reg_data[] = {
1239 {
1240 .name = "vddp",
1241 .min_uV = ISA_I2C_VTG_MIN_UV,
1242 .max_uV = ISA_I2C_VTG_MAX_UV,
1243 .load_uA = ISA_I2C_CURR_UA,
1244 },
1245};
1246
1247static struct isa1200_platform_data isa1200_1_pdata = {
1248 .name = "vibrator",
1249 .dev_setup = isa1200_dev_setup,
Mohan Pallaka2d877602012-05-11 13:07:30 +05301250 .clk_enable = isa1200_clk_enable,
Mohan Pallaka32f20a72012-06-14 14:41:11 +05301251 .need_pwm_clk = true,
Amy Maloche70090f992012-02-16 16:35:26 -08001252 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
1253 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
1254 .max_timeout = 15000,
1255 .mode_ctrl = PWM_GEN_MODE,
1256 .pwm_fd = {
1257 .pwm_div = 256,
1258 },
1259 .is_erm = false,
1260 .smart_en = true,
1261 .ext_clk_en = true,
1262 .chip_en = 1,
1263 .regulator_info = isa1200_reg_data,
1264 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1265};
1266
1267static struct i2c_board_info isa1200_board_info[] __initdata = {
1268 {
1269 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1270 .platform_data = &isa1200_1_pdata,
1271 },
1272};
Jing Lin21ed4de2012-02-05 15:53:28 -08001273/* configuration data for mxt1386e using V2.1 firmware */
1274static const u8 mxt1386e_config_data_v2_1[] = {
1275 /* T6 Object */
1276 0, 0, 0, 0, 0, 0,
1277 /* T38 Object */
Jing Line4c47042012-08-31 10:54:44 -07001278 14, 3, 0, 5, 7, 12, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001279 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1280 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1281 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1282 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1283 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1284 0, 0, 0, 0,
1285 /* T7 Object */
Jing Line4c47042012-08-31 10:54:44 -07001286 32, 10, 50,
Jing Lin21ed4de2012-02-05 15:53:28 -08001287 /* T8 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001288 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001289 /* T9 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001290 139, 0, 0, 26, 42, 0, 32, 80, 2, 5,
Jing Line4c47042012-08-31 10:54:44 -07001291 0, 5, 5, 79, 10, 30, 10, 10, 255, 2,
Jing Linf1208fd2012-02-23 11:15:42 -08001292 85, 5, 0, 5, 9, 5, 12, 35, 70, 40,
1293 20, 5, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001294 /* T18 Object */
1295 0, 0,
1296 /* T24 Object */
1297 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1298 0, 0, 0, 0, 0, 0, 0, 0, 0,
1299 /* T25 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001300 1, 0, 60, 115, 156, 99,
Jing Lin21ed4de2012-02-05 15:53:28 -08001301 /* T27 Object */
1302 0, 0, 0, 0, 0, 0, 0,
1303 /* T40 Object */
1304 0, 0, 0, 0, 0,
1305 /* T42 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001306 0, 0, 255, 0, 255, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001307 /* T43 Object */
1308 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
1309 16,
1310 /* T46 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001311 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001312 /* T47 Object */
1313 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
1314 /* T48 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001315 1, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001316 32, 40, 0, 10, 10, 0, 0, 100, 10, 90,
1317 0, 0, 0, 0, 0, 0, 0, 10, 1, 10,
1318 52, 10, 12, 0, 33, 0, 1, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001319 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1320 0, 0, 0, 0,
1321 /* T56 Object */
1322 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1323 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1324 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1325 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001326 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1327 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001328};
1329
1330#define MXT_TS_GPIO_IRQ 6
1331#define MXT_TS_PWR_EN_GPIO PM8921_GPIO_PM_TO_SYS(23)
1332#define MXT_TS_RESET_GPIO 33
1333
1334static struct mxt_config_info mxt_config_array[] = {
1335 {
1336 .config = mxt1386e_config_data_v2_1,
1337 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1338 .family_id = 0xA0,
1339 .variant_id = 0x7,
1340 .version = 0x21,
1341 .build = 0xAA,
Jing Linef4aa9b2012-03-26 12:01:41 -07001342 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
1343 .fw_name = "atmel_8064_liquid_v2_2_AA.hex",
1344 },
1345 {
1346 /* The config data for V2.2.AA is the same as for V2.1.AA */
1347 .config = mxt1386e_config_data_v2_1,
1348 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1349 .family_id = 0xA0,
1350 .variant_id = 0x7,
1351 .version = 0x22,
1352 .build = 0xAA,
1353 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin21ed4de2012-02-05 15:53:28 -08001354 },
1355};
1356
1357static struct mxt_platform_data mxt_platform_data = {
1358 .config_array = mxt_config_array,
1359 .config_array_size = ARRAY_SIZE(mxt_config_array),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08001360 .panel_minx = 0,
1361 .panel_maxx = 1365,
1362 .panel_miny = 0,
1363 .panel_maxy = 767,
1364 .disp_minx = 0,
1365 .disp_maxx = 1365,
1366 .disp_miny = 0,
1367 .disp_maxy = 767,
Anirudh Ghayal39dbe3f2012-04-13 15:43:16 +05301368 .irqflags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
Jing Lin21ed4de2012-02-05 15:53:28 -08001369 .i2c_pull_up = true,
1370 .reset_gpio = MXT_TS_RESET_GPIO,
1371 .irq_gpio = MXT_TS_GPIO_IRQ,
1372};
1373
1374static struct i2c_board_info mxt_device_info[] __initdata = {
1375 {
1376 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
1377 .platform_data = &mxt_platform_data,
1378 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1379 },
1380};
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001381#define CYTTSP_TS_GPIO_IRQ 6
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001382#define CYTTSP_TS_GPIO_SLEEP 33
Amy Maloche609bb5e2012-08-03 09:41:42 -07001383#define CYTTSP_TS_GPIO_SLEEP_ALT 12
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001384
1385static ssize_t tma340_vkeys_show(struct kobject *kobj,
1386 struct kobj_attribute *attr, char *buf)
1387{
1388 return snprintf(buf, 200,
1389 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1390 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1391 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1392 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1393 "\n");
1394}
1395
1396static struct kobj_attribute tma340_vkeys_attr = {
1397 .attr = {
1398 .mode = S_IRUGO,
1399 },
1400 .show = &tma340_vkeys_show,
1401};
1402
1403static struct attribute *tma340_properties_attrs[] = {
1404 &tma340_vkeys_attr.attr,
1405 NULL
1406};
1407
1408static struct attribute_group tma340_properties_attr_group = {
1409 .attrs = tma340_properties_attrs,
1410};
1411
1412static int cyttsp_platform_init(struct i2c_client *client)
1413{
1414 int rc = 0;
1415 static struct kobject *tma340_properties_kobj;
1416
1417 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1418 tma340_properties_kobj = kobject_create_and_add("board_properties",
1419 NULL);
1420 if (tma340_properties_kobj)
1421 rc = sysfs_create_group(tma340_properties_kobj,
1422 &tma340_properties_attr_group);
1423 if (!tma340_properties_kobj || rc)
1424 pr_err("%s: failed to create board_properties\n",
1425 __func__);
1426
1427 return 0;
1428}
1429
1430static struct cyttsp_regulator cyttsp_regulator_data[] = {
1431 {
1432 .name = "vdd",
1433 .min_uV = CY_TMA300_VTG_MIN_UV,
1434 .max_uV = CY_TMA300_VTG_MAX_UV,
1435 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1436 .lpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1437 },
1438 {
1439 .name = "vcc_i2c",
1440 .min_uV = CY_I2C_VTG_MIN_UV,
1441 .max_uV = CY_I2C_VTG_MAX_UV,
1442 .hpm_load_uA = CY_I2C_CURR_UA,
1443 .lpm_load_uA = CY_I2C_CURR_UA,
1444 },
1445};
1446
1447static struct cyttsp_platform_data cyttsp_pdata = {
1448 .panel_maxx = 634,
1449 .panel_maxy = 1166,
Amy Maloche684fcda2012-12-05 14:28:53 -08001450 .disp_minx = 18,
1451 .disp_maxx = 617,
1452 .disp_miny = 18,
1453 .disp_maxy = 1041,
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001454 .flags = 0x01,
1455 .gen = CY_GEN3,
1456 .use_st = CY_USE_ST,
1457 .use_mt = CY_USE_MT,
1458 .use_hndshk = CY_SEND_HNDSHK,
1459 .use_trk_id = CY_USE_TRACKING_ID,
1460 .use_sleep = CY_USE_DEEP_SLEEP_SEL,
1461 .use_gestures = CY_USE_GESTURES,
1462 .fw_fname = "cyttsp_8064_mtp.hex",
1463 /* change act_intrvl to customize the Active power state
1464 * scanning/processing refresh interval for Operating mode
1465 */
1466 .act_intrvl = CY_ACT_INTRVL_DFLT,
1467 /* change tch_tmout to customize the touch timeout for the
1468 * Active power state for Operating mode
1469 */
1470 .tch_tmout = CY_TCH_TMOUT_DFLT,
1471 /* change lp_intrvl to customize the Low Power power state
1472 * scanning/processing refresh interval for Operating mode
1473 */
1474 .lp_intrvl = CY_LP_INTRVL_DFLT,
1475 .sleep_gpio = CYTTSP_TS_GPIO_SLEEP,
Amy Maloche9ba3ffe2012-04-26 10:31:20 -07001476 .resout_gpio = -1,
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001477 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1478 .regulator_info = cyttsp_regulator_data,
1479 .num_regulators = ARRAY_SIZE(cyttsp_regulator_data),
1480 .init = cyttsp_platform_init,
1481 .correct_fw_ver = 17,
1482};
1483
1484static struct i2c_board_info cyttsp_info[] __initdata = {
1485 {
1486 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1487 .platform_data = &cyttsp_pdata,
1488 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1489 },
1490};
Jing Lin21ed4de2012-02-05 15:53:28 -08001491
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001492#define MSM_WCNSS_PHYS 0x03000000
1493#define MSM_WCNSS_SIZE 0x280000
1494
1495static struct resource resources_wcnss_wlan[] = {
1496 {
1497 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1498 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1499 .name = "wcnss_wlanrx_irq",
1500 .flags = IORESOURCE_IRQ,
1501 },
1502 {
1503 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1504 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1505 .name = "wcnss_wlantx_irq",
1506 .flags = IORESOURCE_IRQ,
1507 },
1508 {
1509 .start = MSM_WCNSS_PHYS,
1510 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1511 .name = "wcnss_mmio",
1512 .flags = IORESOURCE_MEM,
1513 },
1514 {
1515 .start = 64,
1516 .end = 68,
1517 .name = "wcnss_gpios_5wire",
1518 .flags = IORESOURCE_IO,
1519 },
1520};
1521
1522static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1523 .has_48mhz_xo = 1,
1524};
1525
1526static struct platform_device msm_device_wcnss_wlan = {
1527 .name = "wcnss_wlan",
1528 .id = 0,
1529 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1530 .resource = resources_wcnss_wlan,
1531 .dev = {.platform_data = &qcom_wcnss_pdata},
1532};
1533
Ankit Vermab7c26e62012-02-28 15:04:15 -08001534static struct platform_device msm_device_iris_fm __devinitdata = {
1535 .name = "iris_fm",
1536 .id = -1,
1537};
1538
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001539#ifdef CONFIG_QSEECOM
1540/* qseecom bus scaling */
1541static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
1542 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001543 .src = MSM_BUS_MASTER_ADM_PORT0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001544 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001545 .ab = 0,
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001546 .ib = 0,
1547 },
1548 {
1549 .src = MSM_BUS_MASTER_ADM_PORT1,
1550 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1551 .ab = 0,
1552 .ib = 0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001553 },
1554 {
1555 .src = MSM_BUS_MASTER_SPDM,
1556 .dst = MSM_BUS_SLAVE_SPDM,
1557 .ib = 0,
1558 .ab = 0,
1559 },
1560};
1561
1562static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
1563 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001564 .src = MSM_BUS_MASTER_ADM_PORT0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001565 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001566 .ab = 70000000UL,
1567 .ib = 70000000UL,
1568 },
1569 {
1570 .src = MSM_BUS_MASTER_ADM_PORT1,
1571 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1572 .ab = 2480000000UL,
1573 .ib = 2480000000UL,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001574 },
1575 {
1576 .src = MSM_BUS_MASTER_SPDM,
1577 .dst = MSM_BUS_SLAVE_SPDM,
1578 .ib = 0,
1579 .ab = 0,
1580 },
1581};
1582
1583static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1584 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001585 .src = MSM_BUS_MASTER_ADM_PORT0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001586 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001587 .ab = 0,
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001588 .ib = 0,
1589 },
1590 {
1591 .src = MSM_BUS_MASTER_ADM_PORT1,
1592 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1593 .ab = 0,
1594 .ib = 0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001595 },
1596 {
1597 .src = MSM_BUS_MASTER_SPDM,
1598 .dst = MSM_BUS_SLAVE_SPDM,
1599 .ib = (64 * 8) * 1000000UL,
1600 .ab = (64 * 8) * 100000UL,
1601 },
1602};
1603
Ramesh Masavarapu4f091cb2012-10-03 10:18:06 -07001604static struct msm_bus_vectors qseecom_enable_dfab_sfpb_vectors[] = {
1605 {
1606 .src = MSM_BUS_MASTER_ADM_PORT0,
1607 .dst = MSM_BUS_SLAVE_EBI_CH0,
1608 .ab = 70000000UL,
1609 .ib = 70000000UL,
1610 },
1611 {
1612 .src = MSM_BUS_MASTER_ADM_PORT1,
1613 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1614 .ab = 2480000000UL,
1615 .ib = 2480000000UL,
1616 },
1617 {
1618 .src = MSM_BUS_MASTER_SPDM,
1619 .dst = MSM_BUS_SLAVE_SPDM,
1620 .ib = (64 * 8) * 1000000UL,
1621 .ab = (64 * 8) * 100000UL,
1622 },
1623};
1624
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001625static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1626 {
1627 ARRAY_SIZE(qseecom_clks_init_vectors),
1628 qseecom_clks_init_vectors,
1629 },
1630 {
1631 ARRAY_SIZE(qseecom_enable_dfab_vectors),
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001632 qseecom_enable_dfab_vectors,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001633 },
1634 {
1635 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1636 qseecom_enable_sfpb_vectors,
1637 },
Ramesh Masavarapu4f091cb2012-10-03 10:18:06 -07001638 {
1639 ARRAY_SIZE(qseecom_enable_dfab_sfpb_vectors),
1640 qseecom_enable_dfab_sfpb_vectors,
1641 },
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001642};
1643
1644static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1645 qseecom_hw_bus_scale_usecases,
1646 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1647 .name = "qsee",
1648};
1649
1650static struct platform_device qseecom_device = {
1651 .name = "qseecom",
1652 .id = 0,
1653 .dev = {
1654 .platform_data = &qseecom_bus_pdata,
1655 },
1656};
1657#endif
1658
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001659#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1660 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1661 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1662 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1663
1664#define QCE_SIZE 0x10000
1665#define QCE_0_BASE 0x11000000
1666
1667#define QCE_HW_KEY_SUPPORT 0
1668#define QCE_SHA_HMAC_SUPPORT 1
1669#define QCE_SHARE_CE_RESOURCE 3
1670#define QCE_CE_SHARED 0
1671
1672static struct resource qcrypto_resources[] = {
1673 [0] = {
1674 .start = QCE_0_BASE,
1675 .end = QCE_0_BASE + QCE_SIZE - 1,
1676 .flags = IORESOURCE_MEM,
1677 },
1678 [1] = {
1679 .name = "crypto_channels",
1680 .start = DMOV8064_CE_IN_CHAN,
1681 .end = DMOV8064_CE_OUT_CHAN,
1682 .flags = IORESOURCE_DMA,
1683 },
1684 [2] = {
1685 .name = "crypto_crci_in",
1686 .start = DMOV8064_CE_IN_CRCI,
1687 .end = DMOV8064_CE_IN_CRCI,
1688 .flags = IORESOURCE_DMA,
1689 },
1690 [3] = {
1691 .name = "crypto_crci_out",
1692 .start = DMOV8064_CE_OUT_CRCI,
1693 .end = DMOV8064_CE_OUT_CRCI,
1694 .flags = IORESOURCE_DMA,
1695 },
1696};
1697
1698static struct resource qcedev_resources[] = {
1699 [0] = {
1700 .start = QCE_0_BASE,
1701 .end = QCE_0_BASE + QCE_SIZE - 1,
1702 .flags = IORESOURCE_MEM,
1703 },
1704 [1] = {
1705 .name = "crypto_channels",
1706 .start = DMOV8064_CE_IN_CHAN,
1707 .end = DMOV8064_CE_OUT_CHAN,
1708 .flags = IORESOURCE_DMA,
1709 },
1710 [2] = {
1711 .name = "crypto_crci_in",
1712 .start = DMOV8064_CE_IN_CRCI,
1713 .end = DMOV8064_CE_IN_CRCI,
1714 .flags = IORESOURCE_DMA,
1715 },
1716 [3] = {
1717 .name = "crypto_crci_out",
1718 .start = DMOV8064_CE_OUT_CRCI,
1719 .end = DMOV8064_CE_OUT_CRCI,
1720 .flags = IORESOURCE_DMA,
1721 },
1722};
1723
1724#endif
1725
1726#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1727 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1728
1729static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1730 .ce_shared = QCE_CE_SHARED,
1731 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1732 .hw_key_support = QCE_HW_KEY_SUPPORT,
1733 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001734 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001735};
1736
1737static struct platform_device qcrypto_device = {
1738 .name = "qcrypto",
1739 .id = 0,
1740 .num_resources = ARRAY_SIZE(qcrypto_resources),
1741 .resource = qcrypto_resources,
1742 .dev = {
1743 .coherent_dma_mask = DMA_BIT_MASK(32),
1744 .platform_data = &qcrypto_ce_hw_suppport,
1745 },
1746};
1747#endif
1748
1749#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1750 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1751
1752static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1753 .ce_shared = QCE_CE_SHARED,
1754 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1755 .hw_key_support = QCE_HW_KEY_SUPPORT,
1756 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001757 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001758};
1759
1760static struct platform_device qcedev_device = {
1761 .name = "qce",
1762 .id = 0,
1763 .num_resources = ARRAY_SIZE(qcedev_resources),
1764 .resource = qcedev_resources,
1765 .dev = {
1766 .coherent_dma_mask = DMA_BIT_MASK(32),
1767 .platform_data = &qcedev_ce_hw_suppport,
1768 },
1769};
1770#endif
1771
Joel Kingef390842012-05-23 16:42:48 -07001772static struct mdm_vddmin_resource mdm_vddmin_rscs = {
1773 .rpm_id = MSM_RPM_ID_VDDMIN_GPIO,
1774 .ap2mdm_vddmin_gpio = 30,
1775 .modes = 0x03,
1776 .drive_strength = 8,
1777 .mdm2ap_vddmin_gpio = 80,
1778};
1779
Joel King269aa602012-07-23 08:07:35 -07001780static struct gpiomux_setting mdm2ap_status_gpio_run_cfg = {
1781 .func = GPIOMUX_FUNC_GPIO,
1782 .drv = GPIOMUX_DRV_8MA,
1783 .pull = GPIOMUX_PULL_NONE,
1784};
1785
Joel Kingdacbc822012-01-25 13:30:57 -08001786static struct mdm_platform_data mdm_platform_data = {
1787 .mdm_version = "3.0",
1788 .ramdump_delay_ms = 2000,
Joel King14fe7fa2012-05-27 14:26:11 -07001789 .early_power_on = 1,
1790 .sfr_query = 1,
Joel Kingef390842012-05-23 16:42:48 -07001791 .vddmin_resource = &mdm_vddmin_rscs,
Hemant Kumara945b472012-01-25 15:08:06 -08001792 .peripheral_platform_device = &apq8064_device_hsic_host,
Ameya Thakurc9a7a842012-06-24 22:47:52 -07001793 .ramdump_timeout_ms = 120000,
Joel King269aa602012-07-23 08:07:35 -07001794 .mdm2ap_status_gpio_run_cfg = &mdm2ap_status_gpio_run_cfg,
Ameya Thakurffd21b02013-01-30 11:33:22 -08001795 .sysmon_subsys_id_valid = 1,
1796 .sysmon_subsys_id = SYSMON_SS_EXT_MODEM,
Joel Kingdacbc822012-01-25 13:30:57 -08001797};
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001798
Joel Kingfdde32b2013-02-06 17:38:05 -08001799static struct mdm_platform_data amdm_platform_data = {
1800 .mdm_version = "3.0",
1801 .ramdump_delay_ms = 2000,
1802 .early_power_on = 1,
1803 .sfr_query = 1,
1804 .send_shdn = 1,
1805 .vddmin_resource = &mdm_vddmin_rscs,
1806 .peripheral_platform_device = &apq8064_device_hsic_host,
1807 .ramdump_timeout_ms = 120000,
1808 .mdm2ap_status_gpio_run_cfg = &mdm2ap_status_gpio_run_cfg,
1809 .sysmon_subsys_id_valid = 1,
1810 .sysmon_subsys_id = SYSMON_SS_EXT_MODEM,
1811 .no_a2m_errfatal_on_ssr = 1,
1812};
1813
Ameya Thakur2702baf2013-01-30 11:55:25 -08001814static struct mdm_vddmin_resource bmdm_vddmin_rscs = {
1815 .rpm_id = MSM_RPM_ID_VDDMIN_GPIO,
1816 .ap2mdm_vddmin_gpio = 30,
1817 .modes = 0x03,
1818 .drive_strength = 8,
1819 .mdm2ap_vddmin_gpio = 64,
1820};
1821
1822static struct mdm_platform_data bmdm_platform_data = {
1823 .mdm_version = "3.0",
1824 .ramdump_delay_ms = 2000,
1825 .sfr_query = 1,
1826 .send_shdn = 1,
1827 .vddmin_resource = &bmdm_vddmin_rscs,
1828 .peripheral_platform_device = &apq8064_device_ehci_host3,
1829 .ramdump_timeout_ms = 120000,
1830 .mdm2ap_status_gpio_run_cfg = &mdm2ap_status_gpio_run_cfg,
Joel Kingfdde32b2013-02-06 17:38:05 -08001831 .sysmon_subsys_id_valid = 1,
1832 .sysmon_subsys_id = SYSMON_SS_EXT_MODEM2,
1833 .no_a2m_errfatal_on_ssr = 1,
Ameya Thakur2702baf2013-01-30 11:55:25 -08001834};
1835
Joel King57aefdd2013-03-11 13:46:05 -07001836static struct mdm_platform_data sglte2_mdm_platform_data = {
1837 .mdm_version = "3.0",
1838 .ramdump_delay_ms = 2000,
1839 .early_power_on = 1,
1840 .sfr_query = 1,
1841 .vddmin_resource = &mdm_vddmin_rscs,
1842 .peripheral_platform_device = &apq8064_device_hsic_host,
1843 .ramdump_timeout_ms = 120000,
1844 .mdm2ap_status_gpio_run_cfg = &mdm2ap_status_gpio_run_cfg,
1845 .sysmon_subsys_id_valid = 1,
1846 .sysmon_subsys_id = SYSMON_SS_EXT_MODEM,
1847 .no_a2m_errfatal_on_ssr = 1,
Joel Kinga0e9ce92013-03-25 10:42:35 -07001848 .subsys_name = "external_modem_mdm",
Joel King57aefdd2013-03-11 13:46:05 -07001849};
1850
Joel King3166e892013-02-26 11:16:08 -08001851static struct mdm_platform_data sglte2_qsc_platform_data = {
1852 .mdm_version = "3.0",
1853 .ramdump_delay_ms = 2000,
1854 .ramdump_timeout_ms = 600000,
1855 .no_powerdown_after_ramdumps = 1,
1856 .image_upgrade_supported = 1,
Joel King57aefdd2013-03-11 13:46:05 -07001857 .no_a2m_errfatal_on_ssr = 1,
Joel King68cb5462013-03-15 12:54:33 -07001858 .no_reset_on_first_powerup = 1,
Joel King64677852013-03-20 12:59:23 -07001859 .kpd_not_inverted = 1,
Joel Kinga0e9ce92013-03-25 10:42:35 -07001860 .subsys_name = "external_modem",
Joel King3166e892013-02-26 11:16:08 -08001861};
1862
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001863static struct tsens_platform_data apq_tsens_pdata = {
1864 .tsens_factor = 1000,
1865 .hw_type = APQ_8064,
1866 .tsens_num_sensor = 11,
1867 .slope = {1176, 1176, 1154, 1176, 1111,
1868 1132, 1132, 1199, 1132, 1199, 1132},
1869};
1870
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07001871static struct platform_device msm_tsens_device = {
1872 .name = "tsens8960-tm",
1873 .id = -1,
1874};
1875
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06001876static struct msm_thermal_data msm_thermal_pdata = {
1877 .sensor_id = 7,
Eugene Seah2ee4a5d2012-06-25 18:16:41 -06001878 .poll_ms = 250,
1879 .limit_temp_degC = 60,
1880 .temp_hysteresis_degC = 10,
1881 .freq_step = 2,
Praveen Chidambaram771c7892013-02-21 11:44:38 -07001882 .core_limit_temp_degC = 80,
1883 .core_temp_hysteresis_degC = 10,
1884 .core_control_mask = 0xe,
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06001885};
1886
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001887#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001888static void __init apq8064_map_io(void)
1889{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001890 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001891 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001892 if (socinfo_init() < 0)
1893 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001894}
1895
1896static void __init apq8064_init_irq(void)
1897{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001898 struct msm_mpm_device_data *data = NULL;
1899
1900#ifdef CONFIG_MSM_MPM
1901 data = &apq8064_mpm_dev_data;
1902#endif
1903
1904 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001905 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1906 (void *)MSM_QGIC_CPU_BASE);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001907}
1908
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001909static struct platform_device msm8064_device_saw_regulator_core0 = {
1910 .name = "saw-regulator",
1911 .id = 0,
1912 .dev = {
1913 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
1914 },
1915};
1916
1917static struct platform_device msm8064_device_saw_regulator_core1 = {
1918 .name = "saw-regulator",
1919 .id = 1,
1920 .dev = {
1921 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
1922 },
1923};
1924
1925static struct platform_device msm8064_device_saw_regulator_core2 = {
1926 .name = "saw-regulator",
1927 .id = 2,
1928 .dev = {
1929 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
1930 },
1931};
1932
1933static struct platform_device msm8064_device_saw_regulator_core3 = {
1934 .name = "saw-regulator",
1935 .id = 3,
1936 .dev = {
1937 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001938
1939 },
1940};
1941
Oluwafemi Adeyemif5a31422012-03-08 16:58:45 -08001942static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001943 {
1944 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1945 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1946 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001947 1, 784, 180000, 100,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001948 },
1949
1950 {
Anji Jonnala85b29ff2013-01-15 14:12:45 +05301951 MSM_PM_SLEEP_MODE_RETENTION,
1952 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1953 true,
1954 415, 715, 340827, 475,
1955 },
1956
1957 {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001958 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1959 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1960 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001961 1300, 228, 1200000, 2000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001962 },
1963
1964 {
1965 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1966 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1967 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001968 2000, 138, 1208400, 3200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001969 },
1970
1971 {
1972 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001973 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
1974 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001975 6000, 119, 1850300, 9000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001976 },
1977
1978 {
1979 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1980 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1981 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001982 9200, 68, 2839200, 16400,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001983 },
1984
1985 {
1986 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1987 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1988 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001989 10300, 63, 3128000, 18200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001990 },
1991
1992 {
1993 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1994 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1995 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001996 18000, 10, 4602600, 27000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001997 },
1998
1999 {
2000 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2001 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2002 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002003 20000, 2, 5752000, 32000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002004 },
2005};
2006
2007static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2008 .mode = MSM_PM_BOOT_CONFIG_TZ,
2009};
2010
2011static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2012 .levels = &msm_rpmrs_levels[0],
2013 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2014 .vdd_mem_levels = {
2015 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2016 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2017 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2018 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2019 },
2020 .vdd_dig_levels = {
2021 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
2022 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
2023 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
2024 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
2025 },
2026 .vdd_mask = 0x7FFFFF,
2027 .rpmrs_target_id = {
2028 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2029 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
2030 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
2031 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
2032 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
2033 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
2034 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2035 },
2036};
2037
Praveen Chidambaram78499012011-11-01 17:15:17 -06002038static uint8_t spm_wfi_cmd_sequence[] __initdata = {
2039 0x03, 0x0f,
2040};
2041
2042static uint8_t spm_power_collapse_without_rpm[] __initdata = {
2043 0x00, 0x24, 0x54, 0x10,
2044 0x09, 0x03, 0x01,
2045 0x10, 0x54, 0x30, 0x0C,
2046 0x24, 0x30, 0x0f,
2047};
2048
Anji Jonnala85b29ff2013-01-15 14:12:45 +05302049static uint8_t spm_retention_cmd_sequence[] __initdata = {
2050 0x00, 0x05, 0x03, 0x0D,
2051 0x0B, 0x00, 0x0f,
2052};
2053
Anji Jonnala786b39e2013-01-29 13:34:10 +05302054static uint8_t spm_retention_with_krait_v3_cmd_sequence[] __initdata = {
2055 0x42, 0x1B, 0x00,
2056 0x05, 0x03, 0x0D, 0x0B,
2057 0x00, 0x42, 0x1B,
2058 0x0f,
2059};
2060
Praveen Chidambaram78499012011-11-01 17:15:17 -06002061static uint8_t spm_power_collapse_with_rpm[] __initdata = {
2062 0x00, 0x24, 0x54, 0x10,
2063 0x09, 0x07, 0x01, 0x0B,
2064 0x10, 0x54, 0x30, 0x0C,
2065 0x24, 0x30, 0x0f,
2066};
2067
Anji Jonnala0f297a92013-01-19 11:22:25 +05302068/* 8064AB has a different command to assert apc_pdn */
2069static uint8_t spm_power_collapse_without_rpm_krait_v3[] __initdata = {
2070 0x00, 0x24, 0x84, 0x10,
2071 0x09, 0x03, 0x01,
2072 0x10, 0x84, 0x30, 0x0C,
2073 0x24, 0x30, 0x0f,
2074};
2075
2076static uint8_t spm_power_collapse_with_rpm_krait_v3[] __initdata = {
2077 0x00, 0x24, 0x84, 0x10,
2078 0x09, 0x07, 0x01, 0x0B,
2079 0x10, 0x84, 0x30, 0x0C,
2080 0x24, 0x30, 0x0f,
2081};
2082
Anji Jonnala85b29ff2013-01-15 14:12:45 +05302083static struct msm_spm_seq_entry msm_spm_boot_cpu_seq_list[] __initdata = {
2084 [0] = {
2085 .mode = MSM_SPM_MODE_CLOCK_GATING,
2086 .notify_rpm = false,
2087 .cmd = spm_wfi_cmd_sequence,
2088 },
2089 [1] = {
2090 .mode = MSM_SPM_MODE_POWER_RETENTION,
2091 .notify_rpm = false,
2092 .cmd = spm_retention_cmd_sequence,
2093 },
2094 [2] = {
2095 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2096 .notify_rpm = false,
2097 .cmd = spm_power_collapse_without_rpm,
2098 },
2099 [3] = {
2100 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2101 .notify_rpm = true,
2102 .cmd = spm_power_collapse_with_rpm,
2103 },
2104};
2105static struct msm_spm_seq_entry msm_spm_nonboot_cpu_seq_list[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06002106 [0] = {
2107 .mode = MSM_SPM_MODE_CLOCK_GATING,
2108 .notify_rpm = false,
2109 .cmd = spm_wfi_cmd_sequence,
2110 },
2111 [1] = {
Anji Jonnala786b39e2013-01-29 13:34:10 +05302112 .mode = MSM_SPM_MODE_POWER_RETENTION,
2113 .notify_rpm = false,
2114 .cmd = spm_retention_cmd_sequence,
2115 },
2116 [2] = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06002117 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2118 .notify_rpm = false,
2119 .cmd = spm_power_collapse_without_rpm,
2120 },
Anji Jonnala786b39e2013-01-29 13:34:10 +05302121 [3] = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06002122 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2123 .notify_rpm = true,
2124 .cmd = spm_power_collapse_with_rpm,
2125 },
2126};
2127
2128static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
2129 0x00, 0x20, 0x03, 0x20,
2130 0x00, 0x0f,
2131};
2132
2133static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
2134 0x00, 0x20, 0x34, 0x64,
2135 0x48, 0x07, 0x48, 0x20,
2136 0x50, 0x64, 0x04, 0x34,
2137 0x50, 0x0f,
2138};
2139static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
2140 0x00, 0x10, 0x34, 0x64,
2141 0x48, 0x07, 0x48, 0x10,
2142 0x50, 0x64, 0x04, 0x34,
2143 0x50, 0x0F,
2144};
2145
2146static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
2147 [0] = {
2148 .mode = MSM_SPM_L2_MODE_RETENTION,
2149 .notify_rpm = false,
2150 .cmd = l2_spm_wfi_cmd_sequence,
2151 },
2152 [1] = {
2153 .mode = MSM_SPM_L2_MODE_GDHS,
2154 .notify_rpm = true,
2155 .cmd = l2_spm_gdhs_cmd_sequence,
2156 },
2157 [2] = {
2158 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
2159 .notify_rpm = true,
2160 .cmd = l2_spm_power_off_cmd_sequence,
2161 },
2162};
2163
2164
2165static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
2166 [0] = {
2167 .reg_base_addr = MSM_SAW_L2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002168 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07002169 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002170 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
2171 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
2172 .modes = msm_spm_l2_seq_list,
2173 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
2174 },
2175};
2176
2177static struct msm_spm_platform_data msm_spm_data[] __initdata = {
2178 [0] = {
2179 .reg_base_addr = MSM_SAW0_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002180 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002181#if defined(CONFIG_MSM_AVS_HW)
2182 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2183 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2184#endif
2185 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Anji Jonnala85b29ff2013-01-15 14:12:45 +05302186 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004,
2187 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C,
2188 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002189 .vctl_timeout_us = 50,
Anji Jonnala85b29ff2013-01-15 14:12:45 +05302190 .num_modes = ARRAY_SIZE(msm_spm_boot_cpu_seq_list),
2191 .modes = msm_spm_boot_cpu_seq_list,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002192 },
2193 [1] = {
2194 .reg_base_addr = MSM_SAW1_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002195 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002196#if defined(CONFIG_MSM_AVS_HW)
2197 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2198 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2199#endif
2200 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Anji Jonnala786b39e2013-01-29 13:34:10 +05302201 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004,
2202 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C,
2203 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002204 .vctl_timeout_us = 50,
Anji Jonnala85b29ff2013-01-15 14:12:45 +05302205 .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
2206 .modes = msm_spm_nonboot_cpu_seq_list,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002207 },
2208 [2] = {
2209 .reg_base_addr = MSM_SAW2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002210 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002211#if defined(CONFIG_MSM_AVS_HW)
2212 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2213 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2214#endif
2215 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Anji Jonnala786b39e2013-01-29 13:34:10 +05302216 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004,
2217 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C,
2218 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002219 .vctl_timeout_us = 50,
Anji Jonnala85b29ff2013-01-15 14:12:45 +05302220 .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
2221 .modes = msm_spm_nonboot_cpu_seq_list,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002222 },
2223 [3] = {
2224 .reg_base_addr = MSM_SAW3_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002225 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002226#if defined(CONFIG_MSM_AVS_HW)
2227 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2228 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2229#endif
2230 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Anji Jonnala786b39e2013-01-29 13:34:10 +05302231 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004,
2232 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C,
2233 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002234 .vctl_timeout_us = 50,
Anji Jonnala85b29ff2013-01-15 14:12:45 +05302235 .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
2236 .modes = msm_spm_nonboot_cpu_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08002237 },
2238};
2239
Anji Jonnala0f297a92013-01-19 11:22:25 +05302240static void __init apq8064ab_update_krait_spm(void)
2241{
2242 int i;
2243
2244 /* Update the SPM sequences for SPC and PC */
2245 for (i = 0; i < ARRAY_SIZE(msm_spm_data); i++) {
2246 int j;
2247 struct msm_spm_platform_data *pdata = &msm_spm_data[i];
2248 for (j = 0; j < pdata->num_modes; j++) {
2249 if (pdata->modes[j].cmd ==
2250 spm_power_collapse_without_rpm)
2251 pdata->modes[j].cmd =
2252 spm_power_collapse_without_rpm_krait_v3;
2253 else if (pdata->modes[j].cmd ==
2254 spm_power_collapse_with_rpm)
2255 pdata->modes[j].cmd =
2256 spm_power_collapse_with_rpm_krait_v3;
2257 }
2258 }
2259}
2260
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002261static void __init apq8064_init_buses(void)
2262{
2263 msm_bus_rpm_set_mt_mask();
2264 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
2265 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
2266 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
2267 msm_bus_8064_apps_fabric.dev.platform_data =
2268 &msm_bus_8064_apps_fabric_pdata;
2269 msm_bus_8064_sys_fabric.dev.platform_data =
2270 &msm_bus_8064_sys_fabric_pdata;
2271 msm_bus_8064_mm_fabric.dev.platform_data =
2272 &msm_bus_8064_mm_fabric_pdata;
2273 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
2274 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
2275}
2276
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002277/* PCIe gpios */
2278static struct msm_pcie_gpio_info_t msm_pcie_gpio_info[MSM_PCIE_MAX_GPIO] = {
2279 {"rst_n", PM8921_MPP_PM_TO_SYS(PCIE_RST_N_PMIC_MPP), 0},
2280 {"pwr_en", PM8921_GPIO_PM_TO_SYS(PCIE_PWR_EN_PMIC_GPIO), 1},
2281};
2282
2283static struct msm_pcie_platform msm_pcie_platform_data = {
2284 .gpio = msm_pcie_gpio_info,
Niranjana Vishwanathapura68210ff2012-06-24 18:03:49 -06002285 .axi_addr = PCIE_AXI_BAR_PHYS,
2286 .axi_size = PCIE_AXI_BAR_SIZE,
Niranjana Vishwanathapura459a27d2012-07-20 12:23:55 -06002287 .wake_n = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, PCIE_WAKE_N_PMIC_GPIO),
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002288};
2289
Niranjana Vishwanathapurac1edd402012-06-28 15:32:50 -06002290static int __init mpq8064_pcie_enabled(void)
2291{
2292 return !((readl_relaxed(QFPROM_RAW_FEAT_CONFIG_ROW0_MSB) & BIT(21)) ||
2293 (readl_relaxed(QFPROM_RAW_OEM_CONFIG_ROW0_LSB) & BIT(4)));
2294}
2295
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002296static void __init mpq8064_pcie_init(void)
2297{
Niranjana Vishwanathapurac1edd402012-06-28 15:32:50 -06002298 if (mpq8064_pcie_enabled()) {
2299 msm_device_pcie.dev.platform_data = &msm_pcie_platform_data;
2300 platform_device_register(&msm_device_pcie);
2301 }
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002302}
2303
David Collinsf0d00732012-01-25 15:46:50 -08002304static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
2305 .name = GPIO_REGULATOR_DEV_NAME,
2306 .id = PM8921_MPP_PM_TO_SYS(7),
2307 .dev = {
2308 .platform_data
2309 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2310 },
2311};
2312
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08002313static struct platform_device apq8064_device_ext_mpp8_vreg __devinitdata = {
2314 .name = GPIO_REGULATOR_DEV_NAME,
2315 .id = PM8921_MPP_PM_TO_SYS(8),
2316 .dev = {
2317 .platform_data
2318 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_MPP8],
2319 },
2320};
2321
David Collinsf0d00732012-01-25 15:46:50 -08002322static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
2323 .name = GPIO_REGULATOR_DEV_NAME,
2324 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
2325 .dev = {
2326 .platform_data =
2327 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2328 },
2329};
2330
David Collins390fc332012-02-07 14:38:16 -08002331static struct platform_device apq8064_device_ext_ts_sw_vreg __devinitdata = {
2332 .name = GPIO_REGULATOR_DEV_NAME,
2333 .id = PM8921_GPIO_PM_TO_SYS(23),
2334 .dev = {
2335 .platform_data
2336 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_TS_SW],
2337 },
2338};
2339
David Collins2782b5c2012-02-06 10:02:42 -08002340static struct platform_device apq8064_device_rpm_regulator __devinitdata = {
2341 .name = "rpm-regulator",
David Collins36199252012-08-21 15:43:02 -07002342 .id = 0,
David Collins2782b5c2012-02-06 10:02:42 -08002343 .dev = {
2344 .platform_data = &apq8064_rpm_regulator_pdata,
2345 },
2346};
2347
David Collins36199252012-08-21 15:43:02 -07002348static struct platform_device
2349apq8064_pm8921_device_rpm_regulator __devinitdata = {
2350 .name = "rpm-regulator",
2351 .id = 1,
2352 .dev = {
2353 .platform_data = &apq8064_rpm_regulator_pm8921_pdata,
2354 },
2355};
2356
Ravi Kumar V05931a22012-04-04 17:09:37 +05302357static struct gpio_ir_recv_platform_data gpio_ir_recv_pdata = {
2358 .gpio_nr = 88,
2359 .active_low = 1,
2360};
2361
2362static struct platform_device gpio_ir_recv_pdev = {
2363 .name = "gpio-rc-recv",
2364 .dev = {
2365 .platform_data = &gpio_ir_recv_pdata,
2366 },
2367};
2368
Terence Hampson36b70722012-05-10 13:18:16 -04002369static struct platform_device *common_not_mpq_devices[] __initdata = {
David Keitel3c40fc52012-02-09 17:53:52 -08002370 &apq8064_device_qup_i2c_gsbi1,
Jing Lin04601f92012-02-05 15:36:07 -08002371 &apq8064_device_qup_i2c_gsbi3,
Terence Hampson36b70722012-05-10 13:18:16 -04002372};
2373
David Collins36199252012-08-21 15:43:02 -07002374static struct platform_device *early_common_devices[] __initdata = {
Matt Wagantallf5cc3892012-06-07 19:47:02 -07002375 &apq8064_device_acpuclk,
Terence Hampson36b70722012-05-10 13:18:16 -04002376 &apq8064_device_dmov,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002377 &apq8064_device_qup_spi_gsbi5,
David Collins36199252012-08-21 15:43:02 -07002378};
2379
2380static struct platform_device *pm8921_common_devices[] __initdata = {
David Collinsf0d00732012-01-25 15:46:50 -08002381 &apq8064_device_ext_5v_vreg,
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08002382 &apq8064_device_ext_mpp8_vreg,
David Collinsf0d00732012-01-25 15:46:50 -08002383 &apq8064_device_ext_3p3v_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07002384 &apq8064_device_ssbi_pmic1,
2385 &apq8064_device_ssbi_pmic2,
Steve Mucklef132c6c2012-06-06 18:30:57 -07002386 &apq8064_device_ext_ts_sw_vreg,
David Collins36199252012-08-21 15:43:02 -07002387};
2388
2389static struct platform_device *pm8917_common_devices[] __initdata = {
2390 &apq8064_device_ext_mpp8_vreg,
2391 &apq8064_device_ext_3p3v_vreg,
2392 &apq8064_device_ssbi_pmic1,
2393 &apq8064_device_ssbi_pmic2,
2394 &apq8064_device_ext_ts_sw_vreg,
2395};
2396
2397static struct platform_device *common_devices[] __initdata = {
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06002398 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07002399 &apq8064_device_otg,
2400 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08002401 &apq8064_device_hsusb_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07002402 &android_usb_device,
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08002403 &msm_device_wcnss_wlan,
Ankit Vermab7c26e62012-02-28 15:04:15 -08002404 &msm_device_iris_fm,
Larry Bassel67b921d2012-04-06 10:23:27 -07002405 &apq8064_fmem_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08002406#ifdef CONFIG_ANDROID_PMEM
2407#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002408 &apq8064_android_pmem_device,
2409 &apq8064_android_pmem_adsp_device,
2410 &apq8064_android_pmem_audio_device,
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -07002411#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
2412#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -08002413#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002414 &apq8064_ion_dev,
Olav Haugan7c6aa742012-01-16 16:47:37 -08002415#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002416 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08002417 &msm8064_device_saw_regulator_core0,
2418 &msm8064_device_saw_regulator_core1,
2419 &msm8064_device_saw_regulator_core2,
2420 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002421#if defined(CONFIG_QSEECOM)
2422 &qseecom_device,
2423#endif
2424
Joel Nider6b9a7bc2012-06-26 11:19:19 +03002425 &msm_8064_device_tsif[0],
2426 &msm_8064_device_tsif[1],
2427
Ramesh Masavarapu28311912011-10-27 11:04:12 -07002428#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2429 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2430 &qcrypto_device,
2431#endif
2432
2433#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2434 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2435 &qcedev_device,
2436#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07002437
2438#ifdef CONFIG_HW_RANDOM_MSM
2439 &apq8064_device_rng,
2440#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002441 &apq_pcm,
2442 &apq_pcm_routing,
2443 &apq_cpudai0,
2444 &apq_cpudai1,
Santosh Mardieff9a742012-04-09 23:23:39 +05302445 &mpq_cpudai_sec_i2s_rx,
Kuirong Wangf23f8c52012-03-31 12:34:51 -07002446 &mpq_cpudai_mi2s_tx,
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002447 &apq_cpudai_hdmi_rx,
2448 &apq_cpudai_bt_rx,
2449 &apq_cpudai_bt_tx,
2450 &apq_cpudai_fm_rx,
2451 &apq_cpudai_fm_tx,
2452 &apq_cpu_fe,
2453 &apq_stub_codec,
2454 &apq_voice,
2455 &apq_voip,
2456 &apq_lpa_pcm,
Krishnankutty Kolathappilly4374e332012-03-18 22:27:30 -07002457 &apq_compr_dsp,
2458 &apq_multi_ch_pcm,
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -07002459 &apq_lowlatency_pcm,
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002460 &apq_pcm_hostless,
2461 &apq_cpudai_afe_01_rx,
2462 &apq_cpudai_afe_01_tx,
2463 &apq_cpudai_afe_02_rx,
2464 &apq_cpudai_afe_02_tx,
2465 &apq_pcm_afe,
2466 &apq_cpudai_auxpcm_rx,
2467 &apq_cpudai_auxpcm_tx,
Neema Shetty8427c262012-02-16 11:23:43 -08002468 &apq_cpudai_stub,
Neema Shetty3c9d2862012-03-11 01:25:32 -08002469 &apq_cpudai_slimbus_1_rx,
2470 &apq_cpudai_slimbus_1_tx,
Kiran Kandi97fe19d2012-05-20 22:34:04 -07002471 &apq_cpudai_slimbus_2_rx,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002472 &apq_cpudai_slimbus_2_tx,
Neema Shettyc9d86c32012-05-09 12:01:39 -07002473 &apq_cpudai_slimbus_3_rx,
Helen Zeng38c3c962012-05-17 14:56:20 -07002474 &apq_cpudai_slimbus_3_tx,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002475 &apq8064_rpm_device,
2476 &apq8064_rpm_log_device,
2477 &apq8064_rpm_stat_device,
Anji Jonnala2a8bd312012-11-01 13:11:42 +05302478 &apq8064_rpm_master_stat_device,
Ramesh Masavarapuf31ff242012-05-10 18:55:21 -07002479 &apq_device_tz_log,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002480 &msm_bus_8064_apps_fabric,
2481 &msm_bus_8064_sys_fabric,
2482 &msm_bus_8064_mm_fabric,
2483 &msm_bus_8064_sys_fpb,
2484 &msm_bus_8064_cpss_fpb,
Mohan Kumar Gubbihalli Lachma Naik7f72edd2012-02-06 17:26:47 -08002485 &apq8064_msm_device_vidc,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07002486 &msm_pil_dsps,
Matt Wagantallb94b9a52012-02-02 21:59:54 -08002487 &msm_8960_q6_lpass,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002488 &msm_pil_vidc,
Matt Wagantall292aace2012-01-26 19:12:34 -08002489 &msm_gss,
Laura Abbottb93525f2012-04-12 09:57:19 -07002490 &apq8064_rtb_device,
Steve Mucklea9aac292012-11-02 15:41:00 -07002491 &apq8064_dcvs_device,
Abhijeet Dharmapurikarde91d2c2012-08-23 14:36:59 -07002492 &apq8064_msm_gov_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002493 &apq8064_device_cache_erp,
Stepan Moskovchenko0f3de112012-06-08 18:11:46 -07002494 &msm8960_device_ebi1_ch0_erp,
2495 &msm8960_device_ebi1_ch1_erp,
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002496 &epm_adc_device,
Pratik Patel3b0ca882012-06-01 16:54:14 -07002497 &coresight_tpiu_device,
2498 &coresight_etb_device,
2499 &apq8064_coresight_funnel_device,
2500 &coresight_etm0_device,
2501 &coresight_etm1_device,
2502 &coresight_etm2_device,
2503 &coresight_etm3_device,
Helen Zeng8f925502012-03-05 16:50:17 -08002504 &apq_cpudai_slim_4_rx,
2505 &apq_cpudai_slim_4_tx,
Steve Mucklef132c6c2012-06-06 18:30:57 -07002506#ifdef CONFIG_MSM_GEMINI
Jignesh Mehta921649d2012-04-19 06:57:23 -07002507 &msm8960_gemini_device,
Steve Mucklef132c6c2012-06-06 18:30:57 -07002508#endif
Laura Abbott0577d7b2012-04-17 11:14:30 -07002509 &apq8064_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002510 &msm_tsens_device,
Laura Abbott93a4a352012-05-25 09:26:35 -07002511 &apq8064_cache_dump_device,
Joel Nider0e4a16d2012-08-05 14:20:11 +03002512 &msm_8064_device_tspp,
Abhijeet Dharmapurikarde91d2c2012-08-23 14:36:59 -07002513#ifdef CONFIG_BATTERY_BCL
2514 &battery_bcl_device,
2515#endif
2516 &apq8064_msm_mpd_device,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002517};
2518
Joel King82b7e3f2012-01-05 10:03:27 -08002519static struct platform_device *cdp_devices[] __initdata = {
2520 &apq8064_device_uart_gsbi1,
Jin Hong4bbbfba2012-02-02 21:48:07 -08002521 &apq8064_device_uart_gsbi7,
Joel King82b7e3f2012-01-05 10:03:27 -08002522 &msm_device_sps_apq8064,
Aravind Venkateswaran4ca27532012-02-16 14:27:05 -08002523#ifdef CONFIG_MSM_ROTATOR
2524 &msm_rotator_device,
2525#endif
Anji Jonnalae84292b2012-09-21 13:34:44 +05302526 &msm8064_pc_cntr,
Joel King82b7e3f2012-01-05 10:03:27 -08002527};
2528
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002529static struct platform_device
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002530mpq8064_device_ext_1p2_buck_vreg __devinitdata = {
2531 .name = GPIO_REGULATOR_DEV_NAME,
2532 .id = SX150X_GPIO(4, 2),
2533 .dev = {
2534 .platform_data =
2535 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P2V],
2536 },
2537};
2538
2539static struct platform_device
2540mpq8064_device_ext_1p8_buck_vreg __devinitdata = {
2541 .name = GPIO_REGULATOR_DEV_NAME,
2542 .id = SX150X_GPIO(4, 4),
2543 .dev = {
2544 .platform_data =
2545 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P8V],
2546 },
2547};
2548
2549static struct platform_device
2550mpq8064_device_ext_2p2_buck_vreg __devinitdata = {
2551 .name = GPIO_REGULATOR_DEV_NAME,
2552 .id = SX150X_GPIO(4, 14),
2553 .dev = {
2554 .platform_data =
2555 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_2P2V],
2556 },
2557};
2558
2559static struct platform_device
2560mpq8064_device_ext_5v_buck_vreg __devinitdata = {
2561 .name = GPIO_REGULATOR_DEV_NAME,
2562 .id = SX150X_GPIO(4, 3),
2563 .dev = {
2564 .platform_data =
2565 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_5V],
2566 },
2567};
2568
2569static struct platform_device
2570mpq8064_device_ext_3p3v_ldo_vreg __devinitdata = {
2571 .name = GPIO_REGULATOR_DEV_NAME,
2572 .id = SX150X_GPIO(4, 15),
2573 .dev = {
2574 .platform_data =
2575 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_3P3V],
2576 },
2577};
2578
Ravi Kumar V1c903012012-05-15 16:11:35 +05302579static struct platform_device rc_input_loopback_pdev = {
2580 .name = "rc-user-input",
2581 .id = -1,
2582};
2583
Ravi Kumar V040eeff2012-05-23 21:29:23 +05302584static int rf4ce_gpio_init(void)
2585{
Ravi Kumar V0143c582012-08-14 17:18:11 +05302586 if (!machine_is_mpq8064_cdp() &&
2587 !machine_is_mpq8064_hrd() &&
2588 !machine_is_mpq8064_dtv())
Ravi Kumar V040eeff2012-05-23 21:29:23 +05302589 return -EINVAL;
2590
2591 /* CC2533 SRDY Input */
2592 if (!gpio_request(SX150X_GPIO(4, 6), "rf4ce_srdy")) {
2593 gpio_direction_input(SX150X_GPIO(4, 6));
2594 gpio_export(SX150X_GPIO(4, 6), true);
2595 }
2596
2597 /* CC2533 MRDY Output */
2598 if (!gpio_request(SX150X_GPIO(4, 5), "rf4ce_mrdy")) {
2599 gpio_direction_output(SX150X_GPIO(4, 5), 1);
2600 gpio_export(SX150X_GPIO(4, 5), true);
2601 }
2602
2603 /* CC2533 Reset Output */
2604 if (!gpio_request(SX150X_GPIO(4, 7), "rf4ce_reset")) {
2605 gpio_direction_output(SX150X_GPIO(4, 7), 0);
2606 gpio_export(SX150X_GPIO(4, 7), true);
2607 }
2608
2609 return 0;
2610}
2611late_initcall(rf4ce_gpio_init);
2612
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002613static struct platform_device *mpq_devices[] __initdata = {
2614 &msm_device_sps_apq8064,
2615 &mpq8064_device_qup_i2c_gsbi5,
2616#ifdef CONFIG_MSM_ROTATOR
2617 &msm_rotator_device,
2618#endif
Ravi Kumar V05931a22012-04-04 17:09:37 +05302619 &gpio_ir_recv_pdev,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002620 &mpq8064_device_ext_1p2_buck_vreg,
2621 &mpq8064_device_ext_1p8_buck_vreg,
2622 &mpq8064_device_ext_2p2_buck_vreg,
2623 &mpq8064_device_ext_5v_buck_vreg,
2624 &mpq8064_device_ext_3p3v_ldo_vreg,
Terence Hampson2e1705f2012-04-11 19:55:29 -04002625#ifdef CONFIG_MSM_VCAP
2626 &msm8064_device_vcap,
2627#endif
Ravi Kumar V1c903012012-05-15 16:11:35 +05302628 &rc_input_loopback_pdev,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002629};
2630
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002631static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002632 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002633};
2634
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002635#define KS8851_IRQ_GPIO 43
2636
2637static struct spi_board_info spi_board_info[] __initdata = {
2638 {
2639 .modalias = "ks8851",
2640 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2641 .max_speed_hz = 19200000,
2642 .bus_num = 0,
2643 .chip_select = 2,
2644 .mode = SPI_MODE_0,
2645 },
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002646 {
2647 .modalias = "epm_adc",
2648 .max_speed_hz = 1100000,
2649 .bus_num = 0,
2650 .chip_select = 3,
2651 .mode = SPI_MODE_0,
2652 },
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002653};
2654
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002655static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002656 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08002657 .bus_num = 1,
2658 .slim_slave = &apq8064_slim_tabla,
2659 },
2660 {
2661 .bus_num = 1,
2662 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002663 },
2664 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002665};
2666
David Keitel3c40fc52012-02-09 17:53:52 -08002667static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi1_pdata = {
2668 .clk_freq = 100000,
2669 .src_clk_rate = 24000000,
2670};
2671
Jing Lin04601f92012-02-05 15:36:07 -08002672static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi3_pdata = {
Anirudh Ghayalc2163472012-04-10 14:58:14 +05302673 .clk_freq = 384000,
Jing Lin04601f92012-02-05 15:36:07 -08002674 .src_clk_rate = 24000000,
2675};
2676
Kenneth Heitke748593a2011-07-15 15:45:11 -06002677static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
2678 .clk_freq = 100000,
2679 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002680};
2681
Joel King8f839b92012-04-01 14:37:46 -07002682static struct msm_i2c_platform_data mpq8064_i2c_qup_gsbi5_pdata = {
2683 .clk_freq = 100000,
2684 .src_clk_rate = 24000000,
2685};
2686
David Keitel3c40fc52012-02-09 17:53:52 -08002687#define GSBI_DUAL_MODE_CODE 0x60
2688#define MSM_GSBI1_PHYS 0x12440000
Kenneth Heitke748593a2011-07-15 15:45:11 -06002689static void __init apq8064_i2c_init(void)
2690{
David Keitel3c40fc52012-02-09 17:53:52 -08002691 void __iomem *gsbi_mem;
2692
2693 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2694 &apq8064_i2c_qup_gsbi1_pdata;
2695 gsbi_mem = ioremap_nocache(MSM_GSBI1_PHYS, 4);
2696 writel_relaxed(GSBI_DUAL_MODE_CODE, gsbi_mem);
2697 /* Ensure protocol code is written before proceeding */
2698 wmb();
2699 iounmap(gsbi_mem);
2700 apq8064_i2c_qup_gsbi1_pdata.use_gsbi_shared_mode = 1;
Jing Lin04601f92012-02-05 15:36:07 -08002701 apq8064_device_qup_i2c_gsbi3.dev.platform_data =
2702 &apq8064_i2c_qup_gsbi3_pdata;
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002703 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2704 &apq8064_i2c_qup_gsbi1_pdata;
Mayank Ranae98f1e42013-02-22 19:58:59 +05302705
2706 /* Add GSBI4 I2C pdata for non-fusion3 SGLTE2 */
2707 if (socinfo_get_platform_subtype() !=
2708 PLATFORM_SUBTYPE_SGLTE2) {
2709 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
Kenneth Heitke748593a2011-07-15 15:45:11 -06002710 &apq8064_i2c_qup_gsbi4_pdata;
Mayank Ranae98f1e42013-02-22 19:58:59 +05302711 }
Joel King8f839b92012-04-01 14:37:46 -07002712 mpq8064_device_qup_i2c_gsbi5.dev.platform_data =
2713 &mpq8064_i2c_qup_gsbi5_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002714}
2715
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002716#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002717static int ethernet_init(void)
2718{
2719 int ret;
2720 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
2721 if (ret) {
2722 pr_err("ks8851 gpio_request failed: %d\n", ret);
2723 goto fail;
2724 }
2725
2726 return 0;
2727fail:
2728 return ret;
2729}
2730#else
2731static int ethernet_init(void)
2732{
2733 return 0;
2734}
2735#endif
2736
David Collins6f7c3472012-08-22 13:18:06 -07002737#define GPIO_KEY_HOME PM8921_GPIO_PM_TO_SYS(27)
2738#define GPIO_KEY_VOLUME_UP PM8921_GPIO_PM_TO_SYS(35)
2739#define GPIO_KEY_VOLUME_DOWN_PM8921 PM8921_GPIO_PM_TO_SYS(38)
2740#define GPIO_KEY_VOLUME_DOWN_PM8917 PM8921_GPIO_PM_TO_SYS(30)
2741#define GPIO_KEY_CAM_FOCUS PM8921_GPIO_PM_TO_SYS(3)
2742#define GPIO_KEY_CAM_SNAP PM8921_GPIO_PM_TO_SYS(4)
2743#define GPIO_KEY_ROTATION_PM8921 PM8921_GPIO_PM_TO_SYS(42)
2744#define GPIO_KEY_ROTATION_PM8917 PM8921_GPIO_PM_TO_SYS(8)
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302745
David Collins6f7c3472012-08-22 13:18:06 -07002746static struct gpio_keys_button cdp_keys_pm8921[] = {
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302747 {
2748 .code = KEY_HOME,
2749 .gpio = GPIO_KEY_HOME,
2750 .desc = "home_key",
2751 .active_low = 1,
2752 .type = EV_KEY,
2753 .wakeup = 1,
2754 .debounce_interval = 15,
2755 },
2756 {
2757 .code = KEY_VOLUMEUP,
2758 .gpio = GPIO_KEY_VOLUME_UP,
2759 .desc = "volume_up_key",
2760 .active_low = 1,
2761 .type = EV_KEY,
2762 .wakeup = 1,
2763 .debounce_interval = 15,
2764 },
2765 {
2766 .code = KEY_VOLUMEDOWN,
David Collins6f7c3472012-08-22 13:18:06 -07002767 .gpio = GPIO_KEY_VOLUME_DOWN_PM8921,
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302768 .desc = "volume_down_key",
2769 .active_low = 1,
2770 .type = EV_KEY,
2771 .wakeup = 1,
2772 .debounce_interval = 15,
2773 },
2774 {
2775 .code = SW_ROTATE_LOCK,
David Collins6f7c3472012-08-22 13:18:06 -07002776 .gpio = GPIO_KEY_ROTATION_PM8921,
2777 .desc = "rotate_key",
2778 .active_low = 1,
2779 .type = EV_SW,
2780 .debounce_interval = 15,
2781 },
2782};
2783
2784static struct gpio_keys_button cdp_keys_pm8917[] = {
2785 {
2786 .code = KEY_HOME,
2787 .gpio = GPIO_KEY_HOME,
2788 .desc = "home_key",
2789 .active_low = 1,
2790 .type = EV_KEY,
2791 .wakeup = 1,
2792 .debounce_interval = 15,
2793 },
2794 {
2795 .code = KEY_VOLUMEUP,
2796 .gpio = GPIO_KEY_VOLUME_UP,
2797 .desc = "volume_up_key",
2798 .active_low = 1,
2799 .type = EV_KEY,
2800 .wakeup = 1,
2801 .debounce_interval = 15,
2802 },
2803 {
2804 .code = KEY_VOLUMEDOWN,
2805 .gpio = GPIO_KEY_VOLUME_DOWN_PM8917,
2806 .desc = "volume_down_key",
2807 .active_low = 1,
2808 .type = EV_KEY,
2809 .wakeup = 1,
2810 .debounce_interval = 15,
2811 },
2812 {
2813 .code = SW_ROTATE_LOCK,
2814 .gpio = GPIO_KEY_ROTATION_PM8917,
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302815 .desc = "rotate_key",
2816 .active_low = 1,
2817 .type = EV_SW,
2818 .debounce_interval = 15,
2819 },
2820};
2821
2822static struct gpio_keys_platform_data cdp_keys_data = {
David Collins6f7c3472012-08-22 13:18:06 -07002823 .buttons = cdp_keys_pm8921,
2824 .nbuttons = ARRAY_SIZE(cdp_keys_pm8921),
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302825};
2826
2827static struct platform_device cdp_kp_pdev = {
2828 .name = "gpio-keys",
2829 .id = -1,
2830 .dev = {
2831 .platform_data = &cdp_keys_data,
2832 },
2833};
2834
2835static struct gpio_keys_button mtp_keys[] = {
2836 {
2837 .code = KEY_CAMERA_FOCUS,
2838 .gpio = GPIO_KEY_CAM_FOCUS,
2839 .desc = "cam_focus_key",
2840 .active_low = 1,
2841 .type = EV_KEY,
2842 .wakeup = 1,
2843 .debounce_interval = 15,
2844 },
2845 {
2846 .code = KEY_VOLUMEUP,
2847 .gpio = GPIO_KEY_VOLUME_UP,
2848 .desc = "volume_up_key",
2849 .active_low = 1,
2850 .type = EV_KEY,
2851 .wakeup = 1,
2852 .debounce_interval = 15,
2853 },
2854 {
2855 .code = KEY_VOLUMEDOWN,
David Collins6f7c3472012-08-22 13:18:06 -07002856 .gpio = GPIO_KEY_VOLUME_DOWN_PM8921,
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302857 .desc = "volume_down_key",
2858 .active_low = 1,
2859 .type = EV_KEY,
2860 .wakeup = 1,
2861 .debounce_interval = 15,
2862 },
2863 {
2864 .code = KEY_CAMERA_SNAPSHOT,
2865 .gpio = GPIO_KEY_CAM_SNAP,
2866 .desc = "cam_snap_key",
2867 .active_low = 1,
2868 .type = EV_KEY,
2869 .debounce_interval = 15,
2870 },
2871};
2872
2873static struct gpio_keys_platform_data mtp_keys_data = {
2874 .buttons = mtp_keys,
2875 .nbuttons = ARRAY_SIZE(mtp_keys),
2876};
2877
2878static struct platform_device mtp_kp_pdev = {
2879 .name = "gpio-keys",
2880 .id = -1,
2881 .dev = {
2882 .platform_data = &mtp_keys_data,
2883 },
2884};
2885
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05302886static struct gpio_keys_button mpq_keys[] = {
2887 {
2888 .code = KEY_VOLUMEDOWN,
David Collins6f7c3472012-08-22 13:18:06 -07002889 .gpio = GPIO_KEY_VOLUME_DOWN_PM8921,
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05302890 .desc = "volume_down_key",
2891 .active_low = 1,
2892 .type = EV_KEY,
2893 .wakeup = 1,
2894 .debounce_interval = 15,
2895 },
2896 {
2897 .code = KEY_VOLUMEUP,
2898 .gpio = GPIO_KEY_VOLUME_UP,
2899 .desc = "volume_up_key",
2900 .active_low = 1,
2901 .type = EV_KEY,
2902 .wakeup = 1,
2903 .debounce_interval = 15,
2904 },
2905};
2906
2907static struct gpio_keys_platform_data mpq_keys_data = {
2908 .buttons = mpq_keys,
2909 .nbuttons = ARRAY_SIZE(mpq_keys),
2910};
2911
2912static struct platform_device mpq_gpio_keys_pdev = {
2913 .name = "gpio-keys",
2914 .id = -1,
2915 .dev = {
2916 .platform_data = &mpq_keys_data,
2917 },
2918};
2919
2920#define MPQ_KP_ROW_BASE SX150X_EXP2_GPIO_BASE
2921#define MPQ_KP_COL_BASE (SX150X_EXP2_GPIO_BASE + 4)
2922
2923static unsigned int mpq_row_gpios[] = {MPQ_KP_ROW_BASE, MPQ_KP_ROW_BASE + 1,
2924 MPQ_KP_ROW_BASE + 2, MPQ_KP_ROW_BASE + 3};
2925static unsigned int mpq_col_gpios[] = {MPQ_KP_COL_BASE, MPQ_KP_COL_BASE + 1,
2926 MPQ_KP_COL_BASE + 2};
2927
2928static const unsigned int mpq_keymap[] = {
2929 KEY(0, 0, KEY_UP),
2930 KEY(0, 1, KEY_ENTER),
2931 KEY(0, 2, KEY_3),
2932
2933 KEY(1, 0, KEY_DOWN),
2934 KEY(1, 1, KEY_EXIT),
2935 KEY(1, 2, KEY_4),
2936
2937 KEY(2, 0, KEY_LEFT),
2938 KEY(2, 1, KEY_1),
2939 KEY(2, 2, KEY_5),
2940
2941 KEY(3, 0, KEY_RIGHT),
2942 KEY(3, 1, KEY_2),
2943 KEY(3, 2, KEY_6),
2944};
2945
2946static struct matrix_keymap_data mpq_keymap_data = {
2947 .keymap_size = ARRAY_SIZE(mpq_keymap),
2948 .keymap = mpq_keymap,
2949};
2950
2951static struct matrix_keypad_platform_data mpq_keypad_data = {
2952 .keymap_data = &mpq_keymap_data,
2953 .row_gpios = mpq_row_gpios,
2954 .col_gpios = mpq_col_gpios,
2955 .num_row_gpios = ARRAY_SIZE(mpq_row_gpios),
2956 .num_col_gpios = ARRAY_SIZE(mpq_col_gpios),
2957 .col_scan_delay_us = 32000,
2958 .debounce_ms = 20,
2959 .wakeup = 1,
2960 .active_low = 1,
2961 .no_autorepeat = 1,
2962};
2963
2964static struct platform_device mpq_keypad_device = {
2965 .name = "matrix-keypad",
2966 .id = -1,
2967 .dev = {
2968 .platform_data = &mpq_keypad_data,
2969 },
2970};
2971
Jin Hongd3024e62012-02-09 16:13:32 -08002972/* Sensors DSPS platform data */
2973#define DSPS_PIL_GENERIC_NAME "dsps"
2974static void __init apq8064_init_dsps(void)
2975{
2976 struct msm_dsps_platform_data *pdata =
2977 msm_dsps_device_8064.dev.platform_data;
2978 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
2979 pdata->gpios = NULL;
2980 pdata->gpios_num = 0;
2981
2982 platform_device_register(&msm_dsps_device_8064);
2983}
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302984
Jing Lin417fa452012-02-05 14:31:06 -08002985#define I2C_SURF 1
2986#define I2C_FFA (1 << 1)
2987#define I2C_RUMI (1 << 2)
2988#define I2C_SIM (1 << 3)
2989#define I2C_LIQUID (1 << 4)
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002990#define I2C_MPQ_CDP BIT(5)
2991#define I2C_MPQ_HRD BIT(6)
2992#define I2C_MPQ_DTV BIT(7)
Jing Lin417fa452012-02-05 14:31:06 -08002993
2994struct i2c_registry {
2995 u8 machs;
2996 int bus;
2997 struct i2c_board_info *info;
2998 int len;
2999};
3000
3001static struct i2c_registry apq8064_i2c_devices[] __initdata = {
Jing Lin21ed4de2012-02-05 15:53:28 -08003002 {
David Keitel2f613d92012-02-15 11:29:16 -08003003 I2C_LIQUID,
3004 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
3005 smb349_charger_i2c_info,
3006 ARRAY_SIZE(smb349_charger_i2c_info)
3007 },
3008 {
Jing Lin21ed4de2012-02-05 15:53:28 -08003009 I2C_SURF | I2C_LIQUID,
3010 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
3011 mxt_device_info,
3012 ARRAY_SIZE(mxt_device_info),
3013 },
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08003014 {
3015 I2C_FFA,
3016 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
3017 cyttsp_info,
3018 ARRAY_SIZE(cyttsp_info),
3019 },
Amy Maloche70090f992012-02-16 16:35:26 -08003020 {
3021 I2C_FFA | I2C_LIQUID,
3022 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
3023 isa1200_board_info,
3024 ARRAY_SIZE(isa1200_board_info),
3025 },
Santosh Mardieff9a742012-04-09 23:23:39 +05303026 {
3027 I2C_MPQ_CDP,
3028 APQ_8064_GSBI5_QUP_I2C_BUS_ID,
3029 cs8427_device_info,
3030 ARRAY_SIZE(cs8427_device_info),
3031 },
Jing Lin417fa452012-02-05 14:31:06 -08003032};
3033
Jay Chokshi607f61b2012-04-25 18:21:21 -07003034#define SX150X_EXP1_INT_N PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9)
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05303035#define SX150X_EXP2_INT_N MSM_GPIO_TO_INT(81)
Jay Chokshi607f61b2012-04-25 18:21:21 -07003036
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003037struct sx150x_platform_data mpq8064_sx150x_pdata[] = {
3038 [SX150X_EXP1] = {
3039 .gpio_base = SX150X_EXP1_GPIO_BASE,
3040 .oscio_is_gpo = false,
3041 .io_pullup_ena = 0x0,
3042 .io_pulldn_ena = 0x0,
3043 .io_open_drain_ena = 0x0,
3044 .io_polarity = 0,
Jay Chokshi607f61b2012-04-25 18:21:21 -07003045 .irq_summary = SX150X_EXP1_INT_N,
3046 .irq_base = SX150X_EXP1_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003047 },
3048 [SX150X_EXP2] = {
3049 .gpio_base = SX150X_EXP2_GPIO_BASE,
3050 .oscio_is_gpo = false,
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05303051 .io_pullup_ena = 0x0f,
3052 .io_pulldn_ena = 0x70,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003053 .io_open_drain_ena = 0x0,
3054 .io_polarity = 0,
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05303055 .irq_summary = SX150X_EXP2_INT_N,
3056 .irq_base = SX150X_EXP2_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003057 },
3058 [SX150X_EXP3] = {
3059 .gpio_base = SX150X_EXP3_GPIO_BASE,
3060 .oscio_is_gpo = false,
3061 .io_pullup_ena = 0x0,
3062 .io_pulldn_ena = 0x0,
3063 .io_open_drain_ena = 0x0,
3064 .io_polarity = 0,
3065 .irq_summary = -1,
3066 },
3067 [SX150X_EXP4] = {
3068 .gpio_base = SX150X_EXP4_GPIO_BASE,
3069 .oscio_is_gpo = false,
3070 .io_pullup_ena = 0x0,
3071 .io_pulldn_ena = 0x0,
3072 .io_open_drain_ena = 0x0,
3073 .io_polarity = 0,
3074 .irq_summary = -1,
3075 },
3076};
3077
3078static struct i2c_board_info sx150x_gpio_exp_info[] = {
3079 {
3080 I2C_BOARD_INFO("sx1509q", 0x70),
3081 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP1],
3082 },
3083 {
3084 I2C_BOARD_INFO("sx1508q", 0x23),
3085 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP2],
3086 },
3087 {
3088 I2C_BOARD_INFO("sx1508q", 0x22),
3089 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP3],
3090 },
3091 {
3092 I2C_BOARD_INFO("sx1509q", 0x3E),
3093 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP4],
3094 },
3095};
3096
3097#define MPQ8064_I2C_GSBI5_BUS_ID 5
3098
3099static struct i2c_registry mpq8064_i2c_devices[] __initdata = {
3100 {
3101 I2C_MPQ_CDP,
3102 MPQ8064_I2C_GSBI5_BUS_ID,
3103 sx150x_gpio_exp_info,
3104 ARRAY_SIZE(sx150x_gpio_exp_info),
3105 },
3106};
3107
Jing Lin417fa452012-02-05 14:31:06 -08003108static void __init register_i2c_devices(void)
3109{
3110 u8 mach_mask = 0;
3111 int i;
3112
Kevin Chand07220e2012-02-13 15:52:22 -08003113#ifdef CONFIG_MSM_CAMERA
3114 struct i2c_registry apq8064_camera_i2c_devices = {
3115 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_RUMI,
3116 APQ_8064_GSBI4_QUP_I2C_BUS_ID,
3117 apq8064_camera_board_info.board_info,
3118 apq8064_camera_board_info.num_i2c_board_info,
3119 };
3120#endif
Jing Lin417fa452012-02-05 14:31:06 -08003121 /* Build the matching 'supported_machs' bitmask */
3122 if (machine_is_apq8064_cdp())
3123 mach_mask = I2C_SURF;
3124 else if (machine_is_apq8064_mtp())
3125 mach_mask = I2C_FFA;
3126 else if (machine_is_apq8064_liquid())
3127 mach_mask = I2C_LIQUID;
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003128 else if (PLATFORM_IS_MPQ8064())
3129 mach_mask = I2C_MPQ_CDP;
Jing Lin417fa452012-02-05 14:31:06 -08003130 else
3131 pr_err("unmatched machine ID in register_i2c_devices\n");
3132
3133 /* Run the array and install devices as appropriate */
3134 for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) {
3135 if (apq8064_i2c_devices[i].machs & mach_mask)
3136 i2c_register_board_info(apq8064_i2c_devices[i].bus,
3137 apq8064_i2c_devices[i].info,
3138 apq8064_i2c_devices[i].len);
3139 }
Kevin Chand07220e2012-02-13 15:52:22 -08003140#ifdef CONFIG_MSM_CAMERA
3141 if (apq8064_camera_i2c_devices.machs & mach_mask)
3142 i2c_register_board_info(apq8064_camera_i2c_devices.bus,
3143 apq8064_camera_i2c_devices.info,
3144 apq8064_camera_i2c_devices.len);
3145#endif
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003146
3147 for (i = 0; i < ARRAY_SIZE(mpq8064_i2c_devices); ++i) {
3148 if (mpq8064_i2c_devices[i].machs & mach_mask)
3149 i2c_register_board_info(
3150 mpq8064_i2c_devices[i].bus,
3151 mpq8064_i2c_devices[i].info,
3152 mpq8064_i2c_devices[i].len);
3153 }
Jing Lin417fa452012-02-05 14:31:06 -08003154}
3155
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003156static void enable_avc_i2c_bus(void)
3157{
3158 int avc_i2c_en_mpp = PM8921_MPP_PM_TO_SYS(8);
3159 int rc;
3160
3161 rc = gpio_request(avc_i2c_en_mpp, "avc_i2c_en");
3162 if (rc)
3163 pr_err("request for avc_i2c_en mpp failed,"
3164 "rc=%d\n", rc);
3165 else
3166 gpio_set_value_cansleep(avc_i2c_en_mpp, 1);
3167}
3168
David Collins6f7c3472012-08-22 13:18:06 -07003169/* Modify platform data values to match requirements for PM8917. */
3170static void __init apq8064_pm8917_pdata_fixup(void)
3171{
3172 cdp_keys_data.buttons = cdp_keys_pm8917;
3173 cdp_keys_data.nbuttons = ARRAY_SIZE(cdp_keys_pm8917);
3174}
3175
Mayank Ranae98f1e42013-02-22 19:58:59 +05303176#ifdef CONFIG_SERIAL_MSM_HS
3177static int configure_uartdm_gsbi4_gpios(int on)
3178{
3179 int ret = 0, i;
3180 int uart_gpios[] = {10, 11, 12, 13};
3181
3182 for (i = 0; i < ARRAY_SIZE(uart_gpios); i++) {
3183 if (on) {
3184 ret = gpio_request(uart_gpios[i], NULL);
3185 if (ret) {
3186 pr_err("%s: unable to request uart gpio[%d]\n",
3187 __func__, uart_gpios[i]);
3188 break;
3189 }
3190 } else {
3191 gpio_free(uart_gpios[i]);
3192 }
3193 }
3194
3195 if (ret && on && i)
3196 for (; i >= 0; i--)
3197 gpio_free(uart_gpios[i]);
3198 return ret;
3199}
3200
3201static struct msm_serial_hs_platform_data apq8064_uartdm_gsbi4_pdata = {
3202 .gpio_config = configure_uartdm_gsbi4_gpios,
3203};
3204#else
3205static struct msm_serial_hs_platform_data apq8064_uartdm_gsbi4_pdata;
3206#endif
3207
Anji Jonnala786b39e2013-01-29 13:34:10 +05303208static void __init apq8064ab_update_retention_spm(void)
3209{
3210 int i;
3211
3212 /* Update the SPM sequences for krait retention on all cores */
3213 for (i = 0; i < ARRAY_SIZE(msm_spm_data); i++) {
3214 int j;
3215 struct msm_spm_platform_data *pdata = &msm_spm_data[i];
3216 for (j = 0; j < pdata->num_modes; j++) {
3217 if (pdata->modes[j].cmd ==
3218 spm_retention_cmd_sequence)
3219 pdata->modes[j].cmd =
3220 spm_retention_with_krait_v3_cmd_sequence;
3221 }
3222 }
3223}
3224
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003225static void __init apq8064_common_init(void)
3226{
Ameya Thakur2702baf2013-01-30 11:55:25 -08003227 u32 platform_version = socinfo_get_platform_version();
David Collins6f7c3472012-08-22 13:18:06 -07003228
3229 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
3230 apq8064_pm8917_pdata_fixup();
Rohit Vaswanib1cc4932012-07-23 21:30:11 -07003231 platform_device_register(&msm_gpio_device);
Praveen Chidambaram4908abf2013-03-06 18:10:15 -07003232 if (cpu_is_apq8064ab())
3233 apq8064ab_update_krait_spm();
3234 if (cpu_is_krait_v3()) {
3235 msm_pm_set_tz_retention_flag(0);
3236 apq8064ab_update_retention_spm();
3237 } else {
3238 msm_pm_set_tz_retention_flag(1);
3239 }
3240 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3241 msm_spm_l2_init(msm_spm_l2_data);
Joel King8f839b92012-04-01 14:37:46 -07003242 msm_tsens_early_init(&apq_tsens_pdata);
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06003243 msm_thermal_init(&msm_thermal_pdata);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003244 if (socinfo_init() < 0)
3245 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06003246 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
3247 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
David Collins2782b5c2012-02-06 10:02:42 -08003248 regulator_suppress_info_printing();
David Collins36199252012-08-21 15:43:02 -07003249 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
3250 configure_apq8064_pm8917_power_grid();
David Collins2782b5c2012-02-06 10:02:42 -08003251 platform_device_register(&apq8064_device_rpm_regulator);
David Collins36199252012-08-21 15:43:02 -07003252 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917)
3253 platform_device_register(&apq8064_pm8921_device_rpm_regulator);
Stephen Boyd4d0d2582012-02-10 14:49:40 -08003254 if (msm_xo_init())
3255 pr_err("Failed to initialize XO votes\n");
Matt Wagantallc51e5602012-02-27 17:25:25 -08003256 msm_clock_init(&apq8064_clock_init_data);
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08003257 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06003258 apq8064_i2c_init();
Jing Lin417fa452012-02-05 14:31:06 -08003259 register_i2c_devices();
Kenneth Heitke36920d32011-07-20 16:44:30 -06003260
Harini Jayaramanc4c58692011-07-19 14:50:10 -06003261 apq8064_device_qup_spi_gsbi5.dev.platform_data =
3262 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08003263 apq8064_init_pmic();
Hemant Kumar94e7da22012-02-03 16:52:29 -08003264 if (machine_is_apq8064_liquid())
3265 msm_otg_pdata.mhl_enable = true;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07003266
Ofir Cohen94213a72012-05-03 14:26:32 +03003267 android_usb_pdata.swfi_latency =
3268 msm_rpmrs_levels[0].latency_us;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07003269
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003270 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Manu Gautam91223e02011-11-08 15:27:22 +05303271 apq8064_ehci_host_init();
Gagan Mac8a7a5d32011-11-11 16:43:06 -07003272 apq8064_init_buses();
David Collins36199252012-08-21 15:43:02 -07003273
3274 platform_add_devices(early_common_devices,
3275 ARRAY_SIZE(early_common_devices));
3276 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917)
3277 platform_add_devices(pm8921_common_devices,
3278 ARRAY_SIZE(pm8921_common_devices));
3279 else
3280 platform_add_devices(pm8917_common_devices,
3281 ARRAY_SIZE(pm8917_common_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003282 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Terence Hampson36b70722012-05-10 13:18:16 -04003283 if (!(machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
Mayank Ranae98f1e42013-02-22 19:58:59 +05303284 machine_is_mpq8064_dtv())) {
Terence Hampson36b70722012-05-10 13:18:16 -04003285 platform_add_devices(common_not_mpq_devices,
3286 ARRAY_SIZE(common_not_mpq_devices));
Mayank Ranae98f1e42013-02-22 19:58:59 +05303287
3288 /* Add GSBI4 I2C Device for non-fusion3 platform */
3289 if (socinfo_get_platform_subtype() !=
3290 PLATFORM_SUBTYPE_SGLTE2) {
3291 platform_device_register(&apq8064_device_qup_i2c_gsbi4);
3292 }
3293 }
3294
Pavankumar Kondetife2d4d32012-09-07 15:33:09 +05303295 msm_hsic_pdata.swfi_latency =
3296 msm_rpmrs_levels[0].latency_us;
Hemant Kumarf1ca9192012-02-07 18:59:33 -08003297 if (machine_is_apq8064_mtp()) {
Ajay Dudanic4e40db2012-08-20 14:44:40 -07003298 msm_hsic_pdata.log2_irq_thresh = 5,
Hemant Kumarf1ca9192012-02-07 18:59:33 -08003299 apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
3300 device_initialize(&apq8064_device_hsic_host.dev);
Ameya Thakur2702baf2013-01-30 11:55:25 -08003301 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_DSDA2) {
3302 apq8064_device_ehci_host3.dev.platform_data =
3303 &msm_ehci_host_pdata3;
3304 device_initialize(&apq8064_device_ehci_host3.dev);
3305 }
Hemant Kumarf1ca9192012-02-07 18:59:33 -08003306 }
Jay Chokshie8741282012-01-25 15:22:55 -08003307 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05303308 apq8064_init_mmc();
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08003309
3310 if (machine_is_apq8064_mtp()) {
Ameya Thakur2702baf2013-01-30 11:55:25 -08003311 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_DSDA2) {
Joel Kingfdde32b2013-02-06 17:38:05 -08003312 amdm_8064_device.dev.platform_data =
3313 &amdm_platform_data;
Ameya Thakur2702baf2013-01-30 11:55:25 -08003314 platform_device_register(&amdm_8064_device);
3315 bmdm_8064_device.dev.platform_data =
3316 &bmdm_platform_data;
3317 platform_device_register(&bmdm_8064_device);
Joel King3166e892013-02-26 11:16:08 -08003318 } else if (socinfo_get_platform_subtype() ==
3319 PLATFORM_SUBTYPE_SGLTE2) {
3320 sglte_mdm_8064_device.dev.platform_data =
Joel King57aefdd2013-03-11 13:46:05 -07003321 &sglte2_mdm_platform_data;
Joel King3166e892013-02-26 11:16:08 -08003322 platform_device_register(&sglte_mdm_8064_device);
3323 sglte2_qsc_8064_device.dev.platform_data =
3324 &sglte2_qsc_platform_data;
3325 platform_device_register(&sglte2_qsc_8064_device);
Mayank Ranae98f1e42013-02-22 19:58:59 +05303326
3327 /* GSBI4 UART device for Primay IPC */
3328 apq8064_uartdm_gsbi4_pdata.wakeup_irq = gpio_to_irq(10);
3329 apq8064_device_uartdm_gsbi4.dev.platform_data =
3330 &apq8064_uartdm_gsbi4_pdata;
3331 platform_device_register(&apq8064_device_uartdm_gsbi4);
Ameya Thakur2702baf2013-01-30 11:55:25 -08003332 } else if (SOCINFO_VERSION_MINOR(platform_version) == 1) {
Ameya Thakure155ece2012-07-09 12:08:37 -07003333 i2s_mdm_8064_device.dev.platform_data =
3334 &mdm_platform_data;
3335 platform_device_register(&i2s_mdm_8064_device);
3336 } else {
3337 mdm_8064_device.dev.platform_data = &mdm_platform_data;
3338 platform_device_register(&mdm_8064_device);
3339 }
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08003340 }
3341 platform_device_register(&apq8064_slim_ctrl);
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06003342 slim_register_board_info(apq8064_slim_devices,
3343 ARRAY_SIZE(apq8064_slim_devices));
Taniya Dasbbf633d2012-07-31 16:07:47 +05303344 if (!PLATFORM_IS_MPQ8064()) {
Taniya Das30cae292012-07-31 15:56:12 +05303345 apq8064_init_dsps();
Taniya Dasbbf633d2012-07-31 16:07:47 +05303346 platform_device_register(&msm_8960_riva);
3347 }
Praveen Chidambaram78499012011-11-01 17:15:17 -06003348 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08003349 apq8064_epm_adc_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003350}
3351
Huaibin Yang4a084e32011-12-15 15:25:52 -08003352static void __init apq8064_allocate_memory_regions(void)
3353{
3354 apq8064_allocate_fb_region();
3355}
3356
Joel King82b7e3f2012-01-05 10:03:27 -08003357static void __init apq8064_cdp_init(void)
3358{
Hanumant Singh50440d42012-04-23 19:27:16 -07003359 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
3360 pr_err("meminfo_init() failed!\n");
Amy Maloche609bb5e2012-08-03 09:41:42 -07003361 if (machine_is_apq8064_mtp() &&
3362 SOCINFO_VERSION_MINOR(socinfo_get_platform_version()) == 1)
3363 cyttsp_pdata.sleep_gpio = CYTTSP_TS_GPIO_SLEEP_ALT;
Joel King82b7e3f2012-01-05 10:03:27 -08003364 apq8064_common_init();
Joel King8f839b92012-04-01 14:37:46 -07003365 if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
3366 machine_is_mpq8064_dtv()) {
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003367 enable_avc_i2c_bus();
Olav Hauganef95ae32012-05-15 09:50:30 -07003368 msm_rotator_set_split_iommu_domain();
Joel King8f839b92012-04-01 14:37:46 -07003369 platform_add_devices(mpq_devices, ARRAY_SIZE(mpq_devices));
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06003370 mpq8064_pcie_init();
Joel King8f839b92012-04-01 14:37:46 -07003371 } else {
3372 ethernet_init();
Olav Hauganef95ae32012-05-15 09:50:30 -07003373 msm_rotator_set_split_iommu_domain();
Joel King8f839b92012-04-01 14:37:46 -07003374 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
3375 spi_register_board_info(spi_board_info,
3376 ARRAY_SIZE(spi_board_info));
3377 }
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003378 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07003379 apq8064_init_gpu();
Matt Wagantall1f65d9d2012-04-25 14:24:20 -07003380 platform_add_devices(apq8064_footswitch, apq8064_num_footswitch);
Steve Mucklef132c6c2012-06-06 18:30:57 -07003381#ifdef CONFIG_MSM_CAMERA
Kevin Chand07220e2012-02-13 15:52:22 -08003382 apq8064_init_cam();
Steve Mucklef132c6c2012-06-06 18:30:57 -07003383#endif
Mohan Pallaka474b94b2012-01-25 12:59:58 +05303384
3385 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
3386 platform_device_register(&cdp_kp_pdev);
3387
3388 if (machine_is_apq8064_mtp())
3389 platform_device_register(&mtp_kp_pdev);
Hanumant Singh50440d42012-04-23 19:27:16 -07003390
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05303391 if (machine_is_mpq8064_cdp()) {
3392 platform_device_register(&mpq_gpio_keys_pdev);
3393 platform_device_register(&mpq_keypad_device);
3394 }
Joel King82b7e3f2012-01-05 10:03:27 -08003395}
3396
Joel King82b7e3f2012-01-05 10:03:27 -08003397MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
3398 .map_io = apq8064_map_io,
3399 .reserve = apq8064_reserve,
3400 .init_irq = apq8064_init_irq,
3401 .handle_irq = gic_handle_irq,
3402 .timer = &msm_timer,
3403 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003404 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003405 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003406 .restart = msm_restart,
Joel King82b7e3f2012-01-05 10:03:27 -08003407MACHINE_END
3408
3409MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
3410 .map_io = apq8064_map_io,
3411 .reserve = apq8064_reserve,
3412 .init_irq = apq8064_init_irq,
3413 .handle_irq = gic_handle_irq,
3414 .timer = &msm_timer,
3415 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003416 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003417 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003418 .restart = msm_restart,
Joel King82b7e3f2012-01-05 10:03:27 -08003419MACHINE_END
3420
3421MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
3422 .map_io = apq8064_map_io,
3423 .reserve = apq8064_reserve,
3424 .init_irq = apq8064_init_irq,
3425 .handle_irq = gic_handle_irq,
3426 .timer = &msm_timer,
3427 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003428 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003429 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003430 .restart = msm_restart,
Joel King82b7e3f2012-01-05 10:03:27 -08003431MACHINE_END
3432
Joel King064bbf82012-04-01 13:23:39 -07003433MACHINE_START(MPQ8064_CDP, "QCT MPQ8064 CDP")
3434 .map_io = apq8064_map_io,
3435 .reserve = apq8064_reserve,
3436 .init_irq = apq8064_init_irq,
3437 .handle_irq = gic_handle_irq,
3438 .timer = &msm_timer,
3439 .init_machine = apq8064_cdp_init,
3440 .init_early = apq8064_allocate_memory_regions,
3441 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003442 .restart = msm_restart,
Joel King064bbf82012-04-01 13:23:39 -07003443MACHINE_END
3444
Joel King11ca8202012-02-13 16:19:03 -08003445MACHINE_START(MPQ8064_HRD, "QCT MPQ8064 HRD")
3446 .map_io = apq8064_map_io,
3447 .reserve = apq8064_reserve,
3448 .init_irq = apq8064_init_irq,
3449 .handle_irq = gic_handle_irq,
3450 .timer = &msm_timer,
3451 .init_machine = apq8064_cdp_init,
Joel King3a57e772012-05-28 11:22:55 -07003452 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003453 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003454 .restart = msm_restart,
Joel King11ca8202012-02-13 16:19:03 -08003455MACHINE_END
3456
3457MACHINE_START(MPQ8064_DTV, "QCT MPQ8064 DTV")
3458 .map_io = apq8064_map_io,
3459 .reserve = apq8064_reserve,
3460 .init_irq = apq8064_init_irq,
3461 .handle_irq = gic_handle_irq,
3462 .timer = &msm_timer,
3463 .init_machine = apq8064_cdp_init,
Joel King3a57e772012-05-28 11:22:55 -07003464 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003465 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003466 .restart = msm_restart,
Joel King11ca8202012-02-13 16:19:03 -08003467MACHINE_END
3468