blob: 620716a0b636b91c4e5e123cf2984968d56a8dd7 [file] [log] [blame]
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
2 *
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>
43
44#include <asm/mach-types.h>
45#include <asm/mach/arch.h>
46#include <asm/setup.h>
47#include <asm/hardware/gic.h>
48#include <asm/mach/mmc.h>
49
50#include <mach/board.h>
51#include <mach/msm_iomap.h>
52#include <mach/msm_spi.h>
53#ifdef CONFIG_USB_MSM_OTG_72K
54#include <mach/msm_hsusb.h>
55#else
56#include <linux/usb/msm_hsusb.h>
57#endif
58#include <linux/usb/android.h>
59#include <mach/usbdiag.h>
60#include <mach/socinfo.h>
61#include <mach/rpm.h>
62#include <mach/gpio.h>
63#include <mach/gpiomux.h>
64#include <mach/msm_bus_board.h>
65#include <mach/msm_memtypes.h>
66#include <mach/dma.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080067#include <mach/msm_xo.h>
68#include <mach/restart.h>
69
70#ifdef CONFIG_WCD9310_CODEC
71#include <linux/slimbus/slimbus.h>
72#include <linux/mfd/wcd9310/core.h>
73#include <linux/mfd/wcd9310/pdata.h>
74#endif
75
76#include <linux/ion.h>
77#include <mach/ion.h>
78#include <mach/mdm2.h>
79
80#include "timer.h"
81#include "devices.h"
82#include "devices-msm8x60.h"
83#include "spm.h"
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080084#include "pm.h"
85#include "cpuidle.h"
86#include "rpm_resources.h"
87#include "mpm.h"
88#include "acpuclock.h"
89#include "rpm_log.h"
90#include "smd_private.h"
91#include "pm-boot.h"
92#include "msm_watchdog.h"
Jay Chokshi06fa7542011-12-07 13:09:17 -080093#include "board-8930.h"
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080094
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080095static struct platform_device msm_fm_platform_init = {
96 .name = "iris_fm",
97 .id = -1,
98};
99
100#define KS8851_RST_GPIO 89
101#define KS8851_IRQ_GPIO 90
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800102#define HAP_SHIFT_LVL_OE_GPIO 47
103
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800104#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
105
106struct sx150x_platform_data msm8930_sx150x_data[] = {
107 [SX150X_CAM] = {
108 .gpio_base = GPIO_CAM_EXPANDER_BASE,
109 .oscio_is_gpo = false,
110 .io_pullup_ena = 0x0,
111 .io_pulldn_ena = 0xc0,
112 .io_open_drain_ena = 0x0,
113 .irq_summary = -1,
114 },
115};
116
117#endif
118
119#define MSM_PMEM_ADSP_SIZE 0x3800000
Ben Romberger3ffcd812011-12-08 19:12:10 -0800120#define MSM_PMEM_AUDIO_SIZE 0x2B4000
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800121#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
122#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
123#else
124#define MSM_PMEM_SIZE 0x1C00000 /* 28 Mbytes */
125#endif
126
127
128#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
129#define MSM_PMEM_KERNEL_EBI1_SIZE 0xB0C000
130#define MSM_ION_EBI_SIZE (MSM_PMEM_SIZE + 0x600000)
131#define MSM_ION_ADSP_SIZE MSM_PMEM_ADSP_SIZE
132#define MSM_ION_HEAP_NUM 4
133#else
134#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
135#define MSM_ION_HEAP_NUM 2
136#endif
137
138#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
139static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
140static int __init pmem_kernel_ebi1_size_setup(char *p)
141{
142 pmem_kernel_ebi1_size = memparse(p, NULL);
143 return 0;
144}
145early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
146#endif
147
148#ifdef CONFIG_ANDROID_PMEM
149static unsigned pmem_size = MSM_PMEM_SIZE;
150static int __init pmem_size_setup(char *p)
151{
152 pmem_size = memparse(p, NULL);
153 return 0;
154}
155early_param("pmem_size", pmem_size_setup);
156
157static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
158
159static int __init pmem_adsp_size_setup(char *p)
160{
161 pmem_adsp_size = memparse(p, NULL);
162 return 0;
163}
164early_param("pmem_adsp_size", pmem_adsp_size_setup);
165
166static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
167
168static int __init pmem_audio_size_setup(char *p)
169{
170 pmem_audio_size = memparse(p, NULL);
171 return 0;
172}
173early_param("pmem_audio_size", pmem_audio_size_setup);
174#endif
175
176#ifdef CONFIG_ANDROID_PMEM
177#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
178static struct android_pmem_platform_data android_pmem_pdata = {
179 .name = "pmem",
180 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
181 .cached = 1,
182 .memory_type = MEMTYPE_EBI1,
183};
184
185static struct platform_device android_pmem_device = {
186 .name = "android_pmem",
187 .id = 0,
188 .dev = {.platform_data = &android_pmem_pdata},
189};
190
191static struct android_pmem_platform_data android_pmem_adsp_pdata = {
192 .name = "pmem_adsp",
193 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
194 .cached = 0,
195 .memory_type = MEMTYPE_EBI1,
196};
197static struct platform_device android_pmem_adsp_device = {
198 .name = "android_pmem",
199 .id = 2,
200 .dev = { .platform_data = &android_pmem_adsp_pdata },
201};
202#endif
203
204static struct android_pmem_platform_data android_pmem_audio_pdata = {
205 .name = "pmem_audio",
206 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
207 .cached = 0,
208 .memory_type = MEMTYPE_EBI1,
209};
210
211static struct platform_device android_pmem_audio_device = {
212 .name = "android_pmem",
213 .id = 4,
214 .dev = { .platform_data = &android_pmem_audio_pdata },
215};
216#endif
217
218#define DSP_RAM_BASE_8960 0x8da00000
219#define DSP_RAM_SIZE_8960 0x1800000
220static int dspcrashd_pdata_8960 = 0xDEADDEAD;
221
222static struct resource resources_dspcrashd_8960[] = {
223 {
224 .name = "msm_dspcrashd",
225 .start = DSP_RAM_BASE_8960,
226 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
227 .flags = IORESOURCE_DMA,
228 },
229};
230
231static struct platform_device msm_device_dspcrashd_8960 = {
232 .name = "msm_dspcrashd",
233 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
234 .resource = resources_dspcrashd_8960,
235 .dev = { .platform_data = &dspcrashd_pdata_8960 },
236};
237
238static struct memtype_reserve msm8930_reserve_table[] __initdata = {
239 [MEMTYPE_SMI] = {
240 },
241 [MEMTYPE_EBI0] = {
242 .flags = MEMTYPE_FLAGS_1M_ALIGN,
243 },
244 [MEMTYPE_EBI1] = {
245 .flags = MEMTYPE_FLAGS_1M_ALIGN,
246 },
247};
248
249static void __init size_pmem_devices(void)
250{
251#ifdef CONFIG_ANDROID_PMEM
252#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
253 android_pmem_adsp_pdata.size = pmem_adsp_size;
254 android_pmem_pdata.size = pmem_size;
255#endif
256 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
257#endif
258}
259
260static void __init reserve_memory_for(struct android_pmem_platform_data *p)
261{
262 msm8930_reserve_table[p->memory_type].size += p->size;
263}
264
265static void __init reserve_pmem_memory(void)
266{
267#ifdef CONFIG_ANDROID_PMEM
268#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
269 reserve_memory_for(&android_pmem_adsp_pdata);
270 reserve_memory_for(&android_pmem_pdata);
271#endif
272 reserve_memory_for(&android_pmem_audio_pdata);
273 msm8930_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
274#endif
275}
276
277static int msm8930_paddr_to_memtype(unsigned int paddr)
278{
279 return MEMTYPE_EBI1;
280}
281
282#ifdef CONFIG_ION_MSM
283static struct ion_platform_data ion_pdata = {
284 .nr = MSM_ION_HEAP_NUM,
285 .heaps = {
286 {
287 .id = ION_HEAP_SYSTEM_ID,
288 .type = ION_HEAP_TYPE_SYSTEM,
289 .name = ION_KMALLOC_HEAP_NAME,
290 },
291 {
292 .id = ION_HEAP_SYSTEM_CONTIG_ID,
293 .type = ION_HEAP_TYPE_SYSTEM_CONTIG,
294 .name = ION_VMALLOC_HEAP_NAME,
295 },
296#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
297 {
298 .id = ION_HEAP_EBI_ID,
299 .type = ION_HEAP_TYPE_CARVEOUT,
300 .name = ION_EBI1_HEAP_NAME,
301 .size = MSM_ION_EBI_SIZE,
302 .memory_type = ION_EBI_TYPE,
303 },
304 {
305 .id = ION_HEAP_ADSP_ID,
306 .type = ION_HEAP_TYPE_CARVEOUT,
307 .name = ION_ADSP_HEAP_NAME,
308 .size = MSM_ION_ADSP_SIZE,
309 .memory_type = ION_EBI_TYPE,
310 },
311#endif
312 }
313};
314
315static struct platform_device ion_dev = {
316 .name = "ion-msm",
317 .id = 1,
318 .dev = { .platform_data = &ion_pdata },
319};
320#endif
321
322static void reserve_ion_memory(void)
323{
324#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
325 msm8930_reserve_table[MEMTYPE_EBI1].size += MSM_ION_EBI_SIZE;
326 msm8930_reserve_table[MEMTYPE_EBI1].size += MSM_ION_ADSP_SIZE;
327#endif
328}
329static void __init msm8930_calculate_reserve_sizes(void)
330{
331 size_pmem_devices();
332 reserve_pmem_memory();
333 reserve_ion_memory();
334}
335
336static struct reserve_info msm8930_reserve_info __initdata = {
337 .memtype_reserve_table = msm8930_reserve_table,
338 .calculate_reserve_sizes = msm8930_calculate_reserve_sizes,
339 .paddr_to_memtype = msm8930_paddr_to_memtype,
340};
341
342static int msm8930_memory_bank_size(void)
343{
344 return 1<<29;
345}
346
347static void __init locate_unstable_memory(void)
348{
349 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
350 unsigned long bank_size;
351 unsigned long low, high;
352
353 bank_size = msm8930_memory_bank_size();
354 low = meminfo.bank[0].start;
355 high = mb->start + mb->size;
356
357 /* Check if 32 bit overflow occured */
358 if (high < mb->start)
359 high = ~0UL;
360
361 low &= ~(bank_size - 1);
362
363 if (high - low <= bank_size)
364 return;
365 msm8930_reserve_info.low_unstable_address = low + bank_size;
366 /* To avoid overflow of u32 compute max_unstable_size
367 * by first subtracting low from mb->start)
368 * */
369 msm8930_reserve_info.max_unstable_size = (mb->start - low) +
370 mb->size - bank_size;
371
372 msm8930_reserve_info.bank_size = bank_size;
373 pr_info("low unstable address %lx max size %lx bank size %lx\n",
374 msm8930_reserve_info.low_unstable_address,
375 msm8930_reserve_info.max_unstable_size,
376 msm8930_reserve_info.bank_size);
377}
378
379static void __init place_movable_zone(void)
380{
381 movable_reserved_start = msm8930_reserve_info.low_unstable_address;
382 movable_reserved_size = msm8930_reserve_info.max_unstable_size;
383 pr_info("movable zone start %lx size %lx\n",
384 movable_reserved_start, movable_reserved_size);
385}
386
387static void __init msm8930_early_memory(void)
388{
389 reserve_info = &msm8930_reserve_info;
390 locate_unstable_memory();
391 place_movable_zone();
392}
393
394static void __init msm8930_reserve(void)
395{
396 msm_reserve();
397}
398
399static int msm8930_change_memory_power(u64 start, u64 size,
400 int change_type)
401{
402 return soc_change_memory_power(start, size, change_type);
403}
404
405static void __init msm8930_allocate_memory_regions(void)
406{
407 msm8930_allocate_fb_region();
408}
409
410#ifdef CONFIG_WCD9310_CODEC
411
412#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
413
414/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
415 * 4 micbiases are used to power various analog and digital
416 * microphones operating at 1800 mV. Technically, all micbiases
417 * can source from single cfilter since all microphones operate
418 * at the same voltage level. The arrangement below is to make
419 * sure all cfilters are exercised. LDO_H regulator ouput level
420 * does not need to be as high as 2.85V. It is choosen for
421 * microphone sensitivity purpose.
422 */
423static struct tabla_pdata tabla_platform_data = {
424 .slimbus_slave_device = {
425 .name = "tabla-slave",
426 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
427 },
428 .irq = MSM_GPIO_TO_INT(62),
429 .irq_base = TABLA_INTERRUPT_BASE,
430 .num_irqs = NR_TABLA_IRQS,
Jay Chokshi06fa7542011-12-07 13:09:17 -0800431
432/*TODO: Replace this with right PM8038 gpio */
433#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800434 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Jay Chokshi06fa7542011-12-07 13:09:17 -0800435#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800436 .micbias = {
437 .ldoh_v = TABLA_LDOH_2P85_V,
438 .cfilt1_mv = 1800,
439 .cfilt2_mv = 1800,
440 .cfilt3_mv = 1800,
441 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
442 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
443 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
444 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
445 }
446};
447
448static struct slim_device msm_slim_tabla = {
449 .name = "tabla-slim",
450 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
451 .dev = {
452 .platform_data = &tabla_platform_data,
453 },
454};
455
456static struct tabla_pdata tabla20_platform_data = {
457 .slimbus_slave_device = {
458 .name = "tabla-slave",
459 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
460 },
461 .irq = MSM_GPIO_TO_INT(62),
462 .irq_base = TABLA_INTERRUPT_BASE,
463 .num_irqs = NR_TABLA_IRQS,
Jay Chokshi06fa7542011-12-07 13:09:17 -0800464
465/*TODO: Replace this with right PM8038 gpio */
466#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800467 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Jay Chokshi06fa7542011-12-07 13:09:17 -0800468#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800469 .micbias = {
470 .ldoh_v = TABLA_LDOH_2P85_V,
471 .cfilt1_mv = 1800,
472 .cfilt2_mv = 1800,
473 .cfilt3_mv = 1800,
474 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
475 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
476 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
477 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
478 }
479};
480
481static struct slim_device msm_slim_tabla20 = {
482 .name = "tabla2x-slim",
483 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
484 .dev = {
485 .platform_data = &tabla20_platform_data,
486 },
487};
488#endif
489
490static struct slim_boardinfo msm_slim_devices[] = {
491#ifdef CONFIG_WCD9310_CODEC
492 {
493 .bus_num = 1,
494 .slim_slave = &msm_slim_tabla,
495 },
496 {
497 .bus_num = 1,
498 .slim_slave = &msm_slim_tabla20,
499 },
500#endif
501 /* add more slimbus slaves as needed */
502};
503
504#define MSM_WCNSS_PHYS 0x03000000
505#define MSM_WCNSS_SIZE 0x280000
506
507static struct resource resources_wcnss_wlan[] = {
508 {
509 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
510 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
511 .name = "wcnss_wlanrx_irq",
512 .flags = IORESOURCE_IRQ,
513 },
514 {
515 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
516 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
517 .name = "wcnss_wlantx_irq",
518 .flags = IORESOURCE_IRQ,
519 },
520 {
521 .start = MSM_WCNSS_PHYS,
522 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
523 .name = "wcnss_mmio",
524 .flags = IORESOURCE_MEM,
525 },
526 {
527 .start = 84,
528 .end = 88,
529 .name = "wcnss_gpios_5wire",
530 .flags = IORESOURCE_IO,
531 },
532};
533
534static struct qcom_wcnss_opts qcom_wcnss_pdata = {
535 .has_48mhz_xo = 1,
536};
537
538static struct platform_device msm_device_wcnss_wlan = {
539 .name = "wcnss_wlan",
540 .id = 0,
541 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
542 .resource = resources_wcnss_wlan,
543 .dev = {.platform_data = &qcom_wcnss_pdata},
544};
545
546#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
547 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
548 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
549 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
550
551#define QCE_SIZE 0x10000
552#define QCE_0_BASE 0x18500000
553
554#define QCE_HW_KEY_SUPPORT 0
555#define QCE_SHA_HMAC_SUPPORT 1
556#define QCE_SHARE_CE_RESOURCE 1
557#define QCE_CE_SHARED 0
558
559static struct resource qcrypto_resources[] = {
560 [0] = {
561 .start = QCE_0_BASE,
562 .end = QCE_0_BASE + QCE_SIZE - 1,
563 .flags = IORESOURCE_MEM,
564 },
565 [1] = {
566 .name = "crypto_channels",
567 .start = DMOV_CE_IN_CHAN,
568 .end = DMOV_CE_OUT_CHAN,
569 .flags = IORESOURCE_DMA,
570 },
571 [2] = {
572 .name = "crypto_crci_in",
573 .start = DMOV_CE_IN_CRCI,
574 .end = DMOV_CE_IN_CRCI,
575 .flags = IORESOURCE_DMA,
576 },
577 [3] = {
578 .name = "crypto_crci_out",
579 .start = DMOV_CE_OUT_CRCI,
580 .end = DMOV_CE_OUT_CRCI,
581 .flags = IORESOURCE_DMA,
582 },
583};
584
585static struct resource qcedev_resources[] = {
586 [0] = {
587 .start = QCE_0_BASE,
588 .end = QCE_0_BASE + QCE_SIZE - 1,
589 .flags = IORESOURCE_MEM,
590 },
591 [1] = {
592 .name = "crypto_channels",
593 .start = DMOV_CE_IN_CHAN,
594 .end = DMOV_CE_OUT_CHAN,
595 .flags = IORESOURCE_DMA,
596 },
597 [2] = {
598 .name = "crypto_crci_in",
599 .start = DMOV_CE_IN_CRCI,
600 .end = DMOV_CE_IN_CRCI,
601 .flags = IORESOURCE_DMA,
602 },
603 [3] = {
604 .name = "crypto_crci_out",
605 .start = DMOV_CE_OUT_CRCI,
606 .end = DMOV_CE_OUT_CRCI,
607 .flags = IORESOURCE_DMA,
608 },
609};
610
611#endif
612
613#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
614 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
615
616static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
617 .ce_shared = QCE_CE_SHARED,
618 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
619 .hw_key_support = QCE_HW_KEY_SUPPORT,
620 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
621};
622
623static struct platform_device qcrypto_device = {
624 .name = "qcrypto",
625 .id = 0,
626 .num_resources = ARRAY_SIZE(qcrypto_resources),
627 .resource = qcrypto_resources,
628 .dev = {
629 .coherent_dma_mask = DMA_BIT_MASK(32),
630 .platform_data = &qcrypto_ce_hw_suppport,
631 },
632};
633#endif
634
635#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
636 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
637
638static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
639 .ce_shared = QCE_CE_SHARED,
640 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
641 .hw_key_support = QCE_HW_KEY_SUPPORT,
642 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
643};
644
645static struct platform_device qcedev_device = {
646 .name = "qce",
647 .id = 0,
648 .num_resources = ARRAY_SIZE(qcedev_resources),
649 .resource = qcedev_resources,
650 .dev = {
651 .coherent_dma_mask = DMA_BIT_MASK(32),
652 .platform_data = &qcedev_ce_hw_suppport,
653 },
654};
655#endif
656
657#define MDM2AP_ERRFATAL 70
658#define AP2MDM_ERRFATAL 95
659#define MDM2AP_STATUS 69
660#define AP2MDM_STATUS 94
661#define AP2MDM_PMIC_RESET_N 80
662#define AP2MDM_KPDPWR_N 81
663
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800664static struct resource mdm_resources[] = {
665 {
666 .start = MDM2AP_ERRFATAL,
667 .end = MDM2AP_ERRFATAL,
668 .name = "MDM2AP_ERRFATAL",
669 .flags = IORESOURCE_IO,
670 },
671 {
672 .start = AP2MDM_ERRFATAL,
673 .end = AP2MDM_ERRFATAL,
674 .name = "AP2MDM_ERRFATAL",
675 .flags = IORESOURCE_IO,
676 },
677 {
678 .start = MDM2AP_STATUS,
679 .end = MDM2AP_STATUS,
680 .name = "MDM2AP_STATUS",
681 .flags = IORESOURCE_IO,
682 },
683 {
684 .start = AP2MDM_STATUS,
685 .end = AP2MDM_STATUS,
686 .name = "AP2MDM_STATUS",
687 .flags = IORESOURCE_IO,
688 },
689 {
690 .start = AP2MDM_PMIC_RESET_N,
691 .end = AP2MDM_PMIC_RESET_N,
692 .name = "AP2MDM_PMIC_RESET_N",
693 .flags = IORESOURCE_IO,
694 },
695 {
696 .start = AP2MDM_KPDPWR_N,
697 .end = AP2MDM_KPDPWR_N,
698 .name = "AP2MDM_KPDPWR_N",
699 .flags = IORESOURCE_IO,
700 },
701};
702
703static struct mdm_platform_data mdm_platform_data = {
704 .mdm_version = "2.5",
705};
706
707static struct platform_device mdm_device = {
708 .name = "mdm2_modem",
709 .id = -1,
710 .num_resources = ARRAY_SIZE(mdm_resources),
711 .resource = mdm_resources,
712 .dev = {
713 .platform_data = &mdm_platform_data,
714 },
715};
716
717static struct platform_device *mdm_devices[] __initdata = {
718 &mdm_device,
719};
720
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800721#define MSM_SHARED_RAM_PHYS 0x80000000
722
723static void __init msm8930_map_io(void)
724{
725 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
726 msm_map_msm8930_io();
727
728 if (socinfo_init() < 0)
729 pr_err("socinfo_init() failed!\n");
730}
731
732static void __init msm8930_init_irq(void)
733{
734 unsigned int i;
735
736 msm_mpm_irq_extn_init();
737 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
738 (void *)MSM_QGIC_CPU_BASE);
739
740 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
741 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
742
743 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
744 mb();
745
746 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
747 * as they are configured as level, which does not play nice with
748 * handle_percpu_irq.
749 */
750 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
751 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
752 irq_set_handler(i, handle_percpu_irq);
753 }
754}
755
756static void __init msm8930_init_buses(void)
757{
758#ifdef CONFIG_MSM_BUS_SCALING
759 msm_bus_rpm_set_mt_mask();
760 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
761 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
762 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
763 msm_bus_apps_fabric.dev.platform_data =
764 &msm_bus_8960_apps_fabric_pdata;
765 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
766 msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
767 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
768 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
769#endif
770}
771
772static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
773 .max_clock_speed = 15060000,
774};
775
776#ifdef CONFIG_USB_MSM_OTG_72K
777static struct msm_otg_platform_data msm_otg_pdata;
778#else
779#define USB_5V_EN 42
780static void msm_hsusb_vbus_power(bool on)
781{
782 int rc;
783 static bool vbus_is_on;
784 static struct regulator *mvs_otg_switch;
785
786 if (vbus_is_on == on)
787 return;
788
789 if (on) {
790 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
791 "vbus_otg");
792 if (IS_ERR(mvs_otg_switch)) {
793 pr_err("Unable to get mvs_otg_switch\n");
794 return;
795 }
Jay Chokshi06fa7542011-12-07 13:09:17 -0800796 /* TODO: Replace this with appropriate PM8038 alternative */
797#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800798 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
799 "usb_5v_en");
Jay Chokshi06fa7542011-12-07 13:09:17 -0800800#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800801 if (rc < 0) {
802 pr_err("failed to request usb_5v_en gpio\n");
803 goto put_mvs_otg;
804 }
805
Jay Chokshi06fa7542011-12-07 13:09:17 -0800806 /* TODO: Replace this with appropriate PM8038 alternative */
807#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800808 rc = gpio_direction_output(PM8921_GPIO_PM_TO_SYS(USB_5V_EN), 1);
809 if (rc) {
810 pr_err("%s: unable to set_direction for gpio [%d]\n",
811 __func__, PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
812 goto free_usb_5v_en;
813 }
Jay Chokshi06fa7542011-12-07 13:09:17 -0800814#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800815 if (regulator_enable(mvs_otg_switch)) {
816 pr_err("unable to enable mvs_otg_switch\n");
817 goto err_ldo_gpio_set_dir;
818 }
819
820 vbus_is_on = true;
821 return;
822 }
823 regulator_disable(mvs_otg_switch);
Jay Chokshi06fa7542011-12-07 13:09:17 -0800824
825/* TODO: Replace this with appropriate PM8038 alternative */
826#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800827err_ldo_gpio_set_dir:
828 gpio_set_value(PM8921_GPIO_PM_TO_SYS(USB_5V_EN), 0);
829free_usb_5v_en:
830 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
Jay Chokshi06fa7542011-12-07 13:09:17 -0800831#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800832put_mvs_otg:
833 regulator_put(mvs_otg_switch);
834 vbus_is_on = false;
835}
836
837static struct msm_otg_platform_data msm_otg_pdata = {
838 .mode = USB_OTG,
839 .otg_control = OTG_PMIC_CONTROL,
840 .phy_type = SNPS_28NM_INTEGRATED_PHY,
841 .pclk_src_name = "dfab_usb_hs_clk",
Jay Chokshi06fa7542011-12-07 13:09:17 -0800842 .pmic_id_irq = PM8038_USB_ID_IN_IRQ(PM8038_IRQ_BASE),
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800843 .vbus_power = msm_hsusb_vbus_power,
844 .power_budget = 750,
845};
846#endif
847
848#ifdef CONFIG_USB_EHCI_MSM_HSIC
849#define HSIC_HUB_RESET_GPIO 91
850static struct msm_hsic_host_platform_data msm_hsic_pdata = {
851 .strobe = 150,
852 .data = 151,
853};
854#else
855static struct msm_hsic_host_platform_data msm_hsic_pdata;
856#endif
857
858#define PID_MAGIC_ID 0x71432909
859#define SERIAL_NUM_MAGIC_ID 0x61945374
860#define SERIAL_NUMBER_LENGTH 127
861#define DLOAD_USB_BASE_ADD 0x2A03F0C8
862
863struct magic_num_struct {
864 uint32_t pid;
865 uint32_t serial_num;
866};
867
868struct dload_struct {
869 uint32_t reserved1;
870 uint32_t reserved2;
871 uint32_t reserved3;
872 uint16_t reserved4;
873 uint16_t pid;
874 char serial_number[SERIAL_NUMBER_LENGTH];
875 uint16_t reserved5;
876 struct magic_num_struct magic_struct;
877};
878
879static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
880{
881 struct dload_struct __iomem *dload = 0;
882
883 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
884 if (!dload) {
885 pr_err("%s: cannot remap I/O memory region: %08x\n",
886 __func__, DLOAD_USB_BASE_ADD);
887 return -ENXIO;
888 }
889
890 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
891 __func__, dload, pid, snum);
892 /* update pid */
893 dload->magic_struct.pid = PID_MAGIC_ID;
894 dload->pid = pid;
895
896 /* update serial number */
897 dload->magic_struct.serial_num = 0;
898 if (!snum) {
899 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
900 goto out;
901 }
902
903 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
904 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
905out:
906 iounmap(dload);
907 return 0;
908}
909
910static struct android_usb_platform_data android_usb_pdata = {
911 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
912};
913
914static struct platform_device android_usb_device = {
915 .name = "android_usb",
916 .id = -1,
917 .dev = {
918 .platform_data = &android_usb_pdata,
919 },
920};
921
922static uint8_t spm_wfi_cmd_sequence[] __initdata = {
923 0x03, 0x0f,
924};
925
926static uint8_t spm_power_collapse_without_rpm[] __initdata = {
927 0x00, 0x24, 0x54, 0x10,
928 0x09, 0x03, 0x01,
929 0x10, 0x54, 0x30, 0x0C,
930 0x24, 0x30, 0x0f,
931};
932
933static uint8_t spm_power_collapse_with_rpm[] __initdata = {
934 0x00, 0x24, 0x54, 0x10,
935 0x09, 0x07, 0x01, 0x0B,
936 0x10, 0x54, 0x30, 0x0C,
937 0x24, 0x30, 0x0f,
938};
939
940static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
941 [0] = {
942 .mode = MSM_SPM_MODE_CLOCK_GATING,
943 .notify_rpm = false,
944 .cmd = spm_wfi_cmd_sequence,
945 },
946 [1] = {
947 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
948 .notify_rpm = false,
949 .cmd = spm_power_collapse_without_rpm,
950 },
951 [2] = {
952 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
953 .notify_rpm = true,
954 .cmd = spm_power_collapse_with_rpm,
955 },
956};
957
958static struct msm_spm_platform_data msm_spm_data[] __initdata = {
959 [0] = {
960 .reg_base_addr = MSM_SAW0_BASE,
961 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
962 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
963 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
964#if defined(CONFIG_MSM_AVS_HW)
965 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
966 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
967#endif
968 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
969 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
970 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
971 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
972 .vctl_timeout_us = 50,
973 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
974 .modes = msm_spm_seq_list,
975 },
976 [1] = {
977 .reg_base_addr = MSM_SAW1_BASE,
978 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
979 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
980 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
981#if defined(CONFIG_MSM_AVS_HW)
982 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
983 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
984#endif
985 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
986 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
987 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
988 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
989 .vctl_timeout_us = 50,
990 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
991 .modes = msm_spm_seq_list,
992 },
993};
994
995static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
996 0x00, 0x20, 0x03, 0x20,
997 0x00, 0x0f,
998};
999
1000static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1001 0x00, 0x20, 0x34, 0x64,
1002 0x48, 0x07, 0x48, 0x20,
1003 0x50, 0x64, 0x04, 0x34,
1004 0x50, 0x0f,
1005};
1006static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1007 0x00, 0x10, 0x34, 0x64,
1008 0x48, 0x07, 0x48, 0x10,
1009 0x50, 0x64, 0x04, 0x34,
1010 0x50, 0x0F,
1011};
1012
1013static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1014 [0] = {
1015 .mode = MSM_SPM_L2_MODE_RETENTION,
1016 .notify_rpm = false,
1017 .cmd = l2_spm_wfi_cmd_sequence,
1018 },
1019 [1] = {
1020 .mode = MSM_SPM_L2_MODE_GDHS,
1021 .notify_rpm = true,
1022 .cmd = l2_spm_gdhs_cmd_sequence,
1023 },
1024 [2] = {
1025 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1026 .notify_rpm = true,
1027 .cmd = l2_spm_power_off_cmd_sequence,
1028 },
1029};
1030
1031static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1032 [0] = {
1033 .reg_base_addr = MSM_SAW_L2_BASE,
1034 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1035 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
1036 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1037 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1038 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1039 .modes = msm_spm_l2_seq_list,
1040 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1041 },
1042};
1043
Jay Chokshi06fa7542011-12-07 13:09:17 -08001044#/* TODO: Remove this once PM8038 physically becomes
1045 * available.
1046 */
1047#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001048#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1049#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
Jay Chokshi06fa7542011-12-07 13:09:17 -08001050#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001051
1052static struct msm_xo_voter *xo_handle_d1;
1053
1054static int isa1200_power(int on)
1055{
1056 int rc = 0;
1057
1058 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !!on);
1059
1060 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
1061 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
1062 if (rc < 0) {
1063 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
1064 __func__, on ? "" : "de-", rc);
1065 goto err_xo_vote;
1066 }
1067
1068 return 0;
1069
1070err_xo_vote:
1071 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !on);
1072 return rc;
1073}
1074
1075static int isa1200_dev_setup(bool enable)
1076{
1077 int rc = 0;
1078
1079 struct pm_gpio hap_gpio_config = {
1080 .direction = PM_GPIO_DIR_OUT,
1081 .pull = PM_GPIO_PULL_NO,
1082 .out_strength = PM_GPIO_STRENGTH_HIGH,
1083 .function = PM_GPIO_FUNC_NORMAL,
1084 .inv_int_pol = 0,
1085 .vin_sel = 2,
1086 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1087 .output_value = 0,
1088 };
1089
1090 if (enable == true) {
1091 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
1092 if (rc) {
1093 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1094 __func__, PM_HAP_EN_GPIO, rc);
1095 return rc;
1096 }
1097
1098 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
1099 if (rc) {
1100 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1101 __func__, PM_HAP_LEN_GPIO, rc);
1102 return rc;
1103 }
1104
1105 rc = gpio_request(HAP_SHIFT_LVL_OE_GPIO, "hap_shft_lvl_oe");
1106 if (rc) {
1107 pr_err("%s: unable to request gpio %d (%d)\n",
1108 __func__, HAP_SHIFT_LVL_OE_GPIO, rc);
1109 return rc;
1110 }
1111
1112 rc = gpio_direction_output(HAP_SHIFT_LVL_OE_GPIO, 0);
1113 if (rc) {
1114 pr_err("%s: Unable to set direction\n", __func__);
1115 goto free_gpio;
1116 }
1117
1118 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
1119 if (IS_ERR(xo_handle_d1)) {
1120 rc = PTR_ERR(xo_handle_d1);
1121 pr_err("%s: failed to get the handle for D1(%d)\n",
1122 __func__, rc);
1123 goto gpio_set_dir;
1124 }
1125 } else {
1126 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1127
1128 msm_xo_put(xo_handle_d1);
1129 }
1130
1131 return 0;
1132
1133gpio_set_dir:
1134 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, 0);
1135free_gpio:
1136 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1137 return rc;
1138}
1139
1140static struct isa1200_regulator isa1200_reg_data[] = {
1141 {
1142 .name = "vcc_i2c",
1143 .min_uV = ISA_I2C_VTG_MIN_UV,
1144 .max_uV = ISA_I2C_VTG_MAX_UV,
1145 .load_uA = ISA_I2C_CURR_UA,
1146 },
1147};
1148
1149static struct isa1200_platform_data isa1200_1_pdata = {
1150 .name = "vibrator",
1151 .dev_setup = isa1200_dev_setup,
1152 .power_on = isa1200_power,
1153 .hap_en_gpio = PM_HAP_EN_GPIO,
1154 .hap_len_gpio = PM_HAP_LEN_GPIO,
1155 .max_timeout = 15000,
1156 .mode_ctrl = PWM_GEN_MODE,
1157 .pwm_fd = {
1158 .pwm_div = 256,
1159 },
1160 .is_erm = false,
1161 .smart_en = true,
1162 .ext_clk_en = true,
1163 .chip_en = 1,
1164 .regulator_info = isa1200_reg_data,
1165 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1166};
1167
1168static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1169 {
1170 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1171 .platform_data = &isa1200_1_pdata,
1172 },
1173};
1174
1175#define CYTTSP_TS_GPIO_IRQ 11
1176#define CYTTSP_TS_SLEEP_GPIO 50
1177#define CYTTSP_TS_RESOUT_N_GPIO 52
1178
1179/*virtual key support */
1180static ssize_t tma340_vkeys_show(struct kobject *kobj,
1181 struct kobj_attribute *attr, char *buf)
1182{
1183 return snprintf(buf, 200,
1184 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1185 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1186 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1187 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1188 "\n");
1189}
1190
1191static struct kobj_attribute tma340_vkeys_attr = {
1192 .attr = {
1193 .mode = S_IRUGO,
1194 },
1195 .show = &tma340_vkeys_show,
1196};
1197
1198static struct attribute *tma340_properties_attrs[] = {
1199 &tma340_vkeys_attr.attr,
1200 NULL
1201};
1202
1203static struct attribute_group tma340_properties_attr_group = {
1204 .attrs = tma340_properties_attrs,
1205};
1206
1207
1208static int cyttsp_platform_init(struct i2c_client *client)
1209{
1210 int rc = 0;
1211 static struct kobject *tma340_properties_kobj;
1212
1213 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1214 tma340_properties_kobj = kobject_create_and_add("board_properties",
1215 NULL);
1216 if (tma340_properties_kobj)
1217 rc = sysfs_create_group(tma340_properties_kobj,
1218 &tma340_properties_attr_group);
1219 if (!tma340_properties_kobj || rc)
1220 pr_err("%s: failed to create board_properties\n",
1221 __func__);
1222
1223 return 0;
1224}
1225
1226static struct cyttsp_regulator regulator_data[] = {
1227 {
1228 .name = "vdd",
1229 .min_uV = CY_TMA300_VTG_MIN_UV,
1230 .max_uV = CY_TMA300_VTG_MAX_UV,
1231 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1232 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
1233 },
1234 /* TODO: Remove after runtime PM is enabled in I2C driver */
1235 {
1236 .name = "vcc_i2c",
1237 .min_uV = CY_I2C_VTG_MIN_UV,
1238 .max_uV = CY_I2C_VTG_MAX_UV,
1239 .hpm_load_uA = CY_I2C_CURR_UA,
1240 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
1241 },
1242};
1243
1244static struct cyttsp_platform_data cyttsp_pdata = {
1245 .panel_maxx = 634,
1246 .panel_maxy = 1166,
1247 .disp_maxx = 616,
1248 .disp_maxy = 1023,
1249 .disp_minx = 0,
1250 .disp_miny = 16,
1251 .flags = 0x01,
1252 .gen = CY_GEN3, /* or */
1253 .use_st = CY_USE_ST,
1254 .use_mt = CY_USE_MT,
1255 .use_hndshk = CY_SEND_HNDSHK,
1256 .use_trk_id = CY_USE_TRACKING_ID,
1257 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
1258 .use_gestures = CY_USE_GESTURES,
1259 .fw_fname = "cyttsp_8960_cdp.hex",
1260 /* activate up to 4 groups
1261 * and set active distance
1262 */
1263 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
1264 CY_GEST_GRP3 | CY_GEST_GRP4 |
1265 CY_ACT_DIST,
1266 /* change act_intrvl to customize the Active power state
1267 * scanning/processing refresh interval for Operating mode
1268 */
1269 .act_intrvl = CY_ACT_INTRVL_DFLT,
1270 /* change tch_tmout to customize the touch timeout for the
1271 * Active power state for Operating mode
1272 */
1273 .tch_tmout = CY_TCH_TMOUT_DFLT,
1274 /* change lp_intrvl to customize the Low Power power state
1275 * scanning/processing refresh interval for Operating mode
1276 */
1277 .lp_intrvl = CY_LP_INTRVL_DFLT,
1278 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
1279 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
1280 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1281 .regulator_info = regulator_data,
1282 .num_regulators = ARRAY_SIZE(regulator_data),
1283 .init = cyttsp_platform_init,
1284 .correct_fw_ver = 9,
1285};
1286
1287static struct i2c_board_info cyttsp_info[] __initdata = {
1288 {
1289 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1290 .platform_data = &cyttsp_pdata,
1291#ifndef CY_USE_TIMER
1292 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1293#endif /* CY_USE_TIMER */
1294 },
1295};
1296
1297/* configuration data */
1298static const u8 mxt_config_data[] = {
1299 /* T6 Object */
1300 0, 0, 0, 0, 0, 0,
1301 /* T38 Object */
1302 11, 2, 0, 11, 11, 11, 0, 0, 0, 0,
1303 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1304 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1305 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1306 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1307 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1308 0, 0, 0, 0,
1309 /* T7 Object */
1310 100, 16, 50,
1311 /* T8 Object */
1312 8, 0, 0, 0, 0, 0, 8, 14, 50, 215,
1313 /* T9 Object */
1314 131, 0, 0, 26, 42, 0, 32, 63, 3, 5,
1315 0, 2, 1, 113, 10, 10, 8, 10, 255, 2,
1316 85, 5, 0, 0, 20, 20, 75, 25, 202, 29,
1317 10, 10, 45, 46,
1318 /* T15 Object */
1319 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1320 0,
1321 /* T22 Object */
1322 5, 0, 0, 0, 0, 0, 0, 0, 30, 0,
1323 0, 0, 5, 8, 10, 13, 0,
1324 /* T24 Object */
1325 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1326 0, 0, 0, 0, 0, 0, 0, 0, 0,
1327 /* T25 Object */
1328 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
1329 0, 0, 0, 0,
1330 /* T27 Object */
1331 0, 0, 0, 0, 0, 0, 0,
1332 /* T28 Object */
1333 0, 0, 0, 8, 12, 60,
1334 /* T40 Object */
1335 0, 0, 0, 0, 0,
1336 /* T41 Object */
1337 0, 0, 0, 0, 0, 0,
1338 /* T43 Object */
1339 0, 0, 0, 0, 0, 0,
1340};
1341
1342#define MXT_TS_GPIO_IRQ 11
1343#define MXT_TS_LDO_EN_GPIO 50
1344#define MXT_TS_RESET_GPIO 52
1345
1346static struct mxt_platform_data mxt_platform_data = {
1347 .config = mxt_config_data,
1348 .config_length = ARRAY_SIZE(mxt_config_data),
1349 .x_size = 1365,
1350 .y_size = 767,
1351 .irqflags = IRQF_TRIGGER_FALLING,
1352 .i2c_pull_up = true,
1353};
1354
1355static struct i2c_board_info mxt_device_info[] __initdata = {
1356 {
1357 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
1358 .platform_data = &mxt_platform_data,
1359 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1360 },
1361};
1362
1363static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
1364{
1365}
1366
1367static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
1368 .clk_freq = 100000,
1369 .src_clk_rate = 24000000,
1370 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
1371};
1372
1373static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
1374 .clk_freq = 100000,
1375 .src_clk_rate = 24000000,
1376 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
1377};
1378
1379static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
1380 .clk_freq = 100000,
1381 .src_clk_rate = 24000000,
1382 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
1383};
1384
1385static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
1386 .clk_freq = 100000,
1387 .src_clk_rate = 24000000,
1388 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
1389};
1390
1391static struct msm_rpm_platform_data msm_rpm_data = {
1392 .reg_base_addrs = {
1393 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
1394 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
1395 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
1396 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
1397 },
1398
1399 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
1400 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
1401 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1402 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
1403 .msm_apps_ipc_rpm_val = 4,
1404};
1405
1406static struct ks8851_pdata spi_eth_pdata = {
1407 .irq_gpio = KS8851_IRQ_GPIO,
1408 .rst_gpio = KS8851_RST_GPIO,
1409};
1410
1411static struct spi_board_info spi_board_info[] __initdata = {
1412 {
1413 .modalias = "ks8851",
1414 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1415 .max_speed_hz = 19200000,
1416 .bus_num = 0,
1417 .chip_select = 0,
1418 .mode = SPI_MODE_0,
1419 .platform_data = &spi_eth_pdata
1420 },
1421 {
1422 .modalias = "dsi_novatek_3d_panel_spi",
1423 .max_speed_hz = 10800000,
1424 .bus_num = 0,
1425 .chip_select = 1,
1426 .mode = SPI_MODE_0,
1427 },
1428};
1429
1430static struct platform_device msm_device_saw_core0 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001431 .name = "saw-regulator",
1432 .id = 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001433 .dev = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001434 /*
1435 * TODO: When physical 8930/PM8038 hardware becomes
1436 * available, replace msm_saw_regulator_pdata_s5
1437 * with 8930 saw regulator object.
1438 */
1439#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001440 .platform_data = &msm_saw_regulator_pdata_s5,
Jay Chokshi06fa7542011-12-07 13:09:17 -08001441#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001442 },
1443};
1444
1445static struct platform_device msm_device_saw_core1 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001446 .name = "saw-regulator",
1447 .id = 1,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001448 .dev = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001449 /*
1450 * TODO: When physical 8930/PM8038 hardware becomes
1451 * available, replace msm_saw_regulator_pdata_s5
1452 * with 8930 saw regulator object.
1453 */
1454#if !defined(MSM8930_PHASE_2)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001455 .platform_data = &msm_saw_regulator_pdata_s6,
Jay Chokshi06fa7542011-12-07 13:09:17 -08001456#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001457 },
1458};
1459
1460static struct tsens_platform_data msm_tsens_pdata = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001461 .slope = 910,
1462 .tsens_factor = 1000,
1463 .hw_type = MSM_8960,
1464 .tsens_num_sensor = 5,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001465};
1466
1467static struct platform_device msm_tsens_device = {
1468 .name = "tsens8960-tm",
1469 .id = -1,
1470 .dev = {
1471 .platform_data = &msm_tsens_pdata,
1472 },
1473};
1474
1475#ifdef CONFIG_MSM_FAKE_BATTERY
1476static struct platform_device fish_battery_device = {
1477 .name = "fish_battery",
1478};
1479#endif
1480
Jay Chokshi06fa7542011-12-07 13:09:17 -08001481static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001482 .name = GPIO_REGULATOR_DEV_NAME,
Jay Chokshi06fa7542011-12-07 13:09:17 -08001483/* TODO: Replace this with right MPP for 8038 */
1484#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001485 .id = PM8921_MPP_PM_TO_SYS(7),
Jay Chokshi06fa7542011-12-07 13:09:17 -08001486#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001487 .dev = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001488 /*
1489 * TODO: When physical 8930/PM8038 hardware becomes
1490 * available, replace msm_gpio_regulator_pdata
1491 * with 8930 gpio regulator object.
1492 */
1493#if !defined(MSM8930_PHASE_2)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001494 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
Jay Chokshi06fa7542011-12-07 13:09:17 -08001495#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001496 },
1497};
1498
Jay Chokshi06fa7542011-12-07 13:09:17 -08001499static struct platform_device msm8930_device_ext_l2_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001500 .name = GPIO_REGULATOR_DEV_NAME,
1501 .id = 91,
1502 .dev = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001503 /*
1504 * TODO: When physical 8930/PM8038 hardware becomes
1505 * available, replace msm_gpio_regulator_pdata
1506 * with 8930 gpio regulator object.
1507 */
1508#if !defined(MSM8930_PHASE_2)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001509 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
Jay Chokshi06fa7542011-12-07 13:09:17 -08001510#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001511 },
1512};
1513
Jay Chokshi06fa7542011-12-07 13:09:17 -08001514static struct platform_device msm8930_device_rpm_regulator __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001515 .name = "rpm-regulator",
1516 .id = -1,
1517 .dev = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001518 /*
1519 * TODO: When physical 8930/PM8038 hardware becomes
1520 * available, replace msm_rpm_regulator_pdata
1521 * with 8930 rpm regulator object.
1522 */
1523#if !defined(MSM8930_PHASE_2)
1524
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001525 .platform_data = &msm_rpm_regulator_pdata,
Jay Chokshi06fa7542011-12-07 13:09:17 -08001526#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001527 },
1528};
1529
1530static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
1531 .phys_addr_base = 0x0010C000,
1532 .reg_offsets = {
1533 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
1534 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
1535 },
1536 .phys_size = SZ_8K,
1537 .log_len = 4096, /* log's buffer length in bytes */
1538 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
1539};
1540
1541static struct platform_device msm_rpm_log_device = {
1542 .name = "msm_rpm_log",
1543 .id = -1,
1544 .dev = {
1545 .platform_data = &msm_rpm_log_pdata,
1546 },
1547};
1548
1549static struct platform_device *common_devices[] __initdata = {
1550 &msm8960_device_dmov,
1551 &msm_device_smd,
1552 &msm8960_device_uart_gsbi5,
1553 &msm_device_uart_dm6,
1554 &msm_device_saw_core0,
1555 &msm_device_saw_core1,
Jay Chokshi06fa7542011-12-07 13:09:17 -08001556 &msm8930_device_ext_5v_vreg,
1557 &msm8930_device_ext_l2_vreg,
Jay Chokshi33c044a2011-12-07 13:05:40 -08001558 &msm8960_device_ssbi_pmic,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001559 &msm8960_device_qup_spi_gsbi1,
1560 &msm8960_device_qup_i2c_gsbi3,
1561 &msm8960_device_qup_i2c_gsbi4,
1562 &msm8960_device_qup_i2c_gsbi10,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001563 &msm8960_device_qup_i2c_gsbi12,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001564 &msm_slim_ctrl,
1565 &msm_device_wcnss_wlan,
1566#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1567 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1568 &qcrypto_device,
1569#endif
1570
1571#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1572 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1573 &qcedev_device,
1574#endif
1575#ifdef CONFIG_MSM_ROTATOR
1576 &msm_rotator_device,
1577#endif
1578 &msm_device_sps,
1579#ifdef CONFIG_MSM_FAKE_BATTERY
1580 &fish_battery_device,
1581#endif
1582#ifdef CONFIG_ANDROID_PMEM
1583#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
1584 &android_pmem_device,
1585 &android_pmem_adsp_device,
1586#endif
1587 &android_pmem_audio_device,
1588#endif
1589 &msm_device_vidc,
1590 &msm_device_bam_dmux,
1591 &msm_fm_platform_init,
1592
1593#ifdef CONFIG_HW_RANDOM_MSM
1594 &msm_device_rng,
1595#endif
1596 &msm_rpm_device,
1597#ifdef CONFIG_ION_MSM
1598 &ion_dev,
1599#endif
1600 &msm_rpm_log_device,
1601 &msm_rpm_stat_device,
1602 &msm_device_tz_log,
1603
1604#ifdef CONFIG_MSM_QDSS
1605 &msm_etb_device,
1606 &msm_tpiu_device,
1607 &msm_funnel_device,
1608 &msm_debug_device,
1609 &msm_ptm_device,
1610#endif
1611 &msm_device_dspcrashd_8960,
1612 &msm8960_device_watchdog,
1613};
1614
1615static struct platform_device *cdp_devices[] __initdata = {
1616 &msm8960_device_otg,
1617 &msm8960_device_gadget_peripheral,
1618 &msm_device_hsusb_host,
1619 &android_usb_device,
1620 &msm_pcm,
1621 &msm_pcm_routing,
1622 &msm_cpudai0,
1623 &msm_cpudai1,
1624 &msm_cpudai_hdmi_rx,
1625 &msm_cpudai_bt_rx,
1626 &msm_cpudai_bt_tx,
1627 &msm_cpudai_fm_rx,
1628 &msm_cpudai_fm_tx,
1629 &msm_cpudai_auxpcm_rx,
1630 &msm_cpudai_auxpcm_tx,
1631 &msm_cpu_fe,
1632 &msm_stub_codec,
1633 &msm_kgsl_3d0,
1634#ifdef CONFIG_MSM_KGSL_2D
1635 &msm_kgsl_2d0,
1636 &msm_kgsl_2d1,
1637#endif
1638#ifdef CONFIG_MSM_GEMINI
1639 &msm8960_gemini_device,
1640#endif
1641 &msm_voice,
1642 &msm_voip,
1643 &msm_lpa_pcm,
1644 &msm_cpudai_afe_01_rx,
1645 &msm_cpudai_afe_01_tx,
1646 &msm_cpudai_afe_02_rx,
1647 &msm_cpudai_afe_02_tx,
1648 &msm_pcm_afe,
1649 &msm_pcm_hostless,
1650 &msm_bus_apps_fabric,
1651 &msm_bus_sys_fabric,
1652 &msm_bus_mm_fabric,
1653 &msm_bus_sys_fpb,
1654 &msm_bus_cpss_fpb,
1655 &msm_tsens_device,
1656};
1657
1658static void __init msm8930_i2c_init(void)
1659{
1660 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
1661 &msm8960_i2c_qup_gsbi4_pdata;
1662
1663 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
1664 &msm8960_i2c_qup_gsbi3_pdata;
1665
1666 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
1667 &msm8960_i2c_qup_gsbi10_pdata;
1668
1669 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
1670 &msm8960_i2c_qup_gsbi12_pdata;
1671}
1672
1673static void __init msm8930_gfx_init(void)
1674{
1675 uint32_t soc_platform_version = socinfo_get_version();
1676 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
1677 struct kgsl_device_platform_data *kgsl_3d0_pdata =
1678 msm_kgsl_3d0.dev.platform_data;
1679 kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
1680 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
1681 }
1682}
1683
1684static struct msm_cpuidle_state msm_cstates[] __initdata = {
1685 {0, 0, "C0", "WFI",
1686 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1687
1688 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1689 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1690
1691 {0, 2, "C2", "POWER_COLLAPSE",
1692 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
1693
1694 {1, 0, "C0", "WFI",
1695 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1696
1697 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1698 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1699};
1700
1701static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
1702 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1703 .idle_supported = 1,
1704 .suspend_supported = 1,
1705 .idle_enabled = 0,
1706 .suspend_enabled = 0,
1707 },
1708
1709 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1710 .idle_supported = 1,
1711 .suspend_supported = 1,
1712 .idle_enabled = 0,
1713 .suspend_enabled = 0,
1714 },
1715
1716 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1717 .idle_supported = 1,
1718 .suspend_supported = 1,
1719 .idle_enabled = 1,
1720 .suspend_enabled = 1,
1721 },
1722
1723 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1724 .idle_supported = 0,
1725 .suspend_supported = 1,
1726 .idle_enabled = 0,
1727 .suspend_enabled = 0,
1728 },
1729
1730 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1731 .idle_supported = 1,
1732 .suspend_supported = 1,
1733 .idle_enabled = 0,
1734 .suspend_enabled = 0,
1735 },
1736
1737 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1738 .idle_supported = 1,
1739 .suspend_supported = 0,
1740 .idle_enabled = 1,
1741 .suspend_enabled = 0,
1742 },
1743};
1744
1745static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
1746 {
1747 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1748 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1749 true,
1750 100, 8000, 100000, 1,
1751 },
1752
1753 {
1754 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1755 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1756 true,
1757 2000, 6000, 60100000, 3000,
1758 },
1759
1760 {
1761 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1762 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1763 false,
1764 4200, 5000, 60350000, 3500,
1765 },
1766
1767 {
1768 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1769 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
1770 false,
1771 6300, 4500, 65350000, 4800,
1772 },
1773 {
1774 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1775 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
1776 false,
1777 7000, 3500, 66600000, 5150,
1778 },
1779
1780 {
1781 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1782 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1783 false,
1784 11700, 2500, 67850000, 5500,
1785 },
1786
1787 {
1788 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1789 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1790 false,
1791 13800, 2000, 71850000, 6800,
1792 },
1793
1794 {
1795 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1796 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1797 false,
1798 29700, 500, 75850000, 8800,
1799 },
1800
1801 {
1802 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1803 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1804 false,
1805 29700, 0, 76350000, 9800,
1806 },
1807};
1808
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06001809static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1810 .mode = MSM_PM_BOOT_CONFIG_TZ,
1811};
1812
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001813#ifdef CONFIG_I2C
1814#define I2C_SURF 1
1815#define I2C_FFA (1 << 1)
1816#define I2C_RUMI (1 << 2)
1817#define I2C_SIM (1 << 3)
1818#define I2C_FLUID (1 << 4)
1819#define I2C_LIQUID (1 << 5)
1820
1821struct i2c_registry {
1822 u8 machs;
1823 int bus;
1824 struct i2c_board_info *info;
1825 int len;
1826};
1827
1828#ifdef CONFIG_MSM_CAMERA
1829static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
1830#ifdef CONFIG_IMX074
1831 {
1832 I2C_BOARD_INFO("imx074", 0x1A),
1833 },
1834#endif
1835#ifdef CONFIG_OV2720
1836 {
1837 I2C_BOARD_INFO("ov2720", 0x6C),
1838 },
1839#endif
1840#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
1841 {
1842 I2C_BOARD_INFO("sc628a", 0x6E),
1843 },
1844#endif
1845};
1846#endif
1847
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001848static void __init msm8930_init_hsic(void)
1849{
1850#ifdef CONFIG_USB_EHCI_MSM_HSIC
1851 uint32_t version = socinfo_get_version();
1852
1853 pr_info("%s: version:%d mtp:%d\n", __func__,
1854 SOCINFO_VERSION_MAJOR(version),
1855 machine_is_msm8930_mtp());
1856
1857 if ((SOCINFO_VERSION_MAJOR(version) == 1) ||
1858 machine_is_msm8930_mtp() ||
1859 machine_is_msm8930_fluid())
1860 return;
1861
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001862 platform_device_register(&msm_device_hsic_host);
1863#endif
1864}
1865
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001866#ifdef CONFIG_ISL9519_CHARGER
1867static struct isl_platform_data isl_data __initdata = {
1868 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
1869 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
1870 .max_system_voltage = 4200,
1871 .min_system_voltage = 3200,
1872 .chgcurrent = 1000, /* 1900, */
1873 .term_current = 400, /* Need fine tuning */
1874 .input_current = 2048,
1875};
1876
1877static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
1878 {
1879 I2C_BOARD_INFO("isl9519q", 0x9),
1880 .irq = 0, /* Not required when notify-by-pmic */
1881 .platform_data = &isl_data,
1882 },
1883};
1884#endif /* CONFIG_ISL9519_CHARGER */
1885
1886static struct i2c_registry msm8960_i2c_devices[] __initdata = {
1887#ifdef CONFIG_MSM_CAMERA
1888 {
1889 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
1890 MSM_8930_GSBI4_QUP_I2C_BUS_ID,
1891 msm_camera_boardinfo,
1892 ARRAY_SIZE(msm_camera_boardinfo),
1893 },
1894#endif
1895#ifdef CONFIG_ISL9519_CHARGER
1896 {
1897 I2C_LIQUID,
1898 MSM_8930_GSBI10_QUP_I2C_BUS_ID,
1899 isl_charger_i2c_info,
1900 ARRAY_SIZE(isl_charger_i2c_info),
1901 },
1902#endif /* CONFIG_ISL9519_CHARGER */
1903 {
1904 I2C_SURF | I2C_FFA | I2C_FLUID,
1905 MSM_8930_GSBI3_QUP_I2C_BUS_ID,
1906 cyttsp_info,
1907 ARRAY_SIZE(cyttsp_info),
1908 },
1909 {
1910 I2C_LIQUID,
1911 MSM_8930_GSBI3_QUP_I2C_BUS_ID,
1912 mxt_device_info,
1913 ARRAY_SIZE(mxt_device_info),
1914 },
1915 {
1916 I2C_LIQUID,
1917 MSM_8930_GSBI10_QUP_I2C_BUS_ID,
1918 msm_isa1200_board_info,
1919 ARRAY_SIZE(msm_isa1200_board_info),
1920 },
1921};
1922#endif /* CONFIG_I2C */
1923
1924static void __init register_i2c_devices(void)
1925{
1926#ifdef CONFIG_I2C
1927 u8 mach_mask = 0;
1928 int i;
1929
1930 /* Build the matching 'supported_machs' bitmask */
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08001931 if (machine_is_msm8930_cdp() || machine_is_msm8627_cdp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001932 mach_mask = I2C_SURF;
1933 else if (machine_is_msm8930_fluid())
1934 mach_mask = I2C_FLUID;
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08001935 else if (machine_is_msm8930_mtp() || machine_is_msm8627_mtp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001936 mach_mask = I2C_FFA;
1937 else
1938 pr_err("unmatched machine ID in register_i2c_devices\n");
1939
1940 /* Run the array and install devices as appropriate */
1941 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
1942 if (msm8960_i2c_devices[i].machs & mach_mask)
1943 i2c_register_board_info(msm8960_i2c_devices[i].bus,
1944 msm8960_i2c_devices[i].info,
1945 msm8960_i2c_devices[i].len);
1946 }
1947#endif
1948}
1949
1950static void __init msm8930_cdp_init(void)
1951{
1952 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
1953 pr_err("meminfo_init() failed!\n");
1954
1955 BUG_ON(msm_rpm_init(&msm_rpm_data));
1956 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
1957 ARRAY_SIZE(msm_rpmrs_levels)));
1958
1959 regulator_suppress_info_printing();
1960 if (msm_xo_init())
1961 pr_err("Failed to initialize XO votes\n");
Jay Chokshi06fa7542011-12-07 13:09:17 -08001962 platform_device_register(&msm8930_device_rpm_regulator);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001963 msm_clock_init(&msm8960_clock_init_data);
1964 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
1965 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08001966 msm8930_init_gpiomux();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001967 msm8960_device_qup_spi_gsbi1.dev.platform_data =
1968 &msm8960_qup_spi_gsbi1_pdata;
1969 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
1970
Jay Chokshi06fa7542011-12-07 13:09:17 -08001971 /*
1972 * TODO: When physical 8930/PM8038 hardware becomes
1973 * available, remove this block or add the config
1974 * option.
1975 */
1976#ifndef MSM8930_PHASE_2
1977 msm8960_init_pmic();
1978#else
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001979 msm8930_init_pmic();
Jay Chokshi06fa7542011-12-07 13:09:17 -08001980#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001981 msm8930_i2c_init();
1982 msm8930_gfx_init();
1983 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
1984 msm_spm_l2_init(msm_spm_l2_data);
1985 msm8930_init_buses();
1986 platform_add_devices(msm_footswitch_devices,
1987 msm_num_footswitch_devices);
1988 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Jay Chokshi06fa7542011-12-07 13:09:17 -08001989 /*
1990 * TODO: When physical 8930/PM8038 hardware becomes
1991 * available, remove this block or add the config
1992 * option.
1993 */
1994#ifndef MSM8930_PHASE_2
1995 msm8960_pm8921_gpio_mpp_init();
1996#else
1997 msm8930_pm8038_gpio_mpp_init();
1998#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001999 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
2000 msm8930_init_hsic();
2001 msm8930_init_cam();
2002 msm8930_init_mmc();
Tianyi Gou7c6b81f2011-12-07 23:09:08 -08002003 acpuclk_init(&acpuclk_8930_soc_data);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002004 register_i2c_devices();
2005 msm8930_init_fb();
2006 slim_register_board_info(msm_slim_devices,
2007 ARRAY_SIZE(msm_slim_devices));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002008 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2009 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2010 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2011 msm_pm_data);
2012 change_memory_power = &msm8930_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002013 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002014
2015 if (PLATFORM_IS_CHARM25())
2016 platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices));
2017}
2018
2019MACHINE_START(MSM8930_CDP, "QCT MSM8930 CDP")
2020 .map_io = msm8930_map_io,
2021 .reserve = msm8930_reserve,
2022 .init_irq = msm8930_init_irq,
2023 .timer = &msm_timer,
2024 .init_machine = msm8930_cdp_init,
2025 .init_early = msm8930_allocate_memory_regions,
2026 .init_very_early = msm8930_early_memory,
2027MACHINE_END
2028
2029MACHINE_START(MSM8930_MTP, "QCT MSM8930 MTP")
2030 .map_io = msm8930_map_io,
2031 .reserve = msm8930_reserve,
2032 .init_irq = msm8930_init_irq,
2033 .timer = &msm_timer,
2034 .init_machine = msm8930_cdp_init,
2035 .init_early = msm8930_allocate_memory_regions,
2036 .init_very_early = msm8930_early_memory,
2037MACHINE_END
2038
2039MACHINE_START(MSM8930_FLUID, "QCT MSM8930 FLUID")
2040 .map_io = msm8930_map_io,
2041 .reserve = msm8930_reserve,
2042 .init_irq = msm8930_init_irq,
2043 .timer = &msm_timer,
2044 .init_machine = msm8930_cdp_init,
2045 .init_early = msm8930_allocate_memory_regions,
2046 .init_very_early = msm8930_early_memory,
2047MACHINE_END
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002048
2049MACHINE_START(MSM8627_CDP, "QCT MSM8627 CDP")
2050 .map_io = msm8930_map_io,
2051 .reserve = msm8930_reserve,
2052 .init_irq = msm8930_init_irq,
2053 .timer = &msm_timer,
2054 .init_machine = msm8930_cdp_init,
2055 .init_early = msm8930_allocate_memory_regions,
2056 .init_very_early = msm8930_early_memory,
2057MACHINE_END
2058
2059MACHINE_START(MSM8627_MTP, "QCT MSM8627 MTP")
2060 .map_io = msm8930_map_io,
2061 .reserve = msm8930_reserve,
2062 .init_irq = msm8930_init_irq,
2063 .timer = &msm_timer,
2064 .init_machine = msm8930_cdp_init,
2065 .init_early = msm8930_allocate_memory_regions,
2066 .init_very_early = msm8930_early_memory,
2067MACHINE_END