blob: 99bba5989583799226366a6e27f3b1ec2cd22950 [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{
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800741 msm_mpm_irq_extn_init();
742 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
743 (void *)MSM_QGIC_CPU_BASE);
744
745 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
746 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
747
748 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
749 mb();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800750}
751
752static void __init msm8930_init_buses(void)
753{
754#ifdef CONFIG_MSM_BUS_SCALING
755 msm_bus_rpm_set_mt_mask();
756 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
757 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
758 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
759 msm_bus_apps_fabric.dev.platform_data =
760 &msm_bus_8960_apps_fabric_pdata;
761 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
762 msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
763 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
764 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
765#endif
766}
767
768static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
769 .max_clock_speed = 15060000,
770};
771
772#ifdef CONFIG_USB_MSM_OTG_72K
773static struct msm_otg_platform_data msm_otg_pdata;
774#else
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800775static void msm_hsusb_vbus_power(bool on)
776{
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800777 static bool vbus_is_on;
778 static struct regulator *mvs_otg_switch;
779
780 if (vbus_is_on == on)
781 return;
782
783 if (on) {
784 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
785 "vbus_otg");
786 if (IS_ERR(mvs_otg_switch)) {
787 pr_err("Unable to get mvs_otg_switch\n");
788 return;
789 }
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800790
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800791 if (regulator_enable(mvs_otg_switch)) {
792 pr_err("unable to enable mvs_otg_switch\n");
David Collins57954fa2011-12-15 09:14:40 -0800793 goto put_mvs_otg;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800794 }
795
796 vbus_is_on = true;
797 return;
798 }
799 regulator_disable(mvs_otg_switch);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800800put_mvs_otg:
801 regulator_put(mvs_otg_switch);
802 vbus_is_on = false;
803}
804
805static struct msm_otg_platform_data msm_otg_pdata = {
806 .mode = USB_OTG,
807 .otg_control = OTG_PMIC_CONTROL,
808 .phy_type = SNPS_28NM_INTEGRATED_PHY,
809 .pclk_src_name = "dfab_usb_hs_clk",
Jay Chokshi06fa7542011-12-07 13:09:17 -0800810 .pmic_id_irq = PM8038_USB_ID_IN_IRQ(PM8038_IRQ_BASE),
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800811 .vbus_power = msm_hsusb_vbus_power,
812 .power_budget = 750,
813};
814#endif
815
816#ifdef CONFIG_USB_EHCI_MSM_HSIC
817#define HSIC_HUB_RESET_GPIO 91
818static struct msm_hsic_host_platform_data msm_hsic_pdata = {
819 .strobe = 150,
820 .data = 151,
821};
822#else
823static struct msm_hsic_host_platform_data msm_hsic_pdata;
824#endif
825
826#define PID_MAGIC_ID 0x71432909
827#define SERIAL_NUM_MAGIC_ID 0x61945374
828#define SERIAL_NUMBER_LENGTH 127
829#define DLOAD_USB_BASE_ADD 0x2A03F0C8
830
831struct magic_num_struct {
832 uint32_t pid;
833 uint32_t serial_num;
834};
835
836struct dload_struct {
837 uint32_t reserved1;
838 uint32_t reserved2;
839 uint32_t reserved3;
840 uint16_t reserved4;
841 uint16_t pid;
842 char serial_number[SERIAL_NUMBER_LENGTH];
843 uint16_t reserved5;
844 struct magic_num_struct magic_struct;
845};
846
847static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
848{
849 struct dload_struct __iomem *dload = 0;
850
851 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
852 if (!dload) {
853 pr_err("%s: cannot remap I/O memory region: %08x\n",
854 __func__, DLOAD_USB_BASE_ADD);
855 return -ENXIO;
856 }
857
858 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
859 __func__, dload, pid, snum);
860 /* update pid */
861 dload->magic_struct.pid = PID_MAGIC_ID;
862 dload->pid = pid;
863
864 /* update serial number */
865 dload->magic_struct.serial_num = 0;
866 if (!snum) {
867 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
868 goto out;
869 }
870
871 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
872 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
873out:
874 iounmap(dload);
875 return 0;
876}
877
878static struct android_usb_platform_data android_usb_pdata = {
879 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
880};
881
882static struct platform_device android_usb_device = {
883 .name = "android_usb",
884 .id = -1,
885 .dev = {
886 .platform_data = &android_usb_pdata,
887 },
888};
889
890static uint8_t spm_wfi_cmd_sequence[] __initdata = {
891 0x03, 0x0f,
892};
893
894static uint8_t spm_power_collapse_without_rpm[] __initdata = {
895 0x00, 0x24, 0x54, 0x10,
896 0x09, 0x03, 0x01,
897 0x10, 0x54, 0x30, 0x0C,
898 0x24, 0x30, 0x0f,
899};
900
901static uint8_t spm_power_collapse_with_rpm[] __initdata = {
902 0x00, 0x24, 0x54, 0x10,
903 0x09, 0x07, 0x01, 0x0B,
904 0x10, 0x54, 0x30, 0x0C,
905 0x24, 0x30, 0x0f,
906};
907
908static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
909 [0] = {
910 .mode = MSM_SPM_MODE_CLOCK_GATING,
911 .notify_rpm = false,
912 .cmd = spm_wfi_cmd_sequence,
913 },
914 [1] = {
915 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
916 .notify_rpm = false,
917 .cmd = spm_power_collapse_without_rpm,
918 },
919 [2] = {
920 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
921 .notify_rpm = true,
922 .cmd = spm_power_collapse_with_rpm,
923 },
924};
925
926static struct msm_spm_platform_data msm_spm_data[] __initdata = {
927 [0] = {
928 .reg_base_addr = MSM_SAW0_BASE,
929 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
930 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
931 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
932#if defined(CONFIG_MSM_AVS_HW)
933 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
934 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
935#endif
936 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
937 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
938 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
939 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
940 .vctl_timeout_us = 50,
941 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
942 .modes = msm_spm_seq_list,
943 },
944 [1] = {
945 .reg_base_addr = MSM_SAW1_BASE,
946 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
947 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
948 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
949#if defined(CONFIG_MSM_AVS_HW)
950 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
951 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
952#endif
953 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
954 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
955 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
956 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
957 .vctl_timeout_us = 50,
958 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
959 .modes = msm_spm_seq_list,
960 },
961};
962
963static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
964 0x00, 0x20, 0x03, 0x20,
965 0x00, 0x0f,
966};
967
968static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
969 0x00, 0x20, 0x34, 0x64,
970 0x48, 0x07, 0x48, 0x20,
971 0x50, 0x64, 0x04, 0x34,
972 0x50, 0x0f,
973};
974static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
975 0x00, 0x10, 0x34, 0x64,
976 0x48, 0x07, 0x48, 0x10,
977 0x50, 0x64, 0x04, 0x34,
978 0x50, 0x0F,
979};
980
981static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
982 [0] = {
983 .mode = MSM_SPM_L2_MODE_RETENTION,
984 .notify_rpm = false,
985 .cmd = l2_spm_wfi_cmd_sequence,
986 },
987 [1] = {
988 .mode = MSM_SPM_L2_MODE_GDHS,
989 .notify_rpm = true,
990 .cmd = l2_spm_gdhs_cmd_sequence,
991 },
992 [2] = {
993 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
994 .notify_rpm = true,
995 .cmd = l2_spm_power_off_cmd_sequence,
996 },
997};
998
999static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1000 [0] = {
1001 .reg_base_addr = MSM_SAW_L2_BASE,
1002 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1003 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
1004 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1005 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1006 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1007 .modes = msm_spm_l2_seq_list,
1008 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1009 },
1010};
1011
Jay Chokshi06fa7542011-12-07 13:09:17 -08001012#/* TODO: Remove this once PM8038 physically becomes
1013 * available.
1014 */
1015#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001016#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1017#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
Jay Chokshi06fa7542011-12-07 13:09:17 -08001018#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001019
1020static struct msm_xo_voter *xo_handle_d1;
1021
1022static int isa1200_power(int on)
1023{
1024 int rc = 0;
1025
1026 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !!on);
1027
1028 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
1029 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
1030 if (rc < 0) {
1031 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
1032 __func__, on ? "" : "de-", rc);
1033 goto err_xo_vote;
1034 }
1035
1036 return 0;
1037
1038err_xo_vote:
1039 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !on);
1040 return rc;
1041}
1042
1043static int isa1200_dev_setup(bool enable)
1044{
1045 int rc = 0;
1046
1047 struct pm_gpio hap_gpio_config = {
1048 .direction = PM_GPIO_DIR_OUT,
1049 .pull = PM_GPIO_PULL_NO,
1050 .out_strength = PM_GPIO_STRENGTH_HIGH,
1051 .function = PM_GPIO_FUNC_NORMAL,
1052 .inv_int_pol = 0,
1053 .vin_sel = 2,
1054 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1055 .output_value = 0,
1056 };
1057
1058 if (enable == true) {
1059 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
1060 if (rc) {
1061 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1062 __func__, PM_HAP_EN_GPIO, rc);
1063 return rc;
1064 }
1065
1066 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
1067 if (rc) {
1068 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1069 __func__, PM_HAP_LEN_GPIO, rc);
1070 return rc;
1071 }
1072
1073 rc = gpio_request(HAP_SHIFT_LVL_OE_GPIO, "hap_shft_lvl_oe");
1074 if (rc) {
1075 pr_err("%s: unable to request gpio %d (%d)\n",
1076 __func__, HAP_SHIFT_LVL_OE_GPIO, rc);
1077 return rc;
1078 }
1079
1080 rc = gpio_direction_output(HAP_SHIFT_LVL_OE_GPIO, 0);
1081 if (rc) {
1082 pr_err("%s: Unable to set direction\n", __func__);
1083 goto free_gpio;
1084 }
1085
1086 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
1087 if (IS_ERR(xo_handle_d1)) {
1088 rc = PTR_ERR(xo_handle_d1);
1089 pr_err("%s: failed to get the handle for D1(%d)\n",
1090 __func__, rc);
1091 goto gpio_set_dir;
1092 }
1093 } else {
1094 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1095
1096 msm_xo_put(xo_handle_d1);
1097 }
1098
1099 return 0;
1100
1101gpio_set_dir:
1102 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, 0);
1103free_gpio:
1104 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1105 return rc;
1106}
1107
1108static struct isa1200_regulator isa1200_reg_data[] = {
1109 {
1110 .name = "vcc_i2c",
1111 .min_uV = ISA_I2C_VTG_MIN_UV,
1112 .max_uV = ISA_I2C_VTG_MAX_UV,
1113 .load_uA = ISA_I2C_CURR_UA,
1114 },
1115};
1116
1117static struct isa1200_platform_data isa1200_1_pdata = {
1118 .name = "vibrator",
1119 .dev_setup = isa1200_dev_setup,
1120 .power_on = isa1200_power,
1121 .hap_en_gpio = PM_HAP_EN_GPIO,
1122 .hap_len_gpio = PM_HAP_LEN_GPIO,
1123 .max_timeout = 15000,
1124 .mode_ctrl = PWM_GEN_MODE,
1125 .pwm_fd = {
1126 .pwm_div = 256,
1127 },
1128 .is_erm = false,
1129 .smart_en = true,
1130 .ext_clk_en = true,
1131 .chip_en = 1,
1132 .regulator_info = isa1200_reg_data,
1133 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1134};
1135
1136static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1137 {
1138 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1139 .platform_data = &isa1200_1_pdata,
1140 },
1141};
1142
1143#define CYTTSP_TS_GPIO_IRQ 11
1144#define CYTTSP_TS_SLEEP_GPIO 50
1145#define CYTTSP_TS_RESOUT_N_GPIO 52
1146
1147/*virtual key support */
1148static ssize_t tma340_vkeys_show(struct kobject *kobj,
1149 struct kobj_attribute *attr, char *buf)
1150{
1151 return snprintf(buf, 200,
1152 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1153 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1154 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1155 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1156 "\n");
1157}
1158
1159static struct kobj_attribute tma340_vkeys_attr = {
1160 .attr = {
1161 .mode = S_IRUGO,
1162 },
1163 .show = &tma340_vkeys_show,
1164};
1165
1166static struct attribute *tma340_properties_attrs[] = {
1167 &tma340_vkeys_attr.attr,
1168 NULL
1169};
1170
1171static struct attribute_group tma340_properties_attr_group = {
1172 .attrs = tma340_properties_attrs,
1173};
1174
1175
1176static int cyttsp_platform_init(struct i2c_client *client)
1177{
1178 int rc = 0;
1179 static struct kobject *tma340_properties_kobj;
1180
1181 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1182 tma340_properties_kobj = kobject_create_and_add("board_properties",
1183 NULL);
1184 if (tma340_properties_kobj)
1185 rc = sysfs_create_group(tma340_properties_kobj,
1186 &tma340_properties_attr_group);
1187 if (!tma340_properties_kobj || rc)
1188 pr_err("%s: failed to create board_properties\n",
1189 __func__);
1190
1191 return 0;
1192}
1193
1194static struct cyttsp_regulator regulator_data[] = {
1195 {
1196 .name = "vdd",
1197 .min_uV = CY_TMA300_VTG_MIN_UV,
1198 .max_uV = CY_TMA300_VTG_MAX_UV,
1199 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1200 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
1201 },
1202 /* TODO: Remove after runtime PM is enabled in I2C driver */
1203 {
1204 .name = "vcc_i2c",
1205 .min_uV = CY_I2C_VTG_MIN_UV,
1206 .max_uV = CY_I2C_VTG_MAX_UV,
1207 .hpm_load_uA = CY_I2C_CURR_UA,
1208 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
1209 },
1210};
1211
1212static struct cyttsp_platform_data cyttsp_pdata = {
1213 .panel_maxx = 634,
1214 .panel_maxy = 1166,
1215 .disp_maxx = 616,
1216 .disp_maxy = 1023,
1217 .disp_minx = 0,
1218 .disp_miny = 16,
1219 .flags = 0x01,
1220 .gen = CY_GEN3, /* or */
1221 .use_st = CY_USE_ST,
1222 .use_mt = CY_USE_MT,
1223 .use_hndshk = CY_SEND_HNDSHK,
1224 .use_trk_id = CY_USE_TRACKING_ID,
1225 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
1226 .use_gestures = CY_USE_GESTURES,
1227 .fw_fname = "cyttsp_8960_cdp.hex",
1228 /* activate up to 4 groups
1229 * and set active distance
1230 */
1231 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
1232 CY_GEST_GRP3 | CY_GEST_GRP4 |
1233 CY_ACT_DIST,
1234 /* change act_intrvl to customize the Active power state
1235 * scanning/processing refresh interval for Operating mode
1236 */
1237 .act_intrvl = CY_ACT_INTRVL_DFLT,
1238 /* change tch_tmout to customize the touch timeout for the
1239 * Active power state for Operating mode
1240 */
1241 .tch_tmout = CY_TCH_TMOUT_DFLT,
1242 /* change lp_intrvl to customize the Low Power power state
1243 * scanning/processing refresh interval for Operating mode
1244 */
1245 .lp_intrvl = CY_LP_INTRVL_DFLT,
1246 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
1247 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
1248 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1249 .regulator_info = regulator_data,
1250 .num_regulators = ARRAY_SIZE(regulator_data),
1251 .init = cyttsp_platform_init,
1252 .correct_fw_ver = 9,
1253};
1254
1255static struct i2c_board_info cyttsp_info[] __initdata = {
1256 {
1257 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1258 .platform_data = &cyttsp_pdata,
1259#ifndef CY_USE_TIMER
1260 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1261#endif /* CY_USE_TIMER */
1262 },
1263};
1264
Amy Malochef3c9db42011-12-08 15:17:35 -08001265#define MXT_TS_GPIO_IRQ 11
1266#define MXT_TS_RESET_GPIO 52
1267
1268static const u8 mxt_config_data_8930[] = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001269 /* T6 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001270 0, 0, 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001271 /* T38 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001272 15, 1, 0, 15, 12, 11, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001273 /* T7 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001274 48, 255, 25,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001275 /* T8 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001276 27, 0, 5, 1, 0, 0, 8, 8, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001277 /* T9 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001278 131, 0, 0, 19, 11, 0, 16, 35, 1, 3,
1279 10, 15, 1, 11, 4, 5, 40, 10, 54, 2,
1280 43, 4, 0, 0, 0, 0, 143, 40, 143, 80,
1281 18, 15, 50, 50, 2,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001282 /* T15 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001283 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1284 0,
1285 /* T18 Object */
1286 0, 0,
1287 /* T19 Object */
1288 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1289 0, 0, 0, 0, 0, 0,
1290 /* T23 Object */
1291 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1292 0, 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001293 /* T25 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001294 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1295 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001296 /* T40 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001297 0, 0, 0, 0, 0,
1298 /* T42 Object */
1299 0, 0, 0, 0, 0, 0, 0, 0,
1300 /* T46 Object */
1301 0, 3, 16, 48, 0, 0, 1, 0, 0,
1302 /* T47 Object */
1303 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1304 /* T48 Object */
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, 0, 0, 0, 0, 0, 0,
1309 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1310 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001311};
1312
Amy Malochef3c9db42011-12-08 15:17:35 -08001313static ssize_t mxt224e_vkeys_show(struct kobject *kobj,
1314 struct kobj_attribute *attr, char *buf)
1315{
1316 return snprintf(buf, 200,
1317 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":65:938:90:90"
1318 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":208:938:90:90"
1319 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":348:938:90:90"
1320 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":490:938:90:90"
1321 "\n");
1322}
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001323
Amy Malochef3c9db42011-12-08 15:17:35 -08001324static struct kobj_attribute mxt224e_vkeys_attr = {
1325 .attr = {
1326 .mode = S_IRUGO,
1327 },
1328 .show = &mxt224e_vkeys_show,
1329};
1330
1331static struct attribute *mxt224e_properties_attrs[] = {
1332 &mxt224e_vkeys_attr.attr,
1333 NULL
1334};
1335
1336static struct attribute_group mxt224e_properties_attr_group = {
1337 .attrs = mxt224e_properties_attrs,
1338};
1339
1340static void mxt_init_vkeys_8930(void)
1341{
1342 int rc;
1343 static struct kobject *mxt224e_properties_kobj;
1344
1345 mxt224e_vkeys_attr.attr.name = "virtualkeys.atmel_mxt_ts";
1346 mxt224e_properties_kobj = kobject_create_and_add("board_properties",
1347 NULL);
1348 if (mxt224e_properties_kobj)
1349 rc = sysfs_create_group(mxt224e_properties_kobj,
1350 &mxt224e_properties_attr_group);
1351 if (!mxt224e_properties_kobj || rc)
1352 pr_err("%s: failed to create board_properties\n",
1353 __func__);
1354
1355 return;
1356}
1357
1358static struct mxt_platform_data mxt_platform_data_8930 = {
1359 .config = mxt_config_data_8930,
1360 .config_length = ARRAY_SIZE(mxt_config_data_8930),
1361 .x_size = 1067,
1362 .y_size = 566,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001363 .irqflags = IRQF_TRIGGER_FALLING,
1364 .i2c_pull_up = true,
Amy Malochef3c9db42011-12-08 15:17:35 -08001365 .reset_gpio = MXT_TS_RESET_GPIO,
1366 .irq_gpio = MXT_TS_GPIO_IRQ,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001367};
1368
Amy Malochef3c9db42011-12-08 15:17:35 -08001369static struct i2c_board_info mxt_device_info_8930[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001370 {
Amy Malochef3c9db42011-12-08 15:17:35 -08001371 I2C_BOARD_INFO("atmel_mxt_ts", 0x4a),
1372 .platform_data = &mxt_platform_data_8930,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001373 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1374 },
1375};
1376
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001377static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
1378 .clk_freq = 100000,
1379 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001380};
1381
1382static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
1383 .clk_freq = 100000,
1384 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001385};
1386
1387static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
1388 .clk_freq = 100000,
1389 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001390};
1391
1392static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
1393 .clk_freq = 100000,
1394 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001395};
1396
1397static struct msm_rpm_platform_data msm_rpm_data = {
1398 .reg_base_addrs = {
1399 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
1400 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
1401 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
1402 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
1403 },
1404
1405 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
1406 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
1407 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1408 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
1409 .msm_apps_ipc_rpm_val = 4,
1410};
1411
1412static struct ks8851_pdata spi_eth_pdata = {
1413 .irq_gpio = KS8851_IRQ_GPIO,
1414 .rst_gpio = KS8851_RST_GPIO,
1415};
1416
1417static struct spi_board_info spi_board_info[] __initdata = {
1418 {
1419 .modalias = "ks8851",
1420 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1421 .max_speed_hz = 19200000,
1422 .bus_num = 0,
1423 .chip_select = 0,
1424 .mode = SPI_MODE_0,
1425 .platform_data = &spi_eth_pdata
1426 },
1427 {
1428 .modalias = "dsi_novatek_3d_panel_spi",
1429 .max_speed_hz = 10800000,
1430 .bus_num = 0,
1431 .chip_select = 1,
1432 .mode = SPI_MODE_0,
1433 },
1434};
1435
1436static struct platform_device msm_device_saw_core0 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001437 .name = "saw-regulator",
1438 .id = 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001439 .dev = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001440 /*
1441 * TODO: When physical 8930/PM8038 hardware becomes
1442 * available, replace msm_saw_regulator_pdata_s5
1443 * with 8930 saw regulator object.
1444 */
1445#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001446 .platform_data = &msm_saw_regulator_pdata_s5,
Jay Chokshi06fa7542011-12-07 13:09:17 -08001447#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001448 },
1449};
1450
1451static struct platform_device msm_device_saw_core1 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001452 .name = "saw-regulator",
1453 .id = 1,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001454 .dev = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001455 /*
1456 * TODO: When physical 8930/PM8038 hardware becomes
1457 * available, replace msm_saw_regulator_pdata_s5
1458 * with 8930 saw regulator object.
1459 */
1460#if !defined(MSM8930_PHASE_2)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001461 .platform_data = &msm_saw_regulator_pdata_s6,
Jay Chokshi06fa7542011-12-07 13:09:17 -08001462#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001463 },
1464};
1465
1466static struct tsens_platform_data msm_tsens_pdata = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001467 .slope = 910,
1468 .tsens_factor = 1000,
1469 .hw_type = MSM_8960,
1470 .tsens_num_sensor = 5,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001471};
1472
1473static struct platform_device msm_tsens_device = {
1474 .name = "tsens8960-tm",
1475 .id = -1,
1476 .dev = {
1477 .platform_data = &msm_tsens_pdata,
1478 },
1479};
1480
1481#ifdef CONFIG_MSM_FAKE_BATTERY
1482static struct platform_device fish_battery_device = {
1483 .name = "fish_battery",
1484};
1485#endif
1486
Jay Chokshi06fa7542011-12-07 13:09:17 -08001487static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001488 .name = GPIO_REGULATOR_DEV_NAME,
Jay Chokshi06fa7542011-12-07 13:09:17 -08001489/* TODO: Replace this with right MPP for 8038 */
1490#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001491 .id = PM8921_MPP_PM_TO_SYS(7),
Jay Chokshi06fa7542011-12-07 13:09:17 -08001492#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001493 .dev = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001494 /*
1495 * TODO: When physical 8930/PM8038 hardware becomes
1496 * available, replace msm_gpio_regulator_pdata
1497 * with 8930 gpio regulator object.
1498 */
1499#if !defined(MSM8930_PHASE_2)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001500 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
Jay Chokshi06fa7542011-12-07 13:09:17 -08001501#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001502 },
1503};
1504
Jay Chokshi06fa7542011-12-07 13:09:17 -08001505static struct platform_device msm8930_device_ext_l2_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001506 .name = GPIO_REGULATOR_DEV_NAME,
1507 .id = 91,
1508 .dev = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001509 /*
1510 * TODO: When physical 8930/PM8038 hardware becomes
1511 * available, replace msm_gpio_regulator_pdata
1512 * with 8930 gpio regulator object.
1513 */
1514#if !defined(MSM8930_PHASE_2)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001515 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
Jay Chokshi06fa7542011-12-07 13:09:17 -08001516#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001517 },
1518};
1519
Jay Chokshi06fa7542011-12-07 13:09:17 -08001520static struct platform_device msm8930_device_rpm_regulator __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001521 .name = "rpm-regulator",
1522 .id = -1,
1523 .dev = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001524 /*
1525 * TODO: When physical 8930/PM8038 hardware becomes
1526 * available, replace msm_rpm_regulator_pdata
1527 * with 8930 rpm regulator object.
1528 */
1529#if !defined(MSM8930_PHASE_2)
1530
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001531 .platform_data = &msm_rpm_regulator_pdata,
Jay Chokshi06fa7542011-12-07 13:09:17 -08001532#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001533 },
1534};
1535
1536static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
1537 .phys_addr_base = 0x0010C000,
1538 .reg_offsets = {
1539 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
1540 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
1541 },
1542 .phys_size = SZ_8K,
1543 .log_len = 4096, /* log's buffer length in bytes */
1544 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
1545};
1546
1547static struct platform_device msm_rpm_log_device = {
1548 .name = "msm_rpm_log",
1549 .id = -1,
1550 .dev = {
1551 .platform_data = &msm_rpm_log_pdata,
1552 },
1553};
1554
1555static struct platform_device *common_devices[] __initdata = {
1556 &msm8960_device_dmov,
1557 &msm_device_smd,
1558 &msm8960_device_uart_gsbi5,
1559 &msm_device_uart_dm6,
1560 &msm_device_saw_core0,
1561 &msm_device_saw_core1,
Jay Chokshi06fa7542011-12-07 13:09:17 -08001562 &msm8930_device_ext_5v_vreg,
1563 &msm8930_device_ext_l2_vreg,
Jay Chokshi33c044a2011-12-07 13:05:40 -08001564 &msm8960_device_ssbi_pmic,
Stephen Boyd28d54952011-12-16 13:19:51 -08001565 &msm_8960_q6_lpass,
1566 &msm_8960_q6_mss_fw,
1567 &msm_8960_q6_mss_sw,
Stephen Boyd322a9922011-09-20 01:05:54 -07001568 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07001569 &msm_pil_tzapps,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001570 &msm8960_device_qup_spi_gsbi1,
1571 &msm8960_device_qup_i2c_gsbi3,
1572 &msm8960_device_qup_i2c_gsbi4,
1573 &msm8960_device_qup_i2c_gsbi10,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001574 &msm8960_device_qup_i2c_gsbi12,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001575 &msm_slim_ctrl,
1576 &msm_device_wcnss_wlan,
1577#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1578 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1579 &qcrypto_device,
1580#endif
1581
1582#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1583 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1584 &qcedev_device,
1585#endif
1586#ifdef CONFIG_MSM_ROTATOR
1587 &msm_rotator_device,
1588#endif
1589 &msm_device_sps,
1590#ifdef CONFIG_MSM_FAKE_BATTERY
1591 &fish_battery_device,
1592#endif
1593#ifdef CONFIG_ANDROID_PMEM
1594#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
1595 &android_pmem_device,
1596 &android_pmem_adsp_device,
1597#endif
1598 &android_pmem_audio_device,
1599#endif
1600 &msm_device_vidc,
1601 &msm_device_bam_dmux,
1602 &msm_fm_platform_init,
1603
1604#ifdef CONFIG_HW_RANDOM_MSM
1605 &msm_device_rng,
1606#endif
1607 &msm_rpm_device,
1608#ifdef CONFIG_ION_MSM
1609 &ion_dev,
1610#endif
1611 &msm_rpm_log_device,
1612 &msm_rpm_stat_device,
1613 &msm_device_tz_log,
1614
1615#ifdef CONFIG_MSM_QDSS
1616 &msm_etb_device,
1617 &msm_tpiu_device,
1618 &msm_funnel_device,
1619 &msm_debug_device,
1620 &msm_ptm_device,
1621#endif
1622 &msm_device_dspcrashd_8960,
1623 &msm8960_device_watchdog,
1624};
1625
1626static struct platform_device *cdp_devices[] __initdata = {
1627 &msm8960_device_otg,
1628 &msm8960_device_gadget_peripheral,
1629 &msm_device_hsusb_host,
1630 &android_usb_device,
1631 &msm_pcm,
1632 &msm_pcm_routing,
1633 &msm_cpudai0,
1634 &msm_cpudai1,
1635 &msm_cpudai_hdmi_rx,
1636 &msm_cpudai_bt_rx,
1637 &msm_cpudai_bt_tx,
1638 &msm_cpudai_fm_rx,
1639 &msm_cpudai_fm_tx,
1640 &msm_cpudai_auxpcm_rx,
1641 &msm_cpudai_auxpcm_tx,
1642 &msm_cpu_fe,
1643 &msm_stub_codec,
1644 &msm_kgsl_3d0,
1645#ifdef CONFIG_MSM_KGSL_2D
1646 &msm_kgsl_2d0,
1647 &msm_kgsl_2d1,
1648#endif
1649#ifdef CONFIG_MSM_GEMINI
1650 &msm8960_gemini_device,
1651#endif
1652 &msm_voice,
1653 &msm_voip,
1654 &msm_lpa_pcm,
1655 &msm_cpudai_afe_01_rx,
1656 &msm_cpudai_afe_01_tx,
1657 &msm_cpudai_afe_02_rx,
1658 &msm_cpudai_afe_02_tx,
1659 &msm_pcm_afe,
1660 &msm_pcm_hostless,
1661 &msm_bus_apps_fabric,
1662 &msm_bus_sys_fabric,
1663 &msm_bus_mm_fabric,
1664 &msm_bus_sys_fpb,
1665 &msm_bus_cpss_fpb,
1666 &msm_tsens_device,
1667};
1668
1669static void __init msm8930_i2c_init(void)
1670{
1671 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
1672 &msm8960_i2c_qup_gsbi4_pdata;
1673
1674 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
1675 &msm8960_i2c_qup_gsbi3_pdata;
1676
1677 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
1678 &msm8960_i2c_qup_gsbi10_pdata;
1679
1680 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
1681 &msm8960_i2c_qup_gsbi12_pdata;
1682}
1683
1684static void __init msm8930_gfx_init(void)
1685{
1686 uint32_t soc_platform_version = socinfo_get_version();
1687 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
1688 struct kgsl_device_platform_data *kgsl_3d0_pdata =
1689 msm_kgsl_3d0.dev.platform_data;
1690 kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
1691 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
1692 }
1693}
1694
1695static struct msm_cpuidle_state msm_cstates[] __initdata = {
1696 {0, 0, "C0", "WFI",
1697 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1698
1699 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1700 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1701
1702 {0, 2, "C2", "POWER_COLLAPSE",
1703 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
1704
1705 {1, 0, "C0", "WFI",
1706 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1707
1708 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1709 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1710};
1711
1712static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
1713 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1714 .idle_supported = 1,
1715 .suspend_supported = 1,
1716 .idle_enabled = 0,
1717 .suspend_enabled = 0,
1718 },
1719
1720 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1721 .idle_supported = 1,
1722 .suspend_supported = 1,
1723 .idle_enabled = 0,
1724 .suspend_enabled = 0,
1725 },
1726
1727 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1728 .idle_supported = 1,
1729 .suspend_supported = 1,
1730 .idle_enabled = 1,
1731 .suspend_enabled = 1,
1732 },
1733
1734 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1735 .idle_supported = 0,
1736 .suspend_supported = 1,
1737 .idle_enabled = 0,
1738 .suspend_enabled = 0,
1739 },
1740
1741 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1742 .idle_supported = 1,
1743 .suspend_supported = 1,
1744 .idle_enabled = 0,
1745 .suspend_enabled = 0,
1746 },
1747
1748 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1749 .idle_supported = 1,
1750 .suspend_supported = 0,
1751 .idle_enabled = 1,
1752 .suspend_enabled = 0,
1753 },
1754};
1755
1756static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
1757 {
1758 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1759 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1760 true,
1761 100, 8000, 100000, 1,
1762 },
1763
1764 {
1765 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1766 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1767 true,
1768 2000, 6000, 60100000, 3000,
1769 },
1770
1771 {
1772 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1773 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1774 false,
1775 4200, 5000, 60350000, 3500,
1776 },
1777
1778 {
1779 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1780 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
1781 false,
1782 6300, 4500, 65350000, 4800,
1783 },
1784 {
1785 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1786 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
1787 false,
1788 7000, 3500, 66600000, 5150,
1789 },
1790
1791 {
1792 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1793 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1794 false,
1795 11700, 2500, 67850000, 5500,
1796 },
1797
1798 {
1799 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1800 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1801 false,
1802 13800, 2000, 71850000, 6800,
1803 },
1804
1805 {
1806 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1807 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1808 false,
1809 29700, 500, 75850000, 8800,
1810 },
1811
1812 {
1813 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1814 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1815 false,
1816 29700, 0, 76350000, 9800,
1817 },
1818};
1819
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06001820static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1821 .mode = MSM_PM_BOOT_CONFIG_TZ,
1822};
1823
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001824#ifdef CONFIG_I2C
1825#define I2C_SURF 1
1826#define I2C_FFA (1 << 1)
1827#define I2C_RUMI (1 << 2)
1828#define I2C_SIM (1 << 3)
1829#define I2C_FLUID (1 << 4)
1830#define I2C_LIQUID (1 << 5)
1831
1832struct i2c_registry {
1833 u8 machs;
1834 int bus;
1835 struct i2c_board_info *info;
1836 int len;
1837};
1838
1839#ifdef CONFIG_MSM_CAMERA
1840static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
1841#ifdef CONFIG_IMX074
1842 {
1843 I2C_BOARD_INFO("imx074", 0x1A),
1844 },
1845#endif
1846#ifdef CONFIG_OV2720
1847 {
1848 I2C_BOARD_INFO("ov2720", 0x6C),
1849 },
1850#endif
1851#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
1852 {
1853 I2C_BOARD_INFO("sc628a", 0x6E),
1854 },
1855#endif
1856};
1857#endif
1858
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001859static void __init msm8930_init_hsic(void)
1860{
1861#ifdef CONFIG_USB_EHCI_MSM_HSIC
1862 uint32_t version = socinfo_get_version();
1863
1864 pr_info("%s: version:%d mtp:%d\n", __func__,
1865 SOCINFO_VERSION_MAJOR(version),
1866 machine_is_msm8930_mtp());
1867
1868 if ((SOCINFO_VERSION_MAJOR(version) == 1) ||
1869 machine_is_msm8930_mtp() ||
1870 machine_is_msm8930_fluid())
1871 return;
1872
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001873 platform_device_register(&msm_device_hsic_host);
1874#endif
1875}
1876
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001877#ifdef CONFIG_ISL9519_CHARGER
1878static struct isl_platform_data isl_data __initdata = {
1879 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
1880 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
1881 .max_system_voltage = 4200,
1882 .min_system_voltage = 3200,
1883 .chgcurrent = 1000, /* 1900, */
1884 .term_current = 400, /* Need fine tuning */
1885 .input_current = 2048,
1886};
1887
1888static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
1889 {
1890 I2C_BOARD_INFO("isl9519q", 0x9),
1891 .irq = 0, /* Not required when notify-by-pmic */
1892 .platform_data = &isl_data,
1893 },
1894};
1895#endif /* CONFIG_ISL9519_CHARGER */
1896
1897static struct i2c_registry msm8960_i2c_devices[] __initdata = {
1898#ifdef CONFIG_MSM_CAMERA
1899 {
1900 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
1901 MSM_8930_GSBI4_QUP_I2C_BUS_ID,
1902 msm_camera_boardinfo,
1903 ARRAY_SIZE(msm_camera_boardinfo),
1904 },
1905#endif
1906#ifdef CONFIG_ISL9519_CHARGER
1907 {
1908 I2C_LIQUID,
1909 MSM_8930_GSBI10_QUP_I2C_BUS_ID,
1910 isl_charger_i2c_info,
1911 ARRAY_SIZE(isl_charger_i2c_info),
1912 },
1913#endif /* CONFIG_ISL9519_CHARGER */
1914 {
1915 I2C_SURF | I2C_FFA | I2C_FLUID,
1916 MSM_8930_GSBI3_QUP_I2C_BUS_ID,
1917 cyttsp_info,
1918 ARRAY_SIZE(cyttsp_info),
1919 },
1920 {
1921 I2C_LIQUID,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001922 MSM_8930_GSBI10_QUP_I2C_BUS_ID,
1923 msm_isa1200_board_info,
1924 ARRAY_SIZE(msm_isa1200_board_info),
1925 },
Amy Malochef3c9db42011-12-08 15:17:35 -08001926 {
1927 I2C_SURF,
1928 MSM_8930_GSBI3_QUP_I2C_BUS_ID,
1929 mxt_device_info_8930,
1930 ARRAY_SIZE(mxt_device_info_8930),
1931 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001932};
1933#endif /* CONFIG_I2C */
1934
1935static void __init register_i2c_devices(void)
1936{
1937#ifdef CONFIG_I2C
1938 u8 mach_mask = 0;
1939 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08001940#ifdef CONFIG_MSM_CAMERA
1941 struct i2c_registry msm8930_camera_i2c_devices = {
1942 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
1943 MSM_8930_GSBI4_QUP_I2C_BUS_ID,
1944 msm8930_camera_board_info.board_info,
1945 msm8930_camera_board_info.num_i2c_board_info,
1946 };
1947#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001948
1949 /* Build the matching 'supported_machs' bitmask */
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08001950 if (machine_is_msm8930_cdp() || machine_is_msm8627_cdp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001951 mach_mask = I2C_SURF;
1952 else if (machine_is_msm8930_fluid())
1953 mach_mask = I2C_FLUID;
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08001954 else if (machine_is_msm8930_mtp() || machine_is_msm8627_mtp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001955 mach_mask = I2C_FFA;
1956 else
1957 pr_err("unmatched machine ID in register_i2c_devices\n");
1958
1959 /* Run the array and install devices as appropriate */
1960 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
1961 if (msm8960_i2c_devices[i].machs & mach_mask)
1962 i2c_register_board_info(msm8960_i2c_devices[i].bus,
1963 msm8960_i2c_devices[i].info,
1964 msm8960_i2c_devices[i].len);
1965 }
Kevin Chan09f4e662011-12-16 08:17:02 -08001966#ifdef CONFIG_MSM_CAMERA
1967 if (msm8930_camera_i2c_devices.machs & mach_mask)
1968 i2c_register_board_info(msm8930_camera_i2c_devices.bus,
1969 msm8930_camera_i2c_devices.info,
1970 msm8930_camera_i2c_devices.len);
1971#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001972#endif
1973}
1974
1975static void __init msm8930_cdp_init(void)
1976{
1977 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
1978 pr_err("meminfo_init() failed!\n");
1979
1980 BUG_ON(msm_rpm_init(&msm_rpm_data));
1981 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
1982 ARRAY_SIZE(msm_rpmrs_levels)));
1983
1984 regulator_suppress_info_printing();
1985 if (msm_xo_init())
1986 pr_err("Failed to initialize XO votes\n");
Jay Chokshi06fa7542011-12-07 13:09:17 -08001987 platform_device_register(&msm8930_device_rpm_regulator);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001988 msm_clock_init(&msm8960_clock_init_data);
1989 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
1990 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08001991 msm8930_init_gpiomux();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001992 msm8960_device_qup_spi_gsbi1.dev.platform_data =
1993 &msm8960_qup_spi_gsbi1_pdata;
1994 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
1995
Jay Chokshi06fa7542011-12-07 13:09:17 -08001996 /*
1997 * TODO: When physical 8930/PM8038 hardware becomes
1998 * available, remove this block or add the config
1999 * option.
2000 */
2001#ifndef MSM8930_PHASE_2
2002 msm8960_init_pmic();
2003#else
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002004 msm8930_init_pmic();
Jay Chokshi06fa7542011-12-07 13:09:17 -08002005#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002006 msm8930_i2c_init();
2007 msm8930_gfx_init();
2008 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2009 msm_spm_l2_init(msm_spm_l2_data);
2010 msm8930_init_buses();
2011 platform_add_devices(msm_footswitch_devices,
2012 msm_num_footswitch_devices);
2013 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Jay Chokshi06fa7542011-12-07 13:09:17 -08002014 /*
2015 * TODO: When physical 8930/PM8038 hardware becomes
2016 * available, remove this block or add the config
2017 * option.
2018 */
2019#ifndef MSM8930_PHASE_2
2020 msm8960_pm8921_gpio_mpp_init();
2021#else
2022 msm8930_pm8038_gpio_mpp_init();
2023#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002024 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
2025 msm8930_init_hsic();
2026 msm8930_init_cam();
2027 msm8930_init_mmc();
Tianyi Gou7c6b81f2011-12-07 23:09:08 -08002028 acpuclk_init(&acpuclk_8930_soc_data);
Amy Malochef3c9db42011-12-08 15:17:35 -08002029 if (machine_is_msm8930_cdp() || machine_is_msm8627_cdp())
2030 mxt_init_vkeys_8930();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002031 register_i2c_devices();
2032 msm8930_init_fb();
2033 slim_register_board_info(msm_slim_devices,
2034 ARRAY_SIZE(msm_slim_devices));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002035 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2036 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2037 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2038 msm_pm_data);
2039 change_memory_power = &msm8930_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002040 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002041
2042 if (PLATFORM_IS_CHARM25())
2043 platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices));
2044}
2045
2046MACHINE_START(MSM8930_CDP, "QCT MSM8930 CDP")
2047 .map_io = msm8930_map_io,
2048 .reserve = msm8930_reserve,
2049 .init_irq = msm8930_init_irq,
2050 .timer = &msm_timer,
2051 .init_machine = msm8930_cdp_init,
2052 .init_early = msm8930_allocate_memory_regions,
2053 .init_very_early = msm8930_early_memory,
2054MACHINE_END
2055
2056MACHINE_START(MSM8930_MTP, "QCT MSM8930 MTP")
2057 .map_io = msm8930_map_io,
2058 .reserve = msm8930_reserve,
2059 .init_irq = msm8930_init_irq,
2060 .timer = &msm_timer,
2061 .init_machine = msm8930_cdp_init,
2062 .init_early = msm8930_allocate_memory_regions,
2063 .init_very_early = msm8930_early_memory,
2064MACHINE_END
2065
2066MACHINE_START(MSM8930_FLUID, "QCT MSM8930 FLUID")
2067 .map_io = msm8930_map_io,
2068 .reserve = msm8930_reserve,
2069 .init_irq = msm8930_init_irq,
2070 .timer = &msm_timer,
2071 .init_machine = msm8930_cdp_init,
2072 .init_early = msm8930_allocate_memory_regions,
2073 .init_very_early = msm8930_early_memory,
2074MACHINE_END
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002075
2076MACHINE_START(MSM8627_CDP, "QCT MSM8627 CDP")
2077 .map_io = msm8930_map_io,
2078 .reserve = msm8930_reserve,
2079 .init_irq = msm8930_init_irq,
2080 .timer = &msm_timer,
2081 .init_machine = msm8930_cdp_init,
2082 .init_early = msm8930_allocate_memory_regions,
2083 .init_very_early = msm8930_early_memory,
2084MACHINE_END
2085
2086MACHINE_START(MSM8627_MTP, "QCT MSM8627 MTP")
2087 .map_io = msm8930_map_io,
2088 .reserve = msm8930_reserve,
2089 .init_irq = msm8930_init_irq,
2090 .timer = &msm_timer,
2091 .init_machine = msm8930_cdp_init,
2092 .init_early = msm8930_allocate_memory_regions,
2093 .init_very_early = msm8930_early_memory,
2094MACHINE_END