blob: c589026adb10cf9694e3bf8900dfafcbb5e4c9ff [file] [log] [blame]
Manu Gautam5143b252012-01-05 19:25:23 -08001/* Copyright (c) 2011-2012, Code Aurora Forum. 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>
14#include <linux/platform_device.h>
15#include <linux/io.h>
16#include <linux/irq.h>
Kenneth Heitke748593a2011-07-15 15:45:11 -060017#include <linux/i2c.h>
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -060018#include <linux/slimbus/slimbus.h>
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +053019#include <linux/mfd/wcd9xxx/core.h>
20#include <linux/mfd/wcd9xxx/pdata.h>
Amy Maloche70090f992012-02-16 16:35:26 -080021#include <linux/mfd/pm8xxx/misc.h>
Kenneth Heitke36920d32011-07-20 16:44:30 -060022#include <linux/msm_ssbi.h>
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -070023#include <linux/spi/spi.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070024#include <linux/dma-mapping.h>
25#include <linux/platform_data/qcom_crypto_device.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080026#include <linux/ion.h>
Jack Cheung46bfffa2012-01-19 15:26:24 -080027#include <linux/memory.h>
Jing Lin21ed4de2012-02-05 15:53:28 -080028#include <linux/i2c/atmel_mxt_ts.h>
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -080029#include <linux/cyttsp.h>
Amy Maloche70090f992012-02-16 16:35:26 -080030#include <linux/i2c/isa1200.h>
Mohan Pallaka474b94b2012-01-25 12:59:58 +053031#include <linux/gpio_keys.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070032#include <asm/mach-types.h>
33#include <asm/mach/arch.h>
34#include <asm/hardware/gic.h>
Sahitya Tummala3586ed92011-08-03 09:13:23 +053035#include <asm/mach/mmc.h>
Ankit Verma6b7e2ba2012-01-26 15:48:54 -080036#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070037
38#include <mach/board.h>
39#include <mach/msm_iomap.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080040#include <mach/ion.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070041#include <linux/usb/msm_hsusb.h>
42#include <linux/usb/android.h>
43#include <mach/socinfo.h>
Harini Jayaramanc4c58692011-07-19 14:50:10 -060044#include <mach/msm_spi.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070045#include "timer.h"
46#include "devices.h"
Joel King4ebccc62011-07-22 09:43:22 -070047#include <mach/gpio.h>
48#include <mach/gpiomux.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060049#include <mach/rpm.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080050#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -070051#include <linux/android_pmem.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080052#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070053#include <mach/msm_memtypes.h>
54#include <linux/bootmem.h>
55#include <asm/setup.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070056#include <mach/dma.h>
Jin Hongd3024e62012-02-09 16:13:32 -080057#include <mach/msm_dsps.h>
Gagan Mac8a7a5d32011-11-11 16:43:06 -070058#include <mach/msm_bus_board.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060059#include <mach/cpuidle.h>
Joel Kingdacbc822012-01-25 13:30:57 -080060#include <mach/mdm2.h>
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -080061#include <linux/msm_tsens.h>
Stephen Boyd4d0d2582012-02-10 14:49:40 -080062#include <mach/msm_xo.h>
Joel King4ebccc62011-07-22 09:43:22 -070063
Jeff Ohlstein7e668552011-10-06 16:17:25 -070064#include "msm_watchdog.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080065#include "board-8064.h"
Vikram Mulukutlabc2e9572011-11-04 03:41:38 -070066#include "acpuclock.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060067#include "spm.h"
68#include "mpm.h"
69#include "rpm_resources.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080070#include "pm.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060071#include "pm-boot.h"
Rajesh Sastrulaaee8af32012-01-20 11:46:31 -080072#include "devices-msm8x60.h"
Jay Chokshiea67c622011-07-29 17:12:26 -070073
Olav Haugan7c6aa742012-01-16 16:47:37 -080074#define MSM_PMEM_ADSP_SIZE 0x7800000
Ben Romberger3ffcd812011-12-08 19:12:10 -080075#define MSM_PMEM_AUDIO_SIZE 0x2B4000
Olav Haugan7c6aa742012-01-16 16:47:37 -080076#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
77#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
78#else
79#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
80#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070081
Olav Haugan7c6aa742012-01-16 16:47:37 -080082#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Olav Hauganedcf6832012-01-24 08:35:41 -080083#define MSM_PMEM_KERNEL_EBI1_SIZE 0x280000
Olav Haugan7c6aa742012-01-16 16:47:37 -080084#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Haugand3d29682012-01-19 10:57:07 -080085#define MSM_ION_MM_FW_SIZE 0x200000 /* (2MB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -080086#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Haugan3a9bd232012-02-15 14:23:27 -080087#define MSM_ION_QSECOM_SIZE 0x300000 /* (3MB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -080088#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan2c43fac2012-01-19 11:06:37 -080089#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
90#define MSM_ION_HEAP_NUM 8
Olav Haugan7c6aa742012-01-16 16:47:37 -080091#else
92#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
93#define MSM_ION_HEAP_NUM 1
94#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070095
Olav Haugan7c6aa742012-01-16 16:47:37 -080096#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
97static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
98static int __init pmem_kernel_ebi1_size_setup(char *p)
Kevin Chan13be4e22011-10-20 11:30:32 -070099{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800100 pmem_kernel_ebi1_size = memparse(p, NULL);
101 return 0;
Kevin Chan13be4e22011-10-20 11:30:32 -0700102}
Olav Haugan7c6aa742012-01-16 16:47:37 -0800103early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
104#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700105
Olav Haugan7c6aa742012-01-16 16:47:37 -0800106#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -0700107static unsigned pmem_size = MSM_PMEM_SIZE;
108static int __init pmem_size_setup(char *p)
109{
110 pmem_size = memparse(p, NULL);
111 return 0;
112}
113early_param("pmem_size", pmem_size_setup);
114
115static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
116
117static int __init pmem_adsp_size_setup(char *p)
118{
119 pmem_adsp_size = memparse(p, NULL);
120 return 0;
121}
122early_param("pmem_adsp_size", pmem_adsp_size_setup);
123
124static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
125
126static int __init pmem_audio_size_setup(char *p)
127{
128 pmem_audio_size = memparse(p, NULL);
129 return 0;
130}
131early_param("pmem_audio_size", pmem_audio_size_setup);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800132#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700133
Olav Haugan7c6aa742012-01-16 16:47:37 -0800134#ifdef CONFIG_ANDROID_PMEM
135#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700136static struct android_pmem_platform_data android_pmem_pdata = {
137 .name = "pmem",
138 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
139 .cached = 1,
140 .memory_type = MEMTYPE_EBI1,
141};
142
143static struct platform_device android_pmem_device = {
144 .name = "android_pmem",
145 .id = 0,
146 .dev = {.platform_data = &android_pmem_pdata},
147};
148
149static struct android_pmem_platform_data android_pmem_adsp_pdata = {
150 .name = "pmem_adsp",
151 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
152 .cached = 0,
153 .memory_type = MEMTYPE_EBI1,
154};
Kevin Chan13be4e22011-10-20 11:30:32 -0700155static struct platform_device android_pmem_adsp_device = {
156 .name = "android_pmem",
157 .id = 2,
158 .dev = { .platform_data = &android_pmem_adsp_pdata },
159};
Olav Haugan7c6aa742012-01-16 16:47:37 -0800160#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700161
162static struct android_pmem_platform_data android_pmem_audio_pdata = {
163 .name = "pmem_audio",
164 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
165 .cached = 0,
166 .memory_type = MEMTYPE_EBI1,
167};
168
169static struct platform_device android_pmem_audio_device = {
170 .name = "android_pmem",
171 .id = 4,
172 .dev = { .platform_data = &android_pmem_audio_pdata },
173};
Olav Haugan7c6aa742012-01-16 16:47:37 -0800174#endif
175
176static struct memtype_reserve apq8064_reserve_table[] __initdata = {
177 [MEMTYPE_SMI] = {
178 },
179 [MEMTYPE_EBI0] = {
180 .flags = MEMTYPE_FLAGS_1M_ALIGN,
181 },
182 [MEMTYPE_EBI1] = {
183 .flags = MEMTYPE_FLAGS_1M_ALIGN,
184 },
185};
Kevin Chan13be4e22011-10-20 11:30:32 -0700186
187static void __init size_pmem_devices(void)
188{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800189#ifdef CONFIG_ANDROID_PMEM
190#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700191 android_pmem_adsp_pdata.size = pmem_adsp_size;
192 android_pmem_pdata.size = pmem_size;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800193#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700194 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800195#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700196}
197
198static void __init reserve_memory_for(struct android_pmem_platform_data *p)
199{
200 apq8064_reserve_table[p->memory_type].size += p->size;
201}
202
Kevin Chan13be4e22011-10-20 11:30:32 -0700203static void __init reserve_pmem_memory(void)
204{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800205#ifdef CONFIG_ANDROID_PMEM
206#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700207 reserve_memory_for(&android_pmem_adsp_pdata);
208 reserve_memory_for(&android_pmem_pdata);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800209#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700210 reserve_memory_for(&android_pmem_audio_pdata);
211 apq8064_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800212#endif
213}
214
215static int apq8064_paddr_to_memtype(unsigned int paddr)
216{
217 return MEMTYPE_EBI1;
218}
219
220#ifdef CONFIG_ION_MSM
221#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
222static struct ion_cp_heap_pdata cp_mm_ion_pdata = {
223 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugand3d29682012-01-19 10:57:07 -0800224 .align = PAGE_SIZE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800225};
226
227static struct ion_cp_heap_pdata cp_mfc_ion_pdata = {
228 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugand3d29682012-01-19 10:57:07 -0800229 .align = PAGE_SIZE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800230};
231
232static struct ion_co_heap_pdata co_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800233 .adjacent_mem_id = INVALID_HEAP_ID,
234 .align = PAGE_SIZE,
235};
236
237static struct ion_co_heap_pdata fw_co_ion_pdata = {
238 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
239 .align = SZ_128K,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800240};
241#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800242
243/**
244 * These heaps are listed in the order they will be allocated. Due to
245 * video hardware restrictions and content protection the FW heap has to
246 * be allocated adjacent (below) the MM heap and the MFC heap has to be
247 * allocated after the MM heap to ensure MFC heap is not more than 256MB
248 * away from the base address of the FW heap.
249 * However, the order of FW heap and MM heap doesn't matter since these
250 * two heaps are taken care of by separate code to ensure they are adjacent
251 * to each other.
252 * Don't swap the order unless you know what you are doing!
253 */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800254static struct ion_platform_data ion_pdata = {
255 .nr = MSM_ION_HEAP_NUM,
256 .heaps = {
257 {
258 .id = ION_SYSTEM_HEAP_ID,
259 .type = ION_HEAP_TYPE_SYSTEM,
260 .name = ION_VMALLOC_HEAP_NAME,
261 },
262#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
263 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800264 .id = ION_CP_MM_HEAP_ID,
265 .type = ION_HEAP_TYPE_CP,
266 .name = ION_MM_HEAP_NAME,
267 .size = MSM_ION_MM_SIZE,
268 .memory_type = ION_EBI_TYPE,
269 .extra_data = (void *) &cp_mm_ion_pdata,
270 },
271 {
Olav Haugand3d29682012-01-19 10:57:07 -0800272 .id = ION_MM_FIRMWARE_HEAP_ID,
273 .type = ION_HEAP_TYPE_CARVEOUT,
274 .name = ION_MM_FIRMWARE_HEAP_NAME,
275 .size = MSM_ION_MM_FW_SIZE,
276 .memory_type = ION_EBI_TYPE,
277 .extra_data = (void *) &fw_co_ion_pdata,
278 },
279 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800280 .id = ION_CP_MFC_HEAP_ID,
281 .type = ION_HEAP_TYPE_CP,
282 .name = ION_MFC_HEAP_NAME,
283 .size = MSM_ION_MFC_SIZE,
284 .memory_type = ION_EBI_TYPE,
285 .extra_data = (void *) &cp_mfc_ion_pdata,
286 },
287 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800288 .id = ION_SF_HEAP_ID,
289 .type = ION_HEAP_TYPE_CARVEOUT,
290 .name = ION_SF_HEAP_NAME,
291 .size = MSM_ION_SF_SIZE,
292 .memory_type = ION_EBI_TYPE,
293 .extra_data = (void *) &co_ion_pdata,
294 },
295 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800296 .id = ION_IOMMU_HEAP_ID,
297 .type = ION_HEAP_TYPE_IOMMU,
298 .name = ION_IOMMU_HEAP_NAME,
299 },
Olav Hauganf45e2142012-01-19 11:01:01 -0800300 {
301 .id = ION_QSECOM_HEAP_ID,
302 .type = ION_HEAP_TYPE_CARVEOUT,
303 .name = ION_QSECOM_HEAP_NAME,
304 .size = MSM_ION_QSECOM_SIZE,
305 .memory_type = ION_EBI_TYPE,
306 .extra_data = (void *) &co_ion_pdata,
307 },
Olav Haugan2c43fac2012-01-19 11:06:37 -0800308 {
309 .id = ION_AUDIO_HEAP_ID,
310 .type = ION_HEAP_TYPE_CARVEOUT,
311 .name = ION_AUDIO_HEAP_NAME,
312 .size = MSM_ION_AUDIO_SIZE,
313 .memory_type = ION_EBI_TYPE,
314 .extra_data = (void *) &co_ion_pdata,
315 },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800316#endif
317 }
318};
319
320static struct platform_device ion_dev = {
321 .name = "ion-msm",
322 .id = 1,
323 .dev = { .platform_data = &ion_pdata },
324};
325#endif
326
327static void reserve_ion_memory(void)
328{
329#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
330 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_SIZE;
Olav Haugand3d29682012-01-19 10:57:07 -0800331 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_FW_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800332 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_SF_SIZE;
333 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MFC_SIZE;
Olav Hauganf45e2142012-01-19 11:01:01 -0800334 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_QSECOM_SIZE;
Olav Haugan2c43fac2012-01-19 11:06:37 -0800335 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_AUDIO_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800336#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700337}
338
Huaibin Yang4a084e32011-12-15 15:25:52 -0800339static void __init reserve_mdp_memory(void)
340{
341 apq8064_mdp_writeback(apq8064_reserve_table);
342}
343
Kevin Chan13be4e22011-10-20 11:30:32 -0700344static void __init apq8064_calculate_reserve_sizes(void)
345{
346 size_pmem_devices();
347 reserve_pmem_memory();
Olav Haugan7c6aa742012-01-16 16:47:37 -0800348 reserve_ion_memory();
Huaibin Yang4a084e32011-12-15 15:25:52 -0800349 reserve_mdp_memory();
Kevin Chan13be4e22011-10-20 11:30:32 -0700350}
351
352static struct reserve_info apq8064_reserve_info __initdata = {
353 .memtype_reserve_table = apq8064_reserve_table,
354 .calculate_reserve_sizes = apq8064_calculate_reserve_sizes,
355 .paddr_to_memtype = apq8064_paddr_to_memtype,
356};
357
358static int apq8064_memory_bank_size(void)
359{
360 return 1<<29;
361}
362
363static void __init locate_unstable_memory(void)
364{
365 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
366 unsigned long bank_size;
367 unsigned long low, high;
368
369 bank_size = apq8064_memory_bank_size();
370 low = meminfo.bank[0].start;
371 high = mb->start + mb->size;
Olav Haugand76e3a82012-01-16 16:55:07 -0800372
373 /* Check if 32 bit overflow occured */
374 if (high < mb->start)
375 high = ~0UL;
376
Kevin Chan13be4e22011-10-20 11:30:32 -0700377 low &= ~(bank_size - 1);
378
379 if (high - low <= bank_size)
380 return;
Jack Cheung46bfffa2012-01-19 15:26:24 -0800381 apq8064_reserve_info.low_unstable_address = mb->start -
382 MIN_MEMORY_BLOCK_SIZE + mb->size;
383 apq8064_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
384
Kevin Chan13be4e22011-10-20 11:30:32 -0700385 apq8064_reserve_info.bank_size = bank_size;
386 pr_info("low unstable address %lx max size %lx bank size %lx\n",
387 apq8064_reserve_info.low_unstable_address,
388 apq8064_reserve_info.max_unstable_size,
389 apq8064_reserve_info.bank_size);
390}
391
392static void __init apq8064_reserve(void)
393{
394 reserve_info = &apq8064_reserve_info;
395 locate_unstable_memory();
396 msm_reserve();
397}
398
Hemant Kumara945b472012-01-25 15:08:06 -0800399#ifdef CONFIG_USB_EHCI_MSM_HSIC
400static struct msm_hsic_host_platform_data msm_hsic_pdata = {
401 .strobe = 88,
402 .data = 89,
403};
404#else
405static struct msm_hsic_host_platform_data msm_hsic_pdata;
406#endif
407
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800408#define PID_MAGIC_ID 0x71432909
409#define SERIAL_NUM_MAGIC_ID 0x61945374
410#define SERIAL_NUMBER_LENGTH 127
411#define DLOAD_USB_BASE_ADD 0x2A03F0C8
412
413struct magic_num_struct {
414 uint32_t pid;
415 uint32_t serial_num;
416};
417
418struct dload_struct {
419 uint32_t reserved1;
420 uint32_t reserved2;
421 uint32_t reserved3;
422 uint16_t reserved4;
423 uint16_t pid;
424 char serial_number[SERIAL_NUMBER_LENGTH];
425 uint16_t reserved5;
426 struct magic_num_struct magic_struct;
427};
428
429static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
430{
431 struct dload_struct __iomem *dload = 0;
432
433 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
434 if (!dload) {
435 pr_err("%s: cannot remap I/O memory region: %08x\n",
436 __func__, DLOAD_USB_BASE_ADD);
437 return -ENXIO;
438 }
439
440 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
441 __func__, dload, pid, snum);
442 /* update pid */
443 dload->magic_struct.pid = PID_MAGIC_ID;
444 dload->pid = pid;
445
446 /* update serial number */
447 dload->magic_struct.serial_num = 0;
448 if (!snum) {
449 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
450 goto out;
451 }
452
453 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
454 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
455out:
456 iounmap(dload);
457 return 0;
458}
459
460static struct android_usb_platform_data android_usb_pdata = {
461 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
462};
463
Hemant Kumar4933b072011-10-17 23:43:11 -0700464static struct platform_device android_usb_device = {
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800465 .name = "android_usb",
466 .id = -1,
467 .dev = {
468 .platform_data = &android_usb_pdata,
469 },
Hemant Kumar4933b072011-10-17 23:43:11 -0700470};
471
Hemant Kumar7620eed2012-02-26 09:08:43 -0800472/* Bandwidth requests (zero) if no vote placed */
473static struct msm_bus_vectors usb_init_vectors[] = {
474 {
475 .src = MSM_BUS_MASTER_SPS,
476 .dst = MSM_BUS_SLAVE_EBI_CH0,
477 .ab = 0,
478 .ib = 0,
479 },
480};
481
482/* Bus bandwidth requests in Bytes/sec */
483static struct msm_bus_vectors usb_max_vectors[] = {
484 {
485 .src = MSM_BUS_MASTER_SPS,
486 .dst = MSM_BUS_SLAVE_EBI_CH0,
487 .ab = 60000000, /* At least 480Mbps on bus. */
488 .ib = 960000000, /* MAX bursts rate */
489 },
490};
491
492static struct msm_bus_paths usb_bus_scale_usecases[] = {
493 {
494 ARRAY_SIZE(usb_init_vectors),
495 usb_init_vectors,
496 },
497 {
498 ARRAY_SIZE(usb_max_vectors),
499 usb_max_vectors,
500 },
501};
502
503static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
504 usb_bus_scale_usecases,
505 ARRAY_SIZE(usb_bus_scale_usecases),
506 .name = "usb",
507};
508
Hemant Kumar4933b072011-10-17 23:43:11 -0700509static struct msm_otg_platform_data msm_otg_pdata = {
Hemant Kumard86c4882012-01-24 19:39:37 -0800510 .mode = USB_OTG,
511 .otg_control = OTG_PMIC_CONTROL,
Hemant Kumar4933b072011-10-17 23:43:11 -0700512 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Hemant Kumard86c4882012-01-24 19:39:37 -0800513 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
514 .power_budget = 750,
Hemant Kumar7620eed2012-02-26 09:08:43 -0800515 .bus_scale_table = &usb_bus_scale_pdata,
Hemant Kumar4933b072011-10-17 23:43:11 -0700516};
517
Manu Gautam91223e02011-11-08 15:27:22 +0530518static struct msm_usb_host_platform_data msm_ehci_host_pdata = {
519 .power_budget = 500,
520};
521
522static void __init apq8064_ehci_host_init(void)
523{
524 if (machine_is_apq8064_liquid()) {
525 apq8064_device_ehci_host3.dev.platform_data =
526 &msm_ehci_host_pdata;
527 platform_device_register(&apq8064_device_ehci_host3);
528 }
529}
530
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800531#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
532
533/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
534 * 4 micbiases are used to power various analog and digital
535 * microphones operating at 1800 mV. Technically, all micbiases
536 * can source from single cfilter since all microphones operate
537 * at the same voltage level. The arrangement below is to make
538 * sure all cfilters are exercised. LDO_H regulator ouput level
539 * does not need to be as high as 2.85V. It is choosen for
540 * microphone sensitivity purpose.
541 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530542static struct wcd9xxx_pdata apq8064_tabla_platform_data = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800543 .slimbus_slave_device = {
544 .name = "tabla-slave",
545 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
546 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800547 .irq = MSM_GPIO_TO_INT(42),
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800548 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530549 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800550 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
551 .micbias = {
552 .ldoh_v = TABLA_LDOH_2P85_V,
553 .cfilt1_mv = 1800,
554 .cfilt2_mv = 1800,
555 .cfilt3_mv = 1800,
556 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
557 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
558 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
559 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530560 },
561 .regulator = {
562 {
563 .name = "CDC_VDD_CP",
564 .min_uV = 1800000,
565 .max_uV = 1800000,
566 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
567 },
568 {
569 .name = "CDC_VDDA_RX",
570 .min_uV = 1800000,
571 .max_uV = 1800000,
572 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
573 },
574 {
575 .name = "CDC_VDDA_TX",
576 .min_uV = 1800000,
577 .max_uV = 1800000,
578 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
579 },
580 {
581 .name = "VDDIO_CDC",
582 .min_uV = 1800000,
583 .max_uV = 1800000,
584 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
585 },
586 {
587 .name = "VDDD_CDC_D",
588 .min_uV = 1225000,
589 .max_uV = 1225000,
590 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
591 },
592 {
593 .name = "CDC_VDDA_A_1P2V",
594 .min_uV = 1225000,
595 .max_uV = 1225000,
596 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
597 },
598 },
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800599};
600
601static struct slim_device apq8064_slim_tabla = {
602 .name = "tabla-slim",
603 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
604 .dev = {
605 .platform_data = &apq8064_tabla_platform_data,
606 },
607};
608
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530609static struct wcd9xxx_pdata apq8064_tabla20_platform_data = {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800610 .slimbus_slave_device = {
611 .name = "tabla-slave",
612 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
613 },
614 .irq = MSM_GPIO_TO_INT(42),
615 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530616 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800617 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
618 .micbias = {
619 .ldoh_v = TABLA_LDOH_2P85_V,
620 .cfilt1_mv = 1800,
621 .cfilt2_mv = 1800,
622 .cfilt3_mv = 1800,
623 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
624 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
625 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
626 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530627 },
628 .regulator = {
629 {
630 .name = "CDC_VDD_CP",
631 .min_uV = 1800000,
632 .max_uV = 1800000,
633 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
634 },
635 {
636 .name = "CDC_VDDA_RX",
637 .min_uV = 1800000,
638 .max_uV = 1800000,
639 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
640 },
641 {
642 .name = "CDC_VDDA_TX",
643 .min_uV = 1800000,
644 .max_uV = 1800000,
645 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
646 },
647 {
648 .name = "VDDIO_CDC",
649 .min_uV = 1800000,
650 .max_uV = 1800000,
651 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
652 },
653 {
654 .name = "VDDD_CDC_D",
655 .min_uV = 1225000,
656 .max_uV = 1225000,
657 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
658 },
659 {
660 .name = "CDC_VDDA_A_1P2V",
661 .min_uV = 1225000,
662 .max_uV = 1225000,
663 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
664 },
665 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800666};
667
668static struct slim_device apq8064_slim_tabla20 = {
669 .name = "tabla2x-slim",
670 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
671 .dev = {
672 .platform_data = &apq8064_tabla20_platform_data,
673 },
674};
675
Amy Maloche70090f992012-02-16 16:35:26 -0800676#define HAP_SHIFT_LVL_OE_GPIO PM8921_MPP_PM_TO_SYS(8)
677#define ISA1200_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
678#define ISA1200_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
679#define ISA1200_HAP_CLK PM8921_GPIO_PM_TO_SYS(44)
680
681static int isa1200_power(int on)
682{
683 gpio_set_value_cansleep(ISA1200_HAP_CLK, !!on);
684
685 return 0;
686}
687
688static int isa1200_dev_setup(bool enable)
689{
690 int rc = 0;
691
692 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_1, enable);
693 if (rc) {
694 pr_err("%s: unable to write aux clock register(%d)\n",
695 __func__, rc);
696 return rc;
697 }
698
699 if (!enable)
700 goto free_gpio;
701
702 rc = gpio_request(ISA1200_HAP_CLK, "haptics_clk");
703 if (rc) {
704 pr_err("%s: unable to request gpio %d config(%d)\n",
705 __func__, ISA1200_HAP_CLK, rc);
706 return rc;
707 }
708
709 rc = gpio_direction_output(ISA1200_HAP_CLK, 0);
710 if (rc) {
711 pr_err("%s: unable to set direction\n", __func__);
712 goto free_gpio;
713 }
714
715 return 0;
716
717free_gpio:
718 gpio_free(ISA1200_HAP_CLK);
719 return rc;
720}
721
722static struct isa1200_regulator isa1200_reg_data[] = {
723 {
724 .name = "vddp",
725 .min_uV = ISA_I2C_VTG_MIN_UV,
726 .max_uV = ISA_I2C_VTG_MAX_UV,
727 .load_uA = ISA_I2C_CURR_UA,
728 },
729};
730
731static struct isa1200_platform_data isa1200_1_pdata = {
732 .name = "vibrator",
733 .dev_setup = isa1200_dev_setup,
734 .power_on = isa1200_power,
735 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
736 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
737 .max_timeout = 15000,
738 .mode_ctrl = PWM_GEN_MODE,
739 .pwm_fd = {
740 .pwm_div = 256,
741 },
742 .is_erm = false,
743 .smart_en = true,
744 .ext_clk_en = true,
745 .chip_en = 1,
746 .regulator_info = isa1200_reg_data,
747 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
748};
749
750static struct i2c_board_info isa1200_board_info[] __initdata = {
751 {
752 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
753 .platform_data = &isa1200_1_pdata,
754 },
755};
Jing Lin21ed4de2012-02-05 15:53:28 -0800756/* configuration data for mxt1386e using V2.1 firmware */
757static const u8 mxt1386e_config_data_v2_1[] = {
758 /* T6 Object */
759 0, 0, 0, 0, 0, 0,
760 /* T38 Object */
Jing Linf1208fd2012-02-23 11:15:42 -0800761 14, 1, 0, 22, 2, 12, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800762 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
763 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
764 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
765 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
766 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
767 0, 0, 0, 0,
768 /* T7 Object */
Jing Linf1208fd2012-02-23 11:15:42 -0800769 100, 10, 50,
Jing Lin21ed4de2012-02-05 15:53:28 -0800770 /* T8 Object */
Jing Linf1208fd2012-02-23 11:15:42 -0800771 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800772 /* T9 Object */
773 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
774 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
Jing Linf1208fd2012-02-23 11:15:42 -0800775 85, 5, 0, 5, 9, 5, 12, 35, 70, 40,
776 20, 5, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800777 /* T18 Object */
778 0, 0,
779 /* T24 Object */
780 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
781 0, 0, 0, 0, 0, 0, 0, 0, 0,
782 /* T25 Object */
783 3, 0, 60, 115, 156, 99,
784 /* T27 Object */
785 0, 0, 0, 0, 0, 0, 0,
786 /* T40 Object */
787 0, 0, 0, 0, 0,
788 /* T42 Object */
789 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
790 /* T43 Object */
791 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
792 16,
793 /* T46 Object */
Jing Linf1208fd2012-02-23 11:15:42 -0800794 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800795 /* T47 Object */
796 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
797 /* T48 Object */
798 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -0800799 32, 40, 0, 10, 10, 0, 0, 100, 10, 90,
800 0, 0, 0, 0, 0, 0, 0, 10, 1, 10,
801 52, 10, 12, 0, 33, 0, 1, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800802 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
803 0, 0, 0, 0,
804 /* T56 Object */
805 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
806 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
807 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
808 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -0800809 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
810 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800811};
812
813#define MXT_TS_GPIO_IRQ 6
814#define MXT_TS_PWR_EN_GPIO PM8921_GPIO_PM_TO_SYS(23)
815#define MXT_TS_RESET_GPIO 33
816
817static struct mxt_config_info mxt_config_array[] = {
818 {
819 .config = mxt1386e_config_data_v2_1,
820 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
821 .family_id = 0xA0,
822 .variant_id = 0x7,
823 .version = 0x21,
824 .build = 0xAA,
825 },
826};
827
828static struct mxt_platform_data mxt_platform_data = {
829 .config_array = mxt_config_array,
830 .config_array_size = ARRAY_SIZE(mxt_config_array),
831 .x_size = 1365,
832 .y_size = 767,
833 .irqflags = IRQF_TRIGGER_FALLING,
834 .i2c_pull_up = true,
835 .reset_gpio = MXT_TS_RESET_GPIO,
836 .irq_gpio = MXT_TS_GPIO_IRQ,
837};
838
839static struct i2c_board_info mxt_device_info[] __initdata = {
840 {
841 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
842 .platform_data = &mxt_platform_data,
843 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
844 },
845};
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -0800846#define CYTTSP_TS_GPIO_IRQ 6
847#define CYTTSP_TS_GPIO_RESOUT 7
848#define CYTTSP_TS_GPIO_SLEEP 33
849
850static ssize_t tma340_vkeys_show(struct kobject *kobj,
851 struct kobj_attribute *attr, char *buf)
852{
853 return snprintf(buf, 200,
854 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
855 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
856 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
857 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
858 "\n");
859}
860
861static struct kobj_attribute tma340_vkeys_attr = {
862 .attr = {
863 .mode = S_IRUGO,
864 },
865 .show = &tma340_vkeys_show,
866};
867
868static struct attribute *tma340_properties_attrs[] = {
869 &tma340_vkeys_attr.attr,
870 NULL
871};
872
873static struct attribute_group tma340_properties_attr_group = {
874 .attrs = tma340_properties_attrs,
875};
876
877static int cyttsp_platform_init(struct i2c_client *client)
878{
879 int rc = 0;
880 static struct kobject *tma340_properties_kobj;
881
882 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
883 tma340_properties_kobj = kobject_create_and_add("board_properties",
884 NULL);
885 if (tma340_properties_kobj)
886 rc = sysfs_create_group(tma340_properties_kobj,
887 &tma340_properties_attr_group);
888 if (!tma340_properties_kobj || rc)
889 pr_err("%s: failed to create board_properties\n",
890 __func__);
891
892 return 0;
893}
894
895static struct cyttsp_regulator cyttsp_regulator_data[] = {
896 {
897 .name = "vdd",
898 .min_uV = CY_TMA300_VTG_MIN_UV,
899 .max_uV = CY_TMA300_VTG_MAX_UV,
900 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
901 .lpm_load_uA = CY_TMA300_CURR_24HZ_UA,
902 },
903 {
904 .name = "vcc_i2c",
905 .min_uV = CY_I2C_VTG_MIN_UV,
906 .max_uV = CY_I2C_VTG_MAX_UV,
907 .hpm_load_uA = CY_I2C_CURR_UA,
908 .lpm_load_uA = CY_I2C_CURR_UA,
909 },
910};
911
912static struct cyttsp_platform_data cyttsp_pdata = {
913 .panel_maxx = 634,
914 .panel_maxy = 1166,
915 .disp_maxx = 599,
916 .disp_maxy = 1023,
917 .disp_minx = 0,
918 .disp_miny = 0,
919 .flags = 0x01,
920 .gen = CY_GEN3,
921 .use_st = CY_USE_ST,
922 .use_mt = CY_USE_MT,
923 .use_hndshk = CY_SEND_HNDSHK,
924 .use_trk_id = CY_USE_TRACKING_ID,
925 .use_sleep = CY_USE_DEEP_SLEEP_SEL,
926 .use_gestures = CY_USE_GESTURES,
927 .fw_fname = "cyttsp_8064_mtp.hex",
928 /* change act_intrvl to customize the Active power state
929 * scanning/processing refresh interval for Operating mode
930 */
931 .act_intrvl = CY_ACT_INTRVL_DFLT,
932 /* change tch_tmout to customize the touch timeout for the
933 * Active power state for Operating mode
934 */
935 .tch_tmout = CY_TCH_TMOUT_DFLT,
936 /* change lp_intrvl to customize the Low Power power state
937 * scanning/processing refresh interval for Operating mode
938 */
939 .lp_intrvl = CY_LP_INTRVL_DFLT,
940 .sleep_gpio = CYTTSP_TS_GPIO_SLEEP,
941 .resout_gpio = CYTTSP_TS_GPIO_RESOUT,
942 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
943 .regulator_info = cyttsp_regulator_data,
944 .num_regulators = ARRAY_SIZE(cyttsp_regulator_data),
945 .init = cyttsp_platform_init,
946 .correct_fw_ver = 17,
947};
948
949static struct i2c_board_info cyttsp_info[] __initdata = {
950 {
951 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
952 .platform_data = &cyttsp_pdata,
953 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
954 },
955};
Jing Lin21ed4de2012-02-05 15:53:28 -0800956
Ankit Verma6b7e2ba2012-01-26 15:48:54 -0800957#define MSM_WCNSS_PHYS 0x03000000
958#define MSM_WCNSS_SIZE 0x280000
959
960static struct resource resources_wcnss_wlan[] = {
961 {
962 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
963 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
964 .name = "wcnss_wlanrx_irq",
965 .flags = IORESOURCE_IRQ,
966 },
967 {
968 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
969 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
970 .name = "wcnss_wlantx_irq",
971 .flags = IORESOURCE_IRQ,
972 },
973 {
974 .start = MSM_WCNSS_PHYS,
975 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
976 .name = "wcnss_mmio",
977 .flags = IORESOURCE_MEM,
978 },
979 {
980 .start = 64,
981 .end = 68,
982 .name = "wcnss_gpios_5wire",
983 .flags = IORESOURCE_IO,
984 },
985};
986
987static struct qcom_wcnss_opts qcom_wcnss_pdata = {
988 .has_48mhz_xo = 1,
989};
990
991static struct platform_device msm_device_wcnss_wlan = {
992 .name = "wcnss_wlan",
993 .id = 0,
994 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
995 .resource = resources_wcnss_wlan,
996 .dev = {.platform_data = &qcom_wcnss_pdata},
997};
998
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700999#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1000 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1001 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1002 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1003
1004#define QCE_SIZE 0x10000
1005#define QCE_0_BASE 0x11000000
1006
1007#define QCE_HW_KEY_SUPPORT 0
1008#define QCE_SHA_HMAC_SUPPORT 1
1009#define QCE_SHARE_CE_RESOURCE 3
1010#define QCE_CE_SHARED 0
1011
1012static struct resource qcrypto_resources[] = {
1013 [0] = {
1014 .start = QCE_0_BASE,
1015 .end = QCE_0_BASE + QCE_SIZE - 1,
1016 .flags = IORESOURCE_MEM,
1017 },
1018 [1] = {
1019 .name = "crypto_channels",
1020 .start = DMOV8064_CE_IN_CHAN,
1021 .end = DMOV8064_CE_OUT_CHAN,
1022 .flags = IORESOURCE_DMA,
1023 },
1024 [2] = {
1025 .name = "crypto_crci_in",
1026 .start = DMOV8064_CE_IN_CRCI,
1027 .end = DMOV8064_CE_IN_CRCI,
1028 .flags = IORESOURCE_DMA,
1029 },
1030 [3] = {
1031 .name = "crypto_crci_out",
1032 .start = DMOV8064_CE_OUT_CRCI,
1033 .end = DMOV8064_CE_OUT_CRCI,
1034 .flags = IORESOURCE_DMA,
1035 },
1036};
1037
1038static struct resource qcedev_resources[] = {
1039 [0] = {
1040 .start = QCE_0_BASE,
1041 .end = QCE_0_BASE + QCE_SIZE - 1,
1042 .flags = IORESOURCE_MEM,
1043 },
1044 [1] = {
1045 .name = "crypto_channels",
1046 .start = DMOV8064_CE_IN_CHAN,
1047 .end = DMOV8064_CE_OUT_CHAN,
1048 .flags = IORESOURCE_DMA,
1049 },
1050 [2] = {
1051 .name = "crypto_crci_in",
1052 .start = DMOV8064_CE_IN_CRCI,
1053 .end = DMOV8064_CE_IN_CRCI,
1054 .flags = IORESOURCE_DMA,
1055 },
1056 [3] = {
1057 .name = "crypto_crci_out",
1058 .start = DMOV8064_CE_OUT_CRCI,
1059 .end = DMOV8064_CE_OUT_CRCI,
1060 .flags = IORESOURCE_DMA,
1061 },
1062};
1063
1064#endif
1065
1066#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1067 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1068
1069static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1070 .ce_shared = QCE_CE_SHARED,
1071 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1072 .hw_key_support = QCE_HW_KEY_SUPPORT,
1073 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001074 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001075};
1076
1077static struct platform_device qcrypto_device = {
1078 .name = "qcrypto",
1079 .id = 0,
1080 .num_resources = ARRAY_SIZE(qcrypto_resources),
1081 .resource = qcrypto_resources,
1082 .dev = {
1083 .coherent_dma_mask = DMA_BIT_MASK(32),
1084 .platform_data = &qcrypto_ce_hw_suppport,
1085 },
1086};
1087#endif
1088
1089#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1090 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1091
1092static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1093 .ce_shared = QCE_CE_SHARED,
1094 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1095 .hw_key_support = QCE_HW_KEY_SUPPORT,
1096 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001097 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001098};
1099
1100static struct platform_device qcedev_device = {
1101 .name = "qce",
1102 .id = 0,
1103 .num_resources = ARRAY_SIZE(qcedev_resources),
1104 .resource = qcedev_resources,
1105 .dev = {
1106 .coherent_dma_mask = DMA_BIT_MASK(32),
1107 .platform_data = &qcedev_ce_hw_suppport,
1108 },
1109};
1110#endif
1111
Joel Kingdacbc822012-01-25 13:30:57 -08001112static struct mdm_platform_data mdm_platform_data = {
1113 .mdm_version = "3.0",
1114 .ramdump_delay_ms = 2000,
Hemant Kumara945b472012-01-25 15:08:06 -08001115 .peripheral_platform_device = &apq8064_device_hsic_host,
Joel Kingdacbc822012-01-25 13:30:57 -08001116};
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001117
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001118static struct tsens_platform_data apq_tsens_pdata = {
1119 .tsens_factor = 1000,
1120 .hw_type = APQ_8064,
1121 .tsens_num_sensor = 11,
1122 .slope = {1176, 1176, 1154, 1176, 1111,
1123 1132, 1132, 1199, 1132, 1199, 1132},
1124};
1125
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001126#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001127static void __init apq8064_map_io(void)
1128{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001129 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001130 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001131 if (socinfo_init() < 0)
1132 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001133}
1134
1135static void __init apq8064_init_irq(void)
1136{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001137 struct msm_mpm_device_data *data = NULL;
1138
1139#ifdef CONFIG_MSM_MPM
1140 data = &apq8064_mpm_dev_data;
1141#endif
1142
1143 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001144 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1145 (void *)MSM_QGIC_CPU_BASE);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001146}
1147
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001148static struct platform_device msm8064_device_saw_regulator_core0 = {
1149 .name = "saw-regulator",
1150 .id = 0,
1151 .dev = {
1152 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
1153 },
1154};
1155
1156static struct platform_device msm8064_device_saw_regulator_core1 = {
1157 .name = "saw-regulator",
1158 .id = 1,
1159 .dev = {
1160 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
1161 },
1162};
1163
1164static struct platform_device msm8064_device_saw_regulator_core2 = {
1165 .name = "saw-regulator",
1166 .id = 2,
1167 .dev = {
1168 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
1169 },
1170};
1171
1172static struct platform_device msm8064_device_saw_regulator_core3 = {
1173 .name = "saw-regulator",
1174 .id = 3,
1175 .dev = {
1176 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001177
1178 },
1179};
1180
1181static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
1182 {
1183 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1184 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1185 true,
1186 100, 8000, 100000, 1,
1187 },
1188
1189 {
1190 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1191 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1192 true,
1193 2000, 6000, 60100000, 3000,
1194 },
1195
1196 {
1197 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1198 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1199 false,
1200 4200, 5000, 60350000, 3500,
1201 },
1202
1203 {
1204 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1205 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
1206 false,
1207 6300, 4500, 65350000, 4800,
1208 },
1209
1210 {
1211 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1212 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1213 false,
1214 11700, 2500, 67850000, 5500,
1215 },
1216
1217 {
1218 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1219 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1220 false,
1221 13800, 2000, 71850000, 6800,
1222 },
1223
1224 {
1225 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1226 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1227 false,
1228 29700, 500, 75850000, 8800,
1229 },
1230
1231 {
1232 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1233 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1234 false,
1235 29700, 0, 76350000, 9800,
1236 },
1237};
1238
1239static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1240 .mode = MSM_PM_BOOT_CONFIG_TZ,
1241};
1242
1243static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
1244 .levels = &msm_rpmrs_levels[0],
1245 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
1246 .vdd_mem_levels = {
1247 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
1248 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
1249 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
1250 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
1251 },
1252 .vdd_dig_levels = {
1253 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
1254 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
1255 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
1256 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
1257 },
1258 .vdd_mask = 0x7FFFFF,
1259 .rpmrs_target_id = {
1260 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
1261 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
1262 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
1263 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
1264 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
1265 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
1266 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
1267 },
1268};
1269
1270static struct msm_cpuidle_state msm_cstates[] __initdata = {
1271 {0, 0, "C0", "WFI",
1272 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1273
1274 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1275 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1276
1277 {0, 2, "C2", "POWER_COLLAPSE",
1278 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
1279
1280 {1, 0, "C0", "WFI",
1281 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1282
1283 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1284 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1285
1286 {2, 0, "C0", "WFI",
1287 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1288
1289 {2, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1290 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1291
1292 {3, 0, "C0", "WFI",
1293 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1294
1295 {3, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1296 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1297};
1298
1299static struct msm_pm_platform_data msm_pm_data[] = {
1300 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1301 .idle_supported = 1,
1302 .suspend_supported = 1,
1303 .idle_enabled = 0,
1304 .suspend_enabled = 0,
1305 },
1306
1307 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1308 .idle_supported = 1,
1309 .suspend_supported = 1,
1310 .idle_enabled = 0,
1311 .suspend_enabled = 0,
1312 },
1313
1314 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1315 .idle_supported = 1,
1316 .suspend_supported = 1,
1317 .idle_enabled = 1,
1318 .suspend_enabled = 1,
1319 },
1320
1321 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1322 .idle_supported = 0,
1323 .suspend_supported = 1,
1324 .idle_enabled = 0,
1325 .suspend_enabled = 0,
1326 },
1327
1328 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1329 .idle_supported = 1,
1330 .suspend_supported = 1,
1331 .idle_enabled = 0,
1332 .suspend_enabled = 0,
1333 },
1334
1335 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1336 .idle_supported = 1,
1337 .suspend_supported = 0,
1338 .idle_enabled = 1,
1339 .suspend_enabled = 0,
1340 },
1341
1342 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1343 .idle_supported = 0,
1344 .suspend_supported = 1,
1345 .idle_enabled = 0,
1346 .suspend_enabled = 0,
1347 },
1348
1349 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1350 .idle_supported = 1,
1351 .suspend_supported = 1,
1352 .idle_enabled = 0,
1353 .suspend_enabled = 0,
1354 },
1355
1356 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1357 .idle_supported = 1,
1358 .suspend_supported = 0,
1359 .idle_enabled = 1,
1360 .suspend_enabled = 0,
1361 },
1362
1363 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1364 .idle_supported = 0,
1365 .suspend_supported = 1,
1366 .idle_enabled = 0,
1367 .suspend_enabled = 0,
1368 },
1369
1370 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1371 .idle_supported = 1,
1372 .suspend_supported = 1,
1373 .idle_enabled = 0,
1374 .suspend_enabled = 0,
1375 },
1376
1377 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1378 .idle_supported = 1,
1379 .suspend_supported = 0,
1380 .idle_enabled = 1,
1381 .suspend_enabled = 0,
1382 },
1383};
1384
1385static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1386 0x03, 0x0f,
1387};
1388
1389static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1390 0x00, 0x24, 0x54, 0x10,
1391 0x09, 0x03, 0x01,
1392 0x10, 0x54, 0x30, 0x0C,
1393 0x24, 0x30, 0x0f,
1394};
1395
1396static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1397 0x00, 0x24, 0x54, 0x10,
1398 0x09, 0x07, 0x01, 0x0B,
1399 0x10, 0x54, 0x30, 0x0C,
1400 0x24, 0x30, 0x0f,
1401};
1402
1403static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1404 [0] = {
1405 .mode = MSM_SPM_MODE_CLOCK_GATING,
1406 .notify_rpm = false,
1407 .cmd = spm_wfi_cmd_sequence,
1408 },
1409 [1] = {
1410 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1411 .notify_rpm = false,
1412 .cmd = spm_power_collapse_without_rpm,
1413 },
1414 [2] = {
1415 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1416 .notify_rpm = true,
1417 .cmd = spm_power_collapse_with_rpm,
1418 },
1419};
1420
1421static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1422 0x00, 0x20, 0x03, 0x20,
1423 0x00, 0x0f,
1424};
1425
1426static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1427 0x00, 0x20, 0x34, 0x64,
1428 0x48, 0x07, 0x48, 0x20,
1429 0x50, 0x64, 0x04, 0x34,
1430 0x50, 0x0f,
1431};
1432static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1433 0x00, 0x10, 0x34, 0x64,
1434 0x48, 0x07, 0x48, 0x10,
1435 0x50, 0x64, 0x04, 0x34,
1436 0x50, 0x0F,
1437};
1438
1439static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1440 [0] = {
1441 .mode = MSM_SPM_L2_MODE_RETENTION,
1442 .notify_rpm = false,
1443 .cmd = l2_spm_wfi_cmd_sequence,
1444 },
1445 [1] = {
1446 .mode = MSM_SPM_L2_MODE_GDHS,
1447 .notify_rpm = true,
1448 .cmd = l2_spm_gdhs_cmd_sequence,
1449 },
1450 [2] = {
1451 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1452 .notify_rpm = true,
1453 .cmd = l2_spm_power_off_cmd_sequence,
1454 },
1455};
1456
1457
1458static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1459 [0] = {
1460 .reg_base_addr = MSM_SAW_L2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001461 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
1462 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1463 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1464 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1465 .modes = msm_spm_l2_seq_list,
1466 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1467 },
1468};
1469
1470static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1471 [0] = {
1472 .reg_base_addr = MSM_SAW0_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001473 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001474#if defined(CONFIG_MSM_AVS_HW)
1475 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1476 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1477#endif
1478 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1479 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1480 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1481 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1482 .vctl_timeout_us = 50,
1483 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1484 .modes = msm_spm_seq_list,
1485 },
1486 [1] = {
1487 .reg_base_addr = MSM_SAW1_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001488 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001489#if defined(CONFIG_MSM_AVS_HW)
1490 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1491 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1492#endif
1493 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1494 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1495 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1496 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1497 .vctl_timeout_us = 50,
1498 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1499 .modes = msm_spm_seq_list,
1500 },
1501 [2] = {
1502 .reg_base_addr = MSM_SAW2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001503 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001504#if defined(CONFIG_MSM_AVS_HW)
1505 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1506 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1507#endif
1508 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1509 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1510 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1511 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1512 .vctl_timeout_us = 50,
1513 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1514 .modes = msm_spm_seq_list,
1515 },
1516 [3] = {
1517 .reg_base_addr = MSM_SAW3_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001518 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001519#if defined(CONFIG_MSM_AVS_HW)
1520 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1521 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1522#endif
1523 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1524 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1525 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1526 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1527 .vctl_timeout_us = 50,
1528 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1529 .modes = msm_spm_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001530 },
1531};
1532
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001533static void __init apq8064_init_buses(void)
1534{
1535 msm_bus_rpm_set_mt_mask();
1536 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
1537 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
1538 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
1539 msm_bus_8064_apps_fabric.dev.platform_data =
1540 &msm_bus_8064_apps_fabric_pdata;
1541 msm_bus_8064_sys_fabric.dev.platform_data =
1542 &msm_bus_8064_sys_fabric_pdata;
1543 msm_bus_8064_mm_fabric.dev.platform_data =
1544 &msm_bus_8064_mm_fabric_pdata;
1545 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
1546 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
1547}
1548
David Collinsf0d00732012-01-25 15:46:50 -08001549static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
1550 .name = GPIO_REGULATOR_DEV_NAME,
1551 .id = PM8921_MPP_PM_TO_SYS(7),
1552 .dev = {
1553 .platform_data
1554 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
1555 },
1556};
1557
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08001558static struct platform_device apq8064_device_ext_mpp8_vreg __devinitdata = {
1559 .name = GPIO_REGULATOR_DEV_NAME,
1560 .id = PM8921_MPP_PM_TO_SYS(8),
1561 .dev = {
1562 .platform_data
1563 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_MPP8],
1564 },
1565};
1566
David Collinsf0d00732012-01-25 15:46:50 -08001567static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
1568 .name = GPIO_REGULATOR_DEV_NAME,
1569 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
1570 .dev = {
1571 .platform_data =
1572 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
1573 },
1574};
1575
David Collins390fc332012-02-07 14:38:16 -08001576static struct platform_device apq8064_device_ext_ts_sw_vreg __devinitdata = {
1577 .name = GPIO_REGULATOR_DEV_NAME,
1578 .id = PM8921_GPIO_PM_TO_SYS(23),
1579 .dev = {
1580 .platform_data
1581 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_TS_SW],
1582 },
1583};
1584
David Collins2782b5c2012-02-06 10:02:42 -08001585static struct platform_device apq8064_device_rpm_regulator __devinitdata = {
1586 .name = "rpm-regulator",
1587 .id = -1,
1588 .dev = {
1589 .platform_data = &apq8064_rpm_regulator_pdata,
1590 },
1591};
1592
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001593static struct platform_device *common_devices[] __initdata = {
Jin Hong01f2dbb2011-11-03 22:13:51 -07001594 &apq8064_device_dmov,
David Keitel3c40fc52012-02-09 17:53:52 -08001595 &apq8064_device_qup_i2c_gsbi1,
Jing Lin04601f92012-02-05 15:36:07 -08001596 &apq8064_device_qup_i2c_gsbi3,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001597 &apq8064_device_qup_i2c_gsbi4,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001598 &apq8064_device_qup_spi_gsbi5,
David Collinsf0d00732012-01-25 15:46:50 -08001599 &apq8064_device_ext_5v_vreg,
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08001600 &apq8064_device_ext_mpp8_vreg,
David Collinsf0d00732012-01-25 15:46:50 -08001601 &apq8064_device_ext_3p3v_vreg,
David Collins390fc332012-02-07 14:38:16 -08001602 &apq8064_device_ext_ts_sw_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07001603 &apq8064_device_ssbi_pmic1,
1604 &apq8064_device_ssbi_pmic2,
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001605 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07001606 &apq8064_device_otg,
1607 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08001608 &apq8064_device_hsusb_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07001609 &android_usb_device,
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001610 &msm_device_wcnss_wlan,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001611#ifdef CONFIG_ANDROID_PMEM
1612#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -07001613 &android_pmem_device,
1614 &android_pmem_adsp_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001615#endif
Kevin Chan13be4e22011-10-20 11:30:32 -07001616 &android_pmem_audio_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001617#endif
1618#ifdef CONFIG_ION_MSM
1619 &ion_dev,
1620#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001621 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001622 &msm8064_device_saw_regulator_core0,
1623 &msm8064_device_saw_regulator_core1,
1624 &msm8064_device_saw_regulator_core2,
1625 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001626#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1627 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1628 &qcrypto_device,
1629#endif
1630
1631#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1632 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1633 &qcedev_device,
1634#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07001635
1636#ifdef CONFIG_HW_RANDOM_MSM
1637 &apq8064_device_rng,
1638#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08001639 &apq_pcm,
1640 &apq_pcm_routing,
1641 &apq_cpudai0,
1642 &apq_cpudai1,
1643 &apq_cpudai_hdmi_rx,
1644 &apq_cpudai_bt_rx,
1645 &apq_cpudai_bt_tx,
1646 &apq_cpudai_fm_rx,
1647 &apq_cpudai_fm_tx,
1648 &apq_cpu_fe,
1649 &apq_stub_codec,
1650 &apq_voice,
1651 &apq_voip,
1652 &apq_lpa_pcm,
1653 &apq_pcm_hostless,
1654 &apq_cpudai_afe_01_rx,
1655 &apq_cpudai_afe_01_tx,
1656 &apq_cpudai_afe_02_rx,
1657 &apq_cpudai_afe_02_tx,
1658 &apq_pcm_afe,
1659 &apq_cpudai_auxpcm_rx,
1660 &apq_cpudai_auxpcm_tx,
Neema Shetty8427c262012-02-16 11:23:43 -08001661 &apq_cpudai_stub,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001662 &apq8064_rpm_device,
1663 &apq8064_rpm_log_device,
1664 &apq8064_rpm_stat_device,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001665 &msm_bus_8064_apps_fabric,
1666 &msm_bus_8064_sys_fabric,
1667 &msm_bus_8064_mm_fabric,
1668 &msm_bus_8064_sys_fpb,
1669 &msm_bus_8064_cpss_fpb,
Mohan Kumar Gubbihalli Lachma Naik7f72edd2012-02-06 17:26:47 -08001670 &apq8064_msm_device_vidc,
Matt Wagantalled832652012-02-02 19:23:17 -08001671 &msm_8960_riva,
Matt Wagantallb94b9a52012-02-02 21:59:54 -08001672 &msm_8960_q6_lpass,
Matt Wagantall292aace2012-01-26 19:12:34 -08001673 &msm_gss,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001674};
1675
Joel King4e7ad222011-08-17 15:47:38 -07001676static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001677 &apq8064_device_uart_gsbi3,
Yan He06913ce2011-08-26 16:33:46 -07001678 &msm_device_sps_apq8064,
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001679};
1680
1681static struct platform_device *rumi3_devices[] __initdata = {
1682 &apq8064_device_uart_gsbi1,
Yan He435ed612011-11-23 17:34:59 -08001683 &msm_device_sps_apq8064,
Huaibin Yang4a084e32011-12-15 15:25:52 -08001684#ifdef CONFIG_MSM_ROTATOR
1685 &msm_rotator_device,
1686#endif
Joel King4e7ad222011-08-17 15:47:38 -07001687};
1688
Joel King82b7e3f2012-01-05 10:03:27 -08001689static struct platform_device *cdp_devices[] __initdata = {
1690 &apq8064_device_uart_gsbi1,
Jin Hong4bbbfba2012-02-02 21:48:07 -08001691 &apq8064_device_uart_gsbi7,
Joel King82b7e3f2012-01-05 10:03:27 -08001692 &msm_device_sps_apq8064,
1693};
1694
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001695static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08001696 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001697};
1698
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001699#define KS8851_IRQ_GPIO 43
1700
1701static struct spi_board_info spi_board_info[] __initdata = {
1702 {
1703 .modalias = "ks8851",
1704 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1705 .max_speed_hz = 19200000,
1706 .bus_num = 0,
1707 .chip_select = 2,
1708 .mode = SPI_MODE_0,
1709 },
1710};
1711
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001712static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001713 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001714 .bus_num = 1,
1715 .slim_slave = &apq8064_slim_tabla,
1716 },
1717 {
1718 .bus_num = 1,
1719 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001720 },
1721 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001722};
1723
David Keitel3c40fc52012-02-09 17:53:52 -08001724static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi1_pdata = {
1725 .clk_freq = 100000,
1726 .src_clk_rate = 24000000,
1727};
1728
Jing Lin04601f92012-02-05 15:36:07 -08001729static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi3_pdata = {
1730 .clk_freq = 100000,
1731 .src_clk_rate = 24000000,
1732};
1733
Kenneth Heitke748593a2011-07-15 15:45:11 -06001734static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
1735 .clk_freq = 100000,
1736 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001737};
1738
David Keitel3c40fc52012-02-09 17:53:52 -08001739#define GSBI_DUAL_MODE_CODE 0x60
1740#define MSM_GSBI1_PHYS 0x12440000
Kenneth Heitke748593a2011-07-15 15:45:11 -06001741static void __init apq8064_i2c_init(void)
1742{
David Keitel3c40fc52012-02-09 17:53:52 -08001743 void __iomem *gsbi_mem;
1744
1745 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
1746 &apq8064_i2c_qup_gsbi1_pdata;
1747 gsbi_mem = ioremap_nocache(MSM_GSBI1_PHYS, 4);
1748 writel_relaxed(GSBI_DUAL_MODE_CODE, gsbi_mem);
1749 /* Ensure protocol code is written before proceeding */
1750 wmb();
1751 iounmap(gsbi_mem);
1752 apq8064_i2c_qup_gsbi1_pdata.use_gsbi_shared_mode = 1;
Jing Lin04601f92012-02-05 15:36:07 -08001753 apq8064_device_qup_i2c_gsbi3.dev.platform_data =
1754 &apq8064_i2c_qup_gsbi3_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06001755 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
1756 &apq8064_i2c_qup_gsbi4_pdata;
1757}
1758
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08001759#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001760static int ethernet_init(void)
1761{
1762 int ret;
1763 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
1764 if (ret) {
1765 pr_err("ks8851 gpio_request failed: %d\n", ret);
1766 goto fail;
1767 }
1768
1769 return 0;
1770fail:
1771 return ret;
1772}
1773#else
1774static int ethernet_init(void)
1775{
1776 return 0;
1777}
1778#endif
1779
Mohan Pallaka474b94b2012-01-25 12:59:58 +05301780#define GPIO_KEY_HOME PM8921_GPIO_PM_TO_SYS(27)
1781#define GPIO_KEY_VOLUME_UP PM8921_GPIO_PM_TO_SYS(35)
1782#define GPIO_KEY_VOLUME_DOWN PM8921_GPIO_PM_TO_SYS(38)
1783#define GPIO_KEY_CAM_FOCUS PM8921_GPIO_PM_TO_SYS(3)
1784#define GPIO_KEY_CAM_SNAP PM8921_GPIO_PM_TO_SYS(4)
1785#define GPIO_KEY_ROTATION 46
1786
1787static struct gpio_keys_button cdp_keys[] = {
1788 {
1789 .code = KEY_HOME,
1790 .gpio = GPIO_KEY_HOME,
1791 .desc = "home_key",
1792 .active_low = 1,
1793 .type = EV_KEY,
1794 .wakeup = 1,
1795 .debounce_interval = 15,
1796 },
1797 {
1798 .code = KEY_VOLUMEUP,
1799 .gpio = GPIO_KEY_VOLUME_UP,
1800 .desc = "volume_up_key",
1801 .active_low = 1,
1802 .type = EV_KEY,
1803 .wakeup = 1,
1804 .debounce_interval = 15,
1805 },
1806 {
1807 .code = KEY_VOLUMEDOWN,
1808 .gpio = GPIO_KEY_VOLUME_DOWN,
1809 .desc = "volume_down_key",
1810 .active_low = 1,
1811 .type = EV_KEY,
1812 .wakeup = 1,
1813 .debounce_interval = 15,
1814 },
1815 {
1816 .code = SW_ROTATE_LOCK,
1817 .gpio = GPIO_KEY_ROTATION,
1818 .desc = "rotate_key",
1819 .active_low = 1,
1820 .type = EV_SW,
1821 .debounce_interval = 15,
1822 },
1823};
1824
1825static struct gpio_keys_platform_data cdp_keys_data = {
1826 .buttons = cdp_keys,
1827 .nbuttons = ARRAY_SIZE(cdp_keys),
1828};
1829
1830static struct platform_device cdp_kp_pdev = {
1831 .name = "gpio-keys",
1832 .id = -1,
1833 .dev = {
1834 .platform_data = &cdp_keys_data,
1835 },
1836};
1837
1838static struct gpio_keys_button mtp_keys[] = {
1839 {
1840 .code = KEY_CAMERA_FOCUS,
1841 .gpio = GPIO_KEY_CAM_FOCUS,
1842 .desc = "cam_focus_key",
1843 .active_low = 1,
1844 .type = EV_KEY,
1845 .wakeup = 1,
1846 .debounce_interval = 15,
1847 },
1848 {
1849 .code = KEY_VOLUMEUP,
1850 .gpio = GPIO_KEY_VOLUME_UP,
1851 .desc = "volume_up_key",
1852 .active_low = 1,
1853 .type = EV_KEY,
1854 .wakeup = 1,
1855 .debounce_interval = 15,
1856 },
1857 {
1858 .code = KEY_VOLUMEDOWN,
1859 .gpio = GPIO_KEY_VOLUME_DOWN,
1860 .desc = "volume_down_key",
1861 .active_low = 1,
1862 .type = EV_KEY,
1863 .wakeup = 1,
1864 .debounce_interval = 15,
1865 },
1866 {
1867 .code = KEY_CAMERA_SNAPSHOT,
1868 .gpio = GPIO_KEY_CAM_SNAP,
1869 .desc = "cam_snap_key",
1870 .active_low = 1,
1871 .type = EV_KEY,
1872 .debounce_interval = 15,
1873 },
1874};
1875
1876static struct gpio_keys_platform_data mtp_keys_data = {
1877 .buttons = mtp_keys,
1878 .nbuttons = ARRAY_SIZE(mtp_keys),
1879};
1880
1881static struct platform_device mtp_kp_pdev = {
1882 .name = "gpio-keys",
1883 .id = -1,
1884 .dev = {
1885 .platform_data = &mtp_keys_data,
1886 },
1887};
1888
Jin Hongd3024e62012-02-09 16:13:32 -08001889/* Sensors DSPS platform data */
1890#define DSPS_PIL_GENERIC_NAME "dsps"
1891static void __init apq8064_init_dsps(void)
1892{
1893 struct msm_dsps_platform_data *pdata =
1894 msm_dsps_device_8064.dev.platform_data;
1895 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
1896 pdata->gpios = NULL;
1897 pdata->gpios_num = 0;
1898
1899 platform_device_register(&msm_dsps_device_8064);
1900}
Mohan Pallaka474b94b2012-01-25 12:59:58 +05301901
Tianyi Gou41515e22011-09-01 19:37:43 -07001902static void __init apq8064_clock_init(void)
1903{
Tianyi Gouacb588d2012-01-27 18:24:05 -08001904 if (machine_is_apq8064_rumi3())
Tianyi Gou41515e22011-09-01 19:37:43 -07001905 msm_clock_init(&apq8064_dummy_clock_init_data);
Tianyi Gouacb588d2012-01-27 18:24:05 -08001906 else
1907 msm_clock_init(&apq8064_clock_init_data);
Tianyi Gou41515e22011-09-01 19:37:43 -07001908}
1909
Jing Lin417fa452012-02-05 14:31:06 -08001910#define I2C_SURF 1
1911#define I2C_FFA (1 << 1)
1912#define I2C_RUMI (1 << 2)
1913#define I2C_SIM (1 << 3)
1914#define I2C_LIQUID (1 << 4)
1915
1916struct i2c_registry {
1917 u8 machs;
1918 int bus;
1919 struct i2c_board_info *info;
1920 int len;
1921};
1922
1923static struct i2c_registry apq8064_i2c_devices[] __initdata = {
Jing Lin21ed4de2012-02-05 15:53:28 -08001924 {
1925 I2C_SURF | I2C_LIQUID,
1926 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
1927 mxt_device_info,
1928 ARRAY_SIZE(mxt_device_info),
1929 },
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001930 {
1931 I2C_FFA,
1932 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
1933 cyttsp_info,
1934 ARRAY_SIZE(cyttsp_info),
1935 },
Amy Maloche70090f992012-02-16 16:35:26 -08001936 {
1937 I2C_FFA | I2C_LIQUID,
1938 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
1939 isa1200_board_info,
1940 ARRAY_SIZE(isa1200_board_info),
1941 },
Jing Lin417fa452012-02-05 14:31:06 -08001942};
1943
1944static void __init register_i2c_devices(void)
1945{
1946 u8 mach_mask = 0;
1947 int i;
1948
Kevin Chand07220e2012-02-13 15:52:22 -08001949#ifdef CONFIG_MSM_CAMERA
1950 struct i2c_registry apq8064_camera_i2c_devices = {
1951 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_RUMI,
1952 APQ_8064_GSBI4_QUP_I2C_BUS_ID,
1953 apq8064_camera_board_info.board_info,
1954 apq8064_camera_board_info.num_i2c_board_info,
1955 };
1956#endif
Jing Lin417fa452012-02-05 14:31:06 -08001957 /* Build the matching 'supported_machs' bitmask */
1958 if (machine_is_apq8064_cdp())
1959 mach_mask = I2C_SURF;
1960 else if (machine_is_apq8064_mtp())
1961 mach_mask = I2C_FFA;
1962 else if (machine_is_apq8064_liquid())
1963 mach_mask = I2C_LIQUID;
1964 else if (machine_is_apq8064_rumi3())
1965 mach_mask = I2C_RUMI;
1966 else if (machine_is_apq8064_sim())
1967 mach_mask = I2C_SIM;
1968 else
1969 pr_err("unmatched machine ID in register_i2c_devices\n");
1970
1971 /* Run the array and install devices as appropriate */
1972 for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) {
1973 if (apq8064_i2c_devices[i].machs & mach_mask)
1974 i2c_register_board_info(apq8064_i2c_devices[i].bus,
1975 apq8064_i2c_devices[i].info,
1976 apq8064_i2c_devices[i].len);
1977 }
Kevin Chand07220e2012-02-13 15:52:22 -08001978#ifdef CONFIG_MSM_CAMERA
1979 if (apq8064_camera_i2c_devices.machs & mach_mask)
1980 i2c_register_board_info(apq8064_camera_i2c_devices.bus,
1981 apq8064_camera_i2c_devices.info,
1982 apq8064_camera_i2c_devices.len);
1983#endif
Jing Lin417fa452012-02-05 14:31:06 -08001984}
1985
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001986static void __init apq8064_common_init(void)
1987{
1988 if (socinfo_init() < 0)
1989 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06001990 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
1991 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
David Collins2782b5c2012-02-06 10:02:42 -08001992 regulator_suppress_info_printing();
1993 platform_device_register(&apq8064_device_rpm_regulator);
Stephen Boyd4d0d2582012-02-10 14:49:40 -08001994 if (msm_xo_init())
1995 pr_err("Failed to initialize XO votes\n");
Tianyi Gou41515e22011-09-01 19:37:43 -07001996 apq8064_clock_init();
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08001997 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06001998 apq8064_i2c_init();
Jing Lin417fa452012-02-05 14:31:06 -08001999 register_i2c_devices();
Kenneth Heitke36920d32011-07-20 16:44:30 -06002000
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002001 apq8064_device_qup_spi_gsbi5.dev.platform_data =
2002 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08002003 apq8064_init_pmic();
Hemant Kumar94e7da22012-02-03 16:52:29 -08002004 if (machine_is_apq8064_liquid())
2005 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002006 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Manu Gautam91223e02011-11-08 15:27:22 +05302007 apq8064_ehci_host_init();
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002008 apq8064_init_buses();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002009 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Hemant Kumarf1ca9192012-02-07 18:59:33 -08002010 if (machine_is_apq8064_mtp()) {
2011 apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
2012 device_initialize(&apq8064_device_hsic_host.dev);
2013 }
Jay Chokshie8741282012-01-25 15:22:55 -08002014 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05302015 apq8064_init_mmc();
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08002016
2017 if (machine_is_apq8064_mtp()) {
2018 mdm_8064_device.dev.platform_data = &mdm_platform_data;
2019 platform_device_register(&mdm_8064_device);
2020 }
2021 platform_device_register(&apq8064_slim_ctrl);
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002022 slim_register_board_info(apq8064_slim_devices,
2023 ARRAY_SIZE(apq8064_slim_devices));
Jin Hongd3024e62012-02-09 16:13:32 -08002024 apq8064_init_dsps();
Praveen Chidambaram78499012011-11-01 17:15:17 -06002025 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Mahesh Sivasubramaniancbce1ec2012-01-24 10:32:44 -07002026 acpuclk_init(&acpuclk_8064_soc_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002027 msm_spm_l2_init(msm_spm_l2_data);
2028 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2029 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2030 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2031 msm_pm_data);
2032 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002033}
2034
Huaibin Yang4a084e32011-12-15 15:25:52 -08002035static void __init apq8064_allocate_memory_regions(void)
2036{
2037 apq8064_allocate_fb_region();
2038}
2039
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002040static void __init apq8064_sim_init(void)
2041{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002042 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
2043 &msm8064_device_watchdog.dev.platform_data;
2044
2045 wdog_pdata->bark_time = 15000;
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002046 msm_tsens_early_init(&apq_tsens_pdata);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002047 apq8064_common_init();
Joel King4e7ad222011-08-17 15:47:38 -07002048 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
2049}
2050
2051static void __init apq8064_rumi3_init(void)
2052{
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002053 msm_tsens_early_init(&apq_tsens_pdata);
Joel King4e7ad222011-08-17 15:47:38 -07002054 apq8064_common_init();
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002055 ethernet_init();
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002056 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002057 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Huaibin Yang4a084e32011-12-15 15:25:52 -08002058 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07002059 apq8064_init_gpu();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002060}
2061
Joel King82b7e3f2012-01-05 10:03:27 -08002062static void __init apq8064_cdp_init(void)
2063{
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002064 msm_tsens_early_init(&apq_tsens_pdata);
Joel King82b7e3f2012-01-05 10:03:27 -08002065 apq8064_common_init();
2066 ethernet_init();
2067 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
2068 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002069 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07002070 apq8064_init_gpu();
Matt Wagantall1875d322012-02-22 16:11:33 -08002071 platform_add_devices(apq8064_fs_devices, apq8064_num_fs_devices);
Kevin Chand07220e2012-02-13 15:52:22 -08002072 apq8064_init_cam();
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302073
2074 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
2075 platform_device_register(&cdp_kp_pdev);
2076
2077 if (machine_is_apq8064_mtp())
2078 platform_device_register(&mtp_kp_pdev);
Joel King82b7e3f2012-01-05 10:03:27 -08002079}
2080
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002081MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
2082 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002083 .reserve = apq8064_reserve,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002084 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302085 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002086 .timer = &msm_timer,
2087 .init_machine = apq8064_sim_init,
2088MACHINE_END
2089
Joel King4e7ad222011-08-17 15:47:38 -07002090MACHINE_START(APQ8064_RUMI3, "QCT APQ8064 RUMI3")
2091 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002092 .reserve = apq8064_reserve,
Joel King4e7ad222011-08-17 15:47:38 -07002093 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302094 .handle_irq = gic_handle_irq,
Joel King4e7ad222011-08-17 15:47:38 -07002095 .timer = &msm_timer,
2096 .init_machine = apq8064_rumi3_init,
Huaibin Yang4a084e32011-12-15 15:25:52 -08002097 .init_early = apq8064_allocate_memory_regions,
Joel King4e7ad222011-08-17 15:47:38 -07002098MACHINE_END
2099
Joel King82b7e3f2012-01-05 10:03:27 -08002100MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
2101 .map_io = apq8064_map_io,
2102 .reserve = apq8064_reserve,
2103 .init_irq = apq8064_init_irq,
2104 .handle_irq = gic_handle_irq,
2105 .timer = &msm_timer,
2106 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002107 .init_early = apq8064_allocate_memory_regions,
Joel King82b7e3f2012-01-05 10:03:27 -08002108MACHINE_END
2109
2110MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
2111 .map_io = apq8064_map_io,
2112 .reserve = apq8064_reserve,
2113 .init_irq = apq8064_init_irq,
2114 .handle_irq = gic_handle_irq,
2115 .timer = &msm_timer,
2116 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002117 .init_early = apq8064_allocate_memory_regions,
Joel King82b7e3f2012-01-05 10:03:27 -08002118MACHINE_END
2119
2120MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
2121 .map_io = apq8064_map_io,
2122 .reserve = apq8064_reserve,
2123 .init_irq = apq8064_init_irq,
2124 .handle_irq = gic_handle_irq,
2125 .timer = &msm_timer,
2126 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002127 .init_early = apq8064_allocate_memory_regions,
Joel King82b7e3f2012-01-05 10:03:27 -08002128MACHINE_END
2129
Joel King11ca8202012-02-13 16:19:03 -08002130MACHINE_START(MPQ8064_HRD, "QCT MPQ8064 HRD")
2131 .map_io = apq8064_map_io,
2132 .reserve = apq8064_reserve,
2133 .init_irq = apq8064_init_irq,
2134 .handle_irq = gic_handle_irq,
2135 .timer = &msm_timer,
2136 .init_machine = apq8064_cdp_init,
2137MACHINE_END
2138
2139MACHINE_START(MPQ8064_DTV, "QCT MPQ8064 DTV")
2140 .map_io = apq8064_map_io,
2141 .reserve = apq8064_reserve,
2142 .init_irq = apq8064_init_irq,
2143 .handle_irq = gic_handle_irq,
2144 .timer = &msm_timer,
2145 .init_machine = apq8064_cdp_init,
2146MACHINE_END
2147