blob: fa548aa44426c2b72c5f06ab0d00f1cfb425842e [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,
788 .pclk_src_name = "dfab_usb_hs_clk",
Jay Chokshi06fa7542011-12-07 13:09:17 -0800789 .pmic_id_irq = PM8038_USB_ID_IN_IRQ(PM8038_IRQ_BASE),
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800790 .power_budget = 750,
791};
792#endif
793
794#ifdef CONFIG_USB_EHCI_MSM_HSIC
795#define HSIC_HUB_RESET_GPIO 91
796static struct msm_hsic_host_platform_data msm_hsic_pdata = {
797 .strobe = 150,
798 .data = 151,
799};
800#else
801static struct msm_hsic_host_platform_data msm_hsic_pdata;
802#endif
803
804#define PID_MAGIC_ID 0x71432909
805#define SERIAL_NUM_MAGIC_ID 0x61945374
806#define SERIAL_NUMBER_LENGTH 127
807#define DLOAD_USB_BASE_ADD 0x2A03F0C8
808
809struct magic_num_struct {
810 uint32_t pid;
811 uint32_t serial_num;
812};
813
814struct dload_struct {
815 uint32_t reserved1;
816 uint32_t reserved2;
817 uint32_t reserved3;
818 uint16_t reserved4;
819 uint16_t pid;
820 char serial_number[SERIAL_NUMBER_LENGTH];
821 uint16_t reserved5;
822 struct magic_num_struct magic_struct;
823};
824
825static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
826{
827 struct dload_struct __iomem *dload = 0;
828
829 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
830 if (!dload) {
831 pr_err("%s: cannot remap I/O memory region: %08x\n",
832 __func__, DLOAD_USB_BASE_ADD);
833 return -ENXIO;
834 }
835
836 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
837 __func__, dload, pid, snum);
838 /* update pid */
839 dload->magic_struct.pid = PID_MAGIC_ID;
840 dload->pid = pid;
841
842 /* update serial number */
843 dload->magic_struct.serial_num = 0;
844 if (!snum) {
845 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
846 goto out;
847 }
848
849 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
850 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
851out:
852 iounmap(dload);
853 return 0;
854}
855
856static struct android_usb_platform_data android_usb_pdata = {
857 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
858};
859
860static struct platform_device android_usb_device = {
861 .name = "android_usb",
862 .id = -1,
863 .dev = {
864 .platform_data = &android_usb_pdata,
865 },
866};
867
868static uint8_t spm_wfi_cmd_sequence[] __initdata = {
869 0x03, 0x0f,
870};
871
872static uint8_t spm_power_collapse_without_rpm[] __initdata = {
873 0x00, 0x24, 0x54, 0x10,
874 0x09, 0x03, 0x01,
875 0x10, 0x54, 0x30, 0x0C,
876 0x24, 0x30, 0x0f,
877};
878
879static uint8_t spm_power_collapse_with_rpm[] __initdata = {
880 0x00, 0x24, 0x54, 0x10,
881 0x09, 0x07, 0x01, 0x0B,
882 0x10, 0x54, 0x30, 0x0C,
883 0x24, 0x30, 0x0f,
884};
885
886static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
887 [0] = {
888 .mode = MSM_SPM_MODE_CLOCK_GATING,
889 .notify_rpm = false,
890 .cmd = spm_wfi_cmd_sequence,
891 },
892 [1] = {
893 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
894 .notify_rpm = false,
895 .cmd = spm_power_collapse_without_rpm,
896 },
897 [2] = {
898 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
899 .notify_rpm = true,
900 .cmd = spm_power_collapse_with_rpm,
901 },
902};
903
904static struct msm_spm_platform_data msm_spm_data[] __initdata = {
905 [0] = {
906 .reg_base_addr = MSM_SAW0_BASE,
907 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
908 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
909 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
910#if defined(CONFIG_MSM_AVS_HW)
911 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
912 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
913#endif
914 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
915 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
916 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
917 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
918 .vctl_timeout_us = 50,
919 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
920 .modes = msm_spm_seq_list,
921 },
922 [1] = {
923 .reg_base_addr = MSM_SAW1_BASE,
924 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
925 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
926 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
927#if defined(CONFIG_MSM_AVS_HW)
928 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
929 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
930#endif
931 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
932 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
933 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
934 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
935 .vctl_timeout_us = 50,
936 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
937 .modes = msm_spm_seq_list,
938 },
939};
940
941static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
942 0x00, 0x20, 0x03, 0x20,
943 0x00, 0x0f,
944};
945
946static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
947 0x00, 0x20, 0x34, 0x64,
948 0x48, 0x07, 0x48, 0x20,
949 0x50, 0x64, 0x04, 0x34,
950 0x50, 0x0f,
951};
952static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
953 0x00, 0x10, 0x34, 0x64,
954 0x48, 0x07, 0x48, 0x10,
955 0x50, 0x64, 0x04, 0x34,
956 0x50, 0x0F,
957};
958
959static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
960 [0] = {
961 .mode = MSM_SPM_L2_MODE_RETENTION,
962 .notify_rpm = false,
963 .cmd = l2_spm_wfi_cmd_sequence,
964 },
965 [1] = {
966 .mode = MSM_SPM_L2_MODE_GDHS,
967 .notify_rpm = true,
968 .cmd = l2_spm_gdhs_cmd_sequence,
969 },
970 [2] = {
971 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
972 .notify_rpm = true,
973 .cmd = l2_spm_power_off_cmd_sequence,
974 },
975};
976
977static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
978 [0] = {
979 .reg_base_addr = MSM_SAW_L2_BASE,
980 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
981 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
982 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
983 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
984 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
985 .modes = msm_spm_l2_seq_list,
986 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
987 },
988};
989
Jay Chokshi06fa7542011-12-07 13:09:17 -0800990#/* TODO: Remove this once PM8038 physically becomes
991 * available.
992 */
993#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800994#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
995#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
Jay Chokshi06fa7542011-12-07 13:09:17 -0800996#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800997
998static struct msm_xo_voter *xo_handle_d1;
999
1000static int isa1200_power(int on)
1001{
1002 int rc = 0;
1003
1004 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !!on);
1005
1006 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
1007 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
1008 if (rc < 0) {
1009 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
1010 __func__, on ? "" : "de-", rc);
1011 goto err_xo_vote;
1012 }
1013
1014 return 0;
1015
1016err_xo_vote:
1017 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !on);
1018 return rc;
1019}
1020
1021static int isa1200_dev_setup(bool enable)
1022{
1023 int rc = 0;
1024
1025 struct pm_gpio hap_gpio_config = {
1026 .direction = PM_GPIO_DIR_OUT,
1027 .pull = PM_GPIO_PULL_NO,
1028 .out_strength = PM_GPIO_STRENGTH_HIGH,
1029 .function = PM_GPIO_FUNC_NORMAL,
1030 .inv_int_pol = 0,
1031 .vin_sel = 2,
1032 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1033 .output_value = 0,
1034 };
1035
1036 if (enable == true) {
1037 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
1038 if (rc) {
1039 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1040 __func__, PM_HAP_EN_GPIO, rc);
1041 return rc;
1042 }
1043
1044 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
1045 if (rc) {
1046 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1047 __func__, PM_HAP_LEN_GPIO, rc);
1048 return rc;
1049 }
1050
1051 rc = gpio_request(HAP_SHIFT_LVL_OE_GPIO, "hap_shft_lvl_oe");
1052 if (rc) {
1053 pr_err("%s: unable to request gpio %d (%d)\n",
1054 __func__, HAP_SHIFT_LVL_OE_GPIO, rc);
1055 return rc;
1056 }
1057
1058 rc = gpio_direction_output(HAP_SHIFT_LVL_OE_GPIO, 0);
1059 if (rc) {
1060 pr_err("%s: Unable to set direction\n", __func__);
1061 goto free_gpio;
1062 }
1063
1064 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
1065 if (IS_ERR(xo_handle_d1)) {
1066 rc = PTR_ERR(xo_handle_d1);
1067 pr_err("%s: failed to get the handle for D1(%d)\n",
1068 __func__, rc);
1069 goto gpio_set_dir;
1070 }
1071 } else {
1072 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1073
1074 msm_xo_put(xo_handle_d1);
1075 }
1076
1077 return 0;
1078
1079gpio_set_dir:
1080 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, 0);
1081free_gpio:
1082 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1083 return rc;
1084}
1085
1086static struct isa1200_regulator isa1200_reg_data[] = {
1087 {
1088 .name = "vcc_i2c",
1089 .min_uV = ISA_I2C_VTG_MIN_UV,
1090 .max_uV = ISA_I2C_VTG_MAX_UV,
1091 .load_uA = ISA_I2C_CURR_UA,
1092 },
1093};
1094
1095static struct isa1200_platform_data isa1200_1_pdata = {
1096 .name = "vibrator",
1097 .dev_setup = isa1200_dev_setup,
1098 .power_on = isa1200_power,
1099 .hap_en_gpio = PM_HAP_EN_GPIO,
1100 .hap_len_gpio = PM_HAP_LEN_GPIO,
1101 .max_timeout = 15000,
1102 .mode_ctrl = PWM_GEN_MODE,
1103 .pwm_fd = {
1104 .pwm_div = 256,
1105 },
1106 .is_erm = false,
1107 .smart_en = true,
1108 .ext_clk_en = true,
1109 .chip_en = 1,
1110 .regulator_info = isa1200_reg_data,
1111 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1112};
1113
1114static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1115 {
1116 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1117 .platform_data = &isa1200_1_pdata,
1118 },
1119};
1120
1121#define CYTTSP_TS_GPIO_IRQ 11
1122#define CYTTSP_TS_SLEEP_GPIO 50
1123#define CYTTSP_TS_RESOUT_N_GPIO 52
1124
1125/*virtual key support */
1126static ssize_t tma340_vkeys_show(struct kobject *kobj,
1127 struct kobj_attribute *attr, char *buf)
1128{
1129 return snprintf(buf, 200,
1130 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1131 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1132 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1133 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1134 "\n");
1135}
1136
1137static struct kobj_attribute tma340_vkeys_attr = {
1138 .attr = {
1139 .mode = S_IRUGO,
1140 },
1141 .show = &tma340_vkeys_show,
1142};
1143
1144static struct attribute *tma340_properties_attrs[] = {
1145 &tma340_vkeys_attr.attr,
1146 NULL
1147};
1148
1149static struct attribute_group tma340_properties_attr_group = {
1150 .attrs = tma340_properties_attrs,
1151};
1152
1153
1154static int cyttsp_platform_init(struct i2c_client *client)
1155{
1156 int rc = 0;
1157 static struct kobject *tma340_properties_kobj;
1158
1159 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1160 tma340_properties_kobj = kobject_create_and_add("board_properties",
1161 NULL);
1162 if (tma340_properties_kobj)
1163 rc = sysfs_create_group(tma340_properties_kobj,
1164 &tma340_properties_attr_group);
1165 if (!tma340_properties_kobj || rc)
1166 pr_err("%s: failed to create board_properties\n",
1167 __func__);
1168
1169 return 0;
1170}
1171
1172static struct cyttsp_regulator regulator_data[] = {
1173 {
1174 .name = "vdd",
1175 .min_uV = CY_TMA300_VTG_MIN_UV,
1176 .max_uV = CY_TMA300_VTG_MAX_UV,
1177 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1178 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
1179 },
1180 /* TODO: Remove after runtime PM is enabled in I2C driver */
1181 {
1182 .name = "vcc_i2c",
1183 .min_uV = CY_I2C_VTG_MIN_UV,
1184 .max_uV = CY_I2C_VTG_MAX_UV,
1185 .hpm_load_uA = CY_I2C_CURR_UA,
1186 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
1187 },
1188};
1189
1190static struct cyttsp_platform_data cyttsp_pdata = {
1191 .panel_maxx = 634,
1192 .panel_maxy = 1166,
1193 .disp_maxx = 616,
1194 .disp_maxy = 1023,
1195 .disp_minx = 0,
1196 .disp_miny = 16,
1197 .flags = 0x01,
1198 .gen = CY_GEN3, /* or */
1199 .use_st = CY_USE_ST,
1200 .use_mt = CY_USE_MT,
1201 .use_hndshk = CY_SEND_HNDSHK,
1202 .use_trk_id = CY_USE_TRACKING_ID,
1203 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
1204 .use_gestures = CY_USE_GESTURES,
1205 .fw_fname = "cyttsp_8960_cdp.hex",
1206 /* activate up to 4 groups
1207 * and set active distance
1208 */
1209 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
1210 CY_GEST_GRP3 | CY_GEST_GRP4 |
1211 CY_ACT_DIST,
1212 /* change act_intrvl to customize the Active power state
1213 * scanning/processing refresh interval for Operating mode
1214 */
1215 .act_intrvl = CY_ACT_INTRVL_DFLT,
1216 /* change tch_tmout to customize the touch timeout for the
1217 * Active power state for Operating mode
1218 */
1219 .tch_tmout = CY_TCH_TMOUT_DFLT,
1220 /* change lp_intrvl to customize the Low Power power state
1221 * scanning/processing refresh interval for Operating mode
1222 */
1223 .lp_intrvl = CY_LP_INTRVL_DFLT,
1224 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
1225 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
1226 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1227 .regulator_info = regulator_data,
1228 .num_regulators = ARRAY_SIZE(regulator_data),
1229 .init = cyttsp_platform_init,
1230 .correct_fw_ver = 9,
1231};
1232
1233static struct i2c_board_info cyttsp_info[] __initdata = {
1234 {
1235 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1236 .platform_data = &cyttsp_pdata,
1237#ifndef CY_USE_TIMER
1238 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1239#endif /* CY_USE_TIMER */
1240 },
1241};
1242
Amy Malochef3c9db42011-12-08 15:17:35 -08001243#define MXT_TS_GPIO_IRQ 11
1244#define MXT_TS_RESET_GPIO 52
1245
1246static const u8 mxt_config_data_8930[] = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001247 /* T6 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001248 0, 0, 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001249 /* T38 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001250 15, 1, 0, 15, 12, 11, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001251 /* T7 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001252 48, 255, 25,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001253 /* T8 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001254 27, 0, 5, 1, 0, 0, 8, 8, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001255 /* T9 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001256 131, 0, 0, 19, 11, 0, 16, 35, 1, 3,
1257 10, 15, 1, 11, 4, 5, 40, 10, 54, 2,
1258 43, 4, 0, 0, 0, 0, 143, 40, 143, 80,
1259 18, 15, 50, 50, 2,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001260 /* T15 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001261 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1262 0,
1263 /* T18 Object */
1264 0, 0,
1265 /* T19 Object */
1266 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1267 0, 0, 0, 0, 0, 0,
1268 /* T23 Object */
1269 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1270 0, 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001271 /* T25 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001272 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1273 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001274 /* T40 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001275 0, 0, 0, 0, 0,
1276 /* T42 Object */
1277 0, 0, 0, 0, 0, 0, 0, 0,
1278 /* T46 Object */
1279 0, 3, 16, 48, 0, 0, 1, 0, 0,
1280 /* T47 Object */
1281 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1282 /* T48 Object */
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, 0, 0, 0, 0, 0, 0,
1288 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001289};
1290
Amy Malochef3c9db42011-12-08 15:17:35 -08001291static ssize_t mxt224e_vkeys_show(struct kobject *kobj,
1292 struct kobj_attribute *attr, char *buf)
1293{
1294 return snprintf(buf, 200,
1295 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":65:938:90:90"
1296 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":208:938:90:90"
1297 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":348:938:90:90"
1298 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":490:938:90:90"
1299 "\n");
1300}
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001301
Amy Malochef3c9db42011-12-08 15:17:35 -08001302static struct kobj_attribute mxt224e_vkeys_attr = {
1303 .attr = {
1304 .mode = S_IRUGO,
1305 },
1306 .show = &mxt224e_vkeys_show,
1307};
1308
1309static struct attribute *mxt224e_properties_attrs[] = {
1310 &mxt224e_vkeys_attr.attr,
1311 NULL
1312};
1313
1314static struct attribute_group mxt224e_properties_attr_group = {
1315 .attrs = mxt224e_properties_attrs,
1316};
1317
1318static void mxt_init_vkeys_8930(void)
1319{
1320 int rc;
1321 static struct kobject *mxt224e_properties_kobj;
1322
1323 mxt224e_vkeys_attr.attr.name = "virtualkeys.atmel_mxt_ts";
1324 mxt224e_properties_kobj = kobject_create_and_add("board_properties",
1325 NULL);
1326 if (mxt224e_properties_kobj)
1327 rc = sysfs_create_group(mxt224e_properties_kobj,
1328 &mxt224e_properties_attr_group);
1329 if (!mxt224e_properties_kobj || rc)
1330 pr_err("%s: failed to create board_properties\n",
1331 __func__);
1332
1333 return;
1334}
1335
1336static struct mxt_platform_data mxt_platform_data_8930 = {
1337 .config = mxt_config_data_8930,
1338 .config_length = ARRAY_SIZE(mxt_config_data_8930),
1339 .x_size = 1067,
1340 .y_size = 566,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001341 .irqflags = IRQF_TRIGGER_FALLING,
1342 .i2c_pull_up = true,
Amy Malochef3c9db42011-12-08 15:17:35 -08001343 .reset_gpio = MXT_TS_RESET_GPIO,
1344 .irq_gpio = MXT_TS_GPIO_IRQ,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001345};
1346
Amy Malochef3c9db42011-12-08 15:17:35 -08001347static struct i2c_board_info mxt_device_info_8930[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001348 {
Amy Malochef3c9db42011-12-08 15:17:35 -08001349 I2C_BOARD_INFO("atmel_mxt_ts", 0x4a),
1350 .platform_data = &mxt_platform_data_8930,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001351 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1352 },
1353};
1354
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001355static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
1356 .clk_freq = 100000,
1357 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001358};
1359
1360static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
1361 .clk_freq = 100000,
1362 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001363};
1364
1365static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
1366 .clk_freq = 100000,
1367 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001368};
1369
1370static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
1371 .clk_freq = 100000,
1372 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001373};
1374
1375static struct msm_rpm_platform_data msm_rpm_data = {
1376 .reg_base_addrs = {
1377 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
1378 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
1379 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
1380 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
1381 },
1382
1383 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
1384 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
1385 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1386 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
1387 .msm_apps_ipc_rpm_val = 4,
1388};
1389
1390static struct ks8851_pdata spi_eth_pdata = {
1391 .irq_gpio = KS8851_IRQ_GPIO,
1392 .rst_gpio = KS8851_RST_GPIO,
1393};
1394
1395static struct spi_board_info spi_board_info[] __initdata = {
1396 {
1397 .modalias = "ks8851",
1398 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1399 .max_speed_hz = 19200000,
1400 .bus_num = 0,
1401 .chip_select = 0,
1402 .mode = SPI_MODE_0,
1403 .platform_data = &spi_eth_pdata
1404 },
1405 {
1406 .modalias = "dsi_novatek_3d_panel_spi",
1407 .max_speed_hz = 10800000,
1408 .bus_num = 0,
1409 .chip_select = 1,
1410 .mode = SPI_MODE_0,
1411 },
1412};
1413
1414static struct platform_device msm_device_saw_core0 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001415 .name = "saw-regulator",
1416 .id = 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001417 .dev = {
David Collinsb4558422012-01-05 10:50:49 -08001418 .platform_data = &msm8930_saw_regulator_core0_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001419 },
1420};
1421
1422static struct platform_device msm_device_saw_core1 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001423 .name = "saw-regulator",
1424 .id = 1,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001425 .dev = {
David Collinsb4558422012-01-05 10:50:49 -08001426 .platform_data = &msm8930_saw_regulator_core1_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001427 },
1428};
1429
1430static struct tsens_platform_data msm_tsens_pdata = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001431 .slope = 910,
1432 .tsens_factor = 1000,
1433 .hw_type = MSM_8960,
1434 .tsens_num_sensor = 5,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001435};
1436
1437static struct platform_device msm_tsens_device = {
1438 .name = "tsens8960-tm",
1439 .id = -1,
1440 .dev = {
1441 .platform_data = &msm_tsens_pdata,
1442 },
1443};
1444
1445#ifdef CONFIG_MSM_FAKE_BATTERY
1446static struct platform_device fish_battery_device = {
1447 .name = "fish_battery",
1448};
1449#endif
1450
David Collins1d4061b2011-12-06 15:36:40 -08001451#ifndef MSM8930_PHASE_2
1452
1453/* 8930 Phase 1 */
Jay Chokshi06fa7542011-12-07 13:09:17 -08001454static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001455 .name = GPIO_REGULATOR_DEV_NAME,
1456 .id = PM8921_MPP_PM_TO_SYS(7),
1457 .dev = {
1458 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
1459 },
1460};
1461
Jay Chokshi06fa7542011-12-07 13:09:17 -08001462static struct platform_device msm8930_device_ext_l2_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001463 .name = GPIO_REGULATOR_DEV_NAME,
1464 .id = 91,
1465 .dev = {
1466 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
1467 },
1468};
1469
David Collins1d4061b2011-12-06 15:36:40 -08001470#else
1471
1472/* 8930 Phase 2 */
1473static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = {
1474 .name = GPIO_REGULATOR_DEV_NAME,
1475 .id = 63,
1476 .dev = {
1477 .platform_data =
1478 &msm8930_gpio_regulator_pdata[MSM8930_GPIO_VREG_ID_EXT_5V],
1479 },
1480};
1481
1482static struct platform_device msm8930_device_ext_otg_sw_vreg __devinitdata = {
1483 .name = GPIO_REGULATOR_DEV_NAME,
1484 .id = 97,
1485 .dev = {
1486 .platform_data =
1487 &msm8930_gpio_regulator_pdata[MSM8930_GPIO_VREG_ID_EXT_OTG_SW],
1488 },
1489};
1490
1491#endif
1492
Jay Chokshi06fa7542011-12-07 13:09:17 -08001493static struct platform_device msm8930_device_rpm_regulator __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001494 .name = "rpm-regulator",
1495 .id = -1,
1496 .dev = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001497 /*
1498 * TODO: When physical 8930/PM8038 hardware becomes
1499 * available, replace msm_rpm_regulator_pdata
1500 * with 8930 rpm regulator object.
1501 */
1502#if !defined(MSM8930_PHASE_2)
1503
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001504 .platform_data = &msm_rpm_regulator_pdata,
Jay Chokshi06fa7542011-12-07 13:09:17 -08001505#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001506 },
1507};
1508
1509static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
1510 .phys_addr_base = 0x0010C000,
1511 .reg_offsets = {
1512 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
1513 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
1514 },
1515 .phys_size = SZ_8K,
1516 .log_len = 4096, /* log's buffer length in bytes */
1517 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
1518};
1519
1520static struct platform_device msm_rpm_log_device = {
1521 .name = "msm_rpm_log",
1522 .id = -1,
1523 .dev = {
1524 .platform_data = &msm_rpm_log_pdata,
1525 },
1526};
1527
1528static struct platform_device *common_devices[] __initdata = {
1529 &msm8960_device_dmov,
1530 &msm_device_smd,
1531 &msm8960_device_uart_gsbi5,
1532 &msm_device_uart_dm6,
1533 &msm_device_saw_core0,
1534 &msm_device_saw_core1,
Jay Chokshi06fa7542011-12-07 13:09:17 -08001535 &msm8930_device_ext_5v_vreg,
David Collins1d4061b2011-12-06 15:36:40 -08001536#ifndef MSM8930_PHASE_2
Jay Chokshi06fa7542011-12-07 13:09:17 -08001537 &msm8930_device_ext_l2_vreg,
David Collins1d4061b2011-12-06 15:36:40 -08001538#endif
Jay Chokshi33c044a2011-12-07 13:05:40 -08001539 &msm8960_device_ssbi_pmic,
David Collins1d4061b2011-12-06 15:36:40 -08001540#ifdef MSM8930_PHASE_2
1541 &msm8930_device_ext_otg_sw_vreg,
1542#endif
Stephen Boyd28d54952011-12-16 13:19:51 -08001543 &msm_8960_q6_lpass,
1544 &msm_8960_q6_mss_fw,
1545 &msm_8960_q6_mss_sw,
Stephen Boyd322a9922011-09-20 01:05:54 -07001546 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07001547 &msm_pil_tzapps,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001548 &msm8960_device_qup_spi_gsbi1,
1549 &msm8960_device_qup_i2c_gsbi3,
1550 &msm8960_device_qup_i2c_gsbi4,
1551 &msm8960_device_qup_i2c_gsbi10,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001552 &msm8960_device_qup_i2c_gsbi12,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001553 &msm_slim_ctrl,
1554 &msm_device_wcnss_wlan,
1555#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1556 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1557 &qcrypto_device,
1558#endif
1559
1560#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1561 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1562 &qcedev_device,
1563#endif
1564#ifdef CONFIG_MSM_ROTATOR
1565 &msm_rotator_device,
1566#endif
1567 &msm_device_sps,
1568#ifdef CONFIG_MSM_FAKE_BATTERY
1569 &fish_battery_device,
1570#endif
1571#ifdef CONFIG_ANDROID_PMEM
1572#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
1573 &android_pmem_device,
1574 &android_pmem_adsp_device,
1575#endif
1576 &android_pmem_audio_device,
1577#endif
1578 &msm_device_vidc,
1579 &msm_device_bam_dmux,
1580 &msm_fm_platform_init,
1581
1582#ifdef CONFIG_HW_RANDOM_MSM
1583 &msm_device_rng,
1584#endif
1585 &msm_rpm_device,
1586#ifdef CONFIG_ION_MSM
1587 &ion_dev,
1588#endif
1589 &msm_rpm_log_device,
1590 &msm_rpm_stat_device,
1591 &msm_device_tz_log,
1592
1593#ifdef CONFIG_MSM_QDSS
1594 &msm_etb_device,
1595 &msm_tpiu_device,
1596 &msm_funnel_device,
1597 &msm_debug_device,
1598 &msm_ptm_device,
1599#endif
1600 &msm_device_dspcrashd_8960,
1601 &msm8960_device_watchdog,
1602};
1603
1604static struct platform_device *cdp_devices[] __initdata = {
1605 &msm8960_device_otg,
1606 &msm8960_device_gadget_peripheral,
1607 &msm_device_hsusb_host,
1608 &android_usb_device,
1609 &msm_pcm,
1610 &msm_pcm_routing,
1611 &msm_cpudai0,
1612 &msm_cpudai1,
1613 &msm_cpudai_hdmi_rx,
1614 &msm_cpudai_bt_rx,
1615 &msm_cpudai_bt_tx,
1616 &msm_cpudai_fm_rx,
1617 &msm_cpudai_fm_tx,
1618 &msm_cpudai_auxpcm_rx,
1619 &msm_cpudai_auxpcm_tx,
1620 &msm_cpu_fe,
1621 &msm_stub_codec,
1622 &msm_kgsl_3d0,
1623#ifdef CONFIG_MSM_KGSL_2D
1624 &msm_kgsl_2d0,
1625 &msm_kgsl_2d1,
1626#endif
1627#ifdef CONFIG_MSM_GEMINI
1628 &msm8960_gemini_device,
1629#endif
1630 &msm_voice,
1631 &msm_voip,
1632 &msm_lpa_pcm,
1633 &msm_cpudai_afe_01_rx,
1634 &msm_cpudai_afe_01_tx,
1635 &msm_cpudai_afe_02_rx,
1636 &msm_cpudai_afe_02_tx,
1637 &msm_pcm_afe,
Ajay Dudani79e268c2011-12-28 13:14:44 -08001638 &msm_compr_dsp,
1639 &msm_cpudai_incall_music_rx,
1640 &msm_cpudai_incall_record_rx,
1641 &msm_cpudai_incall_record_tx,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001642 &msm_pcm_hostless,
1643 &msm_bus_apps_fabric,
1644 &msm_bus_sys_fabric,
1645 &msm_bus_mm_fabric,
1646 &msm_bus_sys_fpb,
1647 &msm_bus_cpss_fpb,
1648 &msm_tsens_device,
1649};
1650
1651static void __init msm8930_i2c_init(void)
1652{
1653 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
1654 &msm8960_i2c_qup_gsbi4_pdata;
1655
1656 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
1657 &msm8960_i2c_qup_gsbi3_pdata;
1658
1659 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
1660 &msm8960_i2c_qup_gsbi10_pdata;
1661
1662 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
1663 &msm8960_i2c_qup_gsbi12_pdata;
1664}
1665
1666static void __init msm8930_gfx_init(void)
1667{
1668 uint32_t soc_platform_version = socinfo_get_version();
1669 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
1670 struct kgsl_device_platform_data *kgsl_3d0_pdata =
1671 msm_kgsl_3d0.dev.platform_data;
1672 kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
1673 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
1674 }
1675}
1676
1677static struct msm_cpuidle_state msm_cstates[] __initdata = {
1678 {0, 0, "C0", "WFI",
1679 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1680
1681 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1682 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1683
1684 {0, 2, "C2", "POWER_COLLAPSE",
1685 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
1686
1687 {1, 0, "C0", "WFI",
1688 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1689
1690 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1691 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1692};
1693
1694static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
1695 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1696 .idle_supported = 1,
1697 .suspend_supported = 1,
1698 .idle_enabled = 0,
1699 .suspend_enabled = 0,
1700 },
1701
1702 [MSM_PM_MODE(0, 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(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1710 .idle_supported = 1,
1711 .suspend_supported = 1,
1712 .idle_enabled = 1,
1713 .suspend_enabled = 1,
1714 },
1715
1716 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1717 .idle_supported = 0,
1718 .suspend_supported = 1,
1719 .idle_enabled = 0,
1720 .suspend_enabled = 0,
1721 },
1722
1723 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1724 .idle_supported = 1,
1725 .suspend_supported = 1,
1726 .idle_enabled = 0,
1727 .suspend_enabled = 0,
1728 },
1729
1730 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1731 .idle_supported = 1,
1732 .suspend_supported = 0,
1733 .idle_enabled = 1,
1734 .suspend_enabled = 0,
1735 },
1736};
1737
1738static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
1739 {
1740 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1741 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1742 true,
1743 100, 8000, 100000, 1,
1744 },
1745
1746 {
1747 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1748 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1749 true,
1750 2000, 6000, 60100000, 3000,
1751 },
1752
1753 {
1754 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1755 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1756 false,
1757 4200, 5000, 60350000, 3500,
1758 },
1759
1760 {
1761 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1762 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
1763 false,
1764 6300, 4500, 65350000, 4800,
1765 },
1766 {
1767 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1768 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
1769 false,
1770 7000, 3500, 66600000, 5150,
1771 },
1772
1773 {
1774 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1775 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1776 false,
1777 11700, 2500, 67850000, 5500,
1778 },
1779
1780 {
1781 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1782 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1783 false,
1784 13800, 2000, 71850000, 6800,
1785 },
1786
1787 {
1788 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1789 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1790 false,
1791 29700, 500, 75850000, 8800,
1792 },
1793
1794 {
1795 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1796 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1797 false,
1798 29700, 0, 76350000, 9800,
1799 },
1800};
1801
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06001802static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1803 .mode = MSM_PM_BOOT_CONFIG_TZ,
1804};
1805
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001806#ifdef CONFIG_I2C
1807#define I2C_SURF 1
1808#define I2C_FFA (1 << 1)
1809#define I2C_RUMI (1 << 2)
1810#define I2C_SIM (1 << 3)
1811#define I2C_FLUID (1 << 4)
1812#define I2C_LIQUID (1 << 5)
1813
1814struct i2c_registry {
1815 u8 machs;
1816 int bus;
1817 struct i2c_board_info *info;
1818 int len;
1819};
1820
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001821static void __init msm8930_init_hsic(void)
1822{
1823#ifdef CONFIG_USB_EHCI_MSM_HSIC
1824 uint32_t version = socinfo_get_version();
1825
1826 pr_info("%s: version:%d mtp:%d\n", __func__,
1827 SOCINFO_VERSION_MAJOR(version),
1828 machine_is_msm8930_mtp());
1829
1830 if ((SOCINFO_VERSION_MAJOR(version) == 1) ||
1831 machine_is_msm8930_mtp() ||
1832 machine_is_msm8930_fluid())
1833 return;
1834
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001835 platform_device_register(&msm_device_hsic_host);
1836#endif
1837}
1838
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001839#ifdef CONFIG_ISL9519_CHARGER
1840static struct isl_platform_data isl_data __initdata = {
1841 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
1842 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
1843 .max_system_voltage = 4200,
1844 .min_system_voltage = 3200,
1845 .chgcurrent = 1000, /* 1900, */
1846 .term_current = 400, /* Need fine tuning */
1847 .input_current = 2048,
1848};
1849
1850static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
1851 {
1852 I2C_BOARD_INFO("isl9519q", 0x9),
1853 .irq = 0, /* Not required when notify-by-pmic */
1854 .platform_data = &isl_data,
1855 },
1856};
1857#endif /* CONFIG_ISL9519_CHARGER */
1858
1859static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001860#ifdef CONFIG_ISL9519_CHARGER
1861 {
1862 I2C_LIQUID,
1863 MSM_8930_GSBI10_QUP_I2C_BUS_ID,
1864 isl_charger_i2c_info,
1865 ARRAY_SIZE(isl_charger_i2c_info),
1866 },
1867#endif /* CONFIG_ISL9519_CHARGER */
1868 {
1869 I2C_SURF | I2C_FFA | I2C_FLUID,
1870 MSM_8930_GSBI3_QUP_I2C_BUS_ID,
1871 cyttsp_info,
1872 ARRAY_SIZE(cyttsp_info),
1873 },
1874 {
1875 I2C_LIQUID,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001876 MSM_8930_GSBI10_QUP_I2C_BUS_ID,
1877 msm_isa1200_board_info,
1878 ARRAY_SIZE(msm_isa1200_board_info),
1879 },
Amy Malochef3c9db42011-12-08 15:17:35 -08001880 {
1881 I2C_SURF,
1882 MSM_8930_GSBI3_QUP_I2C_BUS_ID,
1883 mxt_device_info_8930,
1884 ARRAY_SIZE(mxt_device_info_8930),
1885 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001886};
1887#endif /* CONFIG_I2C */
1888
1889static void __init register_i2c_devices(void)
1890{
1891#ifdef CONFIG_I2C
1892 u8 mach_mask = 0;
1893 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08001894#ifdef CONFIG_MSM_CAMERA
1895 struct i2c_registry msm8930_camera_i2c_devices = {
1896 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
1897 MSM_8930_GSBI4_QUP_I2C_BUS_ID,
1898 msm8930_camera_board_info.board_info,
1899 msm8930_camera_board_info.num_i2c_board_info,
1900 };
1901#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001902
1903 /* Build the matching 'supported_machs' bitmask */
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08001904 if (machine_is_msm8930_cdp() || machine_is_msm8627_cdp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001905 mach_mask = I2C_SURF;
1906 else if (machine_is_msm8930_fluid())
1907 mach_mask = I2C_FLUID;
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08001908 else if (machine_is_msm8930_mtp() || machine_is_msm8627_mtp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001909 mach_mask = I2C_FFA;
1910 else
1911 pr_err("unmatched machine ID in register_i2c_devices\n");
1912
1913 /* Run the array and install devices as appropriate */
1914 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
1915 if (msm8960_i2c_devices[i].machs & mach_mask)
1916 i2c_register_board_info(msm8960_i2c_devices[i].bus,
1917 msm8960_i2c_devices[i].info,
1918 msm8960_i2c_devices[i].len);
1919 }
Kevin Chan09f4e662011-12-16 08:17:02 -08001920#ifdef CONFIG_MSM_CAMERA
1921 if (msm8930_camera_i2c_devices.machs & mach_mask)
1922 i2c_register_board_info(msm8930_camera_i2c_devices.bus,
1923 msm8930_camera_i2c_devices.info,
1924 msm8930_camera_i2c_devices.len);
1925#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001926#endif
1927}
1928
1929static void __init msm8930_cdp_init(void)
1930{
1931 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
1932 pr_err("meminfo_init() failed!\n");
1933
1934 BUG_ON(msm_rpm_init(&msm_rpm_data));
1935 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
1936 ARRAY_SIZE(msm_rpmrs_levels)));
1937
1938 regulator_suppress_info_printing();
1939 if (msm_xo_init())
1940 pr_err("Failed to initialize XO votes\n");
Jay Chokshi06fa7542011-12-07 13:09:17 -08001941 platform_device_register(&msm8930_device_rpm_regulator);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001942 msm_clock_init(&msm8960_clock_init_data);
1943 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
1944 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08001945 msm8930_init_gpiomux();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001946 msm8960_device_qup_spi_gsbi1.dev.platform_data =
1947 &msm8960_qup_spi_gsbi1_pdata;
1948 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
1949
Jay Chokshi06fa7542011-12-07 13:09:17 -08001950 /*
1951 * TODO: When physical 8930/PM8038 hardware becomes
1952 * available, remove this block or add the config
1953 * option.
1954 */
1955#ifndef MSM8930_PHASE_2
1956 msm8960_init_pmic();
1957#else
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001958 msm8930_init_pmic();
Jay Chokshi06fa7542011-12-07 13:09:17 -08001959#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001960 msm8930_i2c_init();
1961 msm8930_gfx_init();
1962 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
1963 msm_spm_l2_init(msm_spm_l2_data);
1964 msm8930_init_buses();
1965 platform_add_devices(msm_footswitch_devices,
1966 msm_num_footswitch_devices);
1967 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Jay Chokshi06fa7542011-12-07 13:09:17 -08001968 /*
1969 * TODO: When physical 8930/PM8038 hardware becomes
1970 * available, remove this block or add the config
1971 * option.
1972 */
1973#ifndef MSM8930_PHASE_2
1974 msm8960_pm8921_gpio_mpp_init();
1975#else
1976 msm8930_pm8038_gpio_mpp_init();
1977#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001978 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
1979 msm8930_init_hsic();
1980 msm8930_init_cam();
1981 msm8930_init_mmc();
Tianyi Gou7c6b81f2011-12-07 23:09:08 -08001982 acpuclk_init(&acpuclk_8930_soc_data);
Amy Malochef3c9db42011-12-08 15:17:35 -08001983 if (machine_is_msm8930_cdp() || machine_is_msm8627_cdp())
1984 mxt_init_vkeys_8930();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001985 register_i2c_devices();
1986 msm8930_init_fb();
1987 slim_register_board_info(msm_slim_devices,
1988 ARRAY_SIZE(msm_slim_devices));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001989 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
1990 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
1991 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
1992 msm_pm_data);
1993 change_memory_power = &msm8930_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06001994 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001995
1996 if (PLATFORM_IS_CHARM25())
1997 platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices));
1998}
1999
2000MACHINE_START(MSM8930_CDP, "QCT MSM8930 CDP")
2001 .map_io = msm8930_map_io,
2002 .reserve = msm8930_reserve,
2003 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302004 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002005 .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_MTP, "QCT MSM8930 MTP")
2012 .map_io = msm8930_map_io,
2013 .reserve = msm8930_reserve,
2014 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302015 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002016 .timer = &msm_timer,
2017 .init_machine = msm8930_cdp_init,
2018 .init_early = msm8930_allocate_memory_regions,
2019 .init_very_early = msm8930_early_memory,
2020MACHINE_END
2021
2022MACHINE_START(MSM8930_FLUID, "QCT MSM8930 FLUID")
2023 .map_io = msm8930_map_io,
2024 .reserve = msm8930_reserve,
2025 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302026 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002027 .timer = &msm_timer,
2028 .init_machine = msm8930_cdp_init,
2029 .init_early = msm8930_allocate_memory_regions,
2030 .init_very_early = msm8930_early_memory,
2031MACHINE_END
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002032
2033MACHINE_START(MSM8627_CDP, "QCT MSM8627 CDP")
2034 .map_io = msm8930_map_io,
2035 .reserve = msm8930_reserve,
2036 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302037 .handle_irq = gic_handle_irq,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002038 .timer = &msm_timer,
2039 .init_machine = msm8930_cdp_init,
2040 .init_early = msm8930_allocate_memory_regions,
2041 .init_very_early = msm8930_early_memory,
2042MACHINE_END
2043
2044MACHINE_START(MSM8627_MTP, "QCT MSM8627 MTP")
2045 .map_io = msm8930_map_io,
2046 .reserve = msm8930_reserve,
2047 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302048 .handle_irq = gic_handle_irq,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002049 .timer = &msm_timer,
2050 .init_machine = msm8930_cdp_init,
2051 .init_early = msm8930_allocate_memory_regions,
2052 .init_very_early = msm8930_early_memory,
2053MACHINE_END