blob: df20d6026375f97afb5162c80be7268d0f28a713 [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>
David Keitel2f613d92012-02-15 11:29:16 -080018#include <linux/i2c/smb349.h>
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -080019#include <linux/i2c/sx150x.h>
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -060020#include <linux/slimbus/slimbus.h>
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +053021#include <linux/mfd/wcd9xxx/core.h>
22#include <linux/mfd/wcd9xxx/pdata.h>
Amy Maloche70090f992012-02-16 16:35:26 -080023#include <linux/mfd/pm8xxx/misc.h>
Kenneth Heitke36920d32011-07-20 16:44:30 -060024#include <linux/msm_ssbi.h>
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -070025#include <linux/spi/spi.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070026#include <linux/dma-mapping.h>
27#include <linux/platform_data/qcom_crypto_device.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080028#include <linux/ion.h>
Jack Cheung46bfffa2012-01-19 15:26:24 -080029#include <linux/memory.h>
Jing Lin21ed4de2012-02-05 15:53:28 -080030#include <linux/i2c/atmel_mxt_ts.h>
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -080031#include <linux/cyttsp.h>
Amy Maloche70090f992012-02-16 16:35:26 -080032#include <linux/i2c/isa1200.h>
Mohan Pallaka474b94b2012-01-25 12:59:58 +053033#include <linux/gpio_keys.h>
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -080034#include <linux/epm_adc.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070035#include <asm/mach-types.h>
36#include <asm/mach/arch.h>
37#include <asm/hardware/gic.h>
Sahitya Tummala3586ed92011-08-03 09:13:23 +053038#include <asm/mach/mmc.h>
Ankit Verma6b7e2ba2012-01-26 15:48:54 -080039#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070040
41#include <mach/board.h>
42#include <mach/msm_iomap.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080043#include <mach/ion.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070044#include <linux/usb/msm_hsusb.h>
45#include <linux/usb/android.h>
46#include <mach/socinfo.h>
Harini Jayaramanc4c58692011-07-19 14:50:10 -060047#include <mach/msm_spi.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070048#include "timer.h"
49#include "devices.h"
Joel King4ebccc62011-07-22 09:43:22 -070050#include <mach/gpio.h>
51#include <mach/gpiomux.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060052#include <mach/rpm.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080053#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -070054#include <linux/android_pmem.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080055#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070056#include <mach/msm_memtypes.h>
57#include <linux/bootmem.h>
58#include <asm/setup.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070059#include <mach/dma.h>
Jin Hongd3024e62012-02-09 16:13:32 -080060#include <mach/msm_dsps.h>
Gagan Mac8a7a5d32011-11-11 16:43:06 -070061#include <mach/msm_bus_board.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060062#include <mach/cpuidle.h>
Joel Kingdacbc822012-01-25 13:30:57 -080063#include <mach/mdm2.h>
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -080064#include <linux/msm_tsens.h>
Stephen Boyd4d0d2582012-02-10 14:49:40 -080065#include <mach/msm_xo.h>
Laura Abbott350c8362012-02-28 14:46:52 -080066#include <mach/msm_rtb.h>
Joel King4ebccc62011-07-22 09:43:22 -070067
Jeff Ohlstein7e668552011-10-06 16:17:25 -070068#include "msm_watchdog.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080069#include "board-8064.h"
Vikram Mulukutlabc2e9572011-11-04 03:41:38 -070070#include "acpuclock.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060071#include "spm.h"
72#include "mpm.h"
73#include "rpm_resources.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080074#include "pm.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060075#include "pm-boot.h"
Rajesh Sastrulaaee8af32012-01-20 11:46:31 -080076#include "devices-msm8x60.h"
Jay Chokshiea67c622011-07-29 17:12:26 -070077
Olav Haugan7c6aa742012-01-16 16:47:37 -080078#define MSM_PMEM_ADSP_SIZE 0x7800000
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -070079#define MSM_PMEM_AUDIO_SIZE 0x4CF000
Olav Haugan7c6aa742012-01-16 16:47:37 -080080#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
81#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
82#else
Chetan Kalyan72aac4f2012-02-23 14:56:54 -080083#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Olav Haugan7c6aa742012-01-16 16:47:37 -080084#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070085
Olav Haugan7c6aa742012-01-16 16:47:37 -080086#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -070087#define MSM_PMEM_KERNEL_EBI1_SIZE 0x65000
Olav Haugan7c6aa742012-01-16 16:47:37 -080088#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Haugand3d29682012-01-19 10:57:07 -080089#define MSM_ION_MM_FW_SIZE 0x200000 /* (2MB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -080090#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Haugan3a9bd232012-02-15 14:23:27 -080091#define MSM_ION_QSECOM_SIZE 0x300000 /* (3MB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -080092#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan2c43fac2012-01-19 11:06:37 -080093#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
94#define MSM_ION_HEAP_NUM 8
Olav Haugan7c6aa742012-01-16 16:47:37 -080095#else
96#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
97#define MSM_ION_HEAP_NUM 1
98#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070099
Siddartha Mohanadoss9c658982012-02-28 15:11:48 -0800100#define GPIO_EXPANDER_IRQ_BASE (PM8821_IRQ_BASE + PM8821_NR_IRQS)
101#define GPIO_EXPANDER_GPIO_BASE (PM8821_MPP_BASE + PM8821_NR_MPPS)
102#define GPIO_EPM_EXPANDER_BASE GPIO_EXPANDER_GPIO_BASE
103
104enum {
105 SX150X_EPM,
106};
107
Olav Haugan7c6aa742012-01-16 16:47:37 -0800108#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
109static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
110static int __init pmem_kernel_ebi1_size_setup(char *p)
Kevin Chan13be4e22011-10-20 11:30:32 -0700111{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800112 pmem_kernel_ebi1_size = memparse(p, NULL);
113 return 0;
Kevin Chan13be4e22011-10-20 11:30:32 -0700114}
Olav Haugan7c6aa742012-01-16 16:47:37 -0800115early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
116#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700117
Olav Haugan7c6aa742012-01-16 16:47:37 -0800118#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -0700119static unsigned pmem_size = MSM_PMEM_SIZE;
120static int __init pmem_size_setup(char *p)
121{
122 pmem_size = memparse(p, NULL);
123 return 0;
124}
125early_param("pmem_size", pmem_size_setup);
126
127static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
128
129static int __init pmem_adsp_size_setup(char *p)
130{
131 pmem_adsp_size = memparse(p, NULL);
132 return 0;
133}
134early_param("pmem_adsp_size", pmem_adsp_size_setup);
135
136static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
137
138static int __init pmem_audio_size_setup(char *p)
139{
140 pmem_audio_size = memparse(p, NULL);
141 return 0;
142}
143early_param("pmem_audio_size", pmem_audio_size_setup);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800144#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700145
Olav Haugan7c6aa742012-01-16 16:47:37 -0800146#ifdef CONFIG_ANDROID_PMEM
147#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700148static struct android_pmem_platform_data android_pmem_pdata = {
149 .name = "pmem",
150 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
151 .cached = 1,
152 .memory_type = MEMTYPE_EBI1,
153};
154
155static struct platform_device android_pmem_device = {
156 .name = "android_pmem",
157 .id = 0,
158 .dev = {.platform_data = &android_pmem_pdata},
159};
160
161static struct android_pmem_platform_data android_pmem_adsp_pdata = {
162 .name = "pmem_adsp",
163 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
164 .cached = 0,
165 .memory_type = MEMTYPE_EBI1,
166};
Kevin Chan13be4e22011-10-20 11:30:32 -0700167static struct platform_device android_pmem_adsp_device = {
168 .name = "android_pmem",
169 .id = 2,
170 .dev = { .platform_data = &android_pmem_adsp_pdata },
171};
172
173static struct android_pmem_platform_data android_pmem_audio_pdata = {
174 .name = "pmem_audio",
175 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
176 .cached = 0,
177 .memory_type = MEMTYPE_EBI1,
178};
179
180static struct platform_device android_pmem_audio_device = {
181 .name = "android_pmem",
182 .id = 4,
183 .dev = { .platform_data = &android_pmem_audio_pdata },
184};
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700185#endif /* CONFIG_MSM_MULTIMEDIA_USE_ION */
186#endif /* CONFIG_ANDROID_PMEM */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800187
188static struct memtype_reserve apq8064_reserve_table[] __initdata = {
189 [MEMTYPE_SMI] = {
190 },
191 [MEMTYPE_EBI0] = {
192 .flags = MEMTYPE_FLAGS_1M_ALIGN,
193 },
194 [MEMTYPE_EBI1] = {
195 .flags = MEMTYPE_FLAGS_1M_ALIGN,
196 },
197};
Kevin Chan13be4e22011-10-20 11:30:32 -0700198
Laura Abbott350c8362012-02-28 14:46:52 -0800199#if defined(CONFIG_MSM_RTB)
200static struct msm_rtb_platform_data msm_rtb_pdata = {
201 .size = SZ_1M,
202};
203
204static int __init msm_rtb_set_buffer_size(char *p)
205{
206 int s;
207
208 s = memparse(p, NULL);
209 msm_rtb_pdata.size = ALIGN(s, SZ_4K);
210 return 0;
211}
212early_param("msm_rtb_size", msm_rtb_set_buffer_size);
213
214
215static struct platform_device msm_rtb_device = {
216 .name = "msm_rtb",
217 .id = -1,
218 .dev = {
219 .platform_data = &msm_rtb_pdata,
220 },
221};
222#endif
223
224static void __init reserve_rtb_memory(void)
225{
226#if defined(CONFIG_MSM_RTB)
227 apq8064_reserve_table[MEMTYPE_EBI1].size += msm_rtb_pdata.size;
228#endif
229}
230
231
Kevin Chan13be4e22011-10-20 11:30:32 -0700232static void __init size_pmem_devices(void)
233{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800234#ifdef CONFIG_ANDROID_PMEM
235#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700236 android_pmem_adsp_pdata.size = pmem_adsp_size;
237 android_pmem_pdata.size = pmem_size;
238 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700239#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
240#endif /*CONFIG_ANDROID_PMEM*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700241}
242
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700243#ifdef CONFIG_ANDROID_PMEM
244#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700245static void __init reserve_memory_for(struct android_pmem_platform_data *p)
246{
247 apq8064_reserve_table[p->memory_type].size += p->size;
248}
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700249#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
250#endif /*CONFIG_ANDROID_PMEM*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700251
Kevin Chan13be4e22011-10-20 11:30:32 -0700252static void __init reserve_pmem_memory(void)
253{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800254#ifdef CONFIG_ANDROID_PMEM
255#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700256 reserve_memory_for(&android_pmem_adsp_pdata);
257 reserve_memory_for(&android_pmem_pdata);
258 reserve_memory_for(&android_pmem_audio_pdata);
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700259#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
Kevin Chan13be4e22011-10-20 11:30:32 -0700260 apq8064_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700261#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -0800262}
263
264static int apq8064_paddr_to_memtype(unsigned int paddr)
265{
266 return MEMTYPE_EBI1;
267}
268
269#ifdef CONFIG_ION_MSM
270#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
271static struct ion_cp_heap_pdata cp_mm_ion_pdata = {
272 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugand3d29682012-01-19 10:57:07 -0800273 .align = PAGE_SIZE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800274};
275
276static struct ion_cp_heap_pdata cp_mfc_ion_pdata = {
277 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugand3d29682012-01-19 10:57:07 -0800278 .align = PAGE_SIZE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800279};
280
281static struct ion_co_heap_pdata co_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800282 .adjacent_mem_id = INVALID_HEAP_ID,
283 .align = PAGE_SIZE,
284};
285
286static struct ion_co_heap_pdata fw_co_ion_pdata = {
287 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
288 .align = SZ_128K,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800289};
290#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800291
292/**
293 * These heaps are listed in the order they will be allocated. Due to
294 * video hardware restrictions and content protection the FW heap has to
295 * be allocated adjacent (below) the MM heap and the MFC heap has to be
296 * allocated after the MM heap to ensure MFC heap is not more than 256MB
297 * away from the base address of the FW heap.
298 * However, the order of FW heap and MM heap doesn't matter since these
299 * two heaps are taken care of by separate code to ensure they are adjacent
300 * to each other.
301 * Don't swap the order unless you know what you are doing!
302 */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800303static struct ion_platform_data ion_pdata = {
304 .nr = MSM_ION_HEAP_NUM,
305 .heaps = {
306 {
307 .id = ION_SYSTEM_HEAP_ID,
308 .type = ION_HEAP_TYPE_SYSTEM,
309 .name = ION_VMALLOC_HEAP_NAME,
310 },
311#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
312 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800313 .id = ION_CP_MM_HEAP_ID,
314 .type = ION_HEAP_TYPE_CP,
315 .name = ION_MM_HEAP_NAME,
316 .size = MSM_ION_MM_SIZE,
317 .memory_type = ION_EBI_TYPE,
318 .extra_data = (void *) &cp_mm_ion_pdata,
319 },
320 {
Olav Haugand3d29682012-01-19 10:57:07 -0800321 .id = ION_MM_FIRMWARE_HEAP_ID,
322 .type = ION_HEAP_TYPE_CARVEOUT,
323 .name = ION_MM_FIRMWARE_HEAP_NAME,
324 .size = MSM_ION_MM_FW_SIZE,
325 .memory_type = ION_EBI_TYPE,
326 .extra_data = (void *) &fw_co_ion_pdata,
327 },
328 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800329 .id = ION_CP_MFC_HEAP_ID,
330 .type = ION_HEAP_TYPE_CP,
331 .name = ION_MFC_HEAP_NAME,
332 .size = MSM_ION_MFC_SIZE,
333 .memory_type = ION_EBI_TYPE,
334 .extra_data = (void *) &cp_mfc_ion_pdata,
335 },
336 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800337 .id = ION_SF_HEAP_ID,
338 .type = ION_HEAP_TYPE_CARVEOUT,
339 .name = ION_SF_HEAP_NAME,
340 .size = MSM_ION_SF_SIZE,
341 .memory_type = ION_EBI_TYPE,
342 .extra_data = (void *) &co_ion_pdata,
343 },
344 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800345 .id = ION_IOMMU_HEAP_ID,
346 .type = ION_HEAP_TYPE_IOMMU,
347 .name = ION_IOMMU_HEAP_NAME,
348 },
Olav Hauganf45e2142012-01-19 11:01:01 -0800349 {
350 .id = ION_QSECOM_HEAP_ID,
351 .type = ION_HEAP_TYPE_CARVEOUT,
352 .name = ION_QSECOM_HEAP_NAME,
353 .size = MSM_ION_QSECOM_SIZE,
354 .memory_type = ION_EBI_TYPE,
355 .extra_data = (void *) &co_ion_pdata,
356 },
Olav Haugan2c43fac2012-01-19 11:06:37 -0800357 {
358 .id = ION_AUDIO_HEAP_ID,
359 .type = ION_HEAP_TYPE_CARVEOUT,
360 .name = ION_AUDIO_HEAP_NAME,
361 .size = MSM_ION_AUDIO_SIZE,
362 .memory_type = ION_EBI_TYPE,
363 .extra_data = (void *) &co_ion_pdata,
364 },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800365#endif
366 }
367};
368
369static struct platform_device ion_dev = {
370 .name = "ion-msm",
371 .id = 1,
372 .dev = { .platform_data = &ion_pdata },
373};
374#endif
375
376static void reserve_ion_memory(void)
377{
378#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
379 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_SIZE;
Olav Haugand3d29682012-01-19 10:57:07 -0800380 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_FW_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800381 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_SF_SIZE;
382 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MFC_SIZE;
Olav Hauganf45e2142012-01-19 11:01:01 -0800383 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_QSECOM_SIZE;
Olav Haugan2c43fac2012-01-19 11:06:37 -0800384 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_AUDIO_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800385#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700386}
387
Huaibin Yang4a084e32011-12-15 15:25:52 -0800388static void __init reserve_mdp_memory(void)
389{
390 apq8064_mdp_writeback(apq8064_reserve_table);
391}
392
Kevin Chan13be4e22011-10-20 11:30:32 -0700393static void __init apq8064_calculate_reserve_sizes(void)
394{
395 size_pmem_devices();
396 reserve_pmem_memory();
Olav Haugan7c6aa742012-01-16 16:47:37 -0800397 reserve_ion_memory();
Huaibin Yang4a084e32011-12-15 15:25:52 -0800398 reserve_mdp_memory();
Laura Abbott350c8362012-02-28 14:46:52 -0800399 reserve_rtb_memory();
Kevin Chan13be4e22011-10-20 11:30:32 -0700400}
401
402static struct reserve_info apq8064_reserve_info __initdata = {
403 .memtype_reserve_table = apq8064_reserve_table,
404 .calculate_reserve_sizes = apq8064_calculate_reserve_sizes,
405 .paddr_to_memtype = apq8064_paddr_to_memtype,
406};
407
408static int apq8064_memory_bank_size(void)
409{
410 return 1<<29;
411}
412
413static void __init locate_unstable_memory(void)
414{
415 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
416 unsigned long bank_size;
417 unsigned long low, high;
418
419 bank_size = apq8064_memory_bank_size();
420 low = meminfo.bank[0].start;
421 high = mb->start + mb->size;
Olav Haugand76e3a82012-01-16 16:55:07 -0800422
423 /* Check if 32 bit overflow occured */
424 if (high < mb->start)
425 high = ~0UL;
426
Kevin Chan13be4e22011-10-20 11:30:32 -0700427 low &= ~(bank_size - 1);
428
429 if (high - low <= bank_size)
430 return;
Jack Cheung46bfffa2012-01-19 15:26:24 -0800431 apq8064_reserve_info.low_unstable_address = mb->start -
432 MIN_MEMORY_BLOCK_SIZE + mb->size;
433 apq8064_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
434
Kevin Chan13be4e22011-10-20 11:30:32 -0700435 apq8064_reserve_info.bank_size = bank_size;
436 pr_info("low unstable address %lx max size %lx bank size %lx\n",
437 apq8064_reserve_info.low_unstable_address,
438 apq8064_reserve_info.max_unstable_size,
439 apq8064_reserve_info.bank_size);
440}
441
Aravind Venkateswaran8ac7f412012-03-16 17:57:30 -0700442static char prim_panel_name[PANEL_NAME_MAX_LEN];
443static char ext_panel_name[PANEL_NAME_MAX_LEN];
444static int __init prim_display_setup(char *param)
445{
446 if (strnlen(param, PANEL_NAME_MAX_LEN))
447 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
448 return 0;
449}
450early_param("prim_display", prim_display_setup);
451
452static int __init ext_display_setup(char *param)
453{
454 if (strnlen(param, PANEL_NAME_MAX_LEN))
455 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
456 return 0;
457}
458early_param("ext_display", ext_display_setup);
459
Kevin Chan13be4e22011-10-20 11:30:32 -0700460static void __init apq8064_reserve(void)
461{
Aravind Venkateswaran8ac7f412012-03-16 17:57:30 -0700462 apq8064_set_display_params(prim_panel_name, ext_panel_name);
Kevin Chan13be4e22011-10-20 11:30:32 -0700463 msm_reserve();
464}
465
Laura Abbott6988cef2012-03-15 14:27:13 -0700466static void __init place_movable_zone(void)
467{
468 movable_reserved_start = apq8064_reserve_info.low_unstable_address;
469 movable_reserved_size = apq8064_reserve_info.max_unstable_size;
470 pr_info("movable zone start %lx size %lx\n",
471 movable_reserved_start, movable_reserved_size);
472}
473
474static void __init apq8064_early_reserve(void)
475{
476 reserve_info = &apq8064_reserve_info;
477 locate_unstable_memory();
478 place_movable_zone();
479
480}
Hemant Kumara945b472012-01-25 15:08:06 -0800481#ifdef CONFIG_USB_EHCI_MSM_HSIC
482static struct msm_hsic_host_platform_data msm_hsic_pdata = {
483 .strobe = 88,
484 .data = 89,
485};
486#else
487static struct msm_hsic_host_platform_data msm_hsic_pdata;
488#endif
489
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800490#define PID_MAGIC_ID 0x71432909
491#define SERIAL_NUM_MAGIC_ID 0x61945374
492#define SERIAL_NUMBER_LENGTH 127
493#define DLOAD_USB_BASE_ADD 0x2A03F0C8
494
495struct magic_num_struct {
496 uint32_t pid;
497 uint32_t serial_num;
498};
499
500struct dload_struct {
501 uint32_t reserved1;
502 uint32_t reserved2;
503 uint32_t reserved3;
504 uint16_t reserved4;
505 uint16_t pid;
506 char serial_number[SERIAL_NUMBER_LENGTH];
507 uint16_t reserved5;
508 struct magic_num_struct magic_struct;
509};
510
511static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
512{
513 struct dload_struct __iomem *dload = 0;
514
515 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
516 if (!dload) {
517 pr_err("%s: cannot remap I/O memory region: %08x\n",
518 __func__, DLOAD_USB_BASE_ADD);
519 return -ENXIO;
520 }
521
522 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
523 __func__, dload, pid, snum);
524 /* update pid */
525 dload->magic_struct.pid = PID_MAGIC_ID;
526 dload->pid = pid;
527
528 /* update serial number */
529 dload->magic_struct.serial_num = 0;
530 if (!snum) {
531 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
532 goto out;
533 }
534
535 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
536 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
537out:
538 iounmap(dload);
539 return 0;
540}
541
542static struct android_usb_platform_data android_usb_pdata = {
543 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
544};
545
Hemant Kumar4933b072011-10-17 23:43:11 -0700546static struct platform_device android_usb_device = {
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800547 .name = "android_usb",
548 .id = -1,
549 .dev = {
550 .platform_data = &android_usb_pdata,
551 },
Hemant Kumar4933b072011-10-17 23:43:11 -0700552};
553
Hemant Kumar7620eed2012-02-26 09:08:43 -0800554/* Bandwidth requests (zero) if no vote placed */
555static struct msm_bus_vectors usb_init_vectors[] = {
556 {
557 .src = MSM_BUS_MASTER_SPS,
558 .dst = MSM_BUS_SLAVE_EBI_CH0,
559 .ab = 0,
560 .ib = 0,
561 },
562};
563
564/* Bus bandwidth requests in Bytes/sec */
565static struct msm_bus_vectors usb_max_vectors[] = {
566 {
567 .src = MSM_BUS_MASTER_SPS,
568 .dst = MSM_BUS_SLAVE_EBI_CH0,
569 .ab = 60000000, /* At least 480Mbps on bus. */
570 .ib = 960000000, /* MAX bursts rate */
571 },
572};
573
574static struct msm_bus_paths usb_bus_scale_usecases[] = {
575 {
576 ARRAY_SIZE(usb_init_vectors),
577 usb_init_vectors,
578 },
579 {
580 ARRAY_SIZE(usb_max_vectors),
581 usb_max_vectors,
582 },
583};
584
585static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
586 usb_bus_scale_usecases,
587 ARRAY_SIZE(usb_bus_scale_usecases),
588 .name = "usb",
589};
590
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700591static int phy_init_seq[] = {
592 0x38, 0x81, /* update DC voltage level */
593 0x24, 0x82, /* set pre-emphasis and rise/fall time */
594 -1
595};
596
Hemant Kumar4933b072011-10-17 23:43:11 -0700597static struct msm_otg_platform_data msm_otg_pdata = {
Hemant Kumard86c4882012-01-24 19:39:37 -0800598 .mode = USB_OTG,
599 .otg_control = OTG_PMIC_CONTROL,
Hemant Kumar4933b072011-10-17 23:43:11 -0700600 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Hemant Kumard86c4882012-01-24 19:39:37 -0800601 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
602 .power_budget = 750,
Hemant Kumar7620eed2012-02-26 09:08:43 -0800603 .bus_scale_table = &usb_bus_scale_pdata,
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700604 .phy_init_seq = phy_init_seq,
Hemant Kumar4933b072011-10-17 23:43:11 -0700605};
606
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800607static struct msm_usb_host_platform_data msm_ehci_host_pdata3 = {
Manu Gautam91223e02011-11-08 15:27:22 +0530608 .power_budget = 500,
609};
610
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800611#ifdef CONFIG_USB_EHCI_MSM_HOST4
612static struct msm_usb_host_platform_data msm_ehci_host_pdata4;
613#endif
614
Manu Gautam91223e02011-11-08 15:27:22 +0530615static void __init apq8064_ehci_host_init(void)
616{
617 if (machine_is_apq8064_liquid()) {
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800618 msm_ehci_host_pdata3.dock_connect_irq =
Hemant Kumar56925352012-02-13 16:59:52 -0800619 PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9);
620
Manu Gautam91223e02011-11-08 15:27:22 +0530621 apq8064_device_ehci_host3.dev.platform_data =
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800622 &msm_ehci_host_pdata3;
Manu Gautam91223e02011-11-08 15:27:22 +0530623 platform_device_register(&apq8064_device_ehci_host3);
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800624
625#ifdef CONFIG_USB_EHCI_MSM_HOST4
626 apq8064_device_ehci_host4.dev.platform_data =
627 &msm_ehci_host_pdata4;
628 platform_device_register(&apq8064_device_ehci_host4);
629#endif
Manu Gautam91223e02011-11-08 15:27:22 +0530630 }
631}
632
David Keitel2f613d92012-02-15 11:29:16 -0800633static struct smb349_platform_data smb349_data __initdata = {
634 .en_n_gpio = PM8921_GPIO_PM_TO_SYS(37),
635 .chg_susp_gpio = PM8921_GPIO_PM_TO_SYS(30),
636 .chg_current_ma = 2200,
637};
638
639static struct i2c_board_info smb349_charger_i2c_info[] __initdata = {
640 {
641 I2C_BOARD_INFO(SMB349_NAME, 0x1B),
642 .platform_data = &smb349_data,
643 },
644};
645
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -0800646struct sx150x_platform_data apq8064_sx150x_data[] = {
647 [SX150X_EPM] = {
648 .gpio_base = GPIO_EPM_EXPANDER_BASE,
649 .oscio_is_gpo = false,
650 .io_pullup_ena = 0x0,
651 .io_pulldn_ena = 0x0,
652 .io_open_drain_ena = 0x0,
653 .io_polarity = 0,
654 .irq_summary = -1,
655 },
656};
657
658static struct epm_chan_properties ads_adc_channel_data[] = {
659 {10, 100}, {500, 50}, {1, 1}, {1, 1},
660 {20, 50}, {10, 100}, {1, 1}, {1, 1},
661 {10, 100}, {10, 100}, {100, 100}, {200, 100},
662 {100, 50}, {2000, 50}, {1000, 50}, {200, 50},
663 {200, 100}, {1, 1}, {20, 50}, {500, 50},
664 {50, 50}, {200, 100}, {500, 100}, {20, 50},
665 {200, 50}, {2000, 100}, {1000, 50}, {100, 50},
666 {200, 100}, {500, 50}, {1000, 100}, {200, 50},
667 {1000, 50}, {50, 50}, {100, 50}, {100, 50},
668 {1, 1}, {1, 1}, {20, 100}, {20, 50},
669 {500, 100}, {1000, 100}, {100, 50}, {1000, 50},
670 {100, 50}, {1000, 100}, {100, 50}, {100, 50},
671};
672
673static struct epm_adc_platform_data epm_adc_pdata = {
674 .channel = ads_adc_channel_data,
675 .bus_id = 0x0,
676 .epm_i2c_board_info = {
677 .type = "sx1509q",
678 .addr = 0x3e,
679 .platform_data = &apq8064_sx150x_data[SX150X_EPM],
680 },
681 .gpio_expander_base_addr = GPIO_EPM_EXPANDER_BASE,
682};
683
684static struct platform_device epm_adc_device = {
685 .name = "epm_adc",
686 .id = -1,
687 .dev = {
688 .platform_data = &epm_adc_pdata,
689 },
690};
691
692static void __init apq8064_epm_adc_init(void)
693{
694 epm_adc_pdata.num_channels = 32;
695 epm_adc_pdata.num_adc = 2;
696 epm_adc_pdata.chan_per_adc = 16;
697 epm_adc_pdata.chan_per_mux = 8;
698};
699
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800700/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
701 * 4 micbiases are used to power various analog and digital
702 * microphones operating at 1800 mV. Technically, all micbiases
703 * can source from single cfilter since all microphones operate
704 * at the same voltage level. The arrangement below is to make
705 * sure all cfilters are exercised. LDO_H regulator ouput level
706 * does not need to be as high as 2.85V. It is choosen for
707 * microphone sensitivity purpose.
708 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530709static struct wcd9xxx_pdata apq8064_tabla_platform_data = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800710 .slimbus_slave_device = {
711 .name = "tabla-slave",
712 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
713 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800714 .irq = MSM_GPIO_TO_INT(42),
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800715 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530716 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800717 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
718 .micbias = {
719 .ldoh_v = TABLA_LDOH_2P85_V,
720 .cfilt1_mv = 1800,
721 .cfilt2_mv = 1800,
722 .cfilt3_mv = 1800,
723 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
724 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
725 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
726 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530727 },
728 .regulator = {
729 {
730 .name = "CDC_VDD_CP",
731 .min_uV = 1800000,
732 .max_uV = 1800000,
733 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
734 },
735 {
736 .name = "CDC_VDDA_RX",
737 .min_uV = 1800000,
738 .max_uV = 1800000,
739 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
740 },
741 {
742 .name = "CDC_VDDA_TX",
743 .min_uV = 1800000,
744 .max_uV = 1800000,
745 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
746 },
747 {
748 .name = "VDDIO_CDC",
749 .min_uV = 1800000,
750 .max_uV = 1800000,
751 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
752 },
753 {
754 .name = "VDDD_CDC_D",
755 .min_uV = 1225000,
756 .max_uV = 1225000,
757 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
758 },
759 {
760 .name = "CDC_VDDA_A_1P2V",
761 .min_uV = 1225000,
762 .max_uV = 1225000,
763 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
764 },
765 },
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800766};
767
768static struct slim_device apq8064_slim_tabla = {
769 .name = "tabla-slim",
770 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
771 .dev = {
772 .platform_data = &apq8064_tabla_platform_data,
773 },
774};
775
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530776static struct wcd9xxx_pdata apq8064_tabla20_platform_data = {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800777 .slimbus_slave_device = {
778 .name = "tabla-slave",
779 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
780 },
781 .irq = MSM_GPIO_TO_INT(42),
782 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530783 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800784 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
785 .micbias = {
786 .ldoh_v = TABLA_LDOH_2P85_V,
787 .cfilt1_mv = 1800,
788 .cfilt2_mv = 1800,
789 .cfilt3_mv = 1800,
790 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
791 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
792 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
793 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530794 },
795 .regulator = {
796 {
797 .name = "CDC_VDD_CP",
798 .min_uV = 1800000,
799 .max_uV = 1800000,
800 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
801 },
802 {
803 .name = "CDC_VDDA_RX",
804 .min_uV = 1800000,
805 .max_uV = 1800000,
806 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
807 },
808 {
809 .name = "CDC_VDDA_TX",
810 .min_uV = 1800000,
811 .max_uV = 1800000,
812 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
813 },
814 {
815 .name = "VDDIO_CDC",
816 .min_uV = 1800000,
817 .max_uV = 1800000,
818 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
819 },
820 {
821 .name = "VDDD_CDC_D",
822 .min_uV = 1225000,
823 .max_uV = 1225000,
824 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
825 },
826 {
827 .name = "CDC_VDDA_A_1P2V",
828 .min_uV = 1225000,
829 .max_uV = 1225000,
830 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
831 },
832 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800833};
834
835static struct slim_device apq8064_slim_tabla20 = {
836 .name = "tabla2x-slim",
837 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
838 .dev = {
839 .platform_data = &apq8064_tabla20_platform_data,
840 },
841};
842
Amy Maloche70090f992012-02-16 16:35:26 -0800843#define HAP_SHIFT_LVL_OE_GPIO PM8921_MPP_PM_TO_SYS(8)
844#define ISA1200_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
845#define ISA1200_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
846#define ISA1200_HAP_CLK PM8921_GPIO_PM_TO_SYS(44)
847
848static int isa1200_power(int on)
849{
850 gpio_set_value_cansleep(ISA1200_HAP_CLK, !!on);
851
852 return 0;
853}
854
855static int isa1200_dev_setup(bool enable)
856{
857 int rc = 0;
858
859 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_1, enable);
860 if (rc) {
861 pr_err("%s: unable to write aux clock register(%d)\n",
862 __func__, rc);
863 return rc;
864 }
865
866 if (!enable)
867 goto free_gpio;
868
869 rc = gpio_request(ISA1200_HAP_CLK, "haptics_clk");
870 if (rc) {
871 pr_err("%s: unable to request gpio %d config(%d)\n",
872 __func__, ISA1200_HAP_CLK, rc);
873 return rc;
874 }
875
876 rc = gpio_direction_output(ISA1200_HAP_CLK, 0);
877 if (rc) {
878 pr_err("%s: unable to set direction\n", __func__);
879 goto free_gpio;
880 }
881
882 return 0;
883
884free_gpio:
885 gpio_free(ISA1200_HAP_CLK);
886 return rc;
887}
888
889static struct isa1200_regulator isa1200_reg_data[] = {
890 {
891 .name = "vddp",
892 .min_uV = ISA_I2C_VTG_MIN_UV,
893 .max_uV = ISA_I2C_VTG_MAX_UV,
894 .load_uA = ISA_I2C_CURR_UA,
895 },
896};
897
898static struct isa1200_platform_data isa1200_1_pdata = {
899 .name = "vibrator",
900 .dev_setup = isa1200_dev_setup,
901 .power_on = isa1200_power,
902 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
903 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
904 .max_timeout = 15000,
905 .mode_ctrl = PWM_GEN_MODE,
906 .pwm_fd = {
907 .pwm_div = 256,
908 },
909 .is_erm = false,
910 .smart_en = true,
911 .ext_clk_en = true,
912 .chip_en = 1,
913 .regulator_info = isa1200_reg_data,
914 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
915};
916
917static struct i2c_board_info isa1200_board_info[] __initdata = {
918 {
919 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
920 .platform_data = &isa1200_1_pdata,
921 },
922};
Jing Lin21ed4de2012-02-05 15:53:28 -0800923/* configuration data for mxt1386e using V2.1 firmware */
924static const u8 mxt1386e_config_data_v2_1[] = {
925 /* T6 Object */
926 0, 0, 0, 0, 0, 0,
927 /* T38 Object */
Jing Linf1208fd2012-02-23 11:15:42 -0800928 14, 1, 0, 22, 2, 12, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800929 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
930 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
931 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
932 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
933 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
934 0, 0, 0, 0,
935 /* T7 Object */
Jing Linf1208fd2012-02-23 11:15:42 -0800936 100, 10, 50,
Jing Lin21ed4de2012-02-05 15:53:28 -0800937 /* T8 Object */
Jing Linf1208fd2012-02-23 11:15:42 -0800938 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800939 /* T9 Object */
940 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
941 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
Jing Linf1208fd2012-02-23 11:15:42 -0800942 85, 5, 0, 5, 9, 5, 12, 35, 70, 40,
943 20, 5, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800944 /* T18 Object */
945 0, 0,
946 /* T24 Object */
947 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
948 0, 0, 0, 0, 0, 0, 0, 0, 0,
949 /* T25 Object */
950 3, 0, 60, 115, 156, 99,
951 /* T27 Object */
952 0, 0, 0, 0, 0, 0, 0,
953 /* T40 Object */
954 0, 0, 0, 0, 0,
955 /* T42 Object */
956 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
957 /* T43 Object */
958 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
959 16,
960 /* T46 Object */
Jing Linf1208fd2012-02-23 11:15:42 -0800961 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800962 /* T47 Object */
963 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
964 /* T48 Object */
965 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -0800966 32, 40, 0, 10, 10, 0, 0, 100, 10, 90,
967 0, 0, 0, 0, 0, 0, 0, 10, 1, 10,
968 52, 10, 12, 0, 33, 0, 1, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800969 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
970 0, 0, 0, 0,
971 /* T56 Object */
972 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
973 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
974 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
975 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -0800976 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
977 0,
Jing Lin21ed4de2012-02-05 15:53:28 -0800978};
979
980#define MXT_TS_GPIO_IRQ 6
981#define MXT_TS_PWR_EN_GPIO PM8921_GPIO_PM_TO_SYS(23)
982#define MXT_TS_RESET_GPIO 33
983
984static struct mxt_config_info mxt_config_array[] = {
985 {
986 .config = mxt1386e_config_data_v2_1,
987 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
988 .family_id = 0xA0,
989 .variant_id = 0x7,
990 .version = 0x21,
991 .build = 0xAA,
992 },
993};
994
995static struct mxt_platform_data mxt_platform_data = {
996 .config_array = mxt_config_array,
997 .config_array_size = ARRAY_SIZE(mxt_config_array),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -0800998 .panel_minx = 0,
999 .panel_maxx = 1365,
1000 .panel_miny = 0,
1001 .panel_maxy = 767,
1002 .disp_minx = 0,
1003 .disp_maxx = 1365,
1004 .disp_miny = 0,
1005 .disp_maxy = 767,
Jing Lin21ed4de2012-02-05 15:53:28 -08001006 .irqflags = IRQF_TRIGGER_FALLING,
1007 .i2c_pull_up = true,
1008 .reset_gpio = MXT_TS_RESET_GPIO,
1009 .irq_gpio = MXT_TS_GPIO_IRQ,
1010};
1011
1012static struct i2c_board_info mxt_device_info[] __initdata = {
1013 {
1014 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
1015 .platform_data = &mxt_platform_data,
1016 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1017 },
1018};
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001019#define CYTTSP_TS_GPIO_IRQ 6
1020#define CYTTSP_TS_GPIO_RESOUT 7
1021#define CYTTSP_TS_GPIO_SLEEP 33
1022
1023static ssize_t tma340_vkeys_show(struct kobject *kobj,
1024 struct kobj_attribute *attr, char *buf)
1025{
1026 return snprintf(buf, 200,
1027 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1028 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1029 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1030 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1031 "\n");
1032}
1033
1034static struct kobj_attribute tma340_vkeys_attr = {
1035 .attr = {
1036 .mode = S_IRUGO,
1037 },
1038 .show = &tma340_vkeys_show,
1039};
1040
1041static struct attribute *tma340_properties_attrs[] = {
1042 &tma340_vkeys_attr.attr,
1043 NULL
1044};
1045
1046static struct attribute_group tma340_properties_attr_group = {
1047 .attrs = tma340_properties_attrs,
1048};
1049
1050static int cyttsp_platform_init(struct i2c_client *client)
1051{
1052 int rc = 0;
1053 static struct kobject *tma340_properties_kobj;
1054
1055 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1056 tma340_properties_kobj = kobject_create_and_add("board_properties",
1057 NULL);
1058 if (tma340_properties_kobj)
1059 rc = sysfs_create_group(tma340_properties_kobj,
1060 &tma340_properties_attr_group);
1061 if (!tma340_properties_kobj || rc)
1062 pr_err("%s: failed to create board_properties\n",
1063 __func__);
1064
1065 return 0;
1066}
1067
1068static struct cyttsp_regulator cyttsp_regulator_data[] = {
1069 {
1070 .name = "vdd",
1071 .min_uV = CY_TMA300_VTG_MIN_UV,
1072 .max_uV = CY_TMA300_VTG_MAX_UV,
1073 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1074 .lpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1075 },
1076 {
1077 .name = "vcc_i2c",
1078 .min_uV = CY_I2C_VTG_MIN_UV,
1079 .max_uV = CY_I2C_VTG_MAX_UV,
1080 .hpm_load_uA = CY_I2C_CURR_UA,
1081 .lpm_load_uA = CY_I2C_CURR_UA,
1082 },
1083};
1084
1085static struct cyttsp_platform_data cyttsp_pdata = {
1086 .panel_maxx = 634,
1087 .panel_maxy = 1166,
1088 .disp_maxx = 599,
1089 .disp_maxy = 1023,
1090 .disp_minx = 0,
1091 .disp_miny = 0,
1092 .flags = 0x01,
1093 .gen = CY_GEN3,
1094 .use_st = CY_USE_ST,
1095 .use_mt = CY_USE_MT,
1096 .use_hndshk = CY_SEND_HNDSHK,
1097 .use_trk_id = CY_USE_TRACKING_ID,
1098 .use_sleep = CY_USE_DEEP_SLEEP_SEL,
1099 .use_gestures = CY_USE_GESTURES,
1100 .fw_fname = "cyttsp_8064_mtp.hex",
1101 /* change act_intrvl to customize the Active power state
1102 * scanning/processing refresh interval for Operating mode
1103 */
1104 .act_intrvl = CY_ACT_INTRVL_DFLT,
1105 /* change tch_tmout to customize the touch timeout for the
1106 * Active power state for Operating mode
1107 */
1108 .tch_tmout = CY_TCH_TMOUT_DFLT,
1109 /* change lp_intrvl to customize the Low Power power state
1110 * scanning/processing refresh interval for Operating mode
1111 */
1112 .lp_intrvl = CY_LP_INTRVL_DFLT,
1113 .sleep_gpio = CYTTSP_TS_GPIO_SLEEP,
1114 .resout_gpio = CYTTSP_TS_GPIO_RESOUT,
1115 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1116 .regulator_info = cyttsp_regulator_data,
1117 .num_regulators = ARRAY_SIZE(cyttsp_regulator_data),
1118 .init = cyttsp_platform_init,
1119 .correct_fw_ver = 17,
1120};
1121
1122static struct i2c_board_info cyttsp_info[] __initdata = {
1123 {
1124 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1125 .platform_data = &cyttsp_pdata,
1126 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1127 },
1128};
Jing Lin21ed4de2012-02-05 15:53:28 -08001129
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001130#define MSM_WCNSS_PHYS 0x03000000
1131#define MSM_WCNSS_SIZE 0x280000
1132
1133static struct resource resources_wcnss_wlan[] = {
1134 {
1135 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1136 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1137 .name = "wcnss_wlanrx_irq",
1138 .flags = IORESOURCE_IRQ,
1139 },
1140 {
1141 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1142 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1143 .name = "wcnss_wlantx_irq",
1144 .flags = IORESOURCE_IRQ,
1145 },
1146 {
1147 .start = MSM_WCNSS_PHYS,
1148 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1149 .name = "wcnss_mmio",
1150 .flags = IORESOURCE_MEM,
1151 },
1152 {
1153 .start = 64,
1154 .end = 68,
1155 .name = "wcnss_gpios_5wire",
1156 .flags = IORESOURCE_IO,
1157 },
1158};
1159
1160static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1161 .has_48mhz_xo = 1,
1162};
1163
1164static struct platform_device msm_device_wcnss_wlan = {
1165 .name = "wcnss_wlan",
1166 .id = 0,
1167 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1168 .resource = resources_wcnss_wlan,
1169 .dev = {.platform_data = &qcom_wcnss_pdata},
1170};
1171
Ankit Vermab7c26e62012-02-28 15:04:15 -08001172static struct platform_device msm_device_iris_fm __devinitdata = {
1173 .name = "iris_fm",
1174 .id = -1,
1175};
1176
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001177#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1178 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1179 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1180 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1181
1182#define QCE_SIZE 0x10000
1183#define QCE_0_BASE 0x11000000
1184
1185#define QCE_HW_KEY_SUPPORT 0
1186#define QCE_SHA_HMAC_SUPPORT 1
1187#define QCE_SHARE_CE_RESOURCE 3
1188#define QCE_CE_SHARED 0
1189
1190static struct resource qcrypto_resources[] = {
1191 [0] = {
1192 .start = QCE_0_BASE,
1193 .end = QCE_0_BASE + QCE_SIZE - 1,
1194 .flags = IORESOURCE_MEM,
1195 },
1196 [1] = {
1197 .name = "crypto_channels",
1198 .start = DMOV8064_CE_IN_CHAN,
1199 .end = DMOV8064_CE_OUT_CHAN,
1200 .flags = IORESOURCE_DMA,
1201 },
1202 [2] = {
1203 .name = "crypto_crci_in",
1204 .start = DMOV8064_CE_IN_CRCI,
1205 .end = DMOV8064_CE_IN_CRCI,
1206 .flags = IORESOURCE_DMA,
1207 },
1208 [3] = {
1209 .name = "crypto_crci_out",
1210 .start = DMOV8064_CE_OUT_CRCI,
1211 .end = DMOV8064_CE_OUT_CRCI,
1212 .flags = IORESOURCE_DMA,
1213 },
1214};
1215
1216static struct resource qcedev_resources[] = {
1217 [0] = {
1218 .start = QCE_0_BASE,
1219 .end = QCE_0_BASE + QCE_SIZE - 1,
1220 .flags = IORESOURCE_MEM,
1221 },
1222 [1] = {
1223 .name = "crypto_channels",
1224 .start = DMOV8064_CE_IN_CHAN,
1225 .end = DMOV8064_CE_OUT_CHAN,
1226 .flags = IORESOURCE_DMA,
1227 },
1228 [2] = {
1229 .name = "crypto_crci_in",
1230 .start = DMOV8064_CE_IN_CRCI,
1231 .end = DMOV8064_CE_IN_CRCI,
1232 .flags = IORESOURCE_DMA,
1233 },
1234 [3] = {
1235 .name = "crypto_crci_out",
1236 .start = DMOV8064_CE_OUT_CRCI,
1237 .end = DMOV8064_CE_OUT_CRCI,
1238 .flags = IORESOURCE_DMA,
1239 },
1240};
1241
1242#endif
1243
1244#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1245 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1246
1247static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1248 .ce_shared = QCE_CE_SHARED,
1249 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1250 .hw_key_support = QCE_HW_KEY_SUPPORT,
1251 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001252 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001253};
1254
1255static struct platform_device qcrypto_device = {
1256 .name = "qcrypto",
1257 .id = 0,
1258 .num_resources = ARRAY_SIZE(qcrypto_resources),
1259 .resource = qcrypto_resources,
1260 .dev = {
1261 .coherent_dma_mask = DMA_BIT_MASK(32),
1262 .platform_data = &qcrypto_ce_hw_suppport,
1263 },
1264};
1265#endif
1266
1267#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1268 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1269
1270static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1271 .ce_shared = QCE_CE_SHARED,
1272 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1273 .hw_key_support = QCE_HW_KEY_SUPPORT,
1274 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001275 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001276};
1277
1278static struct platform_device qcedev_device = {
1279 .name = "qce",
1280 .id = 0,
1281 .num_resources = ARRAY_SIZE(qcedev_resources),
1282 .resource = qcedev_resources,
1283 .dev = {
1284 .coherent_dma_mask = DMA_BIT_MASK(32),
1285 .platform_data = &qcedev_ce_hw_suppport,
1286 },
1287};
1288#endif
1289
Joel Kingdacbc822012-01-25 13:30:57 -08001290static struct mdm_platform_data mdm_platform_data = {
1291 .mdm_version = "3.0",
1292 .ramdump_delay_ms = 2000,
Hemant Kumara945b472012-01-25 15:08:06 -08001293 .peripheral_platform_device = &apq8064_device_hsic_host,
Joel Kingdacbc822012-01-25 13:30:57 -08001294};
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001295
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001296static struct tsens_platform_data apq_tsens_pdata = {
1297 .tsens_factor = 1000,
1298 .hw_type = APQ_8064,
1299 .tsens_num_sensor = 11,
1300 .slope = {1176, 1176, 1154, 1176, 1111,
1301 1132, 1132, 1199, 1132, 1199, 1132},
1302};
1303
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001304#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001305static void __init apq8064_map_io(void)
1306{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001307 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001308 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001309 if (socinfo_init() < 0)
1310 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001311}
1312
1313static void __init apq8064_init_irq(void)
1314{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001315 struct msm_mpm_device_data *data = NULL;
1316
1317#ifdef CONFIG_MSM_MPM
1318 data = &apq8064_mpm_dev_data;
1319#endif
1320
1321 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001322 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1323 (void *)MSM_QGIC_CPU_BASE);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001324}
1325
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001326static struct platform_device msm8064_device_saw_regulator_core0 = {
1327 .name = "saw-regulator",
1328 .id = 0,
1329 .dev = {
1330 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
1331 },
1332};
1333
1334static struct platform_device msm8064_device_saw_regulator_core1 = {
1335 .name = "saw-regulator",
1336 .id = 1,
1337 .dev = {
1338 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
1339 },
1340};
1341
1342static struct platform_device msm8064_device_saw_regulator_core2 = {
1343 .name = "saw-regulator",
1344 .id = 2,
1345 .dev = {
1346 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
1347 },
1348};
1349
1350static struct platform_device msm8064_device_saw_regulator_core3 = {
1351 .name = "saw-regulator",
1352 .id = 3,
1353 .dev = {
1354 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001355
1356 },
1357};
1358
Oluwafemi Adeyemif5a31422012-03-08 16:58:45 -08001359static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001360 {
1361 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1362 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1363 true,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001364 100, 650, 801, 200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001365 },
1366
1367 {
1368 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1369 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1370 true,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001371 2000, 200, 576000, 2000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001372 },
1373
1374 {
1375 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1376 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1377 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001378 8500, 51, 1122000, 8500,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001379 },
1380
1381 {
1382 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1383 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
1384 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001385 9000, 51, 1130300, 9000,
1386 },
1387 {
1388 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1389 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
1390 false,
1391 10000, 51, 1130300, 10000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001392 },
1393
1394 {
1395 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1396 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1397 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001398 12000, 14, 2205900, 12000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001399 },
1400
1401 {
1402 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1403 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1404 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001405 18000, 12, 2364250, 18000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001406 },
1407
1408 {
1409 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1410 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1411 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001412 23500, 10, 2667000, 23500,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001413 },
1414
1415 {
1416 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1417 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1418 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07001419 29700, 5, 2867000, 30000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001420 },
1421};
1422
Oluwafemi Adeyemif5a31422012-03-08 16:58:45 -08001423uint32_t apq8064_rpm_get_swfi_latency(void)
1424{
1425 int i;
1426
1427 for (i = 0; i < ARRAY_SIZE(msm_rpmrs_levels); i++) {
1428 if (msm_rpmrs_levels[i].sleep_mode ==
1429 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)
1430 return msm_rpmrs_levels[i].latency_us;
1431 }
1432
1433 return 0;
1434}
1435
Praveen Chidambaram78499012011-11-01 17:15:17 -06001436static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1437 .mode = MSM_PM_BOOT_CONFIG_TZ,
1438};
1439
1440static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
1441 .levels = &msm_rpmrs_levels[0],
1442 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
1443 .vdd_mem_levels = {
1444 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
1445 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
1446 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
1447 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
1448 },
1449 .vdd_dig_levels = {
1450 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
1451 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
1452 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
1453 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
1454 },
1455 .vdd_mask = 0x7FFFFF,
1456 .rpmrs_target_id = {
1457 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
1458 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
1459 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
1460 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
1461 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
1462 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
1463 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
1464 },
1465};
1466
1467static struct msm_cpuidle_state msm_cstates[] __initdata = {
1468 {0, 0, "C0", "WFI",
1469 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1470
1471 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1472 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1473
1474 {0, 2, "C2", "POWER_COLLAPSE",
1475 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
1476
1477 {1, 0, "C0", "WFI",
1478 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1479
1480 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1481 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1482
1483 {2, 0, "C0", "WFI",
1484 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1485
1486 {2, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1487 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1488
1489 {3, 0, "C0", "WFI",
1490 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1491
1492 {3, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1493 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1494};
1495
1496static struct msm_pm_platform_data msm_pm_data[] = {
1497 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1498 .idle_supported = 1,
1499 .suspend_supported = 1,
1500 .idle_enabled = 0,
1501 .suspend_enabled = 0,
1502 },
1503
1504 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1505 .idle_supported = 1,
1506 .suspend_supported = 1,
1507 .idle_enabled = 0,
1508 .suspend_enabled = 0,
1509 },
1510
1511 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1512 .idle_supported = 1,
1513 .suspend_supported = 1,
1514 .idle_enabled = 1,
1515 .suspend_enabled = 1,
1516 },
1517
1518 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1519 .idle_supported = 0,
1520 .suspend_supported = 1,
1521 .idle_enabled = 0,
1522 .suspend_enabled = 0,
1523 },
1524
1525 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1526 .idle_supported = 1,
1527 .suspend_supported = 1,
1528 .idle_enabled = 0,
1529 .suspend_enabled = 0,
1530 },
1531
1532 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1533 .idle_supported = 1,
1534 .suspend_supported = 0,
1535 .idle_enabled = 1,
1536 .suspend_enabled = 0,
1537 },
1538
1539 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1540 .idle_supported = 0,
1541 .suspend_supported = 1,
1542 .idle_enabled = 0,
1543 .suspend_enabled = 0,
1544 },
1545
1546 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1547 .idle_supported = 1,
1548 .suspend_supported = 1,
1549 .idle_enabled = 0,
1550 .suspend_enabled = 0,
1551 },
1552
1553 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1554 .idle_supported = 1,
1555 .suspend_supported = 0,
1556 .idle_enabled = 1,
1557 .suspend_enabled = 0,
1558 },
1559
1560 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1561 .idle_supported = 0,
1562 .suspend_supported = 1,
1563 .idle_enabled = 0,
1564 .suspend_enabled = 0,
1565 },
1566
1567 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1568 .idle_supported = 1,
1569 .suspend_supported = 1,
1570 .idle_enabled = 0,
1571 .suspend_enabled = 0,
1572 },
1573
1574 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1575 .idle_supported = 1,
1576 .suspend_supported = 0,
1577 .idle_enabled = 1,
1578 .suspend_enabled = 0,
1579 },
1580};
1581
1582static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1583 0x03, 0x0f,
1584};
1585
1586static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1587 0x00, 0x24, 0x54, 0x10,
1588 0x09, 0x03, 0x01,
1589 0x10, 0x54, 0x30, 0x0C,
1590 0x24, 0x30, 0x0f,
1591};
1592
1593static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1594 0x00, 0x24, 0x54, 0x10,
1595 0x09, 0x07, 0x01, 0x0B,
1596 0x10, 0x54, 0x30, 0x0C,
1597 0x24, 0x30, 0x0f,
1598};
1599
1600static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1601 [0] = {
1602 .mode = MSM_SPM_MODE_CLOCK_GATING,
1603 .notify_rpm = false,
1604 .cmd = spm_wfi_cmd_sequence,
1605 },
1606 [1] = {
1607 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1608 .notify_rpm = false,
1609 .cmd = spm_power_collapse_without_rpm,
1610 },
1611 [2] = {
1612 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1613 .notify_rpm = true,
1614 .cmd = spm_power_collapse_with_rpm,
1615 },
1616};
1617
1618static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1619 0x00, 0x20, 0x03, 0x20,
1620 0x00, 0x0f,
1621};
1622
1623static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1624 0x00, 0x20, 0x34, 0x64,
1625 0x48, 0x07, 0x48, 0x20,
1626 0x50, 0x64, 0x04, 0x34,
1627 0x50, 0x0f,
1628};
1629static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1630 0x00, 0x10, 0x34, 0x64,
1631 0x48, 0x07, 0x48, 0x10,
1632 0x50, 0x64, 0x04, 0x34,
1633 0x50, 0x0F,
1634};
1635
1636static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1637 [0] = {
1638 .mode = MSM_SPM_L2_MODE_RETENTION,
1639 .notify_rpm = false,
1640 .cmd = l2_spm_wfi_cmd_sequence,
1641 },
1642 [1] = {
1643 .mode = MSM_SPM_L2_MODE_GDHS,
1644 .notify_rpm = true,
1645 .cmd = l2_spm_gdhs_cmd_sequence,
1646 },
1647 [2] = {
1648 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1649 .notify_rpm = true,
1650 .cmd = l2_spm_power_off_cmd_sequence,
1651 },
1652};
1653
1654
1655static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1656 [0] = {
1657 .reg_base_addr = MSM_SAW_L2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001658 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001659 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001660 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1661 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1662 .modes = msm_spm_l2_seq_list,
1663 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1664 },
1665};
1666
1667static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1668 [0] = {
1669 .reg_base_addr = MSM_SAW0_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001670 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001671#if defined(CONFIG_MSM_AVS_HW)
1672 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1673 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1674#endif
1675 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001676 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001677 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1678 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1679 .vctl_timeout_us = 50,
1680 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1681 .modes = msm_spm_seq_list,
1682 },
1683 [1] = {
1684 .reg_base_addr = MSM_SAW1_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001685 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001686#if defined(CONFIG_MSM_AVS_HW)
1687 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1688 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1689#endif
1690 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001691 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001692 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1693 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1694 .vctl_timeout_us = 50,
1695 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1696 .modes = msm_spm_seq_list,
1697 },
1698 [2] = {
1699 .reg_base_addr = MSM_SAW2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001700 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001701#if defined(CONFIG_MSM_AVS_HW)
1702 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1703 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1704#endif
1705 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001706 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001707 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1708 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1709 .vctl_timeout_us = 50,
1710 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1711 .modes = msm_spm_seq_list,
1712 },
1713 [3] = {
1714 .reg_base_addr = MSM_SAW3_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001715 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001716#if defined(CONFIG_MSM_AVS_HW)
1717 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1718 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1719#endif
1720 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001721 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001722 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1723 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1724 .vctl_timeout_us = 50,
1725 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1726 .modes = msm_spm_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001727 },
1728};
1729
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001730static void __init apq8064_init_buses(void)
1731{
1732 msm_bus_rpm_set_mt_mask();
1733 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
1734 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
1735 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
1736 msm_bus_8064_apps_fabric.dev.platform_data =
1737 &msm_bus_8064_apps_fabric_pdata;
1738 msm_bus_8064_sys_fabric.dev.platform_data =
1739 &msm_bus_8064_sys_fabric_pdata;
1740 msm_bus_8064_mm_fabric.dev.platform_data =
1741 &msm_bus_8064_mm_fabric_pdata;
1742 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
1743 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
1744}
1745
David Collinsf0d00732012-01-25 15:46:50 -08001746static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
1747 .name = GPIO_REGULATOR_DEV_NAME,
1748 .id = PM8921_MPP_PM_TO_SYS(7),
1749 .dev = {
1750 .platform_data
1751 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
1752 },
1753};
1754
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08001755static struct platform_device apq8064_device_ext_mpp8_vreg __devinitdata = {
1756 .name = GPIO_REGULATOR_DEV_NAME,
1757 .id = PM8921_MPP_PM_TO_SYS(8),
1758 .dev = {
1759 .platform_data
1760 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_MPP8],
1761 },
1762};
1763
David Collinsf0d00732012-01-25 15:46:50 -08001764static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
1765 .name = GPIO_REGULATOR_DEV_NAME,
1766 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
1767 .dev = {
1768 .platform_data =
1769 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
1770 },
1771};
1772
David Collins390fc332012-02-07 14:38:16 -08001773static struct platform_device apq8064_device_ext_ts_sw_vreg __devinitdata = {
1774 .name = GPIO_REGULATOR_DEV_NAME,
1775 .id = PM8921_GPIO_PM_TO_SYS(23),
1776 .dev = {
1777 .platform_data
1778 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_TS_SW],
1779 },
1780};
1781
David Collins2782b5c2012-02-06 10:02:42 -08001782static struct platform_device apq8064_device_rpm_regulator __devinitdata = {
1783 .name = "rpm-regulator",
1784 .id = -1,
1785 .dev = {
1786 .platform_data = &apq8064_rpm_regulator_pdata,
1787 },
1788};
1789
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001790static struct platform_device *common_devices[] __initdata = {
Jin Hong01f2dbb2011-11-03 22:13:51 -07001791 &apq8064_device_dmov,
David Keitel3c40fc52012-02-09 17:53:52 -08001792 &apq8064_device_qup_i2c_gsbi1,
Jing Lin04601f92012-02-05 15:36:07 -08001793 &apq8064_device_qup_i2c_gsbi3,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001794 &apq8064_device_qup_i2c_gsbi4,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001795 &apq8064_device_qup_spi_gsbi5,
David Collinsf0d00732012-01-25 15:46:50 -08001796 &apq8064_device_ext_5v_vreg,
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08001797 &apq8064_device_ext_mpp8_vreg,
David Collinsf0d00732012-01-25 15:46:50 -08001798 &apq8064_device_ext_3p3v_vreg,
David Collins390fc332012-02-07 14:38:16 -08001799 &apq8064_device_ext_ts_sw_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07001800 &apq8064_device_ssbi_pmic1,
1801 &apq8064_device_ssbi_pmic2,
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001802 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07001803 &apq8064_device_otg,
1804 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08001805 &apq8064_device_hsusb_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07001806 &android_usb_device,
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001807 &msm_device_wcnss_wlan,
Ankit Vermab7c26e62012-02-28 15:04:15 -08001808 &msm_device_iris_fm,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001809#ifdef CONFIG_ANDROID_PMEM
1810#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -07001811 &android_pmem_device,
1812 &android_pmem_adsp_device,
1813 &android_pmem_audio_device,
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -07001814#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
1815#endif /*CONFIG_ANDROID_PMEM*/
Olav Haugan7c6aa742012-01-16 16:47:37 -08001816#ifdef CONFIG_ION_MSM
1817 &ion_dev,
1818#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001819 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001820 &msm8064_device_saw_regulator_core0,
1821 &msm8064_device_saw_regulator_core1,
1822 &msm8064_device_saw_regulator_core2,
1823 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001824#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1825 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1826 &qcrypto_device,
1827#endif
1828
1829#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1830 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1831 &qcedev_device,
1832#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07001833
1834#ifdef CONFIG_HW_RANDOM_MSM
1835 &apq8064_device_rng,
1836#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08001837 &apq_pcm,
1838 &apq_pcm_routing,
1839 &apq_cpudai0,
1840 &apq_cpudai1,
1841 &apq_cpudai_hdmi_rx,
1842 &apq_cpudai_bt_rx,
1843 &apq_cpudai_bt_tx,
1844 &apq_cpudai_fm_rx,
1845 &apq_cpudai_fm_tx,
1846 &apq_cpu_fe,
1847 &apq_stub_codec,
1848 &apq_voice,
1849 &apq_voip,
1850 &apq_lpa_pcm,
1851 &apq_pcm_hostless,
1852 &apq_cpudai_afe_01_rx,
1853 &apq_cpudai_afe_01_tx,
1854 &apq_cpudai_afe_02_rx,
1855 &apq_cpudai_afe_02_tx,
1856 &apq_pcm_afe,
1857 &apq_cpudai_auxpcm_rx,
1858 &apq_cpudai_auxpcm_tx,
Neema Shetty8427c262012-02-16 11:23:43 -08001859 &apq_cpudai_stub,
Neema Shetty3c9d2862012-03-11 01:25:32 -08001860 &apq_cpudai_slimbus_1_rx,
1861 &apq_cpudai_slimbus_1_tx,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001862 &apq8064_rpm_device,
1863 &apq8064_rpm_log_device,
1864 &apq8064_rpm_stat_device,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001865 &msm_bus_8064_apps_fabric,
1866 &msm_bus_8064_sys_fabric,
1867 &msm_bus_8064_mm_fabric,
1868 &msm_bus_8064_sys_fpb,
1869 &msm_bus_8064_cpss_fpb,
Mohan Kumar Gubbihalli Lachma Naik7f72edd2012-02-06 17:26:47 -08001870 &apq8064_msm_device_vidc,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07001871 &msm_pil_dsps,
Matt Wagantalled832652012-02-02 19:23:17 -08001872 &msm_8960_riva,
Matt Wagantallb94b9a52012-02-02 21:59:54 -08001873 &msm_8960_q6_lpass,
Stephen Boyd7b973de2012-03-09 12:26:16 -08001874 &msm_pil_vidc,
Matt Wagantall292aace2012-01-26 19:12:34 -08001875 &msm_gss,
Laura Abbott350c8362012-02-28 14:46:52 -08001876#ifdef CONFIG_MSM_RTB
1877 &msm_rtb_device,
1878#endif
Praveen Chidambaram8ea3dcd2011-12-07 14:46:31 -07001879 &apq8064_cpu_idle_device,
Praveen Chidambaram5c8adf22012-02-23 18:44:37 -07001880 &apq8064_msm_gov_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08001881 &apq8064_device_cache_erp,
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08001882 &epm_adc_device,
Pratik Patel212ab362012-03-16 12:30:07 -07001883 &apq8064_qdss_device,
1884 &msm_etb_device,
1885 &msm_tpiu_device,
1886 &msm_funnel_device,
1887 &apq8064_etm_device,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001888};
1889
Joel King4e7ad222011-08-17 15:47:38 -07001890static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001891 &apq8064_device_uart_gsbi3,
Yan He06913ce2011-08-26 16:33:46 -07001892 &msm_device_sps_apq8064,
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001893};
1894
1895static struct platform_device *rumi3_devices[] __initdata = {
1896 &apq8064_device_uart_gsbi1,
Yan He435ed612011-11-23 17:34:59 -08001897 &msm_device_sps_apq8064,
Huaibin Yang4a084e32011-12-15 15:25:52 -08001898#ifdef CONFIG_MSM_ROTATOR
1899 &msm_rotator_device,
1900#endif
Joel King4e7ad222011-08-17 15:47:38 -07001901};
1902
Joel King82b7e3f2012-01-05 10:03:27 -08001903static struct platform_device *cdp_devices[] __initdata = {
1904 &apq8064_device_uart_gsbi1,
Jin Hong4bbbfba2012-02-02 21:48:07 -08001905 &apq8064_device_uart_gsbi7,
Joel King82b7e3f2012-01-05 10:03:27 -08001906 &msm_device_sps_apq8064,
Aravind Venkateswaran4ca27532012-02-16 14:27:05 -08001907#ifdef CONFIG_MSM_ROTATOR
1908 &msm_rotator_device,
1909#endif
Joel King82b7e3f2012-01-05 10:03:27 -08001910};
1911
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001912static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08001913 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001914};
1915
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001916#define KS8851_IRQ_GPIO 43
1917
1918static struct spi_board_info spi_board_info[] __initdata = {
1919 {
1920 .modalias = "ks8851",
1921 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1922 .max_speed_hz = 19200000,
1923 .bus_num = 0,
1924 .chip_select = 2,
1925 .mode = SPI_MODE_0,
1926 },
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08001927 {
1928 .modalias = "epm_adc",
1929 .max_speed_hz = 1100000,
1930 .bus_num = 0,
1931 .chip_select = 3,
1932 .mode = SPI_MODE_0,
1933 },
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001934};
1935
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001936static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001937 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001938 .bus_num = 1,
1939 .slim_slave = &apq8064_slim_tabla,
1940 },
1941 {
1942 .bus_num = 1,
1943 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001944 },
1945 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001946};
1947
David Keitel3c40fc52012-02-09 17:53:52 -08001948static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi1_pdata = {
1949 .clk_freq = 100000,
1950 .src_clk_rate = 24000000,
1951};
1952
Jing Lin04601f92012-02-05 15:36:07 -08001953static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi3_pdata = {
1954 .clk_freq = 100000,
1955 .src_clk_rate = 24000000,
1956};
1957
Kenneth Heitke748593a2011-07-15 15:45:11 -06001958static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
1959 .clk_freq = 100000,
1960 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001961};
1962
David Keitel3c40fc52012-02-09 17:53:52 -08001963#define GSBI_DUAL_MODE_CODE 0x60
1964#define MSM_GSBI1_PHYS 0x12440000
Kenneth Heitke748593a2011-07-15 15:45:11 -06001965static void __init apq8064_i2c_init(void)
1966{
David Keitel3c40fc52012-02-09 17:53:52 -08001967 void __iomem *gsbi_mem;
1968
1969 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
1970 &apq8064_i2c_qup_gsbi1_pdata;
1971 gsbi_mem = ioremap_nocache(MSM_GSBI1_PHYS, 4);
1972 writel_relaxed(GSBI_DUAL_MODE_CODE, gsbi_mem);
1973 /* Ensure protocol code is written before proceeding */
1974 wmb();
1975 iounmap(gsbi_mem);
1976 apq8064_i2c_qup_gsbi1_pdata.use_gsbi_shared_mode = 1;
Jing Lin04601f92012-02-05 15:36:07 -08001977 apq8064_device_qup_i2c_gsbi3.dev.platform_data =
1978 &apq8064_i2c_qup_gsbi3_pdata;
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08001979 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
1980 &apq8064_i2c_qup_gsbi1_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06001981 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
1982 &apq8064_i2c_qup_gsbi4_pdata;
1983}
1984
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08001985#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001986static int ethernet_init(void)
1987{
1988 int ret;
1989 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
1990 if (ret) {
1991 pr_err("ks8851 gpio_request failed: %d\n", ret);
1992 goto fail;
1993 }
1994
1995 return 0;
1996fail:
1997 return ret;
1998}
1999#else
2000static int ethernet_init(void)
2001{
2002 return 0;
2003}
2004#endif
2005
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302006#define GPIO_KEY_HOME PM8921_GPIO_PM_TO_SYS(27)
2007#define GPIO_KEY_VOLUME_UP PM8921_GPIO_PM_TO_SYS(35)
2008#define GPIO_KEY_VOLUME_DOWN PM8921_GPIO_PM_TO_SYS(38)
2009#define GPIO_KEY_CAM_FOCUS PM8921_GPIO_PM_TO_SYS(3)
2010#define GPIO_KEY_CAM_SNAP PM8921_GPIO_PM_TO_SYS(4)
Jing Lin3f8f8422012-03-05 09:32:11 -08002011#define GPIO_KEY_ROTATION PM8921_GPIO_PM_TO_SYS(42)
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302012
2013static struct gpio_keys_button cdp_keys[] = {
2014 {
2015 .code = KEY_HOME,
2016 .gpio = GPIO_KEY_HOME,
2017 .desc = "home_key",
2018 .active_low = 1,
2019 .type = EV_KEY,
2020 .wakeup = 1,
2021 .debounce_interval = 15,
2022 },
2023 {
2024 .code = KEY_VOLUMEUP,
2025 .gpio = GPIO_KEY_VOLUME_UP,
2026 .desc = "volume_up_key",
2027 .active_low = 1,
2028 .type = EV_KEY,
2029 .wakeup = 1,
2030 .debounce_interval = 15,
2031 },
2032 {
2033 .code = KEY_VOLUMEDOWN,
2034 .gpio = GPIO_KEY_VOLUME_DOWN,
2035 .desc = "volume_down_key",
2036 .active_low = 1,
2037 .type = EV_KEY,
2038 .wakeup = 1,
2039 .debounce_interval = 15,
2040 },
2041 {
2042 .code = SW_ROTATE_LOCK,
2043 .gpio = GPIO_KEY_ROTATION,
2044 .desc = "rotate_key",
2045 .active_low = 1,
2046 .type = EV_SW,
2047 .debounce_interval = 15,
2048 },
2049};
2050
2051static struct gpio_keys_platform_data cdp_keys_data = {
2052 .buttons = cdp_keys,
2053 .nbuttons = ARRAY_SIZE(cdp_keys),
2054};
2055
2056static struct platform_device cdp_kp_pdev = {
2057 .name = "gpio-keys",
2058 .id = -1,
2059 .dev = {
2060 .platform_data = &cdp_keys_data,
2061 },
2062};
2063
2064static struct gpio_keys_button mtp_keys[] = {
2065 {
2066 .code = KEY_CAMERA_FOCUS,
2067 .gpio = GPIO_KEY_CAM_FOCUS,
2068 .desc = "cam_focus_key",
2069 .active_low = 1,
2070 .type = EV_KEY,
2071 .wakeup = 1,
2072 .debounce_interval = 15,
2073 },
2074 {
2075 .code = KEY_VOLUMEUP,
2076 .gpio = GPIO_KEY_VOLUME_UP,
2077 .desc = "volume_up_key",
2078 .active_low = 1,
2079 .type = EV_KEY,
2080 .wakeup = 1,
2081 .debounce_interval = 15,
2082 },
2083 {
2084 .code = KEY_VOLUMEDOWN,
2085 .gpio = GPIO_KEY_VOLUME_DOWN,
2086 .desc = "volume_down_key",
2087 .active_low = 1,
2088 .type = EV_KEY,
2089 .wakeup = 1,
2090 .debounce_interval = 15,
2091 },
2092 {
2093 .code = KEY_CAMERA_SNAPSHOT,
2094 .gpio = GPIO_KEY_CAM_SNAP,
2095 .desc = "cam_snap_key",
2096 .active_low = 1,
2097 .type = EV_KEY,
2098 .debounce_interval = 15,
2099 },
2100};
2101
2102static struct gpio_keys_platform_data mtp_keys_data = {
2103 .buttons = mtp_keys,
2104 .nbuttons = ARRAY_SIZE(mtp_keys),
2105};
2106
2107static struct platform_device mtp_kp_pdev = {
2108 .name = "gpio-keys",
2109 .id = -1,
2110 .dev = {
2111 .platform_data = &mtp_keys_data,
2112 },
2113};
2114
Jin Hongd3024e62012-02-09 16:13:32 -08002115/* Sensors DSPS platform data */
2116#define DSPS_PIL_GENERIC_NAME "dsps"
2117static void __init apq8064_init_dsps(void)
2118{
2119 struct msm_dsps_platform_data *pdata =
2120 msm_dsps_device_8064.dev.platform_data;
2121 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
2122 pdata->gpios = NULL;
2123 pdata->gpios_num = 0;
2124
2125 platform_device_register(&msm_dsps_device_8064);
2126}
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302127
Tianyi Gou41515e22011-09-01 19:37:43 -07002128static void __init apq8064_clock_init(void)
2129{
Tianyi Gouacb588d2012-01-27 18:24:05 -08002130 if (machine_is_apq8064_rumi3())
Tianyi Gou41515e22011-09-01 19:37:43 -07002131 msm_clock_init(&apq8064_dummy_clock_init_data);
Tianyi Gouacb588d2012-01-27 18:24:05 -08002132 else
2133 msm_clock_init(&apq8064_clock_init_data);
Tianyi Gou41515e22011-09-01 19:37:43 -07002134}
2135
Jing Lin417fa452012-02-05 14:31:06 -08002136#define I2C_SURF 1
2137#define I2C_FFA (1 << 1)
2138#define I2C_RUMI (1 << 2)
2139#define I2C_SIM (1 << 3)
2140#define I2C_LIQUID (1 << 4)
2141
2142struct i2c_registry {
2143 u8 machs;
2144 int bus;
2145 struct i2c_board_info *info;
2146 int len;
2147};
2148
2149static struct i2c_registry apq8064_i2c_devices[] __initdata = {
Jing Lin21ed4de2012-02-05 15:53:28 -08002150 {
David Keitel2f613d92012-02-15 11:29:16 -08002151 I2C_LIQUID,
2152 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
2153 smb349_charger_i2c_info,
2154 ARRAY_SIZE(smb349_charger_i2c_info)
2155 },
2156 {
Jing Lin21ed4de2012-02-05 15:53:28 -08002157 I2C_SURF | I2C_LIQUID,
2158 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
2159 mxt_device_info,
2160 ARRAY_SIZE(mxt_device_info),
2161 },
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08002162 {
2163 I2C_FFA,
2164 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
2165 cyttsp_info,
2166 ARRAY_SIZE(cyttsp_info),
2167 },
Amy Maloche70090f992012-02-16 16:35:26 -08002168 {
2169 I2C_FFA | I2C_LIQUID,
2170 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
2171 isa1200_board_info,
2172 ARRAY_SIZE(isa1200_board_info),
2173 },
Jing Lin417fa452012-02-05 14:31:06 -08002174};
2175
2176static void __init register_i2c_devices(void)
2177{
2178 u8 mach_mask = 0;
2179 int i;
2180
Kevin Chand07220e2012-02-13 15:52:22 -08002181#ifdef CONFIG_MSM_CAMERA
2182 struct i2c_registry apq8064_camera_i2c_devices = {
2183 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_RUMI,
2184 APQ_8064_GSBI4_QUP_I2C_BUS_ID,
2185 apq8064_camera_board_info.board_info,
2186 apq8064_camera_board_info.num_i2c_board_info,
2187 };
2188#endif
Jing Lin417fa452012-02-05 14:31:06 -08002189 /* Build the matching 'supported_machs' bitmask */
2190 if (machine_is_apq8064_cdp())
2191 mach_mask = I2C_SURF;
2192 else if (machine_is_apq8064_mtp())
2193 mach_mask = I2C_FFA;
2194 else if (machine_is_apq8064_liquid())
2195 mach_mask = I2C_LIQUID;
2196 else if (machine_is_apq8064_rumi3())
2197 mach_mask = I2C_RUMI;
2198 else if (machine_is_apq8064_sim())
2199 mach_mask = I2C_SIM;
2200 else
2201 pr_err("unmatched machine ID in register_i2c_devices\n");
2202
2203 /* Run the array and install devices as appropriate */
2204 for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) {
2205 if (apq8064_i2c_devices[i].machs & mach_mask)
2206 i2c_register_board_info(apq8064_i2c_devices[i].bus,
2207 apq8064_i2c_devices[i].info,
2208 apq8064_i2c_devices[i].len);
2209 }
Kevin Chand07220e2012-02-13 15:52:22 -08002210#ifdef CONFIG_MSM_CAMERA
2211 if (apq8064_camera_i2c_devices.machs & mach_mask)
2212 i2c_register_board_info(apq8064_camera_i2c_devices.bus,
2213 apq8064_camera_i2c_devices.info,
2214 apq8064_camera_i2c_devices.len);
2215#endif
Jing Lin417fa452012-02-05 14:31:06 -08002216}
2217
Jay Chokshi994ff122012-03-27 15:43:48 -07002218static void enable_ddr3_regulator(void)
2219{
2220 static struct regulator *ext_ddr3;
2221
2222 /* Use MPP7 output state as a flag for PCDDR3 presence. */
2223 if (gpio_get_value_cansleep(PM8921_MPP_PM_TO_SYS(7)) > 0) {
2224 ext_ddr3 = regulator_get(NULL, "ext_ddr3");
2225 if (IS_ERR(ext_ddr3) || ext_ddr3 == NULL)
2226 pr_err("Could not get MPP7 regulator\n");
2227 else
2228 regulator_enable(ext_ddr3);
2229 }
2230}
2231
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002232static void __init apq8064_common_init(void)
2233{
2234 if (socinfo_init() < 0)
2235 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06002236 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
2237 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
David Collins2782b5c2012-02-06 10:02:42 -08002238 regulator_suppress_info_printing();
2239 platform_device_register(&apq8064_device_rpm_regulator);
Stephen Boyd4d0d2582012-02-10 14:49:40 -08002240 if (msm_xo_init())
2241 pr_err("Failed to initialize XO votes\n");
Tianyi Gou41515e22011-09-01 19:37:43 -07002242 apq8064_clock_init();
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08002243 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06002244 apq8064_i2c_init();
Jing Lin417fa452012-02-05 14:31:06 -08002245 register_i2c_devices();
Kenneth Heitke36920d32011-07-20 16:44:30 -06002246
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002247 apq8064_device_qup_spi_gsbi5.dev.platform_data =
2248 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08002249 apq8064_init_pmic();
Hemant Kumar94e7da22012-02-03 16:52:29 -08002250 if (machine_is_apq8064_liquid())
2251 msm_otg_pdata.mhl_enable = true;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07002252
2253 msm_otg_pdata.swfi_latency =
2254 msm_rpmrs_levels[0].latency_us + 1;
2255
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002256 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Manu Gautam91223e02011-11-08 15:27:22 +05302257 apq8064_ehci_host_init();
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002258 apq8064_init_buses();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002259 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Jay Chokshi994ff122012-03-27 15:43:48 -07002260 enable_ddr3_regulator();
Hemant Kumarf1ca9192012-02-07 18:59:33 -08002261 if (machine_is_apq8064_mtp()) {
2262 apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
2263 device_initialize(&apq8064_device_hsic_host.dev);
2264 }
Jay Chokshie8741282012-01-25 15:22:55 -08002265 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05302266 apq8064_init_mmc();
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08002267
2268 if (machine_is_apq8064_mtp()) {
2269 mdm_8064_device.dev.platform_data = &mdm_platform_data;
2270 platform_device_register(&mdm_8064_device);
2271 }
2272 platform_device_register(&apq8064_slim_ctrl);
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002273 slim_register_board_info(apq8064_slim_devices,
2274 ARRAY_SIZE(apq8064_slim_devices));
Jin Hongd3024e62012-02-09 16:13:32 -08002275 apq8064_init_dsps();
Praveen Chidambaram78499012011-11-01 17:15:17 -06002276 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Mahesh Sivasubramaniancbce1ec2012-01-24 10:32:44 -07002277 acpuclk_init(&acpuclk_8064_soc_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002278 msm_spm_l2_init(msm_spm_l2_data);
2279 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2280 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2281 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2282 msm_pm_data);
2283 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002284 apq8064_epm_adc_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002285}
2286
Huaibin Yang4a084e32011-12-15 15:25:52 -08002287static void __init apq8064_allocate_memory_regions(void)
2288{
2289 apq8064_allocate_fb_region();
2290}
2291
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002292static void __init apq8064_sim_init(void)
2293{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002294 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
2295 &msm8064_device_watchdog.dev.platform_data;
2296
2297 wdog_pdata->bark_time = 15000;
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002298 msm_tsens_early_init(&apq_tsens_pdata);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002299 apq8064_common_init();
Joel King4e7ad222011-08-17 15:47:38 -07002300 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
2301}
2302
2303static void __init apq8064_rumi3_init(void)
2304{
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002305 msm_tsens_early_init(&apq_tsens_pdata);
Joel King4e7ad222011-08-17 15:47:38 -07002306 apq8064_common_init();
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002307 ethernet_init();
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07002308 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002309 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Huaibin Yang4a084e32011-12-15 15:25:52 -08002310 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07002311 apq8064_init_gpu();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002312}
2313
Joel King82b7e3f2012-01-05 10:03:27 -08002314static void __init apq8064_cdp_init(void)
2315{
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002316 msm_tsens_early_init(&apq_tsens_pdata);
Joel King82b7e3f2012-01-05 10:03:27 -08002317 apq8064_common_init();
2318 ethernet_init();
2319 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Ravishangar Kalyanam319a83c2012-03-21 18:38:05 -07002320 if (!machine_is_apq8064_mtp())
2321 msm_rotator_update_bus_vectors(1376, 768);
Joel King82b7e3f2012-01-05 10:03:27 -08002322 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002323 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07002324 apq8064_init_gpu();
Matt Wagantall1875d322012-02-22 16:11:33 -08002325 platform_add_devices(apq8064_fs_devices, apq8064_num_fs_devices);
Kevin Chand07220e2012-02-13 15:52:22 -08002326 apq8064_init_cam();
Mohan Pallaka474b94b2012-01-25 12:59:58 +05302327
2328 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
2329 platform_device_register(&cdp_kp_pdev);
2330
2331 if (machine_is_apq8064_mtp())
2332 platform_device_register(&mtp_kp_pdev);
Joel King82b7e3f2012-01-05 10:03:27 -08002333}
2334
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002335MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
2336 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002337 .reserve = apq8064_reserve,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002338 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302339 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002340 .timer = &msm_timer,
2341 .init_machine = apq8064_sim_init,
2342MACHINE_END
2343
Joel King4e7ad222011-08-17 15:47:38 -07002344MACHINE_START(APQ8064_RUMI3, "QCT APQ8064 RUMI3")
2345 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07002346 .reserve = apq8064_reserve,
Joel King4e7ad222011-08-17 15:47:38 -07002347 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302348 .handle_irq = gic_handle_irq,
Joel King4e7ad222011-08-17 15:47:38 -07002349 .timer = &msm_timer,
2350 .init_machine = apq8064_rumi3_init,
Huaibin Yang4a084e32011-12-15 15:25:52 -08002351 .init_early = apq8064_allocate_memory_regions,
Joel King4e7ad222011-08-17 15:47:38 -07002352MACHINE_END
2353
Joel King82b7e3f2012-01-05 10:03:27 -08002354MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
2355 .map_io = apq8064_map_io,
2356 .reserve = apq8064_reserve,
2357 .init_irq = apq8064_init_irq,
2358 .handle_irq = gic_handle_irq,
2359 .timer = &msm_timer,
2360 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002361 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07002362 .init_very_early = apq8064_early_reserve,
Joel King82b7e3f2012-01-05 10:03:27 -08002363MACHINE_END
2364
2365MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
2366 .map_io = apq8064_map_io,
2367 .reserve = apq8064_reserve,
2368 .init_irq = apq8064_init_irq,
2369 .handle_irq = gic_handle_irq,
2370 .timer = &msm_timer,
2371 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002372 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07002373 .init_very_early = apq8064_early_reserve,
Joel King82b7e3f2012-01-05 10:03:27 -08002374MACHINE_END
2375
2376MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
2377 .map_io = apq8064_map_io,
2378 .reserve = apq8064_reserve,
2379 .init_irq = apq8064_init_irq,
2380 .handle_irq = gic_handle_irq,
2381 .timer = &msm_timer,
2382 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08002383 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07002384 .init_very_early = apq8064_early_reserve,
Joel King82b7e3f2012-01-05 10:03:27 -08002385MACHINE_END
2386
Joel King064bbf82012-04-01 13:23:39 -07002387MACHINE_START(MPQ8064_CDP, "QCT MPQ8064 CDP")
2388 .map_io = apq8064_map_io,
2389 .reserve = apq8064_reserve,
2390 .init_irq = apq8064_init_irq,
2391 .handle_irq = gic_handle_irq,
2392 .timer = &msm_timer,
2393 .init_machine = apq8064_cdp_init,
2394 .init_early = apq8064_allocate_memory_regions,
2395 .init_very_early = apq8064_early_reserve,
2396MACHINE_END
2397
Joel King11ca8202012-02-13 16:19:03 -08002398MACHINE_START(MPQ8064_HRD, "QCT MPQ8064 HRD")
2399 .map_io = apq8064_map_io,
2400 .reserve = apq8064_reserve,
2401 .init_irq = apq8064_init_irq,
2402 .handle_irq = gic_handle_irq,
2403 .timer = &msm_timer,
2404 .init_machine = apq8064_cdp_init,
Laura Abbott6988cef2012-03-15 14:27:13 -07002405 .init_very_early = apq8064_early_reserve,
Joel King11ca8202012-02-13 16:19:03 -08002406MACHINE_END
2407
2408MACHINE_START(MPQ8064_DTV, "QCT MPQ8064 DTV")
2409 .map_io = apq8064_map_io,
2410 .reserve = apq8064_reserve,
2411 .init_irq = apq8064_init_irq,
2412 .handle_irq = gic_handle_irq,
2413 .timer = &msm_timer,
2414 .init_machine = apq8064_cdp_init,
Laura Abbott6988cef2012-03-15 14:27:13 -07002415 .init_very_early = apq8064_early_reserve,
Joel King11ca8202012-02-13 16:19:03 -08002416MACHINE_END
2417