diff options
author | Tony Lindgren <tony@atomide.com> | 2008-07-03 05:24:37 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2008-07-03 05:24:37 -0400 |
commit | 97b7f715589fb997e430c6aa824abbd9fd5ed42d (patch) | |
tree | d5e7d0b71875f487328cc1c1ddf0b9ae336ab724 /arch/arm/plat-omap/dma.c | |
parent | 0499bdeb1dec30325aa282a83f9374fa849aa01c (diff) |
ARM: OMAP: DMA: Clean-up code
DMA clean-up, mostly checkpatch.pl fixes.
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/plat-omap/dma.c')
-rw-r--r-- | arch/arm/plat-omap/dma.c | 255 |
1 files changed, 132 insertions, 123 deletions
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c index 18e757a9ec6b..fac8e994f588 100644 --- a/arch/arm/plat-omap/dma.c +++ b/arch/arm/plat-omap/dma.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * linux/arch/arm/plat-omap/dma.c | 2 | * linux/arch/arm/plat-omap/dma.c |
3 | * | 3 | * |
4 | * Copyright (C) 2003 Nokia Corporation | 4 | * Copyright (C) 2003 - 2008 Nokia Corporation |
5 | * Author: Juha Yrjölä <juha.yrjola@nokia.com> | 5 | * Author: Juha Yrjölä <juha.yrjola@nokia.com> |
6 | * DMA channel linking for 1610 by Samuel Ortiz <samuel.ortiz@nokia.com> | 6 | * DMA channel linking for 1610 by Samuel Ortiz <samuel.ortiz@nokia.com> |
7 | * Graphics DMA and LCD DMA graphics tranformations | 7 | * Graphics DMA and LCD DMA graphics tranformations |
@@ -25,11 +25,11 @@ | |||
25 | #include <linux/errno.h> | 25 | #include <linux/errno.h> |
26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
27 | #include <linux/irq.h> | 27 | #include <linux/irq.h> |
28 | #include <linux/io.h> | ||
28 | 29 | ||
29 | #include <asm/system.h> | 30 | #include <asm/system.h> |
30 | #include <asm/hardware.h> | 31 | #include <asm/hardware.h> |
31 | #include <asm/dma.h> | 32 | #include <asm/dma.h> |
32 | #include <asm/io.h> | ||
33 | 33 | ||
34 | #include <asm/arch/tc.h> | 34 | #include <asm/arch/tc.h> |
35 | 35 | ||
@@ -43,13 +43,13 @@ enum { DMA_CH_ALLOC_DONE, DMA_CH_PARAMS_SET_DONE, DMA_CH_STARTED, | |||
43 | enum { DMA_CHAIN_STARTED, DMA_CHAIN_NOTSTARTED }; | 43 | enum { DMA_CHAIN_STARTED, DMA_CHAIN_NOTSTARTED }; |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | #define OMAP_DMA_ACTIVE 0x01 | 46 | #define OMAP_DMA_ACTIVE 0x01 |
47 | #define OMAP_DMA_CCR_EN (1 << 7) | 47 | #define OMAP_DMA_CCR_EN (1 << 7) |
48 | #define OMAP2_DMA_CSR_CLEAR_MASK 0xffe | 48 | #define OMAP2_DMA_CSR_CLEAR_MASK 0xffe |
49 | 49 | ||
50 | #define OMAP_FUNC_MUX_ARM_BASE (0xfffe1000 + 0xec) | 50 | #define OMAP_FUNC_MUX_ARM_BASE (0xfffe1000 + 0xec) |
51 | 51 | ||
52 | static int enable_1510_mode = 0; | 52 | static int enable_1510_mode; |
53 | 53 | ||
54 | struct omap_dma_lch { | 54 | struct omap_dma_lch { |
55 | int next_lch; | 55 | int next_lch; |
@@ -57,7 +57,7 @@ struct omap_dma_lch { | |||
57 | u16 saved_csr; | 57 | u16 saved_csr; |
58 | u16 enabled_irqs; | 58 | u16 enabled_irqs; |
59 | const char *dev_name; | 59 | const char *dev_name; |
60 | void (* callback)(int lch, u16 ch_status, void *data); | 60 | void (*callback)(int lch, u16 ch_status, void *data); |
61 | void *data; | 61 | void *data; |
62 | 62 | ||
63 | #ifndef CONFIG_ARCH_OMAP1 | 63 | #ifndef CONFIG_ARCH_OMAP1 |
@@ -245,6 +245,7 @@ void omap_set_dma_priority(int lch, int dst_port, int priority) | |||
245 | dma_write(ccr, CCR(lch)); | 245 | dma_write(ccr, CCR(lch)); |
246 | } | 246 | } |
247 | } | 247 | } |
248 | EXPORT_SYMBOL(omap_set_dma_priority); | ||
248 | 249 | ||
249 | void omap_set_dma_transfer_params(int lch, int data_type, int elem_count, | 250 | void omap_set_dma_transfer_params(int lch, int data_type, int elem_count, |
250 | int frame_count, int sync_mode, | 251 | int frame_count, int sync_mode, |
@@ -307,6 +308,7 @@ void omap_set_dma_transfer_params(int lch, int data_type, int elem_count, | |||
307 | dma_write(elem_count, CEN(lch)); | 308 | dma_write(elem_count, CEN(lch)); |
308 | dma_write(frame_count, CFN(lch)); | 309 | dma_write(frame_count, CFN(lch)); |
309 | } | 310 | } |
311 | EXPORT_SYMBOL(omap_set_dma_transfer_params); | ||
310 | 312 | ||
311 | void omap_set_dma_color_mode(int lch, enum omap_dma_color_mode mode, u32 color) | 313 | void omap_set_dma_color_mode(int lch, enum omap_dma_color_mode mode, u32 color) |
312 | { | 314 | { |
@@ -346,6 +348,7 @@ void omap_set_dma_color_mode(int lch, enum omap_dma_color_mode mode, u32 color) | |||
346 | } | 348 | } |
347 | dma_write(w, LCH_CTRL(lch)); | 349 | dma_write(w, LCH_CTRL(lch)); |
348 | } | 350 | } |
351 | EXPORT_SYMBOL(omap_set_dma_color_mode); | ||
349 | 352 | ||
350 | void omap_set_dma_write_mode(int lch, enum omap_dma_write_mode mode) | 353 | void omap_set_dma_write_mode(int lch, enum omap_dma_write_mode mode) |
351 | { | 354 | { |
@@ -358,6 +361,7 @@ void omap_set_dma_write_mode(int lch, enum omap_dma_write_mode mode) | |||
358 | dma_write(csdp, CSDP(lch)); | 361 | dma_write(csdp, CSDP(lch)); |
359 | } | 362 | } |
360 | } | 363 | } |
364 | EXPORT_SYMBOL(omap_set_dma_write_mode); | ||
361 | 365 | ||
362 | void omap_set_dma_channel_mode(int lch, enum omap_dma_channel_mode mode) | 366 | void omap_set_dma_channel_mode(int lch, enum omap_dma_channel_mode mode) |
363 | { | 367 | { |
@@ -377,6 +381,8 @@ void omap_set_dma_src_params(int lch, int src_port, int src_amode, | |||
377 | unsigned long src_start, | 381 | unsigned long src_start, |
378 | int src_ei, int src_fi) | 382 | int src_ei, int src_fi) |
379 | { | 383 | { |
384 | u32 l; | ||
385 | |||
380 | if (cpu_class_is_omap1()) { | 386 | if (cpu_class_is_omap1()) { |
381 | u16 w; | 387 | u16 w; |
382 | 388 | ||
@@ -384,34 +390,27 @@ void omap_set_dma_src_params(int lch, int src_port, int src_amode, | |||
384 | w &= ~(0x1f << 2); | 390 | w &= ~(0x1f << 2); |
385 | w |= src_port << 2; | 391 | w |= src_port << 2; |
386 | dma_write(w, CSDP(lch)); | 392 | dma_write(w, CSDP(lch)); |
393 | } | ||
387 | 394 | ||
388 | w = dma_read(CCR(lch)); | 395 | l = dma_read(CCR(lch)); |
389 | w &= ~(0x03 << 12); | 396 | l &= ~(0x03 << 12); |
390 | w |= src_amode << 12; | 397 | l |= src_amode << 12; |
391 | dma_write(w, CCR(lch)); | 398 | dma_write(l, CCR(lch)); |
392 | 399 | ||
400 | if (cpu_class_is_omap1()) { | ||
393 | dma_write(src_start >> 16, CSSA_U(lch)); | 401 | dma_write(src_start >> 16, CSSA_U(lch)); |
394 | dma_write((u16)src_start, CSSA_L(lch)); | 402 | dma_write((u16)src_start, CSSA_L(lch)); |
395 | |||
396 | dma_write(src_ei, CSEI(lch)); | ||
397 | dma_write(src_fi, CSFI(lch)); | ||
398 | } | 403 | } |
399 | 404 | ||
400 | if (cpu_class_is_omap2()) { | 405 | if (cpu_class_is_omap2()) |
401 | u32 l; | ||
402 | |||
403 | l = dma_read(CCR(lch)); | ||
404 | l &= ~(0x03 << 12); | ||
405 | l |= src_amode << 12; | ||
406 | dma_write(l, CCR(lch)); | ||
407 | |||
408 | dma_write(src_start, CSSA(lch)); | 406 | dma_write(src_start, CSSA(lch)); |
409 | dma_write(src_ei, CSEI(lch)); | 407 | |
410 | dma_write(src_fi, CSFI(lch)); | 408 | dma_write(src_ei, CSEI(lch)); |
411 | } | 409 | dma_write(src_fi, CSFI(lch)); |
412 | } | 410 | } |
411 | EXPORT_SYMBOL(omap_set_dma_src_params); | ||
413 | 412 | ||
414 | void omap_set_dma_params(int lch, struct omap_dma_channel_params * params) | 413 | void omap_set_dma_params(int lch, struct omap_dma_channel_params *params) |
415 | { | 414 | { |
416 | omap_set_dma_transfer_params(lch, params->data_type, | 415 | omap_set_dma_transfer_params(lch, params->data_type, |
417 | params->elem_count, params->frame_count, | 416 | params->elem_count, params->frame_count, |
@@ -428,16 +427,17 @@ void omap_set_dma_params(int lch, struct omap_dma_channel_params * params) | |||
428 | omap_dma_set_prio_lch(lch, params->read_prio, | 427 | omap_dma_set_prio_lch(lch, params->read_prio, |
429 | params->write_prio); | 428 | params->write_prio); |
430 | } | 429 | } |
430 | EXPORT_SYMBOL(omap_set_dma_params); | ||
431 | 431 | ||
432 | void omap_set_dma_src_index(int lch, int eidx, int fidx) | 432 | void omap_set_dma_src_index(int lch, int eidx, int fidx) |
433 | { | 433 | { |
434 | if (cpu_class_is_omap2()) { | 434 | if (cpu_class_is_omap2()) |
435 | REVISIT_24XX(); | ||
436 | return; | 435 | return; |
437 | } | 436 | |
438 | dma_write(eidx, CSEI(lch)); | 437 | dma_write(eidx, CSEI(lch)); |
439 | dma_write(fidx, CSFI(lch)); | 438 | dma_write(fidx, CSFI(lch)); |
440 | } | 439 | } |
440 | EXPORT_SYMBOL(omap_set_dma_src_index); | ||
441 | 441 | ||
442 | void omap_set_dma_src_data_pack(int lch, int enable) | 442 | void omap_set_dma_src_data_pack(int lch, int enable) |
443 | { | 443 | { |
@@ -449,6 +449,7 @@ void omap_set_dma_src_data_pack(int lch, int enable) | |||
449 | l |= (1 << 6); | 449 | l |= (1 << 6); |
450 | dma_write(l, CSDP(lch)); | 450 | dma_write(l, CSDP(lch)); |
451 | } | 451 | } |
452 | EXPORT_SYMBOL(omap_set_dma_src_data_pack); | ||
452 | 453 | ||
453 | void omap_set_dma_src_burst_mode(int lch, enum omap_dma_burst_mode burst_mode) | 454 | void omap_set_dma_src_burst_mode(int lch, enum omap_dma_burst_mode burst_mode) |
454 | { | 455 | { |
@@ -491,6 +492,7 @@ void omap_set_dma_src_burst_mode(int lch, enum omap_dma_burst_mode burst_mode) | |||
491 | l |= (burst << 7); | 492 | l |= (burst << 7); |
492 | dma_write(l, CSDP(lch)); | 493 | dma_write(l, CSDP(lch)); |
493 | } | 494 | } |
495 | EXPORT_SYMBOL(omap_set_dma_src_burst_mode); | ||
494 | 496 | ||
495 | /* Note that dest_port is only for OMAP1 */ | 497 | /* Note that dest_port is only for OMAP1 */ |
496 | void omap_set_dma_dest_params(int lch, int dest_port, int dest_amode, | 498 | void omap_set_dma_dest_params(int lch, int dest_port, int dest_amode, |
@@ -522,16 +524,17 @@ void omap_set_dma_dest_params(int lch, int dest_port, int dest_amode, | |||
522 | dma_write(dst_ei, CDEI(lch)); | 524 | dma_write(dst_ei, CDEI(lch)); |
523 | dma_write(dst_fi, CDFI(lch)); | 525 | dma_write(dst_fi, CDFI(lch)); |
524 | } | 526 | } |
527 | EXPORT_SYMBOL(omap_set_dma_dest_params); | ||
525 | 528 | ||
526 | void omap_set_dma_dest_index(int lch, int eidx, int fidx) | 529 | void omap_set_dma_dest_index(int lch, int eidx, int fidx) |
527 | { | 530 | { |
528 | if (cpu_class_is_omap2()) { | 531 | if (cpu_class_is_omap2()) |
529 | REVISIT_24XX(); | ||
530 | return; | 532 | return; |
531 | } | 533 | |
532 | dma_write(eidx, CDEI(lch)); | 534 | dma_write(eidx, CDEI(lch)); |
533 | dma_write(fidx, CDFI(lch)); | 535 | dma_write(fidx, CDFI(lch)); |
534 | } | 536 | } |
537 | EXPORT_SYMBOL(omap_set_dma_dest_index); | ||
535 | 538 | ||
536 | void omap_set_dma_dest_data_pack(int lch, int enable) | 539 | void omap_set_dma_dest_data_pack(int lch, int enable) |
537 | { | 540 | { |
@@ -543,6 +546,7 @@ void omap_set_dma_dest_data_pack(int lch, int enable) | |||
543 | l |= 1 << 13; | 546 | l |= 1 << 13; |
544 | dma_write(l, CSDP(lch)); | 547 | dma_write(l, CSDP(lch)); |
545 | } | 548 | } |
549 | EXPORT_SYMBOL(omap_set_dma_dest_data_pack); | ||
546 | 550 | ||
547 | void omap_set_dma_dest_burst_mode(int lch, enum omap_dma_burst_mode burst_mode) | 551 | void omap_set_dma_dest_burst_mode(int lch, enum omap_dma_burst_mode burst_mode) |
548 | { | 552 | { |
@@ -583,6 +587,7 @@ void omap_set_dma_dest_burst_mode(int lch, enum omap_dma_burst_mode burst_mode) | |||
583 | l |= (burst << 14); | 587 | l |= (burst << 14); |
584 | dma_write(l, CSDP(lch)); | 588 | dma_write(l, CSDP(lch)); |
585 | } | 589 | } |
590 | EXPORT_SYMBOL(omap_set_dma_dest_burst_mode); | ||
586 | 591 | ||
587 | static inline void omap_enable_channel_irq(int lch) | 592 | static inline void omap_enable_channel_irq(int lch) |
588 | { | 593 | { |
@@ -608,11 +613,13 @@ void omap_enable_dma_irq(int lch, u16 bits) | |||
608 | { | 613 | { |
609 | dma_chan[lch].enabled_irqs |= bits; | 614 | dma_chan[lch].enabled_irqs |= bits; |
610 | } | 615 | } |
616 | EXPORT_SYMBOL(omap_enable_dma_irq); | ||
611 | 617 | ||
612 | void omap_disable_dma_irq(int lch, u16 bits) | 618 | void omap_disable_dma_irq(int lch, u16 bits) |
613 | { | 619 | { |
614 | dma_chan[lch].enabled_irqs &= ~bits; | 620 | dma_chan[lch].enabled_irqs &= ~bits; |
615 | } | 621 | } |
622 | EXPORT_SYMBOL(omap_disable_dma_irq); | ||
616 | 623 | ||
617 | static inline void enable_lnk(int lch) | 624 | static inline void enable_lnk(int lch) |
618 | { | 625 | { |
@@ -628,8 +635,9 @@ static inline void enable_lnk(int lch) | |||
628 | l = dma_chan[lch].next_lch | (1 << 15); | 635 | l = dma_chan[lch].next_lch | (1 << 15); |
629 | 636 | ||
630 | #ifndef CONFIG_ARCH_OMAP1 | 637 | #ifndef CONFIG_ARCH_OMAP1 |
631 | if (dma_chan[lch].next_linked_ch != -1) | 638 | if (cpu_class_is_omap2()) |
632 | l = dma_chan[lch].next_linked_ch | (1 << 15); | 639 | if (dma_chan[lch].next_linked_ch != -1) |
640 | l = dma_chan[lch].next_linked_ch | (1 << 15); | ||
633 | #endif | 641 | #endif |
634 | 642 | ||
635 | dma_write(l, CLNK_CTRL(lch)); | 643 | dma_write(l, CLNK_CTRL(lch)); |
@@ -671,7 +679,7 @@ static inline void omap2_enable_irq_lch(int lch) | |||
671 | } | 679 | } |
672 | 680 | ||
673 | int omap_request_dma(int dev_id, const char *dev_name, | 681 | int omap_request_dma(int dev_id, const char *dev_name, |
674 | void (* callback)(int lch, u16 ch_status, void *data), | 682 | void (*callback)(int lch, u16 ch_status, void *data), |
675 | void *data, int *dma_ch_out) | 683 | void *data, int *dma_ch_out) |
676 | { | 684 | { |
677 | int ch, free_ch = -1; | 685 | int ch, free_ch = -1; |
@@ -704,10 +712,14 @@ int omap_request_dma(int dev_id, const char *dev_name, | |||
704 | chan->dev_name = dev_name; | 712 | chan->dev_name = dev_name; |
705 | chan->callback = callback; | 713 | chan->callback = callback; |
706 | chan->data = data; | 714 | chan->data = data; |
715 | |||
707 | #ifndef CONFIG_ARCH_OMAP1 | 716 | #ifndef CONFIG_ARCH_OMAP1 |
708 | chan->chain_id = -1; | 717 | if (cpu_class_is_omap2()) { |
709 | chan->next_linked_ch = -1; | 718 | chan->chain_id = -1; |
719 | chan->next_linked_ch = -1; | ||
720 | } | ||
710 | #endif | 721 | #endif |
722 | |||
711 | chan->enabled_irqs = OMAP_DMA_DROP_IRQ | OMAP_DMA_BLOCK_IRQ; | 723 | chan->enabled_irqs = OMAP_DMA_DROP_IRQ | OMAP_DMA_BLOCK_IRQ; |
712 | 724 | ||
713 | if (cpu_class_is_omap1()) | 725 | if (cpu_class_is_omap1()) |
@@ -722,8 +734,10 @@ int omap_request_dma(int dev_id, const char *dev_name, | |||
722 | set_gdma_dev(free_ch + 1, dev_id); | 734 | set_gdma_dev(free_ch + 1, dev_id); |
723 | dev_id = free_ch + 1; | 735 | dev_id = free_ch + 1; |
724 | } | 736 | } |
725 | /* Disable the 1510 compatibility mode and set the sync device | 737 | /* |
726 | * id. */ | 738 | * Disable the 1510 compatibility mode and set the sync device |
739 | * id. | ||
740 | */ | ||
727 | dma_write(dev_id | (1 << 10), CCR(free_ch)); | 741 | dma_write(dev_id | (1 << 10), CCR(free_ch)); |
728 | } else if (cpu_is_omap730() || cpu_is_omap15xx()) { | 742 | } else if (cpu_is_omap730() || cpu_is_omap15xx()) { |
729 | dma_write(dev_id, CCR(free_ch)); | 743 | dma_write(dev_id, CCR(free_ch)); |
@@ -731,7 +745,6 @@ int omap_request_dma(int dev_id, const char *dev_name, | |||
731 | 745 | ||
732 | if (cpu_class_is_omap2()) { | 746 | if (cpu_class_is_omap2()) { |
733 | omap2_enable_irq_lch(free_ch); | 747 | omap2_enable_irq_lch(free_ch); |
734 | |||
735 | omap_enable_channel_irq(free_ch); | 748 | omap_enable_channel_irq(free_ch); |
736 | /* Clear the CSR register and IRQ status register */ | 749 | /* Clear the CSR register and IRQ status register */ |
737 | dma_write(OMAP2_DMA_CSR_CLEAR_MASK, CSR(free_ch)); | 750 | dma_write(OMAP2_DMA_CSR_CLEAR_MASK, CSR(free_ch)); |
@@ -742,6 +755,7 @@ int omap_request_dma(int dev_id, const char *dev_name, | |||
742 | 755 | ||
743 | return 0; | 756 | return 0; |
744 | } | 757 | } |
758 | EXPORT_SYMBOL(omap_request_dma); | ||
745 | 759 | ||
746 | void omap_free_dma(int lch) | 760 | void omap_free_dma(int lch) |
747 | { | 761 | { |
@@ -749,11 +763,12 @@ void omap_free_dma(int lch) | |||
749 | 763 | ||
750 | spin_lock_irqsave(&dma_chan_lock, flags); | 764 | spin_lock_irqsave(&dma_chan_lock, flags); |
751 | if (dma_chan[lch].dev_id == -1) { | 765 | if (dma_chan[lch].dev_id == -1) { |
752 | printk("omap_dma: trying to free nonallocated DMA channel %d\n", | 766 | pr_err("omap_dma: trying to free unallocated DMA channel %d\n", |
753 | lch); | 767 | lch); |
754 | spin_unlock_irqrestore(&dma_chan_lock, flags); | 768 | spin_unlock_irqrestore(&dma_chan_lock, flags); |
755 | return; | 769 | return; |
756 | } | 770 | } |
771 | |||
757 | dma_chan[lch].dev_id = -1; | 772 | dma_chan[lch].dev_id = -1; |
758 | dma_chan[lch].next_lch = -1; | 773 | dma_chan[lch].next_lch = -1; |
759 | dma_chan[lch].callback = NULL; | 774 | dma_chan[lch].callback = NULL; |
@@ -785,6 +800,7 @@ void omap_free_dma(int lch) | |||
785 | omap_clear_dma(lch); | 800 | omap_clear_dma(lch); |
786 | } | 801 | } |
787 | } | 802 | } |
803 | EXPORT_SYMBOL(omap_free_dma); | ||
788 | 804 | ||
789 | /** | 805 | /** |
790 | * @brief omap_dma_set_global_params : Set global priority settings for dma | 806 | * @brief omap_dma_set_global_params : Set global priority settings for dma |
@@ -878,6 +894,7 @@ void omap_clear_dma(int lch) | |||
878 | 894 | ||
879 | local_irq_restore(flags); | 895 | local_irq_restore(flags); |
880 | } | 896 | } |
897 | EXPORT_SYMBOL(omap_clear_dma); | ||
881 | 898 | ||
882 | void omap_start_dma(int lch) | 899 | void omap_start_dma(int lch) |
883 | { | 900 | { |
@@ -916,8 +933,10 @@ void omap_start_dma(int lch) | |||
916 | 933 | ||
917 | l = dma_read(CCR(lch)); | 934 | l = dma_read(CCR(lch)); |
918 | 935 | ||
919 | /* Errata: On ES2.0 BUFFERING disable must be set. | 936 | /* |
920 | * This will always fail on ES1.0 */ | 937 | * Errata: On ES2.0 BUFFERING disable must be set. |
938 | * This will always fail on ES1.0 | ||
939 | */ | ||
921 | if (cpu_is_omap24xx()) | 940 | if (cpu_is_omap24xx()) |
922 | l |= OMAP_DMA_CCR_EN; | 941 | l |= OMAP_DMA_CCR_EN; |
923 | 942 | ||
@@ -926,6 +945,7 @@ void omap_start_dma(int lch) | |||
926 | 945 | ||
927 | dma_chan[lch].flags |= OMAP_DMA_ACTIVE; | 946 | dma_chan[lch].flags |= OMAP_DMA_ACTIVE; |
928 | } | 947 | } |
948 | EXPORT_SYMBOL(omap_start_dma); | ||
929 | 949 | ||
930 | void omap_stop_dma(int lch) | 950 | void omap_stop_dma(int lch) |
931 | { | 951 | { |
@@ -962,13 +982,14 @@ void omap_stop_dma(int lch) | |||
962 | 982 | ||
963 | dma_chan[lch].flags &= ~OMAP_DMA_ACTIVE; | 983 | dma_chan[lch].flags &= ~OMAP_DMA_ACTIVE; |
964 | } | 984 | } |
985 | EXPORT_SYMBOL(omap_stop_dma); | ||
965 | 986 | ||
966 | /* | 987 | /* |
967 | * Allows changing the DMA callback function or data. This may be needed if | 988 | * Allows changing the DMA callback function or data. This may be needed if |
968 | * the driver shares a single DMA channel for multiple dma triggers. | 989 | * the driver shares a single DMA channel for multiple dma triggers. |
969 | */ | 990 | */ |
970 | int omap_set_dma_callback(int lch, | 991 | int omap_set_dma_callback(int lch, |
971 | void (* callback)(int lch, u16 ch_status, void *data), | 992 | void (*callback)(int lch, u16 ch_status, void *data), |
972 | void *data) | 993 | void *data) |
973 | { | 994 | { |
974 | unsigned long flags; | 995 | unsigned long flags; |
@@ -988,6 +1009,7 @@ int omap_set_dma_callback(int lch, | |||
988 | 1009 | ||
989 | return 0; | 1010 | return 0; |
990 | } | 1011 | } |
1012 | EXPORT_SYMBOL(omap_set_dma_callback); | ||
991 | 1013 | ||
992 | /* | 1014 | /* |
993 | * Returns current physical source address for the given DMA channel. | 1015 | * Returns current physical source address for the given DMA channel. |
@@ -1018,6 +1040,7 @@ dma_addr_t omap_get_dma_src_pos(int lch) | |||
1018 | 1040 | ||
1019 | return offset; | 1041 | return offset; |
1020 | } | 1042 | } |
1043 | EXPORT_SYMBOL(omap_get_dma_src_pos); | ||
1021 | 1044 | ||
1022 | /* | 1045 | /* |
1023 | * Returns current physical destination address for the given DMA channel. | 1046 | * Returns current physical destination address for the given DMA channel. |
@@ -1048,16 +1071,7 @@ dma_addr_t omap_get_dma_dst_pos(int lch) | |||
1048 | 1071 | ||
1049 | return offset; | 1072 | return offset; |
1050 | } | 1073 | } |
1051 | 1074 | EXPORT_SYMBOL(omap_get_dma_dst_pos); | |
1052 | /* | ||
1053 | * Returns current source transfer counting for the given DMA channel. | ||
1054 | * Can be used to monitor the progress of a transfer inside a block. | ||
1055 | * It must be called with disabled interrupts. | ||
1056 | */ | ||
1057 | int omap_get_dma_src_addr_counter(int lch) | ||
1058 | { | ||
1059 | return (dma_addr_t)dma_read(CSAC(lch)); | ||
1060 | } | ||
1061 | 1075 | ||
1062 | int omap_get_dma_active_status(int lch) | 1076 | int omap_get_dma_active_status(int lch) |
1063 | { | 1077 | { |
@@ -1086,7 +1100,7 @@ int omap_dma_running(void) | |||
1086 | * For this DMA link to start, you still need to start (see omap_start_dma) | 1100 | * For this DMA link to start, you still need to start (see omap_start_dma) |
1087 | * the first one. That will fire up the entire queue. | 1101 | * the first one. That will fire up the entire queue. |
1088 | */ | 1102 | */ |
1089 | void omap_dma_link_lch (int lch_head, int lch_queue) | 1103 | void omap_dma_link_lch(int lch_head, int lch_queue) |
1090 | { | 1104 | { |
1091 | if (omap_dma_in_1510_mode()) { | 1105 | if (omap_dma_in_1510_mode()) { |
1092 | printk(KERN_ERR "DMA linking is not supported in 1510 mode\n"); | 1106 | printk(KERN_ERR "DMA linking is not supported in 1510 mode\n"); |
@@ -1103,11 +1117,12 @@ void omap_dma_link_lch (int lch_head, int lch_queue) | |||
1103 | 1117 | ||
1104 | dma_chan[lch_head].next_lch = lch_queue; | 1118 | dma_chan[lch_head].next_lch = lch_queue; |
1105 | } | 1119 | } |
1120 | EXPORT_SYMBOL(omap_dma_link_lch); | ||
1106 | 1121 | ||
1107 | /* | 1122 | /* |
1108 | * Once the DMA queue is stopped, we can destroy it. | 1123 | * Once the DMA queue is stopped, we can destroy it. |
1109 | */ | 1124 | */ |
1110 | void omap_dma_unlink_lch (int lch_head, int lch_queue) | 1125 | void omap_dma_unlink_lch(int lch_head, int lch_queue) |
1111 | { | 1126 | { |
1112 | if (omap_dma_in_1510_mode()) { | 1127 | if (omap_dma_in_1510_mode()) { |
1113 | printk(KERN_ERR "DMA linking is not supported in 1510 mode\n"); | 1128 | printk(KERN_ERR "DMA linking is not supported in 1510 mode\n"); |
@@ -1122,7 +1137,6 @@ void omap_dma_unlink_lch (int lch_head, int lch_queue) | |||
1122 | dump_stack(); | 1137 | dump_stack(); |
1123 | } | 1138 | } |
1124 | 1139 | ||
1125 | |||
1126 | if ((dma_chan[lch_head].flags & OMAP_DMA_ACTIVE) || | 1140 | if ((dma_chan[lch_head].flags & OMAP_DMA_ACTIVE) || |
1127 | (dma_chan[lch_head].flags & OMAP_DMA_ACTIVE)) { | 1141 | (dma_chan[lch_head].flags & OMAP_DMA_ACTIVE)) { |
1128 | printk(KERN_ERR "omap_dma: You need to stop the DMA channels " | 1142 | printk(KERN_ERR "omap_dma: You need to stop the DMA channels " |
@@ -1132,6 +1146,9 @@ void omap_dma_unlink_lch (int lch_head, int lch_queue) | |||
1132 | 1146 | ||
1133 | dma_chan[lch_head].next_lch = -1; | 1147 | dma_chan[lch_head].next_lch = -1; |
1134 | } | 1148 | } |
1149 | EXPORT_SYMBOL(omap_dma_unlink_lch); | ||
1150 | |||
1151 | /*----------------------------------------------------------------------------*/ | ||
1135 | 1152 | ||
1136 | #ifndef CONFIG_ARCH_OMAP1 | 1153 | #ifndef CONFIG_ARCH_OMAP1 |
1137 | /* Create chain of DMA channesls */ | 1154 | /* Create chain of DMA channesls */ |
@@ -1255,6 +1272,7 @@ int omap_request_dma_chain(int dev_id, const char *dev_name, | |||
1255 | for (i = 0; i < (no_of_chans - 1); i++) | 1272 | for (i = 0; i < (no_of_chans - 1); i++) |
1256 | create_dma_lch_chain(channels[i], channels[i + 1]); | 1273 | create_dma_lch_chain(channels[i], channels[i + 1]); |
1257 | } | 1274 | } |
1275 | |||
1258 | return 0; | 1276 | return 0; |
1259 | } | 1277 | } |
1260 | EXPORT_SYMBOL(omap_request_dma_chain); | 1278 | EXPORT_SYMBOL(omap_request_dma_chain); |
@@ -1297,6 +1315,7 @@ int omap_modify_dma_chain_params(int chain_id, | |||
1297 | */ | 1315 | */ |
1298 | omap_set_dma_params(channels[i], ¶ms); | 1316 | omap_set_dma_params(channels[i], ¶ms); |
1299 | } | 1317 | } |
1318 | |||
1300 | return 0; | 1319 | return 0; |
1301 | } | 1320 | } |
1302 | EXPORT_SYMBOL(omap_modify_dma_chain_params); | 1321 | EXPORT_SYMBOL(omap_modify_dma_chain_params); |
@@ -1340,6 +1359,7 @@ int omap_free_dma_chain(int chain_id) | |||
1340 | dma_linked_lch[chain_id].linked_dmach_q = NULL; | 1359 | dma_linked_lch[chain_id].linked_dmach_q = NULL; |
1341 | dma_linked_lch[chain_id].chain_mode = -1; | 1360 | dma_linked_lch[chain_id].chain_mode = -1; |
1342 | dma_linked_lch[chain_id].chain_state = -1; | 1361 | dma_linked_lch[chain_id].chain_state = -1; |
1362 | |||
1343 | return (0); | 1363 | return (0); |
1344 | } | 1364 | } |
1345 | EXPORT_SYMBOL(omap_free_dma_chain); | 1365 | EXPORT_SYMBOL(omap_free_dma_chain); |
@@ -1370,6 +1390,7 @@ int omap_dma_chain_status(int chain_id) | |||
1370 | 1390 | ||
1371 | if (OMAP_DMA_CHAIN_QEMPTY(chain_id)) | 1391 | if (OMAP_DMA_CHAIN_QEMPTY(chain_id)) |
1372 | return OMAP_DMA_CHAIN_INACTIVE; | 1392 | return OMAP_DMA_CHAIN_INACTIVE; |
1393 | |||
1373 | return OMAP_DMA_CHAIN_ACTIVE; | 1394 | return OMAP_DMA_CHAIN_ACTIVE; |
1374 | } | 1395 | } |
1375 | EXPORT_SYMBOL(omap_dma_chain_status); | 1396 | EXPORT_SYMBOL(omap_dma_chain_status); |
@@ -1395,8 +1416,10 @@ int omap_dma_chain_a_transfer(int chain_id, int src_start, int dest_start, | |||
1395 | u32 l, lch; | 1416 | u32 l, lch; |
1396 | int start_dma = 0; | 1417 | int start_dma = 0; |
1397 | 1418 | ||
1398 | /* if buffer size is less than 1 then there is | 1419 | /* |
1399 | * no use of starting the chain */ | 1420 | * if buffer size is less than 1 then there is |
1421 | * no use of starting the chain | ||
1422 | */ | ||
1400 | if (elem_count < 1) { | 1423 | if (elem_count < 1) { |
1401 | printk(KERN_ERR "Invalid buffer size\n"); | 1424 | printk(KERN_ERR "Invalid buffer size\n"); |
1402 | return -EINVAL; | 1425 | return -EINVAL; |
@@ -1441,12 +1464,16 @@ int omap_dma_chain_a_transfer(int chain_id, int src_start, int dest_start, | |||
1441 | dma_write(elem_count, CEN(lch)); | 1464 | dma_write(elem_count, CEN(lch)); |
1442 | dma_write(frame_count, CFN(lch)); | 1465 | dma_write(frame_count, CFN(lch)); |
1443 | 1466 | ||
1444 | /* If the chain is dynamically linked, | 1467 | /* |
1445 | * then we may have to start the chain if its not active */ | 1468 | * If the chain is dynamically linked, |
1469 | * then we may have to start the chain if its not active | ||
1470 | */ | ||
1446 | if (dma_linked_lch[chain_id].chain_mode == OMAP_DMA_DYNAMIC_CHAIN) { | 1471 | if (dma_linked_lch[chain_id].chain_mode == OMAP_DMA_DYNAMIC_CHAIN) { |
1447 | 1472 | ||
1448 | /* In Dynamic chain, if the chain is not started, | 1473 | /* |
1449 | * queue the channel */ | 1474 | * In Dynamic chain, if the chain is not started, |
1475 | * queue the channel | ||
1476 | */ | ||
1450 | if (dma_linked_lch[chain_id].chain_state == | 1477 | if (dma_linked_lch[chain_id].chain_state == |
1451 | DMA_CHAIN_NOTSTARTED) { | 1478 | DMA_CHAIN_NOTSTARTED) { |
1452 | /* Enable the link in previous channel */ | 1479 | /* Enable the link in previous channel */ |
@@ -1456,8 +1483,10 @@ int omap_dma_chain_a_transfer(int chain_id, int src_start, int dest_start, | |||
1456 | dma_chan[lch].state = DMA_CH_QUEUED; | 1483 | dma_chan[lch].state = DMA_CH_QUEUED; |
1457 | } | 1484 | } |
1458 | 1485 | ||
1459 | /* Chain is already started, make sure its active, | 1486 | /* |
1460 | * if not then start the chain */ | 1487 | * Chain is already started, make sure its active, |
1488 | * if not then start the chain | ||
1489 | */ | ||
1461 | else { | 1490 | else { |
1462 | start_dma = 1; | 1491 | start_dma = 1; |
1463 | 1492 | ||
@@ -1504,6 +1533,7 @@ int omap_dma_chain_a_transfer(int chain_id, int src_start, int dest_start, | |||
1504 | dma_chan[lch].flags |= OMAP_DMA_ACTIVE; | 1533 | dma_chan[lch].flags |= OMAP_DMA_ACTIVE; |
1505 | } | 1534 | } |
1506 | } | 1535 | } |
1536 | |||
1507 | return 0; | 1537 | return 0; |
1508 | } | 1538 | } |
1509 | EXPORT_SYMBOL(omap_dma_chain_a_transfer); | 1539 | EXPORT_SYMBOL(omap_dma_chain_a_transfer); |
@@ -1555,6 +1585,7 @@ int omap_start_dma_chain_transfers(int chain_id) | |||
1555 | dma_write(l, CCR(channels[0])); | 1585 | dma_write(l, CCR(channels[0])); |
1556 | 1586 | ||
1557 | dma_chan[channels[0]].flags |= OMAP_DMA_ACTIVE; | 1587 | dma_chan[channels[0]].flags |= OMAP_DMA_ACTIVE; |
1588 | |||
1558 | return 0; | 1589 | return 0; |
1559 | } | 1590 | } |
1560 | EXPORT_SYMBOL(omap_start_dma_chain_transfers); | 1591 | EXPORT_SYMBOL(omap_start_dma_chain_transfers); |
@@ -1586,7 +1617,8 @@ int omap_stop_dma_chain_transfers(int chain_id) | |||
1586 | } | 1617 | } |
1587 | channels = dma_linked_lch[chain_id].linked_dmach_q; | 1618 | channels = dma_linked_lch[chain_id].linked_dmach_q; |
1588 | 1619 | ||
1589 | /* DMA Errata: | 1620 | /* |
1621 | * DMA Errata: | ||
1590 | * Special programming model needed to disable DMA before end of block | 1622 | * Special programming model needed to disable DMA before end of block |
1591 | */ | 1623 | */ |
1592 | sys_cf = dma_read(OCP_SYSCONFIG); | 1624 | sys_cf = dma_read(OCP_SYSCONFIG); |
@@ -1614,6 +1646,7 @@ int omap_stop_dma_chain_transfers(int chain_id) | |||
1614 | 1646 | ||
1615 | /* Errata - put in the old value */ | 1647 | /* Errata - put in the old value */ |
1616 | dma_write(sys_cf, OCP_SYSCONFIG); | 1648 | dma_write(sys_cf, OCP_SYSCONFIG); |
1649 | |||
1617 | return 0; | 1650 | return 0; |
1618 | } | 1651 | } |
1619 | EXPORT_SYMBOL(omap_stop_dma_chain_transfers); | 1652 | EXPORT_SYMBOL(omap_stop_dma_chain_transfers); |
@@ -1729,7 +1762,7 @@ int omap_get_dma_chain_src_pos(int chain_id) | |||
1729 | return dma_read(CSAC(lch)); | 1762 | return dma_read(CSAC(lch)); |
1730 | } | 1763 | } |
1731 | EXPORT_SYMBOL(omap_get_dma_chain_src_pos); | 1764 | EXPORT_SYMBOL(omap_get_dma_chain_src_pos); |
1732 | #endif | 1765 | #endif /* ifndef CONFIG_ARCH_OMAP1 */ |
1733 | 1766 | ||
1734 | /*----------------------------------------------------------------------------*/ | 1767 | /*----------------------------------------------------------------------------*/ |
1735 | 1768 | ||
@@ -1765,6 +1798,7 @@ static int omap1_dma_handle_ch(int ch) | |||
1765 | dma_chan[ch].flags &= ~OMAP_DMA_ACTIVE; | 1798 | dma_chan[ch].flags &= ~OMAP_DMA_ACTIVE; |
1766 | if (likely(dma_chan[ch].callback != NULL)) | 1799 | if (likely(dma_chan[ch].callback != NULL)) |
1767 | dma_chan[ch].callback(ch, csr, dma_chan[ch].data); | 1800 | dma_chan[ch].callback(ch, csr, dma_chan[ch].data); |
1801 | |||
1768 | return 1; | 1802 | return 1; |
1769 | } | 1803 | } |
1770 | 1804 | ||
@@ -1799,7 +1833,8 @@ static int omap2_dma_handle_ch(int ch) | |||
1799 | 1833 | ||
1800 | if (!status) { | 1834 | if (!status) { |
1801 | if (printk_ratelimit()) | 1835 | if (printk_ratelimit()) |
1802 | printk(KERN_WARNING "Spurious DMA IRQ for lch %d\n", ch); | 1836 | printk(KERN_WARNING "Spurious DMA IRQ for lch %d\n", |
1837 | ch); | ||
1803 | dma_write(1 << ch, IRQSTATUS_L0); | 1838 | dma_write(1 << ch, IRQSTATUS_L0); |
1804 | return 0; | 1839 | return 0; |
1805 | } | 1840 | } |
@@ -1887,7 +1922,7 @@ static struct irqaction omap24xx_dma_irq; | |||
1887 | static struct lcd_dma_info { | 1922 | static struct lcd_dma_info { |
1888 | spinlock_t lock; | 1923 | spinlock_t lock; |
1889 | int reserved; | 1924 | int reserved; |
1890 | void (* callback)(u16 status, void *data); | 1925 | void (*callback)(u16 status, void *data); |
1891 | void *cb_data; | 1926 | void *cb_data; |
1892 | 1927 | ||
1893 | int active; | 1928 | int active; |
@@ -1909,6 +1944,7 @@ void omap_set_lcd_dma_b1(unsigned long addr, u16 fb_xres, u16 fb_yres, | |||
1909 | lcd_dma.xres = fb_xres; | 1944 | lcd_dma.xres = fb_xres; |
1910 | lcd_dma.yres = fb_yres; | 1945 | lcd_dma.yres = fb_yres; |
1911 | } | 1946 | } |
1947 | EXPORT_SYMBOL(omap_set_lcd_dma_b1); | ||
1912 | 1948 | ||
1913 | void omap_set_lcd_dma_src_port(int port) | 1949 | void omap_set_lcd_dma_src_port(int port) |
1914 | { | 1950 | { |
@@ -1919,12 +1955,13 @@ void omap_set_lcd_dma_ext_controller(int external) | |||
1919 | { | 1955 | { |
1920 | lcd_dma.ext_ctrl = external; | 1956 | lcd_dma.ext_ctrl = external; |
1921 | } | 1957 | } |
1958 | EXPORT_SYMBOL(omap_set_lcd_dma_ext_controller); | ||
1922 | 1959 | ||
1923 | void omap_set_lcd_dma_single_transfer(int single) | 1960 | void omap_set_lcd_dma_single_transfer(int single) |
1924 | { | 1961 | { |
1925 | lcd_dma.single_transfer = single; | 1962 | lcd_dma.single_transfer = single; |
1926 | } | 1963 | } |
1927 | 1964 | EXPORT_SYMBOL(omap_set_lcd_dma_single_transfer); | |
1928 | 1965 | ||
1929 | void omap_set_lcd_dma_b1_rotation(int rotate) | 1966 | void omap_set_lcd_dma_b1_rotation(int rotate) |
1930 | { | 1967 | { |
@@ -1935,6 +1972,7 @@ void omap_set_lcd_dma_b1_rotation(int rotate) | |||
1935 | } | 1972 | } |
1936 | lcd_dma.rotate = rotate; | 1973 | lcd_dma.rotate = rotate; |
1937 | } | 1974 | } |
1975 | EXPORT_SYMBOL(omap_set_lcd_dma_b1_rotation); | ||
1938 | 1976 | ||
1939 | void omap_set_lcd_dma_b1_mirror(int mirror) | 1977 | void omap_set_lcd_dma_b1_mirror(int mirror) |
1940 | { | 1978 | { |
@@ -1944,6 +1982,7 @@ void omap_set_lcd_dma_b1_mirror(int mirror) | |||
1944 | } | 1982 | } |
1945 | lcd_dma.mirror = mirror; | 1983 | lcd_dma.mirror = mirror; |
1946 | } | 1984 | } |
1985 | EXPORT_SYMBOL(omap_set_lcd_dma_b1_mirror); | ||
1947 | 1986 | ||
1948 | void omap_set_lcd_dma_b1_vxres(unsigned long vxres) | 1987 | void omap_set_lcd_dma_b1_vxres(unsigned long vxres) |
1949 | { | 1988 | { |
@@ -1954,6 +1993,7 @@ void omap_set_lcd_dma_b1_vxres(unsigned long vxres) | |||
1954 | } | 1993 | } |
1955 | lcd_dma.vxres = vxres; | 1994 | lcd_dma.vxres = vxres; |
1956 | } | 1995 | } |
1996 | EXPORT_SYMBOL(omap_set_lcd_dma_b1_vxres); | ||
1957 | 1997 | ||
1958 | void omap_set_lcd_dma_b1_scale(unsigned int xscale, unsigned int yscale) | 1998 | void omap_set_lcd_dma_b1_scale(unsigned int xscale, unsigned int yscale) |
1959 | { | 1999 | { |
@@ -1964,6 +2004,7 @@ void omap_set_lcd_dma_b1_scale(unsigned int xscale, unsigned int yscale) | |||
1964 | lcd_dma.xscale = xscale; | 2004 | lcd_dma.xscale = xscale; |
1965 | lcd_dma.yscale = yscale; | 2005 | lcd_dma.yscale = yscale; |
1966 | } | 2006 | } |
2007 | EXPORT_SYMBOL(omap_set_lcd_dma_b1_scale); | ||
1967 | 2008 | ||
1968 | static void set_b1_regs(void) | 2009 | static void set_b1_regs(void) |
1969 | { | 2010 | { |
@@ -1994,8 +2035,11 @@ static void set_b1_regs(void) | |||
1994 | xscale = lcd_dma.xscale ? lcd_dma.xscale : 1; | 2035 | xscale = lcd_dma.xscale ? lcd_dma.xscale : 1; |
1995 | yscale = lcd_dma.yscale ? lcd_dma.yscale : 1; | 2036 | yscale = lcd_dma.yscale ? lcd_dma.yscale : 1; |
1996 | BUG_ON(vxres < lcd_dma.xres); | 2037 | BUG_ON(vxres < lcd_dma.xres); |
1997 | #define PIXADDR(x,y) (lcd_dma.addr + ((y) * vxres * yscale + (x) * xscale) * es) | 2038 | |
2039 | #define PIXADDR(x, y) (lcd_dma.addr + \ | ||
2040 | ((y) * vxres * yscale + (x) * xscale) * es) | ||
1998 | #define PIXSTEP(sx, sy, dx, dy) (PIXADDR(dx, dy) - PIXADDR(sx, sy) - es + 1) | 2041 | #define PIXSTEP(sx, sy, dx, dy) (PIXADDR(dx, dy) - PIXADDR(sx, sy) - es + 1) |
2042 | |||
1999 | switch (lcd_dma.rotate) { | 2043 | switch (lcd_dma.rotate) { |
2000 | case 0: | 2044 | case 0: |
2001 | if (!lcd_dma.mirror) { | 2045 | if (!lcd_dma.mirror) { |
@@ -2004,8 +2048,8 @@ static void set_b1_regs(void) | |||
2004 | /* 1510 DMA requires the bottom address to be 2 more | 2048 | /* 1510 DMA requires the bottom address to be 2 more |
2005 | * than the actual last memory access location. */ | 2049 | * than the actual last memory access location. */ |
2006 | if (omap_dma_in_1510_mode() && | 2050 | if (omap_dma_in_1510_mode() && |
2007 | lcd_dma.data_type == OMAP_DMA_DATA_TYPE_S32) | 2051 | lcd_dma.data_type == OMAP_DMA_DATA_TYPE_S32) |
2008 | bottom += 2; | 2052 | bottom += 2; |
2009 | ei = PIXSTEP(0, 0, 1, 0); | 2053 | ei = PIXSTEP(0, 0, 1, 0); |
2010 | fi = PIXSTEP(lcd_dma.xres - 1, 0, 0, 1); | 2054 | fi = PIXSTEP(lcd_dma.xres - 1, 0, 0, 1); |
2011 | } else { | 2055 | } else { |
@@ -2132,7 +2176,7 @@ static irqreturn_t lcd_dma_irq_handler(int irq, void *dev_id) | |||
2132 | return IRQ_HANDLED; | 2176 | return IRQ_HANDLED; |
2133 | } | 2177 | } |
2134 | 2178 | ||
2135 | int omap_request_lcd_dma(void (* callback)(u16 status, void *data), | 2179 | int omap_request_lcd_dma(void (*callback)(u16 status, void *data), |
2136 | void *data) | 2180 | void *data) |
2137 | { | 2181 | { |
2138 | spin_lock_irq(&lcd_dma.lock); | 2182 | spin_lock_irq(&lcd_dma.lock); |
@@ -2158,6 +2202,7 @@ int omap_request_lcd_dma(void (* callback)(u16 status, void *data), | |||
2158 | 2202 | ||
2159 | return 0; | 2203 | return 0; |
2160 | } | 2204 | } |
2205 | EXPORT_SYMBOL(omap_request_lcd_dma); | ||
2161 | 2206 | ||
2162 | void omap_free_lcd_dma(void) | 2207 | void omap_free_lcd_dma(void) |
2163 | { | 2208 | { |
@@ -2174,12 +2219,14 @@ void omap_free_lcd_dma(void) | |||
2174 | lcd_dma.reserved = 0; | 2219 | lcd_dma.reserved = 0; |
2175 | spin_unlock(&lcd_dma.lock); | 2220 | spin_unlock(&lcd_dma.lock); |
2176 | } | 2221 | } |
2222 | EXPORT_SYMBOL(omap_free_lcd_dma); | ||
2177 | 2223 | ||
2178 | void omap_enable_lcd_dma(void) | 2224 | void omap_enable_lcd_dma(void) |
2179 | { | 2225 | { |
2180 | u16 w; | 2226 | u16 w; |
2181 | 2227 | ||
2182 | /* Set the Enable bit only if an external controller is | 2228 | /* |
2229 | * Set the Enable bit only if an external controller is | ||
2183 | * connected. Otherwise the OMAP internal controller will | 2230 | * connected. Otherwise the OMAP internal controller will |
2184 | * start the transfer when it gets enabled. | 2231 | * start the transfer when it gets enabled. |
2185 | */ | 2232 | */ |
@@ -2196,6 +2243,7 @@ void omap_enable_lcd_dma(void) | |||
2196 | w |= 1 << 7; | 2243 | w |= 1 << 7; |
2197 | omap_writew(w, OMAP1610_DMA_LCD_CCR); | 2244 | omap_writew(w, OMAP1610_DMA_LCD_CCR); |
2198 | } | 2245 | } |
2246 | EXPORT_SYMBOL(omap_enable_lcd_dma); | ||
2199 | 2247 | ||
2200 | void omap_setup_lcd_dma(void) | 2248 | void omap_setup_lcd_dma(void) |
2201 | { | 2249 | { |
@@ -2211,16 +2259,18 @@ void omap_setup_lcd_dma(void) | |||
2211 | u16 w; | 2259 | u16 w; |
2212 | 2260 | ||
2213 | w = omap_readw(OMAP1610_DMA_LCD_CCR); | 2261 | w = omap_readw(OMAP1610_DMA_LCD_CCR); |
2214 | /* If DMA was already active set the end_prog bit to have | 2262 | /* |
2263 | * If DMA was already active set the end_prog bit to have | ||
2215 | * the programmed register set loaded into the active | 2264 | * the programmed register set loaded into the active |
2216 | * register set. | 2265 | * register set. |
2217 | */ | 2266 | */ |
2218 | w |= 1 << 11; /* End_prog */ | 2267 | w |= 1 << 11; /* End_prog */ |
2219 | if (!lcd_dma.single_transfer) | 2268 | if (!lcd_dma.single_transfer) |
2220 | w |= (3 << 8); /* Auto_init, repeat */ | 2269 | w |= (3 << 8); /* Auto_init, repeat */ |
2221 | omap_writew(w, OMAP1610_DMA_LCD_CCR); | 2270 | omap_writew(w, OMAP1610_DMA_LCD_CCR); |
2222 | } | 2271 | } |
2223 | } | 2272 | } |
2273 | EXPORT_SYMBOL(omap_setup_lcd_dma); | ||
2224 | 2274 | ||
2225 | void omap_stop_lcd_dma(void) | 2275 | void omap_stop_lcd_dma(void) |
2226 | { | 2276 | { |
@@ -2238,6 +2288,7 @@ void omap_stop_lcd_dma(void) | |||
2238 | w &= ~(1 << 8); | 2288 | w &= ~(1 << 8); |
2239 | omap_writew(w, OMAP1610_DMA_LCD_CTRL); | 2289 | omap_writew(w, OMAP1610_DMA_LCD_CTRL); |
2240 | } | 2290 | } |
2291 | EXPORT_SYMBOL(omap_stop_lcd_dma); | ||
2241 | 2292 | ||
2242 | /*----------------------------------------------------------------------------*/ | 2293 | /*----------------------------------------------------------------------------*/ |
2243 | 2294 | ||
@@ -2327,8 +2378,10 @@ static int __init omap_init_dma(void) | |||
2327 | continue; | 2378 | continue; |
2328 | 2379 | ||
2329 | if (cpu_class_is_omap1()) { | 2380 | if (cpu_class_is_omap1()) { |
2330 | /* request_irq() doesn't like dev_id (ie. ch) being | 2381 | /* |
2331 | * zero, so we have to kludge around this. */ | 2382 | * request_irq() doesn't like dev_id (ie. ch) being |
2383 | * zero, so we have to kludge around this. | ||
2384 | */ | ||
2332 | r = request_irq(omap1_dma_irq[ch], | 2385 | r = request_irq(omap1_dma_irq[ch], |
2333 | omap1_dma_irq_handler, 0, "DMA", | 2386 | omap1_dma_irq_handler, 0, "DMA", |
2334 | (void *) (ch + 1)); | 2387 | (void *) (ch + 1)); |
@@ -2373,48 +2426,4 @@ static int __init omap_init_dma(void) | |||
2373 | 2426 | ||
2374 | arch_initcall(omap_init_dma); | 2427 | arch_initcall(omap_init_dma); |
2375 | 2428 | ||
2376 | EXPORT_SYMBOL(omap_get_dma_src_pos); | ||
2377 | EXPORT_SYMBOL(omap_get_dma_dst_pos); | ||
2378 | EXPORT_SYMBOL(omap_get_dma_src_addr_counter); | ||
2379 | EXPORT_SYMBOL(omap_clear_dma); | ||
2380 | EXPORT_SYMBOL(omap_set_dma_priority); | ||
2381 | EXPORT_SYMBOL(omap_request_dma); | ||
2382 | EXPORT_SYMBOL(omap_free_dma); | ||
2383 | EXPORT_SYMBOL(omap_start_dma); | ||
2384 | EXPORT_SYMBOL(omap_stop_dma); | ||
2385 | EXPORT_SYMBOL(omap_set_dma_callback); | ||
2386 | EXPORT_SYMBOL(omap_enable_dma_irq); | ||
2387 | EXPORT_SYMBOL(omap_disable_dma_irq); | ||
2388 | |||
2389 | EXPORT_SYMBOL(omap_set_dma_transfer_params); | ||
2390 | EXPORT_SYMBOL(omap_set_dma_color_mode); | ||
2391 | EXPORT_SYMBOL(omap_set_dma_write_mode); | ||
2392 | |||
2393 | EXPORT_SYMBOL(omap_set_dma_src_params); | ||
2394 | EXPORT_SYMBOL(omap_set_dma_src_index); | ||
2395 | EXPORT_SYMBOL(omap_set_dma_src_data_pack); | ||
2396 | EXPORT_SYMBOL(omap_set_dma_src_burst_mode); | ||
2397 | |||
2398 | EXPORT_SYMBOL(omap_set_dma_dest_params); | ||
2399 | EXPORT_SYMBOL(omap_set_dma_dest_index); | ||
2400 | EXPORT_SYMBOL(omap_set_dma_dest_data_pack); | ||
2401 | EXPORT_SYMBOL(omap_set_dma_dest_burst_mode); | ||
2402 | |||
2403 | EXPORT_SYMBOL(omap_set_dma_params); | ||
2404 | |||
2405 | EXPORT_SYMBOL(omap_dma_link_lch); | ||
2406 | EXPORT_SYMBOL(omap_dma_unlink_lch); | ||
2407 | |||
2408 | EXPORT_SYMBOL(omap_request_lcd_dma); | ||
2409 | EXPORT_SYMBOL(omap_free_lcd_dma); | ||
2410 | EXPORT_SYMBOL(omap_enable_lcd_dma); | ||
2411 | EXPORT_SYMBOL(omap_setup_lcd_dma); | ||
2412 | EXPORT_SYMBOL(omap_stop_lcd_dma); | ||
2413 | EXPORT_SYMBOL(omap_set_lcd_dma_b1); | ||
2414 | EXPORT_SYMBOL(omap_set_lcd_dma_single_transfer); | ||
2415 | EXPORT_SYMBOL(omap_set_lcd_dma_ext_controller); | ||
2416 | EXPORT_SYMBOL(omap_set_lcd_dma_b1_rotation); | ||
2417 | EXPORT_SYMBOL(omap_set_lcd_dma_b1_vxres); | ||
2418 | EXPORT_SYMBOL(omap_set_lcd_dma_b1_scale); | ||
2419 | EXPORT_SYMBOL(omap_set_lcd_dma_b1_mirror); | ||
2420 | 2429 | ||