blob: dfe0b45c7c9bded00869b0a795daabcbd4595227 [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}
Huaibin Yanga5419422011-12-08 23:52:10 -0800329
330static void __init reserve_mdp_memory(void)
331{
332 msm8930_mdp_writeback(msm8930_reserve_table);
333}
334
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800335static void __init msm8930_calculate_reserve_sizes(void)
336{
337 size_pmem_devices();
338 reserve_pmem_memory();
339 reserve_ion_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800340 reserve_mdp_memory();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800341}
342
343static struct reserve_info msm8930_reserve_info __initdata = {
344 .memtype_reserve_table = msm8930_reserve_table,
345 .calculate_reserve_sizes = msm8930_calculate_reserve_sizes,
346 .paddr_to_memtype = msm8930_paddr_to_memtype,
347};
348
349static int msm8930_memory_bank_size(void)
350{
351 return 1<<29;
352}
353
354static void __init locate_unstable_memory(void)
355{
356 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
357 unsigned long bank_size;
358 unsigned long low, high;
359
360 bank_size = msm8930_memory_bank_size();
361 low = meminfo.bank[0].start;
362 high = mb->start + mb->size;
363
364 /* Check if 32 bit overflow occured */
365 if (high < mb->start)
366 high = ~0UL;
367
368 low &= ~(bank_size - 1);
369
370 if (high - low <= bank_size)
371 return;
372 msm8930_reserve_info.low_unstable_address = low + bank_size;
373 /* To avoid overflow of u32 compute max_unstable_size
374 * by first subtracting low from mb->start)
375 * */
376 msm8930_reserve_info.max_unstable_size = (mb->start - low) +
377 mb->size - bank_size;
378
379 msm8930_reserve_info.bank_size = bank_size;
380 pr_info("low unstable address %lx max size %lx bank size %lx\n",
381 msm8930_reserve_info.low_unstable_address,
382 msm8930_reserve_info.max_unstable_size,
383 msm8930_reserve_info.bank_size);
384}
385
386static void __init place_movable_zone(void)
387{
388 movable_reserved_start = msm8930_reserve_info.low_unstable_address;
389 movable_reserved_size = msm8930_reserve_info.max_unstable_size;
390 pr_info("movable zone start %lx size %lx\n",
391 movable_reserved_start, movable_reserved_size);
392}
393
394static void __init msm8930_early_memory(void)
395{
396 reserve_info = &msm8930_reserve_info;
397 locate_unstable_memory();
398 place_movable_zone();
399}
400
401static void __init msm8930_reserve(void)
402{
403 msm_reserve();
404}
405
406static int msm8930_change_memory_power(u64 start, u64 size,
407 int change_type)
408{
409 return soc_change_memory_power(start, size, change_type);
410}
411
412static void __init msm8930_allocate_memory_regions(void)
413{
414 msm8930_allocate_fb_region();
415}
416
417#ifdef CONFIG_WCD9310_CODEC
418
419#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
420
421/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
422 * 4 micbiases are used to power various analog and digital
423 * microphones operating at 1800 mV. Technically, all micbiases
424 * can source from single cfilter since all microphones operate
425 * at the same voltage level. The arrangement below is to make
426 * sure all cfilters are exercised. LDO_H regulator ouput level
427 * does not need to be as high as 2.85V. It is choosen for
428 * microphone sensitivity purpose.
429 */
430static struct tabla_pdata tabla_platform_data = {
431 .slimbus_slave_device = {
432 .name = "tabla-slave",
433 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
434 },
435 .irq = MSM_GPIO_TO_INT(62),
436 .irq_base = TABLA_INTERRUPT_BASE,
437 .num_irqs = NR_TABLA_IRQS,
Jay Chokshi06fa7542011-12-07 13:09:17 -0800438
439/*TODO: Replace this with right PM8038 gpio */
440#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800441 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Jay Chokshi06fa7542011-12-07 13:09:17 -0800442#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800443 .micbias = {
444 .ldoh_v = TABLA_LDOH_2P85_V,
445 .cfilt1_mv = 1800,
446 .cfilt2_mv = 1800,
447 .cfilt3_mv = 1800,
448 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
449 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
450 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
451 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
452 }
453};
454
455static struct slim_device msm_slim_tabla = {
456 .name = "tabla-slim",
457 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
458 .dev = {
459 .platform_data = &tabla_platform_data,
460 },
461};
462
463static struct tabla_pdata tabla20_platform_data = {
464 .slimbus_slave_device = {
465 .name = "tabla-slave",
466 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
467 },
468 .irq = MSM_GPIO_TO_INT(62),
469 .irq_base = TABLA_INTERRUPT_BASE,
470 .num_irqs = NR_TABLA_IRQS,
Jay Chokshi06fa7542011-12-07 13:09:17 -0800471
472/*TODO: Replace this with right PM8038 gpio */
473#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800474 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Jay Chokshi06fa7542011-12-07 13:09:17 -0800475#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800476 .micbias = {
477 .ldoh_v = TABLA_LDOH_2P85_V,
478 .cfilt1_mv = 1800,
479 .cfilt2_mv = 1800,
480 .cfilt3_mv = 1800,
481 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
482 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
483 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
484 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
485 }
486};
487
488static struct slim_device msm_slim_tabla20 = {
489 .name = "tabla2x-slim",
490 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
491 .dev = {
492 .platform_data = &tabla20_platform_data,
493 },
494};
495#endif
496
497static struct slim_boardinfo msm_slim_devices[] = {
498#ifdef CONFIG_WCD9310_CODEC
499 {
500 .bus_num = 1,
501 .slim_slave = &msm_slim_tabla,
502 },
503 {
504 .bus_num = 1,
505 .slim_slave = &msm_slim_tabla20,
506 },
507#endif
508 /* add more slimbus slaves as needed */
509};
510
511#define MSM_WCNSS_PHYS 0x03000000
512#define MSM_WCNSS_SIZE 0x280000
513
514static struct resource resources_wcnss_wlan[] = {
515 {
516 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
517 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
518 .name = "wcnss_wlanrx_irq",
519 .flags = IORESOURCE_IRQ,
520 },
521 {
522 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
523 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
524 .name = "wcnss_wlantx_irq",
525 .flags = IORESOURCE_IRQ,
526 },
527 {
528 .start = MSM_WCNSS_PHYS,
529 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
530 .name = "wcnss_mmio",
531 .flags = IORESOURCE_MEM,
532 },
533 {
534 .start = 84,
535 .end = 88,
536 .name = "wcnss_gpios_5wire",
537 .flags = IORESOURCE_IO,
538 },
539};
540
541static struct qcom_wcnss_opts qcom_wcnss_pdata = {
542 .has_48mhz_xo = 1,
543};
544
545static struct platform_device msm_device_wcnss_wlan = {
546 .name = "wcnss_wlan",
547 .id = 0,
548 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
549 .resource = resources_wcnss_wlan,
550 .dev = {.platform_data = &qcom_wcnss_pdata},
551};
552
553#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
554 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
555 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
556 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
557
558#define QCE_SIZE 0x10000
559#define QCE_0_BASE 0x18500000
560
561#define QCE_HW_KEY_SUPPORT 0
562#define QCE_SHA_HMAC_SUPPORT 1
563#define QCE_SHARE_CE_RESOURCE 1
564#define QCE_CE_SHARED 0
565
566static struct resource qcrypto_resources[] = {
567 [0] = {
568 .start = QCE_0_BASE,
569 .end = QCE_0_BASE + QCE_SIZE - 1,
570 .flags = IORESOURCE_MEM,
571 },
572 [1] = {
573 .name = "crypto_channels",
574 .start = DMOV_CE_IN_CHAN,
575 .end = DMOV_CE_OUT_CHAN,
576 .flags = IORESOURCE_DMA,
577 },
578 [2] = {
579 .name = "crypto_crci_in",
580 .start = DMOV_CE_IN_CRCI,
581 .end = DMOV_CE_IN_CRCI,
582 .flags = IORESOURCE_DMA,
583 },
584 [3] = {
585 .name = "crypto_crci_out",
586 .start = DMOV_CE_OUT_CRCI,
587 .end = DMOV_CE_OUT_CRCI,
588 .flags = IORESOURCE_DMA,
589 },
590};
591
592static struct resource qcedev_resources[] = {
593 [0] = {
594 .start = QCE_0_BASE,
595 .end = QCE_0_BASE + QCE_SIZE - 1,
596 .flags = IORESOURCE_MEM,
597 },
598 [1] = {
599 .name = "crypto_channels",
600 .start = DMOV_CE_IN_CHAN,
601 .end = DMOV_CE_OUT_CHAN,
602 .flags = IORESOURCE_DMA,
603 },
604 [2] = {
605 .name = "crypto_crci_in",
606 .start = DMOV_CE_IN_CRCI,
607 .end = DMOV_CE_IN_CRCI,
608 .flags = IORESOURCE_DMA,
609 },
610 [3] = {
611 .name = "crypto_crci_out",
612 .start = DMOV_CE_OUT_CRCI,
613 .end = DMOV_CE_OUT_CRCI,
614 .flags = IORESOURCE_DMA,
615 },
616};
617
618#endif
619
620#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
621 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
622
623static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
624 .ce_shared = QCE_CE_SHARED,
625 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
626 .hw_key_support = QCE_HW_KEY_SUPPORT,
627 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
628};
629
630static struct platform_device qcrypto_device = {
631 .name = "qcrypto",
632 .id = 0,
633 .num_resources = ARRAY_SIZE(qcrypto_resources),
634 .resource = qcrypto_resources,
635 .dev = {
636 .coherent_dma_mask = DMA_BIT_MASK(32),
637 .platform_data = &qcrypto_ce_hw_suppport,
638 },
639};
640#endif
641
642#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
643 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
644
645static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
646 .ce_shared = QCE_CE_SHARED,
647 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
648 .hw_key_support = QCE_HW_KEY_SUPPORT,
649 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
650};
651
652static struct platform_device qcedev_device = {
653 .name = "qce",
654 .id = 0,
655 .num_resources = ARRAY_SIZE(qcedev_resources),
656 .resource = qcedev_resources,
657 .dev = {
658 .coherent_dma_mask = DMA_BIT_MASK(32),
659 .platform_data = &qcedev_ce_hw_suppport,
660 },
661};
662#endif
663
664#define MDM2AP_ERRFATAL 70
665#define AP2MDM_ERRFATAL 95
666#define MDM2AP_STATUS 69
667#define AP2MDM_STATUS 94
668#define AP2MDM_PMIC_RESET_N 80
669#define AP2MDM_KPDPWR_N 81
670
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800671static struct resource mdm_resources[] = {
672 {
673 .start = MDM2AP_ERRFATAL,
674 .end = MDM2AP_ERRFATAL,
675 .name = "MDM2AP_ERRFATAL",
676 .flags = IORESOURCE_IO,
677 },
678 {
679 .start = AP2MDM_ERRFATAL,
680 .end = AP2MDM_ERRFATAL,
681 .name = "AP2MDM_ERRFATAL",
682 .flags = IORESOURCE_IO,
683 },
684 {
685 .start = MDM2AP_STATUS,
686 .end = MDM2AP_STATUS,
687 .name = "MDM2AP_STATUS",
688 .flags = IORESOURCE_IO,
689 },
690 {
691 .start = AP2MDM_STATUS,
692 .end = AP2MDM_STATUS,
693 .name = "AP2MDM_STATUS",
694 .flags = IORESOURCE_IO,
695 },
696 {
697 .start = AP2MDM_PMIC_RESET_N,
698 .end = AP2MDM_PMIC_RESET_N,
699 .name = "AP2MDM_PMIC_RESET_N",
700 .flags = IORESOURCE_IO,
701 },
702 {
703 .start = AP2MDM_KPDPWR_N,
704 .end = AP2MDM_KPDPWR_N,
705 .name = "AP2MDM_KPDPWR_N",
706 .flags = IORESOURCE_IO,
707 },
708};
709
710static struct mdm_platform_data mdm_platform_data = {
711 .mdm_version = "2.5",
712};
713
714static struct platform_device mdm_device = {
715 .name = "mdm2_modem",
716 .id = -1,
717 .num_resources = ARRAY_SIZE(mdm_resources),
718 .resource = mdm_resources,
719 .dev = {
720 .platform_data = &mdm_platform_data,
721 },
722};
723
724static struct platform_device *mdm_devices[] __initdata = {
725 &mdm_device,
726};
727
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800728#define MSM_SHARED_RAM_PHYS 0x80000000
729
730static void __init msm8930_map_io(void)
731{
732 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
733 msm_map_msm8930_io();
734
735 if (socinfo_init() < 0)
736 pr_err("socinfo_init() failed!\n");
737}
738
739static void __init msm8930_init_irq(void)
740{
741 unsigned int i;
742
743 msm_mpm_irq_extn_init();
744 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
745 (void *)MSM_QGIC_CPU_BASE);
746
747 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
748 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
749
750 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
751 mb();
752
753 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
754 * as they are configured as level, which does not play nice with
755 * handle_percpu_irq.
756 */
757 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
758 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
759 irq_set_handler(i, handle_percpu_irq);
760 }
761}
762
763static void __init msm8930_init_buses(void)
764{
765#ifdef CONFIG_MSM_BUS_SCALING
766 msm_bus_rpm_set_mt_mask();
767 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
768 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
769 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
770 msm_bus_apps_fabric.dev.platform_data =
771 &msm_bus_8960_apps_fabric_pdata;
772 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
773 msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
774 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
775 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
776#endif
777}
778
779static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
780 .max_clock_speed = 15060000,
781};
782
783#ifdef CONFIG_USB_MSM_OTG_72K
784static struct msm_otg_platform_data msm_otg_pdata;
785#else
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800786static void msm_hsusb_vbus_power(bool on)
787{
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800788 static bool vbus_is_on;
789 static struct regulator *mvs_otg_switch;
790
791 if (vbus_is_on == on)
792 return;
793
794 if (on) {
795 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
796 "vbus_otg");
797 if (IS_ERR(mvs_otg_switch)) {
798 pr_err("Unable to get mvs_otg_switch\n");
799 return;
800 }
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800801
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800802 if (regulator_enable(mvs_otg_switch)) {
803 pr_err("unable to enable mvs_otg_switch\n");
David Collins57954fa2011-12-15 09:14:40 -0800804 goto put_mvs_otg;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800805 }
806
807 vbus_is_on = true;
808 return;
809 }
810 regulator_disable(mvs_otg_switch);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800811put_mvs_otg:
812 regulator_put(mvs_otg_switch);
813 vbus_is_on = false;
814}
815
816static struct msm_otg_platform_data msm_otg_pdata = {
817 .mode = USB_OTG,
818 .otg_control = OTG_PMIC_CONTROL,
819 .phy_type = SNPS_28NM_INTEGRATED_PHY,
820 .pclk_src_name = "dfab_usb_hs_clk",
Jay Chokshi06fa7542011-12-07 13:09:17 -0800821 .pmic_id_irq = PM8038_USB_ID_IN_IRQ(PM8038_IRQ_BASE),
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800822 .vbus_power = msm_hsusb_vbus_power,
823 .power_budget = 750,
824};
825#endif
826
827#ifdef CONFIG_USB_EHCI_MSM_HSIC
828#define HSIC_HUB_RESET_GPIO 91
829static struct msm_hsic_host_platform_data msm_hsic_pdata = {
830 .strobe = 150,
831 .data = 151,
832};
833#else
834static struct msm_hsic_host_platform_data msm_hsic_pdata;
835#endif
836
837#define PID_MAGIC_ID 0x71432909
838#define SERIAL_NUM_MAGIC_ID 0x61945374
839#define SERIAL_NUMBER_LENGTH 127
840#define DLOAD_USB_BASE_ADD 0x2A03F0C8
841
842struct magic_num_struct {
843 uint32_t pid;
844 uint32_t serial_num;
845};
846
847struct dload_struct {
848 uint32_t reserved1;
849 uint32_t reserved2;
850 uint32_t reserved3;
851 uint16_t reserved4;
852 uint16_t pid;
853 char serial_number[SERIAL_NUMBER_LENGTH];
854 uint16_t reserved5;
855 struct magic_num_struct magic_struct;
856};
857
858static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
859{
860 struct dload_struct __iomem *dload = 0;
861
862 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
863 if (!dload) {
864 pr_err("%s: cannot remap I/O memory region: %08x\n",
865 __func__, DLOAD_USB_BASE_ADD);
866 return -ENXIO;
867 }
868
869 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
870 __func__, dload, pid, snum);
871 /* update pid */
872 dload->magic_struct.pid = PID_MAGIC_ID;
873 dload->pid = pid;
874
875 /* update serial number */
876 dload->magic_struct.serial_num = 0;
877 if (!snum) {
878 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
879 goto out;
880 }
881
882 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
883 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
884out:
885 iounmap(dload);
886 return 0;
887}
888
889static struct android_usb_platform_data android_usb_pdata = {
890 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
891};
892
893static struct platform_device android_usb_device = {
894 .name = "android_usb",
895 .id = -1,
896 .dev = {
897 .platform_data = &android_usb_pdata,
898 },
899};
900
901static uint8_t spm_wfi_cmd_sequence[] __initdata = {
902 0x03, 0x0f,
903};
904
905static uint8_t spm_power_collapse_without_rpm[] __initdata = {
906 0x00, 0x24, 0x54, 0x10,
907 0x09, 0x03, 0x01,
908 0x10, 0x54, 0x30, 0x0C,
909 0x24, 0x30, 0x0f,
910};
911
912static uint8_t spm_power_collapse_with_rpm[] __initdata = {
913 0x00, 0x24, 0x54, 0x10,
914 0x09, 0x07, 0x01, 0x0B,
915 0x10, 0x54, 0x30, 0x0C,
916 0x24, 0x30, 0x0f,
917};
918
919static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
920 [0] = {
921 .mode = MSM_SPM_MODE_CLOCK_GATING,
922 .notify_rpm = false,
923 .cmd = spm_wfi_cmd_sequence,
924 },
925 [1] = {
926 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
927 .notify_rpm = false,
928 .cmd = spm_power_collapse_without_rpm,
929 },
930 [2] = {
931 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
932 .notify_rpm = true,
933 .cmd = spm_power_collapse_with_rpm,
934 },
935};
936
937static struct msm_spm_platform_data msm_spm_data[] __initdata = {
938 [0] = {
939 .reg_base_addr = MSM_SAW0_BASE,
940 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
941 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
942 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
943#if defined(CONFIG_MSM_AVS_HW)
944 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
945 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
946#endif
947 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
948 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
949 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
950 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
951 .vctl_timeout_us = 50,
952 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
953 .modes = msm_spm_seq_list,
954 },
955 [1] = {
956 .reg_base_addr = MSM_SAW1_BASE,
957 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
958 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
959 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
960#if defined(CONFIG_MSM_AVS_HW)
961 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
962 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
963#endif
964 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
965 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
966 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
967 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
968 .vctl_timeout_us = 50,
969 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
970 .modes = msm_spm_seq_list,
971 },
972};
973
974static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
975 0x00, 0x20, 0x03, 0x20,
976 0x00, 0x0f,
977};
978
979static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
980 0x00, 0x20, 0x34, 0x64,
981 0x48, 0x07, 0x48, 0x20,
982 0x50, 0x64, 0x04, 0x34,
983 0x50, 0x0f,
984};
985static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
986 0x00, 0x10, 0x34, 0x64,
987 0x48, 0x07, 0x48, 0x10,
988 0x50, 0x64, 0x04, 0x34,
989 0x50, 0x0F,
990};
991
992static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
993 [0] = {
994 .mode = MSM_SPM_L2_MODE_RETENTION,
995 .notify_rpm = false,
996 .cmd = l2_spm_wfi_cmd_sequence,
997 },
998 [1] = {
999 .mode = MSM_SPM_L2_MODE_GDHS,
1000 .notify_rpm = true,
1001 .cmd = l2_spm_gdhs_cmd_sequence,
1002 },
1003 [2] = {
1004 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1005 .notify_rpm = true,
1006 .cmd = l2_spm_power_off_cmd_sequence,
1007 },
1008};
1009
1010static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1011 [0] = {
1012 .reg_base_addr = MSM_SAW_L2_BASE,
1013 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1014 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
1015 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1016 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1017 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1018 .modes = msm_spm_l2_seq_list,
1019 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1020 },
1021};
1022
Jay Chokshi06fa7542011-12-07 13:09:17 -08001023#/* TODO: Remove this once PM8038 physically becomes
1024 * available.
1025 */
1026#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001027#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1028#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
Jay Chokshi06fa7542011-12-07 13:09:17 -08001029#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001030
1031static struct msm_xo_voter *xo_handle_d1;
1032
1033static int isa1200_power(int on)
1034{
1035 int rc = 0;
1036
1037 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !!on);
1038
1039 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
1040 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
1041 if (rc < 0) {
1042 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
1043 __func__, on ? "" : "de-", rc);
1044 goto err_xo_vote;
1045 }
1046
1047 return 0;
1048
1049err_xo_vote:
1050 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !on);
1051 return rc;
1052}
1053
1054static int isa1200_dev_setup(bool enable)
1055{
1056 int rc = 0;
1057
1058 struct pm_gpio hap_gpio_config = {
1059 .direction = PM_GPIO_DIR_OUT,
1060 .pull = PM_GPIO_PULL_NO,
1061 .out_strength = PM_GPIO_STRENGTH_HIGH,
1062 .function = PM_GPIO_FUNC_NORMAL,
1063 .inv_int_pol = 0,
1064 .vin_sel = 2,
1065 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1066 .output_value = 0,
1067 };
1068
1069 if (enable == true) {
1070 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
1071 if (rc) {
1072 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1073 __func__, PM_HAP_EN_GPIO, rc);
1074 return rc;
1075 }
1076
1077 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
1078 if (rc) {
1079 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1080 __func__, PM_HAP_LEN_GPIO, rc);
1081 return rc;
1082 }
1083
1084 rc = gpio_request(HAP_SHIFT_LVL_OE_GPIO, "hap_shft_lvl_oe");
1085 if (rc) {
1086 pr_err("%s: unable to request gpio %d (%d)\n",
1087 __func__, HAP_SHIFT_LVL_OE_GPIO, rc);
1088 return rc;
1089 }
1090
1091 rc = gpio_direction_output(HAP_SHIFT_LVL_OE_GPIO, 0);
1092 if (rc) {
1093 pr_err("%s: Unable to set direction\n", __func__);
1094 goto free_gpio;
1095 }
1096
1097 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
1098 if (IS_ERR(xo_handle_d1)) {
1099 rc = PTR_ERR(xo_handle_d1);
1100 pr_err("%s: failed to get the handle for D1(%d)\n",
1101 __func__, rc);
1102 goto gpio_set_dir;
1103 }
1104 } else {
1105 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1106
1107 msm_xo_put(xo_handle_d1);
1108 }
1109
1110 return 0;
1111
1112gpio_set_dir:
1113 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, 0);
1114free_gpio:
1115 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1116 return rc;
1117}
1118
1119static struct isa1200_regulator isa1200_reg_data[] = {
1120 {
1121 .name = "vcc_i2c",
1122 .min_uV = ISA_I2C_VTG_MIN_UV,
1123 .max_uV = ISA_I2C_VTG_MAX_UV,
1124 .load_uA = ISA_I2C_CURR_UA,
1125 },
1126};
1127
1128static struct isa1200_platform_data isa1200_1_pdata = {
1129 .name = "vibrator",
1130 .dev_setup = isa1200_dev_setup,
1131 .power_on = isa1200_power,
1132 .hap_en_gpio = PM_HAP_EN_GPIO,
1133 .hap_len_gpio = PM_HAP_LEN_GPIO,
1134 .max_timeout = 15000,
1135 .mode_ctrl = PWM_GEN_MODE,
1136 .pwm_fd = {
1137 .pwm_div = 256,
1138 },
1139 .is_erm = false,
1140 .smart_en = true,
1141 .ext_clk_en = true,
1142 .chip_en = 1,
1143 .regulator_info = isa1200_reg_data,
1144 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1145};
1146
1147static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1148 {
1149 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1150 .platform_data = &isa1200_1_pdata,
1151 },
1152};
1153
1154#define CYTTSP_TS_GPIO_IRQ 11
1155#define CYTTSP_TS_SLEEP_GPIO 50
1156#define CYTTSP_TS_RESOUT_N_GPIO 52
1157
1158/*virtual key support */
1159static ssize_t tma340_vkeys_show(struct kobject *kobj,
1160 struct kobj_attribute *attr, char *buf)
1161{
1162 return snprintf(buf, 200,
1163 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1164 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1165 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1166 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1167 "\n");
1168}
1169
1170static struct kobj_attribute tma340_vkeys_attr = {
1171 .attr = {
1172 .mode = S_IRUGO,
1173 },
1174 .show = &tma340_vkeys_show,
1175};
1176
1177static struct attribute *tma340_properties_attrs[] = {
1178 &tma340_vkeys_attr.attr,
1179 NULL
1180};
1181
1182static struct attribute_group tma340_properties_attr_group = {
1183 .attrs = tma340_properties_attrs,
1184};
1185
1186
1187static int cyttsp_platform_init(struct i2c_client *client)
1188{
1189 int rc = 0;
1190 static struct kobject *tma340_properties_kobj;
1191
1192 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1193 tma340_properties_kobj = kobject_create_and_add("board_properties",
1194 NULL);
1195 if (tma340_properties_kobj)
1196 rc = sysfs_create_group(tma340_properties_kobj,
1197 &tma340_properties_attr_group);
1198 if (!tma340_properties_kobj || rc)
1199 pr_err("%s: failed to create board_properties\n",
1200 __func__);
1201
1202 return 0;
1203}
1204
1205static struct cyttsp_regulator regulator_data[] = {
1206 {
1207 .name = "vdd",
1208 .min_uV = CY_TMA300_VTG_MIN_UV,
1209 .max_uV = CY_TMA300_VTG_MAX_UV,
1210 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1211 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
1212 },
1213 /* TODO: Remove after runtime PM is enabled in I2C driver */
1214 {
1215 .name = "vcc_i2c",
1216 .min_uV = CY_I2C_VTG_MIN_UV,
1217 .max_uV = CY_I2C_VTG_MAX_UV,
1218 .hpm_load_uA = CY_I2C_CURR_UA,
1219 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
1220 },
1221};
1222
1223static struct cyttsp_platform_data cyttsp_pdata = {
1224 .panel_maxx = 634,
1225 .panel_maxy = 1166,
1226 .disp_maxx = 616,
1227 .disp_maxy = 1023,
1228 .disp_minx = 0,
1229 .disp_miny = 16,
1230 .flags = 0x01,
1231 .gen = CY_GEN3, /* or */
1232 .use_st = CY_USE_ST,
1233 .use_mt = CY_USE_MT,
1234 .use_hndshk = CY_SEND_HNDSHK,
1235 .use_trk_id = CY_USE_TRACKING_ID,
1236 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
1237 .use_gestures = CY_USE_GESTURES,
1238 .fw_fname = "cyttsp_8960_cdp.hex",
1239 /* activate up to 4 groups
1240 * and set active distance
1241 */
1242 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
1243 CY_GEST_GRP3 | CY_GEST_GRP4 |
1244 CY_ACT_DIST,
1245 /* change act_intrvl to customize the Active power state
1246 * scanning/processing refresh interval for Operating mode
1247 */
1248 .act_intrvl = CY_ACT_INTRVL_DFLT,
1249 /* change tch_tmout to customize the touch timeout for the
1250 * Active power state for Operating mode
1251 */
1252 .tch_tmout = CY_TCH_TMOUT_DFLT,
1253 /* change lp_intrvl to customize the Low Power power state
1254 * scanning/processing refresh interval for Operating mode
1255 */
1256 .lp_intrvl = CY_LP_INTRVL_DFLT,
1257 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
1258 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
1259 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1260 .regulator_info = regulator_data,
1261 .num_regulators = ARRAY_SIZE(regulator_data),
1262 .init = cyttsp_platform_init,
1263 .correct_fw_ver = 9,
1264};
1265
1266static struct i2c_board_info cyttsp_info[] __initdata = {
1267 {
1268 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1269 .platform_data = &cyttsp_pdata,
1270#ifndef CY_USE_TIMER
1271 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1272#endif /* CY_USE_TIMER */
1273 },
1274};
1275
Amy Malochef3c9db42011-12-08 15:17:35 -08001276#define MXT_TS_GPIO_IRQ 11
1277#define MXT_TS_RESET_GPIO 52
1278
1279static const u8 mxt_config_data_8930[] = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001280 /* T6 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001281 0, 0, 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001282 /* T38 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001283 15, 1, 0, 15, 12, 11, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001284 /* T7 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001285 48, 255, 25,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001286 /* T8 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001287 27, 0, 5, 1, 0, 0, 8, 8, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001288 /* T9 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001289 131, 0, 0, 19, 11, 0, 16, 35, 1, 3,
1290 10, 15, 1, 11, 4, 5, 40, 10, 54, 2,
1291 43, 4, 0, 0, 0, 0, 143, 40, 143, 80,
1292 18, 15, 50, 50, 2,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001293 /* T15 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001294 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1295 0,
1296 /* T18 Object */
1297 0, 0,
1298 /* T19 Object */
1299 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1300 0, 0, 0, 0, 0, 0,
1301 /* T23 Object */
1302 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1303 0, 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001304 /* T25 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001305 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1306 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001307 /* T40 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001308 0, 0, 0, 0, 0,
1309 /* T42 Object */
1310 0, 0, 0, 0, 0, 0, 0, 0,
1311 /* T46 Object */
1312 0, 3, 16, 48, 0, 0, 1, 0, 0,
1313 /* T47 Object */
1314 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1315 /* T48 Object */
1316 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1317 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1318 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1319 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1320 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1321 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001322};
1323
Amy Malochef3c9db42011-12-08 15:17:35 -08001324static ssize_t mxt224e_vkeys_show(struct kobject *kobj,
1325 struct kobj_attribute *attr, char *buf)
1326{
1327 return snprintf(buf, 200,
1328 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":65:938:90:90"
1329 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":208:938:90:90"
1330 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":348:938:90:90"
1331 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":490:938:90:90"
1332 "\n");
1333}
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001334
Amy Malochef3c9db42011-12-08 15:17:35 -08001335static struct kobj_attribute mxt224e_vkeys_attr = {
1336 .attr = {
1337 .mode = S_IRUGO,
1338 },
1339 .show = &mxt224e_vkeys_show,
1340};
1341
1342static struct attribute *mxt224e_properties_attrs[] = {
1343 &mxt224e_vkeys_attr.attr,
1344 NULL
1345};
1346
1347static struct attribute_group mxt224e_properties_attr_group = {
1348 .attrs = mxt224e_properties_attrs,
1349};
1350
1351static void mxt_init_vkeys_8930(void)
1352{
1353 int rc;
1354 static struct kobject *mxt224e_properties_kobj;
1355
1356 mxt224e_vkeys_attr.attr.name = "virtualkeys.atmel_mxt_ts";
1357 mxt224e_properties_kobj = kobject_create_and_add("board_properties",
1358 NULL);
1359 if (mxt224e_properties_kobj)
1360 rc = sysfs_create_group(mxt224e_properties_kobj,
1361 &mxt224e_properties_attr_group);
1362 if (!mxt224e_properties_kobj || rc)
1363 pr_err("%s: failed to create board_properties\n",
1364 __func__);
1365
1366 return;
1367}
1368
1369static struct mxt_platform_data mxt_platform_data_8930 = {
1370 .config = mxt_config_data_8930,
1371 .config_length = ARRAY_SIZE(mxt_config_data_8930),
1372 .x_size = 1067,
1373 .y_size = 566,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001374 .irqflags = IRQF_TRIGGER_FALLING,
1375 .i2c_pull_up = true,
Amy Malochef3c9db42011-12-08 15:17:35 -08001376 .reset_gpio = MXT_TS_RESET_GPIO,
1377 .irq_gpio = MXT_TS_GPIO_IRQ,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001378};
1379
Amy Malochef3c9db42011-12-08 15:17:35 -08001380static struct i2c_board_info mxt_device_info_8930[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001381 {
Amy Malochef3c9db42011-12-08 15:17:35 -08001382 I2C_BOARD_INFO("atmel_mxt_ts", 0x4a),
1383 .platform_data = &mxt_platform_data_8930,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001384 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1385 },
1386};
1387
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001388static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
1389 .clk_freq = 100000,
1390 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001391};
1392
1393static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
1394 .clk_freq = 100000,
1395 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001396};
1397
1398static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
1399 .clk_freq = 100000,
1400 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001401};
1402
1403static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
1404 .clk_freq = 100000,
1405 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001406};
1407
1408static struct msm_rpm_platform_data msm_rpm_data = {
1409 .reg_base_addrs = {
1410 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
1411 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
1412 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
1413 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
1414 },
1415
1416 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
1417 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
1418 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1419 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
1420 .msm_apps_ipc_rpm_val = 4,
1421};
1422
1423static struct ks8851_pdata spi_eth_pdata = {
1424 .irq_gpio = KS8851_IRQ_GPIO,
1425 .rst_gpio = KS8851_RST_GPIO,
1426};
1427
1428static struct spi_board_info spi_board_info[] __initdata = {
1429 {
1430 .modalias = "ks8851",
1431 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1432 .max_speed_hz = 19200000,
1433 .bus_num = 0,
1434 .chip_select = 0,
1435 .mode = SPI_MODE_0,
1436 .platform_data = &spi_eth_pdata
1437 },
1438 {
1439 .modalias = "dsi_novatek_3d_panel_spi",
1440 .max_speed_hz = 10800000,
1441 .bus_num = 0,
1442 .chip_select = 1,
1443 .mode = SPI_MODE_0,
1444 },
1445};
1446
1447static struct platform_device msm_device_saw_core0 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001448 .name = "saw-regulator",
1449 .id = 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001450 .dev = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001451 /*
1452 * TODO: When physical 8930/PM8038 hardware becomes
1453 * available, replace msm_saw_regulator_pdata_s5
1454 * with 8930 saw regulator object.
1455 */
1456#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001457 .platform_data = &msm_saw_regulator_pdata_s5,
Jay Chokshi06fa7542011-12-07 13:09:17 -08001458#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001459 },
1460};
1461
1462static struct platform_device msm_device_saw_core1 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001463 .name = "saw-regulator",
1464 .id = 1,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001465 .dev = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001466 /*
1467 * TODO: When physical 8930/PM8038 hardware becomes
1468 * available, replace msm_saw_regulator_pdata_s5
1469 * with 8930 saw regulator object.
1470 */
1471#if !defined(MSM8930_PHASE_2)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001472 .platform_data = &msm_saw_regulator_pdata_s6,
Jay Chokshi06fa7542011-12-07 13:09:17 -08001473#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001474 },
1475};
1476
1477static struct tsens_platform_data msm_tsens_pdata = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001478 .slope = 910,
1479 .tsens_factor = 1000,
1480 .hw_type = MSM_8960,
1481 .tsens_num_sensor = 5,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001482};
1483
1484static struct platform_device msm_tsens_device = {
1485 .name = "tsens8960-tm",
1486 .id = -1,
1487 .dev = {
1488 .platform_data = &msm_tsens_pdata,
1489 },
1490};
1491
1492#ifdef CONFIG_MSM_FAKE_BATTERY
1493static struct platform_device fish_battery_device = {
1494 .name = "fish_battery",
1495};
1496#endif
1497
Jay Chokshi06fa7542011-12-07 13:09:17 -08001498static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001499 .name = GPIO_REGULATOR_DEV_NAME,
Jay Chokshi06fa7542011-12-07 13:09:17 -08001500/* TODO: Replace this with right MPP for 8038 */
1501#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001502 .id = PM8921_MPP_PM_TO_SYS(7),
Jay Chokshi06fa7542011-12-07 13:09:17 -08001503#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001504 .dev = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001505 /*
1506 * TODO: When physical 8930/PM8038 hardware becomes
1507 * available, replace msm_gpio_regulator_pdata
1508 * with 8930 gpio regulator object.
1509 */
1510#if !defined(MSM8930_PHASE_2)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001511 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
Jay Chokshi06fa7542011-12-07 13:09:17 -08001512#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001513 },
1514};
1515
Jay Chokshi06fa7542011-12-07 13:09:17 -08001516static struct platform_device msm8930_device_ext_l2_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001517 .name = GPIO_REGULATOR_DEV_NAME,
1518 .id = 91,
1519 .dev = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001520 /*
1521 * TODO: When physical 8930/PM8038 hardware becomes
1522 * available, replace msm_gpio_regulator_pdata
1523 * with 8930 gpio regulator object.
1524 */
1525#if !defined(MSM8930_PHASE_2)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001526 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
Jay Chokshi06fa7542011-12-07 13:09:17 -08001527#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001528 },
1529};
1530
Jay Chokshi06fa7542011-12-07 13:09:17 -08001531static struct platform_device msm8930_device_rpm_regulator __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001532 .name = "rpm-regulator",
1533 .id = -1,
1534 .dev = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001535 /*
1536 * TODO: When physical 8930/PM8038 hardware becomes
1537 * available, replace msm_rpm_regulator_pdata
1538 * with 8930 rpm regulator object.
1539 */
1540#if !defined(MSM8930_PHASE_2)
1541
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001542 .platform_data = &msm_rpm_regulator_pdata,
Jay Chokshi06fa7542011-12-07 13:09:17 -08001543#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001544 },
1545};
1546
1547static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
1548 .phys_addr_base = 0x0010C000,
1549 .reg_offsets = {
1550 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
1551 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
1552 },
1553 .phys_size = SZ_8K,
1554 .log_len = 4096, /* log's buffer length in bytes */
1555 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
1556};
1557
1558static struct platform_device msm_rpm_log_device = {
1559 .name = "msm_rpm_log",
1560 .id = -1,
1561 .dev = {
1562 .platform_data = &msm_rpm_log_pdata,
1563 },
1564};
1565
1566static struct platform_device *common_devices[] __initdata = {
1567 &msm8960_device_dmov,
1568 &msm_device_smd,
1569 &msm8960_device_uart_gsbi5,
1570 &msm_device_uart_dm6,
1571 &msm_device_saw_core0,
1572 &msm_device_saw_core1,
Jay Chokshi06fa7542011-12-07 13:09:17 -08001573 &msm8930_device_ext_5v_vreg,
1574 &msm8930_device_ext_l2_vreg,
Jay Chokshi33c044a2011-12-07 13:05:40 -08001575 &msm8960_device_ssbi_pmic,
Stephen Boyd28d54952011-12-16 13:19:51 -08001576 &msm_8960_q6_lpass,
1577 &msm_8960_q6_mss_fw,
1578 &msm_8960_q6_mss_sw,
Stephen Boyd322a9922011-09-20 01:05:54 -07001579 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07001580 &msm_pil_tzapps,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001581 &msm8960_device_qup_spi_gsbi1,
1582 &msm8960_device_qup_i2c_gsbi3,
1583 &msm8960_device_qup_i2c_gsbi4,
1584 &msm8960_device_qup_i2c_gsbi10,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001585 &msm8960_device_qup_i2c_gsbi12,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001586 &msm_slim_ctrl,
1587 &msm_device_wcnss_wlan,
1588#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1589 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1590 &qcrypto_device,
1591#endif
1592
1593#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1594 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1595 &qcedev_device,
1596#endif
1597#ifdef CONFIG_MSM_ROTATOR
1598 &msm_rotator_device,
1599#endif
1600 &msm_device_sps,
1601#ifdef CONFIG_MSM_FAKE_BATTERY
1602 &fish_battery_device,
1603#endif
1604#ifdef CONFIG_ANDROID_PMEM
1605#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
1606 &android_pmem_device,
1607 &android_pmem_adsp_device,
1608#endif
1609 &android_pmem_audio_device,
1610#endif
1611 &msm_device_vidc,
1612 &msm_device_bam_dmux,
1613 &msm_fm_platform_init,
1614
1615#ifdef CONFIG_HW_RANDOM_MSM
1616 &msm_device_rng,
1617#endif
1618 &msm_rpm_device,
1619#ifdef CONFIG_ION_MSM
1620 &ion_dev,
1621#endif
1622 &msm_rpm_log_device,
1623 &msm_rpm_stat_device,
1624 &msm_device_tz_log,
1625
1626#ifdef CONFIG_MSM_QDSS
1627 &msm_etb_device,
1628 &msm_tpiu_device,
1629 &msm_funnel_device,
1630 &msm_debug_device,
1631 &msm_ptm_device,
1632#endif
1633 &msm_device_dspcrashd_8960,
1634 &msm8960_device_watchdog,
1635};
1636
1637static struct platform_device *cdp_devices[] __initdata = {
1638 &msm8960_device_otg,
1639 &msm8960_device_gadget_peripheral,
1640 &msm_device_hsusb_host,
1641 &android_usb_device,
1642 &msm_pcm,
1643 &msm_pcm_routing,
1644 &msm_cpudai0,
1645 &msm_cpudai1,
1646 &msm_cpudai_hdmi_rx,
1647 &msm_cpudai_bt_rx,
1648 &msm_cpudai_bt_tx,
1649 &msm_cpudai_fm_rx,
1650 &msm_cpudai_fm_tx,
1651 &msm_cpudai_auxpcm_rx,
1652 &msm_cpudai_auxpcm_tx,
1653 &msm_cpu_fe,
1654 &msm_stub_codec,
1655 &msm_kgsl_3d0,
1656#ifdef CONFIG_MSM_KGSL_2D
1657 &msm_kgsl_2d0,
1658 &msm_kgsl_2d1,
1659#endif
1660#ifdef CONFIG_MSM_GEMINI
1661 &msm8960_gemini_device,
1662#endif
1663 &msm_voice,
1664 &msm_voip,
1665 &msm_lpa_pcm,
1666 &msm_cpudai_afe_01_rx,
1667 &msm_cpudai_afe_01_tx,
1668 &msm_cpudai_afe_02_rx,
1669 &msm_cpudai_afe_02_tx,
1670 &msm_pcm_afe,
1671 &msm_pcm_hostless,
1672 &msm_bus_apps_fabric,
1673 &msm_bus_sys_fabric,
1674 &msm_bus_mm_fabric,
1675 &msm_bus_sys_fpb,
1676 &msm_bus_cpss_fpb,
1677 &msm_tsens_device,
1678};
1679
1680static void __init msm8930_i2c_init(void)
1681{
1682 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
1683 &msm8960_i2c_qup_gsbi4_pdata;
1684
1685 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
1686 &msm8960_i2c_qup_gsbi3_pdata;
1687
1688 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
1689 &msm8960_i2c_qup_gsbi10_pdata;
1690
1691 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
1692 &msm8960_i2c_qup_gsbi12_pdata;
1693}
1694
1695static void __init msm8930_gfx_init(void)
1696{
1697 uint32_t soc_platform_version = socinfo_get_version();
1698 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
1699 struct kgsl_device_platform_data *kgsl_3d0_pdata =
1700 msm_kgsl_3d0.dev.platform_data;
1701 kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
1702 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
1703 }
1704}
1705
1706static struct msm_cpuidle_state msm_cstates[] __initdata = {
1707 {0, 0, "C0", "WFI",
1708 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1709
1710 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1711 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1712
1713 {0, 2, "C2", "POWER_COLLAPSE",
1714 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
1715
1716 {1, 0, "C0", "WFI",
1717 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1718
1719 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1720 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1721};
1722
1723static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
1724 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1725 .idle_supported = 1,
1726 .suspend_supported = 1,
1727 .idle_enabled = 0,
1728 .suspend_enabled = 0,
1729 },
1730
1731 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1732 .idle_supported = 1,
1733 .suspend_supported = 1,
1734 .idle_enabled = 0,
1735 .suspend_enabled = 0,
1736 },
1737
1738 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1739 .idle_supported = 1,
1740 .suspend_supported = 1,
1741 .idle_enabled = 1,
1742 .suspend_enabled = 1,
1743 },
1744
1745 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1746 .idle_supported = 0,
1747 .suspend_supported = 1,
1748 .idle_enabled = 0,
1749 .suspend_enabled = 0,
1750 },
1751
1752 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1753 .idle_supported = 1,
1754 .suspend_supported = 1,
1755 .idle_enabled = 0,
1756 .suspend_enabled = 0,
1757 },
1758
1759 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1760 .idle_supported = 1,
1761 .suspend_supported = 0,
1762 .idle_enabled = 1,
1763 .suspend_enabled = 0,
1764 },
1765};
1766
1767static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
1768 {
1769 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1770 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1771 true,
1772 100, 8000, 100000, 1,
1773 },
1774
1775 {
1776 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1777 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1778 true,
1779 2000, 6000, 60100000, 3000,
1780 },
1781
1782 {
1783 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1784 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1785 false,
1786 4200, 5000, 60350000, 3500,
1787 },
1788
1789 {
1790 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1791 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
1792 false,
1793 6300, 4500, 65350000, 4800,
1794 },
1795 {
1796 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1797 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
1798 false,
1799 7000, 3500, 66600000, 5150,
1800 },
1801
1802 {
1803 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1804 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1805 false,
1806 11700, 2500, 67850000, 5500,
1807 },
1808
1809 {
1810 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1811 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1812 false,
1813 13800, 2000, 71850000, 6800,
1814 },
1815
1816 {
1817 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1818 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1819 false,
1820 29700, 500, 75850000, 8800,
1821 },
1822
1823 {
1824 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1825 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1826 false,
1827 29700, 0, 76350000, 9800,
1828 },
1829};
1830
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06001831static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1832 .mode = MSM_PM_BOOT_CONFIG_TZ,
1833};
1834
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001835#ifdef CONFIG_I2C
1836#define I2C_SURF 1
1837#define I2C_FFA (1 << 1)
1838#define I2C_RUMI (1 << 2)
1839#define I2C_SIM (1 << 3)
1840#define I2C_FLUID (1 << 4)
1841#define I2C_LIQUID (1 << 5)
1842
1843struct i2c_registry {
1844 u8 machs;
1845 int bus;
1846 struct i2c_board_info *info;
1847 int len;
1848};
1849
1850#ifdef CONFIG_MSM_CAMERA
1851static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
1852#ifdef CONFIG_IMX074
1853 {
1854 I2C_BOARD_INFO("imx074", 0x1A),
1855 },
1856#endif
1857#ifdef CONFIG_OV2720
1858 {
1859 I2C_BOARD_INFO("ov2720", 0x6C),
1860 },
1861#endif
1862#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
1863 {
1864 I2C_BOARD_INFO("sc628a", 0x6E),
1865 },
1866#endif
1867};
1868#endif
1869
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001870static void __init msm8930_init_hsic(void)
1871{
1872#ifdef CONFIG_USB_EHCI_MSM_HSIC
1873 uint32_t version = socinfo_get_version();
1874
1875 pr_info("%s: version:%d mtp:%d\n", __func__,
1876 SOCINFO_VERSION_MAJOR(version),
1877 machine_is_msm8930_mtp());
1878
1879 if ((SOCINFO_VERSION_MAJOR(version) == 1) ||
1880 machine_is_msm8930_mtp() ||
1881 machine_is_msm8930_fluid())
1882 return;
1883
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001884 platform_device_register(&msm_device_hsic_host);
1885#endif
1886}
1887
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001888#ifdef CONFIG_ISL9519_CHARGER
1889static struct isl_platform_data isl_data __initdata = {
1890 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
1891 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
1892 .max_system_voltage = 4200,
1893 .min_system_voltage = 3200,
1894 .chgcurrent = 1000, /* 1900, */
1895 .term_current = 400, /* Need fine tuning */
1896 .input_current = 2048,
1897};
1898
1899static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
1900 {
1901 I2C_BOARD_INFO("isl9519q", 0x9),
1902 .irq = 0, /* Not required when notify-by-pmic */
1903 .platform_data = &isl_data,
1904 },
1905};
1906#endif /* CONFIG_ISL9519_CHARGER */
1907
1908static struct i2c_registry msm8960_i2c_devices[] __initdata = {
1909#ifdef CONFIG_MSM_CAMERA
1910 {
1911 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
1912 MSM_8930_GSBI4_QUP_I2C_BUS_ID,
1913 msm_camera_boardinfo,
1914 ARRAY_SIZE(msm_camera_boardinfo),
1915 },
1916#endif
1917#ifdef CONFIG_ISL9519_CHARGER
1918 {
1919 I2C_LIQUID,
1920 MSM_8930_GSBI10_QUP_I2C_BUS_ID,
1921 isl_charger_i2c_info,
1922 ARRAY_SIZE(isl_charger_i2c_info),
1923 },
1924#endif /* CONFIG_ISL9519_CHARGER */
1925 {
1926 I2C_SURF | I2C_FFA | I2C_FLUID,
1927 MSM_8930_GSBI3_QUP_I2C_BUS_ID,
1928 cyttsp_info,
1929 ARRAY_SIZE(cyttsp_info),
1930 },
1931 {
1932 I2C_LIQUID,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001933 MSM_8930_GSBI10_QUP_I2C_BUS_ID,
1934 msm_isa1200_board_info,
1935 ARRAY_SIZE(msm_isa1200_board_info),
1936 },
Amy Malochef3c9db42011-12-08 15:17:35 -08001937 {
1938 I2C_SURF,
1939 MSM_8930_GSBI3_QUP_I2C_BUS_ID,
1940 mxt_device_info_8930,
1941 ARRAY_SIZE(mxt_device_info_8930),
1942 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001943};
1944#endif /* CONFIG_I2C */
1945
1946static void __init register_i2c_devices(void)
1947{
1948#ifdef CONFIG_I2C
1949 u8 mach_mask = 0;
1950 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08001951#ifdef CONFIG_MSM_CAMERA
1952 struct i2c_registry msm8930_camera_i2c_devices = {
1953 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
1954 MSM_8930_GSBI4_QUP_I2C_BUS_ID,
1955 msm8930_camera_board_info.board_info,
1956 msm8930_camera_board_info.num_i2c_board_info,
1957 };
1958#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001959
1960 /* Build the matching 'supported_machs' bitmask */
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08001961 if (machine_is_msm8930_cdp() || machine_is_msm8627_cdp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001962 mach_mask = I2C_SURF;
1963 else if (machine_is_msm8930_fluid())
1964 mach_mask = I2C_FLUID;
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08001965 else if (machine_is_msm8930_mtp() || machine_is_msm8627_mtp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001966 mach_mask = I2C_FFA;
1967 else
1968 pr_err("unmatched machine ID in register_i2c_devices\n");
1969
1970 /* Run the array and install devices as appropriate */
1971 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
1972 if (msm8960_i2c_devices[i].machs & mach_mask)
1973 i2c_register_board_info(msm8960_i2c_devices[i].bus,
1974 msm8960_i2c_devices[i].info,
1975 msm8960_i2c_devices[i].len);
1976 }
Kevin Chan09f4e662011-12-16 08:17:02 -08001977#ifdef CONFIG_MSM_CAMERA
1978 if (msm8930_camera_i2c_devices.machs & mach_mask)
1979 i2c_register_board_info(msm8930_camera_i2c_devices.bus,
1980 msm8930_camera_i2c_devices.info,
1981 msm8930_camera_i2c_devices.len);
1982#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001983#endif
1984}
1985
1986static void __init msm8930_cdp_init(void)
1987{
1988 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
1989 pr_err("meminfo_init() failed!\n");
1990
1991 BUG_ON(msm_rpm_init(&msm_rpm_data));
1992 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
1993 ARRAY_SIZE(msm_rpmrs_levels)));
1994
1995 regulator_suppress_info_printing();
1996 if (msm_xo_init())
1997 pr_err("Failed to initialize XO votes\n");
Jay Chokshi06fa7542011-12-07 13:09:17 -08001998 platform_device_register(&msm8930_device_rpm_regulator);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001999 msm_clock_init(&msm8960_clock_init_data);
2000 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
2001 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002002 msm8930_init_gpiomux();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002003 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2004 &msm8960_qup_spi_gsbi1_pdata;
2005 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2006
Jay Chokshi06fa7542011-12-07 13:09:17 -08002007 /*
2008 * TODO: When physical 8930/PM8038 hardware becomes
2009 * available, remove this block or add the config
2010 * option.
2011 */
2012#ifndef MSM8930_PHASE_2
2013 msm8960_init_pmic();
2014#else
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002015 msm8930_init_pmic();
Jay Chokshi06fa7542011-12-07 13:09:17 -08002016#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002017 msm8930_i2c_init();
2018 msm8930_gfx_init();
2019 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2020 msm_spm_l2_init(msm_spm_l2_data);
2021 msm8930_init_buses();
2022 platform_add_devices(msm_footswitch_devices,
2023 msm_num_footswitch_devices);
2024 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Jay Chokshi06fa7542011-12-07 13:09:17 -08002025 /*
2026 * TODO: When physical 8930/PM8038 hardware becomes
2027 * available, remove this block or add the config
2028 * option.
2029 */
2030#ifndef MSM8930_PHASE_2
2031 msm8960_pm8921_gpio_mpp_init();
2032#else
2033 msm8930_pm8038_gpio_mpp_init();
2034#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002035 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
2036 msm8930_init_hsic();
2037 msm8930_init_cam();
2038 msm8930_init_mmc();
Tianyi Gou7c6b81f2011-12-07 23:09:08 -08002039 acpuclk_init(&acpuclk_8930_soc_data);
Amy Malochef3c9db42011-12-08 15:17:35 -08002040 if (machine_is_msm8930_cdp() || machine_is_msm8627_cdp())
2041 mxt_init_vkeys_8930();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002042 register_i2c_devices();
2043 msm8930_init_fb();
2044 slim_register_board_info(msm_slim_devices,
2045 ARRAY_SIZE(msm_slim_devices));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002046 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2047 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2048 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2049 msm_pm_data);
2050 change_memory_power = &msm8930_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002051 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002052
2053 if (PLATFORM_IS_CHARM25())
2054 platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices));
2055}
2056
2057MACHINE_START(MSM8930_CDP, "QCT MSM8930 CDP")
2058 .map_io = msm8930_map_io,
2059 .reserve = msm8930_reserve,
2060 .init_irq = msm8930_init_irq,
2061 .timer = &msm_timer,
2062 .init_machine = msm8930_cdp_init,
2063 .init_early = msm8930_allocate_memory_regions,
2064 .init_very_early = msm8930_early_memory,
2065MACHINE_END
2066
2067MACHINE_START(MSM8930_MTP, "QCT MSM8930 MTP")
2068 .map_io = msm8930_map_io,
2069 .reserve = msm8930_reserve,
2070 .init_irq = msm8930_init_irq,
2071 .timer = &msm_timer,
2072 .init_machine = msm8930_cdp_init,
2073 .init_early = msm8930_allocate_memory_regions,
2074 .init_very_early = msm8930_early_memory,
2075MACHINE_END
2076
2077MACHINE_START(MSM8930_FLUID, "QCT MSM8930 FLUID")
2078 .map_io = msm8930_map_io,
2079 .reserve = msm8930_reserve,
2080 .init_irq = msm8930_init_irq,
2081 .timer = &msm_timer,
2082 .init_machine = msm8930_cdp_init,
2083 .init_early = msm8930_allocate_memory_regions,
2084 .init_very_early = msm8930_early_memory,
2085MACHINE_END
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002086
2087MACHINE_START(MSM8627_CDP, "QCT MSM8627 CDP")
2088 .map_io = msm8930_map_io,
2089 .reserve = msm8930_reserve,
2090 .init_irq = msm8930_init_irq,
2091 .timer = &msm_timer,
2092 .init_machine = msm8930_cdp_init,
2093 .init_early = msm8930_allocate_memory_regions,
2094 .init_very_early = msm8930_early_memory,
2095MACHINE_END
2096
2097MACHINE_START(MSM8627_MTP, "QCT MSM8627 MTP")
2098 .map_io = msm8930_map_io,
2099 .reserve = msm8930_reserve,
2100 .init_irq = msm8930_init_irq,
2101 .timer = &msm_timer,
2102 .init_machine = msm8930_cdp_init,
2103 .init_early = msm8930_allocate_memory_regions,
2104 .init_very_early = msm8930_early_memory,
2105MACHINE_END