blob: ee1c91a50b764bce7b2882c227a6ea5dc66a9486 [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"
Jay Chokshiea67c622011-07-29 17:12:26 -070062
Olav Haugan7c6aa742012-01-16 16:47:37 -080063#define MSM_PMEM_ADSP_SIZE 0x7800000
Ben Romberger3ffcd812011-12-08 19:12:10 -080064#define MSM_PMEM_AUDIO_SIZE 0x2B4000
Olav Haugan7c6aa742012-01-16 16:47:37 -080065#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
66#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
67#else
68#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
69#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070070
Olav Haugan7c6aa742012-01-16 16:47:37 -080071#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
72#define MSM_PMEM_KERNEL_EBI1_SIZE 0xB0C000
73#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Haugand3d29682012-01-19 10:57:07 -080074#define MSM_ION_MM_FW_SIZE 0x200000 /* (2MB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -080075#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Hauganf45e2142012-01-19 11:01:01 -080076#define MSM_ION_QSECOM_SIZE 0x100000 /* (1MB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -080077#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan2c43fac2012-01-19 11:06:37 -080078#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
79#define MSM_ION_HEAP_NUM 8
Olav Haugan7c6aa742012-01-16 16:47:37 -080080#else
81#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
82#define MSM_ION_HEAP_NUM 1
83#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070084
Olav Haugan7c6aa742012-01-16 16:47:37 -080085#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
86static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
87static int __init pmem_kernel_ebi1_size_setup(char *p)
Kevin Chan13be4e22011-10-20 11:30:32 -070088{
Olav Haugan7c6aa742012-01-16 16:47:37 -080089 pmem_kernel_ebi1_size = memparse(p, NULL);
90 return 0;
Kevin Chan13be4e22011-10-20 11:30:32 -070091}
Olav Haugan7c6aa742012-01-16 16:47:37 -080092early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
93#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070094
Olav Haugan7c6aa742012-01-16 16:47:37 -080095#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -070096static unsigned pmem_size = MSM_PMEM_SIZE;
97static int __init pmem_size_setup(char *p)
98{
99 pmem_size = memparse(p, NULL);
100 return 0;
101}
102early_param("pmem_size", pmem_size_setup);
103
104static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
105
106static int __init pmem_adsp_size_setup(char *p)
107{
108 pmem_adsp_size = memparse(p, NULL);
109 return 0;
110}
111early_param("pmem_adsp_size", pmem_adsp_size_setup);
112
113static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
114
115static int __init pmem_audio_size_setup(char *p)
116{
117 pmem_audio_size = memparse(p, NULL);
118 return 0;
119}
120early_param("pmem_audio_size", pmem_audio_size_setup);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800121#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700122
Olav Haugan7c6aa742012-01-16 16:47:37 -0800123#ifdef CONFIG_ANDROID_PMEM
124#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700125static struct android_pmem_platform_data android_pmem_pdata = {
126 .name = "pmem",
127 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
128 .cached = 1,
129 .memory_type = MEMTYPE_EBI1,
130};
131
132static struct platform_device android_pmem_device = {
133 .name = "android_pmem",
134 .id = 0,
135 .dev = {.platform_data = &android_pmem_pdata},
136};
137
138static struct android_pmem_platform_data android_pmem_adsp_pdata = {
139 .name = "pmem_adsp",
140 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
141 .cached = 0,
142 .memory_type = MEMTYPE_EBI1,
143};
Kevin Chan13be4e22011-10-20 11:30:32 -0700144static struct platform_device android_pmem_adsp_device = {
145 .name = "android_pmem",
146 .id = 2,
147 .dev = { .platform_data = &android_pmem_adsp_pdata },
148};
Olav Haugan7c6aa742012-01-16 16:47:37 -0800149#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700150
151static struct android_pmem_platform_data android_pmem_audio_pdata = {
152 .name = "pmem_audio",
153 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
154 .cached = 0,
155 .memory_type = MEMTYPE_EBI1,
156};
157
158static struct platform_device android_pmem_audio_device = {
159 .name = "android_pmem",
160 .id = 4,
161 .dev = { .platform_data = &android_pmem_audio_pdata },
162};
Olav Haugan7c6aa742012-01-16 16:47:37 -0800163#endif
164
165static struct memtype_reserve apq8064_reserve_table[] __initdata = {
166 [MEMTYPE_SMI] = {
167 },
168 [MEMTYPE_EBI0] = {
169 .flags = MEMTYPE_FLAGS_1M_ALIGN,
170 },
171 [MEMTYPE_EBI1] = {
172 .flags = MEMTYPE_FLAGS_1M_ALIGN,
173 },
174};
Kevin Chan13be4e22011-10-20 11:30:32 -0700175
176static void __init size_pmem_devices(void)
177{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800178#ifdef CONFIG_ANDROID_PMEM
179#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700180 android_pmem_adsp_pdata.size = pmem_adsp_size;
181 android_pmem_pdata.size = pmem_size;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800182#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700183 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800184#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700185}
186
187static void __init reserve_memory_for(struct android_pmem_platform_data *p)
188{
189 apq8064_reserve_table[p->memory_type].size += p->size;
190}
191
Kevin Chan13be4e22011-10-20 11:30:32 -0700192static void __init reserve_pmem_memory(void)
193{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800194#ifdef CONFIG_ANDROID_PMEM
195#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700196 reserve_memory_for(&android_pmem_adsp_pdata);
197 reserve_memory_for(&android_pmem_pdata);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800198#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700199 reserve_memory_for(&android_pmem_audio_pdata);
200 apq8064_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800201#endif
202}
203
204static int apq8064_paddr_to_memtype(unsigned int paddr)
205{
206 return MEMTYPE_EBI1;
207}
208
209#ifdef CONFIG_ION_MSM
210#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
211static struct ion_cp_heap_pdata cp_mm_ion_pdata = {
212 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugand3d29682012-01-19 10:57:07 -0800213 .align = PAGE_SIZE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800214};
215
216static struct ion_cp_heap_pdata cp_mfc_ion_pdata = {
217 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugand3d29682012-01-19 10:57:07 -0800218 .align = PAGE_SIZE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800219};
220
221static struct ion_co_heap_pdata co_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800222 .adjacent_mem_id = INVALID_HEAP_ID,
223 .align = PAGE_SIZE,
224};
225
226static struct ion_co_heap_pdata fw_co_ion_pdata = {
227 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
228 .align = SZ_128K,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800229};
230#endif
231static struct ion_platform_data ion_pdata = {
232 .nr = MSM_ION_HEAP_NUM,
233 .heaps = {
234 {
235 .id = ION_SYSTEM_HEAP_ID,
236 .type = ION_HEAP_TYPE_SYSTEM,
237 .name = ION_VMALLOC_HEAP_NAME,
238 },
239#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
240 {
241 .id = ION_SF_HEAP_ID,
242 .type = ION_HEAP_TYPE_CARVEOUT,
243 .name = ION_SF_HEAP_NAME,
244 .size = MSM_ION_SF_SIZE,
245 .memory_type = ION_EBI_TYPE,
246 .extra_data = (void *) &co_ion_pdata,
247 },
248 {
249 .id = ION_CP_MM_HEAP_ID,
250 .type = ION_HEAP_TYPE_CP,
251 .name = ION_MM_HEAP_NAME,
252 .size = MSM_ION_MM_SIZE,
253 .memory_type = ION_EBI_TYPE,
254 .extra_data = (void *) &cp_mm_ion_pdata,
255 },
256 {
Olav Haugand3d29682012-01-19 10:57:07 -0800257 .id = ION_MM_FIRMWARE_HEAP_ID,
258 .type = ION_HEAP_TYPE_CARVEOUT,
259 .name = ION_MM_FIRMWARE_HEAP_NAME,
260 .size = MSM_ION_MM_FW_SIZE,
261 .memory_type = ION_EBI_TYPE,
262 .extra_data = (void *) &fw_co_ion_pdata,
263 },
264 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800265 .id = ION_CP_MFC_HEAP_ID,
266 .type = ION_HEAP_TYPE_CP,
267 .name = ION_MFC_HEAP_NAME,
268 .size = MSM_ION_MFC_SIZE,
269 .memory_type = ION_EBI_TYPE,
270 .extra_data = (void *) &cp_mfc_ion_pdata,
271 },
272 {
273 .id = ION_IOMMU_HEAP_ID,
274 .type = ION_HEAP_TYPE_IOMMU,
275 .name = ION_IOMMU_HEAP_NAME,
276 },
Olav Hauganf45e2142012-01-19 11:01:01 -0800277 {
278 .id = ION_QSECOM_HEAP_ID,
279 .type = ION_HEAP_TYPE_CARVEOUT,
280 .name = ION_QSECOM_HEAP_NAME,
281 .size = MSM_ION_QSECOM_SIZE,
282 .memory_type = ION_EBI_TYPE,
283 .extra_data = (void *) &co_ion_pdata,
284 },
Olav Haugan2c43fac2012-01-19 11:06:37 -0800285 {
286 .id = ION_AUDIO_HEAP_ID,
287 .type = ION_HEAP_TYPE_CARVEOUT,
288 .name = ION_AUDIO_HEAP_NAME,
289 .size = MSM_ION_AUDIO_SIZE,
290 .memory_type = ION_EBI_TYPE,
291 .extra_data = (void *) &co_ion_pdata,
292 },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800293#endif
294 }
295};
296
297static struct platform_device ion_dev = {
298 .name = "ion-msm",
299 .id = 1,
300 .dev = { .platform_data = &ion_pdata },
301};
302#endif
303
304static void reserve_ion_memory(void)
305{
306#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
307 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_SIZE;
Olav Haugand3d29682012-01-19 10:57:07 -0800308 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_FW_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800309 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_SF_SIZE;
310 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MFC_SIZE;
Olav Hauganf45e2142012-01-19 11:01:01 -0800311 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_QSECOM_SIZE;
Olav Haugan2c43fac2012-01-19 11:06:37 -0800312 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_AUDIO_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800313#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700314}
315
316static void __init apq8064_calculate_reserve_sizes(void)
317{
318 size_pmem_devices();
319 reserve_pmem_memory();
Olav Haugan7c6aa742012-01-16 16:47:37 -0800320 reserve_ion_memory();
Kevin Chan13be4e22011-10-20 11:30:32 -0700321}
322
323static struct reserve_info apq8064_reserve_info __initdata = {
324 .memtype_reserve_table = apq8064_reserve_table,
325 .calculate_reserve_sizes = apq8064_calculate_reserve_sizes,
326 .paddr_to_memtype = apq8064_paddr_to_memtype,
327};
328
329static int apq8064_memory_bank_size(void)
330{
331 return 1<<29;
332}
333
334static void __init locate_unstable_memory(void)
335{
336 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
337 unsigned long bank_size;
338 unsigned long low, high;
339
340 bank_size = apq8064_memory_bank_size();
341 low = meminfo.bank[0].start;
342 high = mb->start + mb->size;
Olav Haugand76e3a82012-01-16 16:55:07 -0800343
344 /* Check if 32 bit overflow occured */
345 if (high < mb->start)
346 high = ~0UL;
347
Kevin Chan13be4e22011-10-20 11:30:32 -0700348 low &= ~(bank_size - 1);
349
350 if (high - low <= bank_size)
351 return;
Jack Cheung46bfffa2012-01-19 15:26:24 -0800352 apq8064_reserve_info.low_unstable_address = mb->start -
353 MIN_MEMORY_BLOCK_SIZE + mb->size;
354 apq8064_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
355
Kevin Chan13be4e22011-10-20 11:30:32 -0700356 apq8064_reserve_info.bank_size = bank_size;
357 pr_info("low unstable address %lx max size %lx bank size %lx\n",
358 apq8064_reserve_info.low_unstable_address,
359 apq8064_reserve_info.max_unstable_size,
360 apq8064_reserve_info.bank_size);
361}
362
363static void __init apq8064_reserve(void)
364{
365 reserve_info = &apq8064_reserve_info;
366 locate_unstable_memory();
367 msm_reserve();
368}
369
Hemant Kumar4933b072011-10-17 23:43:11 -0700370static struct platform_device android_usb_device = {
371 .name = "android_usb",
372 .id = -1,
373};
374
375static struct msm_otg_platform_data msm_otg_pdata = {
376 .mode = USB_PERIPHERAL,
377 .otg_control = OTG_PHY_CONTROL,
378 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Hemant Kumar4933b072011-10-17 23:43:11 -0700379};
380
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800381#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
382
383/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
384 * 4 micbiases are used to power various analog and digital
385 * microphones operating at 1800 mV. Technically, all micbiases
386 * can source from single cfilter since all microphones operate
387 * at the same voltage level. The arrangement below is to make
388 * sure all cfilters are exercised. LDO_H regulator ouput level
389 * does not need to be as high as 2.85V. It is choosen for
390 * microphone sensitivity purpose.
391 */
392static struct tabla_pdata apq8064_tabla_platform_data = {
393 .slimbus_slave_device = {
394 .name = "tabla-slave",
395 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
396 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800397 .irq = MSM_GPIO_TO_INT(42),
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800398 .irq_base = TABLA_INTERRUPT_BASE,
399 .num_irqs = NR_TABLA_IRQS,
400 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
401 .micbias = {
402 .ldoh_v = TABLA_LDOH_2P85_V,
403 .cfilt1_mv = 1800,
404 .cfilt2_mv = 1800,
405 .cfilt3_mv = 1800,
406 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
407 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
408 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
409 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
410 }
411};
412
413static struct slim_device apq8064_slim_tabla = {
414 .name = "tabla-slim",
415 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
416 .dev = {
417 .platform_data = &apq8064_tabla_platform_data,
418 },
419};
420
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800421static struct tabla_pdata apq8064_tabla20_platform_data = {
422 .slimbus_slave_device = {
423 .name = "tabla-slave",
424 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
425 },
426 .irq = MSM_GPIO_TO_INT(42),
427 .irq_base = TABLA_INTERRUPT_BASE,
428 .num_irqs = NR_TABLA_IRQS,
429 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
430 .micbias = {
431 .ldoh_v = TABLA_LDOH_2P85_V,
432 .cfilt1_mv = 1800,
433 .cfilt2_mv = 1800,
434 .cfilt3_mv = 1800,
435 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
436 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
437 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
438 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
439 }
440};
441
442static struct slim_device apq8064_slim_tabla20 = {
443 .name = "tabla2x-slim",
444 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
445 .dev = {
446 .platform_data = &apq8064_tabla20_platform_data,
447 },
448};
449
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700450#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
451 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
452 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
453 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
454
455#define QCE_SIZE 0x10000
456#define QCE_0_BASE 0x11000000
457
458#define QCE_HW_KEY_SUPPORT 0
459#define QCE_SHA_HMAC_SUPPORT 1
460#define QCE_SHARE_CE_RESOURCE 3
461#define QCE_CE_SHARED 0
462
463static struct resource qcrypto_resources[] = {
464 [0] = {
465 .start = QCE_0_BASE,
466 .end = QCE_0_BASE + QCE_SIZE - 1,
467 .flags = IORESOURCE_MEM,
468 },
469 [1] = {
470 .name = "crypto_channels",
471 .start = DMOV8064_CE_IN_CHAN,
472 .end = DMOV8064_CE_OUT_CHAN,
473 .flags = IORESOURCE_DMA,
474 },
475 [2] = {
476 .name = "crypto_crci_in",
477 .start = DMOV8064_CE_IN_CRCI,
478 .end = DMOV8064_CE_IN_CRCI,
479 .flags = IORESOURCE_DMA,
480 },
481 [3] = {
482 .name = "crypto_crci_out",
483 .start = DMOV8064_CE_OUT_CRCI,
484 .end = DMOV8064_CE_OUT_CRCI,
485 .flags = IORESOURCE_DMA,
486 },
487};
488
489static struct resource qcedev_resources[] = {
490 [0] = {
491 .start = QCE_0_BASE,
492 .end = QCE_0_BASE + QCE_SIZE - 1,
493 .flags = IORESOURCE_MEM,
494 },
495 [1] = {
496 .name = "crypto_channels",
497 .start = DMOV8064_CE_IN_CHAN,
498 .end = DMOV8064_CE_OUT_CHAN,
499 .flags = IORESOURCE_DMA,
500 },
501 [2] = {
502 .name = "crypto_crci_in",
503 .start = DMOV8064_CE_IN_CRCI,
504 .end = DMOV8064_CE_IN_CRCI,
505 .flags = IORESOURCE_DMA,
506 },
507 [3] = {
508 .name = "crypto_crci_out",
509 .start = DMOV8064_CE_OUT_CRCI,
510 .end = DMOV8064_CE_OUT_CRCI,
511 .flags = IORESOURCE_DMA,
512 },
513};
514
515#endif
516
517#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
518 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
519
520static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
521 .ce_shared = QCE_CE_SHARED,
522 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
523 .hw_key_support = QCE_HW_KEY_SUPPORT,
524 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800525 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700526};
527
528static struct platform_device qcrypto_device = {
529 .name = "qcrypto",
530 .id = 0,
531 .num_resources = ARRAY_SIZE(qcrypto_resources),
532 .resource = qcrypto_resources,
533 .dev = {
534 .coherent_dma_mask = DMA_BIT_MASK(32),
535 .platform_data = &qcrypto_ce_hw_suppport,
536 },
537};
538#endif
539
540#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
541 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
542
543static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
544 .ce_shared = QCE_CE_SHARED,
545 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
546 .hw_key_support = QCE_HW_KEY_SUPPORT,
547 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800548 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700549};
550
551static struct platform_device qcedev_device = {
552 .name = "qce",
553 .id = 0,
554 .num_resources = ARRAY_SIZE(qcedev_resources),
555 .resource = qcedev_resources,
556 .dev = {
557 .coherent_dma_mask = DMA_BIT_MASK(32),
558 .platform_data = &qcedev_ce_hw_suppport,
559 },
560};
561#endif
562
563
Jeff Hugo0c0f5e92011-09-28 13:55:45 -0600564#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700565static void __init apq8064_map_io(void)
566{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -0600567 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700568 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -0700569 if (socinfo_init() < 0)
570 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700571}
572
573static void __init apq8064_init_irq(void)
574{
Praveen Chidambaram78499012011-11-01 17:15:17 -0600575 struct msm_mpm_device_data *data = NULL;
576
577#ifdef CONFIG_MSM_MPM
578 data = &apq8064_mpm_dev_data;
579#endif
580
581 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700582 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
583 (void *)MSM_QGIC_CPU_BASE);
584
585 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
586 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
587
588 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
589 mb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700590}
591
Jay Chokshi7805b5a2011-11-07 15:55:30 -0800592static struct platform_device msm8064_device_saw_regulator_core0 = {
593 .name = "saw-regulator",
594 .id = 0,
595 .dev = {
596 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
597 },
598};
599
600static struct platform_device msm8064_device_saw_regulator_core1 = {
601 .name = "saw-regulator",
602 .id = 1,
603 .dev = {
604 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
605 },
606};
607
608static struct platform_device msm8064_device_saw_regulator_core2 = {
609 .name = "saw-regulator",
610 .id = 2,
611 .dev = {
612 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
613 },
614};
615
616static struct platform_device msm8064_device_saw_regulator_core3 = {
617 .name = "saw-regulator",
618 .id = 3,
619 .dev = {
620 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -0600621
622 },
623};
624
625static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
626 {
627 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
628 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
629 true,
630 100, 8000, 100000, 1,
631 },
632
633 {
634 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
635 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
636 true,
637 2000, 6000, 60100000, 3000,
638 },
639
640 {
641 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
642 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
643 false,
644 4200, 5000, 60350000, 3500,
645 },
646
647 {
648 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
649 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
650 false,
651 6300, 4500, 65350000, 4800,
652 },
653
654 {
655 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
656 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
657 false,
658 11700, 2500, 67850000, 5500,
659 },
660
661 {
662 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
663 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
664 false,
665 13800, 2000, 71850000, 6800,
666 },
667
668 {
669 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
670 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
671 false,
672 29700, 500, 75850000, 8800,
673 },
674
675 {
676 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
677 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
678 false,
679 29700, 0, 76350000, 9800,
680 },
681};
682
683static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
684 .mode = MSM_PM_BOOT_CONFIG_TZ,
685};
686
687static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
688 .levels = &msm_rpmrs_levels[0],
689 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
690 .vdd_mem_levels = {
691 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
692 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
693 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
694 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
695 },
696 .vdd_dig_levels = {
697 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
698 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
699 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
700 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
701 },
702 .vdd_mask = 0x7FFFFF,
703 .rpmrs_target_id = {
704 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
705 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
706 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
707 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
708 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
709 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
710 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
711 },
712};
713
714static struct msm_cpuidle_state msm_cstates[] __initdata = {
715 {0, 0, "C0", "WFI",
716 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
717
718 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
719 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
720
721 {0, 2, "C2", "POWER_COLLAPSE",
722 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
723
724 {1, 0, "C0", "WFI",
725 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
726
727 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
728 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
729
730 {2, 0, "C0", "WFI",
731 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
732
733 {2, 1, "C1", "STANDALONE_POWER_COLLAPSE",
734 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
735
736 {3, 0, "C0", "WFI",
737 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
738
739 {3, 1, "C1", "STANDALONE_POWER_COLLAPSE",
740 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
741};
742
743static struct msm_pm_platform_data msm_pm_data[] = {
744 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
745 .idle_supported = 1,
746 .suspend_supported = 1,
747 .idle_enabled = 0,
748 .suspend_enabled = 0,
749 },
750
751 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
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_WAIT_FOR_INTERRUPT)] = {
759 .idle_supported = 1,
760 .suspend_supported = 1,
761 .idle_enabled = 1,
762 .suspend_enabled = 1,
763 },
764
765 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
766 .idle_supported = 0,
767 .suspend_supported = 1,
768 .idle_enabled = 0,
769 .suspend_enabled = 0,
770 },
771
772 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
773 .idle_supported = 1,
774 .suspend_supported = 1,
775 .idle_enabled = 0,
776 .suspend_enabled = 0,
777 },
778
779 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
780 .idle_supported = 1,
781 .suspend_supported = 0,
782 .idle_enabled = 1,
783 .suspend_enabled = 0,
784 },
785
786 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
787 .idle_supported = 0,
788 .suspend_supported = 1,
789 .idle_enabled = 0,
790 .suspend_enabled = 0,
791 },
792
793 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
794 .idle_supported = 1,
795 .suspend_supported = 1,
796 .idle_enabled = 0,
797 .suspend_enabled = 0,
798 },
799
800 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
801 .idle_supported = 1,
802 .suspend_supported = 0,
803 .idle_enabled = 1,
804 .suspend_enabled = 0,
805 },
806
807 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
808 .idle_supported = 0,
809 .suspend_supported = 1,
810 .idle_enabled = 0,
811 .suspend_enabled = 0,
812 },
813
814 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
815 .idle_supported = 1,
816 .suspend_supported = 1,
817 .idle_enabled = 0,
818 .suspend_enabled = 0,
819 },
820
821 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
822 .idle_supported = 1,
823 .suspend_supported = 0,
824 .idle_enabled = 1,
825 .suspend_enabled = 0,
826 },
827};
828
829static uint8_t spm_wfi_cmd_sequence[] __initdata = {
830 0x03, 0x0f,
831};
832
833static uint8_t spm_power_collapse_without_rpm[] __initdata = {
834 0x00, 0x24, 0x54, 0x10,
835 0x09, 0x03, 0x01,
836 0x10, 0x54, 0x30, 0x0C,
837 0x24, 0x30, 0x0f,
838};
839
840static uint8_t spm_power_collapse_with_rpm[] __initdata = {
841 0x00, 0x24, 0x54, 0x10,
842 0x09, 0x07, 0x01, 0x0B,
843 0x10, 0x54, 0x30, 0x0C,
844 0x24, 0x30, 0x0f,
845};
846
847static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
848 [0] = {
849 .mode = MSM_SPM_MODE_CLOCK_GATING,
850 .notify_rpm = false,
851 .cmd = spm_wfi_cmd_sequence,
852 },
853 [1] = {
854 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
855 .notify_rpm = false,
856 .cmd = spm_power_collapse_without_rpm,
857 },
858 [2] = {
859 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
860 .notify_rpm = true,
861 .cmd = spm_power_collapse_with_rpm,
862 },
863};
864
865static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
866 0x00, 0x20, 0x03, 0x20,
867 0x00, 0x0f,
868};
869
870static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
871 0x00, 0x20, 0x34, 0x64,
872 0x48, 0x07, 0x48, 0x20,
873 0x50, 0x64, 0x04, 0x34,
874 0x50, 0x0f,
875};
876static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
877 0x00, 0x10, 0x34, 0x64,
878 0x48, 0x07, 0x48, 0x10,
879 0x50, 0x64, 0x04, 0x34,
880 0x50, 0x0F,
881};
882
883static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
884 [0] = {
885 .mode = MSM_SPM_L2_MODE_RETENTION,
886 .notify_rpm = false,
887 .cmd = l2_spm_wfi_cmd_sequence,
888 },
889 [1] = {
890 .mode = MSM_SPM_L2_MODE_GDHS,
891 .notify_rpm = true,
892 .cmd = l2_spm_gdhs_cmd_sequence,
893 },
894 [2] = {
895 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
896 .notify_rpm = true,
897 .cmd = l2_spm_power_off_cmd_sequence,
898 },
899};
900
901
902static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
903 [0] = {
904 .reg_base_addr = MSM_SAW_L2_BASE,
905 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
906 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
907 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
908 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
909 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
910 .modes = msm_spm_l2_seq_list,
911 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
912 },
913};
914
915static struct msm_spm_platform_data msm_spm_data[] __initdata = {
916 [0] = {
917 .reg_base_addr = MSM_SAW0_BASE,
918 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
919 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
920 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
921#if defined(CONFIG_MSM_AVS_HW)
922 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
923 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
924#endif
925 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
926 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
927 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
928 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
929 .vctl_timeout_us = 50,
930 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
931 .modes = msm_spm_seq_list,
932 },
933 [1] = {
934 .reg_base_addr = MSM_SAW1_BASE,
935 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
936 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
937 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
938#if defined(CONFIG_MSM_AVS_HW)
939 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
940 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
941#endif
942 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
943 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
944 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
945 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
946 .vctl_timeout_us = 50,
947 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
948 .modes = msm_spm_seq_list,
949 },
950 [2] = {
951 .reg_base_addr = MSM_SAW2_BASE,
952 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
953 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
954 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
955#if defined(CONFIG_MSM_AVS_HW)
956 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
957 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
958#endif
959 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
960 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
961 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
962 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
963 .vctl_timeout_us = 50,
964 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
965 .modes = msm_spm_seq_list,
966 },
967 [3] = {
968 .reg_base_addr = MSM_SAW3_BASE,
969 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
970 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
971 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
972#if defined(CONFIG_MSM_AVS_HW)
973 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
974 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
975#endif
976 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
977 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
978 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
979 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
980 .vctl_timeout_us = 50,
981 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
982 .modes = msm_spm_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -0800983 },
984};
985
Gagan Mac8a7a5d32011-11-11 16:43:06 -0700986static void __init apq8064_init_buses(void)
987{
988 msm_bus_rpm_set_mt_mask();
989 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
990 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
991 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
992 msm_bus_8064_apps_fabric.dev.platform_data =
993 &msm_bus_8064_apps_fabric_pdata;
994 msm_bus_8064_sys_fabric.dev.platform_data =
995 &msm_bus_8064_sys_fabric_pdata;
996 msm_bus_8064_mm_fabric.dev.platform_data =
997 &msm_bus_8064_mm_fabric_pdata;
998 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
999 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
1000}
1001
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001002static struct platform_device *common_devices[] __initdata = {
Jin Hong01f2dbb2011-11-03 22:13:51 -07001003 &apq8064_device_dmov,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001004 &apq8064_device_qup_i2c_gsbi4,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001005 &apq8064_device_qup_spi_gsbi5,
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001006 &apq8064_slim_ctrl,
Jay Chokshi9c25f072011-09-23 18:19:15 -07001007 &apq8064_device_ssbi_pmic1,
1008 &apq8064_device_ssbi_pmic2,
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001009 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07001010 &apq8064_device_otg,
1011 &apq8064_device_gadget_peripheral,
1012 &android_usb_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001013#ifdef CONFIG_ANDROID_PMEM
1014#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -07001015 &android_pmem_device,
1016 &android_pmem_adsp_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001017#endif
Kevin Chan13be4e22011-10-20 11:30:32 -07001018 &android_pmem_audio_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001019#endif
1020#ifdef CONFIG_ION_MSM
1021 &ion_dev,
1022#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001023 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001024 &msm8064_device_saw_regulator_core0,
1025 &msm8064_device_saw_regulator_core1,
1026 &msm8064_device_saw_regulator_core2,
1027 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001028#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1029 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1030 &qcrypto_device,
1031#endif
1032
1033#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1034 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1035 &qcedev_device,
1036#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07001037
1038#ifdef CONFIG_HW_RANDOM_MSM
1039 &apq8064_device_rng,
1040#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08001041 &apq_pcm,
1042 &apq_pcm_routing,
1043 &apq_cpudai0,
1044 &apq_cpudai1,
1045 &apq_cpudai_hdmi_rx,
1046 &apq_cpudai_bt_rx,
1047 &apq_cpudai_bt_tx,
1048 &apq_cpudai_fm_rx,
1049 &apq_cpudai_fm_tx,
1050 &apq_cpu_fe,
1051 &apq_stub_codec,
1052 &apq_voice,
1053 &apq_voip,
1054 &apq_lpa_pcm,
1055 &apq_pcm_hostless,
1056 &apq_cpudai_afe_01_rx,
1057 &apq_cpudai_afe_01_tx,
1058 &apq_cpudai_afe_02_rx,
1059 &apq_cpudai_afe_02_tx,
1060 &apq_pcm_afe,
1061 &apq_cpudai_auxpcm_rx,
1062 &apq_cpudai_auxpcm_tx,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001063 &apq8064_rpm_device,
1064 &apq8064_rpm_log_device,
1065 &apq8064_rpm_stat_device,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001066 &msm_bus_8064_apps_fabric,
1067 &msm_bus_8064_sys_fabric,
1068 &msm_bus_8064_mm_fabric,
1069 &msm_bus_8064_sys_fpb,
1070 &msm_bus_8064_cpss_fpb,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001071};
1072
Joel King4e7ad222011-08-17 15:47:38 -07001073static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001074 &apq8064_device_uart_gsbi3,
Yan He06913ce2011-08-26 16:33:46 -07001075 &msm_device_sps_apq8064,
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001076};
1077
1078static struct platform_device *rumi3_devices[] __initdata = {
1079 &apq8064_device_uart_gsbi1,
Yan He435ed612011-11-23 17:34:59 -08001080 &msm_device_sps_apq8064,
Joel King4e7ad222011-08-17 15:47:38 -07001081};
1082
Joel King82b7e3f2012-01-05 10:03:27 -08001083static struct platform_device *cdp_devices[] __initdata = {
1084 &apq8064_device_uart_gsbi1,
1085 &msm_device_sps_apq8064,
1086};
1087
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001088static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Harini Jayaraman60ee14c2011-11-09 18:53:27 -07001089 .max_clock_speed = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001090};
1091
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001092#define KS8851_IRQ_GPIO 43
1093
1094static struct spi_board_info spi_board_info[] __initdata = {
1095 {
1096 .modalias = "ks8851",
1097 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1098 .max_speed_hz = 19200000,
1099 .bus_num = 0,
1100 .chip_select = 2,
1101 .mode = SPI_MODE_0,
1102 },
1103};
1104
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001105static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001106 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001107 .bus_num = 1,
1108 .slim_slave = &apq8064_slim_tabla,
1109 },
1110 {
1111 .bus_num = 1,
1112 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001113 },
1114 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001115};
1116
Kenneth Heitke748593a2011-07-15 15:45:11 -06001117static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
1118 .clk_freq = 100000,
1119 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001120};
1121
1122static void __init apq8064_i2c_init(void)
1123{
1124 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
1125 &apq8064_i2c_qup_gsbi4_pdata;
1126}
1127
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001128#ifdef CONFIG_KS8851
1129static int ethernet_init(void)
1130{
1131 int ret;
1132 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
1133 if (ret) {
1134 pr_err("ks8851 gpio_request failed: %d\n", ret);
1135 goto fail;
1136 }
1137
1138 return 0;
1139fail:
1140 return ret;
1141}
1142#else
1143static int ethernet_init(void)
1144{
1145 return 0;
1146}
1147#endif
1148
Tianyi Gou41515e22011-09-01 19:37:43 -07001149static void __init apq8064_clock_init(void)
1150{
1151 if (machine_is_apq8064_sim())
1152 msm_clock_init(&apq8064_clock_init_data);
1153 else
1154 msm_clock_init(&apq8064_dummy_clock_init_data);
1155}
1156
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001157static void __init apq8064_common_init(void)
1158{
1159 if (socinfo_init() < 0)
1160 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06001161 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
1162 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Tianyi Gou41515e22011-09-01 19:37:43 -07001163 apq8064_clock_init();
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08001164 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06001165 apq8064_i2c_init();
Kenneth Heitke36920d32011-07-20 16:44:30 -06001166
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001167 apq8064_device_qup_spi_gsbi5.dev.platform_data =
1168 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08001169 apq8064_init_pmic();
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001170 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001171 apq8064_init_buses();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001172 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Sahitya Tummala3586ed92011-08-03 09:13:23 +05301173 apq8064_init_mmc();
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001174 slim_register_board_info(apq8064_slim_devices,
1175 ARRAY_SIZE(apq8064_slim_devices));
Vikram Mulukutlabc2e9572011-11-04 03:41:38 -07001176 acpuclk_init(&acpuclk_8064_soc_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06001177 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
1178 msm_spm_l2_init(msm_spm_l2_data);
1179 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
1180 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
1181 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
1182 msm_pm_data);
1183 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001184}
1185
1186static void __init apq8064_sim_init(void)
1187{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001188 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
1189 &msm8064_device_watchdog.dev.platform_data;
1190
1191 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001192 apq8064_common_init();
Joel King4e7ad222011-08-17 15:47:38 -07001193 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
1194}
1195
1196static void __init apq8064_rumi3_init(void)
1197{
1198 apq8064_common_init();
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001199 ethernet_init();
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001200 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001201 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001202}
1203
Joel King82b7e3f2012-01-05 10:03:27 -08001204static void __init apq8064_cdp_init(void)
1205{
1206 apq8064_common_init();
1207 ethernet_init();
1208 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
1209 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
1210}
1211
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001212MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
1213 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07001214 .reserve = apq8064_reserve,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001215 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05301216 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001217 .timer = &msm_timer,
1218 .init_machine = apq8064_sim_init,
1219MACHINE_END
1220
Joel King4e7ad222011-08-17 15:47:38 -07001221MACHINE_START(APQ8064_RUMI3, "QCT APQ8064 RUMI3")
1222 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07001223 .reserve = apq8064_reserve,
Joel King4e7ad222011-08-17 15:47:38 -07001224 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05301225 .handle_irq = gic_handle_irq,
Joel King4e7ad222011-08-17 15:47:38 -07001226 .timer = &msm_timer,
1227 .init_machine = apq8064_rumi3_init,
1228MACHINE_END
1229
Joel King82b7e3f2012-01-05 10:03:27 -08001230MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
1231 .map_io = apq8064_map_io,
1232 .reserve = apq8064_reserve,
1233 .init_irq = apq8064_init_irq,
1234 .handle_irq = gic_handle_irq,
1235 .timer = &msm_timer,
1236 .init_machine = apq8064_cdp_init,
1237MACHINE_END
1238
1239MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
1240 .map_io = apq8064_map_io,
1241 .reserve = apq8064_reserve,
1242 .init_irq = apq8064_init_irq,
1243 .handle_irq = gic_handle_irq,
1244 .timer = &msm_timer,
1245 .init_machine = apq8064_cdp_init,
1246MACHINE_END
1247
1248MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
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