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