blob: 533d4f76d37ca9b2e69e5edbc6d2732c4100596e [file] [log] [blame]
David Collinsb4558422012-01-05 10:50:49 -08001/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002 *
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>
17#include <linux/i2c.h>
18#include <linux/i2c/sx150x.h>
19#include <linux/i2c/isl9519.h>
20#include <linux/gpio.h>
21#include <linux/msm_ssbi.h>
22#include <linux/regulator/gpio-regulator.h>
23#include <linux/mfd/pm8xxx/pm8921.h>
24#include <linux/mfd/pm8xxx/pm8xxx-adc.h>
25#include <linux/regulator/consumer.h>
26#include <linux/spi/spi.h>
27#include <linux/slimbus/slimbus.h>
28#include <linux/bootmem.h>
29#include <linux/msm_kgsl.h>
30#ifdef CONFIG_ANDROID_PMEM
31#include <linux/android_pmem.h>
32#endif
33#include <linux/cyttsp.h>
34#include <linux/dma-mapping.h>
35#include <linux/platform_data/qcom_crypto_device.h>
36#include <linux/platform_data/qcom_wcnss_device.h>
37#include <linux/leds.h>
38#include <linux/leds-pm8xxx.h>
39#include <linux/i2c/atmel_mxt_ts.h>
40#include <linux/msm_tsens.h>
41#include <linux/ks8851.h>
42#include <linux/i2c/isa1200.h>
Anirudh Ghayaleb3af972011-12-13 17:29:06 +053043#include <linux/gpio_keys.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080044
45#include <asm/mach-types.h>
46#include <asm/mach/arch.h>
47#include <asm/setup.h>
48#include <asm/hardware/gic.h>
49#include <asm/mach/mmc.h>
50
51#include <mach/board.h>
52#include <mach/msm_iomap.h>
53#include <mach/msm_spi.h>
54#ifdef CONFIG_USB_MSM_OTG_72K
55#include <mach/msm_hsusb.h>
56#else
57#include <linux/usb/msm_hsusb.h>
58#endif
59#include <linux/usb/android.h>
60#include <mach/usbdiag.h>
61#include <mach/socinfo.h>
62#include <mach/rpm.h>
63#include <mach/gpio.h>
64#include <mach/gpiomux.h>
65#include <mach/msm_bus_board.h>
66#include <mach/msm_memtypes.h>
67#include <mach/dma.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080068#include <mach/msm_xo.h>
69#include <mach/restart.h>
70
71#ifdef CONFIG_WCD9310_CODEC
72#include <linux/slimbus/slimbus.h>
73#include <linux/mfd/wcd9310/core.h>
74#include <linux/mfd/wcd9310/pdata.h>
75#endif
76
77#include <linux/ion.h>
78#include <mach/ion.h>
79#include <mach/mdm2.h>
80
81#include "timer.h"
82#include "devices.h"
83#include "devices-msm8x60.h"
84#include "spm.h"
Abhijeet Dharmapurikarefaca4f2011-12-27 16:24:07 -080085#include <mach/pm.h>
86#include <mach/cpuidle.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080087#include "rpm_resources.h"
88#include "mpm.h"
89#include "acpuclock.h"
90#include "rpm_log.h"
91#include "smd_private.h"
92#include "pm-boot.h"
93#include "msm_watchdog.h"
Jay Chokshi06fa7542011-12-07 13:09:17 -080094#include "board-8930.h"
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080095
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080096static struct platform_device msm_fm_platform_init = {
97 .name = "iris_fm",
98 .id = -1,
99};
100
101#define KS8851_RST_GPIO 89
102#define KS8851_IRQ_GPIO 90
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800103#define HAP_SHIFT_LVL_OE_GPIO 47
104
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800105#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
106
107struct sx150x_platform_data msm8930_sx150x_data[] = {
108 [SX150X_CAM] = {
109 .gpio_base = GPIO_CAM_EXPANDER_BASE,
110 .oscio_is_gpo = false,
111 .io_pullup_ena = 0x0,
112 .io_pulldn_ena = 0xc0,
113 .io_open_drain_ena = 0x0,
114 .irq_summary = -1,
115 },
116};
117
118#endif
119
120#define MSM_PMEM_ADSP_SIZE 0x3800000
Ben Romberger3ffcd812011-12-08 19:12:10 -0800121#define MSM_PMEM_AUDIO_SIZE 0x2B4000
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800122#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
123#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
124#else
125#define MSM_PMEM_SIZE 0x1C00000 /* 28 Mbytes */
126#endif
127
128
129#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
130#define MSM_PMEM_KERNEL_EBI1_SIZE 0xB0C000
Olav Hauganb5be7992011-11-18 14:29:02 -0800131#define MSM_ION_SF_SIZE 0x1800000 /* 24MB */
132#define MSM_ION_MM_SIZE 0x4000000 /* (64MB) */
133#define MSM_ION_MFC_SIZE SZ_8K
134#define MSM_ION_HEAP_NUM 5
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800135#else
136#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
Olav Hauganb5be7992011-11-18 14:29:02 -0800137#define MSM_ION_HEAP_NUM 1
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800138#endif
139
140#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
141static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
142static int __init pmem_kernel_ebi1_size_setup(char *p)
143{
144 pmem_kernel_ebi1_size = memparse(p, NULL);
145 return 0;
146}
147early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
148#endif
149
150#ifdef CONFIG_ANDROID_PMEM
151static unsigned pmem_size = MSM_PMEM_SIZE;
152static int __init pmem_size_setup(char *p)
153{
154 pmem_size = memparse(p, NULL);
155 return 0;
156}
157early_param("pmem_size", pmem_size_setup);
158
159static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
160
161static int __init pmem_adsp_size_setup(char *p)
162{
163 pmem_adsp_size = memparse(p, NULL);
164 return 0;
165}
166early_param("pmem_adsp_size", pmem_adsp_size_setup);
167
168static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
169
170static int __init pmem_audio_size_setup(char *p)
171{
172 pmem_audio_size = memparse(p, NULL);
173 return 0;
174}
175early_param("pmem_audio_size", pmem_audio_size_setup);
176#endif
177
178#ifdef CONFIG_ANDROID_PMEM
179#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
180static struct android_pmem_platform_data android_pmem_pdata = {
181 .name = "pmem",
182 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
183 .cached = 1,
184 .memory_type = MEMTYPE_EBI1,
185};
186
187static struct platform_device android_pmem_device = {
188 .name = "android_pmem",
189 .id = 0,
190 .dev = {.platform_data = &android_pmem_pdata},
191};
192
193static struct android_pmem_platform_data android_pmem_adsp_pdata = {
194 .name = "pmem_adsp",
195 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
196 .cached = 0,
197 .memory_type = MEMTYPE_EBI1,
198};
199static struct platform_device android_pmem_adsp_device = {
200 .name = "android_pmem",
201 .id = 2,
202 .dev = { .platform_data = &android_pmem_adsp_pdata },
203};
204#endif
205
206static struct android_pmem_platform_data android_pmem_audio_pdata = {
207 .name = "pmem_audio",
208 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
209 .cached = 0,
210 .memory_type = MEMTYPE_EBI1,
211};
212
213static struct platform_device android_pmem_audio_device = {
214 .name = "android_pmem",
215 .id = 4,
216 .dev = { .platform_data = &android_pmem_audio_pdata },
217};
218#endif
219
220#define DSP_RAM_BASE_8960 0x8da00000
221#define DSP_RAM_SIZE_8960 0x1800000
222static int dspcrashd_pdata_8960 = 0xDEADDEAD;
223
224static struct resource resources_dspcrashd_8960[] = {
225 {
226 .name = "msm_dspcrashd",
227 .start = DSP_RAM_BASE_8960,
228 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
229 .flags = IORESOURCE_DMA,
230 },
231};
232
233static struct platform_device msm_device_dspcrashd_8960 = {
234 .name = "msm_dspcrashd",
235 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
236 .resource = resources_dspcrashd_8960,
237 .dev = { .platform_data = &dspcrashd_pdata_8960 },
238};
239
240static struct memtype_reserve msm8930_reserve_table[] __initdata = {
241 [MEMTYPE_SMI] = {
242 },
243 [MEMTYPE_EBI0] = {
244 .flags = MEMTYPE_FLAGS_1M_ALIGN,
245 },
246 [MEMTYPE_EBI1] = {
247 .flags = MEMTYPE_FLAGS_1M_ALIGN,
248 },
249};
250
251static void __init size_pmem_devices(void)
252{
253#ifdef CONFIG_ANDROID_PMEM
254#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
255 android_pmem_adsp_pdata.size = pmem_adsp_size;
256 android_pmem_pdata.size = pmem_size;
257#endif
258 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
259#endif
260}
261
262static void __init reserve_memory_for(struct android_pmem_platform_data *p)
263{
264 msm8930_reserve_table[p->memory_type].size += p->size;
265}
266
267static void __init reserve_pmem_memory(void)
268{
269#ifdef CONFIG_ANDROID_PMEM
270#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
271 reserve_memory_for(&android_pmem_adsp_pdata);
272 reserve_memory_for(&android_pmem_pdata);
273#endif
274 reserve_memory_for(&android_pmem_audio_pdata);
275 msm8930_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
276#endif
277}
278
279static int msm8930_paddr_to_memtype(unsigned int paddr)
280{
281 return MEMTYPE_EBI1;
282}
283
284#ifdef CONFIG_ION_MSM
Olav Haugan0703dbf2011-12-19 17:53:38 -0800285#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
286static struct ion_cp_heap_pdata cp_mm_ion_pdata = {
287 .permission_type = IPT_TYPE_MM_CARVEOUT,
288};
289
290static struct ion_cp_heap_pdata cp_mfc_ion_pdata = {
291 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
292};
293static struct ion_co_heap_pdata co_ion_pdata = {
294};
295#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800296static struct ion_platform_data ion_pdata = {
297 .nr = MSM_ION_HEAP_NUM,
298 .heaps = {
299 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800300 .id = ION_SYSTEM_HEAP_ID,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800301 .type = ION_HEAP_TYPE_SYSTEM,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800302 .name = ION_VMALLOC_HEAP_NAME,
303 },
304#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
305 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800306 .id = ION_SF_HEAP_ID,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800307 .type = ION_HEAP_TYPE_CARVEOUT,
Olav Hauganb5be7992011-11-18 14:29:02 -0800308 .name = ION_SF_HEAP_NAME,
309 .size = MSM_ION_SF_SIZE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800310 .memory_type = ION_EBI_TYPE,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800311 .extra_data = &co_ion_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800312 },
313 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800314 .id = ION_CP_MM_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800315 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800316 .name = ION_MM_HEAP_NAME,
317 .size = MSM_ION_MM_SIZE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800318 .memory_type = ION_EBI_TYPE,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800319 .extra_data = (void *) &cp_mm_ion_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800320 },
Olav Hauganb5be7992011-11-18 14:29:02 -0800321 {
322 .id = ION_CP_MFC_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800323 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800324 .name = ION_MFC_HEAP_NAME,
325 .size = MSM_ION_MFC_SIZE,
326 .memory_type = ION_EBI_TYPE,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800327 .extra_data = (void *) &cp_mfc_ion_pdata,
Olav Hauganb5be7992011-11-18 14:29:02 -0800328 },
329 {
330 .id = ION_IOMMU_HEAP_ID,
331 .type = ION_HEAP_TYPE_IOMMU,
332 .name = ION_IOMMU_HEAP_NAME,
333 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800334#endif
335 }
336};
337
338static struct platform_device ion_dev = {
339 .name = "ion-msm",
340 .id = 1,
341 .dev = { .platform_data = &ion_pdata },
342};
343#endif
344
345static void reserve_ion_memory(void)
346{
347#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Olav Hauganb5be7992011-11-18 14:29:02 -0800348 msm8930_reserve_table[MEMTYPE_EBI1].size += MSM_ION_SF_SIZE;
349 msm8930_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_SIZE;
350 msm8930_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MFC_SIZE;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800351#endif
352}
Huaibin Yanga5419422011-12-08 23:52:10 -0800353
354static void __init reserve_mdp_memory(void)
355{
356 msm8930_mdp_writeback(msm8930_reserve_table);
357}
358
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800359static void __init msm8930_calculate_reserve_sizes(void)
360{
361 size_pmem_devices();
362 reserve_pmem_memory();
363 reserve_ion_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800364 reserve_mdp_memory();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800365}
366
367static struct reserve_info msm8930_reserve_info __initdata = {
368 .memtype_reserve_table = msm8930_reserve_table,
369 .calculate_reserve_sizes = msm8930_calculate_reserve_sizes,
370 .paddr_to_memtype = msm8930_paddr_to_memtype,
371};
372
373static int msm8930_memory_bank_size(void)
374{
375 return 1<<29;
376}
377
378static void __init locate_unstable_memory(void)
379{
380 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
381 unsigned long bank_size;
382 unsigned long low, high;
383
384 bank_size = msm8930_memory_bank_size();
385 low = meminfo.bank[0].start;
386 high = mb->start + mb->size;
387
388 /* Check if 32 bit overflow occured */
389 if (high < mb->start)
390 high = ~0UL;
391
392 low &= ~(bank_size - 1);
393
394 if (high - low <= bank_size)
395 return;
396 msm8930_reserve_info.low_unstable_address = low + bank_size;
397 /* To avoid overflow of u32 compute max_unstable_size
398 * by first subtracting low from mb->start)
399 * */
400 msm8930_reserve_info.max_unstable_size = (mb->start - low) +
401 mb->size - bank_size;
402
403 msm8930_reserve_info.bank_size = bank_size;
404 pr_info("low unstable address %lx max size %lx bank size %lx\n",
405 msm8930_reserve_info.low_unstable_address,
406 msm8930_reserve_info.max_unstable_size,
407 msm8930_reserve_info.bank_size);
408}
409
410static void __init place_movable_zone(void)
411{
412 movable_reserved_start = msm8930_reserve_info.low_unstable_address;
413 movable_reserved_size = msm8930_reserve_info.max_unstable_size;
414 pr_info("movable zone start %lx size %lx\n",
415 movable_reserved_start, movable_reserved_size);
416}
417
418static void __init msm8930_early_memory(void)
419{
420 reserve_info = &msm8930_reserve_info;
421 locate_unstable_memory();
422 place_movable_zone();
423}
424
425static void __init msm8930_reserve(void)
426{
427 msm_reserve();
428}
429
430static int msm8930_change_memory_power(u64 start, u64 size,
431 int change_type)
432{
433 return soc_change_memory_power(start, size, change_type);
434}
435
436static void __init msm8930_allocate_memory_regions(void)
437{
438 msm8930_allocate_fb_region();
439}
440
441#ifdef CONFIG_WCD9310_CODEC
442
443#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
444
445/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
446 * 4 micbiases are used to power various analog and digital
447 * microphones operating at 1800 mV. Technically, all micbiases
448 * can source from single cfilter since all microphones operate
449 * at the same voltage level. The arrangement below is to make
450 * sure all cfilters are exercised. LDO_H regulator ouput level
451 * does not need to be as high as 2.85V. It is choosen for
452 * microphone sensitivity purpose.
453 */
454static struct tabla_pdata tabla_platform_data = {
455 .slimbus_slave_device = {
456 .name = "tabla-slave",
457 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
458 },
459 .irq = MSM_GPIO_TO_INT(62),
460 .irq_base = TABLA_INTERRUPT_BASE,
461 .num_irqs = NR_TABLA_IRQS,
Jay Chokshi06fa7542011-12-07 13:09:17 -0800462
463/*TODO: Replace this with right PM8038 gpio */
464#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800465 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Jay Chokshi06fa7542011-12-07 13:09:17 -0800466#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800467 .micbias = {
468 .ldoh_v = TABLA_LDOH_2P85_V,
469 .cfilt1_mv = 1800,
470 .cfilt2_mv = 1800,
471 .cfilt3_mv = 1800,
472 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
473 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
474 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
475 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
476 }
477};
478
479static struct slim_device msm_slim_tabla = {
480 .name = "tabla-slim",
481 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
482 .dev = {
483 .platform_data = &tabla_platform_data,
484 },
485};
486
487static struct tabla_pdata tabla20_platform_data = {
488 .slimbus_slave_device = {
489 .name = "tabla-slave",
490 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
491 },
492 .irq = MSM_GPIO_TO_INT(62),
493 .irq_base = TABLA_INTERRUPT_BASE,
494 .num_irqs = NR_TABLA_IRQS,
Jay Chokshi06fa7542011-12-07 13:09:17 -0800495
496/*TODO: Replace this with right PM8038 gpio */
497#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800498 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Jay Chokshi06fa7542011-12-07 13:09:17 -0800499#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800500 .micbias = {
501 .ldoh_v = TABLA_LDOH_2P85_V,
502 .cfilt1_mv = 1800,
503 .cfilt2_mv = 1800,
504 .cfilt3_mv = 1800,
505 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
506 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
507 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
508 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
509 }
510};
511
512static struct slim_device msm_slim_tabla20 = {
513 .name = "tabla2x-slim",
514 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
515 .dev = {
516 .platform_data = &tabla20_platform_data,
517 },
518};
519#endif
520
521static struct slim_boardinfo msm_slim_devices[] = {
522#ifdef CONFIG_WCD9310_CODEC
523 {
524 .bus_num = 1,
525 .slim_slave = &msm_slim_tabla,
526 },
527 {
528 .bus_num = 1,
529 .slim_slave = &msm_slim_tabla20,
530 },
531#endif
532 /* add more slimbus slaves as needed */
533};
534
535#define MSM_WCNSS_PHYS 0x03000000
536#define MSM_WCNSS_SIZE 0x280000
537
538static struct resource resources_wcnss_wlan[] = {
539 {
540 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
541 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
542 .name = "wcnss_wlanrx_irq",
543 .flags = IORESOURCE_IRQ,
544 },
545 {
546 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
547 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
548 .name = "wcnss_wlantx_irq",
549 .flags = IORESOURCE_IRQ,
550 },
551 {
552 .start = MSM_WCNSS_PHYS,
553 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
554 .name = "wcnss_mmio",
555 .flags = IORESOURCE_MEM,
556 },
557 {
558 .start = 84,
559 .end = 88,
560 .name = "wcnss_gpios_5wire",
561 .flags = IORESOURCE_IO,
562 },
563};
564
565static struct qcom_wcnss_opts qcom_wcnss_pdata = {
566 .has_48mhz_xo = 1,
567};
568
569static struct platform_device msm_device_wcnss_wlan = {
570 .name = "wcnss_wlan",
571 .id = 0,
572 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
573 .resource = resources_wcnss_wlan,
574 .dev = {.platform_data = &qcom_wcnss_pdata},
575};
576
577#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
578 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
579 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
580 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
581
582#define QCE_SIZE 0x10000
583#define QCE_0_BASE 0x18500000
584
585#define QCE_HW_KEY_SUPPORT 0
586#define QCE_SHA_HMAC_SUPPORT 1
587#define QCE_SHARE_CE_RESOURCE 1
588#define QCE_CE_SHARED 0
589
590static struct resource qcrypto_resources[] = {
591 [0] = {
592 .start = QCE_0_BASE,
593 .end = QCE_0_BASE + QCE_SIZE - 1,
594 .flags = IORESOURCE_MEM,
595 },
596 [1] = {
597 .name = "crypto_channels",
598 .start = DMOV_CE_IN_CHAN,
599 .end = DMOV_CE_OUT_CHAN,
600 .flags = IORESOURCE_DMA,
601 },
602 [2] = {
603 .name = "crypto_crci_in",
604 .start = DMOV_CE_IN_CRCI,
605 .end = DMOV_CE_IN_CRCI,
606 .flags = IORESOURCE_DMA,
607 },
608 [3] = {
609 .name = "crypto_crci_out",
610 .start = DMOV_CE_OUT_CRCI,
611 .end = DMOV_CE_OUT_CRCI,
612 .flags = IORESOURCE_DMA,
613 },
614};
615
616static struct resource qcedev_resources[] = {
617 [0] = {
618 .start = QCE_0_BASE,
619 .end = QCE_0_BASE + QCE_SIZE - 1,
620 .flags = IORESOURCE_MEM,
621 },
622 [1] = {
623 .name = "crypto_channels",
624 .start = DMOV_CE_IN_CHAN,
625 .end = DMOV_CE_OUT_CHAN,
626 .flags = IORESOURCE_DMA,
627 },
628 [2] = {
629 .name = "crypto_crci_in",
630 .start = DMOV_CE_IN_CRCI,
631 .end = DMOV_CE_IN_CRCI,
632 .flags = IORESOURCE_DMA,
633 },
634 [3] = {
635 .name = "crypto_crci_out",
636 .start = DMOV_CE_OUT_CRCI,
637 .end = DMOV_CE_OUT_CRCI,
638 .flags = IORESOURCE_DMA,
639 },
640};
641
642#endif
643
644#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
645 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
646
647static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
648 .ce_shared = QCE_CE_SHARED,
649 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
650 .hw_key_support = QCE_HW_KEY_SUPPORT,
651 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
652};
653
654static struct platform_device qcrypto_device = {
655 .name = "qcrypto",
656 .id = 0,
657 .num_resources = ARRAY_SIZE(qcrypto_resources),
658 .resource = qcrypto_resources,
659 .dev = {
660 .coherent_dma_mask = DMA_BIT_MASK(32),
661 .platform_data = &qcrypto_ce_hw_suppport,
662 },
663};
664#endif
665
666#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
667 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
668
669static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
670 .ce_shared = QCE_CE_SHARED,
671 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
672 .hw_key_support = QCE_HW_KEY_SUPPORT,
673 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
674};
675
676static struct platform_device qcedev_device = {
677 .name = "qce",
678 .id = 0,
679 .num_resources = ARRAY_SIZE(qcedev_resources),
680 .resource = qcedev_resources,
681 .dev = {
682 .coherent_dma_mask = DMA_BIT_MASK(32),
683 .platform_data = &qcedev_ce_hw_suppport,
684 },
685};
686#endif
687
688#define MDM2AP_ERRFATAL 70
689#define AP2MDM_ERRFATAL 95
690#define MDM2AP_STATUS 69
691#define AP2MDM_STATUS 94
692#define AP2MDM_PMIC_RESET_N 80
693#define AP2MDM_KPDPWR_N 81
694
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800695static struct resource mdm_resources[] = {
696 {
697 .start = MDM2AP_ERRFATAL,
698 .end = MDM2AP_ERRFATAL,
699 .name = "MDM2AP_ERRFATAL",
700 .flags = IORESOURCE_IO,
701 },
702 {
703 .start = AP2MDM_ERRFATAL,
704 .end = AP2MDM_ERRFATAL,
705 .name = "AP2MDM_ERRFATAL",
706 .flags = IORESOURCE_IO,
707 },
708 {
709 .start = MDM2AP_STATUS,
710 .end = MDM2AP_STATUS,
711 .name = "MDM2AP_STATUS",
712 .flags = IORESOURCE_IO,
713 },
714 {
715 .start = AP2MDM_STATUS,
716 .end = AP2MDM_STATUS,
717 .name = "AP2MDM_STATUS",
718 .flags = IORESOURCE_IO,
719 },
720 {
721 .start = AP2MDM_PMIC_RESET_N,
722 .end = AP2MDM_PMIC_RESET_N,
723 .name = "AP2MDM_PMIC_RESET_N",
724 .flags = IORESOURCE_IO,
725 },
726 {
727 .start = AP2MDM_KPDPWR_N,
728 .end = AP2MDM_KPDPWR_N,
729 .name = "AP2MDM_KPDPWR_N",
730 .flags = IORESOURCE_IO,
731 },
732};
733
734static struct mdm_platform_data mdm_platform_data = {
735 .mdm_version = "2.5",
736};
737
738static struct platform_device mdm_device = {
739 .name = "mdm2_modem",
740 .id = -1,
741 .num_resources = ARRAY_SIZE(mdm_resources),
742 .resource = mdm_resources,
743 .dev = {
744 .platform_data = &mdm_platform_data,
745 },
746};
747
748static struct platform_device *mdm_devices[] __initdata = {
749 &mdm_device,
750};
751
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800752#define MSM_SHARED_RAM_PHYS 0x80000000
753
754static void __init msm8930_map_io(void)
755{
756 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
757 msm_map_msm8930_io();
758
759 if (socinfo_init() < 0)
760 pr_err("socinfo_init() failed!\n");
761}
762
763static void __init msm8930_init_irq(void)
764{
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800765 msm_mpm_irq_extn_init();
766 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
767 (void *)MSM_QGIC_CPU_BASE);
768
769 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
770 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
771
772 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
773 mb();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800774}
775
776static void __init msm8930_init_buses(void)
777{
778#ifdef CONFIG_MSM_BUS_SCALING
779 msm_bus_rpm_set_mt_mask();
780 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
781 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
782 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
783 msm_bus_apps_fabric.dev.platform_data =
784 &msm_bus_8960_apps_fabric_pdata;
785 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
786 msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
787 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
788 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
789#endif
790}
791
792static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
793 .max_clock_speed = 15060000,
794};
795
796#ifdef CONFIG_USB_MSM_OTG_72K
797static struct msm_otg_platform_data msm_otg_pdata;
798#else
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800799static struct msm_otg_platform_data msm_otg_pdata = {
800 .mode = USB_OTG,
801 .otg_control = OTG_PMIC_CONTROL,
802 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Jay Chokshi06fa7542011-12-07 13:09:17 -0800803 .pmic_id_irq = PM8038_USB_ID_IN_IRQ(PM8038_IRQ_BASE),
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800804 .power_budget = 750,
805};
806#endif
807
808#ifdef CONFIG_USB_EHCI_MSM_HSIC
809#define HSIC_HUB_RESET_GPIO 91
810static struct msm_hsic_host_platform_data msm_hsic_pdata = {
811 .strobe = 150,
812 .data = 151,
813};
814#else
815static struct msm_hsic_host_platform_data msm_hsic_pdata;
816#endif
817
818#define PID_MAGIC_ID 0x71432909
819#define SERIAL_NUM_MAGIC_ID 0x61945374
820#define SERIAL_NUMBER_LENGTH 127
821#define DLOAD_USB_BASE_ADD 0x2A03F0C8
822
823struct magic_num_struct {
824 uint32_t pid;
825 uint32_t serial_num;
826};
827
828struct dload_struct {
829 uint32_t reserved1;
830 uint32_t reserved2;
831 uint32_t reserved3;
832 uint16_t reserved4;
833 uint16_t pid;
834 char serial_number[SERIAL_NUMBER_LENGTH];
835 uint16_t reserved5;
836 struct magic_num_struct magic_struct;
837};
838
839static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
840{
841 struct dload_struct __iomem *dload = 0;
842
843 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
844 if (!dload) {
845 pr_err("%s: cannot remap I/O memory region: %08x\n",
846 __func__, DLOAD_USB_BASE_ADD);
847 return -ENXIO;
848 }
849
850 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
851 __func__, dload, pid, snum);
852 /* update pid */
853 dload->magic_struct.pid = PID_MAGIC_ID;
854 dload->pid = pid;
855
856 /* update serial number */
857 dload->magic_struct.serial_num = 0;
858 if (!snum) {
859 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
860 goto out;
861 }
862
863 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
864 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
865out:
866 iounmap(dload);
867 return 0;
868}
869
870static struct android_usb_platform_data android_usb_pdata = {
871 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
872};
873
874static struct platform_device android_usb_device = {
875 .name = "android_usb",
876 .id = -1,
877 .dev = {
878 .platform_data = &android_usb_pdata,
879 },
880};
881
882static uint8_t spm_wfi_cmd_sequence[] __initdata = {
883 0x03, 0x0f,
884};
885
886static uint8_t spm_power_collapse_without_rpm[] __initdata = {
887 0x00, 0x24, 0x54, 0x10,
888 0x09, 0x03, 0x01,
889 0x10, 0x54, 0x30, 0x0C,
890 0x24, 0x30, 0x0f,
891};
892
893static uint8_t spm_power_collapse_with_rpm[] __initdata = {
894 0x00, 0x24, 0x54, 0x10,
895 0x09, 0x07, 0x01, 0x0B,
896 0x10, 0x54, 0x30, 0x0C,
897 0x24, 0x30, 0x0f,
898};
899
900static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
901 [0] = {
902 .mode = MSM_SPM_MODE_CLOCK_GATING,
903 .notify_rpm = false,
904 .cmd = spm_wfi_cmd_sequence,
905 },
906 [1] = {
907 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
908 .notify_rpm = false,
909 .cmd = spm_power_collapse_without_rpm,
910 },
911 [2] = {
912 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
913 .notify_rpm = true,
914 .cmd = spm_power_collapse_with_rpm,
915 },
916};
917
918static struct msm_spm_platform_data msm_spm_data[] __initdata = {
919 [0] = {
920 .reg_base_addr = MSM_SAW0_BASE,
921 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
922 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
923 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
924#if defined(CONFIG_MSM_AVS_HW)
925 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
926 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
927#endif
928 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
929 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
930 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
931 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
932 .vctl_timeout_us = 50,
933 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
934 .modes = msm_spm_seq_list,
935 },
936 [1] = {
937 .reg_base_addr = MSM_SAW1_BASE,
938 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
939 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
940 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
941#if defined(CONFIG_MSM_AVS_HW)
942 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
943 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
944#endif
945 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
946 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
947 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
948 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
949 .vctl_timeout_us = 50,
950 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
951 .modes = msm_spm_seq_list,
952 },
953};
954
955static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
956 0x00, 0x20, 0x03, 0x20,
957 0x00, 0x0f,
958};
959
960static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
961 0x00, 0x20, 0x34, 0x64,
962 0x48, 0x07, 0x48, 0x20,
963 0x50, 0x64, 0x04, 0x34,
964 0x50, 0x0f,
965};
966static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
967 0x00, 0x10, 0x34, 0x64,
968 0x48, 0x07, 0x48, 0x10,
969 0x50, 0x64, 0x04, 0x34,
970 0x50, 0x0F,
971};
972
973static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
974 [0] = {
975 .mode = MSM_SPM_L2_MODE_RETENTION,
976 .notify_rpm = false,
977 .cmd = l2_spm_wfi_cmd_sequence,
978 },
979 [1] = {
980 .mode = MSM_SPM_L2_MODE_GDHS,
981 .notify_rpm = true,
982 .cmd = l2_spm_gdhs_cmd_sequence,
983 },
984 [2] = {
985 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
986 .notify_rpm = true,
987 .cmd = l2_spm_power_off_cmd_sequence,
988 },
989};
990
991static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
992 [0] = {
993 .reg_base_addr = MSM_SAW_L2_BASE,
994 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
995 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
996 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
997 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
998 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
999 .modes = msm_spm_l2_seq_list,
1000 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1001 },
1002};
1003
Jay Chokshi06fa7542011-12-07 13:09:17 -08001004#/* TODO: Remove this once PM8038 physically becomes
1005 * available.
1006 */
1007#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001008#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1009#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301010#else
1011#define ISA1200_HAP_EN_GPIO 77
1012#define ISA1200_HAP_LEN_GPIO 78
1013#define ISA1200_HAP_CLK PM8038_GPIO_PM_TO_SYS(7)
Jay Chokshi06fa7542011-12-07 13:09:17 -08001014#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001015
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301016#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001017static struct msm_xo_voter *xo_handle_d1;
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301018#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001019
1020static int isa1200_power(int on)
1021{
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301022#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001023 int rc = 0;
1024
1025 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !!on);
1026
1027 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
1028 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
1029 if (rc < 0) {
1030 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
1031 __func__, on ? "" : "de-", rc);
1032 goto err_xo_vote;
1033 }
1034
1035 return 0;
1036
1037err_xo_vote:
1038 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !on);
1039 return rc;
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301040#else
1041 gpio_set_value_cansleep(ISA1200_HAP_CLK, !!on);
1042
1043 return 0;
1044#endif
1045
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001046}
1047
1048static int isa1200_dev_setup(bool enable)
1049{
1050 int rc = 0;
1051
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301052#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001053 struct pm_gpio hap_gpio_config = {
1054 .direction = PM_GPIO_DIR_OUT,
1055 .pull = PM_GPIO_PULL_NO,
1056 .out_strength = PM_GPIO_STRENGTH_HIGH,
1057 .function = PM_GPIO_FUNC_NORMAL,
1058 .inv_int_pol = 0,
1059 .vin_sel = 2,
1060 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1061 .output_value = 0,
1062 };
1063
1064 if (enable == true) {
1065 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
1066 if (rc) {
1067 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1068 __func__, PM_HAP_EN_GPIO, rc);
1069 return rc;
1070 }
1071
1072 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
1073 if (rc) {
1074 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1075 __func__, PM_HAP_LEN_GPIO, rc);
1076 return rc;
1077 }
1078
1079 rc = gpio_request(HAP_SHIFT_LVL_OE_GPIO, "hap_shft_lvl_oe");
1080 if (rc) {
1081 pr_err("%s: unable to request gpio %d (%d)\n",
1082 __func__, HAP_SHIFT_LVL_OE_GPIO, rc);
1083 return rc;
1084 }
1085
1086 rc = gpio_direction_output(HAP_SHIFT_LVL_OE_GPIO, 0);
1087 if (rc) {
1088 pr_err("%s: Unable to set direction\n", __func__);
1089 goto free_gpio;
1090 }
1091
1092 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
1093 if (IS_ERR(xo_handle_d1)) {
1094 rc = PTR_ERR(xo_handle_d1);
1095 pr_err("%s: failed to get the handle for D1(%d)\n",
1096 __func__, rc);
1097 goto gpio_set_dir;
1098 }
1099 } else {
1100 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1101
1102 msm_xo_put(xo_handle_d1);
1103 }
1104
1105 return 0;
1106
1107gpio_set_dir:
1108 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, 0);
1109free_gpio:
1110 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1111 return rc;
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301112#else
1113 struct pm_gpio hap_clk_gpio_config = {
1114 .direction = PM_GPIO_DIR_OUT,
1115 .pull = PM_GPIO_PULL_NO,
1116 .out_strength = PM_GPIO_STRENGTH_HIGH,
1117 .function = PM_GPIO_FUNC_1,
1118 .inv_int_pol = 0,
1119 .vin_sel = PM_GPIO_VIN_S4,
1120 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1121 .output_value = 0,
1122 };
1123
1124 rc = pm8xxx_gpio_config(ISA1200_HAP_CLK, &hap_clk_gpio_config);
1125 if (rc) {
1126 pr_err("%s: pm8038 gpio %d config failed(%d)\n",
1127 __func__, ISA1200_HAP_CLK, rc);
1128 return rc;
1129 }
1130
1131 rc = gpio_request(ISA1200_HAP_CLK, "haptics_clk");
1132 if (rc) {
1133 pr_err("%s: gpio_request for %d gpio failed rc(%d)\n",
1134 __func__, ISA1200_HAP_CLK, rc);
1135 goto fail_gpio_req;
1136 }
1137
1138 rc = gpio_direction_output(ISA1200_HAP_CLK, 0);
1139 if (rc) {
1140 pr_err("%s: gpio_direction_output failed for %d gpio rc(%d)\n",
1141 __func__, ISA1200_HAP_CLK, rc);
1142 goto fail_gpio_dir;
1143 }
1144
1145 return 0;
1146
1147fail_gpio_dir:
1148 gpio_free(ISA1200_HAP_CLK);
1149fail_gpio_req:
1150 return rc;
1151
1152#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001153}
1154
1155static struct isa1200_regulator isa1200_reg_data[] = {
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301156#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001157 {
1158 .name = "vcc_i2c",
1159 .min_uV = ISA_I2C_VTG_MIN_UV,
1160 .max_uV = ISA_I2C_VTG_MAX_UV,
1161 .load_uA = ISA_I2C_CURR_UA,
1162 },
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301163#else
1164 {
1165 .name = "vddp",
1166 .min_uV = ISA_I2C_VTG_MIN_UV,
1167 .max_uV = ISA_I2C_VTG_MAX_UV,
1168 .load_uA = ISA_I2C_CURR_UA,
1169 },
1170#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001171};
1172
1173static struct isa1200_platform_data isa1200_1_pdata = {
1174 .name = "vibrator",
1175 .dev_setup = isa1200_dev_setup,
1176 .power_on = isa1200_power,
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301177#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001178 .hap_en_gpio = PM_HAP_EN_GPIO,
1179 .hap_len_gpio = PM_HAP_LEN_GPIO,
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301180#else
1181 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
1182 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
1183#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001184 .max_timeout = 15000,
1185 .mode_ctrl = PWM_GEN_MODE,
1186 .pwm_fd = {
1187 .pwm_div = 256,
1188 },
1189 .is_erm = false,
1190 .smart_en = true,
1191 .ext_clk_en = true,
1192 .chip_en = 1,
1193 .regulator_info = isa1200_reg_data,
1194 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1195};
1196
1197static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1198 {
1199 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1200 .platform_data = &isa1200_1_pdata,
1201 },
1202};
1203
1204#define CYTTSP_TS_GPIO_IRQ 11
1205#define CYTTSP_TS_SLEEP_GPIO 50
1206#define CYTTSP_TS_RESOUT_N_GPIO 52
1207
1208/*virtual key support */
1209static ssize_t tma340_vkeys_show(struct kobject *kobj,
1210 struct kobj_attribute *attr, char *buf)
1211{
1212 return snprintf(buf, 200,
1213 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1214 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1215 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1216 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1217 "\n");
1218}
1219
1220static struct kobj_attribute tma340_vkeys_attr = {
1221 .attr = {
1222 .mode = S_IRUGO,
1223 },
1224 .show = &tma340_vkeys_show,
1225};
1226
1227static struct attribute *tma340_properties_attrs[] = {
1228 &tma340_vkeys_attr.attr,
1229 NULL
1230};
1231
1232static struct attribute_group tma340_properties_attr_group = {
1233 .attrs = tma340_properties_attrs,
1234};
1235
1236
1237static int cyttsp_platform_init(struct i2c_client *client)
1238{
1239 int rc = 0;
1240 static struct kobject *tma340_properties_kobj;
1241
1242 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1243 tma340_properties_kobj = kobject_create_and_add("board_properties",
1244 NULL);
1245 if (tma340_properties_kobj)
1246 rc = sysfs_create_group(tma340_properties_kobj,
1247 &tma340_properties_attr_group);
1248 if (!tma340_properties_kobj || rc)
1249 pr_err("%s: failed to create board_properties\n",
1250 __func__);
1251
1252 return 0;
1253}
1254
1255static struct cyttsp_regulator regulator_data[] = {
1256 {
1257 .name = "vdd",
1258 .min_uV = CY_TMA300_VTG_MIN_UV,
1259 .max_uV = CY_TMA300_VTG_MAX_UV,
1260 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1261 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
1262 },
1263 /* TODO: Remove after runtime PM is enabled in I2C driver */
1264 {
1265 .name = "vcc_i2c",
1266 .min_uV = CY_I2C_VTG_MIN_UV,
1267 .max_uV = CY_I2C_VTG_MAX_UV,
1268 .hpm_load_uA = CY_I2C_CURR_UA,
1269 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
1270 },
1271};
1272
1273static struct cyttsp_platform_data cyttsp_pdata = {
1274 .panel_maxx = 634,
1275 .panel_maxy = 1166,
1276 .disp_maxx = 616,
1277 .disp_maxy = 1023,
1278 .disp_minx = 0,
1279 .disp_miny = 16,
1280 .flags = 0x01,
1281 .gen = CY_GEN3, /* or */
1282 .use_st = CY_USE_ST,
1283 .use_mt = CY_USE_MT,
1284 .use_hndshk = CY_SEND_HNDSHK,
1285 .use_trk_id = CY_USE_TRACKING_ID,
1286 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
1287 .use_gestures = CY_USE_GESTURES,
1288 .fw_fname = "cyttsp_8960_cdp.hex",
1289 /* activate up to 4 groups
1290 * and set active distance
1291 */
1292 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
1293 CY_GEST_GRP3 | CY_GEST_GRP4 |
1294 CY_ACT_DIST,
1295 /* change act_intrvl to customize the Active power state
1296 * scanning/processing refresh interval for Operating mode
1297 */
1298 .act_intrvl = CY_ACT_INTRVL_DFLT,
1299 /* change tch_tmout to customize the touch timeout for the
1300 * Active power state for Operating mode
1301 */
1302 .tch_tmout = CY_TCH_TMOUT_DFLT,
1303 /* change lp_intrvl to customize the Low Power power state
1304 * scanning/processing refresh interval for Operating mode
1305 */
1306 .lp_intrvl = CY_LP_INTRVL_DFLT,
1307 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
1308 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
1309 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1310 .regulator_info = regulator_data,
1311 .num_regulators = ARRAY_SIZE(regulator_data),
1312 .init = cyttsp_platform_init,
1313 .correct_fw_ver = 9,
1314};
1315
1316static struct i2c_board_info cyttsp_info[] __initdata = {
1317 {
1318 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1319 .platform_data = &cyttsp_pdata,
1320#ifndef CY_USE_TIMER
1321 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1322#endif /* CY_USE_TIMER */
1323 },
1324};
1325
Amy Malochef3c9db42011-12-08 15:17:35 -08001326#define MXT_TS_GPIO_IRQ 11
1327#define MXT_TS_RESET_GPIO 52
1328
1329static const u8 mxt_config_data_8930[] = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001330 /* T6 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001331 0, 0, 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001332 /* T38 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001333 15, 1, 0, 15, 12, 11, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001334 /* T7 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001335 48, 255, 25,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001336 /* T8 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001337 27, 0, 5, 1, 0, 0, 8, 8, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001338 /* T9 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001339 131, 0, 0, 19, 11, 0, 16, 35, 1, 3,
1340 10, 15, 1, 11, 4, 5, 40, 10, 54, 2,
1341 43, 4, 0, 0, 0, 0, 143, 40, 143, 80,
1342 18, 15, 50, 50, 2,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001343 /* T15 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001344 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1345 0,
1346 /* T18 Object */
1347 0, 0,
1348 /* T19 Object */
1349 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1350 0, 0, 0, 0, 0, 0,
1351 /* T23 Object */
1352 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1353 0, 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001354 /* T25 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001355 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1356 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001357 /* T40 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001358 0, 0, 0, 0, 0,
1359 /* T42 Object */
1360 0, 0, 0, 0, 0, 0, 0, 0,
1361 /* T46 Object */
1362 0, 3, 16, 48, 0, 0, 1, 0, 0,
1363 /* T47 Object */
1364 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1365 /* T48 Object */
1366 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1367 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1368 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1369 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1370 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1371 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001372};
1373
Amy Malochef3c9db42011-12-08 15:17:35 -08001374static ssize_t mxt224e_vkeys_show(struct kobject *kobj,
1375 struct kobj_attribute *attr, char *buf)
1376{
1377 return snprintf(buf, 200,
1378 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":65:938:90:90"
1379 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":208:938:90:90"
1380 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":348:938:90:90"
1381 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":490:938:90:90"
1382 "\n");
1383}
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001384
Amy Malochef3c9db42011-12-08 15:17:35 -08001385static struct kobj_attribute mxt224e_vkeys_attr = {
1386 .attr = {
1387 .mode = S_IRUGO,
1388 },
1389 .show = &mxt224e_vkeys_show,
1390};
1391
1392static struct attribute *mxt224e_properties_attrs[] = {
1393 &mxt224e_vkeys_attr.attr,
1394 NULL
1395};
1396
1397static struct attribute_group mxt224e_properties_attr_group = {
1398 .attrs = mxt224e_properties_attrs,
1399};
1400
1401static void mxt_init_vkeys_8930(void)
1402{
1403 int rc;
1404 static struct kobject *mxt224e_properties_kobj;
1405
1406 mxt224e_vkeys_attr.attr.name = "virtualkeys.atmel_mxt_ts";
1407 mxt224e_properties_kobj = kobject_create_and_add("board_properties",
1408 NULL);
1409 if (mxt224e_properties_kobj)
1410 rc = sysfs_create_group(mxt224e_properties_kobj,
1411 &mxt224e_properties_attr_group);
1412 if (!mxt224e_properties_kobj || rc)
1413 pr_err("%s: failed to create board_properties\n",
1414 __func__);
1415
1416 return;
1417}
1418
1419static struct mxt_platform_data mxt_platform_data_8930 = {
1420 .config = mxt_config_data_8930,
1421 .config_length = ARRAY_SIZE(mxt_config_data_8930),
1422 .x_size = 1067,
1423 .y_size = 566,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001424 .irqflags = IRQF_TRIGGER_FALLING,
Anirudh Ghayald7ad84c2012-01-09 09:17:53 +05301425#ifdef MSM8930_PHASE_2
1426 .digital_pwr_regulator = true,
1427#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001428 .i2c_pull_up = true,
Amy Malochef3c9db42011-12-08 15:17:35 -08001429 .reset_gpio = MXT_TS_RESET_GPIO,
1430 .irq_gpio = MXT_TS_GPIO_IRQ,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001431};
1432
Amy Malochef3c9db42011-12-08 15:17:35 -08001433static struct i2c_board_info mxt_device_info_8930[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001434 {
Amy Malochef3c9db42011-12-08 15:17:35 -08001435 I2C_BOARD_INFO("atmel_mxt_ts", 0x4a),
1436 .platform_data = &mxt_platform_data_8930,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001437 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1438 },
1439};
1440
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05301441#ifdef MSM8930_PHASE_2
1442
1443#define GPIO_VOLUME_UP PM8038_GPIO_PM_TO_SYS(3)
1444#define GPIO_VOLUME_DOWN PM8038_GPIO_PM_TO_SYS(8)
1445#define GPIO_CAMERA_SNAPSHOT PM8038_GPIO_PM_TO_SYS(10)
1446#define GPIO_CAMERA_FOCUS PM8038_GPIO_PM_TO_SYS(11)
1447
1448static struct gpio_keys_button keys_8930[] = {
1449 {
1450 .code = KEY_VOLUMEUP,
1451 .type = EV_KEY,
1452 .desc = "volume_up",
1453 .gpio = GPIO_VOLUME_UP,
1454 .wakeup = 1,
1455 .active_low = 1,
1456 },
1457 {
1458 .code = KEY_VOLUMEDOWN,
1459 .type = EV_KEY,
1460 .desc = "volume_down",
1461 .gpio = GPIO_VOLUME_DOWN,
1462 .wakeup = 1,
1463 .active_low = 1,
1464 },
1465 {
1466 .code = KEY_CAMERA_FOCUS,
1467 .type = EV_KEY,
1468 .desc = "camera_focus",
1469 .gpio = GPIO_CAMERA_FOCUS,
1470 .wakeup = 1,
1471 .active_low = 1,
1472 },
1473 {
1474 .code = KEY_CAMERA_SNAPSHOT,
1475 .type = EV_KEY,
1476 .desc = "camera_snapshot",
1477 .gpio = GPIO_CAMERA_SNAPSHOT,
1478 .wakeup = 1,
1479 .active_low = 1,
1480 },
1481};
1482
1483/* Add GPIO keys for 8930 */
1484static struct gpio_keys_platform_data gpio_keys_8930_pdata = {
1485 .buttons = keys_8930,
1486 .nbuttons = 4,
1487};
1488
1489static struct platform_device gpio_keys_8930 = {
1490 .name = "gpio-keys",
1491 .id = -1,
1492 .dev = {
1493 .platform_data = &gpio_keys_8930_pdata,
1494 },
1495};
1496#endif /* MSM8930_PHASE_2 */
1497
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001498static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
1499 .clk_freq = 100000,
1500 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001501};
1502
1503static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
1504 .clk_freq = 100000,
1505 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001506};
1507
1508static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
1509 .clk_freq = 100000,
1510 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001511};
1512
1513static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
1514 .clk_freq = 100000,
1515 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001516};
1517
1518static struct msm_rpm_platform_data msm_rpm_data = {
1519 .reg_base_addrs = {
1520 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
1521 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
1522 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
1523 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
1524 },
1525
1526 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
1527 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
1528 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1529 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
1530 .msm_apps_ipc_rpm_val = 4,
1531};
1532
1533static struct ks8851_pdata spi_eth_pdata = {
1534 .irq_gpio = KS8851_IRQ_GPIO,
1535 .rst_gpio = KS8851_RST_GPIO,
1536};
1537
1538static struct spi_board_info spi_board_info[] __initdata = {
1539 {
1540 .modalias = "ks8851",
1541 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1542 .max_speed_hz = 19200000,
1543 .bus_num = 0,
1544 .chip_select = 0,
1545 .mode = SPI_MODE_0,
1546 .platform_data = &spi_eth_pdata
1547 },
1548 {
1549 .modalias = "dsi_novatek_3d_panel_spi",
1550 .max_speed_hz = 10800000,
1551 .bus_num = 0,
1552 .chip_select = 1,
1553 .mode = SPI_MODE_0,
1554 },
1555};
1556
1557static struct platform_device msm_device_saw_core0 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001558 .name = "saw-regulator",
1559 .id = 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001560 .dev = {
David Collinsb4558422012-01-05 10:50:49 -08001561 .platform_data = &msm8930_saw_regulator_core0_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001562 },
1563};
1564
1565static struct platform_device msm_device_saw_core1 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001566 .name = "saw-regulator",
1567 .id = 1,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001568 .dev = {
David Collinsb4558422012-01-05 10:50:49 -08001569 .platform_data = &msm8930_saw_regulator_core1_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001570 },
1571};
1572
1573static struct tsens_platform_data msm_tsens_pdata = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001574 .slope = 910,
1575 .tsens_factor = 1000,
1576 .hw_type = MSM_8960,
1577 .tsens_num_sensor = 5,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001578};
1579
1580static struct platform_device msm_tsens_device = {
1581 .name = "tsens8960-tm",
1582 .id = -1,
1583 .dev = {
1584 .platform_data = &msm_tsens_pdata,
1585 },
1586};
1587
1588#ifdef CONFIG_MSM_FAKE_BATTERY
1589static struct platform_device fish_battery_device = {
1590 .name = "fish_battery",
1591};
1592#endif
1593
David Collins1d4061b2011-12-06 15:36:40 -08001594#ifndef MSM8930_PHASE_2
1595
1596/* 8930 Phase 1 */
Jay Chokshi06fa7542011-12-07 13:09:17 -08001597static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001598 .name = GPIO_REGULATOR_DEV_NAME,
1599 .id = PM8921_MPP_PM_TO_SYS(7),
1600 .dev = {
1601 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
1602 },
1603};
1604
Jay Chokshi06fa7542011-12-07 13:09:17 -08001605static struct platform_device msm8930_device_ext_l2_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001606 .name = GPIO_REGULATOR_DEV_NAME,
1607 .id = 91,
1608 .dev = {
1609 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
1610 },
1611};
1612
David Collins1d4061b2011-12-06 15:36:40 -08001613#else
1614
1615/* 8930 Phase 2 */
1616static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = {
1617 .name = GPIO_REGULATOR_DEV_NAME,
1618 .id = 63,
1619 .dev = {
1620 .platform_data =
1621 &msm8930_gpio_regulator_pdata[MSM8930_GPIO_VREG_ID_EXT_5V],
1622 },
1623};
1624
1625static struct platform_device msm8930_device_ext_otg_sw_vreg __devinitdata = {
1626 .name = GPIO_REGULATOR_DEV_NAME,
1627 .id = 97,
1628 .dev = {
1629 .platform_data =
1630 &msm8930_gpio_regulator_pdata[MSM8930_GPIO_VREG_ID_EXT_OTG_SW],
1631 },
1632};
1633
1634#endif
1635
Jay Chokshi06fa7542011-12-07 13:09:17 -08001636static struct platform_device msm8930_device_rpm_regulator __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001637 .name = "rpm-regulator",
1638 .id = -1,
1639 .dev = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001640 /*
1641 * TODO: When physical 8930/PM8038 hardware becomes
1642 * available, replace msm_rpm_regulator_pdata
1643 * with 8930 rpm regulator object.
1644 */
1645#if !defined(MSM8930_PHASE_2)
1646
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001647 .platform_data = &msm_rpm_regulator_pdata,
Jay Chokshi06fa7542011-12-07 13:09:17 -08001648#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001649 },
1650};
1651
1652static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
1653 .phys_addr_base = 0x0010C000,
1654 .reg_offsets = {
1655 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
1656 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
1657 },
1658 .phys_size = SZ_8K,
1659 .log_len = 4096, /* log's buffer length in bytes */
1660 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
1661};
1662
1663static struct platform_device msm_rpm_log_device = {
1664 .name = "msm_rpm_log",
1665 .id = -1,
1666 .dev = {
1667 .platform_data = &msm_rpm_log_pdata,
1668 },
1669};
1670
1671static struct platform_device *common_devices[] __initdata = {
1672 &msm8960_device_dmov,
1673 &msm_device_smd,
1674 &msm8960_device_uart_gsbi5,
1675 &msm_device_uart_dm6,
1676 &msm_device_saw_core0,
1677 &msm_device_saw_core1,
Jay Chokshi06fa7542011-12-07 13:09:17 -08001678 &msm8930_device_ext_5v_vreg,
David Collins1d4061b2011-12-06 15:36:40 -08001679#ifndef MSM8930_PHASE_2
Jay Chokshi06fa7542011-12-07 13:09:17 -08001680 &msm8930_device_ext_l2_vreg,
David Collins1d4061b2011-12-06 15:36:40 -08001681#endif
Jay Chokshi33c044a2011-12-07 13:05:40 -08001682 &msm8960_device_ssbi_pmic,
David Collins1d4061b2011-12-06 15:36:40 -08001683#ifdef MSM8930_PHASE_2
1684 &msm8930_device_ext_otg_sw_vreg,
1685#endif
Stephen Boyd28d54952011-12-16 13:19:51 -08001686 &msm_8960_q6_lpass,
1687 &msm_8960_q6_mss_fw,
1688 &msm_8960_q6_mss_sw,
Stephen Boyd322a9922011-09-20 01:05:54 -07001689 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07001690 &msm_pil_tzapps,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001691 &msm8960_device_qup_spi_gsbi1,
1692 &msm8960_device_qup_i2c_gsbi3,
1693 &msm8960_device_qup_i2c_gsbi4,
1694 &msm8960_device_qup_i2c_gsbi10,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001695 &msm8960_device_qup_i2c_gsbi12,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001696 &msm_slim_ctrl,
1697 &msm_device_wcnss_wlan,
1698#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1699 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1700 &qcrypto_device,
1701#endif
1702
1703#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1704 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1705 &qcedev_device,
1706#endif
1707#ifdef CONFIG_MSM_ROTATOR
1708 &msm_rotator_device,
1709#endif
1710 &msm_device_sps,
1711#ifdef CONFIG_MSM_FAKE_BATTERY
1712 &fish_battery_device,
1713#endif
1714#ifdef CONFIG_ANDROID_PMEM
1715#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
1716 &android_pmem_device,
1717 &android_pmem_adsp_device,
1718#endif
1719 &android_pmem_audio_device,
1720#endif
1721 &msm_device_vidc,
1722 &msm_device_bam_dmux,
1723 &msm_fm_platform_init,
1724
1725#ifdef CONFIG_HW_RANDOM_MSM
1726 &msm_device_rng,
1727#endif
1728 &msm_rpm_device,
1729#ifdef CONFIG_ION_MSM
1730 &ion_dev,
1731#endif
1732 &msm_rpm_log_device,
1733 &msm_rpm_stat_device,
1734 &msm_device_tz_log,
1735
1736#ifdef CONFIG_MSM_QDSS
1737 &msm_etb_device,
1738 &msm_tpiu_device,
1739 &msm_funnel_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001740 &msm_ptm_device,
1741#endif
1742 &msm_device_dspcrashd_8960,
1743 &msm8960_device_watchdog,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05301744#ifdef MSM8930_PHASE_2
1745 &gpio_keys_8930,
1746#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001747};
1748
1749static struct platform_device *cdp_devices[] __initdata = {
1750 &msm8960_device_otg,
1751 &msm8960_device_gadget_peripheral,
1752 &msm_device_hsusb_host,
1753 &android_usb_device,
1754 &msm_pcm,
1755 &msm_pcm_routing,
1756 &msm_cpudai0,
1757 &msm_cpudai1,
1758 &msm_cpudai_hdmi_rx,
1759 &msm_cpudai_bt_rx,
1760 &msm_cpudai_bt_tx,
1761 &msm_cpudai_fm_rx,
1762 &msm_cpudai_fm_tx,
1763 &msm_cpudai_auxpcm_rx,
1764 &msm_cpudai_auxpcm_tx,
1765 &msm_cpu_fe,
1766 &msm_stub_codec,
1767 &msm_kgsl_3d0,
1768#ifdef CONFIG_MSM_KGSL_2D
1769 &msm_kgsl_2d0,
1770 &msm_kgsl_2d1,
1771#endif
1772#ifdef CONFIG_MSM_GEMINI
1773 &msm8960_gemini_device,
1774#endif
1775 &msm_voice,
1776 &msm_voip,
1777 &msm_lpa_pcm,
1778 &msm_cpudai_afe_01_rx,
1779 &msm_cpudai_afe_01_tx,
1780 &msm_cpudai_afe_02_rx,
1781 &msm_cpudai_afe_02_tx,
1782 &msm_pcm_afe,
Ajay Dudani79e268c2011-12-28 13:14:44 -08001783 &msm_compr_dsp,
1784 &msm_cpudai_incall_music_rx,
1785 &msm_cpudai_incall_record_rx,
1786 &msm_cpudai_incall_record_tx,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001787 &msm_pcm_hostless,
1788 &msm_bus_apps_fabric,
1789 &msm_bus_sys_fabric,
1790 &msm_bus_mm_fabric,
1791 &msm_bus_sys_fpb,
1792 &msm_bus_cpss_fpb,
1793 &msm_tsens_device,
1794};
1795
1796static void __init msm8930_i2c_init(void)
1797{
1798 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
1799 &msm8960_i2c_qup_gsbi4_pdata;
1800
1801 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
1802 &msm8960_i2c_qup_gsbi3_pdata;
1803
1804 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
1805 &msm8960_i2c_qup_gsbi10_pdata;
1806
1807 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
1808 &msm8960_i2c_qup_gsbi12_pdata;
1809}
1810
1811static void __init msm8930_gfx_init(void)
1812{
1813 uint32_t soc_platform_version = socinfo_get_version();
1814 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
1815 struct kgsl_device_platform_data *kgsl_3d0_pdata =
1816 msm_kgsl_3d0.dev.platform_data;
1817 kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
1818 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
1819 }
1820}
1821
1822static struct msm_cpuidle_state msm_cstates[] __initdata = {
1823 {0, 0, "C0", "WFI",
1824 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1825
1826 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1827 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1828
1829 {0, 2, "C2", "POWER_COLLAPSE",
1830 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
1831
1832 {1, 0, "C0", "WFI",
1833 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1834
1835 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1836 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1837};
1838
1839static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
1840 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1841 .idle_supported = 1,
1842 .suspend_supported = 1,
1843 .idle_enabled = 0,
1844 .suspend_enabled = 0,
1845 },
1846
1847 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1848 .idle_supported = 1,
1849 .suspend_supported = 1,
1850 .idle_enabled = 0,
1851 .suspend_enabled = 0,
1852 },
1853
1854 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1855 .idle_supported = 1,
1856 .suspend_supported = 1,
1857 .idle_enabled = 1,
1858 .suspend_enabled = 1,
1859 },
1860
1861 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1862 .idle_supported = 0,
1863 .suspend_supported = 1,
1864 .idle_enabled = 0,
1865 .suspend_enabled = 0,
1866 },
1867
1868 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1869 .idle_supported = 1,
1870 .suspend_supported = 1,
1871 .idle_enabled = 0,
1872 .suspend_enabled = 0,
1873 },
1874
1875 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1876 .idle_supported = 1,
1877 .suspend_supported = 0,
1878 .idle_enabled = 1,
1879 .suspend_enabled = 0,
1880 },
1881};
1882
1883static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
1884 {
1885 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1886 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1887 true,
1888 100, 8000, 100000, 1,
1889 },
1890
1891 {
1892 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1893 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1894 true,
1895 2000, 6000, 60100000, 3000,
1896 },
1897
1898 {
1899 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1900 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1901 false,
1902 4200, 5000, 60350000, 3500,
1903 },
1904
1905 {
1906 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1907 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
1908 false,
1909 6300, 4500, 65350000, 4800,
1910 },
1911 {
1912 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1913 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
1914 false,
1915 7000, 3500, 66600000, 5150,
1916 },
1917
1918 {
1919 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1920 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1921 false,
1922 11700, 2500, 67850000, 5500,
1923 },
1924
1925 {
1926 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1927 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1928 false,
1929 13800, 2000, 71850000, 6800,
1930 },
1931
1932 {
1933 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1934 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1935 false,
1936 29700, 500, 75850000, 8800,
1937 },
1938
1939 {
1940 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1941 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1942 false,
1943 29700, 0, 76350000, 9800,
1944 },
1945};
1946
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06001947static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1948 .mode = MSM_PM_BOOT_CONFIG_TZ,
1949};
1950
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001951#ifdef CONFIG_I2C
1952#define I2C_SURF 1
1953#define I2C_FFA (1 << 1)
1954#define I2C_RUMI (1 << 2)
1955#define I2C_SIM (1 << 3)
1956#define I2C_FLUID (1 << 4)
1957#define I2C_LIQUID (1 << 5)
1958
1959struct i2c_registry {
1960 u8 machs;
1961 int bus;
1962 struct i2c_board_info *info;
1963 int len;
1964};
1965
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001966static void __init msm8930_init_hsic(void)
1967{
1968#ifdef CONFIG_USB_EHCI_MSM_HSIC
1969 uint32_t version = socinfo_get_version();
1970
1971 pr_info("%s: version:%d mtp:%d\n", __func__,
1972 SOCINFO_VERSION_MAJOR(version),
1973 machine_is_msm8930_mtp());
1974
1975 if ((SOCINFO_VERSION_MAJOR(version) == 1) ||
1976 machine_is_msm8930_mtp() ||
1977 machine_is_msm8930_fluid())
1978 return;
1979
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001980 platform_device_register(&msm_device_hsic_host);
1981#endif
1982}
1983
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001984#ifdef CONFIG_ISL9519_CHARGER
1985static struct isl_platform_data isl_data __initdata = {
1986 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
1987 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
1988 .max_system_voltage = 4200,
1989 .min_system_voltage = 3200,
1990 .chgcurrent = 1000, /* 1900, */
1991 .term_current = 400, /* Need fine tuning */
1992 .input_current = 2048,
1993};
1994
1995static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
1996 {
1997 I2C_BOARD_INFO("isl9519q", 0x9),
1998 .irq = 0, /* Not required when notify-by-pmic */
1999 .platform_data = &isl_data,
2000 },
2001};
2002#endif /* CONFIG_ISL9519_CHARGER */
2003
2004static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002005#ifdef CONFIG_ISL9519_CHARGER
2006 {
2007 I2C_LIQUID,
2008 MSM_8930_GSBI10_QUP_I2C_BUS_ID,
2009 isl_charger_i2c_info,
2010 ARRAY_SIZE(isl_charger_i2c_info),
2011 },
2012#endif /* CONFIG_ISL9519_CHARGER */
2013 {
2014 I2C_SURF | I2C_FFA | I2C_FLUID,
2015 MSM_8930_GSBI3_QUP_I2C_BUS_ID,
2016 cyttsp_info,
2017 ARRAY_SIZE(cyttsp_info),
2018 },
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05302019#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002020 {
2021 I2C_LIQUID,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002022 MSM_8930_GSBI10_QUP_I2C_BUS_ID,
2023 msm_isa1200_board_info,
2024 ARRAY_SIZE(msm_isa1200_board_info),
2025 },
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05302026#else
2027 {
2028 I2C_FFA | I2C_FLUID,
2029 MSM_8930_GSBI10_QUP_I2C_BUS_ID,
2030 msm_isa1200_board_info,
2031 ARRAY_SIZE(msm_isa1200_board_info),
2032 },
2033#endif
Amy Malochef3c9db42011-12-08 15:17:35 -08002034 {
2035 I2C_SURF,
2036 MSM_8930_GSBI3_QUP_I2C_BUS_ID,
2037 mxt_device_info_8930,
2038 ARRAY_SIZE(mxt_device_info_8930),
2039 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002040};
2041#endif /* CONFIG_I2C */
2042
2043static void __init register_i2c_devices(void)
2044{
2045#ifdef CONFIG_I2C
2046 u8 mach_mask = 0;
2047 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08002048#ifdef CONFIG_MSM_CAMERA
2049 struct i2c_registry msm8930_camera_i2c_devices = {
2050 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
2051 MSM_8930_GSBI4_QUP_I2C_BUS_ID,
2052 msm8930_camera_board_info.board_info,
2053 msm8930_camera_board_info.num_i2c_board_info,
2054 };
2055#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002056
2057 /* Build the matching 'supported_machs' bitmask */
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002058 if (machine_is_msm8930_cdp() || machine_is_msm8627_cdp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002059 mach_mask = I2C_SURF;
2060 else if (machine_is_msm8930_fluid())
2061 mach_mask = I2C_FLUID;
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002062 else if (machine_is_msm8930_mtp() || machine_is_msm8627_mtp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002063 mach_mask = I2C_FFA;
2064 else
2065 pr_err("unmatched machine ID in register_i2c_devices\n");
2066
2067 /* Run the array and install devices as appropriate */
2068 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
2069 if (msm8960_i2c_devices[i].machs & mach_mask)
2070 i2c_register_board_info(msm8960_i2c_devices[i].bus,
2071 msm8960_i2c_devices[i].info,
2072 msm8960_i2c_devices[i].len);
2073 }
Kevin Chan09f4e662011-12-16 08:17:02 -08002074#ifdef CONFIG_MSM_CAMERA
2075 if (msm8930_camera_i2c_devices.machs & mach_mask)
2076 i2c_register_board_info(msm8930_camera_i2c_devices.bus,
2077 msm8930_camera_i2c_devices.info,
2078 msm8930_camera_i2c_devices.len);
2079#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002080#endif
2081}
2082
2083static void __init msm8930_cdp_init(void)
2084{
2085 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2086 pr_err("meminfo_init() failed!\n");
2087
2088 BUG_ON(msm_rpm_init(&msm_rpm_data));
2089 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
2090 ARRAY_SIZE(msm_rpmrs_levels)));
2091
2092 regulator_suppress_info_printing();
2093 if (msm_xo_init())
2094 pr_err("Failed to initialize XO votes\n");
Jay Chokshi06fa7542011-12-07 13:09:17 -08002095 platform_device_register(&msm8930_device_rpm_regulator);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002096 msm_clock_init(&msm8960_clock_init_data);
2097 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
2098 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002099 msm8930_init_gpiomux();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002100 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2101 &msm8960_qup_spi_gsbi1_pdata;
2102 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2103
Jay Chokshi06fa7542011-12-07 13:09:17 -08002104 /*
2105 * TODO: When physical 8930/PM8038 hardware becomes
2106 * available, remove this block or add the config
2107 * option.
2108 */
2109#ifndef MSM8930_PHASE_2
2110 msm8960_init_pmic();
2111#else
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002112 msm8930_init_pmic();
Jay Chokshi06fa7542011-12-07 13:09:17 -08002113#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002114 msm8930_i2c_init();
2115 msm8930_gfx_init();
2116 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2117 msm_spm_l2_init(msm_spm_l2_data);
2118 msm8930_init_buses();
2119 platform_add_devices(msm_footswitch_devices,
2120 msm_num_footswitch_devices);
2121 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Jay Chokshi06fa7542011-12-07 13:09:17 -08002122 /*
2123 * TODO: When physical 8930/PM8038 hardware becomes
2124 * available, remove this block or add the config
2125 * option.
2126 */
2127#ifndef MSM8930_PHASE_2
2128 msm8960_pm8921_gpio_mpp_init();
2129#else
2130 msm8930_pm8038_gpio_mpp_init();
2131#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002132 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
2133 msm8930_init_hsic();
2134 msm8930_init_cam();
2135 msm8930_init_mmc();
Tianyi Gou7c6b81f2011-12-07 23:09:08 -08002136 acpuclk_init(&acpuclk_8930_soc_data);
Amy Malochef3c9db42011-12-08 15:17:35 -08002137 if (machine_is_msm8930_cdp() || machine_is_msm8627_cdp())
2138 mxt_init_vkeys_8930();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002139 register_i2c_devices();
2140 msm8930_init_fb();
2141 slim_register_board_info(msm_slim_devices,
2142 ARRAY_SIZE(msm_slim_devices));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002143 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2144 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2145 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2146 msm_pm_data);
2147 change_memory_power = &msm8930_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002148 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002149
2150 if (PLATFORM_IS_CHARM25())
2151 platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices));
2152}
2153
2154MACHINE_START(MSM8930_CDP, "QCT MSM8930 CDP")
2155 .map_io = msm8930_map_io,
2156 .reserve = msm8930_reserve,
2157 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302158 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002159 .timer = &msm_timer,
2160 .init_machine = msm8930_cdp_init,
2161 .init_early = msm8930_allocate_memory_regions,
2162 .init_very_early = msm8930_early_memory,
2163MACHINE_END
2164
2165MACHINE_START(MSM8930_MTP, "QCT MSM8930 MTP")
2166 .map_io = msm8930_map_io,
2167 .reserve = msm8930_reserve,
2168 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302169 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002170 .timer = &msm_timer,
2171 .init_machine = msm8930_cdp_init,
2172 .init_early = msm8930_allocate_memory_regions,
2173 .init_very_early = msm8930_early_memory,
2174MACHINE_END
2175
2176MACHINE_START(MSM8930_FLUID, "QCT MSM8930 FLUID")
2177 .map_io = msm8930_map_io,
2178 .reserve = msm8930_reserve,
2179 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302180 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002181 .timer = &msm_timer,
2182 .init_machine = msm8930_cdp_init,
2183 .init_early = msm8930_allocate_memory_regions,
2184 .init_very_early = msm8930_early_memory,
2185MACHINE_END
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002186
2187MACHINE_START(MSM8627_CDP, "QCT MSM8627 CDP")
2188 .map_io = msm8930_map_io,
2189 .reserve = msm8930_reserve,
2190 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302191 .handle_irq = gic_handle_irq,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002192 .timer = &msm_timer,
2193 .init_machine = msm8930_cdp_init,
2194 .init_early = msm8930_allocate_memory_regions,
2195 .init_very_early = msm8930_early_memory,
2196MACHINE_END
2197
2198MACHINE_START(MSM8627_MTP, "QCT MSM8627 MTP")
2199 .map_io = msm8930_map_io,
2200 .reserve = msm8930_reserve,
2201 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302202 .handle_irq = gic_handle_irq,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002203 .timer = &msm_timer,
2204 .init_machine = msm8930_cdp_init,
2205 .init_early = msm8930_allocate_memory_regions,
2206 .init_very_early = msm8930_early_memory,
2207MACHINE_END