blob: 20e460058342cb6868a39fac8753adc0e576c21b [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 Kumara945b472012-01-25 15:08:06 -0800378#ifdef CONFIG_USB_EHCI_MSM_HSIC
379static struct msm_hsic_host_platform_data msm_hsic_pdata = {
380 .strobe = 88,
381 .data = 89,
382};
383#else
384static struct msm_hsic_host_platform_data msm_hsic_pdata;
385#endif
386
Hemant Kumar4933b072011-10-17 23:43:11 -0700387static struct platform_device android_usb_device = {
388 .name = "android_usb",
389 .id = -1,
390};
391
392static struct msm_otg_platform_data msm_otg_pdata = {
Hemant Kumard86c4882012-01-24 19:39:37 -0800393 .mode = USB_OTG,
394 .otg_control = OTG_PMIC_CONTROL,
Hemant Kumar4933b072011-10-17 23:43:11 -0700395 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Hemant Kumard86c4882012-01-24 19:39:37 -0800396 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
397 .power_budget = 750,
Hemant Kumar4933b072011-10-17 23:43:11 -0700398};
399
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800400#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
401
402/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
403 * 4 micbiases are used to power various analog and digital
404 * microphones operating at 1800 mV. Technically, all micbiases
405 * can source from single cfilter since all microphones operate
406 * at the same voltage level. The arrangement below is to make
407 * sure all cfilters are exercised. LDO_H regulator ouput level
408 * does not need to be as high as 2.85V. It is choosen for
409 * microphone sensitivity purpose.
410 */
411static struct tabla_pdata apq8064_tabla_platform_data = {
412 .slimbus_slave_device = {
413 .name = "tabla-slave",
414 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
415 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800416 .irq = MSM_GPIO_TO_INT(42),
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800417 .irq_base = TABLA_INTERRUPT_BASE,
418 .num_irqs = NR_TABLA_IRQS,
419 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
420 .micbias = {
421 .ldoh_v = TABLA_LDOH_2P85_V,
422 .cfilt1_mv = 1800,
423 .cfilt2_mv = 1800,
424 .cfilt3_mv = 1800,
425 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
426 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
427 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
428 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
429 }
430};
431
432static struct slim_device apq8064_slim_tabla = {
433 .name = "tabla-slim",
434 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
435 .dev = {
436 .platform_data = &apq8064_tabla_platform_data,
437 },
438};
439
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800440static struct tabla_pdata apq8064_tabla20_platform_data = {
441 .slimbus_slave_device = {
442 .name = "tabla-slave",
443 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
444 },
445 .irq = MSM_GPIO_TO_INT(42),
446 .irq_base = TABLA_INTERRUPT_BASE,
447 .num_irqs = NR_TABLA_IRQS,
448 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
449 .micbias = {
450 .ldoh_v = TABLA_LDOH_2P85_V,
451 .cfilt1_mv = 1800,
452 .cfilt2_mv = 1800,
453 .cfilt3_mv = 1800,
454 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
455 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
456 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
457 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
458 }
459};
460
461static struct slim_device apq8064_slim_tabla20 = {
462 .name = "tabla2x-slim",
463 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
464 .dev = {
465 .platform_data = &apq8064_tabla20_platform_data,
466 },
467};
468
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700469#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
470 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
471 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
472 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
473
474#define QCE_SIZE 0x10000
475#define QCE_0_BASE 0x11000000
476
477#define QCE_HW_KEY_SUPPORT 0
478#define QCE_SHA_HMAC_SUPPORT 1
479#define QCE_SHARE_CE_RESOURCE 3
480#define QCE_CE_SHARED 0
481
482static struct resource qcrypto_resources[] = {
483 [0] = {
484 .start = QCE_0_BASE,
485 .end = QCE_0_BASE + QCE_SIZE - 1,
486 .flags = IORESOURCE_MEM,
487 },
488 [1] = {
489 .name = "crypto_channels",
490 .start = DMOV8064_CE_IN_CHAN,
491 .end = DMOV8064_CE_OUT_CHAN,
492 .flags = IORESOURCE_DMA,
493 },
494 [2] = {
495 .name = "crypto_crci_in",
496 .start = DMOV8064_CE_IN_CRCI,
497 .end = DMOV8064_CE_IN_CRCI,
498 .flags = IORESOURCE_DMA,
499 },
500 [3] = {
501 .name = "crypto_crci_out",
502 .start = DMOV8064_CE_OUT_CRCI,
503 .end = DMOV8064_CE_OUT_CRCI,
504 .flags = IORESOURCE_DMA,
505 },
506};
507
508static struct resource qcedev_resources[] = {
509 [0] = {
510 .start = QCE_0_BASE,
511 .end = QCE_0_BASE + QCE_SIZE - 1,
512 .flags = IORESOURCE_MEM,
513 },
514 [1] = {
515 .name = "crypto_channels",
516 .start = DMOV8064_CE_IN_CHAN,
517 .end = DMOV8064_CE_OUT_CHAN,
518 .flags = IORESOURCE_DMA,
519 },
520 [2] = {
521 .name = "crypto_crci_in",
522 .start = DMOV8064_CE_IN_CRCI,
523 .end = DMOV8064_CE_IN_CRCI,
524 .flags = IORESOURCE_DMA,
525 },
526 [3] = {
527 .name = "crypto_crci_out",
528 .start = DMOV8064_CE_OUT_CRCI,
529 .end = DMOV8064_CE_OUT_CRCI,
530 .flags = IORESOURCE_DMA,
531 },
532};
533
534#endif
535
536#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
537 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
538
539static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
540 .ce_shared = QCE_CE_SHARED,
541 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
542 .hw_key_support = QCE_HW_KEY_SUPPORT,
543 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800544 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700545};
546
547static struct platform_device qcrypto_device = {
548 .name = "qcrypto",
549 .id = 0,
550 .num_resources = ARRAY_SIZE(qcrypto_resources),
551 .resource = qcrypto_resources,
552 .dev = {
553 .coherent_dma_mask = DMA_BIT_MASK(32),
554 .platform_data = &qcrypto_ce_hw_suppport,
555 },
556};
557#endif
558
559#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
560 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
561
562static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
563 .ce_shared = QCE_CE_SHARED,
564 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
565 .hw_key_support = QCE_HW_KEY_SUPPORT,
566 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800567 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700568};
569
570static struct platform_device qcedev_device = {
571 .name = "qce",
572 .id = 0,
573 .num_resources = ARRAY_SIZE(qcedev_resources),
574 .resource = qcedev_resources,
575 .dev = {
576 .coherent_dma_mask = DMA_BIT_MASK(32),
577 .platform_data = &qcedev_ce_hw_suppport,
578 },
579};
580#endif
581
Joel Kingdacbc822012-01-25 13:30:57 -0800582static struct mdm_platform_data mdm_platform_data = {
583 .mdm_version = "3.0",
584 .ramdump_delay_ms = 2000,
Hemant Kumara945b472012-01-25 15:08:06 -0800585 .peripheral_platform_device = &apq8064_device_hsic_host,
Joel Kingdacbc822012-01-25 13:30:57 -0800586};
Ramesh Masavarapu28311912011-10-27 11:04:12 -0700587
Jeff Hugo0c0f5e92011-09-28 13:55:45 -0600588#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700589static void __init apq8064_map_io(void)
590{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -0600591 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700592 msm_map_apq8064_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -0700593 if (socinfo_init() < 0)
594 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700595}
596
597static void __init apq8064_init_irq(void)
598{
Praveen Chidambaram78499012011-11-01 17:15:17 -0600599 struct msm_mpm_device_data *data = NULL;
600
601#ifdef CONFIG_MSM_MPM
602 data = &apq8064_mpm_dev_data;
603#endif
604
605 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700606 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
607 (void *)MSM_QGIC_CPU_BASE);
608
609 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
610 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
611
612 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
613 mb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700614}
615
Jay Chokshi7805b5a2011-11-07 15:55:30 -0800616static struct platform_device msm8064_device_saw_regulator_core0 = {
617 .name = "saw-regulator",
618 .id = 0,
619 .dev = {
620 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
621 },
622};
623
624static struct platform_device msm8064_device_saw_regulator_core1 = {
625 .name = "saw-regulator",
626 .id = 1,
627 .dev = {
628 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
629 },
630};
631
632static struct platform_device msm8064_device_saw_regulator_core2 = {
633 .name = "saw-regulator",
634 .id = 2,
635 .dev = {
636 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
637 },
638};
639
640static struct platform_device msm8064_device_saw_regulator_core3 = {
641 .name = "saw-regulator",
642 .id = 3,
643 .dev = {
644 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -0600645
646 },
647};
648
649static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
650 {
651 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
652 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
653 true,
654 100, 8000, 100000, 1,
655 },
656
657 {
658 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
659 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
660 true,
661 2000, 6000, 60100000, 3000,
662 },
663
664 {
665 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
666 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
667 false,
668 4200, 5000, 60350000, 3500,
669 },
670
671 {
672 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
673 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
674 false,
675 6300, 4500, 65350000, 4800,
676 },
677
678 {
679 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
680 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
681 false,
682 11700, 2500, 67850000, 5500,
683 },
684
685 {
686 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
687 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
688 false,
689 13800, 2000, 71850000, 6800,
690 },
691
692 {
693 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
694 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
695 false,
696 29700, 500, 75850000, 8800,
697 },
698
699 {
700 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
701 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
702 false,
703 29700, 0, 76350000, 9800,
704 },
705};
706
707static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
708 .mode = MSM_PM_BOOT_CONFIG_TZ,
709};
710
711static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
712 .levels = &msm_rpmrs_levels[0],
713 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
714 .vdd_mem_levels = {
715 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
716 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
717 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
718 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
719 },
720 .vdd_dig_levels = {
721 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
722 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
723 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
724 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
725 },
726 .vdd_mask = 0x7FFFFF,
727 .rpmrs_target_id = {
728 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
729 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
730 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
731 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
732 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
733 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
734 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
735 },
736};
737
738static struct msm_cpuidle_state msm_cstates[] __initdata = {
739 {0, 0, "C0", "WFI",
740 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
741
742 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
743 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
744
745 {0, 2, "C2", "POWER_COLLAPSE",
746 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
747
748 {1, 0, "C0", "WFI",
749 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
750
751 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
752 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
753
754 {2, 0, "C0", "WFI",
755 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
756
757 {2, 1, "C1", "STANDALONE_POWER_COLLAPSE",
758 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
759
760 {3, 0, "C0", "WFI",
761 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
762
763 {3, 1, "C1", "STANDALONE_POWER_COLLAPSE",
764 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
765};
766
767static struct msm_pm_platform_data msm_pm_data[] = {
768 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
769 .idle_supported = 1,
770 .suspend_supported = 1,
771 .idle_enabled = 0,
772 .suspend_enabled = 0,
773 },
774
775 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
776 .idle_supported = 1,
777 .suspend_supported = 1,
778 .idle_enabled = 0,
779 .suspend_enabled = 0,
780 },
781
782 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
783 .idle_supported = 1,
784 .suspend_supported = 1,
785 .idle_enabled = 1,
786 .suspend_enabled = 1,
787 },
788
789 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
790 .idle_supported = 0,
791 .suspend_supported = 1,
792 .idle_enabled = 0,
793 .suspend_enabled = 0,
794 },
795
796 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
797 .idle_supported = 1,
798 .suspend_supported = 1,
799 .idle_enabled = 0,
800 .suspend_enabled = 0,
801 },
802
803 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
804 .idle_supported = 1,
805 .suspend_supported = 0,
806 .idle_enabled = 1,
807 .suspend_enabled = 0,
808 },
809
810 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
811 .idle_supported = 0,
812 .suspend_supported = 1,
813 .idle_enabled = 0,
814 .suspend_enabled = 0,
815 },
816
817 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
818 .idle_supported = 1,
819 .suspend_supported = 1,
820 .idle_enabled = 0,
821 .suspend_enabled = 0,
822 },
823
824 [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
825 .idle_supported = 1,
826 .suspend_supported = 0,
827 .idle_enabled = 1,
828 .suspend_enabled = 0,
829 },
830
831 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
832 .idle_supported = 0,
833 .suspend_supported = 1,
834 .idle_enabled = 0,
835 .suspend_enabled = 0,
836 },
837
838 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
839 .idle_supported = 1,
840 .suspend_supported = 1,
841 .idle_enabled = 0,
842 .suspend_enabled = 0,
843 },
844
845 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
846 .idle_supported = 1,
847 .suspend_supported = 0,
848 .idle_enabled = 1,
849 .suspend_enabled = 0,
850 },
851};
852
853static uint8_t spm_wfi_cmd_sequence[] __initdata = {
854 0x03, 0x0f,
855};
856
857static uint8_t spm_power_collapse_without_rpm[] __initdata = {
858 0x00, 0x24, 0x54, 0x10,
859 0x09, 0x03, 0x01,
860 0x10, 0x54, 0x30, 0x0C,
861 0x24, 0x30, 0x0f,
862};
863
864static uint8_t spm_power_collapse_with_rpm[] __initdata = {
865 0x00, 0x24, 0x54, 0x10,
866 0x09, 0x07, 0x01, 0x0B,
867 0x10, 0x54, 0x30, 0x0C,
868 0x24, 0x30, 0x0f,
869};
870
871static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
872 [0] = {
873 .mode = MSM_SPM_MODE_CLOCK_GATING,
874 .notify_rpm = false,
875 .cmd = spm_wfi_cmd_sequence,
876 },
877 [1] = {
878 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
879 .notify_rpm = false,
880 .cmd = spm_power_collapse_without_rpm,
881 },
882 [2] = {
883 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
884 .notify_rpm = true,
885 .cmd = spm_power_collapse_with_rpm,
886 },
887};
888
889static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
890 0x00, 0x20, 0x03, 0x20,
891 0x00, 0x0f,
892};
893
894static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
895 0x00, 0x20, 0x34, 0x64,
896 0x48, 0x07, 0x48, 0x20,
897 0x50, 0x64, 0x04, 0x34,
898 0x50, 0x0f,
899};
900static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
901 0x00, 0x10, 0x34, 0x64,
902 0x48, 0x07, 0x48, 0x10,
903 0x50, 0x64, 0x04, 0x34,
904 0x50, 0x0F,
905};
906
907static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
908 [0] = {
909 .mode = MSM_SPM_L2_MODE_RETENTION,
910 .notify_rpm = false,
911 .cmd = l2_spm_wfi_cmd_sequence,
912 },
913 [1] = {
914 .mode = MSM_SPM_L2_MODE_GDHS,
915 .notify_rpm = true,
916 .cmd = l2_spm_gdhs_cmd_sequence,
917 },
918 [2] = {
919 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
920 .notify_rpm = true,
921 .cmd = l2_spm_power_off_cmd_sequence,
922 },
923};
924
925
926static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
927 [0] = {
928 .reg_base_addr = MSM_SAW_L2_BASE,
929 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
930 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
931 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
932 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
933 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
934 .modes = msm_spm_l2_seq_list,
935 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
936 },
937};
938
939static struct msm_spm_platform_data msm_spm_data[] __initdata = {
940 [0] = {
941 .reg_base_addr = MSM_SAW0_BASE,
942 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
943 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
944 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
945#if defined(CONFIG_MSM_AVS_HW)
946 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
947 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
948#endif
949 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
950 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
951 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
952 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
953 .vctl_timeout_us = 50,
954 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
955 .modes = msm_spm_seq_list,
956 },
957 [1] = {
958 .reg_base_addr = MSM_SAW1_BASE,
959 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
960 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
961 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
962#if defined(CONFIG_MSM_AVS_HW)
963 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
964 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
965#endif
966 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
967 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
968 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
969 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
970 .vctl_timeout_us = 50,
971 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
972 .modes = msm_spm_seq_list,
973 },
974 [2] = {
975 .reg_base_addr = MSM_SAW2_BASE,
976 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
977 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
978 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
979#if defined(CONFIG_MSM_AVS_HW)
980 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
981 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
982#endif
983 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
984 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
985 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
986 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
987 .vctl_timeout_us = 50,
988 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
989 .modes = msm_spm_seq_list,
990 },
991 [3] = {
992 .reg_base_addr = MSM_SAW3_BASE,
993 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
994 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
995 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
996#if defined(CONFIG_MSM_AVS_HW)
997 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
998 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
999#endif
1000 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1001 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1002 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1003 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1004 .vctl_timeout_us = 50,
1005 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1006 .modes = msm_spm_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001007 },
1008};
1009
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001010static void __init apq8064_init_buses(void)
1011{
1012 msm_bus_rpm_set_mt_mask();
1013 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
1014 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
1015 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
1016 msm_bus_8064_apps_fabric.dev.platform_data =
1017 &msm_bus_8064_apps_fabric_pdata;
1018 msm_bus_8064_sys_fabric.dev.platform_data =
1019 &msm_bus_8064_sys_fabric_pdata;
1020 msm_bus_8064_mm_fabric.dev.platform_data =
1021 &msm_bus_8064_mm_fabric_pdata;
1022 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
1023 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
1024}
1025
David Collinsf0d00732012-01-25 15:46:50 -08001026static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
1027 .name = GPIO_REGULATOR_DEV_NAME,
1028 .id = PM8921_MPP_PM_TO_SYS(7),
1029 .dev = {
1030 .platform_data
1031 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
1032 },
1033};
1034
1035static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
1036 .name = GPIO_REGULATOR_DEV_NAME,
1037 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
1038 .dev = {
1039 .platform_data =
1040 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
1041 },
1042};
1043
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001044static struct platform_device *common_devices[] __initdata = {
Jin Hong01f2dbb2011-11-03 22:13:51 -07001045 &apq8064_device_dmov,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001046 &apq8064_device_qup_i2c_gsbi4,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001047 &apq8064_device_qup_spi_gsbi5,
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001048 &apq8064_slim_ctrl,
David Collinsf0d00732012-01-25 15:46:50 -08001049 &apq8064_device_ext_5v_vreg,
1050 &apq8064_device_ext_3p3v_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07001051 &apq8064_device_ssbi_pmic1,
1052 &apq8064_device_ssbi_pmic2,
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001053 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07001054 &apq8064_device_otg,
1055 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08001056 &apq8064_device_hsusb_host,
Hemant Kumara945b472012-01-25 15:08:06 -08001057 &apq8064_device_hsic_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07001058 &android_usb_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001059#ifdef CONFIG_ANDROID_PMEM
1060#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Kevin Chan13be4e22011-10-20 11:30:32 -07001061 &android_pmem_device,
1062 &android_pmem_adsp_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001063#endif
Kevin Chan13be4e22011-10-20 11:30:32 -07001064 &android_pmem_audio_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08001065#endif
1066#ifdef CONFIG_ION_MSM
1067 &ion_dev,
1068#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001069 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001070 &msm8064_device_saw_regulator_core0,
1071 &msm8064_device_saw_regulator_core1,
1072 &msm8064_device_saw_regulator_core2,
1073 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001074#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1075 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1076 &qcrypto_device,
1077#endif
1078
1079#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1080 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1081 &qcedev_device,
1082#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07001083
1084#ifdef CONFIG_HW_RANDOM_MSM
1085 &apq8064_device_rng,
1086#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08001087 &apq_pcm,
1088 &apq_pcm_routing,
1089 &apq_cpudai0,
1090 &apq_cpudai1,
1091 &apq_cpudai_hdmi_rx,
1092 &apq_cpudai_bt_rx,
1093 &apq_cpudai_bt_tx,
1094 &apq_cpudai_fm_rx,
1095 &apq_cpudai_fm_tx,
1096 &apq_cpu_fe,
1097 &apq_stub_codec,
1098 &apq_voice,
1099 &apq_voip,
1100 &apq_lpa_pcm,
1101 &apq_pcm_hostless,
1102 &apq_cpudai_afe_01_rx,
1103 &apq_cpudai_afe_01_tx,
1104 &apq_cpudai_afe_02_rx,
1105 &apq_cpudai_afe_02_tx,
1106 &apq_pcm_afe,
1107 &apq_cpudai_auxpcm_rx,
1108 &apq_cpudai_auxpcm_tx,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001109 &apq8064_rpm_device,
1110 &apq8064_rpm_log_device,
1111 &apq8064_rpm_stat_device,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001112 &msm_bus_8064_apps_fabric,
1113 &msm_bus_8064_sys_fabric,
1114 &msm_bus_8064_mm_fabric,
1115 &msm_bus_8064_sys_fpb,
1116 &msm_bus_8064_cpss_fpb,
Rajesh Sastrulaaee8af32012-01-20 11:46:31 -08001117 &msm_device_vidc,
Matt Wagantalled832652012-02-02 19:23:17 -08001118 &msm_8960_riva,
Matt Wagantallb94b9a52012-02-02 21:59:54 -08001119 &msm_8960_q6_lpass,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001120};
1121
Joel King4e7ad222011-08-17 15:47:38 -07001122static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001123 &apq8064_device_uart_gsbi3,
Yan He06913ce2011-08-26 16:33:46 -07001124 &msm_device_sps_apq8064,
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001125};
1126
1127static struct platform_device *rumi3_devices[] __initdata = {
1128 &apq8064_device_uart_gsbi1,
Yan He435ed612011-11-23 17:34:59 -08001129 &msm_device_sps_apq8064,
Huaibin Yang4a084e32011-12-15 15:25:52 -08001130#ifdef CONFIG_MSM_ROTATOR
1131 &msm_rotator_device,
1132#endif
Joel King4e7ad222011-08-17 15:47:38 -07001133};
1134
Joel King82b7e3f2012-01-05 10:03:27 -08001135static struct platform_device *cdp_devices[] __initdata = {
1136 &apq8064_device_uart_gsbi1,
1137 &msm_device_sps_apq8064,
1138};
1139
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001140static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08001141 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001142};
1143
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001144#define KS8851_IRQ_GPIO 43
1145
1146static struct spi_board_info spi_board_info[] __initdata = {
1147 {
1148 .modalias = "ks8851",
1149 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1150 .max_speed_hz = 19200000,
1151 .bus_num = 0,
1152 .chip_select = 2,
1153 .mode = SPI_MODE_0,
1154 },
1155};
1156
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001157static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001158 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001159 .bus_num = 1,
1160 .slim_slave = &apq8064_slim_tabla,
1161 },
1162 {
1163 .bus_num = 1,
1164 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08001165 },
1166 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001167};
1168
Kenneth Heitke748593a2011-07-15 15:45:11 -06001169static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
1170 .clk_freq = 100000,
1171 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06001172};
1173
1174static void __init apq8064_i2c_init(void)
1175{
1176 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
1177 &apq8064_i2c_qup_gsbi4_pdata;
1178}
1179
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08001180#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001181static int ethernet_init(void)
1182{
1183 int ret;
1184 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
1185 if (ret) {
1186 pr_err("ks8851 gpio_request failed: %d\n", ret);
1187 goto fail;
1188 }
1189
1190 return 0;
1191fail:
1192 return ret;
1193}
1194#else
1195static int ethernet_init(void)
1196{
1197 return 0;
1198}
1199#endif
1200
Tianyi Gou41515e22011-09-01 19:37:43 -07001201static void __init apq8064_clock_init(void)
1202{
Tianyi Gouacb588d2012-01-27 18:24:05 -08001203 if (machine_is_apq8064_rumi3())
Tianyi Gou41515e22011-09-01 19:37:43 -07001204 msm_clock_init(&apq8064_dummy_clock_init_data);
Tianyi Gouacb588d2012-01-27 18:24:05 -08001205 else
1206 msm_clock_init(&apq8064_clock_init_data);
Tianyi Gou41515e22011-09-01 19:37:43 -07001207}
1208
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001209static void __init apq8064_common_init(void)
1210{
1211 if (socinfo_init() < 0)
1212 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06001213 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
1214 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Tianyi Gou41515e22011-09-01 19:37:43 -07001215 apq8064_clock_init();
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08001216 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06001217 apq8064_i2c_init();
Kenneth Heitke36920d32011-07-20 16:44:30 -06001218
Harini Jayaramanc4c58692011-07-19 14:50:10 -06001219 apq8064_device_qup_spi_gsbi5.dev.platform_data =
1220 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08001221 apq8064_init_pmic();
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001222 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Hemant Kumara945b472012-01-25 15:08:06 -08001223 apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Gagan Mac8a7a5d32011-11-11 16:43:06 -07001224 apq8064_init_buses();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001225 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Jay Chokshie8741282012-01-25 15:22:55 -08001226 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05301227 apq8064_init_mmc();
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06001228 slim_register_board_info(apq8064_slim_devices,
1229 ARRAY_SIZE(apq8064_slim_devices));
Praveen Chidambaram78499012011-11-01 17:15:17 -06001230 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Mahesh Sivasubramaniancbce1ec2012-01-24 10:32:44 -07001231 acpuclk_init(&acpuclk_8064_soc_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06001232 msm_spm_l2_init(msm_spm_l2_data);
1233 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
1234 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
1235 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
1236 msm_pm_data);
1237 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Jordan Crouseb3115fe2012-02-01 22:11:12 -07001238
Joel Kingdacbc822012-01-25 13:30:57 -08001239 if (machine_is_apq8064_mtp()) {
1240 mdm_8064_device.dev.platform_data = &mdm_platform_data;
1241 platform_device_register(&mdm_8064_device);
1242 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001243}
1244
Huaibin Yang4a084e32011-12-15 15:25:52 -08001245static void __init apq8064_allocate_memory_regions(void)
1246{
1247 apq8064_allocate_fb_region();
1248}
1249
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001250static void __init apq8064_sim_init(void)
1251{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001252 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
1253 &msm8064_device_watchdog.dev.platform_data;
1254
1255 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001256 apq8064_common_init();
Joel King4e7ad222011-08-17 15:47:38 -07001257 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
1258}
1259
1260static void __init apq8064_rumi3_init(void)
1261{
1262 apq8064_common_init();
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001263 ethernet_init();
Stepan Moskovchenko2701a442011-08-19 13:47:22 -07001264 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07001265 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Huaibin Yang4a084e32011-12-15 15:25:52 -08001266 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07001267 apq8064_init_gpu();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001268}
1269
Joel King82b7e3f2012-01-05 10:03:27 -08001270static void __init apq8064_cdp_init(void)
1271{
1272 apq8064_common_init();
1273 ethernet_init();
1274 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
1275 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Jordan Crouseb3115fe2012-02-01 22:11:12 -07001276 apq8064_init_gpu();
Joel King82b7e3f2012-01-05 10:03:27 -08001277}
1278
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001279MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
1280 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07001281 .reserve = apq8064_reserve,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001282 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05301283 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001284 .timer = &msm_timer,
1285 .init_machine = apq8064_sim_init,
1286MACHINE_END
1287
Joel King4e7ad222011-08-17 15:47:38 -07001288MACHINE_START(APQ8064_RUMI3, "QCT APQ8064 RUMI3")
1289 .map_io = apq8064_map_io,
Kevin Chan13be4e22011-10-20 11:30:32 -07001290 .reserve = apq8064_reserve,
Joel King4e7ad222011-08-17 15:47:38 -07001291 .init_irq = apq8064_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05301292 .handle_irq = gic_handle_irq,
Joel King4e7ad222011-08-17 15:47:38 -07001293 .timer = &msm_timer,
1294 .init_machine = apq8064_rumi3_init,
Huaibin Yang4a084e32011-12-15 15:25:52 -08001295 .init_early = apq8064_allocate_memory_regions,
Joel King4e7ad222011-08-17 15:47:38 -07001296MACHINE_END
1297
Joel King82b7e3f2012-01-05 10:03:27 -08001298MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
1299 .map_io = apq8064_map_io,
1300 .reserve = apq8064_reserve,
1301 .init_irq = apq8064_init_irq,
1302 .handle_irq = gic_handle_irq,
1303 .timer = &msm_timer,
1304 .init_machine = apq8064_cdp_init,
1305MACHINE_END
1306
1307MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
1308 .map_io = apq8064_map_io,
1309 .reserve = apq8064_reserve,
1310 .init_irq = apq8064_init_irq,
1311 .handle_irq = gic_handle_irq,
1312 .timer = &msm_timer,
1313 .init_machine = apq8064_cdp_init,
1314MACHINE_END
1315
1316MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
1317 .map_io = apq8064_map_io,
1318 .reserve = apq8064_reserve,
1319 .init_irq = apq8064_init_irq,
1320 .handle_irq = gic_handle_irq,
1321 .timer = &msm_timer,
1322 .init_machine = apq8064_cdp_init,
1323MACHINE_END
1324