blob: 748229e3a83f24a91ae19e25ee1d200a0c72c136 [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/*
2 * Copyright (C) 2008 Google, Inc.
3 * Copyright (c) 2008-2011, Code Aurora Forum. All rights reserved.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 */
15
16#include <linux/kernel.h>
17#include <linux/platform_device.h>
18
19#include <linux/dma-mapping.h>
20#include <asm/clkdev.h>
21#include <mach/irqs.h>
22#include <mach/msm_iomap.h>
23#include <mach/dma.h>
24#include <mach/board.h>
25
26#include "devices.h"
27#include "smd_private.h"
28
29#include <asm/mach/flash.h>
30
31#include <asm/mach/mmc.h>
32#include <mach/msm_hsusb.h>
33#include <mach/usbdiag.h>
34#include <mach/usb_gadget_fserial.h>
35#include <mach/rpc_hsusb.h>
36
37#include "clock-pcom.h"
38
39static struct resource resources_uart1[] = {
40 {
41 .start = INT_UART1,
42 .end = INT_UART1,
43 .flags = IORESOURCE_IRQ,
44 },
45 {
46 .start = MSM_UART1_PHYS,
47 .end = MSM_UART1_PHYS + MSM_UART1_SIZE - 1,
48 .flags = IORESOURCE_MEM,
49 },
50};
51
52static struct resource resources_uart2[] = {
53 {
54 .start = INT_UART2,
55 .end = INT_UART2,
56 .flags = IORESOURCE_IRQ,
57 },
58 {
59 .start = MSM_UART2_PHYS,
60 .end = MSM_UART2_PHYS + MSM_UART2_SIZE - 1,
61 .flags = IORESOURCE_MEM,
62 },
63};
64
65static struct resource resources_uart3[] = {
66 {
67 .start = INT_UART3,
68 .end = INT_UART3,
69 .flags = IORESOURCE_IRQ,
70 },
71 {
72 .start = MSM_UART3_PHYS,
73 .end = MSM_UART3_PHYS + MSM_UART3_SIZE - 1,
74 .flags = IORESOURCE_MEM,
75 },
76};
77
78struct platform_device msm_device_uart1 = {
79 .name = "msm_serial",
80 .id = 0,
81 .num_resources = ARRAY_SIZE(resources_uart1),
82 .resource = resources_uart1,
83};
84
85struct platform_device msm_device_uart2 = {
86 .name = "msm_serial",
87 .id = 1,
88 .num_resources = ARRAY_SIZE(resources_uart2),
89 .resource = resources_uart2,
90};
91
92struct platform_device msm_device_uart3 = {
93 .name = "msm_serial",
94 .id = 2,
95 .num_resources = ARRAY_SIZE(resources_uart3),
96 .resource = resources_uart3,
97};
98
99#define MSM_UART1DM_PHYS 0xA0200000
100#define MSM_UART2DM_PHYS 0xA0300000
101static struct resource msm_uart1_dm_resources[] = {
102 {
103 .start = MSM_UART1DM_PHYS,
104 .end = MSM_UART1DM_PHYS + PAGE_SIZE - 1,
105 .flags = IORESOURCE_MEM,
106 },
107 {
108 .start = INT_UART1DM_IRQ,
109 .end = INT_UART1DM_IRQ,
110 .flags = IORESOURCE_IRQ,
111 },
112 {
113 .start = INT_UART1DM_RX,
114 .end = INT_UART1DM_RX,
115 .flags = IORESOURCE_IRQ,
116 },
117 {
118 .start = DMOV_HSUART1_TX_CHAN,
119 .end = DMOV_HSUART1_RX_CHAN,
120 .name = "uartdm_channels",
121 .flags = IORESOURCE_DMA,
122 },
123 {
124 .start = DMOV_HSUART1_TX_CRCI,
125 .end = DMOV_HSUART1_RX_CRCI,
126 .name = "uartdm_crci",
127 .flags = IORESOURCE_DMA,
128 },
129};
130
131static u64 msm_uart_dm1_dma_mask = DMA_BIT_MASK(32);
132
133struct platform_device msm_device_uart_dm1 = {
134 .name = "msm_serial_hs",
135 .id = 0,
136 .num_resources = ARRAY_SIZE(msm_uart1_dm_resources),
137 .resource = msm_uart1_dm_resources,
138 .dev = {
139 .dma_mask = &msm_uart_dm1_dma_mask,
140 .coherent_dma_mask = DMA_BIT_MASK(32),
141 },
142};
143
144static struct resource msm_uart2_dm_resources[] = {
145 {
146 .start = MSM_UART2DM_PHYS,
147 .end = MSM_UART2DM_PHYS + PAGE_SIZE - 1,
148 .flags = IORESOURCE_MEM,
149 },
150 {
151 .start = INT_UART2DM_IRQ,
152 .end = INT_UART2DM_IRQ,
153 .flags = IORESOURCE_IRQ,
154 },
155 {
156 .start = INT_UART2DM_RX,
157 .end = INT_UART2DM_RX,
158 .flags = IORESOURCE_IRQ,
159 },
160 {
161 .start = DMOV_HSUART2_TX_CHAN,
162 .end = DMOV_HSUART2_RX_CHAN,
163 .name = "uartdm_channels",
164 .flags = IORESOURCE_DMA,
165 },
166 {
167 .start = DMOV_HSUART2_TX_CRCI,
168 .end = DMOV_HSUART2_RX_CRCI,
169 .name = "uartdm_crci",
170 .flags = IORESOURCE_DMA,
171 },
172};
173
174static u64 msm_uart_dm2_dma_mask = DMA_BIT_MASK(32);
175
176struct platform_device msm_device_uart_dm2 = {
177 .name = "msm_serial_hs",
178 .id = 1,
179 .num_resources = ARRAY_SIZE(msm_uart2_dm_resources),
180 .resource = msm_uart2_dm_resources,
181 .dev = {
182 .dma_mask = &msm_uart_dm2_dma_mask,
183 .coherent_dma_mask = DMA_BIT_MASK(32),
184 },
185};
186
187#define MSM_I2C_SIZE SZ_4K
188#define MSM_I2C_PHYS 0xA9900000
189static struct resource resources_i2c[] = {
190 {
191 .start = MSM_I2C_PHYS,
192 .end = MSM_I2C_PHYS + MSM_I2C_SIZE - 1,
193 .flags = IORESOURCE_MEM,
194 },
195 {
196 .start = INT_PWB_I2C,
197 .end = INT_PWB_I2C,
198 .flags = IORESOURCE_IRQ,
199 },
200};
201
202struct platform_device msm_device_i2c = {
203 .name = "msm_i2c",
204 .id = 0,
205 .num_resources = ARRAY_SIZE(resources_i2c),
206 .resource = resources_i2c,
207};
208
209#define MSM_HSUSB_PHYS 0xA0800000
210static struct resource resources_hsusb_otg[] = {
211 {
212 .start = MSM_HSUSB_PHYS,
213 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
214 .flags = IORESOURCE_MEM,
215 },
216 {
217 .start = INT_USB_HS,
218 .end = INT_USB_HS,
219 .flags = IORESOURCE_IRQ,
220 },
221};
222
223static u64 dma_mask = 0xffffffffULL;
224struct platform_device msm_device_hsusb_otg = {
225 .name = "msm_hsusb_otg",
226 .id = -1,
227 .num_resources = ARRAY_SIZE(resources_hsusb_otg),
228 .resource = resources_hsusb_otg,
229 .dev = {
230 .dma_mask = &dma_mask,
231 .coherent_dma_mask = 0xffffffffULL,
232 },
233};
234
235static struct resource resources_hsusb_peripheral[] = {
236 {
237 .start = MSM_HSUSB_PHYS,
238 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
239 .flags = IORESOURCE_MEM,
240 },
241 {
242 .start = INT_USB_HS,
243 .end = INT_USB_HS,
244 .flags = IORESOURCE_IRQ,
245 },
246};
247
248static struct resource resources_gadget_peripheral[] = {
249 {
250 .start = MSM_HSUSB_PHYS,
251 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
252 .flags = IORESOURCE_MEM,
253 },
254 {
255 .start = INT_USB_HS,
256 .end = INT_USB_HS,
257 .flags = IORESOURCE_IRQ,
258 },
259};
260
261struct platform_device msm_device_hsusb_peripheral = {
262 .name = "msm_hsusb_peripheral",
263 .id = -1,
264 .num_resources = ARRAY_SIZE(resources_hsusb_peripheral),
265 .resource = resources_hsusb_peripheral,
266 .dev = {
267 .dma_mask = &dma_mask,
268 .coherent_dma_mask = 0xffffffffULL,
269 },
270};
271
272struct platform_device msm_device_gadget_peripheral = {
273 .name = "msm_hsusb",
274 .id = -1,
275 .num_resources = ARRAY_SIZE(resources_gadget_peripheral),
276 .resource = resources_gadget_peripheral,
277 .dev = {
278 .dma_mask = &dma_mask,
279 .coherent_dma_mask = 0xffffffffULL,
280 },
281};
282
283static struct resource resources_hsusb_host[] = {
284 {
285 .start = MSM_HSUSB_PHYS,
286 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
287 .flags = IORESOURCE_MEM,
288 },
289 {
290 .start = INT_USB_HS,
291 .end = INT_USB_HS,
292 .flags = IORESOURCE_IRQ,
293 },
294};
295
296struct platform_device msm_device_hsusb_host = {
297 .name = "msm_hsusb_host",
298 .id = 0,
299 .num_resources = ARRAY_SIZE(resources_hsusb_host),
300 .resource = resources_hsusb_host,
301 .dev = {
302 .dma_mask = &dma_mask,
303 .coherent_dma_mask = 0xffffffffULL,
304 },
305};
306
307static struct platform_device *msm_host_devices[] = {
308 &msm_device_hsusb_host,
309};
310
311int msm_add_host(unsigned int host, struct msm_usb_host_platform_data *plat)
312{
313 struct platform_device *pdev;
314
315 pdev = msm_host_devices[host];
316 if (!pdev)
317 return -ENODEV;
318 pdev->dev.platform_data = plat;
319 return platform_device_register(pdev);
320}
321
322#ifdef CONFIG_USB_ANDROID_DIAG
323struct usb_diag_platform_data usb_diag_pdata = {
324 .ch_name = DIAG_LEGACY,
325 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
326};
327
328struct platform_device usb_diag_device = {
329 .name = "usb_diag",
330 .id = -1,
331 .dev = {
332 .platform_data = &usb_diag_pdata,
333 },
334};
335#endif
336
337#ifdef CONFIG_USB_F_SERIAL
338static struct usb_gadget_fserial_platform_data fserial_pdata = {
339 .no_ports = 2,
340};
341
342struct platform_device usb_gadget_fserial_device = {
343 .name = "usb_fserial",
344 .id = -1,
345 .dev = {
346 .platform_data = &fserial_pdata,
347 },
348};
349#endif
350
351#define MSM_NAND_PHYS 0xA0A00000
352static struct resource resources_nand[] = {
353 [0] = {
354 .name = "msm_nand_dmac",
355 .start = DMOV_NAND_CHAN,
356 .end = DMOV_NAND_CHAN,
357 .flags = IORESOURCE_DMA,
358 },
359 [1] = {
360 .name = "msm_nand_phys",
361 .start = MSM_NAND_PHYS,
362 .end = MSM_NAND_PHYS + 0x7FF,
363 .flags = IORESOURCE_MEM,
364 },
365};
366
367static struct resource resources_otg[] = {
368 {
369 .start = MSM_HSUSB_PHYS,
370 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
371 .flags = IORESOURCE_MEM,
372 },
373 {
374 .start = INT_USB_HS,
375 .end = INT_USB_HS,
376 .flags = IORESOURCE_IRQ,
377 },
378};
379
380struct platform_device msm_device_otg = {
381 .name = "msm_otg",
382 .id = -1,
383 .num_resources = ARRAY_SIZE(resources_otg),
384 .resource = resources_otg,
385 .dev = {
386 .coherent_dma_mask = 0xffffffffULL,
387 },
388};
389
390struct flash_platform_data msm_nand_data = {
391 .parts = NULL,
392 .nr_parts = 0,
393};
394
395struct platform_device msm_device_nand = {
396 .name = "msm_nand",
397 .id = -1,
398 .num_resources = ARRAY_SIZE(resources_nand),
399 .resource = resources_nand,
400 .dev = {
401 .platform_data = &msm_nand_data,
402 },
403};
404
405struct platform_device msm_device_smd = {
406 .name = "msm_smd",
407 .id = -1,
408};
409
410struct resource msm_dmov_resource[] = {
411 {
412 .start = INT_ADM_AARM,
413 .end = (resource_size_t)MSM_DMOV_BASE,
414 .flags = IORESOURCE_IRQ,
415 },
416};
417
418struct platform_device msm_device_dmov = {
419 .name = "msm_dmov",
420 .id = -1,
421 .resource = msm_dmov_resource,
422 .num_resources = ARRAY_SIZE(msm_dmov_resource),
423};
424
425#define MSM_SDC1_BASE 0xA0400000
426#define MSM_SDC2_BASE 0xA0500000
427#define MSM_SDC3_BASE 0xA0600000
428#define MSM_SDC4_BASE 0xA0700000
429static struct resource resources_sdc1[] = {
430 {
431 .start = MSM_SDC1_BASE,
432 .end = MSM_SDC1_BASE + SZ_4K - 1,
433 .flags = IORESOURCE_MEM,
434 },
435 {
436 .start = INT_SDC1_0,
437 .end = INT_SDC1_1,
438 .flags = IORESOURCE_IRQ,
439 },
440 {
441 .start = 8,
442 .end = 8,
443 .flags = IORESOURCE_DMA,
444 },
445};
446
447static struct resource resources_sdc2[] = {
448 {
449 .start = MSM_SDC2_BASE,
450 .end = MSM_SDC2_BASE + SZ_4K - 1,
451 .flags = IORESOURCE_MEM,
452 },
453 {
454 .start = INT_SDC2_0,
455 .end = INT_SDC2_1,
456 .flags = IORESOURCE_IRQ,
457 },
458 {
459 .start = 8,
460 .end = 8,
461 .flags = IORESOURCE_DMA,
462 },
463};
464
465static struct resource resources_sdc3[] = {
466 {
467 .start = MSM_SDC3_BASE,
468 .end = MSM_SDC3_BASE + SZ_4K - 1,
469 .flags = IORESOURCE_MEM,
470 },
471 {
472 .start = INT_SDC3_0,
473 .end = INT_SDC3_1,
474 .flags = IORESOURCE_IRQ,
475 },
476 {
477 .start = 8,
478 .end = 8,
479 .flags = IORESOURCE_DMA,
480 },
481};
482
483static struct resource resources_sdc4[] = {
484 {
485 .start = MSM_SDC4_BASE,
486 .end = MSM_SDC4_BASE + SZ_4K - 1,
487 .flags = IORESOURCE_MEM,
488 },
489 {
490 .start = INT_SDC4_0,
491 .end = INT_SDC4_1,
492 .flags = IORESOURCE_IRQ,
493 },
494 {
495 .start = 8,
496 .end = 8,
497 .flags = IORESOURCE_DMA,
498 },
499};
500
501struct platform_device msm_device_sdc1 = {
502 .name = "msm_sdcc",
503 .id = 1,
504 .num_resources = ARRAY_SIZE(resources_sdc1),
505 .resource = resources_sdc1,
506 .dev = {
507 .coherent_dma_mask = 0xffffffff,
508 },
509};
510
511struct platform_device msm_device_sdc2 = {
512 .name = "msm_sdcc",
513 .id = 2,
514 .num_resources = ARRAY_SIZE(resources_sdc2),
515 .resource = resources_sdc2,
516 .dev = {
517 .coherent_dma_mask = 0xffffffff,
518 },
519};
520
521struct platform_device msm_device_sdc3 = {
522 .name = "msm_sdcc",
523 .id = 3,
524 .num_resources = ARRAY_SIZE(resources_sdc3),
525 .resource = resources_sdc3,
526 .dev = {
527 .coherent_dma_mask = 0xffffffff,
528 },
529};
530
531struct platform_device msm_device_sdc4 = {
532 .name = "msm_sdcc",
533 .id = 4,
534 .num_resources = ARRAY_SIZE(resources_sdc4),
535 .resource = resources_sdc4,
536 .dev = {
537 .coherent_dma_mask = 0xffffffff,
538 },
539};
540
541static struct platform_device *msm_sdcc_devices[] __initdata = {
542 &msm_device_sdc1,
543 &msm_device_sdc2,
544 &msm_device_sdc3,
545 &msm_device_sdc4,
546};
547
548int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat)
549{
550 struct platform_device *pdev;
551
552 if (controller < 1 || controller > 4)
553 return -EINVAL;
554
555 pdev = msm_sdcc_devices[controller-1];
556 pdev->dev.platform_data = plat;
557 return platform_device_register(pdev);
558}
559
560#define RAMFS_INFO_MAGICNUMBER 0x654D4D43
561#define RAMFS_INFO_VERSION 0x00000001
562#define RAMFS_MODEMSTORAGE_ID 0x4D454653
563
564static struct resource rmt_storage_resources[] = {
565 {
566 .flags = IORESOURCE_MEM,
567 },
568};
569
570static struct platform_device rmt_storage_device = {
571 .name = "rmt_storage",
572 .id = -1,
573 .num_resources = ARRAY_SIZE(rmt_storage_resources),
574 .resource = rmt_storage_resources,
575};
576
577struct shared_ramfs_entry {
578 uint32_t client_id; /* Client id to uniquely identify a client */
579 uint32_t base_addr; /* Base address of shared RAMFS memory */
580 uint32_t size; /* Size of the shared RAMFS memory */
581 uint32_t reserved; /* Reserved attribute for future use */
582};
583struct shared_ramfs_table {
584 uint32_t magic_id; /* Identify RAMFS details in SMEM */
585 uint32_t version; /* Version of shared_ramfs_table */
586 uint32_t entries; /* Total number of valid entries */
587 struct shared_ramfs_entry ramfs_entry[3]; /* List all entries */
588};
589
590int __init rmt_storage_add_ramfs(void)
591{
592 struct shared_ramfs_table *ramfs_table;
593 struct shared_ramfs_entry *ramfs_entry;
594 int index;
595
596 ramfs_table = smem_alloc(SMEM_SEFS_INFO,
597 sizeof(struct shared_ramfs_table));
598
599 if (!ramfs_table) {
600 printk(KERN_WARNING "%s: No RAMFS table in SMEM\n", __func__);
601 return -ENOENT;
602 }
603
604 if ((ramfs_table->magic_id != (u32) RAMFS_INFO_MAGICNUMBER) ||
605 (ramfs_table->version != (u32) RAMFS_INFO_VERSION)) {
606 printk(KERN_WARNING "%s: Magic / Version mismatch:, "
607 "magic_id=%#x, format_version=%#x\n", __func__,
608 ramfs_table->magic_id, ramfs_table->version);
609 return -ENOENT;
610 }
611
612 for (index = 0; index < ramfs_table->entries; index++) {
613 ramfs_entry = &ramfs_table->ramfs_entry[index];
614
615 /* Find a match for the Modem Storage RAMFS area */
616 if (ramfs_entry->client_id == (u32) RAMFS_MODEMSTORAGE_ID) {
617 printk(KERN_INFO "%s: RAMFS Info (from SMEM): "
618 "Baseaddr = 0x%08x, Size = 0x%08x\n", __func__,
619 ramfs_entry->base_addr, ramfs_entry->size);
620
621 rmt_storage_resources[0].start = ramfs_entry->base_addr;
622 rmt_storage_resources[0].end = ramfs_entry->base_addr +
623 ramfs_entry->size - 1;
624 platform_device_register(&rmt_storage_device);
625 return 0;
626 }
627 }
628 return -ENOENT;
629}
630
631#if defined(CONFIG_FB_MSM_MDP40)
632#define MDP_BASE 0xA3F00000
633#define PMDH_BASE 0xAD600000
634#define EMDH_BASE 0xAD700000
635#define TVENC_BASE 0xAD400000
636#else
637#define MDP_BASE 0xAA200000
638#define PMDH_BASE 0xAA600000
639#define EMDH_BASE 0xAA700000
640#define TVENC_BASE 0xAA400000
641#endif
642
643static struct resource msm_mdp_resources[] = {
644 {
645 .name = "mdp",
646 .start = MDP_BASE,
647 .end = MDP_BASE + 0x000F0000 - 1,
648 .flags = IORESOURCE_MEM,
649 },
650 {
651 .start = INT_MDP,
652 .end = INT_MDP,
653 .flags = IORESOURCE_IRQ,
654 },
655};
656
657static struct resource msm_mddi_resources[] = {
658 {
659 .name = "pmdh",
660 .start = PMDH_BASE,
661 .end = PMDH_BASE + PAGE_SIZE - 1,
662 .flags = IORESOURCE_MEM,
663 }
664};
665
666static struct resource msm_mddi_ext_resources[] = {
667 {
668 .name = "emdh",
669 .start = EMDH_BASE,
670 .end = EMDH_BASE + PAGE_SIZE - 1,
671 .flags = IORESOURCE_MEM,
672 }
673};
674
675static struct resource msm_ebi2_lcd_resources[] = {
676 {
677 .name = "base",
678 .start = 0xa0d00000,
679 .end = 0xa0d00000 + PAGE_SIZE - 1,
680 .flags = IORESOURCE_MEM,
681 },
682 {
683 .name = "lcd01",
684 .start = 0x98000000,
685 .end = 0x98000000 + 0x80000 - 1,
686 .flags = IORESOURCE_MEM,
687 },
688 {
689 .name = "lcd02",
690 .start = 0x9c000000,
691 .end = 0x9c000000 + 0x80000 - 1,
692 .flags = IORESOURCE_MEM,
693 },
694};
695
696static struct resource msm_tvenc_resources[] = {
697 {
698 .name = "tvenc",
699 .start = TVENC_BASE,
700 .end = TVENC_BASE + PAGE_SIZE - 1,
701 .flags = IORESOURCE_MEM,
702 }
703};
704
705static struct platform_device msm_mdp_device = {
706 .name = "mdp",
707 .id = 0,
708 .num_resources = ARRAY_SIZE(msm_mdp_resources),
709 .resource = msm_mdp_resources,
710};
711
712static struct platform_device msm_mddi_device = {
713 .name = "mddi",
714 .id = 0,
715 .num_resources = ARRAY_SIZE(msm_mddi_resources),
716 .resource = msm_mddi_resources,
717};
718
719static struct platform_device msm_mddi_ext_device = {
720 .name = "mddi_ext",
721 .id = 0,
722 .num_resources = ARRAY_SIZE(msm_mddi_ext_resources),
723 .resource = msm_mddi_ext_resources,
724};
725
726static struct platform_device msm_ebi2_lcd_device = {
727 .name = "ebi2_lcd",
728 .id = 0,
729 .num_resources = ARRAY_SIZE(msm_ebi2_lcd_resources),
730 .resource = msm_ebi2_lcd_resources,
731};
732
733static struct platform_device msm_lcdc_device = {
734 .name = "lcdc",
735 .id = 0,
736};
737
738static struct platform_device msm_tvenc_device = {
739 .name = "tvenc",
740 .id = 0,
741 .num_resources = ARRAY_SIZE(msm_tvenc_resources),
742 .resource = msm_tvenc_resources,
743};
744
745/* TSIF begin */
746#if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE)
747
748#define MSM_TSIF_PHYS (0xa0100000)
749#define MSM_TSIF_SIZE (0x200)
750
751static struct resource tsif_resources[] = {
752 [0] = {
753 .flags = IORESOURCE_IRQ,
754 .start = INT_TSIF_IRQ,
755 .end = INT_TSIF_IRQ,
756 },
757 [1] = {
758 .flags = IORESOURCE_MEM,
759 .start = MSM_TSIF_PHYS,
760 .end = MSM_TSIF_PHYS + MSM_TSIF_SIZE - 1,
761 },
762 [2] = {
763 .flags = IORESOURCE_DMA,
764 .start = DMOV_TSIF_CHAN,
765 .end = DMOV_TSIF_CRCI,
766 },
767};
768
769static void tsif_release(struct device *dev)
770{
771 dev_info(dev, "release\n");
772}
773
774struct platform_device msm_device_tsif = {
775 .name = "msm_tsif",
776 .id = 0,
777 .num_resources = ARRAY_SIZE(tsif_resources),
778 .resource = tsif_resources,
779 .dev = {
780 .release = tsif_release,
781 },
782};
783#endif /* defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE) */
784/* TSIF end */
785
786#define MSM_TSSC_PHYS 0xAA300000
787static struct resource resources_tssc[] = {
788 {
789 .start = MSM_TSSC_PHYS,
790 .end = MSM_TSSC_PHYS + SZ_4K - 1,
791 .name = "tssc",
792 .flags = IORESOURCE_MEM,
793 },
794 {
795 .start = INT_TCHSCRN1,
796 .end = INT_TCHSCRN1,
797 .name = "tssc1",
798 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
799 },
800 {
801 .start = INT_TCHSCRN2,
802 .end = INT_TCHSCRN2,
803 .name = "tssc2",
804 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
805 },
806};
807
808struct platform_device msm_device_tssc = {
809 .name = "msm_touchscreen",
810 .id = 0,
811 .num_resources = ARRAY_SIZE(resources_tssc),
812 .resource = resources_tssc,
813};
814
815static void __init msm_register_device(struct platform_device *pdev, void *data)
816{
817 int ret;
818
819 pdev->dev.platform_data = data;
820
821 ret = platform_device_register(pdev);
822 if (ret)
823 dev_err(&pdev->dev,
824 "%s: platform_device_register() failed = %d\n",
825 __func__, ret);
826}
827
828void __init msm_fb_register_device(char *name, void *data)
829{
830 if (!strncmp(name, "mdp", 3))
831 msm_register_device(&msm_mdp_device, data);
832 else if (!strncmp(name, "pmdh", 4))
833 msm_register_device(&msm_mddi_device, data);
834 else if (!strncmp(name, "emdh", 4))
835 msm_register_device(&msm_mddi_ext_device, data);
836 else if (!strncmp(name, "ebi2", 4))
837 msm_register_device(&msm_ebi2_lcd_device, data);
838 else if (!strncmp(name, "tvenc", 5))
839 msm_register_device(&msm_tvenc_device, data);
840 else if (!strncmp(name, "lcdc", 4))
841 msm_register_device(&msm_lcdc_device, data);
842 else
843 printk(KERN_ERR "%s: unknown device! %s\n", __func__, name);
844}
845
846static struct platform_device msm_camera_device = {
847 .name = "msm_camera",
848 .id = 0,
849};
850
851void __init msm_camera_register_device(void *res, uint32_t num,
852 void *data)
853{
854 msm_camera_device.num_resources = num;
855 msm_camera_device.resource = res;
856
857 msm_register_device(&msm_camera_device, data);
858}
859
860static DEFINE_CLK_PCOM(adm_clk, ADM_CLK, 0);
861static DEFINE_CLK_PCOM(adsp_clk, ADSP_CLK, 0);
862static DEFINE_CLK_PCOM(ebi1_clk, EBI1_CLK, CLK_MIN);
863static DEFINE_CLK_PCOM(ebi2_clk, EBI2_CLK, 0);
864static DEFINE_CLK_PCOM(ecodec_clk, ECODEC_CLK, 0);
865static DEFINE_CLK_PCOM(gp_clk, GP_CLK, 0);
866static DEFINE_CLK_PCOM(i2c_clk, I2C_CLK, 0);
867static DEFINE_CLK_PCOM(icodec_rx_clk, ICODEC_RX_CLK, 0);
868static DEFINE_CLK_PCOM(icodec_tx_clk, ICODEC_TX_CLK, 0);
869static DEFINE_CLK_PCOM(imem_clk, IMEM_CLK, OFF);
870static DEFINE_CLK_PCOM(mdc_clk, MDC_CLK, 0);
871static DEFINE_CLK_PCOM(pmdh_clk, PMDH_CLK, OFF | CLK_MINMAX);
872static DEFINE_CLK_PCOM(mdp_clk, MDP_CLK, OFF);
873static DEFINE_CLK_PCOM(mdp_lcdc_pclk_clk, MDP_LCDC_PCLK_CLK, 0);
874static DEFINE_CLK_PCOM(mdp_lcdc_pad_pclk_clk, MDP_LCDC_PAD_PCLK_CLK, 0);
875static DEFINE_CLK_PCOM(mdp_vsync_clk, MDP_VSYNC_CLK, OFF);
876static DEFINE_CLK_PCOM(pbus_clk, PBUS_CLK, CLK_MIN);
877static DEFINE_CLK_PCOM(pcm_clk, PCM_CLK, 0);
878static DEFINE_CLK_PCOM(sdac_clk, SDAC_CLK, OFF);
879static DEFINE_CLK_PCOM(sdc1_clk, SDC1_CLK, OFF);
880static DEFINE_CLK_PCOM(sdc1_p_clk, SDC1_P_CLK, OFF);
881static DEFINE_CLK_PCOM(sdc2_clk, SDC2_CLK, OFF);
882static DEFINE_CLK_PCOM(sdc2_p_clk, SDC2_P_CLK, OFF);
883static DEFINE_CLK_PCOM(sdc3_clk, SDC3_CLK, OFF);
884static DEFINE_CLK_PCOM(sdc3_p_clk, SDC3_P_CLK, OFF);
885static DEFINE_CLK_PCOM(sdc4_clk, SDC4_CLK, OFF);
886static DEFINE_CLK_PCOM(sdc4_p_clk, SDC4_P_CLK, OFF);
887static DEFINE_CLK_PCOM(uart1_clk, UART1_CLK, OFF);
888static DEFINE_CLK_PCOM(uart2_clk, UART2_CLK, 0);
889static DEFINE_CLK_PCOM(uart3_clk, UART3_CLK, OFF);
890static DEFINE_CLK_PCOM(uart1dm_clk, UART1DM_CLK, OFF);
891static DEFINE_CLK_PCOM(uart2dm_clk, UART2DM_CLK, 0);
892static DEFINE_CLK_PCOM(usb_hs_clk, USB_HS_CLK, OFF);
893static DEFINE_CLK_PCOM(usb_hs_p_clk, USB_HS_P_CLK, OFF);
894static DEFINE_CLK_PCOM(usb_otg_clk, USB_OTG_CLK, 0);
895static DEFINE_CLK_PCOM(vdc_clk, VDC_CLK, OFF | CLK_MIN);
896static DEFINE_CLK_PCOM(vfe_clk, VFE_CLK, OFF);
897static DEFINE_CLK_PCOM(vfe_mdc_clk, VFE_MDC_CLK, OFF);
898
899struct clk_lookup msm_clocks_7x25[] = {
900 CLK_LOOKUP("adm_clk", adm_clk.c, NULL),
901 CLK_LOOKUP("adsp_clk", adsp_clk.c, NULL),
902 CLK_LOOKUP("ebi1_clk", ebi1_clk.c, NULL),
903 CLK_LOOKUP("ebi2_clk", ebi2_clk.c, NULL),
904 CLK_LOOKUP("ecodec_clk", ecodec_clk.c, NULL),
905 CLK_LOOKUP("gp_clk", gp_clk.c, NULL),
906 CLK_LOOKUP("i2c_clk", i2c_clk.c, "msm_i2c.0"),
907 CLK_LOOKUP("icodec_rx_clk", icodec_rx_clk.c, NULL),
908 CLK_LOOKUP("icodec_tx_clk", icodec_tx_clk.c, NULL),
909 CLK_LOOKUP("imem_clk", imem_clk.c, NULL),
910 CLK_LOOKUP("mdc_clk", mdc_clk.c, NULL),
911 CLK_LOOKUP("mddi_clk", pmdh_clk.c, NULL),
912 CLK_LOOKUP("mdp_clk", mdp_clk.c, NULL),
913 CLK_LOOKUP("mdp_lcdc_pclk_clk", mdp_lcdc_pclk_clk.c, NULL),
914 CLK_LOOKUP("mdp_lcdc_pad_pclk_clk", mdp_lcdc_pad_pclk_clk.c, NULL),
915 CLK_LOOKUP("mdp_vsync_clk", mdp_vsync_clk.c, NULL),
916 CLK_LOOKUP("pbus_clk", pbus_clk.c, NULL),
917 CLK_LOOKUP("pcm_clk", pcm_clk.c, NULL),
918 CLK_LOOKUP("sdac_clk", sdac_clk.c, NULL),
919 CLK_LOOKUP("sdc_clk", sdc1_clk.c, "msm_sdcc.1"),
920 CLK_LOOKUP("sdc_pclk", sdc1_p_clk.c, "msm_sdcc.1"),
921 CLK_LOOKUP("sdc_clk", sdc2_clk.c, "msm_sdcc.2"),
922 CLK_LOOKUP("sdc_pclk", sdc2_p_clk.c, "msm_sdcc.2"),
923 CLK_LOOKUP("sdc_clk", sdc3_clk.c, "msm_sdcc.3"),
924 CLK_LOOKUP("sdc_pclk", sdc3_p_clk.c, "msm_sdcc.3"),
925 CLK_LOOKUP("sdc_clk", sdc4_clk.c, "msm_sdcc.4"),
926 CLK_LOOKUP("sdc_pclk", sdc4_p_clk.c, "msm_sdcc.4"),
927 CLK_LOOKUP("uart_clk", uart1_clk.c, "msm_serial.0"),
928 CLK_LOOKUP("uart_clk", uart2_clk.c, "msm_serial.1"),
929 CLK_LOOKUP("uart_clk", uart3_clk.c, "msm_serial.2"),
930 CLK_LOOKUP("uartdm_clk", uart1dm_clk.c, "msm_serial_hs.0"),
931 CLK_LOOKUP("uartdm_clk", uart2dm_clk.c, "msm_serial_hs.1"),
932 CLK_LOOKUP("usb_hs_clk", usb_hs_clk.c, NULL),
933 CLK_LOOKUP("usb_hs_pclk", usb_hs_p_clk.c, NULL),
934 CLK_LOOKUP("usb_otg_clk", usb_otg_clk.c, NULL),
935 CLK_LOOKUP("vdc_clk", vdc_clk.c, NULL),
936 CLK_LOOKUP("vfe_clk", vfe_clk.c, NULL),
937 CLK_LOOKUP("vfe_mdc_clk", vfe_mdc_clk.c, NULL),
938};
939
940unsigned msm_num_clocks_7x25 = ARRAY_SIZE(msm_clocks_7x25);
941