blob: 59a766381d532d5839e8a332d91154c768460118 [file] [log] [blame]
Manu Gautam5143b252012-01-05 19:25:23 -08001/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13#include <linux/kernel.h>
14#include <linux/platform_device.h>
15#include <linux/io.h>
16#include <linux/irq.h>
Kenneth Heitke748593a2011-07-15 15:45:11 -060017#include <linux/i2c.h>
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -060018#include <linux/slimbus/slimbus.h>
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -080019#include <linux/mfd/wcd9310/core.h>
20#include <linux/mfd/wcd9310/pdata.h>
Kenneth Heitke36920d32011-07-20 16:44:30 -060021#include <linux/msm_ssbi.h>
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -070022#include <linux/spi/spi.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070023#include <linux/dma-mapping.h>
24#include <linux/platform_data/qcom_crypto_device.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080025#include <linux/ion.h>
Jack Cheung46bfffa2012-01-19 15:26:24 -080026#include <linux/memory.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070027#include <asm/mach-types.h>
28#include <asm/mach/arch.h>
29#include <asm/hardware/gic.h>
Sahitya Tummala3586ed92011-08-03 09:13:23 +053030#include <asm/mach/mmc.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070031
32#include <mach/board.h>
33#include <mach/msm_iomap.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080034#include <mach/ion.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070035#include <linux/usb/msm_hsusb.h>
36#include <linux/usb/android.h>
37#include <mach/socinfo.h>
Harini Jayaramanc4c58692011-07-19 14:50:10 -060038#include <mach/msm_spi.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070039#include "timer.h"
40#include "devices.h"
Joel King4ebccc62011-07-22 09:43:22 -070041#include <mach/gpio.h>
42#include <mach/gpiomux.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060043#include <mach/rpm.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080044#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -070045#include <linux/android_pmem.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080046#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070047#include <mach/msm_memtypes.h>
48#include <linux/bootmem.h>
49#include <asm/setup.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070050#include <mach/dma.h>
Gagan Mac8a7a5d32011-11-11 16:43:06 -070051#include <mach/msm_bus_board.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060052#include <mach/cpuidle.h>
Joel Kingdacbc822012-01-25 13:30:57 -080053#include <mach/mdm2.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"
Matt Wagantall7cca4642012-02-01 16:43:24 -080061#include "pm.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060062#include "pm-boot.h"
Rajesh Sastrulaaee8af32012-01-20 11:46:31 -080063#include "devices-msm8x60.h"
Jay Chokshiea67c622011-07-29 17:12:26 -070064
Olav Haugan7c6aa742012-01-16 16:47:37 -080065#define MSM_PMEM_ADSP_SIZE 0x7800000
Ben Romberger3ffcd812011-12-08 19:12:10 -080066#define MSM_PMEM_AUDIO_SIZE 0x2B4000
Olav Haugan7c6aa742012-01-16 16:47:37 -080067#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
68#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
69#else
70#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
71#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070072
Olav Haugan7c6aa742012-01-16 16:47:37 -080073#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Olav Hauganedcf6832012-01-24 08:35:41 -080074#define MSM_PMEM_KERNEL_EBI1_SIZE 0x280000
Olav Haugan7c6aa742012-01-16 16:47:37 -080075#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Haugand3d29682012-01-19 10:57:07 -080076#define MSM_ION_MM_FW_SIZE 0x200000 /* (2MB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -080077#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Hauganf45e2142012-01-19 11:01:01 -080078#define MSM_ION_QSECOM_SIZE 0x100000 /* (1MB) */
Olav Haugan7c6aa742012-01-16 16:47:37 -080079#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan2c43fac2012-01-19 11:06:37 -080080#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
81#define MSM_ION_HEAP_NUM 8
Olav Haugan7c6aa742012-01-16 16:47:37 -080082#else
83#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
84#define MSM_ION_HEAP_NUM 1
85#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070086
Olav Haugan7c6aa742012-01-16 16:47:37 -080087#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
88static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
89static int __init pmem_kernel_ebi1_size_setup(char *p)
Kevin Chan13be4e22011-10-20 11:30:32 -070090{
Olav Haugan7c6aa742012-01-16 16:47:37 -080091 pmem_kernel_ebi1_size = memparse(p, NULL);
92 return 0;
Kevin Chan13be4e22011-10-20 11:30:32 -070093}
Olav Haugan7c6aa742012-01-16 16:47:37 -080094early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
95#endif
Kevin Chan13be4e22011-10-20 11:30:32 -070096
Olav Haugan7c6aa742012-01-16 16:47:37 -080097#ifdef CONFIG_ANDROID_PMEM
Kevin Chan13be4e22011-10-20 11:30:32 -070098static unsigned pmem_size = MSM_PMEM_SIZE;
99static int __init pmem_size_setup(char *p)
100{
101 pmem_size = memparse(p, NULL);
102 return 0;
103}
104early_param("pmem_size", pmem_size_setup);
105
106static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
107
108static int __init pmem_adsp_size_setup(char *p)
109{
110 pmem_adsp_size = memparse(p, NULL);
111 return 0;
112}
113early_param("pmem_adsp_size", pmem_adsp_size_setup);
114
115static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
116
117static int __init pmem_audio_size_setup(char *p)
118{
119 pmem_audio_size = memparse(p, NULL);
120 return 0;
121}
122early_param("pmem_audio_size", pmem_audio_size_setup);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800123#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700124
Olav Haugan7c6aa742012-01-16 16:47:37 -0800125#ifdef CONFIG_ANDROID_PMEM
126#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700127static struct android_pmem_platform_data android_pmem_pdata = {
128 .name = "pmem",
129 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
130 .cached = 1,
131 .memory_type = MEMTYPE_EBI1,
132};
133
134static struct platform_device android_pmem_device = {
135 .name = "android_pmem",
136 .id = 0,
137 .dev = {.platform_data = &android_pmem_pdata},
138};
139
140static struct android_pmem_platform_data android_pmem_adsp_pdata = {
141 .name = "pmem_adsp",
142 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
143 .cached = 0,
144 .memory_type = MEMTYPE_EBI1,
145};
Kevin Chan13be4e22011-10-20 11:30:32 -0700146static struct platform_device android_pmem_adsp_device = {
147 .name = "android_pmem",
148 .id = 2,
149 .dev = { .platform_data = &android_pmem_adsp_pdata },
150};
Olav Haugan7c6aa742012-01-16 16:47:37 -0800151#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700152
153static struct android_pmem_platform_data android_pmem_audio_pdata = {
154 .name = "pmem_audio",
155 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
156 .cached = 0,
157 .memory_type = MEMTYPE_EBI1,
158};
159
160static struct platform_device android_pmem_audio_device = {
161 .name = "android_pmem",
162 .id = 4,
163 .dev = { .platform_data = &android_pmem_audio_pdata },
164};
Olav Haugan7c6aa742012-01-16 16:47:37 -0800165#endif
166
167static struct memtype_reserve apq8064_reserve_table[] __initdata = {
168 [MEMTYPE_SMI] = {
169 },
170 [MEMTYPE_EBI0] = {
171 .flags = MEMTYPE_FLAGS_1M_ALIGN,
172 },
173 [MEMTYPE_EBI1] = {
174 .flags = MEMTYPE_FLAGS_1M_ALIGN,
175 },
176};
Kevin Chan13be4e22011-10-20 11:30:32 -0700177
178static void __init size_pmem_devices(void)
179{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800180#ifdef CONFIG_ANDROID_PMEM
181#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700182 android_pmem_adsp_pdata.size = pmem_adsp_size;
183 android_pmem_pdata.size = pmem_size;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800184#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700185 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800186#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700187}
188
189static void __init reserve_memory_for(struct android_pmem_platform_data *p)
190{
191 apq8064_reserve_table[p->memory_type].size += p->size;
192}
193
Kevin Chan13be4e22011-10-20 11:30:32 -0700194static void __init reserve_pmem_memory(void)
195{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800196#ifdef CONFIG_ANDROID_PMEM
197#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -0700198 reserve_memory_for(&android_pmem_adsp_pdata);
199 reserve_memory_for(&android_pmem_pdata);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800200#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700201 reserve_memory_for(&android_pmem_audio_pdata);
202 apq8064_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800203#endif
204}
205
206static int apq8064_paddr_to_memtype(unsigned int paddr)
207{
208 return MEMTYPE_EBI1;
209}
210
211#ifdef CONFIG_ION_MSM
212#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
213static struct ion_cp_heap_pdata cp_mm_ion_pdata = {
214 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugand3d29682012-01-19 10:57:07 -0800215 .align = PAGE_SIZE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800216};
217
218static struct ion_cp_heap_pdata cp_mfc_ion_pdata = {
219 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugand3d29682012-01-19 10:57:07 -0800220 .align = PAGE_SIZE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800221};
222
223static struct ion_co_heap_pdata co_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800224 .adjacent_mem_id = INVALID_HEAP_ID,
225 .align = PAGE_SIZE,
226};
227
228static struct ion_co_heap_pdata fw_co_ion_pdata = {
229 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
230 .align = SZ_128K,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800231};
232#endif
233static struct ion_platform_data ion_pdata = {
234 .nr = MSM_ION_HEAP_NUM,
235 .heaps = {
236 {
237 .id = ION_SYSTEM_HEAP_ID,
238 .type = ION_HEAP_TYPE_SYSTEM,
239 .name = ION_VMALLOC_HEAP_NAME,
240 },
241#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
242 {
243 .id = ION_SF_HEAP_ID,
244 .type = ION_HEAP_TYPE_CARVEOUT,
245 .name = ION_SF_HEAP_NAME,
246 .size = MSM_ION_SF_SIZE,
247 .memory_type = ION_EBI_TYPE,
248 .extra_data = (void *) &co_ion_pdata,
249 },
250 {
251 .id = ION_CP_MM_HEAP_ID,
252 .type = ION_HEAP_TYPE_CP,
253 .name = ION_MM_HEAP_NAME,
254 .size = MSM_ION_MM_SIZE,
255 .memory_type = ION_EBI_TYPE,
256 .extra_data = (void *) &cp_mm_ion_pdata,
257 },
258 {
Olav Haugand3d29682012-01-19 10:57:07 -0800259 .id = ION_MM_FIRMWARE_HEAP_ID,
260 .type = ION_HEAP_TYPE_CARVEOUT,
261 .name = ION_MM_FIRMWARE_HEAP_NAME,
262 .size = MSM_ION_MM_FW_SIZE,
263 .memory_type = ION_EBI_TYPE,
264 .extra_data = (void *) &fw_co_ion_pdata,
265 },
266 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800267 .id = ION_CP_MFC_HEAP_ID,
268 .type = ION_HEAP_TYPE_CP,
269 .name = ION_MFC_HEAP_NAME,
270 .size = MSM_ION_MFC_SIZE,
271 .memory_type = ION_EBI_TYPE,
272 .extra_data = (void *) &cp_mfc_ion_pdata,
273 },
274 {
275 .id = ION_IOMMU_HEAP_ID,
276 .type = ION_HEAP_TYPE_IOMMU,
277 .name = ION_IOMMU_HEAP_NAME,
278 },
Olav Hauganf45e2142012-01-19 11:01:01 -0800279 {
280 .id = ION_QSECOM_HEAP_ID,
281 .type = ION_HEAP_TYPE_CARVEOUT,
282 .name = ION_QSECOM_HEAP_NAME,
283 .size = MSM_ION_QSECOM_SIZE,
284 .memory_type = ION_EBI_TYPE,
285 .extra_data = (void *) &co_ion_pdata,
286 },
Olav Haugan2c43fac2012-01-19 11:06:37 -0800287 {
288 .id = ION_AUDIO_HEAP_ID,
289 .type = ION_HEAP_TYPE_CARVEOUT,
290 .name = ION_AUDIO_HEAP_NAME,
291 .size = MSM_ION_AUDIO_SIZE,
292 .memory_type = ION_EBI_TYPE,
293 .extra_data = (void *) &co_ion_pdata,
294 },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800295#endif
296 }
297};
298
299static struct platform_device ion_dev = {
300 .name = "ion-msm",
301 .id = 1,
302 .dev = { .platform_data = &ion_pdata },
303};
304#endif
305
306static void reserve_ion_memory(void)
307{
308#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
309 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_SIZE;
Olav Haugand3d29682012-01-19 10:57:07 -0800310 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_FW_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800311 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_SF_SIZE;
312 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MFC_SIZE;
Olav Hauganf45e2142012-01-19 11:01:01 -0800313 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_QSECOM_SIZE;
Olav Haugan2c43fac2012-01-19 11:06:37 -0800314 apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_AUDIO_SIZE;
Olav Haugan7c6aa742012-01-16 16:47:37 -0800315#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700316}
317
Huaibin Yang4a084e32011-12-15 15:25:52 -0800318static void __init reserve_mdp_memory(void)
319{
320 apq8064_mdp_writeback(apq8064_reserve_table);
321}
322
Kevin Chan13be4e22011-10-20 11:30:32 -0700323static void __init apq8064_calculate_reserve_sizes(void)
324{
325 size_pmem_devices();
326 reserve_pmem_memory();
Olav Haugan7c6aa742012-01-16 16:47:37 -0800327 reserve_ion_memory();
Huaibin Yang4a084e32011-12-15 15:25:52 -0800328 reserve_mdp_memory();
Kevin Chan13be4e22011-10-20 11:30:32 -0700329}
330
331static struct reserve_info apq8064_reserve_info __initdata = {
332 .memtype_reserve_table = apq8064_reserve_table,
333 .calculate_reserve_sizes = apq8064_calculate_reserve_sizes,
334 .paddr_to_memtype = apq8064_paddr_to_memtype,
335};
336
337static int apq8064_memory_bank_size(void)
338{
339 return 1<<29;
340}
341
342static void __init locate_unstable_memory(void)
343{
344 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
345 unsigned long bank_size;
346 unsigned long low, high;
347
348 bank_size = apq8064_memory_bank_size();
349 low = meminfo.bank[0].start;
350 high = mb->start + mb->size;
Olav Haugand76e3a82012-01-16 16:55:07 -0800351
352 /* Check if 32 bit overflow occured */
353 if (high < mb->start)
354 high = ~0UL;
355
Kevin Chan13be4e22011-10-20 11:30:32 -0700356 low &= ~(bank_size - 1);
357
358 if (high - low <= bank_size)
359 return;
Jack Cheung46bfffa2012-01-19 15:26:24 -0800360 apq8064_reserve_info.low_unstable_address = mb->start -
361 MIN_MEMORY_BLOCK_SIZE + mb->size;
362 apq8064_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
363
Kevin Chan13be4e22011-10-20 11:30:32 -0700364 apq8064_reserve_info.bank_size = bank_size;
365 pr_info("low unstable address %lx max size %lx bank size %lx\n",
366 apq8064_reserve_info.low_unstable_address,
367 apq8064_reserve_info.max_unstable_size,
368 apq8064_reserve_info.bank_size);
369}
370
371static void __init apq8064_reserve(void)
372{
373 reserve_info = &apq8064_reserve_info;
374 locate_unstable_memory();
375 msm_reserve();
376}
377
Hemant Kumar4933b072011-10-17 23:43:11 -0700378static struct platform_device android_usb_device = {
379 .name = "android_usb",
380 .id = -1,
381};
382
383static struct msm_otg_platform_data msm_otg_pdata = {
Hemant Kumard86c4882012-01-24 19:39:37 -0800384 .mode = USB_OTG,
385 .otg_control = OTG_PMIC_CONTROL,
Hemant Kumar4933b072011-10-17 23:43:11 -0700386 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Hemant Kumard86c4882012-01-24 19:39:37 -0800387 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
388 .power_budget = 750,
Hemant Kumar4933b072011-10-17 23:43:11 -0700389};
390
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800391#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
392
393/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
394 * 4 micbiases are used to power various analog and digital
395 * microphones operating at 1800 mV. Technically, all micbiases
396 * can source from single cfilter since all microphones operate
397 * at the same voltage level. The arrangement below is to make
398 * sure all cfilters are exercised. LDO_H regulator ouput level
399 * does not need to be as high as 2.85V. It is choosen for
400 * microphone sensitivity purpose.
401 */
402static struct tabla_pdata apq8064_tabla_platform_data = {
403 .slimbus_slave_device = {
404 .name = "tabla-slave",
405 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
406 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800407 .irq = MSM_GPIO_TO_INT(42),
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800408 .irq_base = TABLA_INTERRUPT_BASE,
409 .num_irqs = NR_TABLA_IRQS,
410 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
411 .micbias = {
412 .ldoh_v = TABLA_LDOH_2P85_V,
413 .cfilt1_mv = 1800,
414 .cfilt2_mv = 1800,
415 .cfilt3_mv = 1800,
416 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
417 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
418 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
419 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
420 }
421};
422
423static struct slim_device apq8064_slim_tabla = {
424 .name = "tabla-slim",
425 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
426 .dev = {
427 .platform_data = &apq8064_tabla_platform_data,
428 },
429};
430
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800431static struct tabla_pdata apq8064_tabla20_platform_data = {
432 .slimbus_slave_device = {
433 .name = "tabla-slave",
434 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
435 },
436 .irq = MSM_GPIO_TO_INT(42),
437 .irq_base = TABLA_INTERRUPT_BASE,
438 .num_irqs = NR_TABLA_IRQS,
439 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
440 .micbias = {
441 .ldoh_v = TABLA_LDOH_2P85_V,
442 .cfilt1_mv = 1800,
443 .cfilt2_mv = 1800,
444 .cfilt3_mv = 1800,
445 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
446 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
447 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
448 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
449 }
450};
451
452static struct slim_device apq8064_slim_tabla20 = {
453 .name = "tabla2x-slim",
454 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
455 .dev = {
456 .platform_data = &apq8064_tabla20_platform_data,
457 },
458};
459
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700460#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
461 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
462 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
463 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
464
465#define QCE_SIZE 0x10000
466#define QCE_0_BASE 0x11000000
467
468#define QCE_HW_KEY_SUPPORT 0
469#define QCE_SHA_HMAC_SUPPORT 1
470#define QCE_SHARE_CE_RESOURCE 3
471#define QCE_CE_SHARED 0
472
473static struct resource qcrypto_resources[] = {
474 [0] = {
475 .start = QCE_0_BASE,
476 .end = QCE_0_BASE + QCE_SIZE - 1,
477 .flags = IORESOURCE_MEM,
478 },
479 [1] = {
480 .name = "crypto_channels",
481 .start = DMOV8064_CE_IN_CHAN,
482 .end = DMOV8064_CE_OUT_CHAN,
483 .flags = IORESOURCE_DMA,
484 },
485 [2] = {
486 .name = "crypto_crci_in",
487 .start = DMOV8064_CE_IN_CRCI,
488 .end = DMOV8064_CE_IN_CRCI,
489 .flags = IORESOURCE_DMA,
490 },
491 [3] = {
492 .name = "crypto_crci_out",
493 .start = DMOV8064_CE_OUT_CRCI,
494 .end = DMOV8064_CE_OUT_CRCI,
495 .flags = IORESOURCE_DMA,
496 },
497};
498
499static struct resource qcedev_resources[] = {
500 [0] = {
501 .start = QCE_0_BASE,
502 .end = QCE_0_BASE + QCE_SIZE - 1,
503 .flags = IORESOURCE_MEM,
504 },
505 [1] = {
506 .name = "crypto_channels",
507 .start = DMOV8064_CE_IN_CHAN,
508 .end = DMOV8064_CE_OUT_CHAN,
509 .flags = IORESOURCE_DMA,
510 },
511 [2] = {
512 .name = "crypto_crci_in",
513 .start = DMOV8064_CE_IN_CRCI,
514 .end = DMOV8064_CE_IN_CRCI,
515 .flags = IORESOURCE_DMA,
516 },
517 [3] = {
518 .name = "crypto_crci_out",
519 .start = DMOV8064_CE_OUT_CRCI,
520 .end = DMOV8064_CE_OUT_CRCI,
521 .flags = IORESOURCE_DMA,
522 },
523};
524
525#endif
526
527#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
528 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
529
530static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
531 .ce_shared = QCE_CE_SHARED,
532 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
533 .hw_key_support = QCE_HW_KEY_SUPPORT,
534 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800535 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700536};
537
538static struct platform_device qcrypto_device = {
539 .name = "qcrypto",
540 .id = 0,
541 .num_resources = ARRAY_SIZE(qcrypto_resources),
542 .resource = qcrypto_resources,
543 .dev = {
544 .coherent_dma_mask = DMA_BIT_MASK(32),
545 .platform_data = &qcrypto_ce_hw_suppport,
546 },
547};
548#endif
549
550#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
551 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
552
553static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
554 .ce_shared = QCE_CE_SHARED,
555 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
556 .hw_key_support = QCE_HW_KEY_SUPPORT,
557 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800558 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700559};
560
561static struct platform_device qcedev_device = {
562 .name = "qce",
563 .id = 0,
564 .num_resources = ARRAY_SIZE(qcedev_resources),
565 .resource = qcedev_resources,
566 .dev = {
567 .coherent_dma_mask = DMA_BIT_MASK(32),
568 .platform_data = &qcedev_ce_hw_suppport,
569 },
570};
571#endif
572
Joel Kingdacbc822012-01-25 13:30:57 -0800573static struct mdm_platform_data mdm_platform_data = {
574 .mdm_version = "3.0",
575 .ramdump_delay_ms = 2000,
576};
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700577
Jeff Hugo0c0f5e92011-09-28 13:55:45 -0600578#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700579static void __init apq8064_map_io(void)
580{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -0600581 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700582 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -0700583 if (socinfo_init() < 0)
584 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700585}
586
587static void __init apq8064_init_irq(void)
588{
Praveen Chidambaram78499012011-11-01 17:15:17 -0600589 struct msm_mpm_device_data *data = NULL;
590
591#ifdef CONFIG_MSM_MPM
592 data = &apq8064_mpm_dev_data;
593#endif
594
595 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700596 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
597 (void *)MSM_QGIC_CPU_BASE);
598
599 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
600 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
601
602 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
603 mb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700604}
605
Jay Chokshi7805b5a2011-11-07 15:55:30 -0800606static struct platform_device msm8064_device_saw_regulator_core0 = {
607 .name = "saw-regulator",
608 .id = 0,
609 .dev = {
610 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
611 },
612};
613
614static struct platform_device msm8064_device_saw_regulator_core1 = {
615 .name = "saw-regulator",
616 .id = 1,
617 .dev = {
618 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
619 },
620};
621
622static struct platform_device msm8064_device_saw_regulator_core2 = {
623 .name = "saw-regulator",
624 .id = 2,
625 .dev = {
626 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
627 },
628};
629
630static struct platform_device msm8064_device_saw_regulator_core3 = {
631 .name = "saw-regulator",
632 .id = 3,
633 .dev = {
634 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -0600635
636 },
637};
638
639static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
640 {
641 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
642 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
643 true,
644 100, 8000, 100000, 1,
645 },
646
647 {
648 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
649 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
650 true,
651 2000, 6000, 60100000, 3000,
652 },
653
654 {
655 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
656 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
657 false,
658 4200, 5000, 60350000, 3500,
659 },
660
661 {
662 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
663 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
664 false,
665 6300, 4500, 65350000, 4800,
666 },
667
668 {
669 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
670 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
671 false,
672 11700, 2500, 67850000, 5500,
673 },
674
675 {
676 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
677 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
678 false,
679 13800, 2000, 71850000, 6800,
680 },
681
682 {
683 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
684 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
685 false,
686 29700, 500, 75850000, 8800,
687 },
688
689 {
690 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
691 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
692 false,
693 29700, 0, 76350000, 9800,
694 },
695};
696
697static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
698 .mode = MSM_PM_BOOT_CONFIG_TZ,
699};
700
701static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
702 .levels = &msm_rpmrs_levels[0],
703 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
704 .vdd_mem_levels = {
705 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
706 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
707 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
708 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
709 },
710 .vdd_dig_levels = {
711 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
712 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
713 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
714 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
715 },
716 .vdd_mask = 0x7FFFFF,
717 .rpmrs_target_id = {
718 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
719 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
720 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
721 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
722 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
723 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
724 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
725 },
726};
727
728static struct msm_cpuidle_state msm_cstates[] __initdata = {
729 {0, 0, "C0", "WFI",
730 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
731
732 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
733 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
734
735 {0, 2, "C2", "POWER_COLLAPSE",
736 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
737
738 {1, 0, "C0", "WFI",
739 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
740
741 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
742 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
743
744 {2, 0, "C0", "WFI",
745 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
746
747 {2, 1, "C1", "STANDALONE_POWER_COLLAPSE",
748 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
749
750 {3, 0, "C0", "WFI",
751 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
752
753 {3, 1, "C1", "STANDALONE_POWER_COLLAPSE",
754 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
755};
756
757static struct msm_pm_platform_data msm_pm_data[] = {
758 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
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_POWER_COLLAPSE_STANDALONE)] = {
766 .idle_supported = 1,
767 .suspend_supported = 1,
768 .idle_enabled = 0,
769 .suspend_enabled = 0,
770 },
771
772 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
773 .idle_supported = 1,
774 .suspend_supported = 1,
775 .idle_enabled = 1,
776 .suspend_enabled = 1,
777 },
778
779 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
780 .idle_supported = 0,
781 .suspend_supported = 1,
782 .idle_enabled = 0,
783 .suspend_enabled = 0,
784 },
785
786 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
787 .idle_supported = 1,
788 .suspend_supported = 1,
789 .idle_enabled = 0,
790 .suspend_enabled = 0,
791 },
792
793 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
794 .idle_supported = 1,
795 .suspend_supported = 0,
796 .idle_enabled = 1,
797 .suspend_enabled = 0,
798 },
799
800 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
801 .idle_supported = 0,
802 .suspend_supported = 1,
803 .idle_enabled = 0,
804 .suspend_enabled = 0,
805 },
806
807 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
808 .idle_supported = 1,
809 .suspend_supported = 1,
810 .idle_enabled = 0,
811 .suspend_enabled = 0,
812 },
813
814 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
815 .idle_supported = 1,
816 .suspend_supported = 0,
817 .idle_enabled = 1,
818 .suspend_enabled = 0,
819 },
820
821 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
822 .idle_supported = 0,
823 .suspend_supported = 1,
824 .idle_enabled = 0,
825 .suspend_enabled = 0,
826 },
827
828 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
829 .idle_supported = 1,
830 .suspend_supported = 1,
831 .idle_enabled = 0,
832 .suspend_enabled = 0,
833 },
834
835 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
836 .idle_supported = 1,
837 .suspend_supported = 0,
838 .idle_enabled = 1,
839 .suspend_enabled = 0,
840 },
841};
842
843static uint8_t spm_wfi_cmd_sequence[] __initdata = {
844 0x03, 0x0f,
845};
846
847static uint8_t spm_power_collapse_without_rpm[] __initdata = {
848 0x00, 0x24, 0x54, 0x10,
849 0x09, 0x03, 0x01,
850 0x10, 0x54, 0x30, 0x0C,
851 0x24, 0x30, 0x0f,
852};
853
854static uint8_t spm_power_collapse_with_rpm[] __initdata = {
855 0x00, 0x24, 0x54, 0x10,
856 0x09, 0x07, 0x01, 0x0B,
857 0x10, 0x54, 0x30, 0x0C,
858 0x24, 0x30, 0x0f,
859};
860
861static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
862 [0] = {
863 .mode = MSM_SPM_MODE_CLOCK_GATING,
864 .notify_rpm = false,
865 .cmd = spm_wfi_cmd_sequence,
866 },
867 [1] = {
868 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
869 .notify_rpm = false,
870 .cmd = spm_power_collapse_without_rpm,
871 },
872 [2] = {
873 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
874 .notify_rpm = true,
875 .cmd = spm_power_collapse_with_rpm,
876 },
877};
878
879static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
880 0x00, 0x20, 0x03, 0x20,
881 0x00, 0x0f,
882};
883
884static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
885 0x00, 0x20, 0x34, 0x64,
886 0x48, 0x07, 0x48, 0x20,
887 0x50, 0x64, 0x04, 0x34,
888 0x50, 0x0f,
889};
890static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
891 0x00, 0x10, 0x34, 0x64,
892 0x48, 0x07, 0x48, 0x10,
893 0x50, 0x64, 0x04, 0x34,
894 0x50, 0x0F,
895};
896
897static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
898 [0] = {
899 .mode = MSM_SPM_L2_MODE_RETENTION,
900 .notify_rpm = false,
901 .cmd = l2_spm_wfi_cmd_sequence,
902 },
903 [1] = {
904 .mode = MSM_SPM_L2_MODE_GDHS,
905 .notify_rpm = true,
906 .cmd = l2_spm_gdhs_cmd_sequence,
907 },
908 [2] = {
909 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
910 .notify_rpm = true,
911 .cmd = l2_spm_power_off_cmd_sequence,
912 },
913};
914
915
916static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
917 [0] = {
918 .reg_base_addr = MSM_SAW_L2_BASE,
919 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
920 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
921 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
922 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
923 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
924 .modes = msm_spm_l2_seq_list,
925 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
926 },
927};
928
929static struct msm_spm_platform_data msm_spm_data[] __initdata = {
930 [0] = {
931 .reg_base_addr = MSM_SAW0_BASE,
932 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
933 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
934 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
935#if defined(CONFIG_MSM_AVS_HW)
936 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
937 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
938#endif
939 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
940 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
941 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
942 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
943 .vctl_timeout_us = 50,
944 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
945 .modes = msm_spm_seq_list,
946 },
947 [1] = {
948 .reg_base_addr = MSM_SAW1_BASE,
949 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
950 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
951 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
952#if defined(CONFIG_MSM_AVS_HW)
953 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
954 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
955#endif
956 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
957 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
958 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
959 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
960 .vctl_timeout_us = 50,
961 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
962 .modes = msm_spm_seq_list,
963 },
964 [2] = {
965 .reg_base_addr = MSM_SAW2_BASE,
966 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
967 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
968 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
969#if defined(CONFIG_MSM_AVS_HW)
970 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
971 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
972#endif
973 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
974 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
975 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
976 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
977 .vctl_timeout_us = 50,
978 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
979 .modes = msm_spm_seq_list,
980 },
981 [3] = {
982 .reg_base_addr = MSM_SAW3_BASE,
983 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
984 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
985 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
986#if defined(CONFIG_MSM_AVS_HW)
987 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
988 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
989#endif
990 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
991 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
992 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
993 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
994 .vctl_timeout_us = 50,
995 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
996 .modes = msm_spm_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -0800997 },
998};
999
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001000static void __init apq8064_init_buses(void)
1001{
1002 msm_bus_rpm_set_mt_mask();
1003 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
1004 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
1005 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
1006 msm_bus_8064_apps_fabric.dev.platform_data =
1007 &msm_bus_8064_apps_fabric_pdata;
1008 msm_bus_8064_sys_fabric.dev.platform_data =
1009 &msm_bus_8064_sys_fabric_pdata;
1010 msm_bus_8064_mm_fabric.dev.platform_data =
1011 &msm_bus_8064_mm_fabric_pdata;
1012 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
1013 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
1014}
1015
David Collinsf0d00732012-01-25 15:46:50 -08001016static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
1017 .name = GPIO_REGULATOR_DEV_NAME,
1018 .id = PM8921_MPP_PM_TO_SYS(7),
1019 .dev = {
1020 .platform_data
1021 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
1022 },
1023};
1024
1025static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
1026 .name = GPIO_REGULATOR_DEV_NAME,
1027 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
1028 .dev = {
1029 .platform_data =
1030 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
1031 },
1032};
1033
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001034static struct platform_device *common_devices[] __initdata = {
Jin Hong01f2dbb2011-11-03 22:13:51 -07001035 &apq8064_device_dmov,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001036 &apq8064_device_qup_i2c_gsbi4,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001037 &apq8064_device_qup_spi_gsbi5,
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001038 &apq8064_slim_ctrl,
David Collinsf0d00732012-01-25 15:46:50 -08001039 &apq8064_device_ext_5v_vreg,
1040 &apq8064_device_ext_3p3v_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07001041 &apq8064_device_ssbi_pmic1,
1042 &apq8064_device_ssbi_pmic2,
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001043 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07001044 &apq8064_device_otg,
1045 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08001046 &apq8064_device_hsusb_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07001047 &android_usb_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001048#ifdef CONFIG_ANDROID_PMEM
1049#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -07001050 &android_pmem_device,
1051 &android_pmem_adsp_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001052#endif
Kevin Chan13be4e22011-10-20 11:30:32 -07001053 &android_pmem_audio_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001054#endif
1055#ifdef CONFIG_ION_MSM
1056 &ion_dev,
1057#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001058 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001059 &msm8064_device_saw_regulator_core0,
1060 &msm8064_device_saw_regulator_core1,
1061 &msm8064_device_saw_regulator_core2,
1062 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001063#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1064 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1065 &qcrypto_device,
1066#endif
1067
1068#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1069 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1070 &qcedev_device,
1071#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07001072
1073#ifdef CONFIG_HW_RANDOM_MSM
1074 &apq8064_device_rng,
1075#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08001076 &apq_pcm,
1077 &apq_pcm_routing,
1078 &apq_cpudai0,
1079 &apq_cpudai1,
1080 &apq_cpudai_hdmi_rx,
1081 &apq_cpudai_bt_rx,
1082 &apq_cpudai_bt_tx,
1083 &apq_cpudai_fm_rx,
1084 &apq_cpudai_fm_tx,
1085 &apq_cpu_fe,
1086 &apq_stub_codec,
1087 &apq_voice,
1088 &apq_voip,
1089 &apq_lpa_pcm,
1090 &apq_pcm_hostless,
1091 &apq_cpudai_afe_01_rx,
1092 &apq_cpudai_afe_01_tx,
1093 &apq_cpudai_afe_02_rx,
1094 &apq_cpudai_afe_02_tx,
1095 &apq_pcm_afe,
1096 &apq_cpudai_auxpcm_rx,
1097 &apq_cpudai_auxpcm_tx,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001098 &apq8064_rpm_device,
1099 &apq8064_rpm_log_device,
1100 &apq8064_rpm_stat_device,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001101 &msm_bus_8064_apps_fabric,
1102 &msm_bus_8064_sys_fabric,
1103 &msm_bus_8064_mm_fabric,
1104 &msm_bus_8064_sys_fpb,
1105 &msm_bus_8064_cpss_fpb,
Rajesh Sastrulaaee8af32012-01-20 11:46:31 -08001106 &msm_device_vidc,
Matt Wagantalled832652012-02-02 19:23:17 -08001107 &msm_8960_riva,
Matt Wagantallb94b9a52012-02-02 21:59:54 -08001108 &msm_8960_q6_lpass,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001109};
1110
Joel King4e7ad222011-08-17 15:47:38 -07001111static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001112 &apq8064_device_uart_gsbi3,
Yan He06913ce2011-08-26 16:33:46 -07001113 &msm_device_sps_apq8064,
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001114};
1115
1116static struct platform_device *rumi3_devices[] __initdata = {
1117 &apq8064_device_uart_gsbi1,
Yan He435ed612011-11-23 17:34:59 -08001118 &msm_device_sps_apq8064,
Huaibin Yang4a084e32011-12-15 15:25:52 -08001119#ifdef CONFIG_MSM_ROTATOR
1120 &msm_rotator_device,
1121#endif
Joel King4e7ad222011-08-17 15:47:38 -07001122};
1123
Joel King82b7e3f2012-01-05 10:03:27 -08001124static struct platform_device *cdp_devices[] __initdata = {
1125 &apq8064_device_uart_gsbi1,
1126 &msm_device_sps_apq8064,
1127};
1128
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001129static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08001130 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001131};
1132
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001133#define KS8851_IRQ_GPIO 43
1134
1135static struct spi_board_info spi_board_info[] __initdata = {
1136 {
1137 .modalias = "ks8851",
1138 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1139 .max_speed_hz = 19200000,
1140 .bus_num = 0,
1141 .chip_select = 2,
1142 .mode = SPI_MODE_0,
1143 },
1144};
1145
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001146static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001147 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001148 .bus_num = 1,
1149 .slim_slave = &apq8064_slim_tabla,
1150 },
1151 {
1152 .bus_num = 1,
1153 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001154 },
1155 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001156};
1157
Kenneth Heitke748593a2011-07-15 15:45:11 -06001158static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
1159 .clk_freq = 100000,
1160 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001161};
1162
1163static void __init apq8064_i2c_init(void)
1164{
1165 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
1166 &apq8064_i2c_qup_gsbi4_pdata;
1167}
1168
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08001169#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001170static int ethernet_init(void)
1171{
1172 int ret;
1173 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
1174 if (ret) {
1175 pr_err("ks8851 gpio_request failed: %d\n", ret);
1176 goto fail;
1177 }
1178
1179 return 0;
1180fail:
1181 return ret;
1182}
1183#else
1184static int ethernet_init(void)
1185{
1186 return 0;
1187}
1188#endif
1189
Tianyi Gou41515e22011-09-01 19:37:43 -07001190static void __init apq8064_clock_init(void)
1191{
Tianyi Gouacb588d2012-01-27 18:24:05 -08001192 if (machine_is_apq8064_rumi3())
Tianyi Gou41515e22011-09-01 19:37:43 -07001193 msm_clock_init(&apq8064_dummy_clock_init_data);
Tianyi Gouacb588d2012-01-27 18:24:05 -08001194 else
1195 msm_clock_init(&apq8064_clock_init_data);
Tianyi Gou41515e22011-09-01 19:37:43 -07001196}
1197
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001198static void __init apq8064_common_init(void)
1199{
1200 if (socinfo_init() < 0)
1201 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06001202 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
1203 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Tianyi Gou41515e22011-09-01 19:37:43 -07001204 apq8064_clock_init();
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08001205 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06001206 apq8064_i2c_init();
Kenneth Heitke36920d32011-07-20 16:44:30 -06001207
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001208 apq8064_device_qup_spi_gsbi5.dev.platform_data =
1209 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08001210 apq8064_init_pmic();
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001211 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001212 apq8064_init_buses();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001213 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Jay Chokshie8741282012-01-25 15:22:55 -08001214 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05301215 apq8064_init_mmc();
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001216 slim_register_board_info(apq8064_slim_devices,
1217 ARRAY_SIZE(apq8064_slim_devices));
Praveen Chidambaram78499012011-11-01 17:15:17 -06001218 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Mahesh Sivasubramaniancbce1ec2012-01-24 10:32:44 -07001219 acpuclk_init(&acpuclk_8064_soc_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06001220 msm_spm_l2_init(msm_spm_l2_data);
1221 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
1222 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
1223 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
1224 msm_pm_data);
1225 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Jordan Crouseb3115fe2012-02-01 22:11:12 -07001226
Joel Kingdacbc822012-01-25 13:30:57 -08001227 if (machine_is_apq8064_mtp()) {
1228 mdm_8064_device.dev.platform_data = &mdm_platform_data;
1229 platform_device_register(&mdm_8064_device);
1230 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001231}
1232
Huaibin Yang4a084e32011-12-15 15:25:52 -08001233static void __init apq8064_allocate_memory_regions(void)
1234{
1235 apq8064_allocate_fb_region();
1236}
1237
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001238static void __init apq8064_sim_init(void)
1239{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001240 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
1241 &msm8064_device_watchdog.dev.platform_data;
1242
1243 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001244 apq8064_common_init();
Joel King4e7ad222011-08-17 15:47:38 -07001245 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
1246}
1247
1248static void __init apq8064_rumi3_init(void)
1249{
1250 apq8064_common_init();
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001251 ethernet_init();
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001252 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001253 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Huaibin Yang4a084e32011-12-15 15:25:52 -08001254 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07001255 apq8064_init_gpu();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001256}
1257
Joel King82b7e3f2012-01-05 10:03:27 -08001258static void __init apq8064_cdp_init(void)
1259{
1260 apq8064_common_init();
1261 ethernet_init();
1262 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
1263 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Jordan Crouseb3115fe2012-02-01 22:11:12 -07001264 apq8064_init_gpu();
Joel King82b7e3f2012-01-05 10:03:27 -08001265}
1266
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001267MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
1268 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07001269 .reserve = apq8064_reserve,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001270 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05301271 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001272 .timer = &msm_timer,
1273 .init_machine = apq8064_sim_init,
1274MACHINE_END
1275
Joel King4e7ad222011-08-17 15:47:38 -07001276MACHINE_START(APQ8064_RUMI3, "QCT APQ8064 RUMI3")
1277 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07001278 .reserve = apq8064_reserve,
Joel King4e7ad222011-08-17 15:47:38 -07001279 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05301280 .handle_irq = gic_handle_irq,
Joel King4e7ad222011-08-17 15:47:38 -07001281 .timer = &msm_timer,
1282 .init_machine = apq8064_rumi3_init,
Huaibin Yang4a084e32011-12-15 15:25:52 -08001283 .init_early = apq8064_allocate_memory_regions,
Joel King4e7ad222011-08-17 15:47:38 -07001284MACHINE_END
1285
Joel King82b7e3f2012-01-05 10:03:27 -08001286MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
1287 .map_io = apq8064_map_io,
1288 .reserve = apq8064_reserve,
1289 .init_irq = apq8064_init_irq,
1290 .handle_irq = gic_handle_irq,
1291 .timer = &msm_timer,
1292 .init_machine = apq8064_cdp_init,
1293MACHINE_END
1294
1295MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
1296 .map_io = apq8064_map_io,
1297 .reserve = apq8064_reserve,
1298 .init_irq = apq8064_init_irq,
1299 .handle_irq = gic_handle_irq,
1300 .timer = &msm_timer,
1301 .init_machine = apq8064_cdp_init,
1302MACHINE_END
1303
1304MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
1305 .map_io = apq8064_map_io,
1306 .reserve = apq8064_reserve,
1307 .init_irq = apq8064_init_irq,
1308 .handle_irq = gic_handle_irq,
1309 .timer = &msm_timer,
1310 .init_machine = apq8064_cdp_init,
1311MACHINE_END
1312