blob: 471f0d8804d14a41e587947c508586c5f43546a5 [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>
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -080019#include <linux/mfd/wcd9310/core.h>
20#include <linux/mfd/wcd9310/pdata.h>
Kenneth Heitke36920d32011-07-20 16:44:30 -060021#include <linux/msm_ssbi.h>
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -070022#include <linux/spi/spi.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070023#include <linux/dma-mapping.h>
24#include <linux/platform_data/qcom_crypto_device.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080025#include <linux/ion.h>
Jack Cheung46bfffa2012-01-19 15:26:24 -080026#include <linux/memory.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070027#include <asm/mach-types.h>
28#include <asm/mach/arch.h>
29#include <asm/hardware/gic.h>
Sahitya Tummala3586ed92011-08-03 09:13:23 +053030#include <asm/mach/mmc.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070031
32#include <mach/board.h>
33#include <mach/msm_iomap.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080034#include <mach/ion.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070035#include <linux/usb/msm_hsusb.h>
36#include <linux/usb/android.h>
37#include <mach/socinfo.h>
Harini Jayaramanc4c58692011-07-19 14:50:10 -060038#include <mach/msm_spi.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070039#include "timer.h"
40#include "devices.h"
Joel King4ebccc62011-07-22 09:43:22 -070041#include <mach/gpio.h>
42#include <mach/gpiomux.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060043#include <mach/rpm.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080044#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -070045#include <linux/android_pmem.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080046#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070047#include <mach/msm_memtypes.h>
48#include <linux/bootmem.h>
49#include <asm/setup.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070050#include <mach/dma.h>
Gagan Mac8a7a5d32011-11-11 16:43:06 -070051#include <mach/msm_bus_board.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060052#include <mach/cpuidle.h>
Joel King4ebccc62011-07-22 09:43:22 -070053
Jeff Ohlstein7e668552011-10-06 16:17:25 -070054#include "msm_watchdog.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080055#include "board-8064.h"
Vikram Mulukutlabc2e9572011-11-04 03:41:38 -070056#include "acpuclock.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060057#include "spm.h"
58#include "mpm.h"
59#include "rpm_resources.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080060#include "pm.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060061#include "pm-boot.h"
Rajesh Sastrulaaee8af32012-01-20 11:46:31 -080062#include "devices-msm8x60.h"
Jay Chokshiea67c622011-07-29 17:12:26 -070063
Olav Haugan7c6aa742012-01-16 16:47:37 -080064#define MSM_PMEM_ADSP_SIZE 0x7800000
Ben Romberger3ffcd812011-12-08 19:12:10 -080065#define MSM_PMEM_AUDIO_SIZE 0x2B4000
Olav Haugan7c6aa742012-01-16 16:47:37 -080066#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
67#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
68#else
69#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
70#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070071
Olav Haugan7c6aa742012-01-16 16:47:37 -080072#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Olav Hauganedcf6832012-01-24 08:35:41 -080073#define MSM_PMEM_KERNEL_EBI1_SIZE 0x280000
Olav Haugan7c6aa742012-01-16 16:47:37 -080074#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Haugand3d29682012-01-19 10:57:07 -080075#define MSM_ION_MM_FW_SIZE 0x200000 /* (2MB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -080076#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Hauganf45e2142012-01-19 11:01:01 -080077#define MSM_ION_QSECOM_SIZE 0x100000 /* (1MB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -080078#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan2c43fac2012-01-19 11:06:37 -080079#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
80#define MSM_ION_HEAP_NUM 8
Olav Haugan7c6aa742012-01-16 16:47:37 -080081#else
82#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
83#define MSM_ION_HEAP_NUM 1
84#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070085
Olav Haugan7c6aa742012-01-16 16:47:37 -080086#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
87static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
88static int __init pmem_kernel_ebi1_size_setup(char *p)
Kevin Chan13be4e22011-10-20 11:30:32 -070089{
Olav Haugan7c6aa742012-01-16 16:47:37 -080090 pmem_kernel_ebi1_size = memparse(p, NULL);
91 return 0;
Kevin Chan13be4e22011-10-20 11:30:32 -070092}
Olav Haugan7c6aa742012-01-16 16:47:37 -080093early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
94#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070095
Olav Haugan7c6aa742012-01-16 16:47:37 -080096#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -070097static unsigned pmem_size = MSM_PMEM_SIZE;
98static int __init pmem_size_setup(char *p)
99{
100 pmem_size = memparse(p, NULL);
101 return 0;
102}
103early_param("pmem_size", pmem_size_setup);
104
105static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
106
107static int __init pmem_adsp_size_setup(char *p)
108{
109 pmem_adsp_size = memparse(p, NULL);
110 return 0;
111}
112early_param("pmem_adsp_size", pmem_adsp_size_setup);
113
114static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
115
116static int __init pmem_audio_size_setup(char *p)
117{
118 pmem_audio_size = memparse(p, NULL);
119 return 0;
120}
121early_param("pmem_audio_size", pmem_audio_size_setup);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800122#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700123
Olav Haugan7c6aa742012-01-16 16:47:37 -0800124#ifdef CONFIG_ANDROID_PMEM
125#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700126static struct android_pmem_platform_data android_pmem_pdata = {
127 .name = "pmem",
128 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
129 .cached = 1,
130 .memory_type = MEMTYPE_EBI1,
131};
132
133static struct platform_device android_pmem_device = {
134 .name = "android_pmem",
135 .id = 0,
136 .dev = {.platform_data = &android_pmem_pdata},
137};
138
139static struct android_pmem_platform_data android_pmem_adsp_pdata = {
140 .name = "pmem_adsp",
141 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
142 .cached = 0,
143 .memory_type = MEMTYPE_EBI1,
144};
Kevin Chan13be4e22011-10-20 11:30:32 -0700145static struct platform_device android_pmem_adsp_device = {
146 .name = "android_pmem",
147 .id = 2,
148 .dev = { .platform_data = &android_pmem_adsp_pdata },
149};
Olav Haugan7c6aa742012-01-16 16:47:37 -0800150#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700151
152static struct android_pmem_platform_data android_pmem_audio_pdata = {
153 .name = "pmem_audio",
154 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
155 .cached = 0,
156 .memory_type = MEMTYPE_EBI1,
157};
158
159static struct platform_device android_pmem_audio_device = {
160 .name = "android_pmem",
161 .id = 4,
162 .dev = { .platform_data = &android_pmem_audio_pdata },
163};
Olav Haugan7c6aa742012-01-16 16:47:37 -0800164#endif
165
166static struct memtype_reserve apq8064_reserve_table[] __initdata = {
167 [MEMTYPE_SMI] = {
168 },
169 [MEMTYPE_EBI0] = {
170 .flags = MEMTYPE_FLAGS_1M_ALIGN,
171 },
172 [MEMTYPE_EBI1] = {
173 .flags = MEMTYPE_FLAGS_1M_ALIGN,
174 },
175};
Kevin Chan13be4e22011-10-20 11:30:32 -0700176
177static void __init size_pmem_devices(void)
178{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800179#ifdef CONFIG_ANDROID_PMEM
180#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700181 android_pmem_adsp_pdata.size = pmem_adsp_size;
182 android_pmem_pdata.size = pmem_size;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800183#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700184 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800185#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700186}
187
188static void __init reserve_memory_for(struct android_pmem_platform_data *p)
189{
190 apq8064_reserve_table[p->memory_type].size += p->size;
191}
192
Kevin Chan13be4e22011-10-20 11:30:32 -0700193static void __init reserve_pmem_memory(void)
194{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800195#ifdef CONFIG_ANDROID_PMEM
196#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700197 reserve_memory_for(&android_pmem_adsp_pdata);
198 reserve_memory_for(&android_pmem_pdata);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800199#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700200 reserve_memory_for(&android_pmem_audio_pdata);
201 apq8064_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800202#endif
203}
204
205static int apq8064_paddr_to_memtype(unsigned int paddr)
206{
207 return MEMTYPE_EBI1;
208}
209
210#ifdef CONFIG_ION_MSM
211#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
212static struct ion_cp_heap_pdata cp_mm_ion_pdata = {
213 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugand3d29682012-01-19 10:57:07 -0800214 .align = PAGE_SIZE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800215};
216
217static struct ion_cp_heap_pdata cp_mfc_ion_pdata = {
218 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugand3d29682012-01-19 10:57:07 -0800219 .align = PAGE_SIZE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800220};
221
222static struct ion_co_heap_pdata co_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800223 .adjacent_mem_id = INVALID_HEAP_ID,
224 .align = PAGE_SIZE,
225};
226
227static struct ion_co_heap_pdata fw_co_ion_pdata = {
228 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
229 .align = SZ_128K,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800230};
231#endif
232static struct ion_platform_data ion_pdata = {
233 .nr = MSM_ION_HEAP_NUM,
234 .heaps = {
235 {
236 .id = ION_SYSTEM_HEAP_ID,
237 .type = ION_HEAP_TYPE_SYSTEM,
238 .name = ION_VMALLOC_HEAP_NAME,
239 },
240#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
241 {
242 .id = ION_SF_HEAP_ID,
243 .type = ION_HEAP_TYPE_CARVEOUT,
244 .name = ION_SF_HEAP_NAME,
245 .size = MSM_ION_SF_SIZE,
246 .memory_type = ION_EBI_TYPE,
247 .extra_data = (void *) &co_ion_pdata,
248 },
249 {
250 .id = ION_CP_MM_HEAP_ID,
251 .type = ION_HEAP_TYPE_CP,
252 .name = ION_MM_HEAP_NAME,
253 .size = MSM_ION_MM_SIZE,
254 .memory_type = ION_EBI_TYPE,
255 .extra_data = (void *) &cp_mm_ion_pdata,
256 },
257 {
Olav Haugand3d29682012-01-19 10:57:07 -0800258 .id = ION_MM_FIRMWARE_HEAP_ID,
259 .type = ION_HEAP_TYPE_CARVEOUT,
260 .name = ION_MM_FIRMWARE_HEAP_NAME,
261 .size = MSM_ION_MM_FW_SIZE,
262 .memory_type = ION_EBI_TYPE,
263 .extra_data = (void *) &fw_co_ion_pdata,
264 },
265 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800266 .id = ION_CP_MFC_HEAP_ID,
267 .type = ION_HEAP_TYPE_CP,
268 .name = ION_MFC_HEAP_NAME,
269 .size = MSM_ION_MFC_SIZE,
270 .memory_type = ION_EBI_TYPE,
271 .extra_data = (void *) &cp_mfc_ion_pdata,
272 },
273 {
274 .id = ION_IOMMU_HEAP_ID,
275 .type = ION_HEAP_TYPE_IOMMU,
276 .name = ION_IOMMU_HEAP_NAME,
277 },
Olav Hauganf45e2142012-01-19 11:01:01 -0800278 {
279 .id = ION_QSECOM_HEAP_ID,
280 .type = ION_HEAP_TYPE_CARVEOUT,
281 .name = ION_QSECOM_HEAP_NAME,
282 .size = MSM_ION_QSECOM_SIZE,
283 .memory_type = ION_EBI_TYPE,
284 .extra_data = (void *) &co_ion_pdata,
285 },
Olav Haugan2c43fac2012-01-19 11:06:37 -0800286 {
287 .id = ION_AUDIO_HEAP_ID,
288 .type = ION_HEAP_TYPE_CARVEOUT,
289 .name = ION_AUDIO_HEAP_NAME,
290 .size = MSM_ION_AUDIO_SIZE,
291 .memory_type = ION_EBI_TYPE,
292 .extra_data = (void *) &co_ion_pdata,
293 },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800294#endif
295 }
296};
297
298static struct platform_device ion_dev = {
299 .name = "ion-msm",
300 .id = 1,
301 .dev = { .platform_data = &ion_pdata },
302};
303#endif
304
305static void reserve_ion_memory(void)
306{
307#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
308 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_SIZE;
Olav Haugand3d29682012-01-19 10:57:07 -0800309 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_FW_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800310 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_SF_SIZE;
311 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MFC_SIZE;
Olav Hauganf45e2142012-01-19 11:01:01 -0800312 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_QSECOM_SIZE;
Olav Haugan2c43fac2012-01-19 11:06:37 -0800313 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_AUDIO_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800314#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700315}
316
Huaibin Yang4a084e32011-12-15 15:25:52 -0800317static void __init reserve_mdp_memory(void)
318{
319 apq8064_mdp_writeback(apq8064_reserve_table);
320}
321
Kevin Chan13be4e22011-10-20 11:30:32 -0700322static void __init apq8064_calculate_reserve_sizes(void)
323{
324 size_pmem_devices();
325 reserve_pmem_memory();
Olav Haugan7c6aa742012-01-16 16:47:37 -0800326 reserve_ion_memory();
Huaibin Yang4a084e32011-12-15 15:25:52 -0800327 reserve_mdp_memory();
Kevin Chan13be4e22011-10-20 11:30:32 -0700328}
329
330static struct reserve_info apq8064_reserve_info __initdata = {
331 .memtype_reserve_table = apq8064_reserve_table,
332 .calculate_reserve_sizes = apq8064_calculate_reserve_sizes,
333 .paddr_to_memtype = apq8064_paddr_to_memtype,
334};
335
336static int apq8064_memory_bank_size(void)
337{
338 return 1<<29;
339}
340
341static void __init locate_unstable_memory(void)
342{
343 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
344 unsigned long bank_size;
345 unsigned long low, high;
346
347 bank_size = apq8064_memory_bank_size();
348 low = meminfo.bank[0].start;
349 high = mb->start + mb->size;
Olav Haugand76e3a82012-01-16 16:55:07 -0800350
351 /* Check if 32 bit overflow occured */
352 if (high < mb->start)
353 high = ~0UL;
354
Kevin Chan13be4e22011-10-20 11:30:32 -0700355 low &= ~(bank_size - 1);
356
357 if (high - low <= bank_size)
358 return;
Jack Cheung46bfffa2012-01-19 15:26:24 -0800359 apq8064_reserve_info.low_unstable_address = mb->start -
360 MIN_MEMORY_BLOCK_SIZE + mb->size;
361 apq8064_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
362
Kevin Chan13be4e22011-10-20 11:30:32 -0700363 apq8064_reserve_info.bank_size = bank_size;
364 pr_info("low unstable address %lx max size %lx bank size %lx\n",
365 apq8064_reserve_info.low_unstable_address,
366 apq8064_reserve_info.max_unstable_size,
367 apq8064_reserve_info.bank_size);
368}
369
370static void __init apq8064_reserve(void)
371{
372 reserve_info = &apq8064_reserve_info;
373 locate_unstable_memory();
374 msm_reserve();
375}
376
Hemant Kumar4933b072011-10-17 23:43:11 -0700377static struct platform_device android_usb_device = {
378 .name = "android_usb",
379 .id = -1,
380};
381
382static struct msm_otg_platform_data msm_otg_pdata = {
Hemant Kumard86c4882012-01-24 19:39:37 -0800383 .mode = USB_OTG,
384 .otg_control = OTG_PMIC_CONTROL,
Hemant Kumar4933b072011-10-17 23:43:11 -0700385 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Hemant Kumard86c4882012-01-24 19:39:37 -0800386 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
387 .power_budget = 750,
Hemant Kumar4933b072011-10-17 23:43:11 -0700388};
389
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800390#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
391
392/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
393 * 4 micbiases are used to power various analog and digital
394 * microphones operating at 1800 mV. Technically, all micbiases
395 * can source from single cfilter since all microphones operate
396 * at the same voltage level. The arrangement below is to make
397 * sure all cfilters are exercised. LDO_H regulator ouput level
398 * does not need to be as high as 2.85V. It is choosen for
399 * microphone sensitivity purpose.
400 */
401static struct tabla_pdata apq8064_tabla_platform_data = {
402 .slimbus_slave_device = {
403 .name = "tabla-slave",
404 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
405 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800406 .irq = MSM_GPIO_TO_INT(42),
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800407 .irq_base = TABLA_INTERRUPT_BASE,
408 .num_irqs = NR_TABLA_IRQS,
409 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
410 .micbias = {
411 .ldoh_v = TABLA_LDOH_2P85_V,
412 .cfilt1_mv = 1800,
413 .cfilt2_mv = 1800,
414 .cfilt3_mv = 1800,
415 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
416 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
417 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
418 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
419 }
420};
421
422static struct slim_device apq8064_slim_tabla = {
423 .name = "tabla-slim",
424 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
425 .dev = {
426 .platform_data = &apq8064_tabla_platform_data,
427 },
428};
429
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800430static struct tabla_pdata apq8064_tabla20_platform_data = {
431 .slimbus_slave_device = {
432 .name = "tabla-slave",
433 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
434 },
435 .irq = MSM_GPIO_TO_INT(42),
436 .irq_base = TABLA_INTERRUPT_BASE,
437 .num_irqs = NR_TABLA_IRQS,
438 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
439 .micbias = {
440 .ldoh_v = TABLA_LDOH_2P85_V,
441 .cfilt1_mv = 1800,
442 .cfilt2_mv = 1800,
443 .cfilt3_mv = 1800,
444 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
445 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
446 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
447 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
448 }
449};
450
451static struct slim_device apq8064_slim_tabla20 = {
452 .name = "tabla2x-slim",
453 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
454 .dev = {
455 .platform_data = &apq8064_tabla20_platform_data,
456 },
457};
458
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700459#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
460 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
461 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
462 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
463
464#define QCE_SIZE 0x10000
465#define QCE_0_BASE 0x11000000
466
467#define QCE_HW_KEY_SUPPORT 0
468#define QCE_SHA_HMAC_SUPPORT 1
469#define QCE_SHARE_CE_RESOURCE 3
470#define QCE_CE_SHARED 0
471
472static struct resource qcrypto_resources[] = {
473 [0] = {
474 .start = QCE_0_BASE,
475 .end = QCE_0_BASE + QCE_SIZE - 1,
476 .flags = IORESOURCE_MEM,
477 },
478 [1] = {
479 .name = "crypto_channels",
480 .start = DMOV8064_CE_IN_CHAN,
481 .end = DMOV8064_CE_OUT_CHAN,
482 .flags = IORESOURCE_DMA,
483 },
484 [2] = {
485 .name = "crypto_crci_in",
486 .start = DMOV8064_CE_IN_CRCI,
487 .end = DMOV8064_CE_IN_CRCI,
488 .flags = IORESOURCE_DMA,
489 },
490 [3] = {
491 .name = "crypto_crci_out",
492 .start = DMOV8064_CE_OUT_CRCI,
493 .end = DMOV8064_CE_OUT_CRCI,
494 .flags = IORESOURCE_DMA,
495 },
496};
497
498static struct resource qcedev_resources[] = {
499 [0] = {
500 .start = QCE_0_BASE,
501 .end = QCE_0_BASE + QCE_SIZE - 1,
502 .flags = IORESOURCE_MEM,
503 },
504 [1] = {
505 .name = "crypto_channels",
506 .start = DMOV8064_CE_IN_CHAN,
507 .end = DMOV8064_CE_OUT_CHAN,
508 .flags = IORESOURCE_DMA,
509 },
510 [2] = {
511 .name = "crypto_crci_in",
512 .start = DMOV8064_CE_IN_CRCI,
513 .end = DMOV8064_CE_IN_CRCI,
514 .flags = IORESOURCE_DMA,
515 },
516 [3] = {
517 .name = "crypto_crci_out",
518 .start = DMOV8064_CE_OUT_CRCI,
519 .end = DMOV8064_CE_OUT_CRCI,
520 .flags = IORESOURCE_DMA,
521 },
522};
523
524#endif
525
526#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
527 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
528
529static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
530 .ce_shared = QCE_CE_SHARED,
531 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
532 .hw_key_support = QCE_HW_KEY_SUPPORT,
533 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800534 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700535};
536
537static struct platform_device qcrypto_device = {
538 .name = "qcrypto",
539 .id = 0,
540 .num_resources = ARRAY_SIZE(qcrypto_resources),
541 .resource = qcrypto_resources,
542 .dev = {
543 .coherent_dma_mask = DMA_BIT_MASK(32),
544 .platform_data = &qcrypto_ce_hw_suppport,
545 },
546};
547#endif
548
549#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
550 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
551
552static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
553 .ce_shared = QCE_CE_SHARED,
554 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
555 .hw_key_support = QCE_HW_KEY_SUPPORT,
556 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800557 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700558};
559
560static struct platform_device qcedev_device = {
561 .name = "qce",
562 .id = 0,
563 .num_resources = ARRAY_SIZE(qcedev_resources),
564 .resource = qcedev_resources,
565 .dev = {
566 .coherent_dma_mask = DMA_BIT_MASK(32),
567 .platform_data = &qcedev_ce_hw_suppport,
568 },
569};
570#endif
571
572
Jeff Hugo0c0f5e92011-09-28 13:55:45 -0600573#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700574static void __init apq8064_map_io(void)
575{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -0600576 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700577 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -0700578 if (socinfo_init() < 0)
579 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700580}
581
582static void __init apq8064_init_irq(void)
583{
Praveen Chidambaram78499012011-11-01 17:15:17 -0600584 struct msm_mpm_device_data *data = NULL;
585
586#ifdef CONFIG_MSM_MPM
587 data = &apq8064_mpm_dev_data;
588#endif
589
590 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700591 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
592 (void *)MSM_QGIC_CPU_BASE);
593
594 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
595 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
596
597 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
598 mb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700599}
600
Jay Chokshi7805b5a2011-11-07 15:55:30 -0800601static struct platform_device msm8064_device_saw_regulator_core0 = {
602 .name = "saw-regulator",
603 .id = 0,
604 .dev = {
605 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
606 },
607};
608
609static struct platform_device msm8064_device_saw_regulator_core1 = {
610 .name = "saw-regulator",
611 .id = 1,
612 .dev = {
613 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
614 },
615};
616
617static struct platform_device msm8064_device_saw_regulator_core2 = {
618 .name = "saw-regulator",
619 .id = 2,
620 .dev = {
621 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
622 },
623};
624
625static struct platform_device msm8064_device_saw_regulator_core3 = {
626 .name = "saw-regulator",
627 .id = 3,
628 .dev = {
629 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -0600630
631 },
632};
633
634static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
635 {
636 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
637 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
638 true,
639 100, 8000, 100000, 1,
640 },
641
642 {
643 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
644 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
645 true,
646 2000, 6000, 60100000, 3000,
647 },
648
649 {
650 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
651 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
652 false,
653 4200, 5000, 60350000, 3500,
654 },
655
656 {
657 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
658 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
659 false,
660 6300, 4500, 65350000, 4800,
661 },
662
663 {
664 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
665 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
666 false,
667 11700, 2500, 67850000, 5500,
668 },
669
670 {
671 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
672 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
673 false,
674 13800, 2000, 71850000, 6800,
675 },
676
677 {
678 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
679 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
680 false,
681 29700, 500, 75850000, 8800,
682 },
683
684 {
685 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
686 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
687 false,
688 29700, 0, 76350000, 9800,
689 },
690};
691
692static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
693 .mode = MSM_PM_BOOT_CONFIG_TZ,
694};
695
696static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
697 .levels = &msm_rpmrs_levels[0],
698 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
699 .vdd_mem_levels = {
700 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
701 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
702 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
703 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
704 },
705 .vdd_dig_levels = {
706 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
707 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
708 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
709 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
710 },
711 .vdd_mask = 0x7FFFFF,
712 .rpmrs_target_id = {
713 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
714 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
715 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
716 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
717 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
718 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
719 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
720 },
721};
722
723static struct msm_cpuidle_state msm_cstates[] __initdata = {
724 {0, 0, "C0", "WFI",
725 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
726
727 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
728 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
729
730 {0, 2, "C2", "POWER_COLLAPSE",
731 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
732
733 {1, 0, "C0", "WFI",
734 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
735
736 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
737 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
738
739 {2, 0, "C0", "WFI",
740 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
741
742 {2, 1, "C1", "STANDALONE_POWER_COLLAPSE",
743 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
744
745 {3, 0, "C0", "WFI",
746 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
747
748 {3, 1, "C1", "STANDALONE_POWER_COLLAPSE",
749 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
750};
751
752static struct msm_pm_platform_data msm_pm_data[] = {
753 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
754 .idle_supported = 1,
755 .suspend_supported = 1,
756 .idle_enabled = 0,
757 .suspend_enabled = 0,
758 },
759
760 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
761 .idle_supported = 1,
762 .suspend_supported = 1,
763 .idle_enabled = 0,
764 .suspend_enabled = 0,
765 },
766
767 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
768 .idle_supported = 1,
769 .suspend_supported = 1,
770 .idle_enabled = 1,
771 .suspend_enabled = 1,
772 },
773
774 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
775 .idle_supported = 0,
776 .suspend_supported = 1,
777 .idle_enabled = 0,
778 .suspend_enabled = 0,
779 },
780
781 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
782 .idle_supported = 1,
783 .suspend_supported = 1,
784 .idle_enabled = 0,
785 .suspend_enabled = 0,
786 },
787
788 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
789 .idle_supported = 1,
790 .suspend_supported = 0,
791 .idle_enabled = 1,
792 .suspend_enabled = 0,
793 },
794
795 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
796 .idle_supported = 0,
797 .suspend_supported = 1,
798 .idle_enabled = 0,
799 .suspend_enabled = 0,
800 },
801
802 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
803 .idle_supported = 1,
804 .suspend_supported = 1,
805 .idle_enabled = 0,
806 .suspend_enabled = 0,
807 },
808
809 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
810 .idle_supported = 1,
811 .suspend_supported = 0,
812 .idle_enabled = 1,
813 .suspend_enabled = 0,
814 },
815
816 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
817 .idle_supported = 0,
818 .suspend_supported = 1,
819 .idle_enabled = 0,
820 .suspend_enabled = 0,
821 },
822
823 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
824 .idle_supported = 1,
825 .suspend_supported = 1,
826 .idle_enabled = 0,
827 .suspend_enabled = 0,
828 },
829
830 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
831 .idle_supported = 1,
832 .suspend_supported = 0,
833 .idle_enabled = 1,
834 .suspend_enabled = 0,
835 },
836};
837
838static uint8_t spm_wfi_cmd_sequence[] __initdata = {
839 0x03, 0x0f,
840};
841
842static uint8_t spm_power_collapse_without_rpm[] __initdata = {
843 0x00, 0x24, 0x54, 0x10,
844 0x09, 0x03, 0x01,
845 0x10, 0x54, 0x30, 0x0C,
846 0x24, 0x30, 0x0f,
847};
848
849static uint8_t spm_power_collapse_with_rpm[] __initdata = {
850 0x00, 0x24, 0x54, 0x10,
851 0x09, 0x07, 0x01, 0x0B,
852 0x10, 0x54, 0x30, 0x0C,
853 0x24, 0x30, 0x0f,
854};
855
856static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
857 [0] = {
858 .mode = MSM_SPM_MODE_CLOCK_GATING,
859 .notify_rpm = false,
860 .cmd = spm_wfi_cmd_sequence,
861 },
862 [1] = {
863 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
864 .notify_rpm = false,
865 .cmd = spm_power_collapse_without_rpm,
866 },
867 [2] = {
868 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
869 .notify_rpm = true,
870 .cmd = spm_power_collapse_with_rpm,
871 },
872};
873
874static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
875 0x00, 0x20, 0x03, 0x20,
876 0x00, 0x0f,
877};
878
879static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
880 0x00, 0x20, 0x34, 0x64,
881 0x48, 0x07, 0x48, 0x20,
882 0x50, 0x64, 0x04, 0x34,
883 0x50, 0x0f,
884};
885static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
886 0x00, 0x10, 0x34, 0x64,
887 0x48, 0x07, 0x48, 0x10,
888 0x50, 0x64, 0x04, 0x34,
889 0x50, 0x0F,
890};
891
892static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
893 [0] = {
894 .mode = MSM_SPM_L2_MODE_RETENTION,
895 .notify_rpm = false,
896 .cmd = l2_spm_wfi_cmd_sequence,
897 },
898 [1] = {
899 .mode = MSM_SPM_L2_MODE_GDHS,
900 .notify_rpm = true,
901 .cmd = l2_spm_gdhs_cmd_sequence,
902 },
903 [2] = {
904 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
905 .notify_rpm = true,
906 .cmd = l2_spm_power_off_cmd_sequence,
907 },
908};
909
910
911static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
912 [0] = {
913 .reg_base_addr = MSM_SAW_L2_BASE,
914 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
915 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
916 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
917 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
918 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
919 .modes = msm_spm_l2_seq_list,
920 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
921 },
922};
923
924static struct msm_spm_platform_data msm_spm_data[] __initdata = {
925 [0] = {
926 .reg_base_addr = MSM_SAW0_BASE,
927 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
928 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
929 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
930#if defined(CONFIG_MSM_AVS_HW)
931 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
932 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
933#endif
934 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
935 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
936 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
937 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
938 .vctl_timeout_us = 50,
939 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
940 .modes = msm_spm_seq_list,
941 },
942 [1] = {
943 .reg_base_addr = MSM_SAW1_BASE,
944 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
945 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
946 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
947#if defined(CONFIG_MSM_AVS_HW)
948 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
949 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
950#endif
951 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
952 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
953 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
954 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
955 .vctl_timeout_us = 50,
956 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
957 .modes = msm_spm_seq_list,
958 },
959 [2] = {
960 .reg_base_addr = MSM_SAW2_BASE,
961 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
962 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
963 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
964#if defined(CONFIG_MSM_AVS_HW)
965 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
966 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
967#endif
968 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
969 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
970 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
971 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
972 .vctl_timeout_us = 50,
973 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
974 .modes = msm_spm_seq_list,
975 },
976 [3] = {
977 .reg_base_addr = MSM_SAW3_BASE,
978 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
979 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
980 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
981#if defined(CONFIG_MSM_AVS_HW)
982 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
983 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
984#endif
985 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
986 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
987 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
988 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
989 .vctl_timeout_us = 50,
990 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
991 .modes = msm_spm_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -0800992 },
993};
994
Gagan Mac8a7a5d32011-11-11 16:43:06 -0700995static void __init apq8064_init_buses(void)
996{
997 msm_bus_rpm_set_mt_mask();
998 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
999 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
1000 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
1001 msm_bus_8064_apps_fabric.dev.platform_data =
1002 &msm_bus_8064_apps_fabric_pdata;
1003 msm_bus_8064_sys_fabric.dev.platform_data =
1004 &msm_bus_8064_sys_fabric_pdata;
1005 msm_bus_8064_mm_fabric.dev.platform_data =
1006 &msm_bus_8064_mm_fabric_pdata;
1007 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
1008 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
1009}
1010
David Collinsf0d00732012-01-25 15:46:50 -08001011static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
1012 .name = GPIO_REGULATOR_DEV_NAME,
1013 .id = PM8921_MPP_PM_TO_SYS(7),
1014 .dev = {
1015 .platform_data
1016 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
1017 },
1018};
1019
1020static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
1021 .name = GPIO_REGULATOR_DEV_NAME,
1022 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
1023 .dev = {
1024 .platform_data =
1025 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
1026 },
1027};
1028
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001029static struct platform_device *common_devices[] __initdata = {
Jin Hong01f2dbb2011-11-03 22:13:51 -07001030 &apq8064_device_dmov,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001031 &apq8064_device_qup_i2c_gsbi4,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001032 &apq8064_device_qup_spi_gsbi5,
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001033 &apq8064_slim_ctrl,
David Collinsf0d00732012-01-25 15:46:50 -08001034 &apq8064_device_ext_5v_vreg,
1035 &apq8064_device_ext_3p3v_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07001036 &apq8064_device_ssbi_pmic1,
1037 &apq8064_device_ssbi_pmic2,
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001038 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07001039 &apq8064_device_otg,
1040 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08001041 &apq8064_device_hsusb_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07001042 &android_usb_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001043#ifdef CONFIG_ANDROID_PMEM
1044#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -07001045 &android_pmem_device,
1046 &android_pmem_adsp_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001047#endif
Kevin Chan13be4e22011-10-20 11:30:32 -07001048 &android_pmem_audio_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001049#endif
1050#ifdef CONFIG_ION_MSM
1051 &ion_dev,
1052#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001053 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001054 &msm8064_device_saw_regulator_core0,
1055 &msm8064_device_saw_regulator_core1,
1056 &msm8064_device_saw_regulator_core2,
1057 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001058#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1059 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1060 &qcrypto_device,
1061#endif
1062
1063#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1064 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1065 &qcedev_device,
1066#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07001067
1068#ifdef CONFIG_HW_RANDOM_MSM
1069 &apq8064_device_rng,
1070#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08001071 &apq_pcm,
1072 &apq_pcm_routing,
1073 &apq_cpudai0,
1074 &apq_cpudai1,
1075 &apq_cpudai_hdmi_rx,
1076 &apq_cpudai_bt_rx,
1077 &apq_cpudai_bt_tx,
1078 &apq_cpudai_fm_rx,
1079 &apq_cpudai_fm_tx,
1080 &apq_cpu_fe,
1081 &apq_stub_codec,
1082 &apq_voice,
1083 &apq_voip,
1084 &apq_lpa_pcm,
1085 &apq_pcm_hostless,
1086 &apq_cpudai_afe_01_rx,
1087 &apq_cpudai_afe_01_tx,
1088 &apq_cpudai_afe_02_rx,
1089 &apq_cpudai_afe_02_tx,
1090 &apq_pcm_afe,
1091 &apq_cpudai_auxpcm_rx,
1092 &apq_cpudai_auxpcm_tx,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001093 &apq8064_rpm_device,
1094 &apq8064_rpm_log_device,
1095 &apq8064_rpm_stat_device,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001096 &msm_bus_8064_apps_fabric,
1097 &msm_bus_8064_sys_fabric,
1098 &msm_bus_8064_mm_fabric,
1099 &msm_bus_8064_sys_fpb,
1100 &msm_bus_8064_cpss_fpb,
Rajesh Sastrulaaee8af32012-01-20 11:46:31 -08001101 &msm_device_vidc,
Matt Wagantalled832652012-02-02 19:23:17 -08001102 &msm_8960_riva,
Matt Wagantallb94b9a52012-02-02 21:59:54 -08001103 &msm_8960_q6_lpass,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001104};
1105
Joel King4e7ad222011-08-17 15:47:38 -07001106static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001107 &apq8064_device_uart_gsbi3,
Yan He06913ce2011-08-26 16:33:46 -07001108 &msm_device_sps_apq8064,
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001109};
1110
1111static struct platform_device *rumi3_devices[] __initdata = {
1112 &apq8064_device_uart_gsbi1,
Yan He435ed612011-11-23 17:34:59 -08001113 &msm_device_sps_apq8064,
Huaibin Yang4a084e32011-12-15 15:25:52 -08001114#ifdef CONFIG_MSM_ROTATOR
1115 &msm_rotator_device,
1116#endif
Joel King4e7ad222011-08-17 15:47:38 -07001117};
1118
Joel King82b7e3f2012-01-05 10:03:27 -08001119static struct platform_device *cdp_devices[] __initdata = {
1120 &apq8064_device_uart_gsbi1,
1121 &msm_device_sps_apq8064,
1122};
1123
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001124static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08001125 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001126};
1127
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001128#define KS8851_IRQ_GPIO 43
1129
1130static struct spi_board_info spi_board_info[] __initdata = {
1131 {
1132 .modalias = "ks8851",
1133 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1134 .max_speed_hz = 19200000,
1135 .bus_num = 0,
1136 .chip_select = 2,
1137 .mode = SPI_MODE_0,
1138 },
1139};
1140
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001141static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001142 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001143 .bus_num = 1,
1144 .slim_slave = &apq8064_slim_tabla,
1145 },
1146 {
1147 .bus_num = 1,
1148 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001149 },
1150 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001151};
1152
Kenneth Heitke748593a2011-07-15 15:45:11 -06001153static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
1154 .clk_freq = 100000,
1155 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001156};
1157
1158static void __init apq8064_i2c_init(void)
1159{
1160 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
1161 &apq8064_i2c_qup_gsbi4_pdata;
1162}
1163
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08001164#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001165static int ethernet_init(void)
1166{
1167 int ret;
1168 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
1169 if (ret) {
1170 pr_err("ks8851 gpio_request failed: %d\n", ret);
1171 goto fail;
1172 }
1173
1174 return 0;
1175fail:
1176 return ret;
1177}
1178#else
1179static int ethernet_init(void)
1180{
1181 return 0;
1182}
1183#endif
1184
Tianyi Gou41515e22011-09-01 19:37:43 -07001185static void __init apq8064_clock_init(void)
1186{
Tianyi Gouacb588d2012-01-27 18:24:05 -08001187 if (machine_is_apq8064_rumi3())
Tianyi Gou41515e22011-09-01 19:37:43 -07001188 msm_clock_init(&apq8064_dummy_clock_init_data);
Tianyi Gouacb588d2012-01-27 18:24:05 -08001189 else
1190 msm_clock_init(&apq8064_clock_init_data);
Tianyi Gou41515e22011-09-01 19:37:43 -07001191}
1192
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001193static void __init apq8064_common_init(void)
1194{
1195 if (socinfo_init() < 0)
1196 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06001197 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
1198 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Tianyi Gou41515e22011-09-01 19:37:43 -07001199 apq8064_clock_init();
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08001200 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06001201 apq8064_i2c_init();
Kenneth Heitke36920d32011-07-20 16:44:30 -06001202
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001203 apq8064_device_qup_spi_gsbi5.dev.platform_data =
1204 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08001205 apq8064_init_pmic();
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001206 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001207 apq8064_init_buses();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001208 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Jay Chokshie8741282012-01-25 15:22:55 -08001209 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05301210 apq8064_init_mmc();
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001211 slim_register_board_info(apq8064_slim_devices,
1212 ARRAY_SIZE(apq8064_slim_devices));
Praveen Chidambaram78499012011-11-01 17:15:17 -06001213 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Mahesh Sivasubramaniancbce1ec2012-01-24 10:32:44 -07001214 acpuclk_init(&acpuclk_8064_soc_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06001215 msm_spm_l2_init(msm_spm_l2_data);
1216 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
1217 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
1218 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
1219 msm_pm_data);
1220 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Jordan Crouseb3115fe2012-02-01 22:11:12 -07001221
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001222}
1223
Huaibin Yang4a084e32011-12-15 15:25:52 -08001224static void __init apq8064_allocate_memory_regions(void)
1225{
1226 apq8064_allocate_fb_region();
1227}
1228
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001229static void __init apq8064_sim_init(void)
1230{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001231 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
1232 &msm8064_device_watchdog.dev.platform_data;
1233
1234 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001235 apq8064_common_init();
Joel King4e7ad222011-08-17 15:47:38 -07001236 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
1237}
1238
1239static void __init apq8064_rumi3_init(void)
1240{
1241 apq8064_common_init();
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001242 ethernet_init();
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001243 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001244 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Huaibin Yang4a084e32011-12-15 15:25:52 -08001245 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07001246 apq8064_init_gpu();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001247}
1248
Joel King82b7e3f2012-01-05 10:03:27 -08001249static void __init apq8064_cdp_init(void)
1250{
1251 apq8064_common_init();
1252 ethernet_init();
1253 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
1254 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Jordan Crouseb3115fe2012-02-01 22:11:12 -07001255 apq8064_init_gpu();
Joel King82b7e3f2012-01-05 10:03:27 -08001256}
1257
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001258MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
1259 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07001260 .reserve = apq8064_reserve,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001261 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05301262 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001263 .timer = &msm_timer,
1264 .init_machine = apq8064_sim_init,
1265MACHINE_END
1266
Joel King4e7ad222011-08-17 15:47:38 -07001267MACHINE_START(APQ8064_RUMI3, "QCT APQ8064 RUMI3")
1268 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07001269 .reserve = apq8064_reserve,
Joel King4e7ad222011-08-17 15:47:38 -07001270 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05301271 .handle_irq = gic_handle_irq,
Joel King4e7ad222011-08-17 15:47:38 -07001272 .timer = &msm_timer,
1273 .init_machine = apq8064_rumi3_init,
Huaibin Yang4a084e32011-12-15 15:25:52 -08001274 .init_early = apq8064_allocate_memory_regions,
Joel King4e7ad222011-08-17 15:47:38 -07001275MACHINE_END
1276
Joel King82b7e3f2012-01-05 10:03:27 -08001277MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
1278 .map_io = apq8064_map_io,
1279 .reserve = apq8064_reserve,
1280 .init_irq = apq8064_init_irq,
1281 .handle_irq = gic_handle_irq,
1282 .timer = &msm_timer,
1283 .init_machine = apq8064_cdp_init,
1284MACHINE_END
1285
1286MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
1287 .map_io = apq8064_map_io,
1288 .reserve = apq8064_reserve,
1289 .init_irq = apq8064_init_irq,
1290 .handle_irq = gic_handle_irq,
1291 .timer = &msm_timer,
1292 .init_machine = apq8064_cdp_init,
1293MACHINE_END
1294
1295MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
1296 .map_io = apq8064_map_io,
1297 .reserve = apq8064_reserve,
1298 .init_irq = apq8064_init_irq,
1299 .handle_irq = gic_handle_irq,
1300 .timer = &msm_timer,
1301 .init_machine = apq8064_cdp_init,
1302MACHINE_END
1303