blob: 9501d3b1855110a764c8b88cf8295f1952c4377f [file] [log] [blame]
Abhijeet Dharmapurikarde91d2c2012-08-23 14:36:59 -07001/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13#include <linux/kernel.h>
Niranjana Vishwanathapurac1edd402012-06-28 15:32:50 -060014#include <linux/bitops.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070015#include <linux/platform_device.h>
Steve Mucklef132c6c2012-06-06 18:30:57 -070016#include <linux/gpio.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070017#include <linux/io.h>
18#include <linux/irq.h>
Kenneth Heitke748593a2011-07-15 15:45:11 -060019#include <linux/i2c.h>
David Keitel2f613d92012-02-15 11:29:16 -080020#include <linux/i2c/smb349.h>
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -080021#include <linux/i2c/sx150x.h>
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -060022#include <linux/slimbus/slimbus.h>
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +053023#include <linux/mfd/wcd9xxx/core.h>
24#include <linux/mfd/wcd9xxx/pdata.h>
Amy Maloche70090f992012-02-16 16:35:26 -080025#include <linux/mfd/pm8xxx/misc.h>
Kenneth Heitke36920d32011-07-20 16:44:30 -060026#include <linux/msm_ssbi.h>
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -070027#include <linux/spi/spi.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070028#include <linux/dma-mapping.h>
29#include <linux/platform_data/qcom_crypto_device.h>
Mitchel Humpherys6ff930c2012-09-06 11:32:54 -070030#include <linux/msm_ion.h>
Jack Cheung46bfffa2012-01-19 15:26:24 -080031#include <linux/memory.h>
Larry Bassel67b921d2012-04-06 10:23:27 -070032#include <linux/memblock.h>
Praveen Chidambaram877d7a42012-06-05 14:33:20 -060033#include <linux/msm_thermal.h>
Jing Lin21ed4de2012-02-05 15:53:28 -080034#include <linux/i2c/atmel_mxt_ts.h>
Steve Mucklef132c6c2012-06-06 18:30:57 -070035#include <linux/cyttsp-qc.h>
Amy Maloche70090f992012-02-16 16:35:26 -080036#include <linux/i2c/isa1200.h>
Mohan Pallaka474b94b2012-01-25 12:59:58 +053037#include <linux/gpio_keys.h>
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -080038#include <linux/epm_adc.h>
Jay Chokshie7d8d4f2012-04-04 14:47:57 -070039#include <linux/i2c/sx150x.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070040#include <asm/mach-types.h>
41#include <asm/mach/arch.h>
42#include <asm/hardware/gic.h>
Sahitya Tummala3586ed92011-08-03 09:13:23 +053043#include <asm/mach/mmc.h>
Ankit Verma6b7e2ba2012-01-26 15:48:54 -080044#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070045
46#include <mach/board.h>
47#include <mach/msm_iomap.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080048#include <mach/ion.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070049#include <linux/usb/msm_hsusb.h>
50#include <linux/usb/android.h>
51#include <mach/socinfo.h>
Harini Jayaramanc4c58692011-07-19 14:50:10 -060052#include <mach/msm_spi.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070053#include "timer.h"
54#include "devices.h"
Joel King4ebccc62011-07-22 09:43:22 -070055#include <mach/gpiomux.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060056#include <mach/rpm.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080057#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -070058#include <linux/android_pmem.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080059#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070060#include <mach/msm_memtypes.h>
61#include <linux/bootmem.h>
62#include <asm/setup.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070063#include <mach/dma.h>
Jin Hongd3024e62012-02-09 16:13:32 -080064#include <mach/msm_dsps.h>
Gagan Mac8a7a5d32011-11-11 16:43:06 -070065#include <mach/msm_bus_board.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060066#include <mach/cpuidle.h>
Joel Kingdacbc822012-01-25 13:30:57 -080067#include <mach/mdm2.h>
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -080068#include <linux/msm_tsens.h>
Stephen Boyd4d0d2582012-02-10 14:49:40 -080069#include <mach/msm_xo.h>
Laura Abbott350c8362012-02-28 14:46:52 -080070#include <mach/msm_rtb.h>
Santosh Mardieff9a742012-04-09 23:23:39 +053071#include <sound/cs8427.h>
Ravi Kumar V05931a22012-04-04 17:09:37 +053072#include <media/gpio-ir-recv.h>
Larry Bassel67b921d2012-04-06 10:23:27 -070073#include <linux/fmem.h>
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -060074#include <mach/msm_pcie.h>
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -070075#include <mach/restart.h>
Niranjana Vishwanathapurac1edd402012-06-28 15:32:50 -060076#include <mach/msm_iomap.h>
Joel King4ebccc62011-07-22 09:43:22 -070077
Jeff Ohlstein7e668552011-10-06 16:17:25 -070078#include "msm_watchdog.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080079#include "board-8064.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060080#include "spm.h"
Subhash Jadavani909e04f2012-04-12 10:52:50 +053081#include <mach/mpm.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060082#include "rpm_resources.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080083#include "pm.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060084#include "pm-boot.h"
Rajesh Sastrulaaee8af32012-01-20 11:46:31 -080085#include "devices-msm8x60.h"
Hanumant Singh50440d42012-04-23 19:27:16 -070086#include "smd_private.h"
Jay Chokshiea67c622011-07-29 17:12:26 -070087
Olav Haugan7c6aa742012-01-16 16:47:37 -080088#define MSM_PMEM_ADSP_SIZE 0x7800000
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -070089#define MSM_PMEM_AUDIO_SIZE 0x4CF000
Olav Haugan7c6aa742012-01-16 16:47:37 -080090#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
91#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
92#else
Chetan Kalyan72aac4f2012-02-23 14:56:54 -080093#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Olav Haugan7c6aa742012-01-16 16:47:37 -080094#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070095
Olav Haugan7c6aa742012-01-16 16:47:37 -080096#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Hanumant Singheadb7502012-05-15 18:14:04 -070097#define HOLE_SIZE 0x20000
Mitchel Humpherys05e58812012-08-13 14:24:13 -070098#define MSM_CONTIG_MEM_SIZE 0x65000
Olav Haugan129992c2012-03-22 09:54:01 -070099#ifdef CONFIG_MSM_IOMMU
100#define MSM_ION_MM_SIZE 0x3800000
101#define MSM_ION_SF_SIZE 0
Olav Haugan39477bb2012-05-14 16:05:36 -0700102#define MSM_ION_QSECOM_SIZE 0x780000 /* (7.5MB) */
Olav Haugan129992c2012-03-22 09:54:01 -0700103#define MSM_ION_HEAP_NUM 7
104#else
Olav Haugan7c6aa742012-01-16 16:47:37 -0800105#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Haugan129992c2012-03-22 09:54:01 -0700106#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Haugan39477bb2012-05-14 16:05:36 -0700107#define MSM_ION_QSECOM_SIZE 0x600000 /* (6MB) */
Olav Haugan129992c2012-03-22 09:54:01 -0700108#define MSM_ION_HEAP_NUM 8
109#endif
Hanumant Singheadb7502012-05-15 18:14:04 -0700110#define MSM_ION_MM_FW_SIZE (0x200000 - HOLE_SIZE) /* (2MB - 128KB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800111#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan2c43fac2012-01-19 11:06:37 -0800112#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Olav Haugan7c6aa742012-01-16 16:47:37 -0800113#else
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700114#define MSM_CONTIG_MEM_SIZE 0x110C000
Olav Haugan7c6aa742012-01-16 16:47:37 -0800115#define MSM_ION_HEAP_NUM 1
116#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700117
Hanumant Singheadb7502012-05-15 18:14:04 -0700118#define APQ8064_FIXED_AREA_START (0xa0000000 - (MSM_ION_MM_FW_SIZE + \
119 HOLE_SIZE))
Larry Bassel67b921d2012-04-06 10:23:27 -0700120#define MAX_FIXED_AREA_SIZE 0x10000000
Hanumant Singheadb7502012-05-15 18:14:04 -0700121#define MSM_MM_FW_SIZE (0x200000 - HOLE_SIZE)
122#define APQ8064_FW_START APQ8064_FIXED_AREA_START
Larry Bassel67b921d2012-04-06 10:23:27 -0700123
Niranjana Vishwanathapurac1edd402012-06-28 15:32:50 -0600124#define QFPROM_RAW_FEAT_CONFIG_ROW0_MSB (MSM_QFPROM_BASE + 0x23c)
125#define QFPROM_RAW_OEM_CONFIG_ROW0_LSB (MSM_QFPROM_BASE + 0x220)
126
Niranjana Vishwanathapura68210ff2012-06-24 18:03:49 -0600127/* PCIE AXI address space */
128#define PCIE_AXI_BAR_PHYS 0x08000000
129#define PCIE_AXI_BAR_SIZE SZ_128M
130
Niranjana Vishwanathapura459a27d2012-07-20 12:23:55 -0600131/* PCIe pmic gpios */
132#define PCIE_WAKE_N_PMIC_GPIO 12
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -0600133#define PCIE_PWR_EN_PMIC_GPIO 13
134#define PCIE_RST_N_PMIC_MPP 1
135
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700136#ifdef CONFIG_KERNEL_MSM_CONTIG_MEM_REGION
137static unsigned msm_contig_mem_size = MSM_CONTIG_MEM_SIZE;
138static int __init msm_contig_mem_size_setup(char *p)
Kevin Chan13be4e22011-10-20 11:30:32 -0700139{
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700140 msm_contig_mem_size = memparse(p, NULL);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800141 return 0;
Kevin Chan13be4e22011-10-20 11:30:32 -0700142}
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700143early_param("msm_contig_mem_size", msm_contig_mem_size_setup);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800144#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700145
Olav Haugan7c6aa742012-01-16 16:47:37 -0800146#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -0700147static unsigned pmem_size = MSM_PMEM_SIZE;
148static int __init pmem_size_setup(char *p)
149{
150 pmem_size = memparse(p, NULL);
151 return 0;
152}
153early_param("pmem_size", pmem_size_setup);
154
155static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
156
157static int __init pmem_adsp_size_setup(char *p)
158{
159 pmem_adsp_size = memparse(p, NULL);
160 return 0;
161}
162early_param("pmem_adsp_size", pmem_adsp_size_setup);
163
164static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
165
166static int __init pmem_audio_size_setup(char *p)
167{
168 pmem_audio_size = memparse(p, NULL);
169 return 0;
170}
171early_param("pmem_audio_size", pmem_audio_size_setup);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800172#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700173
Olav Haugan7c6aa742012-01-16 16:47:37 -0800174#ifdef CONFIG_ANDROID_PMEM
175#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700176static struct android_pmem_platform_data android_pmem_pdata = {
177 .name = "pmem",
178 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
179 .cached = 1,
180 .memory_type = MEMTYPE_EBI1,
181};
182
Laura Abbottb93525f2012-04-12 09:57:19 -0700183static struct platform_device apq8064_android_pmem_device = {
Kevin Chan13be4e22011-10-20 11:30:32 -0700184 .name = "android_pmem",
185 .id = 0,
186 .dev = {.platform_data = &android_pmem_pdata},
187};
188
189static struct android_pmem_platform_data android_pmem_adsp_pdata = {
190 .name = "pmem_adsp",
191 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
192 .cached = 0,
193 .memory_type = MEMTYPE_EBI1,
194};
Laura Abbottb93525f2012-04-12 09:57:19 -0700195static struct platform_device apq8064_android_pmem_adsp_device = {
Kevin Chan13be4e22011-10-20 11:30:32 -0700196 .name = "android_pmem",
197 .id = 2,
198 .dev = { .platform_data = &android_pmem_adsp_pdata },
199};
200
201static struct android_pmem_platform_data android_pmem_audio_pdata = {
202 .name = "pmem_audio",
203 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
204 .cached = 0,
205 .memory_type = MEMTYPE_EBI1,
206};
207
Laura Abbottb93525f2012-04-12 09:57:19 -0700208static struct platform_device apq8064_android_pmem_audio_device = {
Kevin Chan13be4e22011-10-20 11:30:32 -0700209 .name = "android_pmem",
210 .id = 4,
211 .dev = { .platform_data = &android_pmem_audio_pdata },
212};
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700213#endif /* CONFIG_MSM_MULTIMEDIA_USE_ION */
214#endif /* CONFIG_ANDROID_PMEM */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800215
Larry Bassel67b921d2012-04-06 10:23:27 -0700216struct fmem_platform_data apq8064_fmem_pdata = {
217};
218
Olav Haugan7c6aa742012-01-16 16:47:37 -0800219static struct memtype_reserve apq8064_reserve_table[] __initdata = {
220 [MEMTYPE_SMI] = {
221 },
222 [MEMTYPE_EBI0] = {
223 .flags = MEMTYPE_FLAGS_1M_ALIGN,
224 },
225 [MEMTYPE_EBI1] = {
226 .flags = MEMTYPE_FLAGS_1M_ALIGN,
227 },
228};
Kevin Chan13be4e22011-10-20 11:30:32 -0700229
Laura Abbott350c8362012-02-28 14:46:52 -0800230static void __init reserve_rtb_memory(void)
231{
232#if defined(CONFIG_MSM_RTB)
Laura Abbottb93525f2012-04-12 09:57:19 -0700233 apq8064_reserve_table[MEMTYPE_EBI1].size += apq8064_rtb_pdata.size;
Laura Abbott350c8362012-02-28 14:46:52 -0800234#endif
235}
236
237
Kevin Chan13be4e22011-10-20 11:30:32 -0700238static void __init size_pmem_devices(void)
239{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800240#ifdef CONFIG_ANDROID_PMEM
241#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700242 android_pmem_adsp_pdata.size = pmem_adsp_size;
243 android_pmem_pdata.size = pmem_size;
244 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700245#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
246#endif /*CONFIG_ANDROID_PMEM*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700247}
248
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700249#ifdef CONFIG_ANDROID_PMEM
250#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700251static void __init reserve_memory_for(struct android_pmem_platform_data *p)
252{
253 apq8064_reserve_table[p->memory_type].size += p->size;
254}
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700255#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
256#endif /*CONFIG_ANDROID_PMEM*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700257
Kevin Chan13be4e22011-10-20 11:30:32 -0700258static void __init reserve_pmem_memory(void)
259{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800260#ifdef CONFIG_ANDROID_PMEM
261#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700262 reserve_memory_for(&android_pmem_adsp_pdata);
263 reserve_memory_for(&android_pmem_pdata);
264 reserve_memory_for(&android_pmem_audio_pdata);
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700265#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700266 apq8064_reserve_table[MEMTYPE_EBI1].size += msm_contig_mem_size;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700267#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -0800268}
269
270static int apq8064_paddr_to_memtype(unsigned int paddr)
271{
272 return MEMTYPE_EBI1;
273}
274
Steve Mucklef132c6c2012-06-06 18:30:57 -0700275#define FMEM_ENABLED 0
Larry Bassel67b921d2012-04-06 10:23:27 -0700276
Olav Haugan7c6aa742012-01-16 16:47:37 -0800277#ifdef CONFIG_ION_MSM
278#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -0700279static struct ion_cp_heap_pdata cp_mm_apq8064_ion_pdata = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800280 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugand3d29682012-01-19 10:57:07 -0800281 .align = PAGE_SIZE,
Larry Bassel67b921d2012-04-06 10:23:27 -0700282 .reusable = FMEM_ENABLED,
283 .mem_is_fmem = FMEM_ENABLED,
284 .fixed_position = FIXED_MIDDLE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800285};
286
Laura Abbottb93525f2012-04-12 09:57:19 -0700287static struct ion_cp_heap_pdata cp_mfc_apq8064_ion_pdata = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800288 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugand3d29682012-01-19 10:57:07 -0800289 .align = PAGE_SIZE,
Larry Bassel67b921d2012-04-06 10:23:27 -0700290 .reusable = 0,
291 .mem_is_fmem = FMEM_ENABLED,
292 .fixed_position = FIXED_HIGH,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800293};
294
Laura Abbottb93525f2012-04-12 09:57:19 -0700295static struct ion_co_heap_pdata co_apq8064_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800296 .adjacent_mem_id = INVALID_HEAP_ID,
297 .align = PAGE_SIZE,
Larry Bassel67b921d2012-04-06 10:23:27 -0700298 .mem_is_fmem = 0,
Olav Haugand3d29682012-01-19 10:57:07 -0800299};
300
Laura Abbottb93525f2012-04-12 09:57:19 -0700301static struct ion_co_heap_pdata fw_co_apq8064_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800302 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
303 .align = SZ_128K,
Larry Bassel67b921d2012-04-06 10:23:27 -0700304 .mem_is_fmem = FMEM_ENABLED,
305 .fixed_position = FIXED_LOW,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800306};
307#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800308
309/**
310 * These heaps are listed in the order they will be allocated. Due to
311 * video hardware restrictions and content protection the FW heap has to
312 * be allocated adjacent (below) the MM heap and the MFC heap has to be
313 * allocated after the MM heap to ensure MFC heap is not more than 256MB
314 * away from the base address of the FW heap.
315 * However, the order of FW heap and MM heap doesn't matter since these
316 * two heaps are taken care of by separate code to ensure they are adjacent
317 * to each other.
318 * Don't swap the order unless you know what you are doing!
319 */
Benjamin Gaignardb2d367c2012-06-25 15:27:30 -0700320struct ion_platform_heap apq8064_heaps[] = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800321 {
322 .id = ION_SYSTEM_HEAP_ID,
323 .type = ION_HEAP_TYPE_SYSTEM,
324 .name = ION_VMALLOC_HEAP_NAME,
325 },
326#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
327 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800328 .id = ION_CP_MM_HEAP_ID,
329 .type = ION_HEAP_TYPE_CP,
330 .name = ION_MM_HEAP_NAME,
331 .size = MSM_ION_MM_SIZE,
332 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700333 .extra_data = (void *) &cp_mm_apq8064_ion_pdata,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800334 },
335 {
Olav Haugand3d29682012-01-19 10:57:07 -0800336 .id = ION_MM_FIRMWARE_HEAP_ID,
337 .type = ION_HEAP_TYPE_CARVEOUT,
338 .name = ION_MM_FIRMWARE_HEAP_NAME,
339 .size = MSM_ION_MM_FW_SIZE,
340 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700341 .extra_data = (void *) &fw_co_apq8064_ion_pdata,
Olav Haugand3d29682012-01-19 10:57:07 -0800342 },
343 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800344 .id = ION_CP_MFC_HEAP_ID,
345 .type = ION_HEAP_TYPE_CP,
346 .name = ION_MFC_HEAP_NAME,
347 .size = MSM_ION_MFC_SIZE,
348 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700349 .extra_data = (void *) &cp_mfc_apq8064_ion_pdata,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800350 },
Olav Haugan129992c2012-03-22 09:54:01 -0700351#ifndef CONFIG_MSM_IOMMU
Olav Haugan7c6aa742012-01-16 16:47:37 -0800352 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800353 .id = ION_SF_HEAP_ID,
354 .type = ION_HEAP_TYPE_CARVEOUT,
355 .name = ION_SF_HEAP_NAME,
356 .size = MSM_ION_SF_SIZE,
357 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700358 .extra_data = (void *) &co_apq8064_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800359 },
Olav Haugan129992c2012-03-22 09:54:01 -0700360#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800361 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800362 .id = ION_IOMMU_HEAP_ID,
363 .type = ION_HEAP_TYPE_IOMMU,
364 .name = ION_IOMMU_HEAP_NAME,
365 },
Olav Hauganf45e2142012-01-19 11:01:01 -0800366 {
367 .id = ION_QSECOM_HEAP_ID,
368 .type = ION_HEAP_TYPE_CARVEOUT,
369 .name = ION_QSECOM_HEAP_NAME,
370 .size = MSM_ION_QSECOM_SIZE,
371 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700372 .extra_data = (void *) &co_apq8064_ion_pdata,
Olav Hauganf45e2142012-01-19 11:01:01 -0800373 },
Olav Haugan2c43fac2012-01-19 11:06:37 -0800374 {
375 .id = ION_AUDIO_HEAP_ID,
376 .type = ION_HEAP_TYPE_CARVEOUT,
377 .name = ION_AUDIO_HEAP_NAME,
378 .size = MSM_ION_AUDIO_SIZE,
379 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700380 .extra_data = (void *) &co_apq8064_ion_pdata,
Olav Haugan2c43fac2012-01-19 11:06:37 -0800381 },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800382#endif
Benjamin Gaignardb2d367c2012-06-25 15:27:30 -0700383};
384
385static struct ion_platform_data apq8064_ion_pdata = {
386 .nr = MSM_ION_HEAP_NUM,
387 .heaps = apq8064_heaps,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800388};
389
Laura Abbottb93525f2012-04-12 09:57:19 -0700390static struct platform_device apq8064_ion_dev = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800391 .name = "ion-msm",
392 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700393 .dev = { .platform_data = &apq8064_ion_pdata },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800394};
395#endif
396
Larry Bassel67b921d2012-04-06 10:23:27 -0700397static struct platform_device apq8064_fmem_device = {
398 .name = "fmem",
399 .id = 1,
400 .dev = { .platform_data = &apq8064_fmem_pdata },
401};
402
403static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
404 unsigned long size)
405{
406 apq8064_reserve_table[mem_type].size += size;
407}
408
409static void __init apq8064_reserve_fixed_area(unsigned long fixed_area_size)
410{
411#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
412 int ret;
413
414 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
415 panic("fixed area size is larger than %dM\n",
416 MAX_FIXED_AREA_SIZE >> 20);
417
418 reserve_info->fixed_area_size = fixed_area_size;
419 reserve_info->fixed_area_start = APQ8064_FW_START;
420
421 ret = memblock_remove(reserve_info->fixed_area_start,
422 reserve_info->fixed_area_size);
423 BUG_ON(ret);
424#endif
425}
426
427/**
428 * Reserve memory for ION and calculate amount of reusable memory for fmem.
429 * We only reserve memory for heaps that are not reusable. However, we only
430 * support one reusable heap at the moment so we ignore the reusable flag for
431 * other than the first heap with reusable flag set. Also handle special case
432 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
433 * at a higher address than FW in addition to not more than 256MB away from the
434 * base address of the firmware. This means that if MM is reusable the other
435 * two heaps must be allocated in the same region as FW. This is handled by the
436 * mem_is_fmem flag in the platform data. In addition the MM heap must be
437 * adjacent to the FW heap for content protection purposes.
438 */
Stephen Boyd668d7652012-04-25 11:31:01 -0700439static void __init reserve_ion_memory(void)
Olav Haugan7c6aa742012-01-16 16:47:37 -0800440{
441#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Larry Bassel67b921d2012-04-06 10:23:27 -0700442 unsigned int i;
443 unsigned int reusable_count = 0;
444 unsigned int fixed_size = 0;
445 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
446 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
447
448 apq8064_fmem_pdata.size = 0;
449 apq8064_fmem_pdata.reserved_size_low = 0;
450 apq8064_fmem_pdata.reserved_size_high = 0;
Olav Haugan62436252012-05-16 09:09:43 -0700451 apq8064_fmem_pdata.align = PAGE_SIZE;
Larry Bassel67b921d2012-04-06 10:23:27 -0700452 fixed_low_size = 0;
453 fixed_middle_size = 0;
454 fixed_high_size = 0;
455
456 /* We only support 1 reusable heap. Check if more than one heap
457 * is specified as reusable and set as non-reusable if found.
458 */
459 for (i = 0; i < apq8064_ion_pdata.nr; ++i) {
460 const struct ion_platform_heap *heap =
461 &(apq8064_ion_pdata.heaps[i]);
462
Mitchel Humpherysdc4d01d2012-09-13 10:53:22 -0700463 if (heap->type == (enum ion_heap_type) ION_HEAP_TYPE_CP
464 && heap->extra_data) {
Larry Bassel67b921d2012-04-06 10:23:27 -0700465 struct ion_cp_heap_pdata *data = heap->extra_data;
466
467 reusable_count += (data->reusable) ? 1 : 0;
468
469 if (data->reusable && reusable_count > 1) {
470 pr_err("%s: Too many heaps specified as "
471 "reusable. Heap %s was not configured "
472 "as reusable.\n", __func__, heap->name);
473 data->reusable = 0;
474 }
475 }
476 }
477
478 for (i = 0; i < apq8064_ion_pdata.nr; ++i) {
479 const struct ion_platform_heap *heap =
480 &(apq8064_ion_pdata.heaps[i]);
481
482 if (heap->extra_data) {
483 int fixed_position = NOT_FIXED;
484 int mem_is_fmem = 0;
485
Mitchel Humpherysdc4d01d2012-09-13 10:53:22 -0700486 switch ((int)heap->type) {
Larry Bassel67b921d2012-04-06 10:23:27 -0700487 case ION_HEAP_TYPE_CP:
488 mem_is_fmem = ((struct ion_cp_heap_pdata *)
489 heap->extra_data)->mem_is_fmem;
490 fixed_position = ((struct ion_cp_heap_pdata *)
491 heap->extra_data)->fixed_position;
492 break;
493 case ION_HEAP_TYPE_CARVEOUT:
494 mem_is_fmem = ((struct ion_co_heap_pdata *)
495 heap->extra_data)->mem_is_fmem;
496 fixed_position = ((struct ion_co_heap_pdata *)
497 heap->extra_data)->fixed_position;
498 break;
499 default:
500 break;
501 }
502
503 if (fixed_position != NOT_FIXED)
504 fixed_size += heap->size;
505 else
506 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
507
508 if (fixed_position == FIXED_LOW)
509 fixed_low_size += heap->size;
510 else if (fixed_position == FIXED_MIDDLE)
511 fixed_middle_size += heap->size;
512 else if (fixed_position == FIXED_HIGH)
513 fixed_high_size += heap->size;
514
515 if (mem_is_fmem)
516 apq8064_fmem_pdata.size += heap->size;
517 }
518 }
519
520 if (!fixed_size)
521 return;
522
523 if (apq8064_fmem_pdata.size) {
Hanumant Singheadb7502012-05-15 18:14:04 -0700524 apq8064_fmem_pdata.reserved_size_low = fixed_low_size +
525 HOLE_SIZE;
Larry Bassel67b921d2012-04-06 10:23:27 -0700526 apq8064_fmem_pdata.reserved_size_high = fixed_high_size;
527 }
528
529 /* Since the fixed area may be carved out of lowmem,
530 * make sure the length is a multiple of 1M.
531 */
Hanumant Singheadb7502012-05-15 18:14:04 -0700532 fixed_size = (fixed_size + HOLE_SIZE + SECTION_SIZE - 1)
Larry Bassel67b921d2012-04-06 10:23:27 -0700533 & SECTION_MASK;
534 apq8064_reserve_fixed_area(fixed_size);
535
536 fixed_low_start = APQ8064_FIXED_AREA_START;
Hanumant Singheadb7502012-05-15 18:14:04 -0700537 fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE;
Larry Bassel67b921d2012-04-06 10:23:27 -0700538 fixed_high_start = fixed_middle_start + fixed_middle_size;
539
540 for (i = 0; i < apq8064_ion_pdata.nr; ++i) {
541 struct ion_platform_heap *heap = &(apq8064_ion_pdata.heaps[i]);
542
543 if (heap->extra_data) {
544 int fixed_position = NOT_FIXED;
Steve Mucklef132c6c2012-06-06 18:30:57 -0700545 struct ion_cp_heap_pdata *pdata = NULL;
Larry Bassel67b921d2012-04-06 10:23:27 -0700546
Mitchel Humpherysdc4d01d2012-09-13 10:53:22 -0700547 switch ((int) heap->type) {
Larry Bassel67b921d2012-04-06 10:23:27 -0700548 case ION_HEAP_TYPE_CP:
Hanumant Singheadb7502012-05-15 18:14:04 -0700549 pdata =
550 (struct ion_cp_heap_pdata *)heap->extra_data;
551 fixed_position = pdata->fixed_position;
Larry Bassel67b921d2012-04-06 10:23:27 -0700552 break;
553 case ION_HEAP_TYPE_CARVEOUT:
554 fixed_position = ((struct ion_co_heap_pdata *)
555 heap->extra_data)->fixed_position;
556 break;
557 default:
558 break;
559 }
560
561 switch (fixed_position) {
562 case FIXED_LOW:
563 heap->base = fixed_low_start;
564 break;
565 case FIXED_MIDDLE:
566 heap->base = fixed_middle_start;
Hanumant Singheadb7502012-05-15 18:14:04 -0700567 pdata->secure_base = fixed_middle_start
568 - HOLE_SIZE;
569 pdata->secure_size = HOLE_SIZE + heap->size;
Larry Bassel67b921d2012-04-06 10:23:27 -0700570 break;
571 case FIXED_HIGH:
572 heap->base = fixed_high_start;
573 break;
574 default:
575 break;
576 }
577 }
578 }
Olav Haugan7c6aa742012-01-16 16:47:37 -0800579#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700580}
581
Huaibin Yang4a084e32011-12-15 15:25:52 -0800582static void __init reserve_mdp_memory(void)
583{
584 apq8064_mdp_writeback(apq8064_reserve_table);
585}
586
Laura Abbott93a4a352012-05-25 09:26:35 -0700587static void __init reserve_cache_dump_memory(void)
588{
589#ifdef CONFIG_MSM_CACHE_DUMP
590 unsigned int total;
591
592 total = apq8064_cache_dump_pdata.l1_size +
593 apq8064_cache_dump_pdata.l2_size;
594 apq8064_reserve_table[MEMTYPE_EBI1].size += total;
595#endif
596}
597
Abhijeet Dharmapurikar3edb5de2012-09-13 11:02:03 -0700598static void __init reserve_mpdcvs_memory(void)
599{
600 apq8064_reserve_table[MEMTYPE_EBI1].size += SZ_32K;
601}
602
Kevin Chan13be4e22011-10-20 11:30:32 -0700603static void __init apq8064_calculate_reserve_sizes(void)
604{
605 size_pmem_devices();
606 reserve_pmem_memory();
Olav Haugan7c6aa742012-01-16 16:47:37 -0800607 reserve_ion_memory();
Huaibin Yang4a084e32011-12-15 15:25:52 -0800608 reserve_mdp_memory();
Laura Abbott350c8362012-02-28 14:46:52 -0800609 reserve_rtb_memory();
Laura Abbott93a4a352012-05-25 09:26:35 -0700610 reserve_cache_dump_memory();
Abhijeet Dharmapurikar3edb5de2012-09-13 11:02:03 -0700611 reserve_mpdcvs_memory();
Kevin Chan13be4e22011-10-20 11:30:32 -0700612}
613
614static struct reserve_info apq8064_reserve_info __initdata = {
615 .memtype_reserve_table = apq8064_reserve_table,
616 .calculate_reserve_sizes = apq8064_calculate_reserve_sizes,
Larry Bassel67b921d2012-04-06 10:23:27 -0700617 .reserve_fixed_area = apq8064_reserve_fixed_area,
Kevin Chan13be4e22011-10-20 11:30:32 -0700618 .paddr_to_memtype = apq8064_paddr_to_memtype,
619};
620
621static int apq8064_memory_bank_size(void)
622{
623 return 1<<29;
624}
625
626static void __init locate_unstable_memory(void)
627{
628 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
629 unsigned long bank_size;
630 unsigned long low, high;
631
632 bank_size = apq8064_memory_bank_size();
633 low = meminfo.bank[0].start;
634 high = mb->start + mb->size;
Olav Haugand76e3a82012-01-16 16:55:07 -0800635
636 /* Check if 32 bit overflow occured */
637 if (high < mb->start)
Larry Bassel67b921d2012-04-06 10:23:27 -0700638 high = -PAGE_SIZE;
Olav Haugand76e3a82012-01-16 16:55:07 -0800639
Kevin Chan13be4e22011-10-20 11:30:32 -0700640 low &= ~(bank_size - 1);
641
642 if (high - low <= bank_size)
Larry Bassel67b921d2012-04-06 10:23:27 -0700643 goto no_dmm;
644
645#ifdef CONFIG_ENABLE_DMM
Jack Cheung46bfffa2012-01-19 15:26:24 -0800646 apq8064_reserve_info.low_unstable_address = mb->start -
647 MIN_MEMORY_BLOCK_SIZE + mb->size;
648 apq8064_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
649
Kevin Chan13be4e22011-10-20 11:30:32 -0700650 apq8064_reserve_info.bank_size = bank_size;
651 pr_info("low unstable address %lx max size %lx bank size %lx\n",
652 apq8064_reserve_info.low_unstable_address,
653 apq8064_reserve_info.max_unstable_size,
654 apq8064_reserve_info.bank_size);
Larry Bassel67b921d2012-04-06 10:23:27 -0700655 return;
656#endif
657no_dmm:
658 apq8064_reserve_info.low_unstable_address = high;
659 apq8064_reserve_info.max_unstable_size = 0;
Kevin Chan13be4e22011-10-20 11:30:32 -0700660}
661
Hanumant Singh50440d42012-04-23 19:27:16 -0700662static int apq8064_change_memory_power(u64 start, u64 size,
663 int change_type)
664{
665 return soc_change_memory_power(start, size, change_type);
666}
667
Aravind Venkateswaran8ac7f412012-03-16 17:57:30 -0700668static char prim_panel_name[PANEL_NAME_MAX_LEN];
669static char ext_panel_name[PANEL_NAME_MAX_LEN];
Ajay Singh Parmar6b82d2b2012-07-19 17:23:26 +0530670
671static int ext_resolution;
672
Aravind Venkateswaran8ac7f412012-03-16 17:57:30 -0700673static int __init prim_display_setup(char *param)
674{
675 if (strnlen(param, PANEL_NAME_MAX_LEN))
676 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
677 return 0;
678}
679early_param("prim_display", prim_display_setup);
680
681static int __init ext_display_setup(char *param)
682{
683 if (strnlen(param, PANEL_NAME_MAX_LEN))
684 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
685 return 0;
686}
687early_param("ext_display", ext_display_setup);
688
Ajay Singh Parmar6b82d2b2012-07-19 17:23:26 +0530689static int __init hdmi_resulution_setup(char *param)
690{
691 int ret;
692 ret = kstrtoint(param, 10, &ext_resolution);
693 return ret;
694}
695early_param("ext_resolution", hdmi_resulution_setup);
696
Kevin Chan13be4e22011-10-20 11:30:32 -0700697static void __init apq8064_reserve(void)
698{
Ajay Singh Parmar6b82d2b2012-07-19 17:23:26 +0530699 apq8064_set_display_params(prim_panel_name, ext_panel_name,
700 ext_resolution);
Kevin Chan13be4e22011-10-20 11:30:32 -0700701 msm_reserve();
Larry Bassel67b921d2012-04-06 10:23:27 -0700702 if (apq8064_fmem_pdata.size) {
703#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
704 if (reserve_info->fixed_area_size) {
705 apq8064_fmem_pdata.phys =
706 reserve_info->fixed_area_start + MSM_MM_FW_SIZE;
707 pr_info("mm fw at %lx (fixed) size %x\n",
708 reserve_info->fixed_area_start, MSM_MM_FW_SIZE);
709 pr_info("fmem start %lx (fixed) size %lx\n",
710 apq8064_fmem_pdata.phys,
711 apq8064_fmem_pdata.size);
712 }
713#endif
714 }
Kevin Chan13be4e22011-10-20 11:30:32 -0700715}
716
Laura Abbott6988cef2012-03-15 14:27:13 -0700717static void __init place_movable_zone(void)
718{
Larry Bassel67b921d2012-04-06 10:23:27 -0700719#ifdef CONFIG_ENABLE_DMM
Laura Abbott6988cef2012-03-15 14:27:13 -0700720 movable_reserved_start = apq8064_reserve_info.low_unstable_address;
721 movable_reserved_size = apq8064_reserve_info.max_unstable_size;
722 pr_info("movable zone start %lx size %lx\n",
723 movable_reserved_start, movable_reserved_size);
Larry Bassel67b921d2012-04-06 10:23:27 -0700724#endif
Laura Abbott6988cef2012-03-15 14:27:13 -0700725}
726
727static void __init apq8064_early_reserve(void)
728{
729 reserve_info = &apq8064_reserve_info;
730 locate_unstable_memory();
731 place_movable_zone();
732
733}
Hemant Kumara945b472012-01-25 15:08:06 -0800734#ifdef CONFIG_USB_EHCI_MSM_HSIC
Hemant Kumare6275972012-02-29 20:06:21 -0800735/* Bandwidth requests (zero) if no vote placed */
736static struct msm_bus_vectors hsic_init_vectors[] = {
737 {
738 .src = MSM_BUS_MASTER_SPS,
739 .dst = MSM_BUS_SLAVE_EBI_CH0,
740 .ab = 0,
741 .ib = 0,
742 },
743 {
744 .src = MSM_BUS_MASTER_SPS,
745 .dst = MSM_BUS_SLAVE_SPS,
746 .ab = 0,
747 .ib = 0,
748 },
749};
750
751/* Bus bandwidth requests in Bytes/sec */
752static struct msm_bus_vectors hsic_max_vectors[] = {
753 {
754 .src = MSM_BUS_MASTER_SPS,
755 .dst = MSM_BUS_SLAVE_EBI_CH0,
756 .ab = 60000000, /* At least 480Mbps on bus. */
757 .ib = 960000000, /* MAX bursts rate */
758 },
759 {
760 .src = MSM_BUS_MASTER_SPS,
761 .dst = MSM_BUS_SLAVE_SPS,
762 .ab = 0,
763 .ib = 512000000, /*vote for 64Mhz dfab clk rate*/
764 },
765};
766
767static struct msm_bus_paths hsic_bus_scale_usecases[] = {
768 {
769 ARRAY_SIZE(hsic_init_vectors),
770 hsic_init_vectors,
771 },
772 {
773 ARRAY_SIZE(hsic_max_vectors),
774 hsic_max_vectors,
775 },
776};
777
778static struct msm_bus_scale_pdata hsic_bus_scale_pdata = {
779 hsic_bus_scale_usecases,
780 ARRAY_SIZE(hsic_bus_scale_usecases),
781 .name = "hsic",
782};
783
Hemant Kumara945b472012-01-25 15:08:06 -0800784static struct msm_hsic_host_platform_data msm_hsic_pdata = {
Hemant Kumare6275972012-02-29 20:06:21 -0800785 .strobe = 88,
786 .data = 89,
787 .bus_scale_table = &hsic_bus_scale_pdata,
Hemant Kumara945b472012-01-25 15:08:06 -0800788};
789#else
790static struct msm_hsic_host_platform_data msm_hsic_pdata;
791#endif
792
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800793#define PID_MAGIC_ID 0x71432909
794#define SERIAL_NUM_MAGIC_ID 0x61945374
795#define SERIAL_NUMBER_LENGTH 127
796#define DLOAD_USB_BASE_ADD 0x2A03F0C8
797
798struct magic_num_struct {
799 uint32_t pid;
800 uint32_t serial_num;
801};
802
803struct dload_struct {
804 uint32_t reserved1;
805 uint32_t reserved2;
806 uint32_t reserved3;
807 uint16_t reserved4;
808 uint16_t pid;
809 char serial_number[SERIAL_NUMBER_LENGTH];
810 uint16_t reserved5;
811 struct magic_num_struct magic_struct;
812};
813
814static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
815{
816 struct dload_struct __iomem *dload = 0;
817
818 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
819 if (!dload) {
820 pr_err("%s: cannot remap I/O memory region: %08x\n",
821 __func__, DLOAD_USB_BASE_ADD);
822 return -ENXIO;
823 }
824
825 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
826 __func__, dload, pid, snum);
827 /* update pid */
828 dload->magic_struct.pid = PID_MAGIC_ID;
829 dload->pid = pid;
830
831 /* update serial number */
832 dload->magic_struct.serial_num = 0;
833 if (!snum) {
834 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
835 goto out;
836 }
837
838 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
839 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
840out:
841 iounmap(dload);
842 return 0;
843}
844
845static struct android_usb_platform_data android_usb_pdata = {
846 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
847};
848
Hemant Kumar4933b072011-10-17 23:43:11 -0700849static struct platform_device android_usb_device = {
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800850 .name = "android_usb",
851 .id = -1,
852 .dev = {
853 .platform_data = &android_usb_pdata,
854 },
Hemant Kumar4933b072011-10-17 23:43:11 -0700855};
856
Hemant Kumar7620eed2012-02-26 09:08:43 -0800857/* Bandwidth requests (zero) if no vote placed */
858static struct msm_bus_vectors usb_init_vectors[] = {
859 {
860 .src = MSM_BUS_MASTER_SPS,
861 .dst = MSM_BUS_SLAVE_EBI_CH0,
862 .ab = 0,
863 .ib = 0,
864 },
865};
866
867/* Bus bandwidth requests in Bytes/sec */
868static struct msm_bus_vectors usb_max_vectors[] = {
869 {
870 .src = MSM_BUS_MASTER_SPS,
871 .dst = MSM_BUS_SLAVE_EBI_CH0,
872 .ab = 60000000, /* At least 480Mbps on bus. */
873 .ib = 960000000, /* MAX bursts rate */
874 },
875};
876
877static struct msm_bus_paths usb_bus_scale_usecases[] = {
878 {
879 ARRAY_SIZE(usb_init_vectors),
880 usb_init_vectors,
881 },
882 {
883 ARRAY_SIZE(usb_max_vectors),
884 usb_max_vectors,
885 },
886};
887
888static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
889 usb_bus_scale_usecases,
890 ARRAY_SIZE(usb_bus_scale_usecases),
891 .name = "usb",
892};
893
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700894static int phy_init_seq[] = {
895 0x38, 0x81, /* update DC voltage level */
896 0x24, 0x82, /* set pre-emphasis and rise/fall time */
897 -1
898};
899
Vijayavardhan Vennapusa4fa13692012-08-02 14:35:03 +0530900#define PMIC_GPIO_DP 27 /* PMIC GPIO for D+ change */
901#define PMIC_GPIO_DP_IRQ PM8921_GPIO_IRQ(PM8921_IRQ_BASE, PMIC_GPIO_DP)
Jack Pham87f202f2012-08-06 00:24:22 -0700902#define MSM_MPM_PIN_USB1_OTGSESSVLD 40
903
Hemant Kumar4933b072011-10-17 23:43:11 -0700904static struct msm_otg_platform_data msm_otg_pdata = {
Hemant Kumard86c4882012-01-24 19:39:37 -0800905 .mode = USB_OTG,
906 .otg_control = OTG_PMIC_CONTROL,
Hemant Kumar4933b072011-10-17 23:43:11 -0700907 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Hemant Kumard86c4882012-01-24 19:39:37 -0800908 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
909 .power_budget = 750,
Hemant Kumar7620eed2012-02-26 09:08:43 -0800910 .bus_scale_table = &usb_bus_scale_pdata,
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700911 .phy_init_seq = phy_init_seq,
Jack Pham87f202f2012-08-06 00:24:22 -0700912 .mpm_otgsessvld_int = MSM_MPM_PIN_USB1_OTGSESSVLD,
Hemant Kumar4933b072011-10-17 23:43:11 -0700913};
914
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800915static struct msm_usb_host_platform_data msm_ehci_host_pdata3 = {
Manu Gautam91223e02011-11-08 15:27:22 +0530916 .power_budget = 500,
917};
918
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800919#ifdef CONFIG_USB_EHCI_MSM_HOST4
920static struct msm_usb_host_platform_data msm_ehci_host_pdata4;
921#endif
922
Manu Gautam91223e02011-11-08 15:27:22 +0530923static void __init apq8064_ehci_host_init(void)
924{
Chiranjeevi Velempatib822fa32012-05-23 22:05:59 +0530925 if (machine_is_apq8064_liquid() || machine_is_mpq8064_cdp() ||
926 machine_is_mpq8064_hrd() || machine_is_mpq8064_dtv()) {
927 if (machine_is_apq8064_liquid())
928 msm_ehci_host_pdata3.dock_connect_irq =
929 PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9);
Vijayavardhan Vennapusa4fa13692012-08-02 14:35:03 +0530930 else
931 msm_ehci_host_pdata3.pmic_gpio_dp_irq =
932 PMIC_GPIO_DP_IRQ;
Hemant Kumar56925352012-02-13 16:59:52 -0800933
Manu Gautam91223e02011-11-08 15:27:22 +0530934 apq8064_device_ehci_host3.dev.platform_data =
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800935 &msm_ehci_host_pdata3;
Manu Gautam91223e02011-11-08 15:27:22 +0530936 platform_device_register(&apq8064_device_ehci_host3);
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800937
938#ifdef CONFIG_USB_EHCI_MSM_HOST4
939 apq8064_device_ehci_host4.dev.platform_data =
940 &msm_ehci_host_pdata4;
941 platform_device_register(&apq8064_device_ehci_host4);
942#endif
Manu Gautam91223e02011-11-08 15:27:22 +0530943 }
944}
945
David Keitel2f613d92012-02-15 11:29:16 -0800946static struct smb349_platform_data smb349_data __initdata = {
947 .en_n_gpio = PM8921_GPIO_PM_TO_SYS(37),
948 .chg_susp_gpio = PM8921_GPIO_PM_TO_SYS(30),
949 .chg_current_ma = 2200,
950};
951
952static struct i2c_board_info smb349_charger_i2c_info[] __initdata = {
953 {
954 I2C_BOARD_INFO(SMB349_NAME, 0x1B),
955 .platform_data = &smb349_data,
956 },
957};
958
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -0800959struct sx150x_platform_data apq8064_sx150x_data[] = {
960 [SX150X_EPM] = {
961 .gpio_base = GPIO_EPM_EXPANDER_BASE,
962 .oscio_is_gpo = false,
963 .io_pullup_ena = 0x0,
964 .io_pulldn_ena = 0x0,
965 .io_open_drain_ena = 0x0,
966 .io_polarity = 0,
967 .irq_summary = -1,
968 },
969};
970
971static struct epm_chan_properties ads_adc_channel_data[] = {
Yan Hec942e402012-08-31 11:14:58 -0700972 {10, 100}, {1000, 1}, {10, 100}, {1000, 1},
973 {10, 100}, {1000, 1}, {10, 100}, {1000, 1},
974 {10, 100}, {20, 100}, {500, 100}, {5, 100},
975 {1000, 1}, {200, 100}, {50, 100}, {10, 100},
976 {510, 100}, {50, 100}, {20, 100}, {100, 100},
977 {510, 100}, {20, 100}, {50, 100}, {200, 100},
978 {10, 100}, {20, 100}, {1000, 1}, {10, 100},
979 {200, 100}, {510, 100}, {1000, 100}, {200, 100},
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -0800980};
981
982static struct epm_adc_platform_data epm_adc_pdata = {
983 .channel = ads_adc_channel_data,
984 .bus_id = 0x0,
985 .epm_i2c_board_info = {
986 .type = "sx1509q",
987 .addr = 0x3e,
988 .platform_data = &apq8064_sx150x_data[SX150X_EPM],
989 },
990 .gpio_expander_base_addr = GPIO_EPM_EXPANDER_BASE,
991};
992
993static struct platform_device epm_adc_device = {
994 .name = "epm_adc",
995 .id = -1,
996 .dev = {
997 .platform_data = &epm_adc_pdata,
998 },
999};
1000
1001static void __init apq8064_epm_adc_init(void)
1002{
1003 epm_adc_pdata.num_channels = 32;
1004 epm_adc_pdata.num_adc = 2;
1005 epm_adc_pdata.chan_per_adc = 16;
1006 epm_adc_pdata.chan_per_mux = 8;
1007};
1008
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001009/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
1010 * 4 micbiases are used to power various analog and digital
1011 * microphones operating at 1800 mV. Technically, all micbiases
1012 * can source from single cfilter since all microphones operate
1013 * at the same voltage level. The arrangement below is to make
1014 * sure all cfilters are exercised. LDO_H regulator ouput level
1015 * does not need to be as high as 2.85V. It is choosen for
1016 * microphone sensitivity purpose.
1017 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301018static struct wcd9xxx_pdata apq8064_tabla_platform_data = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001019 .slimbus_slave_device = {
1020 .name = "tabla-slave",
1021 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
1022 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001023 .irq = MSM_GPIO_TO_INT(42),
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001024 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301025 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001026 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
1027 .micbias = {
1028 .ldoh_v = TABLA_LDOH_2P85_V,
1029 .cfilt1_mv = 1800,
Bhalchandra Gajare975c53a2012-08-10 12:16:49 -07001030 .cfilt2_mv = 2700,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001031 .cfilt3_mv = 1800,
1032 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
1033 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
1034 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
1035 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301036 },
1037 .regulator = {
1038 {
1039 .name = "CDC_VDD_CP",
1040 .min_uV = 1800000,
1041 .max_uV = 1800000,
1042 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
1043 },
1044 {
1045 .name = "CDC_VDDA_RX",
1046 .min_uV = 1800000,
1047 .max_uV = 1800000,
1048 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
1049 },
1050 {
1051 .name = "CDC_VDDA_TX",
1052 .min_uV = 1800000,
1053 .max_uV = 1800000,
1054 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
1055 },
1056 {
1057 .name = "VDDIO_CDC",
1058 .min_uV = 1800000,
1059 .max_uV = 1800000,
1060 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1061 },
1062 {
1063 .name = "VDDD_CDC_D",
1064 .min_uV = 1225000,
David Collins62debe82012-06-06 17:01:03 -07001065 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301066 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1067 },
1068 {
1069 .name = "CDC_VDDA_A_1P2V",
1070 .min_uV = 1225000,
David Collins62debe82012-06-06 17:01:03 -07001071 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301072 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1073 },
1074 },
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001075};
1076
1077static struct slim_device apq8064_slim_tabla = {
1078 .name = "tabla-slim",
1079 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
1080 .dev = {
1081 .platform_data = &apq8064_tabla_platform_data,
1082 },
1083};
1084
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301085static struct wcd9xxx_pdata apq8064_tabla20_platform_data = {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001086 .slimbus_slave_device = {
1087 .name = "tabla-slave",
1088 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
1089 },
1090 .irq = MSM_GPIO_TO_INT(42),
1091 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301092 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001093 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
1094 .micbias = {
1095 .ldoh_v = TABLA_LDOH_2P85_V,
1096 .cfilt1_mv = 1800,
Bhalchandra Gajare975c53a2012-08-10 12:16:49 -07001097 .cfilt2_mv = 2700,
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001098 .cfilt3_mv = 1800,
1099 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
1100 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
1101 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
1102 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301103 },
1104 .regulator = {
1105 {
1106 .name = "CDC_VDD_CP",
1107 .min_uV = 1800000,
1108 .max_uV = 1800000,
1109 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
1110 },
1111 {
1112 .name = "CDC_VDDA_RX",
1113 .min_uV = 1800000,
1114 .max_uV = 1800000,
1115 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
1116 },
1117 {
1118 .name = "CDC_VDDA_TX",
1119 .min_uV = 1800000,
1120 .max_uV = 1800000,
1121 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
1122 },
1123 {
1124 .name = "VDDIO_CDC",
1125 .min_uV = 1800000,
1126 .max_uV = 1800000,
1127 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1128 },
1129 {
1130 .name = "VDDD_CDC_D",
1131 .min_uV = 1225000,
David Collins62debe82012-06-06 17:01:03 -07001132 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301133 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1134 },
1135 {
1136 .name = "CDC_VDDA_A_1P2V",
1137 .min_uV = 1225000,
David Collins62debe82012-06-06 17:01:03 -07001138 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301139 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1140 },
1141 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001142};
1143
1144static struct slim_device apq8064_slim_tabla20 = {
1145 .name = "tabla2x-slim",
1146 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
1147 .dev = {
1148 .platform_data = &apq8064_tabla20_platform_data,
1149 },
1150};
1151
Santosh Mardi695be0d2012-04-10 23:21:12 +05301152/* enable the level shifter for cs8427 to make sure the I2C
1153 * clock is running at 100KHz and voltage levels are at 3.3
1154 * and 5 volts
1155 */
1156static int enable_100KHz_ls(int enable)
1157{
1158 int ret = 0;
1159 if (enable) {
1160 ret = gpio_request(SX150X_GPIO(1, 10),
1161 "cs8427_100KHZ_ENABLE");
1162 if (ret) {
1163 pr_err("%s: Failed to request gpio %d\n", __func__,
1164 SX150X_GPIO(1, 10));
1165 return ret;
1166 }
1167 gpio_direction_output(SX150X_GPIO(1, 10), 1);
Santosh Mardid706fcf2012-08-31 19:26:54 +05301168 } else {
1169 gpio_direction_output(SX150X_GPIO(1, 10), 0);
Santosh Mardi695be0d2012-04-10 23:21:12 +05301170 gpio_free(SX150X_GPIO(1, 10));
Santosh Mardid706fcf2012-08-31 19:26:54 +05301171 }
Santosh Mardi695be0d2012-04-10 23:21:12 +05301172 return ret;
1173}
1174
Santosh Mardieff9a742012-04-09 23:23:39 +05301175static struct cs8427_platform_data cs8427_i2c_platform_data = {
1176 .irq = SX150X_GPIO(1, 4),
1177 .reset_gpio = SX150X_GPIO(1, 6),
Santosh Mardi695be0d2012-04-10 23:21:12 +05301178 .enable = enable_100KHz_ls,
Santosh Mardieff9a742012-04-09 23:23:39 +05301179};
1180
1181static struct i2c_board_info cs8427_device_info[] __initdata = {
1182 {
1183 I2C_BOARD_INFO("cs8427", CS8427_ADDR4),
1184 .platform_data = &cs8427_i2c_platform_data,
1185 },
1186};
1187
Amy Maloche70090f992012-02-16 16:35:26 -08001188#define HAP_SHIFT_LVL_OE_GPIO PM8921_MPP_PM_TO_SYS(8)
1189#define ISA1200_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1190#define ISA1200_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
David Collins6f7c3472012-08-22 13:18:06 -07001191#define ISA1200_HAP_CLK_PM8921 PM8921_GPIO_PM_TO_SYS(44)
1192#define ISA1200_HAP_CLK_PM8917 PM8921_GPIO_PM_TO_SYS(38)
Amy Maloche70090f992012-02-16 16:35:26 -08001193
Mohan Pallaka2d877602012-05-11 13:07:30 +05301194static int isa1200_clk_enable(bool on)
Amy Maloche70090f992012-02-16 16:35:26 -08001195{
David Collins6f7c3472012-08-22 13:18:06 -07001196 unsigned int gpio = ISA1200_HAP_CLK_PM8921;
Amy Maloche8f973892012-03-26 14:53:13 -07001197 int rc = 0;
1198
David Collins6f7c3472012-08-22 13:18:06 -07001199 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
1200 gpio = ISA1200_HAP_CLK_PM8917;
1201
1202 gpio_set_value_cansleep(gpio, on);
Amy Maloche70090f992012-02-16 16:35:26 -08001203
Mohan Pallaka2d877602012-05-11 13:07:30 +05301204 if (on) {
Amy Maloche8f973892012-03-26 14:53:13 -07001205 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_1, true);
Mohan Pallaka2d877602012-05-11 13:07:30 +05301206 if (rc) {
1207 pr_err("%s: unable to write aux clock register(%d)\n",
1208 __func__, rc);
1209 goto err_gpio_dis;
1210 }
1211 } else {
Amy Maloche8f973892012-03-26 14:53:13 -07001212 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_NONE, true);
Mohan Pallaka2d877602012-05-11 13:07:30 +05301213 if (rc)
1214 pr_err("%s: unable to write aux clock register(%d)\n",
1215 __func__, rc);
Amy Maloche8f973892012-03-26 14:53:13 -07001216 }
1217
1218 return rc;
Mohan Pallaka2d877602012-05-11 13:07:30 +05301219
1220err_gpio_dis:
David Collins6f7c3472012-08-22 13:18:06 -07001221 gpio_set_value_cansleep(gpio, !on);
Mohan Pallaka2d877602012-05-11 13:07:30 +05301222 return rc;
Amy Maloche70090f992012-02-16 16:35:26 -08001223}
1224
1225static int isa1200_dev_setup(bool enable)
1226{
David Collins6f7c3472012-08-22 13:18:06 -07001227 unsigned int gpio = ISA1200_HAP_CLK_PM8921;
Amy Maloche70090f992012-02-16 16:35:26 -08001228 int rc = 0;
1229
David Collins6f7c3472012-08-22 13:18:06 -07001230 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
1231 gpio = ISA1200_HAP_CLK_PM8917;
1232
Amy Maloche70090f992012-02-16 16:35:26 -08001233 if (!enable)
1234 goto free_gpio;
1235
David Collins6f7c3472012-08-22 13:18:06 -07001236 rc = gpio_request(gpio, "haptics_clk");
Amy Maloche70090f992012-02-16 16:35:26 -08001237 if (rc) {
1238 pr_err("%s: unable to request gpio %d config(%d)\n",
David Collins6f7c3472012-08-22 13:18:06 -07001239 __func__, gpio, rc);
Amy Maloche70090f992012-02-16 16:35:26 -08001240 return rc;
1241 }
1242
David Collins6f7c3472012-08-22 13:18:06 -07001243 rc = gpio_direction_output(gpio, 0);
Amy Maloche70090f992012-02-16 16:35:26 -08001244 if (rc) {
1245 pr_err("%s: unable to set direction\n", __func__);
1246 goto free_gpio;
1247 }
1248
1249 return 0;
1250
1251free_gpio:
David Collins6f7c3472012-08-22 13:18:06 -07001252 gpio_free(gpio);
Amy Maloche70090f992012-02-16 16:35:26 -08001253 return rc;
1254}
1255
1256static struct isa1200_regulator isa1200_reg_data[] = {
1257 {
1258 .name = "vddp",
1259 .min_uV = ISA_I2C_VTG_MIN_UV,
1260 .max_uV = ISA_I2C_VTG_MAX_UV,
1261 .load_uA = ISA_I2C_CURR_UA,
1262 },
1263};
1264
1265static struct isa1200_platform_data isa1200_1_pdata = {
1266 .name = "vibrator",
1267 .dev_setup = isa1200_dev_setup,
Mohan Pallaka2d877602012-05-11 13:07:30 +05301268 .clk_enable = isa1200_clk_enable,
Mohan Pallaka32f20a72012-06-14 14:41:11 +05301269 .need_pwm_clk = true,
Amy Maloche70090f992012-02-16 16:35:26 -08001270 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
1271 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
1272 .max_timeout = 15000,
1273 .mode_ctrl = PWM_GEN_MODE,
1274 .pwm_fd = {
1275 .pwm_div = 256,
1276 },
1277 .is_erm = false,
1278 .smart_en = true,
1279 .ext_clk_en = true,
1280 .chip_en = 1,
1281 .regulator_info = isa1200_reg_data,
1282 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1283};
1284
1285static struct i2c_board_info isa1200_board_info[] __initdata = {
1286 {
1287 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1288 .platform_data = &isa1200_1_pdata,
1289 },
1290};
Jing Lin21ed4de2012-02-05 15:53:28 -08001291/* configuration data for mxt1386e using V2.1 firmware */
1292static const u8 mxt1386e_config_data_v2_1[] = {
1293 /* T6 Object */
1294 0, 0, 0, 0, 0, 0,
1295 /* T38 Object */
Jing Line4c47042012-08-31 10:54:44 -07001296 14, 3, 0, 5, 7, 12, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001297 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1298 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1299 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1300 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1301 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1302 0, 0, 0, 0,
1303 /* T7 Object */
Jing Line4c47042012-08-31 10:54:44 -07001304 32, 10, 50,
Jing Lin21ed4de2012-02-05 15:53:28 -08001305 /* T8 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001306 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001307 /* T9 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001308 139, 0, 0, 26, 42, 0, 32, 80, 2, 5,
Jing Line4c47042012-08-31 10:54:44 -07001309 0, 5, 5, 79, 10, 30, 10, 10, 255, 2,
Jing Linf1208fd2012-02-23 11:15:42 -08001310 85, 5, 0, 5, 9, 5, 12, 35, 70, 40,
1311 20, 5, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001312 /* T18 Object */
1313 0, 0,
1314 /* T24 Object */
1315 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1316 0, 0, 0, 0, 0, 0, 0, 0, 0,
1317 /* T25 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001318 1, 0, 60, 115, 156, 99,
Jing Lin21ed4de2012-02-05 15:53:28 -08001319 /* T27 Object */
1320 0, 0, 0, 0, 0, 0, 0,
1321 /* T40 Object */
1322 0, 0, 0, 0, 0,
1323 /* T42 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001324 0, 0, 255, 0, 255, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001325 /* T43 Object */
1326 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
1327 16,
1328 /* T46 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001329 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001330 /* T47 Object */
1331 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
1332 /* T48 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001333 1, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001334 32, 40, 0, 10, 10, 0, 0, 100, 10, 90,
1335 0, 0, 0, 0, 0, 0, 0, 10, 1, 10,
1336 52, 10, 12, 0, 33, 0, 1, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001337 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1338 0, 0, 0, 0,
1339 /* T56 Object */
1340 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1341 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1342 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1343 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001344 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1345 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001346};
1347
1348#define MXT_TS_GPIO_IRQ 6
1349#define MXT_TS_PWR_EN_GPIO PM8921_GPIO_PM_TO_SYS(23)
1350#define MXT_TS_RESET_GPIO 33
1351
1352static struct mxt_config_info mxt_config_array[] = {
1353 {
1354 .config = mxt1386e_config_data_v2_1,
1355 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1356 .family_id = 0xA0,
1357 .variant_id = 0x7,
1358 .version = 0x21,
1359 .build = 0xAA,
Jing Linef4aa9b2012-03-26 12:01:41 -07001360 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
1361 .fw_name = "atmel_8064_liquid_v2_2_AA.hex",
1362 },
1363 {
1364 /* The config data for V2.2.AA is the same as for V2.1.AA */
1365 .config = mxt1386e_config_data_v2_1,
1366 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1367 .family_id = 0xA0,
1368 .variant_id = 0x7,
1369 .version = 0x22,
1370 .build = 0xAA,
1371 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin21ed4de2012-02-05 15:53:28 -08001372 },
1373};
1374
1375static struct mxt_platform_data mxt_platform_data = {
1376 .config_array = mxt_config_array,
1377 .config_array_size = ARRAY_SIZE(mxt_config_array),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08001378 .panel_minx = 0,
1379 .panel_maxx = 1365,
1380 .panel_miny = 0,
1381 .panel_maxy = 767,
1382 .disp_minx = 0,
1383 .disp_maxx = 1365,
1384 .disp_miny = 0,
1385 .disp_maxy = 767,
Anirudh Ghayal39dbe3f2012-04-13 15:43:16 +05301386 .irqflags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
Jing Lin21ed4de2012-02-05 15:53:28 -08001387 .i2c_pull_up = true,
1388 .reset_gpio = MXT_TS_RESET_GPIO,
1389 .irq_gpio = MXT_TS_GPIO_IRQ,
1390};
1391
1392static struct i2c_board_info mxt_device_info[] __initdata = {
1393 {
1394 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
1395 .platform_data = &mxt_platform_data,
1396 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1397 },
1398};
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001399#define CYTTSP_TS_GPIO_IRQ 6
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001400#define CYTTSP_TS_GPIO_SLEEP 33
Amy Maloche609bb5e2012-08-03 09:41:42 -07001401#define CYTTSP_TS_GPIO_SLEEP_ALT 12
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001402
1403static ssize_t tma340_vkeys_show(struct kobject *kobj,
1404 struct kobj_attribute *attr, char *buf)
1405{
1406 return snprintf(buf, 200,
1407 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1408 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1409 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1410 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1411 "\n");
1412}
1413
1414static struct kobj_attribute tma340_vkeys_attr = {
1415 .attr = {
1416 .mode = S_IRUGO,
1417 },
1418 .show = &tma340_vkeys_show,
1419};
1420
1421static struct attribute *tma340_properties_attrs[] = {
1422 &tma340_vkeys_attr.attr,
1423 NULL
1424};
1425
1426static struct attribute_group tma340_properties_attr_group = {
1427 .attrs = tma340_properties_attrs,
1428};
1429
1430static int cyttsp_platform_init(struct i2c_client *client)
1431{
1432 int rc = 0;
1433 static struct kobject *tma340_properties_kobj;
1434
1435 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1436 tma340_properties_kobj = kobject_create_and_add("board_properties",
1437 NULL);
1438 if (tma340_properties_kobj)
1439 rc = sysfs_create_group(tma340_properties_kobj,
1440 &tma340_properties_attr_group);
1441 if (!tma340_properties_kobj || rc)
1442 pr_err("%s: failed to create board_properties\n",
1443 __func__);
1444
1445 return 0;
1446}
1447
1448static struct cyttsp_regulator cyttsp_regulator_data[] = {
1449 {
1450 .name = "vdd",
1451 .min_uV = CY_TMA300_VTG_MIN_UV,
1452 .max_uV = CY_TMA300_VTG_MAX_UV,
1453 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1454 .lpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1455 },
1456 {
1457 .name = "vcc_i2c",
1458 .min_uV = CY_I2C_VTG_MIN_UV,
1459 .max_uV = CY_I2C_VTG_MAX_UV,
1460 .hpm_load_uA = CY_I2C_CURR_UA,
1461 .lpm_load_uA = CY_I2C_CURR_UA,
1462 },
1463};
1464
1465static struct cyttsp_platform_data cyttsp_pdata = {
1466 .panel_maxx = 634,
1467 .panel_maxy = 1166,
1468 .disp_maxx = 599,
1469 .disp_maxy = 1023,
1470 .disp_minx = 0,
1471 .disp_miny = 0,
1472 .flags = 0x01,
1473 .gen = CY_GEN3,
1474 .use_st = CY_USE_ST,
1475 .use_mt = CY_USE_MT,
1476 .use_hndshk = CY_SEND_HNDSHK,
1477 .use_trk_id = CY_USE_TRACKING_ID,
1478 .use_sleep = CY_USE_DEEP_SLEEP_SEL,
1479 .use_gestures = CY_USE_GESTURES,
1480 .fw_fname = "cyttsp_8064_mtp.hex",
1481 /* change act_intrvl to customize the Active power state
1482 * scanning/processing refresh interval for Operating mode
1483 */
1484 .act_intrvl = CY_ACT_INTRVL_DFLT,
1485 /* change tch_tmout to customize the touch timeout for the
1486 * Active power state for Operating mode
1487 */
1488 .tch_tmout = CY_TCH_TMOUT_DFLT,
1489 /* change lp_intrvl to customize the Low Power power state
1490 * scanning/processing refresh interval for Operating mode
1491 */
1492 .lp_intrvl = CY_LP_INTRVL_DFLT,
1493 .sleep_gpio = CYTTSP_TS_GPIO_SLEEP,
Amy Maloche9ba3ffe2012-04-26 10:31:20 -07001494 .resout_gpio = -1,
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001495 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1496 .regulator_info = cyttsp_regulator_data,
1497 .num_regulators = ARRAY_SIZE(cyttsp_regulator_data),
1498 .init = cyttsp_platform_init,
1499 .correct_fw_ver = 17,
1500};
1501
1502static struct i2c_board_info cyttsp_info[] __initdata = {
1503 {
1504 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1505 .platform_data = &cyttsp_pdata,
1506 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1507 },
1508};
Jing Lin21ed4de2012-02-05 15:53:28 -08001509
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001510#define MSM_WCNSS_PHYS 0x03000000
1511#define MSM_WCNSS_SIZE 0x280000
1512
1513static struct resource resources_wcnss_wlan[] = {
1514 {
1515 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1516 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1517 .name = "wcnss_wlanrx_irq",
1518 .flags = IORESOURCE_IRQ,
1519 },
1520 {
1521 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1522 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1523 .name = "wcnss_wlantx_irq",
1524 .flags = IORESOURCE_IRQ,
1525 },
1526 {
1527 .start = MSM_WCNSS_PHYS,
1528 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1529 .name = "wcnss_mmio",
1530 .flags = IORESOURCE_MEM,
1531 },
1532 {
1533 .start = 64,
1534 .end = 68,
1535 .name = "wcnss_gpios_5wire",
1536 .flags = IORESOURCE_IO,
1537 },
1538};
1539
1540static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1541 .has_48mhz_xo = 1,
1542};
1543
1544static struct platform_device msm_device_wcnss_wlan = {
1545 .name = "wcnss_wlan",
1546 .id = 0,
1547 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1548 .resource = resources_wcnss_wlan,
1549 .dev = {.platform_data = &qcom_wcnss_pdata},
1550};
1551
Ankit Vermab7c26e62012-02-28 15:04:15 -08001552static struct platform_device msm_device_iris_fm __devinitdata = {
1553 .name = "iris_fm",
1554 .id = -1,
1555};
1556
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001557#ifdef CONFIG_QSEECOM
1558/* qseecom bus scaling */
1559static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
1560 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001561 .src = MSM_BUS_MASTER_ADM_PORT0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001562 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001563 .ab = 0,
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001564 .ib = 0,
1565 },
1566 {
1567 .src = MSM_BUS_MASTER_ADM_PORT1,
1568 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1569 .ab = 0,
1570 .ib = 0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001571 },
1572 {
1573 .src = MSM_BUS_MASTER_SPDM,
1574 .dst = MSM_BUS_SLAVE_SPDM,
1575 .ib = 0,
1576 .ab = 0,
1577 },
1578};
1579
1580static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
1581 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001582 .src = MSM_BUS_MASTER_ADM_PORT0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001583 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001584 .ab = 70000000UL,
1585 .ib = 70000000UL,
1586 },
1587 {
1588 .src = MSM_BUS_MASTER_ADM_PORT1,
1589 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1590 .ab = 2480000000UL,
1591 .ib = 2480000000UL,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001592 },
1593 {
1594 .src = MSM_BUS_MASTER_SPDM,
1595 .dst = MSM_BUS_SLAVE_SPDM,
1596 .ib = 0,
1597 .ab = 0,
1598 },
1599};
1600
1601static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1602 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001603 .src = MSM_BUS_MASTER_ADM_PORT0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001604 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001605 .ab = 0,
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001606 .ib = 0,
1607 },
1608 {
1609 .src = MSM_BUS_MASTER_ADM_PORT1,
1610 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1611 .ab = 0,
1612 .ib = 0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001613 },
1614 {
1615 .src = MSM_BUS_MASTER_SPDM,
1616 .dst = MSM_BUS_SLAVE_SPDM,
1617 .ib = (64 * 8) * 1000000UL,
1618 .ab = (64 * 8) * 100000UL,
1619 },
1620};
1621
1622static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1623 {
1624 ARRAY_SIZE(qseecom_clks_init_vectors),
1625 qseecom_clks_init_vectors,
1626 },
1627 {
1628 ARRAY_SIZE(qseecom_enable_dfab_vectors),
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001629 qseecom_enable_dfab_vectors,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001630 },
1631 {
1632 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1633 qseecom_enable_sfpb_vectors,
1634 },
1635};
1636
1637static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1638 qseecom_hw_bus_scale_usecases,
1639 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1640 .name = "qsee",
1641};
1642
1643static struct platform_device qseecom_device = {
1644 .name = "qseecom",
1645 .id = 0,
1646 .dev = {
1647 .platform_data = &qseecom_bus_pdata,
1648 },
1649};
1650#endif
1651
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001652#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1653 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1654 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1655 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1656
1657#define QCE_SIZE 0x10000
1658#define QCE_0_BASE 0x11000000
1659
1660#define QCE_HW_KEY_SUPPORT 0
1661#define QCE_SHA_HMAC_SUPPORT 1
1662#define QCE_SHARE_CE_RESOURCE 3
1663#define QCE_CE_SHARED 0
1664
1665static struct resource qcrypto_resources[] = {
1666 [0] = {
1667 .start = QCE_0_BASE,
1668 .end = QCE_0_BASE + QCE_SIZE - 1,
1669 .flags = IORESOURCE_MEM,
1670 },
1671 [1] = {
1672 .name = "crypto_channels",
1673 .start = DMOV8064_CE_IN_CHAN,
1674 .end = DMOV8064_CE_OUT_CHAN,
1675 .flags = IORESOURCE_DMA,
1676 },
1677 [2] = {
1678 .name = "crypto_crci_in",
1679 .start = DMOV8064_CE_IN_CRCI,
1680 .end = DMOV8064_CE_IN_CRCI,
1681 .flags = IORESOURCE_DMA,
1682 },
1683 [3] = {
1684 .name = "crypto_crci_out",
1685 .start = DMOV8064_CE_OUT_CRCI,
1686 .end = DMOV8064_CE_OUT_CRCI,
1687 .flags = IORESOURCE_DMA,
1688 },
1689};
1690
1691static struct resource qcedev_resources[] = {
1692 [0] = {
1693 .start = QCE_0_BASE,
1694 .end = QCE_0_BASE + QCE_SIZE - 1,
1695 .flags = IORESOURCE_MEM,
1696 },
1697 [1] = {
1698 .name = "crypto_channels",
1699 .start = DMOV8064_CE_IN_CHAN,
1700 .end = DMOV8064_CE_OUT_CHAN,
1701 .flags = IORESOURCE_DMA,
1702 },
1703 [2] = {
1704 .name = "crypto_crci_in",
1705 .start = DMOV8064_CE_IN_CRCI,
1706 .end = DMOV8064_CE_IN_CRCI,
1707 .flags = IORESOURCE_DMA,
1708 },
1709 [3] = {
1710 .name = "crypto_crci_out",
1711 .start = DMOV8064_CE_OUT_CRCI,
1712 .end = DMOV8064_CE_OUT_CRCI,
1713 .flags = IORESOURCE_DMA,
1714 },
1715};
1716
1717#endif
1718
1719#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1720 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1721
1722static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1723 .ce_shared = QCE_CE_SHARED,
1724 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1725 .hw_key_support = QCE_HW_KEY_SUPPORT,
1726 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001727 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001728};
1729
1730static struct platform_device qcrypto_device = {
1731 .name = "qcrypto",
1732 .id = 0,
1733 .num_resources = ARRAY_SIZE(qcrypto_resources),
1734 .resource = qcrypto_resources,
1735 .dev = {
1736 .coherent_dma_mask = DMA_BIT_MASK(32),
1737 .platform_data = &qcrypto_ce_hw_suppport,
1738 },
1739};
1740#endif
1741
1742#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1743 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1744
1745static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1746 .ce_shared = QCE_CE_SHARED,
1747 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1748 .hw_key_support = QCE_HW_KEY_SUPPORT,
1749 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001750 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001751};
1752
1753static struct platform_device qcedev_device = {
1754 .name = "qce",
1755 .id = 0,
1756 .num_resources = ARRAY_SIZE(qcedev_resources),
1757 .resource = qcedev_resources,
1758 .dev = {
1759 .coherent_dma_mask = DMA_BIT_MASK(32),
1760 .platform_data = &qcedev_ce_hw_suppport,
1761 },
1762};
1763#endif
1764
Joel Kingef390842012-05-23 16:42:48 -07001765static struct mdm_vddmin_resource mdm_vddmin_rscs = {
1766 .rpm_id = MSM_RPM_ID_VDDMIN_GPIO,
1767 .ap2mdm_vddmin_gpio = 30,
1768 .modes = 0x03,
1769 .drive_strength = 8,
1770 .mdm2ap_vddmin_gpio = 80,
1771};
1772
Joel King269aa602012-07-23 08:07:35 -07001773static struct gpiomux_setting mdm2ap_status_gpio_run_cfg = {
1774 .func = GPIOMUX_FUNC_GPIO,
1775 .drv = GPIOMUX_DRV_8MA,
1776 .pull = GPIOMUX_PULL_NONE,
1777};
1778
Joel Kingdacbc822012-01-25 13:30:57 -08001779static struct mdm_platform_data mdm_platform_data = {
1780 .mdm_version = "3.0",
1781 .ramdump_delay_ms = 2000,
Joel King14fe7fa2012-05-27 14:26:11 -07001782 .early_power_on = 1,
1783 .sfr_query = 1,
Joel Kingef390842012-05-23 16:42:48 -07001784 .vddmin_resource = &mdm_vddmin_rscs,
Hemant Kumara945b472012-01-25 15:08:06 -08001785 .peripheral_platform_device = &apq8064_device_hsic_host,
Ameya Thakurc9a7a842012-06-24 22:47:52 -07001786 .ramdump_timeout_ms = 120000,
Joel King269aa602012-07-23 08:07:35 -07001787 .mdm2ap_status_gpio_run_cfg = &mdm2ap_status_gpio_run_cfg,
Joel Kingdacbc822012-01-25 13:30:57 -08001788};
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001789
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001790static struct tsens_platform_data apq_tsens_pdata = {
1791 .tsens_factor = 1000,
1792 .hw_type = APQ_8064,
1793 .tsens_num_sensor = 11,
1794 .slope = {1176, 1176, 1154, 1176, 1111,
1795 1132, 1132, 1199, 1132, 1199, 1132},
1796};
1797
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07001798static struct platform_device msm_tsens_device = {
1799 .name = "tsens8960-tm",
1800 .id = -1,
1801};
1802
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06001803static struct msm_thermal_data msm_thermal_pdata = {
1804 .sensor_id = 7,
Eugene Seah2ee4a5d2012-06-25 18:16:41 -06001805 .poll_ms = 250,
1806 .limit_temp_degC = 60,
1807 .temp_hysteresis_degC = 10,
1808 .freq_step = 2,
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06001809};
1810
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001811#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001812static void __init apq8064_map_io(void)
1813{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001814 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001815 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001816 if (socinfo_init() < 0)
1817 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001818}
1819
1820static void __init apq8064_init_irq(void)
1821{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001822 struct msm_mpm_device_data *data = NULL;
1823
1824#ifdef CONFIG_MSM_MPM
1825 data = &apq8064_mpm_dev_data;
1826#endif
1827
1828 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001829 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1830 (void *)MSM_QGIC_CPU_BASE);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001831}
1832
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001833static struct platform_device msm8064_device_saw_regulator_core0 = {
1834 .name = "saw-regulator",
1835 .id = 0,
1836 .dev = {
1837 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
1838 },
1839};
1840
1841static struct platform_device msm8064_device_saw_regulator_core1 = {
1842 .name = "saw-regulator",
1843 .id = 1,
1844 .dev = {
1845 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
1846 },
1847};
1848
1849static struct platform_device msm8064_device_saw_regulator_core2 = {
1850 .name = "saw-regulator",
1851 .id = 2,
1852 .dev = {
1853 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
1854 },
1855};
1856
1857static struct platform_device msm8064_device_saw_regulator_core3 = {
1858 .name = "saw-regulator",
1859 .id = 3,
1860 .dev = {
1861 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001862
1863 },
1864};
1865
Oluwafemi Adeyemif5a31422012-03-08 16:58:45 -08001866static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001867 {
1868 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1869 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1870 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001871 1, 784, 180000, 100,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001872 },
1873
1874 {
1875 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1876 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1877 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001878 1300, 228, 1200000, 2000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001879 },
1880
1881 {
1882 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1883 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1884 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001885 2000, 138, 1208400, 3200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001886 },
1887
1888 {
1889 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001890 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
1891 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001892 6000, 119, 1850300, 9000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001893 },
1894
1895 {
1896 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1897 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1898 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001899 9200, 68, 2839200, 16400,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001900 },
1901
1902 {
1903 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1904 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1905 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001906 10300, 63, 3128000, 18200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001907 },
1908
1909 {
1910 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1911 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1912 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001913 18000, 10, 4602600, 27000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001914 },
1915
1916 {
1917 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1918 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1919 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06001920 20000, 2, 5752000, 32000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001921 },
1922};
1923
1924static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1925 .mode = MSM_PM_BOOT_CONFIG_TZ,
1926};
1927
1928static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
1929 .levels = &msm_rpmrs_levels[0],
1930 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
1931 .vdd_mem_levels = {
1932 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
1933 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
1934 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
1935 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
1936 },
1937 .vdd_dig_levels = {
1938 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
1939 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
1940 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
1941 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
1942 },
1943 .vdd_mask = 0x7FFFFF,
1944 .rpmrs_target_id = {
1945 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
1946 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
1947 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
1948 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
1949 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
1950 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
1951 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
1952 },
1953};
1954
Praveen Chidambaram78499012011-11-01 17:15:17 -06001955static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1956 0x03, 0x0f,
1957};
1958
1959static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1960 0x00, 0x24, 0x54, 0x10,
1961 0x09, 0x03, 0x01,
1962 0x10, 0x54, 0x30, 0x0C,
1963 0x24, 0x30, 0x0f,
1964};
1965
1966static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1967 0x00, 0x24, 0x54, 0x10,
1968 0x09, 0x07, 0x01, 0x0B,
1969 0x10, 0x54, 0x30, 0x0C,
1970 0x24, 0x30, 0x0f,
1971};
1972
1973static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1974 [0] = {
1975 .mode = MSM_SPM_MODE_CLOCK_GATING,
1976 .notify_rpm = false,
1977 .cmd = spm_wfi_cmd_sequence,
1978 },
1979 [1] = {
1980 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1981 .notify_rpm = false,
1982 .cmd = spm_power_collapse_without_rpm,
1983 },
1984 [2] = {
1985 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1986 .notify_rpm = true,
1987 .cmd = spm_power_collapse_with_rpm,
1988 },
1989};
1990
1991static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1992 0x00, 0x20, 0x03, 0x20,
1993 0x00, 0x0f,
1994};
1995
1996static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1997 0x00, 0x20, 0x34, 0x64,
1998 0x48, 0x07, 0x48, 0x20,
1999 0x50, 0x64, 0x04, 0x34,
2000 0x50, 0x0f,
2001};
2002static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
2003 0x00, 0x10, 0x34, 0x64,
2004 0x48, 0x07, 0x48, 0x10,
2005 0x50, 0x64, 0x04, 0x34,
2006 0x50, 0x0F,
2007};
2008
2009static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
2010 [0] = {
2011 .mode = MSM_SPM_L2_MODE_RETENTION,
2012 .notify_rpm = false,
2013 .cmd = l2_spm_wfi_cmd_sequence,
2014 },
2015 [1] = {
2016 .mode = MSM_SPM_L2_MODE_GDHS,
2017 .notify_rpm = true,
2018 .cmd = l2_spm_gdhs_cmd_sequence,
2019 },
2020 [2] = {
2021 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
2022 .notify_rpm = true,
2023 .cmd = l2_spm_power_off_cmd_sequence,
2024 },
2025};
2026
2027
2028static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
2029 [0] = {
2030 .reg_base_addr = MSM_SAW_L2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002031 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07002032 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002033 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
2034 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
2035 .modes = msm_spm_l2_seq_list,
2036 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
2037 },
2038};
2039
2040static struct msm_spm_platform_data msm_spm_data[] __initdata = {
2041 [0] = {
2042 .reg_base_addr = MSM_SAW0_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002043 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002044#if defined(CONFIG_MSM_AVS_HW)
2045 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2046 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2047#endif
2048 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07002049 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002050 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2051 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2052 .vctl_timeout_us = 50,
2053 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2054 .modes = msm_spm_seq_list,
2055 },
2056 [1] = {
2057 .reg_base_addr = MSM_SAW1_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002058 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002059#if defined(CONFIG_MSM_AVS_HW)
2060 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2061 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2062#endif
2063 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07002064 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002065 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2066 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2067 .vctl_timeout_us = 50,
2068 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2069 .modes = msm_spm_seq_list,
2070 },
2071 [2] = {
2072 .reg_base_addr = MSM_SAW2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002073 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002074#if defined(CONFIG_MSM_AVS_HW)
2075 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2076 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2077#endif
2078 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07002079 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002080 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2081 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2082 .vctl_timeout_us = 50,
2083 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2084 .modes = msm_spm_seq_list,
2085 },
2086 [3] = {
2087 .reg_base_addr = MSM_SAW3_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002088 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002089#if defined(CONFIG_MSM_AVS_HW)
2090 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2091 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2092#endif
2093 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07002094 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002095 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2096 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2097 .vctl_timeout_us = 50,
2098 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2099 .modes = msm_spm_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08002100 },
2101};
2102
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002103static void __init apq8064_init_buses(void)
2104{
2105 msm_bus_rpm_set_mt_mask();
2106 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
2107 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
2108 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
2109 msm_bus_8064_apps_fabric.dev.platform_data =
2110 &msm_bus_8064_apps_fabric_pdata;
2111 msm_bus_8064_sys_fabric.dev.platform_data =
2112 &msm_bus_8064_sys_fabric_pdata;
2113 msm_bus_8064_mm_fabric.dev.platform_data =
2114 &msm_bus_8064_mm_fabric_pdata;
2115 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
2116 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
2117}
2118
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002119/* PCIe gpios */
2120static struct msm_pcie_gpio_info_t msm_pcie_gpio_info[MSM_PCIE_MAX_GPIO] = {
2121 {"rst_n", PM8921_MPP_PM_TO_SYS(PCIE_RST_N_PMIC_MPP), 0},
2122 {"pwr_en", PM8921_GPIO_PM_TO_SYS(PCIE_PWR_EN_PMIC_GPIO), 1},
2123};
2124
2125static struct msm_pcie_platform msm_pcie_platform_data = {
2126 .gpio = msm_pcie_gpio_info,
Niranjana Vishwanathapura68210ff2012-06-24 18:03:49 -06002127 .axi_addr = PCIE_AXI_BAR_PHYS,
2128 .axi_size = PCIE_AXI_BAR_SIZE,
Niranjana Vishwanathapura459a27d2012-07-20 12:23:55 -06002129 .wake_n = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, PCIE_WAKE_N_PMIC_GPIO),
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002130};
2131
Niranjana Vishwanathapurac1edd402012-06-28 15:32:50 -06002132static int __init mpq8064_pcie_enabled(void)
2133{
2134 return !((readl_relaxed(QFPROM_RAW_FEAT_CONFIG_ROW0_MSB) & BIT(21)) ||
2135 (readl_relaxed(QFPROM_RAW_OEM_CONFIG_ROW0_LSB) & BIT(4)));
2136}
2137
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002138static void __init mpq8064_pcie_init(void)
2139{
Niranjana Vishwanathapurac1edd402012-06-28 15:32:50 -06002140 if (mpq8064_pcie_enabled()) {
2141 msm_device_pcie.dev.platform_data = &msm_pcie_platform_data;
2142 platform_device_register(&msm_device_pcie);
2143 }
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002144}
2145
David Collinsf0d00732012-01-25 15:46:50 -08002146static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
2147 .name = GPIO_REGULATOR_DEV_NAME,
2148 .id = PM8921_MPP_PM_TO_SYS(7),
2149 .dev = {
2150 .platform_data
2151 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2152 },
2153};
2154
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08002155static struct platform_device apq8064_device_ext_mpp8_vreg __devinitdata = {
2156 .name = GPIO_REGULATOR_DEV_NAME,
2157 .id = PM8921_MPP_PM_TO_SYS(8),
2158 .dev = {
2159 .platform_data
2160 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_MPP8],
2161 },
2162};
2163
David Collinsf0d00732012-01-25 15:46:50 -08002164static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
2165 .name = GPIO_REGULATOR_DEV_NAME,
2166 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
2167 .dev = {
2168 .platform_data =
2169 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2170 },
2171};
2172
David Collins390fc332012-02-07 14:38:16 -08002173static struct platform_device apq8064_device_ext_ts_sw_vreg __devinitdata = {
2174 .name = GPIO_REGULATOR_DEV_NAME,
2175 .id = PM8921_GPIO_PM_TO_SYS(23),
2176 .dev = {
2177 .platform_data
2178 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_TS_SW],
2179 },
2180};
2181
David Collins2782b5c2012-02-06 10:02:42 -08002182static struct platform_device apq8064_device_rpm_regulator __devinitdata = {
2183 .name = "rpm-regulator",
David Collins36199252012-08-21 15:43:02 -07002184 .id = 0,
David Collins2782b5c2012-02-06 10:02:42 -08002185 .dev = {
2186 .platform_data = &apq8064_rpm_regulator_pdata,
2187 },
2188};
2189
David Collins36199252012-08-21 15:43:02 -07002190static struct platform_device
2191apq8064_pm8921_device_rpm_regulator __devinitdata = {
2192 .name = "rpm-regulator",
2193 .id = 1,
2194 .dev = {
2195 .platform_data = &apq8064_rpm_regulator_pm8921_pdata,
2196 },
2197};
2198
Ravi Kumar V05931a22012-04-04 17:09:37 +05302199static struct gpio_ir_recv_platform_data gpio_ir_recv_pdata = {
2200 .gpio_nr = 88,
2201 .active_low = 1,
2202};
2203
2204static struct platform_device gpio_ir_recv_pdev = {
2205 .name = "gpio-rc-recv",
2206 .dev = {
2207 .platform_data = &gpio_ir_recv_pdata,
2208 },
2209};
2210
Terence Hampson36b70722012-05-10 13:18:16 -04002211static struct platform_device *common_not_mpq_devices[] __initdata = {
David Keitel3c40fc52012-02-09 17:53:52 -08002212 &apq8064_device_qup_i2c_gsbi1,
Jing Lin04601f92012-02-05 15:36:07 -08002213 &apq8064_device_qup_i2c_gsbi3,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002214 &apq8064_device_qup_i2c_gsbi4,
Terence Hampson36b70722012-05-10 13:18:16 -04002215};
2216
David Collins36199252012-08-21 15:43:02 -07002217static struct platform_device *early_common_devices[] __initdata = {
Matt Wagantallf5cc3892012-06-07 19:47:02 -07002218 &apq8064_device_acpuclk,
Terence Hampson36b70722012-05-10 13:18:16 -04002219 &apq8064_device_dmov,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002220 &apq8064_device_qup_spi_gsbi5,
David Collins36199252012-08-21 15:43:02 -07002221};
2222
2223static struct platform_device *pm8921_common_devices[] __initdata = {
David Collinsf0d00732012-01-25 15:46:50 -08002224 &apq8064_device_ext_5v_vreg,
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08002225 &apq8064_device_ext_mpp8_vreg,
David Collinsf0d00732012-01-25 15:46:50 -08002226 &apq8064_device_ext_3p3v_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07002227 &apq8064_device_ssbi_pmic1,
2228 &apq8064_device_ssbi_pmic2,
Steve Mucklef132c6c2012-06-06 18:30:57 -07002229 &apq8064_device_ext_ts_sw_vreg,
David Collins36199252012-08-21 15:43:02 -07002230};
2231
2232static struct platform_device *pm8917_common_devices[] __initdata = {
2233 &apq8064_device_ext_mpp8_vreg,
2234 &apq8064_device_ext_3p3v_vreg,
2235 &apq8064_device_ssbi_pmic1,
2236 &apq8064_device_ssbi_pmic2,
2237 &apq8064_device_ext_ts_sw_vreg,
2238};
2239
2240static struct platform_device *common_devices[] __initdata = {
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06002241 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07002242 &apq8064_device_otg,
2243 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08002244 &apq8064_device_hsusb_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07002245 &android_usb_device,
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08002246 &msm_device_wcnss_wlan,
Ankit Vermab7c26e62012-02-28 15:04:15 -08002247 &msm_device_iris_fm,
Larry Bassel67b921d2012-04-06 10:23:27 -07002248 &apq8064_fmem_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08002249#ifdef CONFIG_ANDROID_PMEM
2250#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002251 &apq8064_android_pmem_device,
2252 &apq8064_android_pmem_adsp_device,
2253 &apq8064_android_pmem_audio_device,
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -07002254#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
2255#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -08002256#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002257 &apq8064_ion_dev,
Olav Haugan7c6aa742012-01-16 16:47:37 -08002258#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002259 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08002260 &msm8064_device_saw_regulator_core0,
2261 &msm8064_device_saw_regulator_core1,
2262 &msm8064_device_saw_regulator_core2,
2263 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002264#if defined(CONFIG_QSEECOM)
2265 &qseecom_device,
2266#endif
2267
Joel Nider6b9a7bc2012-06-26 11:19:19 +03002268 &msm_8064_device_tsif[0],
2269 &msm_8064_device_tsif[1],
2270
Ramesh Masavarapu28311912011-10-27 11:04:12 -07002271#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2272 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2273 &qcrypto_device,
2274#endif
2275
2276#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2277 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2278 &qcedev_device,
2279#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07002280
2281#ifdef CONFIG_HW_RANDOM_MSM
2282 &apq8064_device_rng,
2283#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002284 &apq_pcm,
2285 &apq_pcm_routing,
2286 &apq_cpudai0,
2287 &apq_cpudai1,
Santosh Mardieff9a742012-04-09 23:23:39 +05302288 &mpq_cpudai_sec_i2s_rx,
Kuirong Wangf23f8c52012-03-31 12:34:51 -07002289 &mpq_cpudai_mi2s_tx,
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002290 &apq_cpudai_hdmi_rx,
2291 &apq_cpudai_bt_rx,
2292 &apq_cpudai_bt_tx,
2293 &apq_cpudai_fm_rx,
2294 &apq_cpudai_fm_tx,
2295 &apq_cpu_fe,
2296 &apq_stub_codec,
2297 &apq_voice,
2298 &apq_voip,
2299 &apq_lpa_pcm,
Krishnankutty Kolathappilly4374e332012-03-18 22:27:30 -07002300 &apq_compr_dsp,
2301 &apq_multi_ch_pcm,
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -07002302 &apq_lowlatency_pcm,
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002303 &apq_pcm_hostless,
2304 &apq_cpudai_afe_01_rx,
2305 &apq_cpudai_afe_01_tx,
2306 &apq_cpudai_afe_02_rx,
2307 &apq_cpudai_afe_02_tx,
2308 &apq_pcm_afe,
2309 &apq_cpudai_auxpcm_rx,
2310 &apq_cpudai_auxpcm_tx,
Neema Shetty8427c262012-02-16 11:23:43 -08002311 &apq_cpudai_stub,
Neema Shetty3c9d2862012-03-11 01:25:32 -08002312 &apq_cpudai_slimbus_1_rx,
2313 &apq_cpudai_slimbus_1_tx,
Kiran Kandi97fe19d2012-05-20 22:34:04 -07002314 &apq_cpudai_slimbus_2_rx,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002315 &apq_cpudai_slimbus_2_tx,
Neema Shettyc9d86c32012-05-09 12:01:39 -07002316 &apq_cpudai_slimbus_3_rx,
Helen Zeng38c3c962012-05-17 14:56:20 -07002317 &apq_cpudai_slimbus_3_tx,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002318 &apq8064_rpm_device,
2319 &apq8064_rpm_log_device,
2320 &apq8064_rpm_stat_device,
Anji Jonnala2a8bd312012-11-01 13:11:42 +05302321 &apq8064_rpm_master_stat_device,
Ramesh Masavarapuf31ff242012-05-10 18:55:21 -07002322 &apq_device_tz_log,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002323 &msm_bus_8064_apps_fabric,
2324 &msm_bus_8064_sys_fabric,
2325 &msm_bus_8064_mm_fabric,
2326 &msm_bus_8064_sys_fpb,
2327 &msm_bus_8064_cpss_fpb,
Mohan Kumar Gubbihalli Lachma Naik7f72edd2012-02-06 17:26:47 -08002328 &apq8064_msm_device_vidc,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07002329 &msm_pil_dsps,
Matt Wagantallb94b9a52012-02-02 21:59:54 -08002330 &msm_8960_q6_lpass,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002331 &msm_pil_vidc,
Matt Wagantall292aace2012-01-26 19:12:34 -08002332 &msm_gss,
Laura Abbottb93525f2012-04-12 09:57:19 -07002333 &apq8064_rtb_device,
Steve Mucklea9aac292012-11-02 15:41:00 -07002334 &apq8064_dcvs_device,
Abhijeet Dharmapurikarde91d2c2012-08-23 14:36:59 -07002335 &apq8064_msm_gov_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002336 &apq8064_device_cache_erp,
Stepan Moskovchenko0f3de112012-06-08 18:11:46 -07002337 &msm8960_device_ebi1_ch0_erp,
2338 &msm8960_device_ebi1_ch1_erp,
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002339 &epm_adc_device,
Pratik Patel3b0ca882012-06-01 16:54:14 -07002340 &coresight_tpiu_device,
2341 &coresight_etb_device,
2342 &apq8064_coresight_funnel_device,
2343 &coresight_etm0_device,
2344 &coresight_etm1_device,
2345 &coresight_etm2_device,
2346 &coresight_etm3_device,
Helen Zeng8f925502012-03-05 16:50:17 -08002347 &apq_cpudai_slim_4_rx,
2348 &apq_cpudai_slim_4_tx,
Steve Mucklef132c6c2012-06-06 18:30:57 -07002349#ifdef CONFIG_MSM_GEMINI
Jignesh Mehta921649d2012-04-19 06:57:23 -07002350 &msm8960_gemini_device,
Steve Mucklef132c6c2012-06-06 18:30:57 -07002351#endif
Laura Abbott0577d7b2012-04-17 11:14:30 -07002352 &apq8064_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002353 &msm_tsens_device,
Laura Abbott93a4a352012-05-25 09:26:35 -07002354 &apq8064_cache_dump_device,
Joel Nider0e4a16d2012-08-05 14:20:11 +03002355 &msm_8064_device_tspp,
Abhijeet Dharmapurikarde91d2c2012-08-23 14:36:59 -07002356#ifdef CONFIG_BATTERY_BCL
2357 &battery_bcl_device,
2358#endif
2359 &apq8064_msm_mpd_device,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002360};
2361
Joel King82b7e3f2012-01-05 10:03:27 -08002362static struct platform_device *cdp_devices[] __initdata = {
2363 &apq8064_device_uart_gsbi1,
Jin Hong4bbbfba2012-02-02 21:48:07 -08002364 &apq8064_device_uart_gsbi7,
Joel King82b7e3f2012-01-05 10:03:27 -08002365 &msm_device_sps_apq8064,
Aravind Venkateswaran4ca27532012-02-16 14:27:05 -08002366#ifdef CONFIG_MSM_ROTATOR
2367 &msm_rotator_device,
2368#endif
Joel King82b7e3f2012-01-05 10:03:27 -08002369};
2370
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002371static struct platform_device
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002372mpq8064_device_ext_1p2_buck_vreg __devinitdata = {
2373 .name = GPIO_REGULATOR_DEV_NAME,
2374 .id = SX150X_GPIO(4, 2),
2375 .dev = {
2376 .platform_data =
2377 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P2V],
2378 },
2379};
2380
2381static struct platform_device
2382mpq8064_device_ext_1p8_buck_vreg __devinitdata = {
2383 .name = GPIO_REGULATOR_DEV_NAME,
2384 .id = SX150X_GPIO(4, 4),
2385 .dev = {
2386 .platform_data =
2387 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P8V],
2388 },
2389};
2390
2391static struct platform_device
2392mpq8064_device_ext_2p2_buck_vreg __devinitdata = {
2393 .name = GPIO_REGULATOR_DEV_NAME,
2394 .id = SX150X_GPIO(4, 14),
2395 .dev = {
2396 .platform_data =
2397 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_2P2V],
2398 },
2399};
2400
2401static struct platform_device
2402mpq8064_device_ext_5v_buck_vreg __devinitdata = {
2403 .name = GPIO_REGULATOR_DEV_NAME,
2404 .id = SX150X_GPIO(4, 3),
2405 .dev = {
2406 .platform_data =
2407 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_5V],
2408 },
2409};
2410
2411static struct platform_device
2412mpq8064_device_ext_3p3v_ldo_vreg __devinitdata = {
2413 .name = GPIO_REGULATOR_DEV_NAME,
2414 .id = SX150X_GPIO(4, 15),
2415 .dev = {
2416 .platform_data =
2417 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_3P3V],
2418 },
2419};
2420
Ravi Kumar V1c903012012-05-15 16:11:35 +05302421static struct platform_device rc_input_loopback_pdev = {
2422 .name = "rc-user-input",
2423 .id = -1,
2424};
2425
Ravi Kumar V040eeff2012-05-23 21:29:23 +05302426static int rf4ce_gpio_init(void)
2427{
Ravi Kumar V0143c582012-08-14 17:18:11 +05302428 if (!machine_is_mpq8064_cdp() &&
2429 !machine_is_mpq8064_hrd() &&
2430 !machine_is_mpq8064_dtv())
Ravi Kumar V040eeff2012-05-23 21:29:23 +05302431 return -EINVAL;
2432
2433 /* CC2533 SRDY Input */
2434 if (!gpio_request(SX150X_GPIO(4, 6), "rf4ce_srdy")) {
2435 gpio_direction_input(SX150X_GPIO(4, 6));
2436 gpio_export(SX150X_GPIO(4, 6), true);
2437 }
2438
2439 /* CC2533 MRDY Output */
2440 if (!gpio_request(SX150X_GPIO(4, 5), "rf4ce_mrdy")) {
2441 gpio_direction_output(SX150X_GPIO(4, 5), 1);
2442 gpio_export(SX150X_GPIO(4, 5), true);
2443 }
2444
2445 /* CC2533 Reset Output */
2446 if (!gpio_request(SX150X_GPIO(4, 7), "rf4ce_reset")) {
2447 gpio_direction_output(SX150X_GPIO(4, 7), 0);
2448 gpio_export(SX150X_GPIO(4, 7), true);
2449 }
2450
2451 return 0;
2452}
2453late_initcall(rf4ce_gpio_init);
2454
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002455static struct platform_device *mpq_devices[] __initdata = {
2456 &msm_device_sps_apq8064,
2457 &mpq8064_device_qup_i2c_gsbi5,
2458#ifdef CONFIG_MSM_ROTATOR
2459 &msm_rotator_device,
2460#endif
Ravi Kumar V05931a22012-04-04 17:09:37 +05302461 &gpio_ir_recv_pdev,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002462 &mpq8064_device_ext_1p2_buck_vreg,
2463 &mpq8064_device_ext_1p8_buck_vreg,
2464 &mpq8064_device_ext_2p2_buck_vreg,
2465 &mpq8064_device_ext_5v_buck_vreg,
2466 &mpq8064_device_ext_3p3v_ldo_vreg,
Terence Hampson2e1705f2012-04-11 19:55:29 -04002467#ifdef CONFIG_MSM_VCAP
2468 &msm8064_device_vcap,
2469#endif
Ravi Kumar V1c903012012-05-15 16:11:35 +05302470 &rc_input_loopback_pdev,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002471};
2472
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002473static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002474 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002475};
2476
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002477#define KS8851_IRQ_GPIO 43
2478
2479static struct spi_board_info spi_board_info[] __initdata = {
2480 {
2481 .modalias = "ks8851",
2482 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2483 .max_speed_hz = 19200000,
2484 .bus_num = 0,
2485 .chip_select = 2,
2486 .mode = SPI_MODE_0,
2487 },
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002488 {
2489 .modalias = "epm_adc",
2490 .max_speed_hz = 1100000,
2491 .bus_num = 0,
2492 .chip_select = 3,
2493 .mode = SPI_MODE_0,
2494 },
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002495};
2496
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002497static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002498 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08002499 .bus_num = 1,
2500 .slim_slave = &apq8064_slim_tabla,
2501 },
2502 {
2503 .bus_num = 1,
2504 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002505 },
2506 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002507};
2508
David Keitel3c40fc52012-02-09 17:53:52 -08002509static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi1_pdata = {
2510 .clk_freq = 100000,
2511 .src_clk_rate = 24000000,
2512};
2513
Jing Lin04601f92012-02-05 15:36:07 -08002514static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi3_pdata = {
Anirudh Ghayalc2163472012-04-10 14:58:14 +05302515 .clk_freq = 384000,
Jing Lin04601f92012-02-05 15:36:07 -08002516 .src_clk_rate = 24000000,
2517};
2518
Kenneth Heitke748593a2011-07-15 15:45:11 -06002519static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
2520 .clk_freq = 100000,
2521 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002522};
2523
Joel King8f839b92012-04-01 14:37:46 -07002524static struct msm_i2c_platform_data mpq8064_i2c_qup_gsbi5_pdata = {
2525 .clk_freq = 100000,
2526 .src_clk_rate = 24000000,
2527};
2528
David Keitel3c40fc52012-02-09 17:53:52 -08002529#define GSBI_DUAL_MODE_CODE 0x60
2530#define MSM_GSBI1_PHYS 0x12440000
Kenneth Heitke748593a2011-07-15 15:45:11 -06002531static void __init apq8064_i2c_init(void)
2532{
David Keitel3c40fc52012-02-09 17:53:52 -08002533 void __iomem *gsbi_mem;
2534
2535 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2536 &apq8064_i2c_qup_gsbi1_pdata;
2537 gsbi_mem = ioremap_nocache(MSM_GSBI1_PHYS, 4);
2538 writel_relaxed(GSBI_DUAL_MODE_CODE, gsbi_mem);
2539 /* Ensure protocol code is written before proceeding */
2540 wmb();
2541 iounmap(gsbi_mem);
2542 apq8064_i2c_qup_gsbi1_pdata.use_gsbi_shared_mode = 1;
Jing Lin04601f92012-02-05 15:36:07 -08002543 apq8064_device_qup_i2c_gsbi3.dev.platform_data =
2544 &apq8064_i2c_qup_gsbi3_pdata;
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002545 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2546 &apq8064_i2c_qup_gsbi1_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002547 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
2548 &apq8064_i2c_qup_gsbi4_pdata;
Joel King8f839b92012-04-01 14:37:46 -07002549 mpq8064_device_qup_i2c_gsbi5.dev.platform_data =
2550 &mpq8064_i2c_qup_gsbi5_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002551}
2552
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002553#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002554static int ethernet_init(void)
2555{
2556 int ret;
2557 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
2558 if (ret) {
2559 pr_err("ks8851 gpio_request failed: %d\n", ret);
2560 goto fail;
2561 }
2562
2563 return 0;
2564fail:
2565 return ret;
2566}
2567#else
2568static int ethernet_init(void)
2569{
2570 return 0;
2571}
2572#endif
2573
David Collins6f7c3472012-08-22 13:18:06 -07002574#define GPIO_KEY_HOME PM8921_GPIO_PM_TO_SYS(27)
2575#define GPIO_KEY_VOLUME_UP PM8921_GPIO_PM_TO_SYS(35)
2576#define GPIO_KEY_VOLUME_DOWN_PM8921 PM8921_GPIO_PM_TO_SYS(38)
2577#define GPIO_KEY_VOLUME_DOWN_PM8917 PM8921_GPIO_PM_TO_SYS(30)
2578#define GPIO_KEY_CAM_FOCUS PM8921_GPIO_PM_TO_SYS(3)
2579#define GPIO_KEY_CAM_SNAP PM8921_GPIO_PM_TO_SYS(4)
2580#define GPIO_KEY_ROTATION_PM8921 PM8921_GPIO_PM_TO_SYS(42)
2581#define GPIO_KEY_ROTATION_PM8917 PM8921_GPIO_PM_TO_SYS(8)
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302582
David Collins6f7c3472012-08-22 13:18:06 -07002583static struct gpio_keys_button cdp_keys_pm8921[] = {
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302584 {
2585 .code = KEY_HOME,
2586 .gpio = GPIO_KEY_HOME,
2587 .desc = "home_key",
2588 .active_low = 1,
2589 .type = EV_KEY,
2590 .wakeup = 1,
2591 .debounce_interval = 15,
2592 },
2593 {
2594 .code = KEY_VOLUMEUP,
2595 .gpio = GPIO_KEY_VOLUME_UP,
2596 .desc = "volume_up_key",
2597 .active_low = 1,
2598 .type = EV_KEY,
2599 .wakeup = 1,
2600 .debounce_interval = 15,
2601 },
2602 {
2603 .code = KEY_VOLUMEDOWN,
David Collins6f7c3472012-08-22 13:18:06 -07002604 .gpio = GPIO_KEY_VOLUME_DOWN_PM8921,
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302605 .desc = "volume_down_key",
2606 .active_low = 1,
2607 .type = EV_KEY,
2608 .wakeup = 1,
2609 .debounce_interval = 15,
2610 },
2611 {
2612 .code = SW_ROTATE_LOCK,
David Collins6f7c3472012-08-22 13:18:06 -07002613 .gpio = GPIO_KEY_ROTATION_PM8921,
2614 .desc = "rotate_key",
2615 .active_low = 1,
2616 .type = EV_SW,
2617 .debounce_interval = 15,
2618 },
2619};
2620
2621static struct gpio_keys_button cdp_keys_pm8917[] = {
2622 {
2623 .code = KEY_HOME,
2624 .gpio = GPIO_KEY_HOME,
2625 .desc = "home_key",
2626 .active_low = 1,
2627 .type = EV_KEY,
2628 .wakeup = 1,
2629 .debounce_interval = 15,
2630 },
2631 {
2632 .code = KEY_VOLUMEUP,
2633 .gpio = GPIO_KEY_VOLUME_UP,
2634 .desc = "volume_up_key",
2635 .active_low = 1,
2636 .type = EV_KEY,
2637 .wakeup = 1,
2638 .debounce_interval = 15,
2639 },
2640 {
2641 .code = KEY_VOLUMEDOWN,
2642 .gpio = GPIO_KEY_VOLUME_DOWN_PM8917,
2643 .desc = "volume_down_key",
2644 .active_low = 1,
2645 .type = EV_KEY,
2646 .wakeup = 1,
2647 .debounce_interval = 15,
2648 },
2649 {
2650 .code = SW_ROTATE_LOCK,
2651 .gpio = GPIO_KEY_ROTATION_PM8917,
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302652 .desc = "rotate_key",
2653 .active_low = 1,
2654 .type = EV_SW,
2655 .debounce_interval = 15,
2656 },
2657};
2658
2659static struct gpio_keys_platform_data cdp_keys_data = {
David Collins6f7c3472012-08-22 13:18:06 -07002660 .buttons = cdp_keys_pm8921,
2661 .nbuttons = ARRAY_SIZE(cdp_keys_pm8921),
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302662};
2663
2664static struct platform_device cdp_kp_pdev = {
2665 .name = "gpio-keys",
2666 .id = -1,
2667 .dev = {
2668 .platform_data = &cdp_keys_data,
2669 },
2670};
2671
2672static struct gpio_keys_button mtp_keys[] = {
2673 {
2674 .code = KEY_CAMERA_FOCUS,
2675 .gpio = GPIO_KEY_CAM_FOCUS,
2676 .desc = "cam_focus_key",
2677 .active_low = 1,
2678 .type = EV_KEY,
2679 .wakeup = 1,
2680 .debounce_interval = 15,
2681 },
2682 {
2683 .code = KEY_VOLUMEUP,
2684 .gpio = GPIO_KEY_VOLUME_UP,
2685 .desc = "volume_up_key",
2686 .active_low = 1,
2687 .type = EV_KEY,
2688 .wakeup = 1,
2689 .debounce_interval = 15,
2690 },
2691 {
2692 .code = KEY_VOLUMEDOWN,
David Collins6f7c3472012-08-22 13:18:06 -07002693 .gpio = GPIO_KEY_VOLUME_DOWN_PM8921,
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302694 .desc = "volume_down_key",
2695 .active_low = 1,
2696 .type = EV_KEY,
2697 .wakeup = 1,
2698 .debounce_interval = 15,
2699 },
2700 {
2701 .code = KEY_CAMERA_SNAPSHOT,
2702 .gpio = GPIO_KEY_CAM_SNAP,
2703 .desc = "cam_snap_key",
2704 .active_low = 1,
2705 .type = EV_KEY,
2706 .debounce_interval = 15,
2707 },
2708};
2709
2710static struct gpio_keys_platform_data mtp_keys_data = {
2711 .buttons = mtp_keys,
2712 .nbuttons = ARRAY_SIZE(mtp_keys),
2713};
2714
2715static struct platform_device mtp_kp_pdev = {
2716 .name = "gpio-keys",
2717 .id = -1,
2718 .dev = {
2719 .platform_data = &mtp_keys_data,
2720 },
2721};
2722
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05302723static struct gpio_keys_button mpq_keys[] = {
2724 {
2725 .code = KEY_VOLUMEDOWN,
David Collins6f7c3472012-08-22 13:18:06 -07002726 .gpio = GPIO_KEY_VOLUME_DOWN_PM8921,
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05302727 .desc = "volume_down_key",
2728 .active_low = 1,
2729 .type = EV_KEY,
2730 .wakeup = 1,
2731 .debounce_interval = 15,
2732 },
2733 {
2734 .code = KEY_VOLUMEUP,
2735 .gpio = GPIO_KEY_VOLUME_UP,
2736 .desc = "volume_up_key",
2737 .active_low = 1,
2738 .type = EV_KEY,
2739 .wakeup = 1,
2740 .debounce_interval = 15,
2741 },
2742};
2743
2744static struct gpio_keys_platform_data mpq_keys_data = {
2745 .buttons = mpq_keys,
2746 .nbuttons = ARRAY_SIZE(mpq_keys),
2747};
2748
2749static struct platform_device mpq_gpio_keys_pdev = {
2750 .name = "gpio-keys",
2751 .id = -1,
2752 .dev = {
2753 .platform_data = &mpq_keys_data,
2754 },
2755};
2756
2757#define MPQ_KP_ROW_BASE SX150X_EXP2_GPIO_BASE
2758#define MPQ_KP_COL_BASE (SX150X_EXP2_GPIO_BASE + 4)
2759
2760static unsigned int mpq_row_gpios[] = {MPQ_KP_ROW_BASE, MPQ_KP_ROW_BASE + 1,
2761 MPQ_KP_ROW_BASE + 2, MPQ_KP_ROW_BASE + 3};
2762static unsigned int mpq_col_gpios[] = {MPQ_KP_COL_BASE, MPQ_KP_COL_BASE + 1,
2763 MPQ_KP_COL_BASE + 2};
2764
2765static const unsigned int mpq_keymap[] = {
2766 KEY(0, 0, KEY_UP),
2767 KEY(0, 1, KEY_ENTER),
2768 KEY(0, 2, KEY_3),
2769
2770 KEY(1, 0, KEY_DOWN),
2771 KEY(1, 1, KEY_EXIT),
2772 KEY(1, 2, KEY_4),
2773
2774 KEY(2, 0, KEY_LEFT),
2775 KEY(2, 1, KEY_1),
2776 KEY(2, 2, KEY_5),
2777
2778 KEY(3, 0, KEY_RIGHT),
2779 KEY(3, 1, KEY_2),
2780 KEY(3, 2, KEY_6),
2781};
2782
2783static struct matrix_keymap_data mpq_keymap_data = {
2784 .keymap_size = ARRAY_SIZE(mpq_keymap),
2785 .keymap = mpq_keymap,
2786};
2787
2788static struct matrix_keypad_platform_data mpq_keypad_data = {
2789 .keymap_data = &mpq_keymap_data,
2790 .row_gpios = mpq_row_gpios,
2791 .col_gpios = mpq_col_gpios,
2792 .num_row_gpios = ARRAY_SIZE(mpq_row_gpios),
2793 .num_col_gpios = ARRAY_SIZE(mpq_col_gpios),
2794 .col_scan_delay_us = 32000,
2795 .debounce_ms = 20,
2796 .wakeup = 1,
2797 .active_low = 1,
2798 .no_autorepeat = 1,
2799};
2800
2801static struct platform_device mpq_keypad_device = {
2802 .name = "matrix-keypad",
2803 .id = -1,
2804 .dev = {
2805 .platform_data = &mpq_keypad_data,
2806 },
2807};
2808
Jin Hongd3024e62012-02-09 16:13:32 -08002809/* Sensors DSPS platform data */
2810#define DSPS_PIL_GENERIC_NAME "dsps"
2811static void __init apq8064_init_dsps(void)
2812{
2813 struct msm_dsps_platform_data *pdata =
2814 msm_dsps_device_8064.dev.platform_data;
2815 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
2816 pdata->gpios = NULL;
2817 pdata->gpios_num = 0;
2818
2819 platform_device_register(&msm_dsps_device_8064);
2820}
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302821
Jing Lin417fa452012-02-05 14:31:06 -08002822#define I2C_SURF 1
2823#define I2C_FFA (1 << 1)
2824#define I2C_RUMI (1 << 2)
2825#define I2C_SIM (1 << 3)
2826#define I2C_LIQUID (1 << 4)
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002827#define I2C_MPQ_CDP BIT(5)
2828#define I2C_MPQ_HRD BIT(6)
2829#define I2C_MPQ_DTV BIT(7)
Jing Lin417fa452012-02-05 14:31:06 -08002830
2831struct i2c_registry {
2832 u8 machs;
2833 int bus;
2834 struct i2c_board_info *info;
2835 int len;
2836};
2837
2838static struct i2c_registry apq8064_i2c_devices[] __initdata = {
Jing Lin21ed4de2012-02-05 15:53:28 -08002839 {
David Keitel2f613d92012-02-15 11:29:16 -08002840 I2C_LIQUID,
2841 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
2842 smb349_charger_i2c_info,
2843 ARRAY_SIZE(smb349_charger_i2c_info)
2844 },
2845 {
Jing Lin21ed4de2012-02-05 15:53:28 -08002846 I2C_SURF | I2C_LIQUID,
2847 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
2848 mxt_device_info,
2849 ARRAY_SIZE(mxt_device_info),
2850 },
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08002851 {
2852 I2C_FFA,
2853 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
2854 cyttsp_info,
2855 ARRAY_SIZE(cyttsp_info),
2856 },
Amy Maloche70090f992012-02-16 16:35:26 -08002857 {
2858 I2C_FFA | I2C_LIQUID,
2859 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
2860 isa1200_board_info,
2861 ARRAY_SIZE(isa1200_board_info),
2862 },
Santosh Mardieff9a742012-04-09 23:23:39 +05302863 {
2864 I2C_MPQ_CDP,
2865 APQ_8064_GSBI5_QUP_I2C_BUS_ID,
2866 cs8427_device_info,
2867 ARRAY_SIZE(cs8427_device_info),
2868 },
Jing Lin417fa452012-02-05 14:31:06 -08002869};
2870
Jay Chokshi607f61b2012-04-25 18:21:21 -07002871#define SX150X_EXP1_INT_N PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9)
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05302872#define SX150X_EXP2_INT_N MSM_GPIO_TO_INT(81)
Jay Chokshi607f61b2012-04-25 18:21:21 -07002873
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002874struct sx150x_platform_data mpq8064_sx150x_pdata[] = {
2875 [SX150X_EXP1] = {
2876 .gpio_base = SX150X_EXP1_GPIO_BASE,
2877 .oscio_is_gpo = false,
2878 .io_pullup_ena = 0x0,
2879 .io_pulldn_ena = 0x0,
2880 .io_open_drain_ena = 0x0,
2881 .io_polarity = 0,
Jay Chokshi607f61b2012-04-25 18:21:21 -07002882 .irq_summary = SX150X_EXP1_INT_N,
2883 .irq_base = SX150X_EXP1_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002884 },
2885 [SX150X_EXP2] = {
2886 .gpio_base = SX150X_EXP2_GPIO_BASE,
2887 .oscio_is_gpo = false,
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05302888 .io_pullup_ena = 0x0f,
2889 .io_pulldn_ena = 0x70,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002890 .io_open_drain_ena = 0x0,
2891 .io_polarity = 0,
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05302892 .irq_summary = SX150X_EXP2_INT_N,
2893 .irq_base = SX150X_EXP2_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002894 },
2895 [SX150X_EXP3] = {
2896 .gpio_base = SX150X_EXP3_GPIO_BASE,
2897 .oscio_is_gpo = false,
2898 .io_pullup_ena = 0x0,
2899 .io_pulldn_ena = 0x0,
2900 .io_open_drain_ena = 0x0,
2901 .io_polarity = 0,
2902 .irq_summary = -1,
2903 },
2904 [SX150X_EXP4] = {
2905 .gpio_base = SX150X_EXP4_GPIO_BASE,
2906 .oscio_is_gpo = false,
2907 .io_pullup_ena = 0x0,
2908 .io_pulldn_ena = 0x0,
2909 .io_open_drain_ena = 0x0,
2910 .io_polarity = 0,
2911 .irq_summary = -1,
2912 },
2913};
2914
2915static struct i2c_board_info sx150x_gpio_exp_info[] = {
2916 {
2917 I2C_BOARD_INFO("sx1509q", 0x70),
2918 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP1],
2919 },
2920 {
2921 I2C_BOARD_INFO("sx1508q", 0x23),
2922 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP2],
2923 },
2924 {
2925 I2C_BOARD_INFO("sx1508q", 0x22),
2926 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP3],
2927 },
2928 {
2929 I2C_BOARD_INFO("sx1509q", 0x3E),
2930 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP4],
2931 },
2932};
2933
2934#define MPQ8064_I2C_GSBI5_BUS_ID 5
2935
2936static struct i2c_registry mpq8064_i2c_devices[] __initdata = {
2937 {
2938 I2C_MPQ_CDP,
2939 MPQ8064_I2C_GSBI5_BUS_ID,
2940 sx150x_gpio_exp_info,
2941 ARRAY_SIZE(sx150x_gpio_exp_info),
2942 },
2943};
2944
Jing Lin417fa452012-02-05 14:31:06 -08002945static void __init register_i2c_devices(void)
2946{
2947 u8 mach_mask = 0;
2948 int i;
2949
Kevin Chand07220e2012-02-13 15:52:22 -08002950#ifdef CONFIG_MSM_CAMERA
2951 struct i2c_registry apq8064_camera_i2c_devices = {
2952 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_RUMI,
2953 APQ_8064_GSBI4_QUP_I2C_BUS_ID,
2954 apq8064_camera_board_info.board_info,
2955 apq8064_camera_board_info.num_i2c_board_info,
2956 };
2957#endif
Jing Lin417fa452012-02-05 14:31:06 -08002958 /* Build the matching 'supported_machs' bitmask */
2959 if (machine_is_apq8064_cdp())
2960 mach_mask = I2C_SURF;
2961 else if (machine_is_apq8064_mtp())
2962 mach_mask = I2C_FFA;
2963 else if (machine_is_apq8064_liquid())
2964 mach_mask = I2C_LIQUID;
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002965 else if (PLATFORM_IS_MPQ8064())
2966 mach_mask = I2C_MPQ_CDP;
Jing Lin417fa452012-02-05 14:31:06 -08002967 else
2968 pr_err("unmatched machine ID in register_i2c_devices\n");
2969
2970 /* Run the array and install devices as appropriate */
2971 for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) {
2972 if (apq8064_i2c_devices[i].machs & mach_mask)
2973 i2c_register_board_info(apq8064_i2c_devices[i].bus,
2974 apq8064_i2c_devices[i].info,
2975 apq8064_i2c_devices[i].len);
2976 }
Kevin Chand07220e2012-02-13 15:52:22 -08002977#ifdef CONFIG_MSM_CAMERA
2978 if (apq8064_camera_i2c_devices.machs & mach_mask)
2979 i2c_register_board_info(apq8064_camera_i2c_devices.bus,
2980 apq8064_camera_i2c_devices.info,
2981 apq8064_camera_i2c_devices.len);
2982#endif
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07002983
2984 for (i = 0; i < ARRAY_SIZE(mpq8064_i2c_devices); ++i) {
2985 if (mpq8064_i2c_devices[i].machs & mach_mask)
2986 i2c_register_board_info(
2987 mpq8064_i2c_devices[i].bus,
2988 mpq8064_i2c_devices[i].info,
2989 mpq8064_i2c_devices[i].len);
2990 }
Jing Lin417fa452012-02-05 14:31:06 -08002991}
2992
Jay Chokshi994ff122012-03-27 15:43:48 -07002993static void enable_ddr3_regulator(void)
2994{
2995 static struct regulator *ext_ddr3;
2996
2997 /* Use MPP7 output state as a flag for PCDDR3 presence. */
2998 if (gpio_get_value_cansleep(PM8921_MPP_PM_TO_SYS(7)) > 0) {
2999 ext_ddr3 = regulator_get(NULL, "ext_ddr3");
3000 if (IS_ERR(ext_ddr3) || ext_ddr3 == NULL)
3001 pr_err("Could not get MPP7 regulator\n");
3002 else
3003 regulator_enable(ext_ddr3);
3004 }
3005}
3006
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003007static void enable_avc_i2c_bus(void)
3008{
3009 int avc_i2c_en_mpp = PM8921_MPP_PM_TO_SYS(8);
3010 int rc;
3011
3012 rc = gpio_request(avc_i2c_en_mpp, "avc_i2c_en");
3013 if (rc)
3014 pr_err("request for avc_i2c_en mpp failed,"
3015 "rc=%d\n", rc);
3016 else
3017 gpio_set_value_cansleep(avc_i2c_en_mpp, 1);
3018}
3019
David Collins6f7c3472012-08-22 13:18:06 -07003020/* Modify platform data values to match requirements for PM8917. */
3021static void __init apq8064_pm8917_pdata_fixup(void)
3022{
3023 cdp_keys_data.buttons = cdp_keys_pm8917;
3024 cdp_keys_data.nbuttons = ARRAY_SIZE(cdp_keys_pm8917);
3025}
3026
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003027static void __init apq8064_common_init(void)
3028{
Ameya Thakure155ece2012-07-09 12:08:37 -07003029 u32 platform_version;
David Collins6f7c3472012-08-22 13:18:06 -07003030
3031 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
3032 apq8064_pm8917_pdata_fixup();
Rohit Vaswanib1cc4932012-07-23 21:30:11 -07003033 platform_device_register(&msm_gpio_device);
Joel King8f839b92012-04-01 14:37:46 -07003034 msm_tsens_early_init(&apq_tsens_pdata);
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06003035 msm_thermal_init(&msm_thermal_pdata);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003036 if (socinfo_init() < 0)
3037 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06003038 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
3039 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
David Collins2782b5c2012-02-06 10:02:42 -08003040 regulator_suppress_info_printing();
David Collins36199252012-08-21 15:43:02 -07003041 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
3042 configure_apq8064_pm8917_power_grid();
David Collins2782b5c2012-02-06 10:02:42 -08003043 platform_device_register(&apq8064_device_rpm_regulator);
David Collins36199252012-08-21 15:43:02 -07003044 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917)
3045 platform_device_register(&apq8064_pm8921_device_rpm_regulator);
Stephen Boyd4d0d2582012-02-10 14:49:40 -08003046 if (msm_xo_init())
3047 pr_err("Failed to initialize XO votes\n");
Matt Wagantallc51e5602012-02-27 17:25:25 -08003048 msm_clock_init(&apq8064_clock_init_data);
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08003049 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06003050 apq8064_i2c_init();
Jing Lin417fa452012-02-05 14:31:06 -08003051 register_i2c_devices();
Kenneth Heitke36920d32011-07-20 16:44:30 -06003052
Harini Jayaramanc4c58692011-07-19 14:50:10 -06003053 apq8064_device_qup_spi_gsbi5.dev.platform_data =
3054 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08003055 apq8064_init_pmic();
Hemant Kumar94e7da22012-02-03 16:52:29 -08003056 if (machine_is_apq8064_liquid())
3057 msm_otg_pdata.mhl_enable = true;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07003058
Ofir Cohen94213a72012-05-03 14:26:32 +03003059 android_usb_pdata.swfi_latency =
3060 msm_rpmrs_levels[0].latency_us;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07003061
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003062 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Manu Gautam91223e02011-11-08 15:27:22 +05303063 apq8064_ehci_host_init();
Gagan Mac8a7a5d32011-11-11 16:43:06 -07003064 apq8064_init_buses();
David Collins36199252012-08-21 15:43:02 -07003065
3066 platform_add_devices(early_common_devices,
3067 ARRAY_SIZE(early_common_devices));
3068 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917)
3069 platform_add_devices(pm8921_common_devices,
3070 ARRAY_SIZE(pm8921_common_devices));
3071 else
3072 platform_add_devices(pm8917_common_devices,
3073 ARRAY_SIZE(pm8917_common_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003074 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Terence Hampson36b70722012-05-10 13:18:16 -04003075 if (!(machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
3076 machine_is_mpq8064_dtv()))
3077 platform_add_devices(common_not_mpq_devices,
3078 ARRAY_SIZE(common_not_mpq_devices));
Jay Chokshi994ff122012-03-27 15:43:48 -07003079 enable_ddr3_regulator();
Pavankumar Kondetife2d4d32012-09-07 15:33:09 +05303080 msm_hsic_pdata.swfi_latency =
3081 msm_rpmrs_levels[0].latency_us;
Hemant Kumarf1ca9192012-02-07 18:59:33 -08003082 if (machine_is_apq8064_mtp()) {
Ajay Dudanic4e40db2012-08-20 14:44:40 -07003083 msm_hsic_pdata.log2_irq_thresh = 5,
Hemant Kumarf1ca9192012-02-07 18:59:33 -08003084 apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
3085 device_initialize(&apq8064_device_hsic_host.dev);
3086 }
Jay Chokshie8741282012-01-25 15:22:55 -08003087 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05303088 apq8064_init_mmc();
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08003089
3090 if (machine_is_apq8064_mtp()) {
3091 mdm_8064_device.dev.platform_data = &mdm_platform_data;
Ameya Thakure155ece2012-07-09 12:08:37 -07003092 platform_version = socinfo_get_platform_version();
3093 if (SOCINFO_VERSION_MINOR(platform_version) == 1) {
3094 i2s_mdm_8064_device.dev.platform_data =
3095 &mdm_platform_data;
3096 platform_device_register(&i2s_mdm_8064_device);
3097 } else {
3098 mdm_8064_device.dev.platform_data = &mdm_platform_data;
3099 platform_device_register(&mdm_8064_device);
3100 }
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08003101 }
3102 platform_device_register(&apq8064_slim_ctrl);
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06003103 slim_register_board_info(apq8064_slim_devices,
3104 ARRAY_SIZE(apq8064_slim_devices));
Taniya Dasbbf633d2012-07-31 16:07:47 +05303105 if (!PLATFORM_IS_MPQ8064()) {
Taniya Das30cae292012-07-31 15:56:12 +05303106 apq8064_init_dsps();
Taniya Dasbbf633d2012-07-31 16:07:47 +05303107 platform_device_register(&msm_8960_riva);
3108 }
Praveen Chidambaram78499012011-11-01 17:15:17 -06003109 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3110 msm_spm_l2_init(msm_spm_l2_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06003111 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08003112 apq8064_epm_adc_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003113}
3114
Huaibin Yang4a084e32011-12-15 15:25:52 -08003115static void __init apq8064_allocate_memory_regions(void)
3116{
3117 apq8064_allocate_fb_region();
3118}
3119
Joel King82b7e3f2012-01-05 10:03:27 -08003120static void __init apq8064_cdp_init(void)
3121{
Hanumant Singh50440d42012-04-23 19:27:16 -07003122 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
3123 pr_err("meminfo_init() failed!\n");
Amy Maloche609bb5e2012-08-03 09:41:42 -07003124 if (machine_is_apq8064_mtp() &&
3125 SOCINFO_VERSION_MINOR(socinfo_get_platform_version()) == 1)
3126 cyttsp_pdata.sleep_gpio = CYTTSP_TS_GPIO_SLEEP_ALT;
Joel King82b7e3f2012-01-05 10:03:27 -08003127 apq8064_common_init();
Joel King8f839b92012-04-01 14:37:46 -07003128 if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
3129 machine_is_mpq8064_dtv()) {
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003130 enable_avc_i2c_bus();
Olav Hauganef95ae32012-05-15 09:50:30 -07003131 msm_rotator_set_split_iommu_domain();
Joel King8f839b92012-04-01 14:37:46 -07003132 platform_add_devices(mpq_devices, ARRAY_SIZE(mpq_devices));
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06003133 mpq8064_pcie_init();
Joel King8f839b92012-04-01 14:37:46 -07003134 } else {
3135 ethernet_init();
Olav Hauganef95ae32012-05-15 09:50:30 -07003136 msm_rotator_set_split_iommu_domain();
Joel King8f839b92012-04-01 14:37:46 -07003137 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
3138 spi_register_board_info(spi_board_info,
3139 ARRAY_SIZE(spi_board_info));
3140 }
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003141 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07003142 apq8064_init_gpu();
Matt Wagantall1f65d9d2012-04-25 14:24:20 -07003143 platform_add_devices(apq8064_footswitch, apq8064_num_footswitch);
Steve Mucklef132c6c2012-06-06 18:30:57 -07003144#ifdef CONFIG_MSM_CAMERA
Kevin Chand07220e2012-02-13 15:52:22 -08003145 apq8064_init_cam();
Steve Mucklef132c6c2012-06-06 18:30:57 -07003146#endif
Mohan Pallaka474b94b2012-01-25 12:59:58 +05303147
3148 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
3149 platform_device_register(&cdp_kp_pdev);
3150
3151 if (machine_is_apq8064_mtp())
3152 platform_device_register(&mtp_kp_pdev);
Hanumant Singh50440d42012-04-23 19:27:16 -07003153
3154 change_memory_power = &apq8064_change_memory_power;
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05303155
3156 if (machine_is_mpq8064_cdp()) {
3157 platform_device_register(&mpq_gpio_keys_pdev);
3158 platform_device_register(&mpq_keypad_device);
3159 }
Joel King82b7e3f2012-01-05 10:03:27 -08003160}
3161
Joel King82b7e3f2012-01-05 10:03:27 -08003162MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
3163 .map_io = apq8064_map_io,
3164 .reserve = apq8064_reserve,
3165 .init_irq = apq8064_init_irq,
3166 .handle_irq = gic_handle_irq,
3167 .timer = &msm_timer,
3168 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003169 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003170 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003171 .restart = msm_restart,
Joel King82b7e3f2012-01-05 10:03:27 -08003172MACHINE_END
3173
3174MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
3175 .map_io = apq8064_map_io,
3176 .reserve = apq8064_reserve,
3177 .init_irq = apq8064_init_irq,
3178 .handle_irq = gic_handle_irq,
3179 .timer = &msm_timer,
3180 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003181 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003182 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003183 .restart = msm_restart,
Joel King82b7e3f2012-01-05 10:03:27 -08003184MACHINE_END
3185
3186MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
3187 .map_io = apq8064_map_io,
3188 .reserve = apq8064_reserve,
3189 .init_irq = apq8064_init_irq,
3190 .handle_irq = gic_handle_irq,
3191 .timer = &msm_timer,
3192 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003193 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003194 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003195 .restart = msm_restart,
Joel King82b7e3f2012-01-05 10:03:27 -08003196MACHINE_END
3197
Joel King064bbf82012-04-01 13:23:39 -07003198MACHINE_START(MPQ8064_CDP, "QCT MPQ8064 CDP")
3199 .map_io = apq8064_map_io,
3200 .reserve = apq8064_reserve,
3201 .init_irq = apq8064_init_irq,
3202 .handle_irq = gic_handle_irq,
3203 .timer = &msm_timer,
3204 .init_machine = apq8064_cdp_init,
3205 .init_early = apq8064_allocate_memory_regions,
3206 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003207 .restart = msm_restart,
Joel King064bbf82012-04-01 13:23:39 -07003208MACHINE_END
3209
Joel King11ca8202012-02-13 16:19:03 -08003210MACHINE_START(MPQ8064_HRD, "QCT MPQ8064 HRD")
3211 .map_io = apq8064_map_io,
3212 .reserve = apq8064_reserve,
3213 .init_irq = apq8064_init_irq,
3214 .handle_irq = gic_handle_irq,
3215 .timer = &msm_timer,
3216 .init_machine = apq8064_cdp_init,
Joel King3a57e772012-05-28 11:22:55 -07003217 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003218 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003219 .restart = msm_restart,
Joel King11ca8202012-02-13 16:19:03 -08003220MACHINE_END
3221
3222MACHINE_START(MPQ8064_DTV, "QCT MPQ8064 DTV")
3223 .map_io = apq8064_map_io,
3224 .reserve = apq8064_reserve,
3225 .init_irq = apq8064_init_irq,
3226 .handle_irq = gic_handle_irq,
3227 .timer = &msm_timer,
3228 .init_machine = apq8064_cdp_init,
Joel King3a57e772012-05-28 11:22:55 -07003229 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003230 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003231 .restart = msm_restart,
Joel King11ca8202012-02-13 16:19:03 -08003232MACHINE_END
3233