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