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