blob: 02fff0b135db1969e34a1bd9cdb359fc6fbcb584 [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/pm.h>
53#include <mach/cpuidle.h>
Joel King4ebccc62011-07-22 09:43:22 -070054
Jeff Ohlstein7e668552011-10-06 16:17:25 -070055#include "msm_watchdog.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080056#include "board-8064.h"
Vikram Mulukutlabc2e9572011-11-04 03:41:38 -070057#include "acpuclock.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060058#include "spm.h"
59#include "mpm.h"
60#include "rpm_resources.h"
61#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 = {
383 .mode = USB_PERIPHERAL,
384 .otg_control = OTG_PHY_CONTROL,
385 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Hemant Kumar4933b072011-10-17 23:43:11 -0700386};
387
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800388#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
389
390/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
391 * 4 micbiases are used to power various analog and digital
392 * microphones operating at 1800 mV. Technically, all micbiases
393 * can source from single cfilter since all microphones operate
394 * at the same voltage level. The arrangement below is to make
395 * sure all cfilters are exercised. LDO_H regulator ouput level
396 * does not need to be as high as 2.85V. It is choosen for
397 * microphone sensitivity purpose.
398 */
399static struct tabla_pdata apq8064_tabla_platform_data = {
400 .slimbus_slave_device = {
401 .name = "tabla-slave",
402 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
403 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800404 .irq = MSM_GPIO_TO_INT(42),
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800405 .irq_base = TABLA_INTERRUPT_BASE,
406 .num_irqs = NR_TABLA_IRQS,
407 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
408 .micbias = {
409 .ldoh_v = TABLA_LDOH_2P85_V,
410 .cfilt1_mv = 1800,
411 .cfilt2_mv = 1800,
412 .cfilt3_mv = 1800,
413 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
414 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
415 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
416 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
417 }
418};
419
420static struct slim_device apq8064_slim_tabla = {
421 .name = "tabla-slim",
422 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
423 .dev = {
424 .platform_data = &apq8064_tabla_platform_data,
425 },
426};
427
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800428static struct tabla_pdata apq8064_tabla20_platform_data = {
429 .slimbus_slave_device = {
430 .name = "tabla-slave",
431 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
432 },
433 .irq = MSM_GPIO_TO_INT(42),
434 .irq_base = TABLA_INTERRUPT_BASE,
435 .num_irqs = NR_TABLA_IRQS,
436 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
437 .micbias = {
438 .ldoh_v = TABLA_LDOH_2P85_V,
439 .cfilt1_mv = 1800,
440 .cfilt2_mv = 1800,
441 .cfilt3_mv = 1800,
442 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
443 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
444 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
445 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
446 }
447};
448
449static struct slim_device apq8064_slim_tabla20 = {
450 .name = "tabla2x-slim",
451 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
452 .dev = {
453 .platform_data = &apq8064_tabla20_platform_data,
454 },
455};
456
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700457#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
458 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
459 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
460 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
461
462#define QCE_SIZE 0x10000
463#define QCE_0_BASE 0x11000000
464
465#define QCE_HW_KEY_SUPPORT 0
466#define QCE_SHA_HMAC_SUPPORT 1
467#define QCE_SHARE_CE_RESOURCE 3
468#define QCE_CE_SHARED 0
469
470static struct resource qcrypto_resources[] = {
471 [0] = {
472 .start = QCE_0_BASE,
473 .end = QCE_0_BASE + QCE_SIZE - 1,
474 .flags = IORESOURCE_MEM,
475 },
476 [1] = {
477 .name = "crypto_channels",
478 .start = DMOV8064_CE_IN_CHAN,
479 .end = DMOV8064_CE_OUT_CHAN,
480 .flags = IORESOURCE_DMA,
481 },
482 [2] = {
483 .name = "crypto_crci_in",
484 .start = DMOV8064_CE_IN_CRCI,
485 .end = DMOV8064_CE_IN_CRCI,
486 .flags = IORESOURCE_DMA,
487 },
488 [3] = {
489 .name = "crypto_crci_out",
490 .start = DMOV8064_CE_OUT_CRCI,
491 .end = DMOV8064_CE_OUT_CRCI,
492 .flags = IORESOURCE_DMA,
493 },
494};
495
496static struct resource qcedev_resources[] = {
497 [0] = {
498 .start = QCE_0_BASE,
499 .end = QCE_0_BASE + QCE_SIZE - 1,
500 .flags = IORESOURCE_MEM,
501 },
502 [1] = {
503 .name = "crypto_channels",
504 .start = DMOV8064_CE_IN_CHAN,
505 .end = DMOV8064_CE_OUT_CHAN,
506 .flags = IORESOURCE_DMA,
507 },
508 [2] = {
509 .name = "crypto_crci_in",
510 .start = DMOV8064_CE_IN_CRCI,
511 .end = DMOV8064_CE_IN_CRCI,
512 .flags = IORESOURCE_DMA,
513 },
514 [3] = {
515 .name = "crypto_crci_out",
516 .start = DMOV8064_CE_OUT_CRCI,
517 .end = DMOV8064_CE_OUT_CRCI,
518 .flags = IORESOURCE_DMA,
519 },
520};
521
522#endif
523
524#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
525 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
526
527static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
528 .ce_shared = QCE_CE_SHARED,
529 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
530 .hw_key_support = QCE_HW_KEY_SUPPORT,
531 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800532 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700533};
534
535static struct platform_device qcrypto_device = {
536 .name = "qcrypto",
537 .id = 0,
538 .num_resources = ARRAY_SIZE(qcrypto_resources),
539 .resource = qcrypto_resources,
540 .dev = {
541 .coherent_dma_mask = DMA_BIT_MASK(32),
542 .platform_data = &qcrypto_ce_hw_suppport,
543 },
544};
545#endif
546
547#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
548 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
549
550static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
551 .ce_shared = QCE_CE_SHARED,
552 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
553 .hw_key_support = QCE_HW_KEY_SUPPORT,
554 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800555 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700556};
557
558static struct platform_device qcedev_device = {
559 .name = "qce",
560 .id = 0,
561 .num_resources = ARRAY_SIZE(qcedev_resources),
562 .resource = qcedev_resources,
563 .dev = {
564 .coherent_dma_mask = DMA_BIT_MASK(32),
565 .platform_data = &qcedev_ce_hw_suppport,
566 },
567};
568#endif
569
570
Jeff Hugo0c0f5e92011-09-28 13:55:45 -0600571#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700572static void __init apq8064_map_io(void)
573{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -0600574 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700575 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -0700576 if (socinfo_init() < 0)
577 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700578}
579
580static void __init apq8064_init_irq(void)
581{
Praveen Chidambaram78499012011-11-01 17:15:17 -0600582 struct msm_mpm_device_data *data = NULL;
583
584#ifdef CONFIG_MSM_MPM
585 data = &apq8064_mpm_dev_data;
586#endif
587
588 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700589 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
590 (void *)MSM_QGIC_CPU_BASE);
591
592 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
593 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
594
595 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
596 mb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700597}
598
Jay Chokshi7805b5a2011-11-07 15:55:30 -0800599static struct platform_device msm8064_device_saw_regulator_core0 = {
600 .name = "saw-regulator",
601 .id = 0,
602 .dev = {
603 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
604 },
605};
606
607static struct platform_device msm8064_device_saw_regulator_core1 = {
608 .name = "saw-regulator",
609 .id = 1,
610 .dev = {
611 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
612 },
613};
614
615static struct platform_device msm8064_device_saw_regulator_core2 = {
616 .name = "saw-regulator",
617 .id = 2,
618 .dev = {
619 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
620 },
621};
622
623static struct platform_device msm8064_device_saw_regulator_core3 = {
624 .name = "saw-regulator",
625 .id = 3,
626 .dev = {
627 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -0600628
629 },
630};
631
632static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
633 {
634 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
635 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
636 true,
637 100, 8000, 100000, 1,
638 },
639
640 {
641 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
642 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
643 true,
644 2000, 6000, 60100000, 3000,
645 },
646
647 {
648 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
649 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
650 false,
651 4200, 5000, 60350000, 3500,
652 },
653
654 {
655 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
656 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
657 false,
658 6300, 4500, 65350000, 4800,
659 },
660
661 {
662 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
663 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
664 false,
665 11700, 2500, 67850000, 5500,
666 },
667
668 {
669 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
670 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
671 false,
672 13800, 2000, 71850000, 6800,
673 },
674
675 {
676 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
677 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
678 false,
679 29700, 500, 75850000, 8800,
680 },
681
682 {
683 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
684 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
685 false,
686 29700, 0, 76350000, 9800,
687 },
688};
689
690static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
691 .mode = MSM_PM_BOOT_CONFIG_TZ,
692};
693
694static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
695 .levels = &msm_rpmrs_levels[0],
696 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
697 .vdd_mem_levels = {
698 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
699 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
700 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
701 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
702 },
703 .vdd_dig_levels = {
704 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
705 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
706 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
707 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
708 },
709 .vdd_mask = 0x7FFFFF,
710 .rpmrs_target_id = {
711 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
712 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
713 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
714 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
715 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
716 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
717 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
718 },
719};
720
721static struct msm_cpuidle_state msm_cstates[] __initdata = {
722 {0, 0, "C0", "WFI",
723 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
724
725 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
726 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
727
728 {0, 2, "C2", "POWER_COLLAPSE",
729 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
730
731 {1, 0, "C0", "WFI",
732 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
733
734 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
735 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
736
737 {2, 0, "C0", "WFI",
738 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
739
740 {2, 1, "C1", "STANDALONE_POWER_COLLAPSE",
741 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
742
743 {3, 0, "C0", "WFI",
744 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
745
746 {3, 1, "C1", "STANDALONE_POWER_COLLAPSE",
747 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
748};
749
750static struct msm_pm_platform_data msm_pm_data[] = {
751 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
752 .idle_supported = 1,
753 .suspend_supported = 1,
754 .idle_enabled = 0,
755 .suspend_enabled = 0,
756 },
757
758 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
759 .idle_supported = 1,
760 .suspend_supported = 1,
761 .idle_enabled = 0,
762 .suspend_enabled = 0,
763 },
764
765 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
766 .idle_supported = 1,
767 .suspend_supported = 1,
768 .idle_enabled = 1,
769 .suspend_enabled = 1,
770 },
771
772 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
773 .idle_supported = 0,
774 .suspend_supported = 1,
775 .idle_enabled = 0,
776 .suspend_enabled = 0,
777 },
778
779 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
780 .idle_supported = 1,
781 .suspend_supported = 1,
782 .idle_enabled = 0,
783 .suspend_enabled = 0,
784 },
785
786 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
787 .idle_supported = 1,
788 .suspend_supported = 0,
789 .idle_enabled = 1,
790 .suspend_enabled = 0,
791 },
792
793 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
794 .idle_supported = 0,
795 .suspend_supported = 1,
796 .idle_enabled = 0,
797 .suspend_enabled = 0,
798 },
799
800 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
801 .idle_supported = 1,
802 .suspend_supported = 1,
803 .idle_enabled = 0,
804 .suspend_enabled = 0,
805 },
806
807 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
808 .idle_supported = 1,
809 .suspend_supported = 0,
810 .idle_enabled = 1,
811 .suspend_enabled = 0,
812 },
813
814 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
815 .idle_supported = 0,
816 .suspend_supported = 1,
817 .idle_enabled = 0,
818 .suspend_enabled = 0,
819 },
820
821 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
822 .idle_supported = 1,
823 .suspend_supported = 1,
824 .idle_enabled = 0,
825 .suspend_enabled = 0,
826 },
827
828 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
829 .idle_supported = 1,
830 .suspend_supported = 0,
831 .idle_enabled = 1,
832 .suspend_enabled = 0,
833 },
834};
835
836static uint8_t spm_wfi_cmd_sequence[] __initdata = {
837 0x03, 0x0f,
838};
839
840static uint8_t spm_power_collapse_without_rpm[] __initdata = {
841 0x00, 0x24, 0x54, 0x10,
842 0x09, 0x03, 0x01,
843 0x10, 0x54, 0x30, 0x0C,
844 0x24, 0x30, 0x0f,
845};
846
847static uint8_t spm_power_collapse_with_rpm[] __initdata = {
848 0x00, 0x24, 0x54, 0x10,
849 0x09, 0x07, 0x01, 0x0B,
850 0x10, 0x54, 0x30, 0x0C,
851 0x24, 0x30, 0x0f,
852};
853
854static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
855 [0] = {
856 .mode = MSM_SPM_MODE_CLOCK_GATING,
857 .notify_rpm = false,
858 .cmd = spm_wfi_cmd_sequence,
859 },
860 [1] = {
861 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
862 .notify_rpm = false,
863 .cmd = spm_power_collapse_without_rpm,
864 },
865 [2] = {
866 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
867 .notify_rpm = true,
868 .cmd = spm_power_collapse_with_rpm,
869 },
870};
871
872static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
873 0x00, 0x20, 0x03, 0x20,
874 0x00, 0x0f,
875};
876
877static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
878 0x00, 0x20, 0x34, 0x64,
879 0x48, 0x07, 0x48, 0x20,
880 0x50, 0x64, 0x04, 0x34,
881 0x50, 0x0f,
882};
883static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
884 0x00, 0x10, 0x34, 0x64,
885 0x48, 0x07, 0x48, 0x10,
886 0x50, 0x64, 0x04, 0x34,
887 0x50, 0x0F,
888};
889
890static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
891 [0] = {
892 .mode = MSM_SPM_L2_MODE_RETENTION,
893 .notify_rpm = false,
894 .cmd = l2_spm_wfi_cmd_sequence,
895 },
896 [1] = {
897 .mode = MSM_SPM_L2_MODE_GDHS,
898 .notify_rpm = true,
899 .cmd = l2_spm_gdhs_cmd_sequence,
900 },
901 [2] = {
902 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
903 .notify_rpm = true,
904 .cmd = l2_spm_power_off_cmd_sequence,
905 },
906};
907
908
909static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
910 [0] = {
911 .reg_base_addr = MSM_SAW_L2_BASE,
912 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
913 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
914 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
915 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
916 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
917 .modes = msm_spm_l2_seq_list,
918 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
919 },
920};
921
922static struct msm_spm_platform_data msm_spm_data[] __initdata = {
923 [0] = {
924 .reg_base_addr = MSM_SAW0_BASE,
925 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
926 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
927 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
928#if defined(CONFIG_MSM_AVS_HW)
929 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
930 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
931#endif
932 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
933 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
934 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
935 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
936 .vctl_timeout_us = 50,
937 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
938 .modes = msm_spm_seq_list,
939 },
940 [1] = {
941 .reg_base_addr = MSM_SAW1_BASE,
942 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
943 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
944 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
945#if defined(CONFIG_MSM_AVS_HW)
946 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
947 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
948#endif
949 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
950 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
951 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
952 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
953 .vctl_timeout_us = 50,
954 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
955 .modes = msm_spm_seq_list,
956 },
957 [2] = {
958 .reg_base_addr = MSM_SAW2_BASE,
959 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
960 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
961 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
962#if defined(CONFIG_MSM_AVS_HW)
963 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
964 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
965#endif
966 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
967 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
968 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
969 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
970 .vctl_timeout_us = 50,
971 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
972 .modes = msm_spm_seq_list,
973 },
974 [3] = {
975 .reg_base_addr = MSM_SAW3_BASE,
976 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
977 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
978 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
979#if defined(CONFIG_MSM_AVS_HW)
980 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
981 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
982#endif
983 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
984 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
985 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
986 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
987 .vctl_timeout_us = 50,
988 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
989 .modes = msm_spm_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -0800990 },
991};
992
Gagan Mac8a7a5d32011-11-11 16:43:06 -0700993static void __init apq8064_init_buses(void)
994{
995 msm_bus_rpm_set_mt_mask();
996 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
997 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
998 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
999 msm_bus_8064_apps_fabric.dev.platform_data =
1000 &msm_bus_8064_apps_fabric_pdata;
1001 msm_bus_8064_sys_fabric.dev.platform_data =
1002 &msm_bus_8064_sys_fabric_pdata;
1003 msm_bus_8064_mm_fabric.dev.platform_data =
1004 &msm_bus_8064_mm_fabric_pdata;
1005 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
1006 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
1007}
1008
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001009static struct platform_device *common_devices[] __initdata = {
Jin Hong01f2dbb2011-11-03 22:13:51 -07001010 &apq8064_device_dmov,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001011 &apq8064_device_qup_i2c_gsbi4,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001012 &apq8064_device_qup_spi_gsbi5,
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001013 &apq8064_slim_ctrl,
Jay Chokshi9c25f072011-09-23 18:19:15 -07001014 &apq8064_device_ssbi_pmic1,
1015 &apq8064_device_ssbi_pmic2,
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001016 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07001017 &apq8064_device_otg,
1018 &apq8064_device_gadget_peripheral,
1019 &android_usb_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001020#ifdef CONFIG_ANDROID_PMEM
1021#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -07001022 &android_pmem_device,
1023 &android_pmem_adsp_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001024#endif
Kevin Chan13be4e22011-10-20 11:30:32 -07001025 &android_pmem_audio_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001026#endif
1027#ifdef CONFIG_ION_MSM
1028 &ion_dev,
1029#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001030 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001031 &msm8064_device_saw_regulator_core0,
1032 &msm8064_device_saw_regulator_core1,
1033 &msm8064_device_saw_regulator_core2,
1034 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001035#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1036 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1037 &qcrypto_device,
1038#endif
1039
1040#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1041 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1042 &qcedev_device,
1043#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07001044
1045#ifdef CONFIG_HW_RANDOM_MSM
1046 &apq8064_device_rng,
1047#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08001048 &apq_pcm,
1049 &apq_pcm_routing,
1050 &apq_cpudai0,
1051 &apq_cpudai1,
1052 &apq_cpudai_hdmi_rx,
1053 &apq_cpudai_bt_rx,
1054 &apq_cpudai_bt_tx,
1055 &apq_cpudai_fm_rx,
1056 &apq_cpudai_fm_tx,
1057 &apq_cpu_fe,
1058 &apq_stub_codec,
1059 &apq_voice,
1060 &apq_voip,
1061 &apq_lpa_pcm,
1062 &apq_pcm_hostless,
1063 &apq_cpudai_afe_01_rx,
1064 &apq_cpudai_afe_01_tx,
1065 &apq_cpudai_afe_02_rx,
1066 &apq_cpudai_afe_02_tx,
1067 &apq_pcm_afe,
1068 &apq_cpudai_auxpcm_rx,
1069 &apq_cpudai_auxpcm_tx,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001070 &apq8064_rpm_device,
1071 &apq8064_rpm_log_device,
1072 &apq8064_rpm_stat_device,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001073 &msm_bus_8064_apps_fabric,
1074 &msm_bus_8064_sys_fabric,
1075 &msm_bus_8064_mm_fabric,
1076 &msm_bus_8064_sys_fpb,
1077 &msm_bus_8064_cpss_fpb,
Rajesh Sastrulaaee8af32012-01-20 11:46:31 -08001078 &msm_device_vidc,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001079};
1080
Joel King4e7ad222011-08-17 15:47:38 -07001081static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001082 &apq8064_device_uart_gsbi3,
Yan He06913ce2011-08-26 16:33:46 -07001083 &msm_device_sps_apq8064,
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001084};
1085
1086static struct platform_device *rumi3_devices[] __initdata = {
1087 &apq8064_device_uart_gsbi1,
Yan He435ed612011-11-23 17:34:59 -08001088 &msm_device_sps_apq8064,
Huaibin Yang4a084e32011-12-15 15:25:52 -08001089#ifdef CONFIG_MSM_ROTATOR
1090 &msm_rotator_device,
1091#endif
Joel King4e7ad222011-08-17 15:47:38 -07001092};
1093
Joel King82b7e3f2012-01-05 10:03:27 -08001094static struct platform_device *cdp_devices[] __initdata = {
1095 &apq8064_device_uart_gsbi1,
1096 &msm_device_sps_apq8064,
1097};
1098
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001099static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Harini Jayaraman60ee14c2011-11-09 18:53:27 -07001100 .max_clock_speed = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001101};
1102
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001103#define KS8851_IRQ_GPIO 43
1104
1105static struct spi_board_info spi_board_info[] __initdata = {
1106 {
1107 .modalias = "ks8851",
1108 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1109 .max_speed_hz = 19200000,
1110 .bus_num = 0,
1111 .chip_select = 2,
1112 .mode = SPI_MODE_0,
1113 },
1114};
1115
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001116static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001117 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001118 .bus_num = 1,
1119 .slim_slave = &apq8064_slim_tabla,
1120 },
1121 {
1122 .bus_num = 1,
1123 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001124 },
1125 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001126};
1127
Kenneth Heitke748593a2011-07-15 15:45:11 -06001128static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
1129 .clk_freq = 100000,
1130 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001131};
1132
1133static void __init apq8064_i2c_init(void)
1134{
1135 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
1136 &apq8064_i2c_qup_gsbi4_pdata;
1137}
1138
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001139#ifdef CONFIG_KS8851
1140static int ethernet_init(void)
1141{
1142 int ret;
1143 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
1144 if (ret) {
1145 pr_err("ks8851 gpio_request failed: %d\n", ret);
1146 goto fail;
1147 }
1148
1149 return 0;
1150fail:
1151 return ret;
1152}
1153#else
1154static int ethernet_init(void)
1155{
1156 return 0;
1157}
1158#endif
1159
Tianyi Gou41515e22011-09-01 19:37:43 -07001160static void __init apq8064_clock_init(void)
1161{
1162 if (machine_is_apq8064_sim())
1163 msm_clock_init(&apq8064_clock_init_data);
1164 else
1165 msm_clock_init(&apq8064_dummy_clock_init_data);
1166}
1167
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001168static void __init apq8064_common_init(void)
1169{
1170 if (socinfo_init() < 0)
1171 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06001172 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
1173 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Tianyi Gou41515e22011-09-01 19:37:43 -07001174 apq8064_clock_init();
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08001175 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06001176 apq8064_i2c_init();
Kenneth Heitke36920d32011-07-20 16:44:30 -06001177
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001178 apq8064_device_qup_spi_gsbi5.dev.platform_data =
1179 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08001180 apq8064_init_pmic();
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001181 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001182 apq8064_init_buses();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001183 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Sahitya Tummala3586ed92011-08-03 09:13:23 +05301184 apq8064_init_mmc();
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001185 slim_register_board_info(apq8064_slim_devices,
1186 ARRAY_SIZE(apq8064_slim_devices));
Praveen Chidambaram78499012011-11-01 17:15:17 -06001187 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Mahesh Sivasubramaniancbce1ec2012-01-24 10:32:44 -07001188 acpuclk_init(&acpuclk_8064_soc_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06001189 msm_spm_l2_init(msm_spm_l2_data);
1190 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
1191 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
1192 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
1193 msm_pm_data);
1194 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001195}
1196
Huaibin Yang4a084e32011-12-15 15:25:52 -08001197static void __init apq8064_allocate_memory_regions(void)
1198{
1199 apq8064_allocate_fb_region();
1200}
1201
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001202static void __init apq8064_sim_init(void)
1203{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001204 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
1205 &msm8064_device_watchdog.dev.platform_data;
1206
1207 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001208 apq8064_common_init();
Joel King4e7ad222011-08-17 15:47:38 -07001209 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
1210}
1211
1212static void __init apq8064_rumi3_init(void)
1213{
1214 apq8064_common_init();
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001215 ethernet_init();
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001216 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001217 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Huaibin Yang4a084e32011-12-15 15:25:52 -08001218 apq8064_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001219}
1220
Joel King82b7e3f2012-01-05 10:03:27 -08001221static void __init apq8064_cdp_init(void)
1222{
1223 apq8064_common_init();
1224 ethernet_init();
1225 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
1226 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
1227}
1228
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001229MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
1230 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07001231 .reserve = apq8064_reserve,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001232 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05301233 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001234 .timer = &msm_timer,
1235 .init_machine = apq8064_sim_init,
1236MACHINE_END
1237
Joel King4e7ad222011-08-17 15:47:38 -07001238MACHINE_START(APQ8064_RUMI3, "QCT APQ8064 RUMI3")
1239 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07001240 .reserve = apq8064_reserve,
Joel King4e7ad222011-08-17 15:47:38 -07001241 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05301242 .handle_irq = gic_handle_irq,
Joel King4e7ad222011-08-17 15:47:38 -07001243 .timer = &msm_timer,
1244 .init_machine = apq8064_rumi3_init,
Huaibin Yang4a084e32011-12-15 15:25:52 -08001245 .init_early = apq8064_allocate_memory_regions,
Joel King4e7ad222011-08-17 15:47:38 -07001246MACHINE_END
1247
Joel King82b7e3f2012-01-05 10:03:27 -08001248MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
1249 .map_io = apq8064_map_io,
1250 .reserve = apq8064_reserve,
1251 .init_irq = apq8064_init_irq,
1252 .handle_irq = gic_handle_irq,
1253 .timer = &msm_timer,
1254 .init_machine = apq8064_cdp_init,
1255MACHINE_END
1256
1257MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
1258 .map_io = apq8064_map_io,
1259 .reserve = apq8064_reserve,
1260 .init_irq = apq8064_init_irq,
1261 .handle_irq = gic_handle_irq,
1262 .timer = &msm_timer,
1263 .init_machine = apq8064_cdp_init,
1264MACHINE_END
1265
1266MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
1267 .map_io = apq8064_map_io,
1268 .reserve = apq8064_reserve,
1269 .init_irq = apq8064_init_irq,
1270 .handle_irq = gic_handle_irq,
1271 .timer = &msm_timer,
1272 .init_machine = apq8064_cdp_init,
1273MACHINE_END
1274