blob: 924a67d844ff9becc3b2ee9ce230b6a8d3d6ef21 [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
73#define MSM_PMEM_KERNEL_EBI1_SIZE 0xB0C000
74#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
317static void __init apq8064_calculate_reserve_sizes(void)
318{
319 size_pmem_devices();
320 reserve_pmem_memory();
Olav Haugan7c6aa742012-01-16 16:47:37 -0800321 reserve_ion_memory();
Kevin Chan13be4e22011-10-20 11:30:32 -0700322}
323
324static struct reserve_info apq8064_reserve_info __initdata = {
325 .memtype_reserve_table = apq8064_reserve_table,
326 .calculate_reserve_sizes = apq8064_calculate_reserve_sizes,
327 .paddr_to_memtype = apq8064_paddr_to_memtype,
328};
329
330static int apq8064_memory_bank_size(void)
331{
332 return 1<<29;
333}
334
335static void __init locate_unstable_memory(void)
336{
337 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
338 unsigned long bank_size;
339 unsigned long low, high;
340
341 bank_size = apq8064_memory_bank_size();
342 low = meminfo.bank[0].start;
343 high = mb->start + mb->size;
Olav Haugand76e3a82012-01-16 16:55:07 -0800344
345 /* Check if 32 bit overflow occured */
346 if (high < mb->start)
347 high = ~0UL;
348
Kevin Chan13be4e22011-10-20 11:30:32 -0700349 low &= ~(bank_size - 1);
350
351 if (high - low <= bank_size)
352 return;
Jack Cheung46bfffa2012-01-19 15:26:24 -0800353 apq8064_reserve_info.low_unstable_address = mb->start -
354 MIN_MEMORY_BLOCK_SIZE + mb->size;
355 apq8064_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
356
Kevin Chan13be4e22011-10-20 11:30:32 -0700357 apq8064_reserve_info.bank_size = bank_size;
358 pr_info("low unstable address %lx max size %lx bank size %lx\n",
359 apq8064_reserve_info.low_unstable_address,
360 apq8064_reserve_info.max_unstable_size,
361 apq8064_reserve_info.bank_size);
362}
363
364static void __init apq8064_reserve(void)
365{
366 reserve_info = &apq8064_reserve_info;
367 locate_unstable_memory();
368 msm_reserve();
369}
370
Hemant Kumar4933b072011-10-17 23:43:11 -0700371static struct platform_device android_usb_device = {
372 .name = "android_usb",
373 .id = -1,
374};
375
376static struct msm_otg_platform_data msm_otg_pdata = {
377 .mode = USB_PERIPHERAL,
378 .otg_control = OTG_PHY_CONTROL,
379 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Hemant Kumar4933b072011-10-17 23:43:11 -0700380};
381
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800382#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
383
384/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
385 * 4 micbiases are used to power various analog and digital
386 * microphones operating at 1800 mV. Technically, all micbiases
387 * can source from single cfilter since all microphones operate
388 * at the same voltage level. The arrangement below is to make
389 * sure all cfilters are exercised. LDO_H regulator ouput level
390 * does not need to be as high as 2.85V. It is choosen for
391 * microphone sensitivity purpose.
392 */
393static struct tabla_pdata apq8064_tabla_platform_data = {
394 .slimbus_slave_device = {
395 .name = "tabla-slave",
396 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
397 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800398 .irq = MSM_GPIO_TO_INT(42),
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800399 .irq_base = TABLA_INTERRUPT_BASE,
400 .num_irqs = NR_TABLA_IRQS,
401 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
402 .micbias = {
403 .ldoh_v = TABLA_LDOH_2P85_V,
404 .cfilt1_mv = 1800,
405 .cfilt2_mv = 1800,
406 .cfilt3_mv = 1800,
407 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
408 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
409 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
410 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
411 }
412};
413
414static struct slim_device apq8064_slim_tabla = {
415 .name = "tabla-slim",
416 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
417 .dev = {
418 .platform_data = &apq8064_tabla_platform_data,
419 },
420};
421
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800422static struct tabla_pdata apq8064_tabla20_platform_data = {
423 .slimbus_slave_device = {
424 .name = "tabla-slave",
425 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
426 },
427 .irq = MSM_GPIO_TO_INT(42),
428 .irq_base = TABLA_INTERRUPT_BASE,
429 .num_irqs = NR_TABLA_IRQS,
430 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
431 .micbias = {
432 .ldoh_v = TABLA_LDOH_2P85_V,
433 .cfilt1_mv = 1800,
434 .cfilt2_mv = 1800,
435 .cfilt3_mv = 1800,
436 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
437 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
438 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
439 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
440 }
441};
442
443static struct slim_device apq8064_slim_tabla20 = {
444 .name = "tabla2x-slim",
445 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
446 .dev = {
447 .platform_data = &apq8064_tabla20_platform_data,
448 },
449};
450
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700451#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
452 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
453 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
454 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
455
456#define QCE_SIZE 0x10000
457#define QCE_0_BASE 0x11000000
458
459#define QCE_HW_KEY_SUPPORT 0
460#define QCE_SHA_HMAC_SUPPORT 1
461#define QCE_SHARE_CE_RESOURCE 3
462#define QCE_CE_SHARED 0
463
464static struct resource qcrypto_resources[] = {
465 [0] = {
466 .start = QCE_0_BASE,
467 .end = QCE_0_BASE + QCE_SIZE - 1,
468 .flags = IORESOURCE_MEM,
469 },
470 [1] = {
471 .name = "crypto_channels",
472 .start = DMOV8064_CE_IN_CHAN,
473 .end = DMOV8064_CE_OUT_CHAN,
474 .flags = IORESOURCE_DMA,
475 },
476 [2] = {
477 .name = "crypto_crci_in",
478 .start = DMOV8064_CE_IN_CRCI,
479 .end = DMOV8064_CE_IN_CRCI,
480 .flags = IORESOURCE_DMA,
481 },
482 [3] = {
483 .name = "crypto_crci_out",
484 .start = DMOV8064_CE_OUT_CRCI,
485 .end = DMOV8064_CE_OUT_CRCI,
486 .flags = IORESOURCE_DMA,
487 },
488};
489
490static struct resource qcedev_resources[] = {
491 [0] = {
492 .start = QCE_0_BASE,
493 .end = QCE_0_BASE + QCE_SIZE - 1,
494 .flags = IORESOURCE_MEM,
495 },
496 [1] = {
497 .name = "crypto_channels",
498 .start = DMOV8064_CE_IN_CHAN,
499 .end = DMOV8064_CE_OUT_CHAN,
500 .flags = IORESOURCE_DMA,
501 },
502 [2] = {
503 .name = "crypto_crci_in",
504 .start = DMOV8064_CE_IN_CRCI,
505 .end = DMOV8064_CE_IN_CRCI,
506 .flags = IORESOURCE_DMA,
507 },
508 [3] = {
509 .name = "crypto_crci_out",
510 .start = DMOV8064_CE_OUT_CRCI,
511 .end = DMOV8064_CE_OUT_CRCI,
512 .flags = IORESOURCE_DMA,
513 },
514};
515
516#endif
517
518#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
519 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
520
521static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
522 .ce_shared = QCE_CE_SHARED,
523 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
524 .hw_key_support = QCE_HW_KEY_SUPPORT,
525 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800526 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700527};
528
529static struct platform_device qcrypto_device = {
530 .name = "qcrypto",
531 .id = 0,
532 .num_resources = ARRAY_SIZE(qcrypto_resources),
533 .resource = qcrypto_resources,
534 .dev = {
535 .coherent_dma_mask = DMA_BIT_MASK(32),
536 .platform_data = &qcrypto_ce_hw_suppport,
537 },
538};
539#endif
540
541#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
542 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
543
544static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
545 .ce_shared = QCE_CE_SHARED,
546 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
547 .hw_key_support = QCE_HW_KEY_SUPPORT,
548 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800549 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700550};
551
552static struct platform_device qcedev_device = {
553 .name = "qce",
554 .id = 0,
555 .num_resources = ARRAY_SIZE(qcedev_resources),
556 .resource = qcedev_resources,
557 .dev = {
558 .coherent_dma_mask = DMA_BIT_MASK(32),
559 .platform_data = &qcedev_ce_hw_suppport,
560 },
561};
562#endif
563
564
Jeff Hugo0c0f5e92011-09-28 13:55:45 -0600565#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700566static void __init apq8064_map_io(void)
567{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -0600568 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700569 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -0700570 if (socinfo_init() < 0)
571 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700572}
573
574static void __init apq8064_init_irq(void)
575{
Praveen Chidambaram78499012011-11-01 17:15:17 -0600576 struct msm_mpm_device_data *data = NULL;
577
578#ifdef CONFIG_MSM_MPM
579 data = &apq8064_mpm_dev_data;
580#endif
581
582 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700583 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
584 (void *)MSM_QGIC_CPU_BASE);
585
586 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
587 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
588
589 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
590 mb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700591}
592
Jay Chokshi7805b5a2011-11-07 15:55:30 -0800593static struct platform_device msm8064_device_saw_regulator_core0 = {
594 .name = "saw-regulator",
595 .id = 0,
596 .dev = {
597 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
598 },
599};
600
601static struct platform_device msm8064_device_saw_regulator_core1 = {
602 .name = "saw-regulator",
603 .id = 1,
604 .dev = {
605 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
606 },
607};
608
609static struct platform_device msm8064_device_saw_regulator_core2 = {
610 .name = "saw-regulator",
611 .id = 2,
612 .dev = {
613 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
614 },
615};
616
617static struct platform_device msm8064_device_saw_regulator_core3 = {
618 .name = "saw-regulator",
619 .id = 3,
620 .dev = {
621 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -0600622
623 },
624};
625
626static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
627 {
628 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
629 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
630 true,
631 100, 8000, 100000, 1,
632 },
633
634 {
635 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
636 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
637 true,
638 2000, 6000, 60100000, 3000,
639 },
640
641 {
642 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
643 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
644 false,
645 4200, 5000, 60350000, 3500,
646 },
647
648 {
649 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
650 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
651 false,
652 6300, 4500, 65350000, 4800,
653 },
654
655 {
656 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
657 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
658 false,
659 11700, 2500, 67850000, 5500,
660 },
661
662 {
663 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
664 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
665 false,
666 13800, 2000, 71850000, 6800,
667 },
668
669 {
670 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
671 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
672 false,
673 29700, 500, 75850000, 8800,
674 },
675
676 {
677 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
678 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
679 false,
680 29700, 0, 76350000, 9800,
681 },
682};
683
684static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
685 .mode = MSM_PM_BOOT_CONFIG_TZ,
686};
687
688static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
689 .levels = &msm_rpmrs_levels[0],
690 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
691 .vdd_mem_levels = {
692 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
693 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
694 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
695 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
696 },
697 .vdd_dig_levels = {
698 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
699 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
700 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
701 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
702 },
703 .vdd_mask = 0x7FFFFF,
704 .rpmrs_target_id = {
705 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
706 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
707 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
708 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
709 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
710 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
711 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
712 },
713};
714
715static struct msm_cpuidle_state msm_cstates[] __initdata = {
716 {0, 0, "C0", "WFI",
717 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
718
719 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
720 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
721
722 {0, 2, "C2", "POWER_COLLAPSE",
723 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
724
725 {1, 0, "C0", "WFI",
726 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
727
728 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
729 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
730
731 {2, 0, "C0", "WFI",
732 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
733
734 {2, 1, "C1", "STANDALONE_POWER_COLLAPSE",
735 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
736
737 {3, 0, "C0", "WFI",
738 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
739
740 {3, 1, "C1", "STANDALONE_POWER_COLLAPSE",
741 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
742};
743
744static struct msm_pm_platform_data msm_pm_data[] = {
745 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
746 .idle_supported = 1,
747 .suspend_supported = 1,
748 .idle_enabled = 0,
749 .suspend_enabled = 0,
750 },
751
752 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
753 .idle_supported = 1,
754 .suspend_supported = 1,
755 .idle_enabled = 0,
756 .suspend_enabled = 0,
757 },
758
759 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
760 .idle_supported = 1,
761 .suspend_supported = 1,
762 .idle_enabled = 1,
763 .suspend_enabled = 1,
764 },
765
766 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
767 .idle_supported = 0,
768 .suspend_supported = 1,
769 .idle_enabled = 0,
770 .suspend_enabled = 0,
771 },
772
773 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
774 .idle_supported = 1,
775 .suspend_supported = 1,
776 .idle_enabled = 0,
777 .suspend_enabled = 0,
778 },
779
780 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
781 .idle_supported = 1,
782 .suspend_supported = 0,
783 .idle_enabled = 1,
784 .suspend_enabled = 0,
785 },
786
787 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
788 .idle_supported = 0,
789 .suspend_supported = 1,
790 .idle_enabled = 0,
791 .suspend_enabled = 0,
792 },
793
794 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
795 .idle_supported = 1,
796 .suspend_supported = 1,
797 .idle_enabled = 0,
798 .suspend_enabled = 0,
799 },
800
801 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
802 .idle_supported = 1,
803 .suspend_supported = 0,
804 .idle_enabled = 1,
805 .suspend_enabled = 0,
806 },
807
808 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
809 .idle_supported = 0,
810 .suspend_supported = 1,
811 .idle_enabled = 0,
812 .suspend_enabled = 0,
813 },
814
815 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
816 .idle_supported = 1,
817 .suspend_supported = 1,
818 .idle_enabled = 0,
819 .suspend_enabled = 0,
820 },
821
822 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
823 .idle_supported = 1,
824 .suspend_supported = 0,
825 .idle_enabled = 1,
826 .suspend_enabled = 0,
827 },
828};
829
830static uint8_t spm_wfi_cmd_sequence[] __initdata = {
831 0x03, 0x0f,
832};
833
834static uint8_t spm_power_collapse_without_rpm[] __initdata = {
835 0x00, 0x24, 0x54, 0x10,
836 0x09, 0x03, 0x01,
837 0x10, 0x54, 0x30, 0x0C,
838 0x24, 0x30, 0x0f,
839};
840
841static uint8_t spm_power_collapse_with_rpm[] __initdata = {
842 0x00, 0x24, 0x54, 0x10,
843 0x09, 0x07, 0x01, 0x0B,
844 0x10, 0x54, 0x30, 0x0C,
845 0x24, 0x30, 0x0f,
846};
847
848static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
849 [0] = {
850 .mode = MSM_SPM_MODE_CLOCK_GATING,
851 .notify_rpm = false,
852 .cmd = spm_wfi_cmd_sequence,
853 },
854 [1] = {
855 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
856 .notify_rpm = false,
857 .cmd = spm_power_collapse_without_rpm,
858 },
859 [2] = {
860 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
861 .notify_rpm = true,
862 .cmd = spm_power_collapse_with_rpm,
863 },
864};
865
866static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
867 0x00, 0x20, 0x03, 0x20,
868 0x00, 0x0f,
869};
870
871static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
872 0x00, 0x20, 0x34, 0x64,
873 0x48, 0x07, 0x48, 0x20,
874 0x50, 0x64, 0x04, 0x34,
875 0x50, 0x0f,
876};
877static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
878 0x00, 0x10, 0x34, 0x64,
879 0x48, 0x07, 0x48, 0x10,
880 0x50, 0x64, 0x04, 0x34,
881 0x50, 0x0F,
882};
883
884static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
885 [0] = {
886 .mode = MSM_SPM_L2_MODE_RETENTION,
887 .notify_rpm = false,
888 .cmd = l2_spm_wfi_cmd_sequence,
889 },
890 [1] = {
891 .mode = MSM_SPM_L2_MODE_GDHS,
892 .notify_rpm = true,
893 .cmd = l2_spm_gdhs_cmd_sequence,
894 },
895 [2] = {
896 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
897 .notify_rpm = true,
898 .cmd = l2_spm_power_off_cmd_sequence,
899 },
900};
901
902
903static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
904 [0] = {
905 .reg_base_addr = MSM_SAW_L2_BASE,
906 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
907 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
908 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
909 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
910 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
911 .modes = msm_spm_l2_seq_list,
912 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
913 },
914};
915
916static struct msm_spm_platform_data msm_spm_data[] __initdata = {
917 [0] = {
918 .reg_base_addr = MSM_SAW0_BASE,
919 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
920 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
921 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
922#if defined(CONFIG_MSM_AVS_HW)
923 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
924 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
925#endif
926 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
927 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
928 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
929 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
930 .vctl_timeout_us = 50,
931 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
932 .modes = msm_spm_seq_list,
933 },
934 [1] = {
935 .reg_base_addr = MSM_SAW1_BASE,
936 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
937 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
938 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
939#if defined(CONFIG_MSM_AVS_HW)
940 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
941 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
942#endif
943 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
944 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
945 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
946 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
947 .vctl_timeout_us = 50,
948 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
949 .modes = msm_spm_seq_list,
950 },
951 [2] = {
952 .reg_base_addr = MSM_SAW2_BASE,
953 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
954 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
955 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
956#if defined(CONFIG_MSM_AVS_HW)
957 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
958 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
959#endif
960 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
961 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
962 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
963 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
964 .vctl_timeout_us = 50,
965 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
966 .modes = msm_spm_seq_list,
967 },
968 [3] = {
969 .reg_base_addr = MSM_SAW3_BASE,
970 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
971 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
972 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
973#if defined(CONFIG_MSM_AVS_HW)
974 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
975 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
976#endif
977 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
978 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
979 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
980 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
981 .vctl_timeout_us = 50,
982 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
983 .modes = msm_spm_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -0800984 },
985};
986
Gagan Mac8a7a5d32011-11-11 16:43:06 -0700987static void __init apq8064_init_buses(void)
988{
989 msm_bus_rpm_set_mt_mask();
990 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
991 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
992 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
993 msm_bus_8064_apps_fabric.dev.platform_data =
994 &msm_bus_8064_apps_fabric_pdata;
995 msm_bus_8064_sys_fabric.dev.platform_data =
996 &msm_bus_8064_sys_fabric_pdata;
997 msm_bus_8064_mm_fabric.dev.platform_data =
998 &msm_bus_8064_mm_fabric_pdata;
999 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
1000 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
1001}
1002
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001003static struct platform_device *common_devices[] __initdata = {
Jin Hong01f2dbb2011-11-03 22:13:51 -07001004 &apq8064_device_dmov,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001005 &apq8064_device_qup_i2c_gsbi4,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001006 &apq8064_device_qup_spi_gsbi5,
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001007 &apq8064_slim_ctrl,
Jay Chokshi9c25f072011-09-23 18:19:15 -07001008 &apq8064_device_ssbi_pmic1,
1009 &apq8064_device_ssbi_pmic2,
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001010 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07001011 &apq8064_device_otg,
1012 &apq8064_device_gadget_peripheral,
1013 &android_usb_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001014#ifdef CONFIG_ANDROID_PMEM
1015#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -07001016 &android_pmem_device,
1017 &android_pmem_adsp_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001018#endif
Kevin Chan13be4e22011-10-20 11:30:32 -07001019 &android_pmem_audio_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001020#endif
1021#ifdef CONFIG_ION_MSM
1022 &ion_dev,
1023#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001024 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001025 &msm8064_device_saw_regulator_core0,
1026 &msm8064_device_saw_regulator_core1,
1027 &msm8064_device_saw_regulator_core2,
1028 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001029#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1030 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1031 &qcrypto_device,
1032#endif
1033
1034#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1035 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1036 &qcedev_device,
1037#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07001038
1039#ifdef CONFIG_HW_RANDOM_MSM
1040 &apq8064_device_rng,
1041#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08001042 &apq_pcm,
1043 &apq_pcm_routing,
1044 &apq_cpudai0,
1045 &apq_cpudai1,
1046 &apq_cpudai_hdmi_rx,
1047 &apq_cpudai_bt_rx,
1048 &apq_cpudai_bt_tx,
1049 &apq_cpudai_fm_rx,
1050 &apq_cpudai_fm_tx,
1051 &apq_cpu_fe,
1052 &apq_stub_codec,
1053 &apq_voice,
1054 &apq_voip,
1055 &apq_lpa_pcm,
1056 &apq_pcm_hostless,
1057 &apq_cpudai_afe_01_rx,
1058 &apq_cpudai_afe_01_tx,
1059 &apq_cpudai_afe_02_rx,
1060 &apq_cpudai_afe_02_tx,
1061 &apq_pcm_afe,
1062 &apq_cpudai_auxpcm_rx,
1063 &apq_cpudai_auxpcm_tx,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001064 &apq8064_rpm_device,
1065 &apq8064_rpm_log_device,
1066 &apq8064_rpm_stat_device,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001067 &msm_bus_8064_apps_fabric,
1068 &msm_bus_8064_sys_fabric,
1069 &msm_bus_8064_mm_fabric,
1070 &msm_bus_8064_sys_fpb,
1071 &msm_bus_8064_cpss_fpb,
Rajesh Sastrulaaee8af32012-01-20 11:46:31 -08001072 &msm_device_vidc,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001073};
1074
Joel King4e7ad222011-08-17 15:47:38 -07001075static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001076 &apq8064_device_uart_gsbi3,
Yan He06913ce2011-08-26 16:33:46 -07001077 &msm_device_sps_apq8064,
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001078};
1079
1080static struct platform_device *rumi3_devices[] __initdata = {
1081 &apq8064_device_uart_gsbi1,
Yan He435ed612011-11-23 17:34:59 -08001082 &msm_device_sps_apq8064,
Joel King4e7ad222011-08-17 15:47:38 -07001083};
1084
Joel King82b7e3f2012-01-05 10:03:27 -08001085static struct platform_device *cdp_devices[] __initdata = {
1086 &apq8064_device_uart_gsbi1,
1087 &msm_device_sps_apq8064,
1088};
1089
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001090static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Harini Jayaraman60ee14c2011-11-09 18:53:27 -07001091 .max_clock_speed = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001092};
1093
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001094#define KS8851_IRQ_GPIO 43
1095
1096static struct spi_board_info spi_board_info[] __initdata = {
1097 {
1098 .modalias = "ks8851",
1099 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1100 .max_speed_hz = 19200000,
1101 .bus_num = 0,
1102 .chip_select = 2,
1103 .mode = SPI_MODE_0,
1104 },
1105};
1106
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001107static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001108 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001109 .bus_num = 1,
1110 .slim_slave = &apq8064_slim_tabla,
1111 },
1112 {
1113 .bus_num = 1,
1114 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001115 },
1116 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001117};
1118
Kenneth Heitke748593a2011-07-15 15:45:11 -06001119static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
1120 .clk_freq = 100000,
1121 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001122};
1123
1124static void __init apq8064_i2c_init(void)
1125{
1126 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
1127 &apq8064_i2c_qup_gsbi4_pdata;
1128}
1129
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001130#ifdef CONFIG_KS8851
1131static int ethernet_init(void)
1132{
1133 int ret;
1134 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
1135 if (ret) {
1136 pr_err("ks8851 gpio_request failed: %d\n", ret);
1137 goto fail;
1138 }
1139
1140 return 0;
1141fail:
1142 return ret;
1143}
1144#else
1145static int ethernet_init(void)
1146{
1147 return 0;
1148}
1149#endif
1150
Tianyi Gou41515e22011-09-01 19:37:43 -07001151static void __init apq8064_clock_init(void)
1152{
1153 if (machine_is_apq8064_sim())
1154 msm_clock_init(&apq8064_clock_init_data);
1155 else
1156 msm_clock_init(&apq8064_dummy_clock_init_data);
1157}
1158
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001159static void __init apq8064_common_init(void)
1160{
1161 if (socinfo_init() < 0)
1162 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06001163 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
1164 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Tianyi Gou41515e22011-09-01 19:37:43 -07001165 apq8064_clock_init();
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08001166 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06001167 apq8064_i2c_init();
Kenneth Heitke36920d32011-07-20 16:44:30 -06001168
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001169 apq8064_device_qup_spi_gsbi5.dev.platform_data =
1170 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08001171 apq8064_init_pmic();
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001172 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001173 apq8064_init_buses();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001174 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Sahitya Tummala3586ed92011-08-03 09:13:23 +05301175 apq8064_init_mmc();
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001176 slim_register_board_info(apq8064_slim_devices,
1177 ARRAY_SIZE(apq8064_slim_devices));
Vikram Mulukutlabc2e9572011-11-04 03:41:38 -07001178 acpuclk_init(&acpuclk_8064_soc_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06001179 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
1180 msm_spm_l2_init(msm_spm_l2_data);
1181 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
1182 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
1183 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
1184 msm_pm_data);
1185 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001186}
1187
1188static void __init apq8064_sim_init(void)
1189{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001190 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
1191 &msm8064_device_watchdog.dev.platform_data;
1192
1193 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001194 apq8064_common_init();
Joel King4e7ad222011-08-17 15:47:38 -07001195 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
1196}
1197
1198static void __init apq8064_rumi3_init(void)
1199{
1200 apq8064_common_init();
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001201 ethernet_init();
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001202 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001203 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001204}
1205
Joel King82b7e3f2012-01-05 10:03:27 -08001206static void __init apq8064_cdp_init(void)
1207{
1208 apq8064_common_init();
1209 ethernet_init();
1210 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
1211 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
1212}
1213
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001214MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
1215 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07001216 .reserve = apq8064_reserve,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001217 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05301218 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001219 .timer = &msm_timer,
1220 .init_machine = apq8064_sim_init,
1221MACHINE_END
1222
Joel King4e7ad222011-08-17 15:47:38 -07001223MACHINE_START(APQ8064_RUMI3, "QCT APQ8064 RUMI3")
1224 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07001225 .reserve = apq8064_reserve,
Joel King4e7ad222011-08-17 15:47:38 -07001226 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05301227 .handle_irq = gic_handle_irq,
Joel King4e7ad222011-08-17 15:47:38 -07001228 .timer = &msm_timer,
1229 .init_machine = apq8064_rumi3_init,
1230MACHINE_END
1231
Joel King82b7e3f2012-01-05 10:03:27 -08001232MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
1233 .map_io = apq8064_map_io,
1234 .reserve = apq8064_reserve,
1235 .init_irq = apq8064_init_irq,
1236 .handle_irq = gic_handle_irq,
1237 .timer = &msm_timer,
1238 .init_machine = apq8064_cdp_init,
1239MACHINE_END
1240
1241MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
1242 .map_io = apq8064_map_io,
1243 .reserve = apq8064_reserve,
1244 .init_irq = apq8064_init_irq,
1245 .handle_irq = gic_handle_irq,
1246 .timer = &msm_timer,
1247 .init_machine = apq8064_cdp_init,
1248MACHINE_END
1249
1250MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
1251 .map_io = apq8064_map_io,
1252 .reserve = apq8064_reserve,
1253 .init_irq = apq8064_init_irq,
1254 .handle_irq = gic_handle_irq,
1255 .timer = &msm_timer,
1256 .init_machine = apq8064_cdp_init,
1257MACHINE_END
1258