blob: d267b8ef8138a871c6a42540021a7c2c476e04c0 [file] [log] [blame]
Abhijeet Dharmapurikarfb4a2f82012-08-23 14:36:59 -07001/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13#include <linux/kernel.h>
Niranjana Vishwanathapurac1edd402012-06-28 15:32:50 -060014#include <linux/bitops.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070015#include <linux/platform_device.h>
Steve Mucklef132c6c2012-06-06 18:30:57 -070016#include <linux/gpio.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070017#include <linux/io.h>
18#include <linux/irq.h>
Kenneth Heitke748593a2011-07-15 15:45:11 -060019#include <linux/i2c.h>
David Keitel2f613d92012-02-15 11:29:16 -080020#include <linux/i2c/smb349.h>
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -080021#include <linux/i2c/sx150x.h>
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -060022#include <linux/slimbus/slimbus.h>
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +053023#include <linux/mfd/wcd9xxx/core.h>
24#include <linux/mfd/wcd9xxx/pdata.h>
Amy Maloche70090f992012-02-16 16:35:26 -080025#include <linux/mfd/pm8xxx/misc.h>
Kenneth Heitke36920d32011-07-20 16:44:30 -060026#include <linux/msm_ssbi.h>
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -070027#include <linux/spi/spi.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070028#include <linux/dma-mapping.h>
29#include <linux/platform_data/qcom_crypto_device.h>
Mitchel Humpherysca983d82012-09-06 11:32:54 -070030#include <linux/msm_ion.h>
Jack Cheung46bfffa2012-01-19 15:26:24 -080031#include <linux/memory.h>
Larry Bassel67b921d2012-04-06 10:23:27 -070032#include <linux/memblock.h>
Praveen Chidambaram877d7a42012-06-05 14:33:20 -060033#include <linux/msm_thermal.h>
Jing Lin21ed4de2012-02-05 15:53:28 -080034#include <linux/i2c/atmel_mxt_ts.h>
Steve Mucklef132c6c2012-06-06 18:30:57 -070035#include <linux/cyttsp-qc.h>
Amy Maloche70090f992012-02-16 16:35:26 -080036#include <linux/i2c/isa1200.h>
Mohan Pallaka474b94b2012-01-25 12:59:58 +053037#include <linux/gpio_keys.h>
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -080038#include <linux/epm_adc.h>
Jay Chokshie7d8d4f2012-04-04 14:47:57 -070039#include <linux/i2c/sx150x.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070040#include <asm/mach-types.h>
41#include <asm/mach/arch.h>
42#include <asm/hardware/gic.h>
Sahitya Tummala3586ed92011-08-03 09:13:23 +053043#include <asm/mach/mmc.h>
Ankit Verma6b7e2ba2012-01-26 15:48:54 -080044#include <linux/platform_data/qcom_wcnss_device.h>
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>
Mayank Rana262e9032012-05-10 15:14:00 -070071#include <mach/msm_serial_hs.h>
Santosh Mardieff9a742012-04-09 23:23:39 +053072#include <sound/cs8427.h>
Ravi Kumar V05931a22012-04-04 17:09:37 +053073#include <media/gpio-ir-recv.h>
Larry Bassel67b921d2012-04-06 10:23:27 -070074#include <linux/fmem.h>
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -060075#include <mach/msm_pcie.h>
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -070076#include <mach/restart.h>
Niranjana Vishwanathapurac1edd402012-06-28 15:32:50 -060077#include <mach/msm_iomap.h>
Joel King4ebccc62011-07-22 09:43:22 -070078
Jeff Ohlstein7e668552011-10-06 16:17:25 -070079#include "msm_watchdog.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080080#include "board-8064.h"
Matt Wagantall33d01f52012-02-23 23:27:44 -080081#include "clock.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060082#include "spm.h"
Subhash Jadavani909e04f2012-04-12 10:52:50 +053083#include <mach/mpm.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060084#include "rpm_resources.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080085#include "pm.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060086#include "pm-boot.h"
Rajesh Sastrulaaee8af32012-01-20 11:46:31 -080087#include "devices-msm8x60.h"
Hanumant Singh50440d42012-04-23 19:27:16 -070088#include "smd_private.h"
Jay Chokshiea67c622011-07-29 17:12:26 -070089
Abhishek Kharbanda72dc72e2012-06-07 13:41:37 -070090#define MHL_GPIO_INT 30
91#define MHL_GPIO_RESET 35
92
Olav Haugan7c6aa742012-01-16 16:47:37 -080093#define MSM_PMEM_ADSP_SIZE 0x7800000
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -070094#define MSM_PMEM_AUDIO_SIZE 0x4CF000
Olav Haugan7c6aa742012-01-16 16:47:37 -080095#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
96#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
97#else
Chetan Kalyan72aac4f2012-02-23 14:56:54 -080098#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Olav Haugan7c6aa742012-01-16 16:47:37 -080099#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700100
Olav Haugan7c6aa742012-01-16 16:47:37 -0800101#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Hanumant Singheadb7502012-05-15 18:14:04 -0700102#define HOLE_SIZE 0x20000
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700103#define MSM_CONTIG_MEM_SIZE 0x65000
Olav Haugan129992c2012-03-22 09:54:01 -0700104#ifdef CONFIG_MSM_IOMMU
105#define MSM_ION_MM_SIZE 0x3800000
106#define MSM_ION_SF_SIZE 0
Olav Haugan39477bb2012-05-14 16:05:36 -0700107#define MSM_ION_QSECOM_SIZE 0x780000 /* (7.5MB) */
Olav Haugan129992c2012-03-22 09:54:01 -0700108#define MSM_ION_HEAP_NUM 7
109#else
Olav Haugan7c6aa742012-01-16 16:47:37 -0800110#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Haugan129992c2012-03-22 09:54:01 -0700111#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Haugan39477bb2012-05-14 16:05:36 -0700112#define MSM_ION_QSECOM_SIZE 0x600000 /* (6MB) */
Olav Haugan129992c2012-03-22 09:54:01 -0700113#define MSM_ION_HEAP_NUM 8
114#endif
Hanumant Singheadb7502012-05-15 18:14:04 -0700115#define MSM_ION_MM_FW_SIZE (0x200000 - HOLE_SIZE) /* (2MB - 128KB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800116#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan2c43fac2012-01-19 11:06:37 -0800117#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Olav Haugan7c6aa742012-01-16 16:47:37 -0800118#else
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700119#define MSM_CONTIG_MEM_SIZE 0x110C000
Olav Haugan7c6aa742012-01-16 16:47:37 -0800120#define MSM_ION_HEAP_NUM 1
121#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700122
Hanumant Singheadb7502012-05-15 18:14:04 -0700123#define APQ8064_FIXED_AREA_START (0xa0000000 - (MSM_ION_MM_FW_SIZE + \
124 HOLE_SIZE))
Larry Bassel67b921d2012-04-06 10:23:27 -0700125#define MAX_FIXED_AREA_SIZE 0x10000000
Hanumant Singheadb7502012-05-15 18:14:04 -0700126#define MSM_MM_FW_SIZE (0x200000 - HOLE_SIZE)
127#define APQ8064_FW_START APQ8064_FIXED_AREA_START
Larry Bassel67b921d2012-04-06 10:23:27 -0700128
Niranjana Vishwanathapurac1edd402012-06-28 15:32:50 -0600129#define QFPROM_RAW_FEAT_CONFIG_ROW0_MSB (MSM_QFPROM_BASE + 0x23c)
130#define QFPROM_RAW_OEM_CONFIG_ROW0_LSB (MSM_QFPROM_BASE + 0x220)
131
Niranjana Vishwanathapura68210ff2012-06-24 18:03:49 -0600132/* PCIE AXI address space */
133#define PCIE_AXI_BAR_PHYS 0x08000000
134#define PCIE_AXI_BAR_SIZE SZ_128M
135
Niranjana Vishwanathapura459a27d2012-07-20 12:23:55 -0600136/* PCIe pmic gpios */
137#define PCIE_WAKE_N_PMIC_GPIO 12
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -0600138#define PCIE_PWR_EN_PMIC_GPIO 13
139#define PCIE_RST_N_PMIC_MPP 1
140
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700141#ifdef CONFIG_KERNEL_MSM_CONTIG_MEM_REGION
142static unsigned msm_contig_mem_size = MSM_CONTIG_MEM_SIZE;
143static int __init msm_contig_mem_size_setup(char *p)
Kevin Chan13be4e22011-10-20 11:30:32 -0700144{
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700145 msm_contig_mem_size = memparse(p, NULL);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800146 return 0;
Kevin Chan13be4e22011-10-20 11:30:32 -0700147}
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700148early_param("msm_contig_mem_size", msm_contig_mem_size_setup);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800149#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700150
Olav Haugan7c6aa742012-01-16 16:47:37 -0800151#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -0700152static unsigned pmem_size = MSM_PMEM_SIZE;
153static int __init pmem_size_setup(char *p)
154{
155 pmem_size = memparse(p, NULL);
156 return 0;
157}
158early_param("pmem_size", pmem_size_setup);
159
160static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
161
162static int __init pmem_adsp_size_setup(char *p)
163{
164 pmem_adsp_size = memparse(p, NULL);
165 return 0;
166}
167early_param("pmem_adsp_size", pmem_adsp_size_setup);
168
169static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
170
171static int __init pmem_audio_size_setup(char *p)
172{
173 pmem_audio_size = memparse(p, NULL);
174 return 0;
175}
176early_param("pmem_audio_size", pmem_audio_size_setup);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800177#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700178
Olav Haugan7c6aa742012-01-16 16:47:37 -0800179#ifdef CONFIG_ANDROID_PMEM
180#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700181static struct android_pmem_platform_data android_pmem_pdata = {
182 .name = "pmem",
183 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
184 .cached = 1,
185 .memory_type = MEMTYPE_EBI1,
186};
187
Laura Abbottb93525f2012-04-12 09:57:19 -0700188static struct platform_device apq8064_android_pmem_device = {
Kevin Chan13be4e22011-10-20 11:30:32 -0700189 .name = "android_pmem",
190 .id = 0,
191 .dev = {.platform_data = &android_pmem_pdata},
192};
193
194static struct android_pmem_platform_data android_pmem_adsp_pdata = {
195 .name = "pmem_adsp",
196 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
197 .cached = 0,
198 .memory_type = MEMTYPE_EBI1,
199};
Laura Abbottb93525f2012-04-12 09:57:19 -0700200static struct platform_device apq8064_android_pmem_adsp_device = {
Kevin Chan13be4e22011-10-20 11:30:32 -0700201 .name = "android_pmem",
202 .id = 2,
203 .dev = { .platform_data = &android_pmem_adsp_pdata },
204};
205
206static struct android_pmem_platform_data android_pmem_audio_pdata = {
207 .name = "pmem_audio",
208 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
209 .cached = 0,
210 .memory_type = MEMTYPE_EBI1,
211};
212
Laura Abbottb93525f2012-04-12 09:57:19 -0700213static struct platform_device apq8064_android_pmem_audio_device = {
Kevin Chan13be4e22011-10-20 11:30:32 -0700214 .name = "android_pmem",
215 .id = 4,
216 .dev = { .platform_data = &android_pmem_audio_pdata },
217};
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700218#endif /* CONFIG_MSM_MULTIMEDIA_USE_ION */
219#endif /* CONFIG_ANDROID_PMEM */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800220
Binqiang Qiuf165c922012-08-15 18:00:18 -0700221#ifdef CONFIG_BATTERY_BCL
222static struct platform_device battery_bcl_device = {
223 .name = "battery_current_limit",
224 .id = -1,
225};
226#endif
227
Larry Bassel67b921d2012-04-06 10:23:27 -0700228struct fmem_platform_data apq8064_fmem_pdata = {
229};
230
Olav Haugan7c6aa742012-01-16 16:47:37 -0800231static struct memtype_reserve apq8064_reserve_table[] __initdata = {
232 [MEMTYPE_SMI] = {
233 },
234 [MEMTYPE_EBI0] = {
235 .flags = MEMTYPE_FLAGS_1M_ALIGN,
236 },
237 [MEMTYPE_EBI1] = {
238 .flags = MEMTYPE_FLAGS_1M_ALIGN,
239 },
240};
Kevin Chan13be4e22011-10-20 11:30:32 -0700241
Laura Abbott350c8362012-02-28 14:46:52 -0800242static void __init reserve_rtb_memory(void)
243{
244#if defined(CONFIG_MSM_RTB)
Laura Abbottb93525f2012-04-12 09:57:19 -0700245 apq8064_reserve_table[MEMTYPE_EBI1].size += apq8064_rtb_pdata.size;
Laura Abbott350c8362012-02-28 14:46:52 -0800246#endif
247}
248
249
Kevin Chan13be4e22011-10-20 11:30:32 -0700250static void __init size_pmem_devices(void)
251{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800252#ifdef CONFIG_ANDROID_PMEM
253#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700254 android_pmem_adsp_pdata.size = pmem_adsp_size;
255 android_pmem_pdata.size = pmem_size;
256 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700257#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
258#endif /*CONFIG_ANDROID_PMEM*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700259}
260
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700261#ifdef CONFIG_ANDROID_PMEM
262#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700263static void __init reserve_memory_for(struct android_pmem_platform_data *p)
264{
265 apq8064_reserve_table[p->memory_type].size += p->size;
266}
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700267#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
268#endif /*CONFIG_ANDROID_PMEM*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700269
Kevin Chan13be4e22011-10-20 11:30:32 -0700270static void __init reserve_pmem_memory(void)
271{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800272#ifdef CONFIG_ANDROID_PMEM
273#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700274 reserve_memory_for(&android_pmem_adsp_pdata);
275 reserve_memory_for(&android_pmem_pdata);
276 reserve_memory_for(&android_pmem_audio_pdata);
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700277#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700278 apq8064_reserve_table[MEMTYPE_EBI1].size += msm_contig_mem_size;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700279#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -0800280}
281
282static int apq8064_paddr_to_memtype(unsigned int paddr)
283{
284 return MEMTYPE_EBI1;
285}
286
Steve Mucklef132c6c2012-06-06 18:30:57 -0700287#define FMEM_ENABLED 0
Larry Bassel67b921d2012-04-06 10:23:27 -0700288
Olav Haugan7c6aa742012-01-16 16:47:37 -0800289#ifdef CONFIG_ION_MSM
290#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -0700291static struct ion_cp_heap_pdata cp_mm_apq8064_ion_pdata = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800292 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugand3d29682012-01-19 10:57:07 -0800293 .align = PAGE_SIZE,
Larry Bassel67b921d2012-04-06 10:23:27 -0700294 .reusable = FMEM_ENABLED,
295 .mem_is_fmem = FMEM_ENABLED,
296 .fixed_position = FIXED_MIDDLE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800297};
298
Laura Abbottb93525f2012-04-12 09:57:19 -0700299static struct ion_cp_heap_pdata cp_mfc_apq8064_ion_pdata = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800300 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugand3d29682012-01-19 10:57:07 -0800301 .align = PAGE_SIZE,
Larry Bassel67b921d2012-04-06 10:23:27 -0700302 .reusable = 0,
303 .mem_is_fmem = FMEM_ENABLED,
304 .fixed_position = FIXED_HIGH,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800305};
306
Laura Abbottb93525f2012-04-12 09:57:19 -0700307static struct ion_co_heap_pdata co_apq8064_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800308 .adjacent_mem_id = INVALID_HEAP_ID,
309 .align = PAGE_SIZE,
Larry Bassel67b921d2012-04-06 10:23:27 -0700310 .mem_is_fmem = 0,
Olav Haugand3d29682012-01-19 10:57:07 -0800311};
312
Laura Abbottb93525f2012-04-12 09:57:19 -0700313static struct ion_co_heap_pdata fw_co_apq8064_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800314 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
315 .align = SZ_128K,
Larry Bassel67b921d2012-04-06 10:23:27 -0700316 .mem_is_fmem = FMEM_ENABLED,
317 .fixed_position = FIXED_LOW,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800318};
319#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800320
321/**
322 * These heaps are listed in the order they will be allocated. Due to
323 * video hardware restrictions and content protection the FW heap has to
324 * be allocated adjacent (below) the MM heap and the MFC heap has to be
325 * allocated after the MM heap to ensure MFC heap is not more than 256MB
326 * away from the base address of the FW heap.
327 * However, the order of FW heap and MM heap doesn't matter since these
328 * two heaps are taken care of by separate code to ensure they are adjacent
329 * to each other.
330 * Don't swap the order unless you know what you are doing!
331 */
Laura Abbottb93525f2012-04-12 09:57:19 -0700332static struct ion_platform_data apq8064_ion_pdata = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800333 .nr = MSM_ION_HEAP_NUM,
334 .heaps = {
335 {
336 .id = ION_SYSTEM_HEAP_ID,
337 .type = ION_HEAP_TYPE_SYSTEM,
338 .name = ION_VMALLOC_HEAP_NAME,
339 },
340#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
341 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800342 .id = ION_CP_MM_HEAP_ID,
343 .type = ION_HEAP_TYPE_CP,
344 .name = ION_MM_HEAP_NAME,
345 .size = MSM_ION_MM_SIZE,
346 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700347 .extra_data = (void *) &cp_mm_apq8064_ion_pdata,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800348 },
349 {
Olav Haugand3d29682012-01-19 10:57:07 -0800350 .id = ION_MM_FIRMWARE_HEAP_ID,
351 .type = ION_HEAP_TYPE_CARVEOUT,
352 .name = ION_MM_FIRMWARE_HEAP_NAME,
353 .size = MSM_ION_MM_FW_SIZE,
354 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700355 .extra_data = (void *) &fw_co_apq8064_ion_pdata,
Olav Haugand3d29682012-01-19 10:57:07 -0800356 },
357 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800358 .id = ION_CP_MFC_HEAP_ID,
359 .type = ION_HEAP_TYPE_CP,
360 .name = ION_MFC_HEAP_NAME,
361 .size = MSM_ION_MFC_SIZE,
362 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700363 .extra_data = (void *) &cp_mfc_apq8064_ion_pdata,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800364 },
Olav Haugan129992c2012-03-22 09:54:01 -0700365#ifndef CONFIG_MSM_IOMMU
Olav Haugan7c6aa742012-01-16 16:47:37 -0800366 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800367 .id = ION_SF_HEAP_ID,
368 .type = ION_HEAP_TYPE_CARVEOUT,
369 .name = ION_SF_HEAP_NAME,
370 .size = MSM_ION_SF_SIZE,
371 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700372 .extra_data = (void *) &co_apq8064_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800373 },
Olav Haugan129992c2012-03-22 09:54:01 -0700374#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800375 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800376 .id = ION_IOMMU_HEAP_ID,
377 .type = ION_HEAP_TYPE_IOMMU,
378 .name = ION_IOMMU_HEAP_NAME,
379 },
Olav Hauganf45e2142012-01-19 11:01:01 -0800380 {
381 .id = ION_QSECOM_HEAP_ID,
382 .type = ION_HEAP_TYPE_CARVEOUT,
383 .name = ION_QSECOM_HEAP_NAME,
384 .size = MSM_ION_QSECOM_SIZE,
385 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700386 .extra_data = (void *) &co_apq8064_ion_pdata,
Olav Hauganf45e2142012-01-19 11:01:01 -0800387 },
Olav Haugan2c43fac2012-01-19 11:06:37 -0800388 {
389 .id = ION_AUDIO_HEAP_ID,
390 .type = ION_HEAP_TYPE_CARVEOUT,
391 .name = ION_AUDIO_HEAP_NAME,
392 .size = MSM_ION_AUDIO_SIZE,
393 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700394 .extra_data = (void *) &co_apq8064_ion_pdata,
Olav Haugan2c43fac2012-01-19 11:06:37 -0800395 },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800396#endif
397 }
398};
399
Laura Abbottb93525f2012-04-12 09:57:19 -0700400static struct platform_device apq8064_ion_dev = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800401 .name = "ion-msm",
402 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700403 .dev = { .platform_data = &apq8064_ion_pdata },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800404};
405#endif
406
Larry Bassel67b921d2012-04-06 10:23:27 -0700407static struct platform_device apq8064_fmem_device = {
408 .name = "fmem",
409 .id = 1,
410 .dev = { .platform_data = &apq8064_fmem_pdata },
411};
412
413static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
414 unsigned long size)
415{
416 apq8064_reserve_table[mem_type].size += size;
417}
418
419static void __init apq8064_reserve_fixed_area(unsigned long fixed_area_size)
420{
421#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
422 int ret;
423
424 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
425 panic("fixed area size is larger than %dM\n",
426 MAX_FIXED_AREA_SIZE >> 20);
427
428 reserve_info->fixed_area_size = fixed_area_size;
429 reserve_info->fixed_area_start = APQ8064_FW_START;
430
431 ret = memblock_remove(reserve_info->fixed_area_start,
432 reserve_info->fixed_area_size);
433 BUG_ON(ret);
434#endif
435}
436
437/**
438 * Reserve memory for ION and calculate amount of reusable memory for fmem.
439 * We only reserve memory for heaps that are not reusable. However, we only
440 * support one reusable heap at the moment so we ignore the reusable flag for
441 * other than the first heap with reusable flag set. Also handle special case
442 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
443 * at a higher address than FW in addition to not more than 256MB away from the
444 * base address of the firmware. This means that if MM is reusable the other
445 * two heaps must be allocated in the same region as FW. This is handled by the
446 * mem_is_fmem flag in the platform data. In addition the MM heap must be
447 * adjacent to the FW heap for content protection purposes.
448 */
Stephen Boyd668d7652012-04-25 11:31:01 -0700449static void __init reserve_ion_memory(void)
Olav Haugan7c6aa742012-01-16 16:47:37 -0800450{
451#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Larry Bassel67b921d2012-04-06 10:23:27 -0700452 unsigned int i;
Larry Bassel67b921d2012-04-06 10:23:27 -0700453 unsigned int fixed_size = 0;
454 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
455 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
456
Larry Bassel67b921d2012-04-06 10:23:27 -0700457 fixed_low_size = 0;
458 fixed_middle_size = 0;
459 fixed_high_size = 0;
460
Larry Bassel67b921d2012-04-06 10:23:27 -0700461 for (i = 0; i < apq8064_ion_pdata.nr; ++i) {
462 const struct ion_platform_heap *heap =
463 &(apq8064_ion_pdata.heaps[i]);
464
465 if (heap->extra_data) {
466 int fixed_position = NOT_FIXED;
Larry Bassel67b921d2012-04-06 10:23:27 -0700467
Mitchel Humpherys362b52b2012-09-13 10:53:22 -0700468 switch ((int)heap->type) {
Larry Bassel67b921d2012-04-06 10:23:27 -0700469 case ION_HEAP_TYPE_CP:
Larry Bassel67b921d2012-04-06 10:23:27 -0700470 fixed_position = ((struct ion_cp_heap_pdata *)
471 heap->extra_data)->fixed_position;
472 break;
473 case ION_HEAP_TYPE_CARVEOUT:
Larry Bassel67b921d2012-04-06 10:23:27 -0700474 fixed_position = ((struct ion_co_heap_pdata *)
475 heap->extra_data)->fixed_position;
476 break;
477 default:
478 break;
479 }
480
481 if (fixed_position != NOT_FIXED)
482 fixed_size += heap->size;
483 else
484 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
485
486 if (fixed_position == FIXED_LOW)
487 fixed_low_size += heap->size;
488 else if (fixed_position == FIXED_MIDDLE)
489 fixed_middle_size += heap->size;
490 else if (fixed_position == FIXED_HIGH)
491 fixed_high_size += heap->size;
Larry Bassel67b921d2012-04-06 10:23:27 -0700492 }
493 }
494
495 if (!fixed_size)
496 return;
497
Larry Bassel67b921d2012-04-06 10:23:27 -0700498 /* Since the fixed area may be carved out of lowmem,
499 * make sure the length is a multiple of 1M.
500 */
Hanumant Singheadb7502012-05-15 18:14:04 -0700501 fixed_size = (fixed_size + HOLE_SIZE + SECTION_SIZE - 1)
Larry Bassel67b921d2012-04-06 10:23:27 -0700502 & SECTION_MASK;
503 apq8064_reserve_fixed_area(fixed_size);
504
505 fixed_low_start = APQ8064_FIXED_AREA_START;
Hanumant Singheadb7502012-05-15 18:14:04 -0700506 fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE;
Larry Bassel67b921d2012-04-06 10:23:27 -0700507 fixed_high_start = fixed_middle_start + fixed_middle_size;
508
509 for (i = 0; i < apq8064_ion_pdata.nr; ++i) {
510 struct ion_platform_heap *heap = &(apq8064_ion_pdata.heaps[i]);
511
512 if (heap->extra_data) {
513 int fixed_position = NOT_FIXED;
Steve Mucklef132c6c2012-06-06 18:30:57 -0700514 struct ion_cp_heap_pdata *pdata = NULL;
Larry Bassel67b921d2012-04-06 10:23:27 -0700515
Mitchel Humpherys362b52b2012-09-13 10:53:22 -0700516 switch ((int) heap->type) {
Larry Bassel67b921d2012-04-06 10:23:27 -0700517 case ION_HEAP_TYPE_CP:
Hanumant Singheadb7502012-05-15 18:14:04 -0700518 pdata =
519 (struct ion_cp_heap_pdata *)heap->extra_data;
520 fixed_position = pdata->fixed_position;
Larry Bassel67b921d2012-04-06 10:23:27 -0700521 break;
522 case ION_HEAP_TYPE_CARVEOUT:
523 fixed_position = ((struct ion_co_heap_pdata *)
524 heap->extra_data)->fixed_position;
525 break;
526 default:
527 break;
528 }
529
530 switch (fixed_position) {
531 case FIXED_LOW:
532 heap->base = fixed_low_start;
533 break;
534 case FIXED_MIDDLE:
535 heap->base = fixed_middle_start;
Hanumant Singheadb7502012-05-15 18:14:04 -0700536 pdata->secure_base = fixed_middle_start
537 - HOLE_SIZE;
538 pdata->secure_size = HOLE_SIZE + heap->size;
Larry Bassel67b921d2012-04-06 10:23:27 -0700539 break;
540 case FIXED_HIGH:
541 heap->base = fixed_high_start;
542 break;
543 default:
544 break;
545 }
546 }
547 }
Olav Haugan7c6aa742012-01-16 16:47:37 -0800548#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700549}
550
Huaibin Yang4a084e32011-12-15 15:25:52 -0800551static void __init reserve_mdp_memory(void)
552{
553 apq8064_mdp_writeback(apq8064_reserve_table);
554}
555
Laura Abbott93a4a352012-05-25 09:26:35 -0700556static void __init reserve_cache_dump_memory(void)
557{
558#ifdef CONFIG_MSM_CACHE_DUMP
559 unsigned int total;
560
561 total = apq8064_cache_dump_pdata.l1_size +
562 apq8064_cache_dump_pdata.l2_size;
563 apq8064_reserve_table[MEMTYPE_EBI1].size += total;
564#endif
565}
566
Abhijeet Dharmapurikardca26f72012-09-13 11:02:03 -0700567static void __init reserve_mpdcvs_memory(void)
568{
569 apq8064_reserve_table[MEMTYPE_EBI1].size += SZ_32K;
570}
571
Kevin Chan13be4e22011-10-20 11:30:32 -0700572static void __init apq8064_calculate_reserve_sizes(void)
573{
574 size_pmem_devices();
575 reserve_pmem_memory();
Olav Haugan7c6aa742012-01-16 16:47:37 -0800576 reserve_ion_memory();
Huaibin Yang4a084e32011-12-15 15:25:52 -0800577 reserve_mdp_memory();
Laura Abbott350c8362012-02-28 14:46:52 -0800578 reserve_rtb_memory();
Laura Abbott93a4a352012-05-25 09:26:35 -0700579 reserve_cache_dump_memory();
Abhijeet Dharmapurikardca26f72012-09-13 11:02:03 -0700580 reserve_mpdcvs_memory();
Kevin Chan13be4e22011-10-20 11:30:32 -0700581}
582
583static struct reserve_info apq8064_reserve_info __initdata = {
584 .memtype_reserve_table = apq8064_reserve_table,
585 .calculate_reserve_sizes = apq8064_calculate_reserve_sizes,
Larry Bassel67b921d2012-04-06 10:23:27 -0700586 .reserve_fixed_area = apq8064_reserve_fixed_area,
Kevin Chan13be4e22011-10-20 11:30:32 -0700587 .paddr_to_memtype = apq8064_paddr_to_memtype,
588};
589
590static int apq8064_memory_bank_size(void)
591{
592 return 1<<29;
593}
594
595static void __init locate_unstable_memory(void)
596{
597 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
598 unsigned long bank_size;
599 unsigned long low, high;
600
601 bank_size = apq8064_memory_bank_size();
602 low = meminfo.bank[0].start;
603 high = mb->start + mb->size;
Olav Haugand76e3a82012-01-16 16:55:07 -0800604
605 /* Check if 32 bit overflow occured */
606 if (high < mb->start)
Larry Bassel67b921d2012-04-06 10:23:27 -0700607 high = -PAGE_SIZE;
Olav Haugand76e3a82012-01-16 16:55:07 -0800608
Kevin Chan13be4e22011-10-20 11:30:32 -0700609 low &= ~(bank_size - 1);
610
611 if (high - low <= bank_size)
Larry Bassel67b921d2012-04-06 10:23:27 -0700612 goto no_dmm;
613
614#ifdef CONFIG_ENABLE_DMM
Jack Cheung46bfffa2012-01-19 15:26:24 -0800615 apq8064_reserve_info.low_unstable_address = mb->start -
616 MIN_MEMORY_BLOCK_SIZE + mb->size;
617 apq8064_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
618
Kevin Chan13be4e22011-10-20 11:30:32 -0700619 apq8064_reserve_info.bank_size = bank_size;
620 pr_info("low unstable address %lx max size %lx bank size %lx\n",
621 apq8064_reserve_info.low_unstable_address,
622 apq8064_reserve_info.max_unstable_size,
623 apq8064_reserve_info.bank_size);
Larry Bassel67b921d2012-04-06 10:23:27 -0700624 return;
625#endif
626no_dmm:
627 apq8064_reserve_info.low_unstable_address = high;
628 apq8064_reserve_info.max_unstable_size = 0;
Kevin Chan13be4e22011-10-20 11:30:32 -0700629}
630
Hanumant Singh50440d42012-04-23 19:27:16 -0700631static int apq8064_change_memory_power(u64 start, u64 size,
632 int change_type)
633{
634 return soc_change_memory_power(start, size, change_type);
635}
636
Aravind Venkateswaran8ac7f412012-03-16 17:57:30 -0700637static char prim_panel_name[PANEL_NAME_MAX_LEN];
638static char ext_panel_name[PANEL_NAME_MAX_LEN];
Ajay Singh Parmar6b82d2b2012-07-19 17:23:26 +0530639
640static int ext_resolution;
641
Aravind Venkateswaran8ac7f412012-03-16 17:57:30 -0700642static int __init prim_display_setup(char *param)
643{
644 if (strnlen(param, PANEL_NAME_MAX_LEN))
645 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
646 return 0;
647}
648early_param("prim_display", prim_display_setup);
649
650static int __init ext_display_setup(char *param)
651{
652 if (strnlen(param, PANEL_NAME_MAX_LEN))
653 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
654 return 0;
655}
656early_param("ext_display", ext_display_setup);
657
Ajay Singh Parmar6b82d2b2012-07-19 17:23:26 +0530658static int __init hdmi_resulution_setup(char *param)
659{
660 int ret;
661 ret = kstrtoint(param, 10, &ext_resolution);
662 return ret;
663}
664early_param("ext_resolution", hdmi_resulution_setup);
665
Kevin Chan13be4e22011-10-20 11:30:32 -0700666static void __init apq8064_reserve(void)
667{
Ajay Singh Parmar6b82d2b2012-07-19 17:23:26 +0530668 apq8064_set_display_params(prim_panel_name, ext_panel_name,
669 ext_resolution);
Kevin Chan13be4e22011-10-20 11:30:32 -0700670 msm_reserve();
671}
672
Laura Abbott6988cef2012-03-15 14:27:13 -0700673static void __init place_movable_zone(void)
674{
Larry Bassel67b921d2012-04-06 10:23:27 -0700675#ifdef CONFIG_ENABLE_DMM
Laura Abbott6988cef2012-03-15 14:27:13 -0700676 movable_reserved_start = apq8064_reserve_info.low_unstable_address;
677 movable_reserved_size = apq8064_reserve_info.max_unstable_size;
678 pr_info("movable zone start %lx size %lx\n",
679 movable_reserved_start, movable_reserved_size);
Larry Bassel67b921d2012-04-06 10:23:27 -0700680#endif
Laura Abbott6988cef2012-03-15 14:27:13 -0700681}
682
683static void __init apq8064_early_reserve(void)
684{
685 reserve_info = &apq8064_reserve_info;
686 locate_unstable_memory();
687 place_movable_zone();
688
689}
Hemant Kumara945b472012-01-25 15:08:06 -0800690#ifdef CONFIG_USB_EHCI_MSM_HSIC
Hemant Kumare6275972012-02-29 20:06:21 -0800691/* Bandwidth requests (zero) if no vote placed */
692static struct msm_bus_vectors hsic_init_vectors[] = {
693 {
694 .src = MSM_BUS_MASTER_SPS,
695 .dst = MSM_BUS_SLAVE_EBI_CH0,
696 .ab = 0,
697 .ib = 0,
698 },
699 {
700 .src = MSM_BUS_MASTER_SPS,
701 .dst = MSM_BUS_SLAVE_SPS,
702 .ab = 0,
703 .ib = 0,
704 },
705};
706
707/* Bus bandwidth requests in Bytes/sec */
708static struct msm_bus_vectors hsic_max_vectors[] = {
709 {
710 .src = MSM_BUS_MASTER_SPS,
711 .dst = MSM_BUS_SLAVE_EBI_CH0,
712 .ab = 60000000, /* At least 480Mbps on bus. */
713 .ib = 960000000, /* MAX bursts rate */
714 },
715 {
716 .src = MSM_BUS_MASTER_SPS,
717 .dst = MSM_BUS_SLAVE_SPS,
718 .ab = 0,
719 .ib = 512000000, /*vote for 64Mhz dfab clk rate*/
720 },
721};
722
723static struct msm_bus_paths hsic_bus_scale_usecases[] = {
724 {
725 ARRAY_SIZE(hsic_init_vectors),
726 hsic_init_vectors,
727 },
728 {
729 ARRAY_SIZE(hsic_max_vectors),
730 hsic_max_vectors,
731 },
732};
733
734static struct msm_bus_scale_pdata hsic_bus_scale_pdata = {
735 hsic_bus_scale_usecases,
736 ARRAY_SIZE(hsic_bus_scale_usecases),
737 .name = "hsic",
738};
739
Hemant Kumara945b472012-01-25 15:08:06 -0800740static struct msm_hsic_host_platform_data msm_hsic_pdata = {
Hemant Kumare6275972012-02-29 20:06:21 -0800741 .strobe = 88,
742 .data = 89,
743 .bus_scale_table = &hsic_bus_scale_pdata,
Hemant Kumara945b472012-01-25 15:08:06 -0800744};
745#else
746static struct msm_hsic_host_platform_data msm_hsic_pdata;
747#endif
748
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800749#define PID_MAGIC_ID 0x71432909
750#define SERIAL_NUM_MAGIC_ID 0x61945374
751#define SERIAL_NUMBER_LENGTH 127
752#define DLOAD_USB_BASE_ADD 0x2A03F0C8
753
754struct magic_num_struct {
755 uint32_t pid;
756 uint32_t serial_num;
757};
758
759struct dload_struct {
760 uint32_t reserved1;
761 uint32_t reserved2;
762 uint32_t reserved3;
763 uint16_t reserved4;
764 uint16_t pid;
765 char serial_number[SERIAL_NUMBER_LENGTH];
766 uint16_t reserved5;
767 struct magic_num_struct magic_struct;
768};
769
770static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
771{
772 struct dload_struct __iomem *dload = 0;
773
774 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
775 if (!dload) {
776 pr_err("%s: cannot remap I/O memory region: %08x\n",
777 __func__, DLOAD_USB_BASE_ADD);
778 return -ENXIO;
779 }
780
781 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
782 __func__, dload, pid, snum);
783 /* update pid */
784 dload->magic_struct.pid = PID_MAGIC_ID;
785 dload->pid = pid;
786
787 /* update serial number */
788 dload->magic_struct.serial_num = 0;
789 if (!snum) {
790 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
791 goto out;
792 }
793
794 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
795 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
796out:
797 iounmap(dload);
798 return 0;
799}
800
801static struct android_usb_platform_data android_usb_pdata = {
802 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
803};
804
Hemant Kumar4933b072011-10-17 23:43:11 -0700805static struct platform_device android_usb_device = {
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800806 .name = "android_usb",
807 .id = -1,
808 .dev = {
809 .platform_data = &android_usb_pdata,
810 },
Hemant Kumar4933b072011-10-17 23:43:11 -0700811};
812
Hemant Kumar7620eed2012-02-26 09:08:43 -0800813/* Bandwidth requests (zero) if no vote placed */
814static struct msm_bus_vectors usb_init_vectors[] = {
815 {
816 .src = MSM_BUS_MASTER_SPS,
817 .dst = MSM_BUS_SLAVE_EBI_CH0,
818 .ab = 0,
819 .ib = 0,
820 },
821};
822
823/* Bus bandwidth requests in Bytes/sec */
824static struct msm_bus_vectors usb_max_vectors[] = {
825 {
826 .src = MSM_BUS_MASTER_SPS,
827 .dst = MSM_BUS_SLAVE_EBI_CH0,
828 .ab = 60000000, /* At least 480Mbps on bus. */
829 .ib = 960000000, /* MAX bursts rate */
830 },
831};
832
833static struct msm_bus_paths usb_bus_scale_usecases[] = {
834 {
835 ARRAY_SIZE(usb_init_vectors),
836 usb_init_vectors,
837 },
838 {
839 ARRAY_SIZE(usb_max_vectors),
840 usb_max_vectors,
841 },
842};
843
844static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
845 usb_bus_scale_usecases,
846 ARRAY_SIZE(usb_bus_scale_usecases),
847 .name = "usb",
848};
849
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700850static int phy_init_seq[] = {
Chiranjeevi Velempatif983aeb2012-08-23 08:16:50 +0530851 0x68, 0x81, /* update DC voltage level */
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700852 0x24, 0x82, /* set pre-emphasis and rise/fall time */
853 -1
854};
855
Vijayavardhan Vennapusa4fa13692012-08-02 14:35:03 +0530856#define PMIC_GPIO_DP 27 /* PMIC GPIO for D+ change */
857#define PMIC_GPIO_DP_IRQ PM8921_GPIO_IRQ(PM8921_IRQ_BASE, PMIC_GPIO_DP)
Jack Pham87f202f2012-08-06 00:24:22 -0700858#define MSM_MPM_PIN_USB1_OTGSESSVLD 40
859
Hemant Kumar4933b072011-10-17 23:43:11 -0700860static struct msm_otg_platform_data msm_otg_pdata = {
Hemant Kumard86c4882012-01-24 19:39:37 -0800861 .mode = USB_OTG,
862 .otg_control = OTG_PMIC_CONTROL,
Hemant Kumar4933b072011-10-17 23:43:11 -0700863 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Hemant Kumard86c4882012-01-24 19:39:37 -0800864 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
865 .power_budget = 750,
Hemant Kumar7620eed2012-02-26 09:08:43 -0800866 .bus_scale_table = &usb_bus_scale_pdata,
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700867 .phy_init_seq = phy_init_seq,
Jack Pham87f202f2012-08-06 00:24:22 -0700868 .mpm_otgsessvld_int = MSM_MPM_PIN_USB1_OTGSESSVLD,
Hemant Kumar4933b072011-10-17 23:43:11 -0700869};
870
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800871static struct msm_usb_host_platform_data msm_ehci_host_pdata3 = {
Manu Gautam91223e02011-11-08 15:27:22 +0530872 .power_budget = 500,
873};
874
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800875#ifdef CONFIG_USB_EHCI_MSM_HOST4
876static struct msm_usb_host_platform_data msm_ehci_host_pdata4;
877#endif
878
Manu Gautam91223e02011-11-08 15:27:22 +0530879static void __init apq8064_ehci_host_init(void)
880{
Chiranjeevi Velempatib822fa32012-05-23 22:05:59 +0530881 if (machine_is_apq8064_liquid() || machine_is_mpq8064_cdp() ||
Chiranjeevi Velempatidd4dbaa2012-10-05 16:22:04 +0530882 machine_is_mpq8064_hrd() || machine_is_mpq8064_dtv() ||
883 machine_is_apq8064_cdp()) {
Chiranjeevi Velempatib822fa32012-05-23 22:05:59 +0530884 if (machine_is_apq8064_liquid())
885 msm_ehci_host_pdata3.dock_connect_irq =
886 PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9);
Vijayavardhan Vennapusa4fa13692012-08-02 14:35:03 +0530887 else
888 msm_ehci_host_pdata3.pmic_gpio_dp_irq =
889 PMIC_GPIO_DP_IRQ;
Hemant Kumar56925352012-02-13 16:59:52 -0800890
Manu Gautam91223e02011-11-08 15:27:22 +0530891 apq8064_device_ehci_host3.dev.platform_data =
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800892 &msm_ehci_host_pdata3;
Manu Gautam91223e02011-11-08 15:27:22 +0530893 platform_device_register(&apq8064_device_ehci_host3);
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800894
895#ifdef CONFIG_USB_EHCI_MSM_HOST4
896 apq8064_device_ehci_host4.dev.platform_data =
897 &msm_ehci_host_pdata4;
898 platform_device_register(&apq8064_device_ehci_host4);
899#endif
Manu Gautam91223e02011-11-08 15:27:22 +0530900 }
901}
902
David Keitel2f613d92012-02-15 11:29:16 -0800903static struct smb349_platform_data smb349_data __initdata = {
904 .en_n_gpio = PM8921_GPIO_PM_TO_SYS(37),
905 .chg_susp_gpio = PM8921_GPIO_PM_TO_SYS(30),
906 .chg_current_ma = 2200,
907};
908
909static struct i2c_board_info smb349_charger_i2c_info[] __initdata = {
910 {
911 I2C_BOARD_INFO(SMB349_NAME, 0x1B),
912 .platform_data = &smb349_data,
913 },
914};
915
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -0800916struct sx150x_platform_data apq8064_sx150x_data[] = {
917 [SX150X_EPM] = {
918 .gpio_base = GPIO_EPM_EXPANDER_BASE,
919 .oscio_is_gpo = false,
920 .io_pullup_ena = 0x0,
921 .io_pulldn_ena = 0x0,
922 .io_open_drain_ena = 0x0,
923 .io_polarity = 0,
924 .irq_summary = -1,
925 },
926};
927
928static struct epm_chan_properties ads_adc_channel_data[] = {
Yan He44c59962012-08-31 11:14:58 -0700929 {10, 100}, {1000, 1}, {10, 100}, {1000, 1},
930 {10, 100}, {1000, 1}, {10, 100}, {1000, 1},
931 {10, 100}, {20, 100}, {500, 100}, {5, 100},
932 {1000, 1}, {200, 100}, {50, 100}, {10, 100},
933 {510, 100}, {50, 100}, {20, 100}, {100, 100},
934 {510, 100}, {20, 100}, {50, 100}, {200, 100},
935 {10, 100}, {20, 100}, {1000, 1}, {10, 100},
936 {200, 100}, {510, 100}, {1000, 100}, {200, 100},
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -0800937};
938
939static struct epm_adc_platform_data epm_adc_pdata = {
940 .channel = ads_adc_channel_data,
941 .bus_id = 0x0,
942 .epm_i2c_board_info = {
943 .type = "sx1509q",
944 .addr = 0x3e,
945 .platform_data = &apq8064_sx150x_data[SX150X_EPM],
946 },
947 .gpio_expander_base_addr = GPIO_EPM_EXPANDER_BASE,
948};
949
950static struct platform_device epm_adc_device = {
951 .name = "epm_adc",
952 .id = -1,
953 .dev = {
954 .platform_data = &epm_adc_pdata,
955 },
956};
957
958static void __init apq8064_epm_adc_init(void)
959{
960 epm_adc_pdata.num_channels = 32;
961 epm_adc_pdata.num_adc = 2;
962 epm_adc_pdata.chan_per_adc = 16;
963 epm_adc_pdata.chan_per_mux = 8;
964};
965
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800966/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
967 * 4 micbiases are used to power various analog and digital
968 * microphones operating at 1800 mV. Technically, all micbiases
969 * can source from single cfilter since all microphones operate
970 * at the same voltage level. The arrangement below is to make
971 * sure all cfilters are exercised. LDO_H regulator ouput level
972 * does not need to be as high as 2.85V. It is choosen for
973 * microphone sensitivity purpose.
974 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530975static struct wcd9xxx_pdata apq8064_tabla_platform_data = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800976 .slimbus_slave_device = {
977 .name = "tabla-slave",
978 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
979 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800980 .irq = MSM_GPIO_TO_INT(42),
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800981 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530982 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800983 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
984 .micbias = {
985 .ldoh_v = TABLA_LDOH_2P85_V,
986 .cfilt1_mv = 1800,
Bhalchandra Gajare975c53a2012-08-10 12:16:49 -0700987 .cfilt2_mv = 2700,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800988 .cfilt3_mv = 1800,
989 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
990 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
991 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
992 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530993 },
994 .regulator = {
995 {
996 .name = "CDC_VDD_CP",
997 .min_uV = 1800000,
998 .max_uV = 1800000,
999 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
1000 },
1001 {
1002 .name = "CDC_VDDA_RX",
1003 .min_uV = 1800000,
1004 .max_uV = 1800000,
1005 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
1006 },
1007 {
1008 .name = "CDC_VDDA_TX",
1009 .min_uV = 1800000,
1010 .max_uV = 1800000,
1011 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
1012 },
1013 {
1014 .name = "VDDIO_CDC",
1015 .min_uV = 1800000,
1016 .max_uV = 1800000,
1017 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1018 },
1019 {
1020 .name = "VDDD_CDC_D",
1021 .min_uV = 1225000,
David Collins62debe82012-06-06 17:01:03 -07001022 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301023 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1024 },
1025 {
1026 .name = "CDC_VDDA_A_1P2V",
1027 .min_uV = 1225000,
David Collins62debe82012-06-06 17:01:03 -07001028 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301029 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1030 },
1031 },
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001032};
1033
1034static struct slim_device apq8064_slim_tabla = {
1035 .name = "tabla-slim",
1036 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
1037 .dev = {
1038 .platform_data = &apq8064_tabla_platform_data,
1039 },
1040};
1041
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301042static struct wcd9xxx_pdata apq8064_tabla20_platform_data = {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001043 .slimbus_slave_device = {
1044 .name = "tabla-slave",
1045 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
1046 },
1047 .irq = MSM_GPIO_TO_INT(42),
1048 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301049 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001050 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
1051 .micbias = {
1052 .ldoh_v = TABLA_LDOH_2P85_V,
1053 .cfilt1_mv = 1800,
Bhalchandra Gajare975c53a2012-08-10 12:16:49 -07001054 .cfilt2_mv = 2700,
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001055 .cfilt3_mv = 1800,
1056 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
1057 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
1058 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
1059 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301060 },
1061 .regulator = {
1062 {
1063 .name = "CDC_VDD_CP",
1064 .min_uV = 1800000,
1065 .max_uV = 1800000,
1066 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
1067 },
1068 {
1069 .name = "CDC_VDDA_RX",
1070 .min_uV = 1800000,
1071 .max_uV = 1800000,
1072 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
1073 },
1074 {
1075 .name = "CDC_VDDA_TX",
1076 .min_uV = 1800000,
1077 .max_uV = 1800000,
1078 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
1079 },
1080 {
1081 .name = "VDDIO_CDC",
1082 .min_uV = 1800000,
1083 .max_uV = 1800000,
1084 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1085 },
1086 {
1087 .name = "VDDD_CDC_D",
1088 .min_uV = 1225000,
David Collins62debe82012-06-06 17:01:03 -07001089 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301090 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1091 },
1092 {
1093 .name = "CDC_VDDA_A_1P2V",
1094 .min_uV = 1225000,
David Collins62debe82012-06-06 17:01:03 -07001095 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301096 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1097 },
1098 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001099};
1100
1101static struct slim_device apq8064_slim_tabla20 = {
1102 .name = "tabla2x-slim",
1103 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
1104 .dev = {
1105 .platform_data = &apq8064_tabla20_platform_data,
1106 },
1107};
1108
Kuirong Wangf8c5e142012-06-21 16:17:32 -07001109static struct wcd9xxx_pdata apq8064_tabla_i2c_platform_data = {
1110 .irq = MSM_GPIO_TO_INT(77),
1111 .irq_base = TABLA_INTERRUPT_BASE,
1112 .num_irqs = NR_WCD9XXX_IRQS,
1113 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
1114 .micbias = {
1115 .ldoh_v = TABLA_LDOH_2P85_V,
1116 .cfilt1_mv = 1800,
1117 .cfilt2_mv = 1800,
1118 .cfilt3_mv = 1800,
1119 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
1120 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
1121 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
1122 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
1123 },
1124 .regulator = {
1125 {
1126 .name = "CDC_VDD_CP",
1127 .min_uV = 1800000,
1128 .max_uV = 1800000,
1129 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
1130 },
1131 {
1132 .name = "CDC_VDDA_RX",
1133 .min_uV = 1800000,
1134 .max_uV = 1800000,
1135 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
1136 },
1137 {
1138 .name = "CDC_VDDA_TX",
1139 .min_uV = 1800000,
1140 .max_uV = 1800000,
1141 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
1142 },
1143 {
1144 .name = "VDDIO_CDC",
1145 .min_uV = 1800000,
1146 .max_uV = 1800000,
1147 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1148 },
1149 {
1150 .name = "VDDD_CDC_D",
1151 .min_uV = 1225000,
1152 .max_uV = 1250000,
1153 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1154 },
1155 {
1156 .name = "CDC_VDDA_A_1P2V",
1157 .min_uV = 1225000,
1158 .max_uV = 1250000,
1159 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1160 },
1161 },
1162};
1163
1164static struct i2c_board_info apq8064_tabla_i2c_device_info[] __initdata = {
1165 {
1166 I2C_BOARD_INFO("tabla top level",
1167 APQ_8064_TABLA_I2C_SLAVE_ADDR),
1168 .platform_data = &apq8064_tabla_i2c_platform_data,
1169 },
1170 {
1171 I2C_BOARD_INFO("tabla analog",
1172 APQ_8064_TABLA_ANALOG_I2C_SLAVE_ADDR),
1173 .platform_data = &apq8064_tabla_i2c_platform_data,
1174 },
1175 {
1176 I2C_BOARD_INFO("tabla digital1",
1177 APQ_8064_TABLA_DIGITAL1_I2C_SLAVE_ADDR),
1178 .platform_data = &apq8064_tabla_i2c_platform_data,
1179 },
1180 {
1181 I2C_BOARD_INFO("tabla digital2",
1182 APQ_8064_TABLA_DIGITAL2_I2C_SLAVE_ADDR),
1183 .platform_data = &apq8064_tabla_i2c_platform_data,
1184 },
1185};
1186
Santosh Mardi344455a2012-09-07 13:22:16 +05301187static struct wcd9xxx_pdata mpq8064_ashiko20_platform_data = {
1188 .slimbus_slave_device = {
1189 .name = "tabla-slave",
1190 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
1191 },
1192 .irq = MSM_GPIO_TO_INT(42),
1193 .irq_base = TABLA_INTERRUPT_BASE,
1194 .num_irqs = NR_WCD9XXX_IRQS,
1195 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
1196 .micbias = {
1197 .ldoh_v = TABLA_LDOH_2P85_V,
1198 .cfilt1_mv = 1800,
1199 .cfilt2_mv = 1800,
1200 .cfilt3_mv = 1800,
1201 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
1202 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
1203 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
1204 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
1205 },
1206 .regulator = {
1207 {
1208 .name = "CDC_VDD_CP",
1209 .min_uV = 1800000,
1210 .max_uV = 1800000,
1211 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
1212 },
1213 {
1214 .name = "CDC_VDDA_RX",
1215 .min_uV = 1800000,
1216 .max_uV = 1800000,
1217 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
1218 },
1219 {
1220 .name = "CDC_VDDA_TX",
1221 .min_uV = 1800000,
1222 .max_uV = 1800000,
1223 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
1224 },
1225 {
1226 .name = "VDDIO_CDC",
1227 .min_uV = 1800000,
1228 .max_uV = 1800000,
1229 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1230 },
1231 {
1232 .name = "HRD_VDDD_CDC_D",
1233 .min_uV = 1200000,
1234 .max_uV = 1200000,
1235 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1236 },
1237 {
1238 .name = "HRD_CDC_VDDA_A_1P2V",
1239 .min_uV = 1200000,
1240 .max_uV = 1200000,
1241 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1242 },
1243 },
1244};
1245
1246static struct slim_device mpq8064_slim_ashiko20 = {
1247 .name = "tabla2x-slim",
1248 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
1249 .dev = {
1250 .platform_data = &mpq8064_ashiko20_platform_data,
1251 },
1252};
1253
1254
Santosh Mardi695be0d2012-04-10 23:21:12 +05301255/* enable the level shifter for cs8427 to make sure the I2C
1256 * clock is running at 100KHz and voltage levels are at 3.3
1257 * and 5 volts
1258 */
1259static int enable_100KHz_ls(int enable)
1260{
1261 int ret = 0;
1262 if (enable) {
1263 ret = gpio_request(SX150X_GPIO(1, 10),
1264 "cs8427_100KHZ_ENABLE");
1265 if (ret) {
1266 pr_err("%s: Failed to request gpio %d\n", __func__,
1267 SX150X_GPIO(1, 10));
1268 return ret;
1269 }
1270 gpio_direction_output(SX150X_GPIO(1, 10), 1);
Santosh Mardi3896ed32012-08-31 19:26:54 +05301271 } else {
1272 gpio_direction_output(SX150X_GPIO(1, 10), 0);
Santosh Mardi695be0d2012-04-10 23:21:12 +05301273 gpio_free(SX150X_GPIO(1, 10));
Santosh Mardi3896ed32012-08-31 19:26:54 +05301274 }
Santosh Mardi695be0d2012-04-10 23:21:12 +05301275 return ret;
1276}
1277
Santosh Mardieff9a742012-04-09 23:23:39 +05301278static struct cs8427_platform_data cs8427_i2c_platform_data = {
1279 .irq = SX150X_GPIO(1, 4),
1280 .reset_gpio = SX150X_GPIO(1, 6),
Santosh Mardi695be0d2012-04-10 23:21:12 +05301281 .enable = enable_100KHz_ls,
Santosh Mardieff9a742012-04-09 23:23:39 +05301282};
1283
1284static struct i2c_board_info cs8427_device_info[] __initdata = {
1285 {
1286 I2C_BOARD_INFO("cs8427", CS8427_ADDR4),
1287 .platform_data = &cs8427_i2c_platform_data,
1288 },
1289};
1290
Amy Maloche70090f992012-02-16 16:35:26 -08001291#define HAP_SHIFT_LVL_OE_GPIO PM8921_MPP_PM_TO_SYS(8)
1292#define ISA1200_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1293#define ISA1200_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
David Collinsd49a1c52012-08-22 13:18:06 -07001294#define ISA1200_HAP_CLK_PM8921 PM8921_GPIO_PM_TO_SYS(44)
1295#define ISA1200_HAP_CLK_PM8917 PM8921_GPIO_PM_TO_SYS(38)
Amy Maloche70090f992012-02-16 16:35:26 -08001296
Mohan Pallaka2d877602012-05-11 13:07:30 +05301297static int isa1200_clk_enable(bool on)
Amy Maloche70090f992012-02-16 16:35:26 -08001298{
David Collinsd49a1c52012-08-22 13:18:06 -07001299 unsigned int gpio = ISA1200_HAP_CLK_PM8921;
Amy Maloche8f973892012-03-26 14:53:13 -07001300 int rc = 0;
1301
David Collinsd49a1c52012-08-22 13:18:06 -07001302 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
1303 gpio = ISA1200_HAP_CLK_PM8917;
1304
1305 gpio_set_value_cansleep(gpio, on);
Amy Maloche70090f992012-02-16 16:35:26 -08001306
Mohan Pallaka2d877602012-05-11 13:07:30 +05301307 if (on) {
Amy Maloche8f973892012-03-26 14:53:13 -07001308 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_1, true);
Mohan Pallaka2d877602012-05-11 13:07:30 +05301309 if (rc) {
1310 pr_err("%s: unable to write aux clock register(%d)\n",
1311 __func__, rc);
1312 goto err_gpio_dis;
1313 }
1314 } else {
Amy Maloche8f973892012-03-26 14:53:13 -07001315 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_NONE, true);
Mohan Pallaka2d877602012-05-11 13:07:30 +05301316 if (rc)
1317 pr_err("%s: unable to write aux clock register(%d)\n",
1318 __func__, rc);
Amy Maloche8f973892012-03-26 14:53:13 -07001319 }
1320
1321 return rc;
Mohan Pallaka2d877602012-05-11 13:07:30 +05301322
1323err_gpio_dis:
David Collinsd49a1c52012-08-22 13:18:06 -07001324 gpio_set_value_cansleep(gpio, !on);
Mohan Pallaka2d877602012-05-11 13:07:30 +05301325 return rc;
Amy Maloche70090f992012-02-16 16:35:26 -08001326}
1327
1328static int isa1200_dev_setup(bool enable)
1329{
David Collinsd49a1c52012-08-22 13:18:06 -07001330 unsigned int gpio = ISA1200_HAP_CLK_PM8921;
Amy Maloche70090f992012-02-16 16:35:26 -08001331 int rc = 0;
1332
David Collinsd49a1c52012-08-22 13:18:06 -07001333 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
1334 gpio = ISA1200_HAP_CLK_PM8917;
1335
Amy Maloche70090f992012-02-16 16:35:26 -08001336 if (!enable)
1337 goto free_gpio;
1338
David Collinsd49a1c52012-08-22 13:18:06 -07001339 rc = gpio_request(gpio, "haptics_clk");
Amy Maloche70090f992012-02-16 16:35:26 -08001340 if (rc) {
1341 pr_err("%s: unable to request gpio %d config(%d)\n",
David Collinsd49a1c52012-08-22 13:18:06 -07001342 __func__, gpio, rc);
Amy Maloche70090f992012-02-16 16:35:26 -08001343 return rc;
1344 }
1345
David Collinsd49a1c52012-08-22 13:18:06 -07001346 rc = gpio_direction_output(gpio, 0);
Amy Maloche70090f992012-02-16 16:35:26 -08001347 if (rc) {
1348 pr_err("%s: unable to set direction\n", __func__);
1349 goto free_gpio;
1350 }
1351
1352 return 0;
1353
1354free_gpio:
David Collinsd49a1c52012-08-22 13:18:06 -07001355 gpio_free(gpio);
Amy Maloche70090f992012-02-16 16:35:26 -08001356 return rc;
1357}
1358
1359static struct isa1200_regulator isa1200_reg_data[] = {
1360 {
1361 .name = "vddp",
1362 .min_uV = ISA_I2C_VTG_MIN_UV,
1363 .max_uV = ISA_I2C_VTG_MAX_UV,
1364 .load_uA = ISA_I2C_CURR_UA,
1365 },
1366};
1367
1368static struct isa1200_platform_data isa1200_1_pdata = {
1369 .name = "vibrator",
1370 .dev_setup = isa1200_dev_setup,
Mohan Pallaka2d877602012-05-11 13:07:30 +05301371 .clk_enable = isa1200_clk_enable,
Mohan Pallaka32f20a72012-06-14 14:41:11 +05301372 .need_pwm_clk = true,
Amy Maloche70090f992012-02-16 16:35:26 -08001373 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
1374 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
1375 .max_timeout = 15000,
1376 .mode_ctrl = PWM_GEN_MODE,
1377 .pwm_fd = {
1378 .pwm_div = 256,
1379 },
1380 .is_erm = false,
1381 .smart_en = true,
1382 .ext_clk_en = true,
1383 .chip_en = 1,
1384 .regulator_info = isa1200_reg_data,
1385 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1386};
1387
1388static struct i2c_board_info isa1200_board_info[] __initdata = {
1389 {
1390 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1391 .platform_data = &isa1200_1_pdata,
1392 },
1393};
Jing Lin21ed4de2012-02-05 15:53:28 -08001394/* configuration data for mxt1386e using V2.1 firmware */
1395static const u8 mxt1386e_config_data_v2_1[] = {
1396 /* T6 Object */
1397 0, 0, 0, 0, 0, 0,
1398 /* T38 Object */
Jing Linc6a55cfc2012-08-31 10:54:44 -07001399 14, 3, 0, 5, 7, 12, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001400 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1401 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1402 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1403 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1404 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1405 0, 0, 0, 0,
1406 /* T7 Object */
Jing Linc6a55cfc2012-08-31 10:54:44 -07001407 32, 10, 50,
Jing Lin21ed4de2012-02-05 15:53:28 -08001408 /* T8 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001409 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001410 /* T9 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001411 139, 0, 0, 26, 42, 0, 32, 80, 2, 5,
Jing Linc6a55cfc2012-08-31 10:54:44 -07001412 0, 5, 5, 79, 10, 30, 10, 10, 255, 2,
Jing Linf1208fd2012-02-23 11:15:42 -08001413 85, 5, 0, 5, 9, 5, 12, 35, 70, 40,
1414 20, 5, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001415 /* T18 Object */
1416 0, 0,
1417 /* T24 Object */
1418 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1419 0, 0, 0, 0, 0, 0, 0, 0, 0,
1420 /* T25 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001421 1, 0, 60, 115, 156, 99,
Jing Lin21ed4de2012-02-05 15:53:28 -08001422 /* T27 Object */
1423 0, 0, 0, 0, 0, 0, 0,
1424 /* T40 Object */
1425 0, 0, 0, 0, 0,
1426 /* T42 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001427 0, 0, 255, 0, 255, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001428 /* T43 Object */
1429 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
1430 16,
1431 /* T46 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001432 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001433 /* T47 Object */
1434 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
1435 /* T48 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001436 1, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001437 32, 40, 0, 10, 10, 0, 0, 100, 10, 90,
1438 0, 0, 0, 0, 0, 0, 0, 10, 1, 10,
1439 52, 10, 12, 0, 33, 0, 1, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001440 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1441 0, 0, 0, 0,
1442 /* T56 Object */
1443 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1444 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1445 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1446 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001447 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1448 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001449};
1450
1451#define MXT_TS_GPIO_IRQ 6
1452#define MXT_TS_PWR_EN_GPIO PM8921_GPIO_PM_TO_SYS(23)
1453#define MXT_TS_RESET_GPIO 33
1454
1455static struct mxt_config_info mxt_config_array[] = {
1456 {
1457 .config = mxt1386e_config_data_v2_1,
1458 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1459 .family_id = 0xA0,
1460 .variant_id = 0x7,
1461 .version = 0x21,
1462 .build = 0xAA,
Jing Linef4aa9b2012-03-26 12:01:41 -07001463 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
1464 .fw_name = "atmel_8064_liquid_v2_2_AA.hex",
1465 },
1466 {
1467 /* The config data for V2.2.AA is the same as for V2.1.AA */
1468 .config = mxt1386e_config_data_v2_1,
1469 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1470 .family_id = 0xA0,
1471 .variant_id = 0x7,
1472 .version = 0x22,
1473 .build = 0xAA,
1474 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin21ed4de2012-02-05 15:53:28 -08001475 },
1476};
1477
1478static struct mxt_platform_data mxt_platform_data = {
1479 .config_array = mxt_config_array,
1480 .config_array_size = ARRAY_SIZE(mxt_config_array),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08001481 .panel_minx = 0,
1482 .panel_maxx = 1365,
1483 .panel_miny = 0,
1484 .panel_maxy = 767,
1485 .disp_minx = 0,
1486 .disp_maxx = 1365,
1487 .disp_miny = 0,
1488 .disp_maxy = 767,
Anirudh Ghayal39dbe3f2012-04-13 15:43:16 +05301489 .irqflags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
Jing Lin21ed4de2012-02-05 15:53:28 -08001490 .i2c_pull_up = true,
1491 .reset_gpio = MXT_TS_RESET_GPIO,
1492 .irq_gpio = MXT_TS_GPIO_IRQ,
1493};
1494
1495static struct i2c_board_info mxt_device_info[] __initdata = {
1496 {
1497 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
1498 .platform_data = &mxt_platform_data,
1499 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1500 },
1501};
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001502#define CYTTSP_TS_GPIO_IRQ 6
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001503#define CYTTSP_TS_GPIO_SLEEP 33
Amy Maloche609bb5e2012-08-03 09:41:42 -07001504#define CYTTSP_TS_GPIO_SLEEP_ALT 12
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001505
1506static ssize_t tma340_vkeys_show(struct kobject *kobj,
1507 struct kobj_attribute *attr, char *buf)
1508{
1509 return snprintf(buf, 200,
1510 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1511 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1512 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1513 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1514 "\n");
1515}
1516
1517static struct kobj_attribute tma340_vkeys_attr = {
1518 .attr = {
1519 .mode = S_IRUGO,
1520 },
1521 .show = &tma340_vkeys_show,
1522};
1523
1524static struct attribute *tma340_properties_attrs[] = {
1525 &tma340_vkeys_attr.attr,
1526 NULL
1527};
1528
1529static struct attribute_group tma340_properties_attr_group = {
1530 .attrs = tma340_properties_attrs,
1531};
1532
1533static int cyttsp_platform_init(struct i2c_client *client)
1534{
1535 int rc = 0;
1536 static struct kobject *tma340_properties_kobj;
1537
1538 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1539 tma340_properties_kobj = kobject_create_and_add("board_properties",
1540 NULL);
1541 if (tma340_properties_kobj)
1542 rc = sysfs_create_group(tma340_properties_kobj,
1543 &tma340_properties_attr_group);
1544 if (!tma340_properties_kobj || rc)
1545 pr_err("%s: failed to create board_properties\n",
1546 __func__);
1547
1548 return 0;
1549}
1550
1551static struct cyttsp_regulator cyttsp_regulator_data[] = {
1552 {
1553 .name = "vdd",
1554 .min_uV = CY_TMA300_VTG_MIN_UV,
1555 .max_uV = CY_TMA300_VTG_MAX_UV,
1556 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1557 .lpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1558 },
1559 {
1560 .name = "vcc_i2c",
1561 .min_uV = CY_I2C_VTG_MIN_UV,
1562 .max_uV = CY_I2C_VTG_MAX_UV,
1563 .hpm_load_uA = CY_I2C_CURR_UA,
1564 .lpm_load_uA = CY_I2C_CURR_UA,
1565 },
1566};
1567
1568static struct cyttsp_platform_data cyttsp_pdata = {
1569 .panel_maxx = 634,
1570 .panel_maxy = 1166,
1571 .disp_maxx = 599,
1572 .disp_maxy = 1023,
1573 .disp_minx = 0,
1574 .disp_miny = 0,
1575 .flags = 0x01,
1576 .gen = CY_GEN3,
1577 .use_st = CY_USE_ST,
1578 .use_mt = CY_USE_MT,
1579 .use_hndshk = CY_SEND_HNDSHK,
1580 .use_trk_id = CY_USE_TRACKING_ID,
1581 .use_sleep = CY_USE_DEEP_SLEEP_SEL,
1582 .use_gestures = CY_USE_GESTURES,
1583 .fw_fname = "cyttsp_8064_mtp.hex",
1584 /* change act_intrvl to customize the Active power state
1585 * scanning/processing refresh interval for Operating mode
1586 */
1587 .act_intrvl = CY_ACT_INTRVL_DFLT,
1588 /* change tch_tmout to customize the touch timeout for the
1589 * Active power state for Operating mode
1590 */
1591 .tch_tmout = CY_TCH_TMOUT_DFLT,
1592 /* change lp_intrvl to customize the Low Power power state
1593 * scanning/processing refresh interval for Operating mode
1594 */
1595 .lp_intrvl = CY_LP_INTRVL_DFLT,
1596 .sleep_gpio = CYTTSP_TS_GPIO_SLEEP,
Amy Maloche9ba3ffe2012-04-26 10:31:20 -07001597 .resout_gpio = -1,
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001598 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1599 .regulator_info = cyttsp_regulator_data,
1600 .num_regulators = ARRAY_SIZE(cyttsp_regulator_data),
1601 .init = cyttsp_platform_init,
1602 .correct_fw_ver = 17,
1603};
1604
1605static struct i2c_board_info cyttsp_info[] __initdata = {
1606 {
1607 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1608 .platform_data = &cyttsp_pdata,
1609 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1610 },
1611};
Jing Lin21ed4de2012-02-05 15:53:28 -08001612
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001613#define MSM_WCNSS_PHYS 0x03000000
1614#define MSM_WCNSS_SIZE 0x280000
1615
1616static struct resource resources_wcnss_wlan[] = {
1617 {
1618 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1619 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1620 .name = "wcnss_wlanrx_irq",
1621 .flags = IORESOURCE_IRQ,
1622 },
1623 {
1624 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1625 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1626 .name = "wcnss_wlantx_irq",
1627 .flags = IORESOURCE_IRQ,
1628 },
1629 {
1630 .start = MSM_WCNSS_PHYS,
1631 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1632 .name = "wcnss_mmio",
1633 .flags = IORESOURCE_MEM,
1634 },
1635 {
1636 .start = 64,
1637 .end = 68,
1638 .name = "wcnss_gpios_5wire",
1639 .flags = IORESOURCE_IO,
1640 },
1641};
1642
1643static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1644 .has_48mhz_xo = 1,
1645};
1646
1647static struct platform_device msm_device_wcnss_wlan = {
1648 .name = "wcnss_wlan",
1649 .id = 0,
1650 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1651 .resource = resources_wcnss_wlan,
1652 .dev = {.platform_data = &qcom_wcnss_pdata},
1653};
1654
Ankit Vermab7c26e62012-02-28 15:04:15 -08001655static struct platform_device msm_device_iris_fm __devinitdata = {
1656 .name = "iris_fm",
1657 .id = -1,
1658};
1659
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001660#ifdef CONFIG_QSEECOM
1661/* qseecom bus scaling */
1662static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
1663 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001664 .src = MSM_BUS_MASTER_ADM_PORT0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001665 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001666 .ab = 0,
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001667 .ib = 0,
1668 },
1669 {
1670 .src = MSM_BUS_MASTER_ADM_PORT1,
1671 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1672 .ab = 0,
1673 .ib = 0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001674 },
1675 {
1676 .src = MSM_BUS_MASTER_SPDM,
1677 .dst = MSM_BUS_SLAVE_SPDM,
1678 .ib = 0,
1679 .ab = 0,
1680 },
1681};
1682
1683static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
1684 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001685 .src = MSM_BUS_MASTER_ADM_PORT0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001686 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001687 .ab = 70000000UL,
1688 .ib = 70000000UL,
1689 },
1690 {
1691 .src = MSM_BUS_MASTER_ADM_PORT1,
1692 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1693 .ab = 2480000000UL,
1694 .ib = 2480000000UL,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001695 },
1696 {
1697 .src = MSM_BUS_MASTER_SPDM,
1698 .dst = MSM_BUS_SLAVE_SPDM,
1699 .ib = 0,
1700 .ab = 0,
1701 },
1702};
1703
1704static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1705 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001706 .src = MSM_BUS_MASTER_ADM_PORT0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001707 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001708 .ab = 0,
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001709 .ib = 0,
1710 },
1711 {
1712 .src = MSM_BUS_MASTER_ADM_PORT1,
1713 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1714 .ab = 0,
1715 .ib = 0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001716 },
1717 {
1718 .src = MSM_BUS_MASTER_SPDM,
1719 .dst = MSM_BUS_SLAVE_SPDM,
1720 .ib = (64 * 8) * 1000000UL,
1721 .ab = (64 * 8) * 100000UL,
1722 },
1723};
1724
Ramesh Masavarapu8d756582012-10-03 10:18:06 -07001725static struct msm_bus_vectors qseecom_enable_dfab_sfpb_vectors[] = {
1726 {
1727 .src = MSM_BUS_MASTER_ADM_PORT0,
1728 .dst = MSM_BUS_SLAVE_EBI_CH0,
1729 .ab = 70000000UL,
1730 .ib = 70000000UL,
1731 },
1732 {
1733 .src = MSM_BUS_MASTER_ADM_PORT1,
1734 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1735 .ab = 2480000000UL,
1736 .ib = 2480000000UL,
1737 },
1738 {
1739 .src = MSM_BUS_MASTER_SPDM,
1740 .dst = MSM_BUS_SLAVE_SPDM,
1741 .ib = (64 * 8) * 1000000UL,
1742 .ab = (64 * 8) * 100000UL,
1743 },
1744};
1745
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001746static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1747 {
1748 ARRAY_SIZE(qseecom_clks_init_vectors),
1749 qseecom_clks_init_vectors,
1750 },
1751 {
1752 ARRAY_SIZE(qseecom_enable_dfab_vectors),
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001753 qseecom_enable_dfab_vectors,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001754 },
1755 {
1756 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1757 qseecom_enable_sfpb_vectors,
1758 },
Ramesh Masavarapu8d756582012-10-03 10:18:06 -07001759 {
1760 ARRAY_SIZE(qseecom_enable_dfab_sfpb_vectors),
1761 qseecom_enable_dfab_sfpb_vectors,
1762 },
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001763};
1764
1765static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1766 qseecom_hw_bus_scale_usecases,
1767 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1768 .name = "qsee",
1769};
1770
1771static struct platform_device qseecom_device = {
1772 .name = "qseecom",
1773 .id = 0,
1774 .dev = {
1775 .platform_data = &qseecom_bus_pdata,
1776 },
1777};
1778#endif
1779
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001780#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1781 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1782 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1783 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1784
1785#define QCE_SIZE 0x10000
1786#define QCE_0_BASE 0x11000000
1787
1788#define QCE_HW_KEY_SUPPORT 0
1789#define QCE_SHA_HMAC_SUPPORT 1
1790#define QCE_SHARE_CE_RESOURCE 3
1791#define QCE_CE_SHARED 0
1792
1793static struct resource qcrypto_resources[] = {
1794 [0] = {
1795 .start = QCE_0_BASE,
1796 .end = QCE_0_BASE + QCE_SIZE - 1,
1797 .flags = IORESOURCE_MEM,
1798 },
1799 [1] = {
1800 .name = "crypto_channels",
1801 .start = DMOV8064_CE_IN_CHAN,
1802 .end = DMOV8064_CE_OUT_CHAN,
1803 .flags = IORESOURCE_DMA,
1804 },
1805 [2] = {
1806 .name = "crypto_crci_in",
1807 .start = DMOV8064_CE_IN_CRCI,
1808 .end = DMOV8064_CE_IN_CRCI,
1809 .flags = IORESOURCE_DMA,
1810 },
1811 [3] = {
1812 .name = "crypto_crci_out",
1813 .start = DMOV8064_CE_OUT_CRCI,
1814 .end = DMOV8064_CE_OUT_CRCI,
1815 .flags = IORESOURCE_DMA,
1816 },
1817};
1818
1819static struct resource qcedev_resources[] = {
1820 [0] = {
1821 .start = QCE_0_BASE,
1822 .end = QCE_0_BASE + QCE_SIZE - 1,
1823 .flags = IORESOURCE_MEM,
1824 },
1825 [1] = {
1826 .name = "crypto_channels",
1827 .start = DMOV8064_CE_IN_CHAN,
1828 .end = DMOV8064_CE_OUT_CHAN,
1829 .flags = IORESOURCE_DMA,
1830 },
1831 [2] = {
1832 .name = "crypto_crci_in",
1833 .start = DMOV8064_CE_IN_CRCI,
1834 .end = DMOV8064_CE_IN_CRCI,
1835 .flags = IORESOURCE_DMA,
1836 },
1837 [3] = {
1838 .name = "crypto_crci_out",
1839 .start = DMOV8064_CE_OUT_CRCI,
1840 .end = DMOV8064_CE_OUT_CRCI,
1841 .flags = IORESOURCE_DMA,
1842 },
1843};
1844
1845#endif
1846
1847#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1848 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1849
1850static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1851 .ce_shared = QCE_CE_SHARED,
1852 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1853 .hw_key_support = QCE_HW_KEY_SUPPORT,
1854 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001855 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001856};
1857
1858static struct platform_device qcrypto_device = {
1859 .name = "qcrypto",
1860 .id = 0,
1861 .num_resources = ARRAY_SIZE(qcrypto_resources),
1862 .resource = qcrypto_resources,
1863 .dev = {
1864 .coherent_dma_mask = DMA_BIT_MASK(32),
1865 .platform_data = &qcrypto_ce_hw_suppport,
1866 },
1867};
1868#endif
1869
1870#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1871 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1872
1873static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1874 .ce_shared = QCE_CE_SHARED,
1875 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1876 .hw_key_support = QCE_HW_KEY_SUPPORT,
1877 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001878 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001879};
1880
1881static struct platform_device qcedev_device = {
1882 .name = "qce",
1883 .id = 0,
1884 .num_resources = ARRAY_SIZE(qcedev_resources),
1885 .resource = qcedev_resources,
1886 .dev = {
1887 .coherent_dma_mask = DMA_BIT_MASK(32),
1888 .platform_data = &qcedev_ce_hw_suppport,
1889 },
1890};
1891#endif
1892
Joel Kingef390842012-05-23 16:42:48 -07001893static struct mdm_vddmin_resource mdm_vddmin_rscs = {
1894 .rpm_id = MSM_RPM_ID_VDDMIN_GPIO,
1895 .ap2mdm_vddmin_gpio = 30,
1896 .modes = 0x03,
1897 .drive_strength = 8,
1898 .mdm2ap_vddmin_gpio = 80,
1899};
1900
Joel King269aa602012-07-23 08:07:35 -07001901static struct gpiomux_setting mdm2ap_status_gpio_run_cfg = {
1902 .func = GPIOMUX_FUNC_GPIO,
1903 .drv = GPIOMUX_DRV_8MA,
1904 .pull = GPIOMUX_PULL_NONE,
1905};
1906
Joel Kingdacbc822012-01-25 13:30:57 -08001907static struct mdm_platform_data mdm_platform_data = {
1908 .mdm_version = "3.0",
1909 .ramdump_delay_ms = 2000,
Joel King14fe7fa2012-05-27 14:26:11 -07001910 .early_power_on = 1,
1911 .sfr_query = 1,
Joel Kingbf3e4b52012-09-26 09:10:34 -07001912 .send_shdn = 1,
Joel Kingef390842012-05-23 16:42:48 -07001913 .vddmin_resource = &mdm_vddmin_rscs,
Hemant Kumara945b472012-01-25 15:08:06 -08001914 .peripheral_platform_device = &apq8064_device_hsic_host,
Ameya Thakurc9a7a842012-06-24 22:47:52 -07001915 .ramdump_timeout_ms = 120000,
Joel King269aa602012-07-23 08:07:35 -07001916 .mdm2ap_status_gpio_run_cfg = &mdm2ap_status_gpio_run_cfg,
Joel Kingdacbc822012-01-25 13:30:57 -08001917};
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001918
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001919static struct tsens_platform_data apq_tsens_pdata = {
1920 .tsens_factor = 1000,
1921 .hw_type = APQ_8064,
1922 .tsens_num_sensor = 11,
1923 .slope = {1176, 1176, 1154, 1176, 1111,
1924 1132, 1132, 1199, 1132, 1199, 1132},
1925};
1926
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07001927static struct platform_device msm_tsens_device = {
1928 .name = "tsens8960-tm",
1929 .id = -1,
1930};
1931
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06001932static struct msm_thermal_data msm_thermal_pdata = {
1933 .sensor_id = 7,
Eugene Seah2ee4a5d2012-06-25 18:16:41 -06001934 .poll_ms = 250,
1935 .limit_temp_degC = 60,
1936 .temp_hysteresis_degC = 10,
1937 .freq_step = 2,
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06001938};
1939
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001940#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001941static void __init apq8064_map_io(void)
1942{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001943 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001944 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001945 if (socinfo_init() < 0)
1946 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001947}
1948
1949static void __init apq8064_init_irq(void)
1950{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001951 struct msm_mpm_device_data *data = NULL;
1952
1953#ifdef CONFIG_MSM_MPM
1954 data = &apq8064_mpm_dev_data;
1955#endif
1956
1957 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001958 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1959 (void *)MSM_QGIC_CPU_BASE);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001960}
1961
Abhishek Kharbanda72dc72e2012-06-07 13:41:37 -07001962static struct msm_mhl_platform_data mhl_platform_data = {
1963 .irq = MSM_GPIO_TO_INT(MHL_GPIO_INT),
1964 .gpio_mhl_int = MHL_GPIO_INT,
1965 .gpio_mhl_reset = MHL_GPIO_RESET,
1966 .gpio_mhl_power = 0,
1967 .gpio_hdmi_mhl_mux = 0,
1968};
1969
1970static struct i2c_board_info sii_device_info[] __initdata = {
1971 {
1972 /*
1973 * keeps SI 8334 as the default
1974 * MHL TX
1975 */
1976 I2C_BOARD_INFO("sii8334", 0x39),
1977 .platform_data = &mhl_platform_data,
1978 .flags = I2C_CLIENT_WAKE,
1979 },
1980};
1981
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001982static struct platform_device msm8064_device_saw_regulator_core0 = {
1983 .name = "saw-regulator",
1984 .id = 0,
1985 .dev = {
1986 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
1987 },
1988};
1989
1990static struct platform_device msm8064_device_saw_regulator_core1 = {
1991 .name = "saw-regulator",
1992 .id = 1,
1993 .dev = {
1994 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
1995 },
1996};
1997
1998static struct platform_device msm8064_device_saw_regulator_core2 = {
1999 .name = "saw-regulator",
2000 .id = 2,
2001 .dev = {
2002 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
2003 },
2004};
2005
2006static struct platform_device msm8064_device_saw_regulator_core3 = {
2007 .name = "saw-regulator",
2008 .id = 3,
2009 .dev = {
2010 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002011
2012 },
2013};
2014
Oluwafemi Adeyemif5a31422012-03-08 16:58:45 -08002015static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06002016 {
2017 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2018 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2019 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002020 1, 784, 180000, 100,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002021 },
2022
2023 {
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002024 MSM_PM_SLEEP_MODE_RETENTION,
2025 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2026 true,
2027 415, 715, 340827, 475,
2028 },
2029
2030 {
Praveen Chidambaram78499012011-11-01 17:15:17 -06002031 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2032 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2033 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002034 1300, 228, 1200000, 2000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002035 },
2036
2037 {
2038 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2039 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2040 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002041 2000, 138, 1208400, 3200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002042 },
2043
2044 {
2045 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Praveen Chidambarame3380672012-02-08 10:32:27 -07002046 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2047 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002048 6000, 119, 1850300, 9000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002049 },
2050
2051 {
2052 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2053 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2054 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002055 9200, 68, 2839200, 16400,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002056 },
2057
2058 {
2059 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2060 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2061 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002062 10300, 63, 3128000, 18200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002063 },
2064
2065 {
2066 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2067 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2068 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002069 18000, 10, 4602600, 27000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002070 },
2071
2072 {
2073 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2074 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2075 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002076 20000, 2, 5752000, 32000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002077 },
2078};
2079
2080static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2081 .mode = MSM_PM_BOOT_CONFIG_TZ,
2082};
2083
2084static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2085 .levels = &msm_rpmrs_levels[0],
2086 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2087 .vdd_mem_levels = {
2088 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2089 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2090 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2091 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2092 },
2093 .vdd_dig_levels = {
2094 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
2095 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
2096 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
2097 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
2098 },
2099 .vdd_mask = 0x7FFFFF,
2100 .rpmrs_target_id = {
2101 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2102 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
2103 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
2104 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
2105 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
2106 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
2107 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2108 },
2109};
2110
Praveen Chidambaram78499012011-11-01 17:15:17 -06002111static uint8_t spm_wfi_cmd_sequence[] __initdata = {
2112 0x03, 0x0f,
2113};
2114
2115static uint8_t spm_power_collapse_without_rpm[] __initdata = {
2116 0x00, 0x24, 0x54, 0x10,
2117 0x09, 0x03, 0x01,
2118 0x10, 0x54, 0x30, 0x0C,
2119 0x24, 0x30, 0x0f,
2120};
2121
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002122static uint8_t spm_retention_cmd_sequence[] __initdata = {
2123 0x00, 0x05, 0x03, 0x0D,
2124 0x0B, 0x00, 0x0f,
2125};
2126
Praveen Chidambaram78499012011-11-01 17:15:17 -06002127static uint8_t spm_power_collapse_with_rpm[] __initdata = {
2128 0x00, 0x24, 0x54, 0x10,
2129 0x09, 0x07, 0x01, 0x0B,
2130 0x10, 0x54, 0x30, 0x0C,
2131 0x24, 0x30, 0x0f,
2132};
2133
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002134static struct msm_spm_seq_entry msm_spm_boot_cpu_seq_list[] __initdata = {
2135 [0] = {
2136 .mode = MSM_SPM_MODE_CLOCK_GATING,
2137 .notify_rpm = false,
2138 .cmd = spm_wfi_cmd_sequence,
2139 },
2140 [1] = {
2141 .mode = MSM_SPM_MODE_POWER_RETENTION,
2142 .notify_rpm = false,
2143 .cmd = spm_retention_cmd_sequence,
2144 },
2145 [2] = {
2146 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2147 .notify_rpm = false,
2148 .cmd = spm_power_collapse_without_rpm,
2149 },
2150 [3] = {
2151 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2152 .notify_rpm = true,
2153 .cmd = spm_power_collapse_with_rpm,
2154 },
2155};
2156static struct msm_spm_seq_entry msm_spm_nonboot_cpu_seq_list[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06002157 [0] = {
2158 .mode = MSM_SPM_MODE_CLOCK_GATING,
2159 .notify_rpm = false,
2160 .cmd = spm_wfi_cmd_sequence,
2161 },
2162 [1] = {
2163 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2164 .notify_rpm = false,
2165 .cmd = spm_power_collapse_without_rpm,
2166 },
2167 [2] = {
2168 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2169 .notify_rpm = true,
2170 .cmd = spm_power_collapse_with_rpm,
2171 },
2172};
2173
2174static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
2175 0x00, 0x20, 0x03, 0x20,
2176 0x00, 0x0f,
2177};
2178
2179static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
2180 0x00, 0x20, 0x34, 0x64,
2181 0x48, 0x07, 0x48, 0x20,
2182 0x50, 0x64, 0x04, 0x34,
2183 0x50, 0x0f,
2184};
2185static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
2186 0x00, 0x10, 0x34, 0x64,
2187 0x48, 0x07, 0x48, 0x10,
2188 0x50, 0x64, 0x04, 0x34,
2189 0x50, 0x0F,
2190};
2191
2192static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
2193 [0] = {
2194 .mode = MSM_SPM_L2_MODE_RETENTION,
2195 .notify_rpm = false,
2196 .cmd = l2_spm_wfi_cmd_sequence,
2197 },
2198 [1] = {
2199 .mode = MSM_SPM_L2_MODE_GDHS,
2200 .notify_rpm = true,
2201 .cmd = l2_spm_gdhs_cmd_sequence,
2202 },
2203 [2] = {
2204 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
2205 .notify_rpm = true,
2206 .cmd = l2_spm_power_off_cmd_sequence,
2207 },
2208};
2209
2210
2211static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
2212 [0] = {
2213 .reg_base_addr = MSM_SAW_L2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002214 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07002215 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002216 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
2217 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
2218 .modes = msm_spm_l2_seq_list,
2219 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
2220 },
2221};
2222
2223static struct msm_spm_platform_data msm_spm_data[] __initdata = {
2224 [0] = {
2225 .reg_base_addr = MSM_SAW0_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002226 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002227#if defined(CONFIG_MSM_AVS_HW)
2228 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2229 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2230#endif
2231 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002232 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004,
2233 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C,
2234 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002235 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002236 .num_modes = ARRAY_SIZE(msm_spm_boot_cpu_seq_list),
2237 .modes = msm_spm_boot_cpu_seq_list,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002238 },
2239 [1] = {
2240 .reg_base_addr = MSM_SAW1_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002241 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002242#if defined(CONFIG_MSM_AVS_HW)
2243 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2244 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2245#endif
2246 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07002247 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002248 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2249 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2250 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002251 .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
2252 .modes = msm_spm_nonboot_cpu_seq_list,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002253 },
2254 [2] = {
2255 .reg_base_addr = MSM_SAW2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002256 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002257#if defined(CONFIG_MSM_AVS_HW)
2258 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2259 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2260#endif
2261 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07002262 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002263 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2264 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2265 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002266 .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
2267 .modes = msm_spm_nonboot_cpu_seq_list,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002268 },
2269 [3] = {
2270 .reg_base_addr = MSM_SAW3_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002271 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002272#if defined(CONFIG_MSM_AVS_HW)
2273 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2274 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2275#endif
2276 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07002277 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002278 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2279 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2280 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002281 .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
2282 .modes = msm_spm_nonboot_cpu_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08002283 },
2284};
2285
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002286static void __init apq8064_init_buses(void)
2287{
2288 msm_bus_rpm_set_mt_mask();
2289 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
2290 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
2291 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
2292 msm_bus_8064_apps_fabric.dev.platform_data =
2293 &msm_bus_8064_apps_fabric_pdata;
2294 msm_bus_8064_sys_fabric.dev.platform_data =
2295 &msm_bus_8064_sys_fabric_pdata;
2296 msm_bus_8064_mm_fabric.dev.platform_data =
2297 &msm_bus_8064_mm_fabric_pdata;
2298 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
2299 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
2300}
2301
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002302/* PCIe gpios */
2303static struct msm_pcie_gpio_info_t msm_pcie_gpio_info[MSM_PCIE_MAX_GPIO] = {
2304 {"rst_n", PM8921_MPP_PM_TO_SYS(PCIE_RST_N_PMIC_MPP), 0},
2305 {"pwr_en", PM8921_GPIO_PM_TO_SYS(PCIE_PWR_EN_PMIC_GPIO), 1},
2306};
2307
2308static struct msm_pcie_platform msm_pcie_platform_data = {
2309 .gpio = msm_pcie_gpio_info,
Niranjana Vishwanathapura68210ff2012-06-24 18:03:49 -06002310 .axi_addr = PCIE_AXI_BAR_PHYS,
2311 .axi_size = PCIE_AXI_BAR_SIZE,
Niranjana Vishwanathapura459a27d2012-07-20 12:23:55 -06002312 .wake_n = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, PCIE_WAKE_N_PMIC_GPIO),
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002313};
2314
Niranjana Vishwanathapurac1edd402012-06-28 15:32:50 -06002315static int __init mpq8064_pcie_enabled(void)
2316{
2317 return !((readl_relaxed(QFPROM_RAW_FEAT_CONFIG_ROW0_MSB) & BIT(21)) ||
2318 (readl_relaxed(QFPROM_RAW_OEM_CONFIG_ROW0_LSB) & BIT(4)));
2319}
2320
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002321static void __init mpq8064_pcie_init(void)
2322{
Niranjana Vishwanathapurac1edd402012-06-28 15:32:50 -06002323 if (mpq8064_pcie_enabled()) {
2324 msm_device_pcie.dev.platform_data = &msm_pcie_platform_data;
2325 platform_device_register(&msm_device_pcie);
2326 }
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002327}
2328
David Collinsf0d00732012-01-25 15:46:50 -08002329static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
2330 .name = GPIO_REGULATOR_DEV_NAME,
2331 .id = PM8921_MPP_PM_TO_SYS(7),
2332 .dev = {
2333 .platform_data
2334 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2335 },
2336};
2337
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08002338static struct platform_device apq8064_device_ext_mpp8_vreg __devinitdata = {
2339 .name = GPIO_REGULATOR_DEV_NAME,
2340 .id = PM8921_MPP_PM_TO_SYS(8),
2341 .dev = {
2342 .platform_data
2343 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_MPP8],
2344 },
2345};
2346
David Collinsf0d00732012-01-25 15:46:50 -08002347static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
2348 .name = GPIO_REGULATOR_DEV_NAME,
2349 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
2350 .dev = {
2351 .platform_data =
2352 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2353 },
2354};
2355
David Collins390fc332012-02-07 14:38:16 -08002356static struct platform_device apq8064_device_ext_ts_sw_vreg __devinitdata = {
2357 .name = GPIO_REGULATOR_DEV_NAME,
2358 .id = PM8921_GPIO_PM_TO_SYS(23),
2359 .dev = {
2360 .platform_data
2361 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_TS_SW],
2362 },
2363};
2364
David Collins2782b5c2012-02-06 10:02:42 -08002365static struct platform_device apq8064_device_rpm_regulator __devinitdata = {
2366 .name = "rpm-regulator",
David Collins793793b2012-08-21 15:43:02 -07002367 .id = 0,
David Collins2782b5c2012-02-06 10:02:42 -08002368 .dev = {
2369 .platform_data = &apq8064_rpm_regulator_pdata,
2370 },
2371};
2372
David Collins793793b2012-08-21 15:43:02 -07002373static struct platform_device
2374apq8064_pm8921_device_rpm_regulator __devinitdata = {
2375 .name = "rpm-regulator",
2376 .id = 1,
2377 .dev = {
2378 .platform_data = &apq8064_rpm_regulator_pm8921_pdata,
2379 },
2380};
2381
Ravi Kumar V05931a22012-04-04 17:09:37 +05302382static struct gpio_ir_recv_platform_data gpio_ir_recv_pdata = {
2383 .gpio_nr = 88,
2384 .active_low = 1,
Ravi Kumar V16a614c2012-10-12 20:59:56 +05302385 .can_wakeup = true,
Ravi Kumar V05931a22012-04-04 17:09:37 +05302386};
2387
2388static struct platform_device gpio_ir_recv_pdev = {
2389 .name = "gpio-rc-recv",
2390 .dev = {
2391 .platform_data = &gpio_ir_recv_pdata,
2392 },
2393};
2394
Terence Hampson36b70722012-05-10 13:18:16 -04002395static struct platform_device *common_not_mpq_devices[] __initdata = {
David Keitel3c40fc52012-02-09 17:53:52 -08002396 &apq8064_device_qup_i2c_gsbi1,
Jing Lin04601f92012-02-05 15:36:07 -08002397 &apq8064_device_qup_i2c_gsbi3,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002398 &apq8064_device_qup_i2c_gsbi4,
Terence Hampson36b70722012-05-10 13:18:16 -04002399};
2400
Kuirong Wangf8c5e142012-06-21 16:17:32 -07002401static struct platform_device *common_mpq_devices[] __initdata = {
2402 &mpq_cpudai_sec_i2s_rx,
2403 &mpq_cpudai_mi2s_tx,
2404};
2405
2406static struct platform_device *common_i2s_devices[] __initdata = {
2407 &apq_cpudai_mi2s,
2408 &apq_cpudai_i2s_rx,
2409 &apq_cpudai_i2s_tx,
2410};
2411
David Collins793793b2012-08-21 15:43:02 -07002412static struct platform_device *early_common_devices[] __initdata = {
Matt Wagantallf5cc3892012-06-07 19:47:02 -07002413 &apq8064_device_acpuclk,
Terence Hampson36b70722012-05-10 13:18:16 -04002414 &apq8064_device_dmov,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002415 &apq8064_device_qup_spi_gsbi5,
David Collins793793b2012-08-21 15:43:02 -07002416};
2417
2418static struct platform_device *pm8921_common_devices[] __initdata = {
David Collinsf0d00732012-01-25 15:46:50 -08002419 &apq8064_device_ext_5v_vreg,
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08002420 &apq8064_device_ext_mpp8_vreg,
David Collinsf0d00732012-01-25 15:46:50 -08002421 &apq8064_device_ext_3p3v_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07002422 &apq8064_device_ssbi_pmic1,
2423 &apq8064_device_ssbi_pmic2,
David Collins793793b2012-08-21 15:43:02 -07002424};
2425
2426static struct platform_device *pm8917_common_devices[] __initdata = {
2427 &apq8064_device_ext_mpp8_vreg,
2428 &apq8064_device_ext_3p3v_vreg,
2429 &apq8064_device_ssbi_pmic1,
2430 &apq8064_device_ssbi_pmic2,
David Collins793793b2012-08-21 15:43:02 -07002431};
2432
2433static struct platform_device *common_devices[] __initdata = {
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06002434 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07002435 &apq8064_device_otg,
2436 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08002437 &apq8064_device_hsusb_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07002438 &android_usb_device,
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08002439 &msm_device_wcnss_wlan,
Ankit Vermab7c26e62012-02-28 15:04:15 -08002440 &msm_device_iris_fm,
Larry Bassel67b921d2012-04-06 10:23:27 -07002441 &apq8064_fmem_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08002442#ifdef CONFIG_ANDROID_PMEM
2443#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002444 &apq8064_android_pmem_device,
2445 &apq8064_android_pmem_adsp_device,
2446 &apq8064_android_pmem_audio_device,
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -07002447#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
2448#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -08002449#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002450 &apq8064_ion_dev,
Olav Haugan7c6aa742012-01-16 16:47:37 -08002451#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002452 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08002453 &msm8064_device_saw_regulator_core0,
2454 &msm8064_device_saw_regulator_core1,
2455 &msm8064_device_saw_regulator_core2,
2456 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002457#if defined(CONFIG_QSEECOM)
2458 &qseecom_device,
2459#endif
2460
Joel Nider6b9a7bc2012-06-26 11:19:19 +03002461 &msm_8064_device_tsif[0],
2462 &msm_8064_device_tsif[1],
2463
Ramesh Masavarapu28311912011-10-27 11:04:12 -07002464#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2465 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2466 &qcrypto_device,
2467#endif
2468
2469#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2470 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2471 &qcedev_device,
2472#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07002473
2474#ifdef CONFIG_HW_RANDOM_MSM
2475 &apq8064_device_rng,
2476#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002477 &apq_pcm,
2478 &apq_pcm_routing,
2479 &apq_cpudai0,
2480 &apq_cpudai1,
2481 &apq_cpudai_hdmi_rx,
2482 &apq_cpudai_bt_rx,
2483 &apq_cpudai_bt_tx,
2484 &apq_cpudai_fm_rx,
2485 &apq_cpudai_fm_tx,
2486 &apq_cpu_fe,
2487 &apq_stub_codec,
2488 &apq_voice,
2489 &apq_voip,
2490 &apq_lpa_pcm,
Krishnankutty Kolathappilly4374e332012-03-18 22:27:30 -07002491 &apq_compr_dsp,
2492 &apq_multi_ch_pcm,
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -07002493 &apq_lowlatency_pcm,
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002494 &apq_pcm_hostless,
2495 &apq_cpudai_afe_01_rx,
2496 &apq_cpudai_afe_01_tx,
2497 &apq_cpudai_afe_02_rx,
2498 &apq_cpudai_afe_02_tx,
2499 &apq_pcm_afe,
2500 &apq_cpudai_auxpcm_rx,
2501 &apq_cpudai_auxpcm_tx,
Neema Shetty8427c262012-02-16 11:23:43 -08002502 &apq_cpudai_stub,
Neema Shetty3c9d2862012-03-11 01:25:32 -08002503 &apq_cpudai_slimbus_1_rx,
2504 &apq_cpudai_slimbus_1_tx,
Kiran Kandi97fe19d2012-05-20 22:34:04 -07002505 &apq_cpudai_slimbus_2_rx,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002506 &apq_cpudai_slimbus_2_tx,
Neema Shettyc9d86c32012-05-09 12:01:39 -07002507 &apq_cpudai_slimbus_3_rx,
Helen Zeng38c3c962012-05-17 14:56:20 -07002508 &apq_cpudai_slimbus_3_tx,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002509 &apq8064_rpm_device,
2510 &apq8064_rpm_log_device,
2511 &apq8064_rpm_stat_device,
Anji Jonnala93129922012-10-09 20:57:53 +05302512 &apq8064_rpm_master_stat_device,
Ramesh Masavarapuf31ff242012-05-10 18:55:21 -07002513 &apq_device_tz_log,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002514 &msm_bus_8064_apps_fabric,
2515 &msm_bus_8064_sys_fabric,
2516 &msm_bus_8064_mm_fabric,
2517 &msm_bus_8064_sys_fpb,
2518 &msm_bus_8064_cpss_fpb,
Mohan Kumar Gubbihalli Lachma Naik7f72edd2012-02-06 17:26:47 -08002519 &apq8064_msm_device_vidc,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07002520 &msm_pil_dsps,
Matt Wagantallb94b9a52012-02-02 21:59:54 -08002521 &msm_8960_q6_lpass,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002522 &msm_pil_vidc,
Matt Wagantall292aace2012-01-26 19:12:34 -08002523 &msm_gss,
Laura Abbottb93525f2012-04-12 09:57:19 -07002524 &apq8064_rtb_device,
Abhijeet Dharmapurikarfb4a2f82012-08-23 14:36:59 -07002525 &apq8064_msm_gov_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002526 &apq8064_device_cache_erp,
Stepan Moskovchenko0f3de112012-06-08 18:11:46 -07002527 &msm8960_device_ebi1_ch0_erp,
2528 &msm8960_device_ebi1_ch1_erp,
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002529 &epm_adc_device,
Pratik Patel3b0ca882012-06-01 16:54:14 -07002530 &coresight_tpiu_device,
2531 &coresight_etb_device,
2532 &apq8064_coresight_funnel_device,
2533 &coresight_etm0_device,
2534 &coresight_etm1_device,
2535 &coresight_etm2_device,
2536 &coresight_etm3_device,
Helen Zeng8f925502012-03-05 16:50:17 -08002537 &apq_cpudai_slim_4_rx,
2538 &apq_cpudai_slim_4_tx,
Steve Mucklef132c6c2012-06-06 18:30:57 -07002539#ifdef CONFIG_MSM_GEMINI
Jignesh Mehta921649d2012-04-19 06:57:23 -07002540 &msm8960_gemini_device,
Steve Mucklef132c6c2012-06-06 18:30:57 -07002541#endif
Laura Abbott0577d7b2012-04-17 11:14:30 -07002542 &apq8064_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002543 &msm_tsens_device,
Laura Abbott93a4a352012-05-25 09:26:35 -07002544 &apq8064_cache_dump_device,
Joel Nider0e4a16d2012-08-05 14:20:11 +03002545 &msm_8064_device_tspp,
Binqiang Qiuf165c922012-08-15 18:00:18 -07002546#ifdef CONFIG_BATTERY_BCL
2547 &battery_bcl_device,
2548#endif
Abhijeet Dharmapurikarfb4a2f82012-08-23 14:36:59 -07002549 &apq8064_msm_mpd_device,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002550};
2551
Joel King82b7e3f2012-01-05 10:03:27 -08002552static struct platform_device *cdp_devices[] __initdata = {
2553 &apq8064_device_uart_gsbi1,
Jin Hong4bbbfba2012-02-02 21:48:07 -08002554 &apq8064_device_uart_gsbi7,
Joel King82b7e3f2012-01-05 10:03:27 -08002555 &msm_device_sps_apq8064,
Aravind Venkateswaran4ca27532012-02-16 14:27:05 -08002556#ifdef CONFIG_MSM_ROTATOR
2557 &msm_rotator_device,
2558#endif
Anji Jonnala6c2b6852012-09-21 13:34:44 +05302559 &msm8064_pc_cntr,
Joel King82b7e3f2012-01-05 10:03:27 -08002560};
2561
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002562static struct platform_device
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002563mpq8064_device_ext_1p2_buck_vreg __devinitdata = {
2564 .name = GPIO_REGULATOR_DEV_NAME,
2565 .id = SX150X_GPIO(4, 2),
2566 .dev = {
2567 .platform_data =
2568 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P2V],
2569 },
2570};
2571
2572static struct platform_device
2573mpq8064_device_ext_1p8_buck_vreg __devinitdata = {
2574 .name = GPIO_REGULATOR_DEV_NAME,
2575 .id = SX150X_GPIO(4, 4),
2576 .dev = {
2577 .platform_data =
2578 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P8V],
2579 },
2580};
2581
2582static struct platform_device
2583mpq8064_device_ext_2p2_buck_vreg __devinitdata = {
2584 .name = GPIO_REGULATOR_DEV_NAME,
2585 .id = SX150X_GPIO(4, 14),
2586 .dev = {
2587 .platform_data =
2588 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_2P2V],
2589 },
2590};
2591
2592static struct platform_device
2593mpq8064_device_ext_5v_buck_vreg __devinitdata = {
2594 .name = GPIO_REGULATOR_DEV_NAME,
2595 .id = SX150X_GPIO(4, 3),
2596 .dev = {
2597 .platform_data =
2598 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_5V],
2599 },
2600};
2601
2602static struct platform_device
2603mpq8064_device_ext_3p3v_ldo_vreg __devinitdata = {
2604 .name = GPIO_REGULATOR_DEV_NAME,
2605 .id = SX150X_GPIO(4, 15),
2606 .dev = {
2607 .platform_data =
2608 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_3P3V],
2609 },
2610};
2611
Ravi Kumar V1c903012012-05-15 16:11:35 +05302612static struct platform_device rc_input_loopback_pdev = {
2613 .name = "rc-user-input",
2614 .id = -1,
2615};
2616
Ravi Kumar V040eeff2012-05-23 21:29:23 +05302617static int rf4ce_gpio_init(void)
2618{
Ravi Kumar V92b2b6c2012-08-14 17:18:11 +05302619 if (!machine_is_mpq8064_cdp() &&
2620 !machine_is_mpq8064_hrd() &&
2621 !machine_is_mpq8064_dtv())
Ravi Kumar V040eeff2012-05-23 21:29:23 +05302622 return -EINVAL;
2623
2624 /* CC2533 SRDY Input */
2625 if (!gpio_request(SX150X_GPIO(4, 6), "rf4ce_srdy")) {
2626 gpio_direction_input(SX150X_GPIO(4, 6));
2627 gpio_export(SX150X_GPIO(4, 6), true);
2628 }
2629
2630 /* CC2533 MRDY Output */
2631 if (!gpio_request(SX150X_GPIO(4, 5), "rf4ce_mrdy")) {
2632 gpio_direction_output(SX150X_GPIO(4, 5), 1);
2633 gpio_export(SX150X_GPIO(4, 5), true);
2634 }
2635
2636 /* CC2533 Reset Output */
2637 if (!gpio_request(SX150X_GPIO(4, 7), "rf4ce_reset")) {
2638 gpio_direction_output(SX150X_GPIO(4, 7), 0);
2639 gpio_export(SX150X_GPIO(4, 7), true);
2640 }
2641
2642 return 0;
2643}
2644late_initcall(rf4ce_gpio_init);
2645
Mayank Rana262e9032012-05-10 15:14:00 -07002646#ifdef CONFIG_SERIAL_MSM_HS
2647static int configure_uart_gpios(int on)
2648{
2649 int ret = 0, i;
2650 int uart_gpios[] = {14, 15, 16, 17};
2651
2652 for (i = 0; i < ARRAY_SIZE(uart_gpios); i++) {
2653 if (on) {
2654 ret = gpio_request(uart_gpios[i], NULL);
2655 if (ret) {
2656 pr_err("%s:unable to request uart gpio[%d]\n",
2657 __func__, uart_gpios[i]);
2658 break;
2659 }
2660 } else {
2661 gpio_free(uart_gpios[i]);
2662 }
2663 }
2664
2665 if (ret && on && i)
2666 for (; i >= 0; i--)
2667 gpio_free(uart_gpios[i]);
2668 return ret;
2669}
2670
2671static struct msm_serial_hs_platform_data mpq8064_gsbi6_uartdm_pdata = {
2672 .inject_rx_on_wakeup = 1,
2673 .rx_to_inject = 0xFD,
2674 .gpio_config = configure_uart_gpios,
2675};
2676#else
2677static struct msm_serial_hs_platform_data msm_uart_dm9_pdata;
2678#endif
2679
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002680static struct platform_device *mpq_devices[] __initdata = {
2681 &msm_device_sps_apq8064,
2682 &mpq8064_device_qup_i2c_gsbi5,
2683#ifdef CONFIG_MSM_ROTATOR
2684 &msm_rotator_device,
2685#endif
Ravi Kumar V05931a22012-04-04 17:09:37 +05302686 &gpio_ir_recv_pdev,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002687 &mpq8064_device_ext_1p2_buck_vreg,
2688 &mpq8064_device_ext_1p8_buck_vreg,
2689 &mpq8064_device_ext_2p2_buck_vreg,
2690 &mpq8064_device_ext_5v_buck_vreg,
2691 &mpq8064_device_ext_3p3v_ldo_vreg,
Terence Hampson2e1705f2012-04-11 19:55:29 -04002692#ifdef CONFIG_MSM_VCAP
2693 &msm8064_device_vcap,
2694#endif
Ravi Kumar V1c903012012-05-15 16:11:35 +05302695 &rc_input_loopback_pdev,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002696};
2697
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002698static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002699 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002700};
2701
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002702#define KS8851_IRQ_GPIO 43
2703
2704static struct spi_board_info spi_board_info[] __initdata = {
2705 {
2706 .modalias = "ks8851",
2707 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2708 .max_speed_hz = 19200000,
2709 .bus_num = 0,
2710 .chip_select = 2,
2711 .mode = SPI_MODE_0,
2712 },
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002713 {
2714 .modalias = "epm_adc",
2715 .max_speed_hz = 1100000,
2716 .bus_num = 0,
2717 .chip_select = 3,
2718 .mode = SPI_MODE_0,
2719 },
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002720};
2721
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002722static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002723 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08002724 .bus_num = 1,
2725 .slim_slave = &apq8064_slim_tabla,
2726 },
2727 {
2728 .bus_num = 1,
2729 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002730 },
2731 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002732};
2733
David Keitel3c40fc52012-02-09 17:53:52 -08002734static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi1_pdata = {
2735 .clk_freq = 100000,
2736 .src_clk_rate = 24000000,
2737};
2738
Jing Lin04601f92012-02-05 15:36:07 -08002739static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi3_pdata = {
Anirudh Ghayalc2163472012-04-10 14:58:14 +05302740 .clk_freq = 384000,
Jing Lin04601f92012-02-05 15:36:07 -08002741 .src_clk_rate = 24000000,
2742};
2743
Kenneth Heitke748593a2011-07-15 15:45:11 -06002744static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
2745 .clk_freq = 100000,
2746 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002747};
2748
Joel King8f839b92012-04-01 14:37:46 -07002749static struct msm_i2c_platform_data mpq8064_i2c_qup_gsbi5_pdata = {
2750 .clk_freq = 100000,
2751 .src_clk_rate = 24000000,
2752};
2753
David Keitel3c40fc52012-02-09 17:53:52 -08002754#define GSBI_DUAL_MODE_CODE 0x60
2755#define MSM_GSBI1_PHYS 0x12440000
Kenneth Heitke748593a2011-07-15 15:45:11 -06002756static void __init apq8064_i2c_init(void)
2757{
David Keitel3c40fc52012-02-09 17:53:52 -08002758 void __iomem *gsbi_mem;
2759
2760 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2761 &apq8064_i2c_qup_gsbi1_pdata;
2762 gsbi_mem = ioremap_nocache(MSM_GSBI1_PHYS, 4);
2763 writel_relaxed(GSBI_DUAL_MODE_CODE, gsbi_mem);
2764 /* Ensure protocol code is written before proceeding */
2765 wmb();
2766 iounmap(gsbi_mem);
2767 apq8064_i2c_qup_gsbi1_pdata.use_gsbi_shared_mode = 1;
Jing Lin04601f92012-02-05 15:36:07 -08002768 apq8064_device_qup_i2c_gsbi3.dev.platform_data =
2769 &apq8064_i2c_qup_gsbi3_pdata;
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002770 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2771 &apq8064_i2c_qup_gsbi1_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002772 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
2773 &apq8064_i2c_qup_gsbi4_pdata;
Joel King8f839b92012-04-01 14:37:46 -07002774 mpq8064_device_qup_i2c_gsbi5.dev.platform_data =
2775 &mpq8064_i2c_qup_gsbi5_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002776}
2777
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002778#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002779static int ethernet_init(void)
2780{
2781 int ret;
2782 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
2783 if (ret) {
2784 pr_err("ks8851 gpio_request failed: %d\n", ret);
2785 goto fail;
2786 }
2787
2788 return 0;
2789fail:
2790 return ret;
2791}
2792#else
2793static int ethernet_init(void)
2794{
2795 return 0;
2796}
2797#endif
2798
David Collinsd49a1c52012-08-22 13:18:06 -07002799#define GPIO_KEY_HOME PM8921_GPIO_PM_TO_SYS(27)
2800#define GPIO_KEY_VOLUME_UP PM8921_GPIO_PM_TO_SYS(35)
2801#define GPIO_KEY_VOLUME_DOWN_PM8921 PM8921_GPIO_PM_TO_SYS(38)
2802#define GPIO_KEY_VOLUME_DOWN_PM8917 PM8921_GPIO_PM_TO_SYS(30)
2803#define GPIO_KEY_CAM_FOCUS PM8921_GPIO_PM_TO_SYS(3)
2804#define GPIO_KEY_CAM_SNAP PM8921_GPIO_PM_TO_SYS(4)
2805#define GPIO_KEY_ROTATION_PM8921 PM8921_GPIO_PM_TO_SYS(42)
2806#define GPIO_KEY_ROTATION_PM8917 PM8921_GPIO_PM_TO_SYS(8)
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302807
David Collinsd49a1c52012-08-22 13:18:06 -07002808static struct gpio_keys_button cdp_keys_pm8921[] = {
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302809 {
2810 .code = KEY_HOME,
2811 .gpio = GPIO_KEY_HOME,
2812 .desc = "home_key",
2813 .active_low = 1,
2814 .type = EV_KEY,
2815 .wakeup = 1,
2816 .debounce_interval = 15,
2817 },
2818 {
2819 .code = KEY_VOLUMEUP,
2820 .gpio = GPIO_KEY_VOLUME_UP,
2821 .desc = "volume_up_key",
2822 .active_low = 1,
2823 .type = EV_KEY,
2824 .wakeup = 1,
2825 .debounce_interval = 15,
2826 },
2827 {
2828 .code = KEY_VOLUMEDOWN,
David Collinsd49a1c52012-08-22 13:18:06 -07002829 .gpio = GPIO_KEY_VOLUME_DOWN_PM8921,
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302830 .desc = "volume_down_key",
2831 .active_low = 1,
2832 .type = EV_KEY,
2833 .wakeup = 1,
2834 .debounce_interval = 15,
2835 },
2836 {
2837 .code = SW_ROTATE_LOCK,
David Collinsd49a1c52012-08-22 13:18:06 -07002838 .gpio = GPIO_KEY_ROTATION_PM8921,
2839 .desc = "rotate_key",
2840 .active_low = 1,
2841 .type = EV_SW,
2842 .debounce_interval = 15,
2843 },
2844};
2845
2846static struct gpio_keys_button cdp_keys_pm8917[] = {
2847 {
2848 .code = KEY_HOME,
2849 .gpio = GPIO_KEY_HOME,
2850 .desc = "home_key",
2851 .active_low = 1,
2852 .type = EV_KEY,
2853 .wakeup = 1,
2854 .debounce_interval = 15,
2855 },
2856 {
2857 .code = KEY_VOLUMEUP,
2858 .gpio = GPIO_KEY_VOLUME_UP,
2859 .desc = "volume_up_key",
2860 .active_low = 1,
2861 .type = EV_KEY,
2862 .wakeup = 1,
2863 .debounce_interval = 15,
2864 },
2865 {
2866 .code = KEY_VOLUMEDOWN,
2867 .gpio = GPIO_KEY_VOLUME_DOWN_PM8917,
2868 .desc = "volume_down_key",
2869 .active_low = 1,
2870 .type = EV_KEY,
2871 .wakeup = 1,
2872 .debounce_interval = 15,
2873 },
2874 {
2875 .code = SW_ROTATE_LOCK,
2876 .gpio = GPIO_KEY_ROTATION_PM8917,
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302877 .desc = "rotate_key",
2878 .active_low = 1,
2879 .type = EV_SW,
2880 .debounce_interval = 15,
2881 },
2882};
2883
2884static struct gpio_keys_platform_data cdp_keys_data = {
David Collinsd49a1c52012-08-22 13:18:06 -07002885 .buttons = cdp_keys_pm8921,
2886 .nbuttons = ARRAY_SIZE(cdp_keys_pm8921),
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302887};
2888
2889static struct platform_device cdp_kp_pdev = {
2890 .name = "gpio-keys",
2891 .id = -1,
2892 .dev = {
2893 .platform_data = &cdp_keys_data,
2894 },
2895};
2896
2897static struct gpio_keys_button mtp_keys[] = {
2898 {
2899 .code = KEY_CAMERA_FOCUS,
2900 .gpio = GPIO_KEY_CAM_FOCUS,
2901 .desc = "cam_focus_key",
2902 .active_low = 1,
2903 .type = EV_KEY,
2904 .wakeup = 1,
2905 .debounce_interval = 15,
2906 },
2907 {
2908 .code = KEY_VOLUMEUP,
2909 .gpio = GPIO_KEY_VOLUME_UP,
2910 .desc = "volume_up_key",
2911 .active_low = 1,
2912 .type = EV_KEY,
2913 .wakeup = 1,
2914 .debounce_interval = 15,
2915 },
2916 {
2917 .code = KEY_VOLUMEDOWN,
David Collinsd49a1c52012-08-22 13:18:06 -07002918 .gpio = GPIO_KEY_VOLUME_DOWN_PM8921,
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302919 .desc = "volume_down_key",
2920 .active_low = 1,
2921 .type = EV_KEY,
2922 .wakeup = 1,
2923 .debounce_interval = 15,
2924 },
2925 {
2926 .code = KEY_CAMERA_SNAPSHOT,
2927 .gpio = GPIO_KEY_CAM_SNAP,
2928 .desc = "cam_snap_key",
2929 .active_low = 1,
2930 .type = EV_KEY,
2931 .debounce_interval = 15,
2932 },
2933};
2934
2935static struct gpio_keys_platform_data mtp_keys_data = {
2936 .buttons = mtp_keys,
2937 .nbuttons = ARRAY_SIZE(mtp_keys),
2938};
2939
2940static struct platform_device mtp_kp_pdev = {
2941 .name = "gpio-keys",
2942 .id = -1,
2943 .dev = {
2944 .platform_data = &mtp_keys_data,
2945 },
2946};
2947
Mohan Pallakab8aa8282012-10-04 14:26:21 +05302948#define MPQ_HRD_HOME_GPIO SX150X_EXP2_GPIO_BASE
2949#define MPQ_HRD_VOL_UP_GPIO (SX150X_EXP2_GPIO_BASE + 1)
2950#define MPQ_HRD_VOL_DOWN_GPIO (SX150X_EXP2_GPIO_BASE + 2)
2951#define MPQ_HRD_RIGHT_GPIO (SX150X_EXP2_GPIO_BASE + 3)
2952#define MPQ_HRD_LEFT_GPIO (SX150X_EXP2_GPIO_BASE + 4)
2953#define MPQ_HRD_ENTER_GPIO (SX150X_EXP2_GPIO_BASE + 5)
2954
2955static struct gpio_keys_button mpq_hrd_keys[] = {
2956 {
2957 .code = KEY_HOME,
2958 .gpio = MPQ_HRD_HOME_GPIO,
2959 .desc = "home_key",
2960 .active_low = 1,
2961 .type = EV_KEY,
2962 .wakeup = 1,
2963 .debounce_interval = 15,
2964 },
2965 {
2966 .code = KEY_VOLUMEUP,
2967 .gpio = MPQ_HRD_VOL_UP_GPIO,
2968 .desc = "volume_up_key",
2969 .active_low = 1,
2970 .type = EV_KEY,
2971 .wakeup = 1,
2972 .debounce_interval = 15,
2973 },
2974 {
2975 .code = KEY_VOLUMEDOWN,
2976 .gpio = MPQ_HRD_VOL_DOWN_GPIO,
2977 .desc = "volume_down_key",
2978 .active_low = 1,
2979 .type = EV_KEY,
2980 .wakeup = 1,
2981 .debounce_interval = 15,
2982 },
2983 {
2984 .code = KEY_RIGHT,
2985 .gpio = MPQ_HRD_RIGHT_GPIO,
2986 .desc = "right_key",
2987 .active_low = 1,
2988 .type = EV_KEY,
2989 .wakeup = 1,
2990 .debounce_interval = 15,
2991 },
2992 {
2993 .code = KEY_LEFT,
2994 .gpio = MPQ_HRD_LEFT_GPIO,
2995 .desc = "left_key",
2996 .active_low = 1,
2997 .type = EV_KEY,
2998 .wakeup = 1,
2999 .debounce_interval = 15,
3000 },
3001 {
3002 .code = KEY_ENTER,
3003 .gpio = MPQ_HRD_ENTER_GPIO,
3004 .desc = "enter_key",
3005 .active_low = 1,
3006 .type = EV_KEY,
3007 .wakeup = 1,
3008 .debounce_interval = 15,
3009 },
3010};
3011
3012static struct gpio_keys_platform_data mpq_hrd_keys_pdata = {
3013 .buttons = mpq_hrd_keys,
3014 .nbuttons = ARRAY_SIZE(mpq_hrd_keys),
3015};
3016
3017static struct platform_device mpq_hrd_keys_pdev = {
3018 .name = "gpio-keys",
3019 .id = -1,
3020 .dev = {
3021 .platform_data = &mpq_hrd_keys_pdata,
3022 },
3023};
3024
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05303025static struct gpio_keys_button mpq_keys[] = {
3026 {
3027 .code = KEY_VOLUMEDOWN,
David Collinsd49a1c52012-08-22 13:18:06 -07003028 .gpio = GPIO_KEY_VOLUME_DOWN_PM8921,
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05303029 .desc = "volume_down_key",
3030 .active_low = 1,
3031 .type = EV_KEY,
3032 .wakeup = 1,
3033 .debounce_interval = 15,
3034 },
3035 {
3036 .code = KEY_VOLUMEUP,
3037 .gpio = GPIO_KEY_VOLUME_UP,
3038 .desc = "volume_up_key",
3039 .active_low = 1,
3040 .type = EV_KEY,
3041 .wakeup = 1,
3042 .debounce_interval = 15,
3043 },
3044};
3045
3046static struct gpio_keys_platform_data mpq_keys_data = {
3047 .buttons = mpq_keys,
3048 .nbuttons = ARRAY_SIZE(mpq_keys),
3049};
3050
3051static struct platform_device mpq_gpio_keys_pdev = {
3052 .name = "gpio-keys",
3053 .id = -1,
3054 .dev = {
3055 .platform_data = &mpq_keys_data,
3056 },
3057};
3058
3059#define MPQ_KP_ROW_BASE SX150X_EXP2_GPIO_BASE
3060#define MPQ_KP_COL_BASE (SX150X_EXP2_GPIO_BASE + 4)
3061
3062static unsigned int mpq_row_gpios[] = {MPQ_KP_ROW_BASE, MPQ_KP_ROW_BASE + 1,
3063 MPQ_KP_ROW_BASE + 2, MPQ_KP_ROW_BASE + 3};
3064static unsigned int mpq_col_gpios[] = {MPQ_KP_COL_BASE, MPQ_KP_COL_BASE + 1,
3065 MPQ_KP_COL_BASE + 2};
3066
3067static const unsigned int mpq_keymap[] = {
3068 KEY(0, 0, KEY_UP),
3069 KEY(0, 1, KEY_ENTER),
3070 KEY(0, 2, KEY_3),
3071
3072 KEY(1, 0, KEY_DOWN),
3073 KEY(1, 1, KEY_EXIT),
3074 KEY(1, 2, KEY_4),
3075
3076 KEY(2, 0, KEY_LEFT),
3077 KEY(2, 1, KEY_1),
3078 KEY(2, 2, KEY_5),
3079
3080 KEY(3, 0, KEY_RIGHT),
3081 KEY(3, 1, KEY_2),
3082 KEY(3, 2, KEY_6),
3083};
3084
3085static struct matrix_keymap_data mpq_keymap_data = {
3086 .keymap_size = ARRAY_SIZE(mpq_keymap),
3087 .keymap = mpq_keymap,
3088};
3089
3090static struct matrix_keypad_platform_data mpq_keypad_data = {
3091 .keymap_data = &mpq_keymap_data,
3092 .row_gpios = mpq_row_gpios,
3093 .col_gpios = mpq_col_gpios,
3094 .num_row_gpios = ARRAY_SIZE(mpq_row_gpios),
3095 .num_col_gpios = ARRAY_SIZE(mpq_col_gpios),
3096 .col_scan_delay_us = 32000,
3097 .debounce_ms = 20,
3098 .wakeup = 1,
3099 .active_low = 1,
3100 .no_autorepeat = 1,
3101};
3102
3103static struct platform_device mpq_keypad_device = {
3104 .name = "matrix-keypad",
3105 .id = -1,
3106 .dev = {
3107 .platform_data = &mpq_keypad_data,
3108 },
3109};
3110
Jin Hongd3024e62012-02-09 16:13:32 -08003111/* Sensors DSPS platform data */
3112#define DSPS_PIL_GENERIC_NAME "dsps"
3113static void __init apq8064_init_dsps(void)
3114{
3115 struct msm_dsps_platform_data *pdata =
3116 msm_dsps_device_8064.dev.platform_data;
3117 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
3118 pdata->gpios = NULL;
3119 pdata->gpios_num = 0;
3120
3121 platform_device_register(&msm_dsps_device_8064);
3122}
Mohan Pallaka474b94b2012-01-25 12:59:58 +05303123
Jing Lin417fa452012-02-05 14:31:06 -08003124#define I2C_SURF 1
3125#define I2C_FFA (1 << 1)
3126#define I2C_RUMI (1 << 2)
3127#define I2C_SIM (1 << 3)
3128#define I2C_LIQUID (1 << 4)
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003129#define I2C_MPQ_CDP BIT(5)
3130#define I2C_MPQ_HRD BIT(6)
3131#define I2C_MPQ_DTV BIT(7)
Jing Lin417fa452012-02-05 14:31:06 -08003132
3133struct i2c_registry {
3134 u8 machs;
3135 int bus;
3136 struct i2c_board_info *info;
3137 int len;
3138};
3139
3140static struct i2c_registry apq8064_i2c_devices[] __initdata = {
Jing Lin21ed4de2012-02-05 15:53:28 -08003141 {
David Keitel2f613d92012-02-15 11:29:16 -08003142 I2C_LIQUID,
3143 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
3144 smb349_charger_i2c_info,
3145 ARRAY_SIZE(smb349_charger_i2c_info)
3146 },
3147 {
Jing Lin21ed4de2012-02-05 15:53:28 -08003148 I2C_SURF | I2C_LIQUID,
3149 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
3150 mxt_device_info,
3151 ARRAY_SIZE(mxt_device_info),
3152 },
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08003153 {
3154 I2C_FFA,
3155 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
3156 cyttsp_info,
3157 ARRAY_SIZE(cyttsp_info),
3158 },
Amy Maloche70090f992012-02-16 16:35:26 -08003159 {
3160 I2C_FFA | I2C_LIQUID,
3161 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
3162 isa1200_board_info,
3163 ARRAY_SIZE(isa1200_board_info),
3164 },
Santosh Mardieff9a742012-04-09 23:23:39 +05303165 {
3166 I2C_MPQ_CDP,
3167 APQ_8064_GSBI5_QUP_I2C_BUS_ID,
3168 cs8427_device_info,
3169 ARRAY_SIZE(cs8427_device_info),
3170 },
Abhishek Kharbanda72dc72e2012-06-07 13:41:37 -07003171 {
3172 I2C_SURF | I2C_FFA | I2C_LIQUID,
3173 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
3174 sii_device_info,
3175 ARRAY_SIZE(sii_device_info),
3176 }
Jing Lin417fa452012-02-05 14:31:06 -08003177};
3178
Kuirong Wangf8c5e142012-06-21 16:17:32 -07003179static struct i2c_registry apq8064_tabla_i2c_devices[] __initdata = {
3180 {
3181 .bus = APQ_8064_GSBI1_QUP_I2C_BUS_ID,
3182 .info = apq8064_tabla_i2c_device_info,
3183 .len = ARRAY_SIZE(apq8064_tabla_i2c_device_info),
3184 },
3185};
3186
Jay Chokshi607f61b2012-04-25 18:21:21 -07003187#define SX150X_EXP1_INT_N PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9)
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05303188#define SX150X_EXP2_INT_N MSM_GPIO_TO_INT(81)
Jay Chokshi607f61b2012-04-25 18:21:21 -07003189
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003190struct sx150x_platform_data mpq8064_sx150x_pdata[] = {
3191 [SX150X_EXP1] = {
3192 .gpio_base = SX150X_EXP1_GPIO_BASE,
3193 .oscio_is_gpo = false,
3194 .io_pullup_ena = 0x0,
3195 .io_pulldn_ena = 0x0,
3196 .io_open_drain_ena = 0x0,
3197 .io_polarity = 0,
Jay Chokshi607f61b2012-04-25 18:21:21 -07003198 .irq_summary = SX150X_EXP1_INT_N,
3199 .irq_base = SX150X_EXP1_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003200 },
3201 [SX150X_EXP2] = {
3202 .gpio_base = SX150X_EXP2_GPIO_BASE,
3203 .oscio_is_gpo = false,
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05303204 .io_pullup_ena = 0x0f,
3205 .io_pulldn_ena = 0x70,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003206 .io_open_drain_ena = 0x0,
3207 .io_polarity = 0,
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05303208 .irq_summary = SX150X_EXP2_INT_N,
3209 .irq_base = SX150X_EXP2_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003210 },
3211 [SX150X_EXP3] = {
3212 .gpio_base = SX150X_EXP3_GPIO_BASE,
3213 .oscio_is_gpo = false,
3214 .io_pullup_ena = 0x0,
3215 .io_pulldn_ena = 0x0,
3216 .io_open_drain_ena = 0x0,
3217 .io_polarity = 0,
3218 .irq_summary = -1,
3219 },
3220 [SX150X_EXP4] = {
3221 .gpio_base = SX150X_EXP4_GPIO_BASE,
3222 .oscio_is_gpo = false,
3223 .io_pullup_ena = 0x0,
3224 .io_pulldn_ena = 0x0,
3225 .io_open_drain_ena = 0x0,
3226 .io_polarity = 0,
3227 .irq_summary = -1,
3228 },
3229};
3230
3231static struct i2c_board_info sx150x_gpio_exp_info[] = {
3232 {
3233 I2C_BOARD_INFO("sx1509q", 0x70),
3234 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP1],
3235 },
3236 {
3237 I2C_BOARD_INFO("sx1508q", 0x23),
3238 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP2],
3239 },
3240 {
3241 I2C_BOARD_INFO("sx1508q", 0x22),
3242 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP3],
3243 },
3244 {
3245 I2C_BOARD_INFO("sx1509q", 0x3E),
3246 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP4],
3247 },
3248};
3249
3250#define MPQ8064_I2C_GSBI5_BUS_ID 5
3251
3252static struct i2c_registry mpq8064_i2c_devices[] __initdata = {
3253 {
3254 I2C_MPQ_CDP,
3255 MPQ8064_I2C_GSBI5_BUS_ID,
3256 sx150x_gpio_exp_info,
3257 ARRAY_SIZE(sx150x_gpio_exp_info),
3258 },
3259};
3260
Jing Lin417fa452012-02-05 14:31:06 -08003261static void __init register_i2c_devices(void)
3262{
3263 u8 mach_mask = 0;
3264 int i;
Kuirong Wangf8c5e142012-06-21 16:17:32 -07003265 u32 version;
Jing Lin417fa452012-02-05 14:31:06 -08003266
Kevin Chand07220e2012-02-13 15:52:22 -08003267#ifdef CONFIG_MSM_CAMERA
3268 struct i2c_registry apq8064_camera_i2c_devices = {
3269 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_RUMI,
3270 APQ_8064_GSBI4_QUP_I2C_BUS_ID,
3271 apq8064_camera_board_info.board_info,
3272 apq8064_camera_board_info.num_i2c_board_info,
3273 };
3274#endif
Jing Lin417fa452012-02-05 14:31:06 -08003275 /* Build the matching 'supported_machs' bitmask */
3276 if (machine_is_apq8064_cdp())
3277 mach_mask = I2C_SURF;
3278 else if (machine_is_apq8064_mtp())
3279 mach_mask = I2C_FFA;
3280 else if (machine_is_apq8064_liquid())
3281 mach_mask = I2C_LIQUID;
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003282 else if (PLATFORM_IS_MPQ8064())
3283 mach_mask = I2C_MPQ_CDP;
Jing Lin417fa452012-02-05 14:31:06 -08003284 else
3285 pr_err("unmatched machine ID in register_i2c_devices\n");
3286
3287 /* Run the array and install devices as appropriate */
3288 for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) {
3289 if (apq8064_i2c_devices[i].machs & mach_mask)
3290 i2c_register_board_info(apq8064_i2c_devices[i].bus,
3291 apq8064_i2c_devices[i].info,
3292 apq8064_i2c_devices[i].len);
3293 }
Kevin Chand07220e2012-02-13 15:52:22 -08003294#ifdef CONFIG_MSM_CAMERA
3295 if (apq8064_camera_i2c_devices.machs & mach_mask)
3296 i2c_register_board_info(apq8064_camera_i2c_devices.bus,
3297 apq8064_camera_i2c_devices.info,
3298 apq8064_camera_i2c_devices.len);
3299#endif
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003300
3301 for (i = 0; i < ARRAY_SIZE(mpq8064_i2c_devices); ++i) {
3302 if (mpq8064_i2c_devices[i].machs & mach_mask)
3303 i2c_register_board_info(
3304 mpq8064_i2c_devices[i].bus,
3305 mpq8064_i2c_devices[i].info,
3306 mpq8064_i2c_devices[i].len);
3307 }
Kuirong Wangf8c5e142012-06-21 16:17:32 -07003308
3309 if (machine_is_apq8064_mtp()) {
3310 version = socinfo_get_platform_version();
3311 if (SOCINFO_VERSION_MINOR(version) == 1)
3312 for (i = 0; i < ARRAY_SIZE(apq8064_tabla_i2c_devices);
3313 ++i)
3314 i2c_register_board_info(
3315 apq8064_tabla_i2c_devices[i].bus,
3316 apq8064_tabla_i2c_devices[i].info,
3317 apq8064_tabla_i2c_devices[i].len);
3318 }
3319
Jing Lin417fa452012-02-05 14:31:06 -08003320}
3321
Jay Chokshi994ff122012-03-27 15:43:48 -07003322static void enable_ddr3_regulator(void)
3323{
3324 static struct regulator *ext_ddr3;
3325
3326 /* Use MPP7 output state as a flag for PCDDR3 presence. */
3327 if (gpio_get_value_cansleep(PM8921_MPP_PM_TO_SYS(7)) > 0) {
3328 ext_ddr3 = regulator_get(NULL, "ext_ddr3");
3329 if (IS_ERR(ext_ddr3) || ext_ddr3 == NULL)
3330 pr_err("Could not get MPP7 regulator\n");
3331 else
3332 regulator_enable(ext_ddr3);
3333 }
3334}
3335
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003336static void enable_avc_i2c_bus(void)
3337{
3338 int avc_i2c_en_mpp = PM8921_MPP_PM_TO_SYS(8);
3339 int rc;
3340
3341 rc = gpio_request(avc_i2c_en_mpp, "avc_i2c_en");
3342 if (rc)
3343 pr_err("request for avc_i2c_en mpp failed,"
3344 "rc=%d\n", rc);
3345 else
3346 gpio_set_value_cansleep(avc_i2c_en_mpp, 1);
3347}
3348
David Collinsd49a1c52012-08-22 13:18:06 -07003349/* Modify platform data values to match requirements for PM8917. */
3350static void __init apq8064_pm8917_pdata_fixup(void)
3351{
3352 cdp_keys_data.buttons = cdp_keys_pm8917;
3353 cdp_keys_data.nbuttons = ARRAY_SIZE(cdp_keys_pm8917);
3354}
3355
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003356static void __init apq8064_common_init(void)
3357{
Kuirong Wangf8c5e142012-06-21 16:17:32 -07003358 u32 platform_version = socinfo_get_platform_version();
David Collinsd49a1c52012-08-22 13:18:06 -07003359
3360 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
3361 apq8064_pm8917_pdata_fixup();
Rohit Vaswanib1cc4932012-07-23 21:30:11 -07003362 platform_device_register(&msm_gpio_device);
Joel King8f839b92012-04-01 14:37:46 -07003363 msm_tsens_early_init(&apq_tsens_pdata);
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06003364 msm_thermal_init(&msm_thermal_pdata);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003365 if (socinfo_init() < 0)
3366 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06003367 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
3368 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
David Collins2782b5c2012-02-06 10:02:42 -08003369 regulator_suppress_info_printing();
David Collins793793b2012-08-21 15:43:02 -07003370 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
3371 configure_apq8064_pm8917_power_grid();
David Collins2782b5c2012-02-06 10:02:42 -08003372 platform_device_register(&apq8064_device_rpm_regulator);
David Collins793793b2012-08-21 15:43:02 -07003373 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917)
3374 platform_device_register(&apq8064_pm8921_device_rpm_regulator);
Stephen Boyd4d0d2582012-02-10 14:49:40 -08003375 if (msm_xo_init())
3376 pr_err("Failed to initialize XO votes\n");
Matt Wagantallc51e5602012-02-27 17:25:25 -08003377 msm_clock_init(&apq8064_clock_init_data);
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08003378 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06003379 apq8064_i2c_init();
Mohan Pallakab8aa8282012-10-04 14:26:21 +05303380
3381 /* configure sx150x parameters for HRD */
3382 if (machine_is_mpq8064_hrd()) {
3383 mpq8064_sx150x_pdata[SX150X_EXP2].irq_summary =
3384 PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 40);
3385 mpq8064_sx150x_pdata[SX150X_EXP2].io_pullup_ena = 0xff;
3386 mpq8064_sx150x_pdata[SX150X_EXP2].io_pulldn_ena = 0x00;
3387 }
3388
Jing Lin417fa452012-02-05 14:31:06 -08003389 register_i2c_devices();
Kenneth Heitke36920d32011-07-20 16:44:30 -06003390
Harini Jayaramanc4c58692011-07-19 14:50:10 -06003391 apq8064_device_qup_spi_gsbi5.dev.platform_data =
3392 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08003393 apq8064_init_pmic();
Hemant Kumar94e7da22012-02-03 16:52:29 -08003394 if (machine_is_apq8064_liquid())
3395 msm_otg_pdata.mhl_enable = true;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07003396
Abhishek Kharbanda72dc72e2012-06-07 13:41:37 -07003397 if (apq8064_mhl_display_enabled())
3398 mhl_platform_data.mhl_enabled = true;
3399
Ofir Cohen94213a72012-05-03 14:26:32 +03003400 android_usb_pdata.swfi_latency =
3401 msm_rpmrs_levels[0].latency_us;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07003402
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003403 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Manu Gautam91223e02011-11-08 15:27:22 +05303404 apq8064_ehci_host_init();
Gagan Mac8a7a5d32011-11-11 16:43:06 -07003405 apq8064_init_buses();
David Collins793793b2012-08-21 15:43:02 -07003406
3407 platform_add_devices(early_common_devices,
3408 ARRAY_SIZE(early_common_devices));
3409 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917)
3410 platform_add_devices(pm8921_common_devices,
3411 ARRAY_SIZE(pm8921_common_devices));
3412 else
3413 platform_add_devices(pm8917_common_devices,
3414 ARRAY_SIZE(pm8917_common_devices));
David Collins03c16372012-10-04 15:57:28 -07003415 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
3416 platform_device_register(&apq8064_device_ext_ts_sw_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003417 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Terence Hampson36b70722012-05-10 13:18:16 -04003418 if (!(machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
3419 machine_is_mpq8064_dtv()))
3420 platform_add_devices(common_not_mpq_devices,
3421 ARRAY_SIZE(common_not_mpq_devices));
Kuirong Wangf8c5e142012-06-21 16:17:32 -07003422
3423 if ((machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
3424 machine_is_mpq8064_dtv()))
3425 platform_add_devices(common_mpq_devices,
3426 ARRAY_SIZE(common_mpq_devices));
3427
3428 if (machine_is_apq8064_mtp()) {
3429 if (SOCINFO_VERSION_MINOR(platform_version) == 1)
3430 platform_add_devices(common_i2s_devices,
3431 ARRAY_SIZE(common_i2s_devices));
3432 }
3433
Jay Chokshi994ff122012-03-27 15:43:48 -07003434 enable_ddr3_regulator();
Pavankumar Kondeti4f5dc3b2012-09-07 15:33:09 +05303435 msm_hsic_pdata.swfi_latency =
3436 msm_rpmrs_levels[0].latency_us;
Hemant Kumarf1ca9192012-02-07 18:59:33 -08003437 if (machine_is_apq8064_mtp()) {
Hemant Kumar30d361c2012-08-20 14:44:40 -07003438 msm_hsic_pdata.log2_irq_thresh = 5,
Hemant Kumarf1ca9192012-02-07 18:59:33 -08003439 apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
3440 device_initialize(&apq8064_device_hsic_host.dev);
3441 }
Jay Chokshie8741282012-01-25 15:22:55 -08003442 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05303443 apq8064_init_mmc();
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08003444
3445 if (machine_is_apq8064_mtp()) {
3446 mdm_8064_device.dev.platform_data = &mdm_platform_data;
Ameya Thakure155ece2012-07-09 12:08:37 -07003447 if (SOCINFO_VERSION_MINOR(platform_version) == 1) {
3448 i2s_mdm_8064_device.dev.platform_data =
3449 &mdm_platform_data;
3450 platform_device_register(&i2s_mdm_8064_device);
3451 } else {
3452 mdm_8064_device.dev.platform_data = &mdm_platform_data;
3453 platform_device_register(&mdm_8064_device);
3454 }
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08003455 }
3456 platform_device_register(&apq8064_slim_ctrl);
Santosh Mardi344455a2012-09-07 13:22:16 +05303457 if (machine_is_mpq8064_hrd() || machine_is_mpq8064_dtv()) {
3458 apq8064_slim_devices[ARRAY_SIZE(apq8064_slim_devices) - 1].\
3459 slim_slave = &mpq8064_slim_ashiko20;
3460 }
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06003461 slim_register_board_info(apq8064_slim_devices,
3462 ARRAY_SIZE(apq8064_slim_devices));
Taniya Dasbbf633d2012-07-31 16:07:47 +05303463 if (!PLATFORM_IS_MPQ8064()) {
Taniya Das30cae292012-07-31 15:56:12 +05303464 apq8064_init_dsps();
Taniya Dasbbf633d2012-07-31 16:07:47 +05303465 platform_device_register(&msm_8960_riva);
3466 }
Praveen Chidambaram78499012011-11-01 17:15:17 -06003467 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3468 msm_spm_l2_init(msm_spm_l2_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06003469 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08003470 apq8064_epm_adc_init();
Girish Mahadevan3bc98772012-08-15 10:01:27 -06003471 msm_pm_set_tz_retention_flag(1);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003472}
3473
Huaibin Yang4a084e32011-12-15 15:25:52 -08003474static void __init apq8064_allocate_memory_regions(void)
3475{
3476 apq8064_allocate_fb_region();
3477}
3478
Joel King82b7e3f2012-01-05 10:03:27 -08003479static void __init apq8064_cdp_init(void)
3480{
Hanumant Singh50440d42012-04-23 19:27:16 -07003481 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
3482 pr_err("meminfo_init() failed!\n");
Amy Maloche609bb5e2012-08-03 09:41:42 -07003483 if (machine_is_apq8064_mtp() &&
3484 SOCINFO_VERSION_MINOR(socinfo_get_platform_version()) == 1)
3485 cyttsp_pdata.sleep_gpio = CYTTSP_TS_GPIO_SLEEP_ALT;
Joel King82b7e3f2012-01-05 10:03:27 -08003486 apq8064_common_init();
Joel King8f839b92012-04-01 14:37:46 -07003487 if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
3488 machine_is_mpq8064_dtv()) {
Ravi Kumar V16a614c2012-10-12 20:59:56 +05303489 gpio_ir_recv_pdata.swfi_latency =
3490 msm_rpmrs_levels[0].latency_us;
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003491 enable_avc_i2c_bus();
Olav Hauganef95ae32012-05-15 09:50:30 -07003492 msm_rotator_set_split_iommu_domain();
Joel King8f839b92012-04-01 14:37:46 -07003493 platform_add_devices(mpq_devices, ARRAY_SIZE(mpq_devices));
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06003494 mpq8064_pcie_init();
Joel King8f839b92012-04-01 14:37:46 -07003495 } else {
3496 ethernet_init();
Olav Hauganef95ae32012-05-15 09:50:30 -07003497 msm_rotator_set_split_iommu_domain();
Joel King8f839b92012-04-01 14:37:46 -07003498 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
3499 spi_register_board_info(spi_board_info,
3500 ARRAY_SIZE(spi_board_info));
3501 }
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003502 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07003503 apq8064_init_gpu();
Matt Wagantall1f65d9d2012-04-25 14:24:20 -07003504 platform_add_devices(apq8064_footswitch, apq8064_num_footswitch);
Steve Mucklef132c6c2012-06-06 18:30:57 -07003505#ifdef CONFIG_MSM_CAMERA
Kevin Chand07220e2012-02-13 15:52:22 -08003506 apq8064_init_cam();
Steve Mucklef132c6c2012-06-06 18:30:57 -07003507#endif
Mohan Pallaka474b94b2012-01-25 12:59:58 +05303508
Mayank Rana262e9032012-05-10 15:14:00 -07003509 if (machine_is_mpq8064_hrd() || machine_is_mpq8064_dtv()) {
3510 platform_device_register(&mpq8064_device_uartdm_gsbi6);
3511#ifdef CONFIG_SERIAL_MSM_HS
3512 /* GSBI6(2) - UARTDM_RX */
3513 mpq8064_gsbi6_uartdm_pdata.wakeup_irq = gpio_to_irq(15);
3514 mpq8064_device_uartdm_gsbi6.dev.platform_data =
3515 &mpq8064_gsbi6_uartdm_pdata;
3516#endif
3517 }
3518
Ankit Verma6fe41b02012-09-13 16:12:11 +05303519#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
3520 if (machine_is_mpq8064_hrd())
3521 apq8064_bt_power_init();
3522#endif
3523
Mohan Pallaka474b94b2012-01-25 12:59:58 +05303524 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
3525 platform_device_register(&cdp_kp_pdev);
3526
3527 if (machine_is_apq8064_mtp())
3528 platform_device_register(&mtp_kp_pdev);
Hanumant Singh50440d42012-04-23 19:27:16 -07003529
3530 change_memory_power = &apq8064_change_memory_power;
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05303531
3532 if (machine_is_mpq8064_cdp()) {
3533 platform_device_register(&mpq_gpio_keys_pdev);
3534 platform_device_register(&mpq_keypad_device);
Mohan Pallakab8aa8282012-10-04 14:26:21 +05303535 } else if (machine_is_mpq8064_hrd())
3536 platform_device_register(&mpq_hrd_keys_pdev);
Joel King82b7e3f2012-01-05 10:03:27 -08003537}
3538
Joel King82b7e3f2012-01-05 10:03:27 -08003539MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
3540 .map_io = apq8064_map_io,
3541 .reserve = apq8064_reserve,
3542 .init_irq = apq8064_init_irq,
3543 .handle_irq = gic_handle_irq,
3544 .timer = &msm_timer,
3545 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003546 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003547 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003548 .restart = msm_restart,
Joel King82b7e3f2012-01-05 10:03:27 -08003549MACHINE_END
3550
3551MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
3552 .map_io = apq8064_map_io,
3553 .reserve = apq8064_reserve,
3554 .init_irq = apq8064_init_irq,
3555 .handle_irq = gic_handle_irq,
3556 .timer = &msm_timer,
3557 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003558 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003559 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003560 .restart = msm_restart,
Joel King82b7e3f2012-01-05 10:03:27 -08003561MACHINE_END
3562
3563MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
3564 .map_io = apq8064_map_io,
3565 .reserve = apq8064_reserve,
3566 .init_irq = apq8064_init_irq,
3567 .handle_irq = gic_handle_irq,
3568 .timer = &msm_timer,
3569 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003570 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003571 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003572 .restart = msm_restart,
Joel King82b7e3f2012-01-05 10:03:27 -08003573MACHINE_END
3574
Joel King064bbf82012-04-01 13:23:39 -07003575MACHINE_START(MPQ8064_CDP, "QCT MPQ8064 CDP")
3576 .map_io = apq8064_map_io,
3577 .reserve = apq8064_reserve,
3578 .init_irq = apq8064_init_irq,
3579 .handle_irq = gic_handle_irq,
3580 .timer = &msm_timer,
3581 .init_machine = apq8064_cdp_init,
3582 .init_early = apq8064_allocate_memory_regions,
3583 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003584 .restart = msm_restart,
Joel King064bbf82012-04-01 13:23:39 -07003585MACHINE_END
3586
Joel King11ca8202012-02-13 16:19:03 -08003587MACHINE_START(MPQ8064_HRD, "QCT MPQ8064 HRD")
3588 .map_io = apq8064_map_io,
3589 .reserve = apq8064_reserve,
3590 .init_irq = apq8064_init_irq,
3591 .handle_irq = gic_handle_irq,
3592 .timer = &msm_timer,
3593 .init_machine = apq8064_cdp_init,
Joel King3a57e772012-05-28 11:22:55 -07003594 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003595 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003596 .restart = msm_restart,
Joel King11ca8202012-02-13 16:19:03 -08003597MACHINE_END
3598
3599MACHINE_START(MPQ8064_DTV, "QCT MPQ8064 DTV")
3600 .map_io = apq8064_map_io,
3601 .reserve = apq8064_reserve,
3602 .init_irq = apq8064_init_irq,
3603 .handle_irq = gic_handle_irq,
3604 .timer = &msm_timer,
3605 .init_machine = apq8064_cdp_init,
Joel King3a57e772012-05-28 11:22:55 -07003606 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003607 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003608 .restart = msm_restart,
Joel King11ca8202012-02-13 16:19:03 -08003609MACHINE_END