|
30 | 30 | *
|
31 | 31 | */
|
32 | 32 |
|
| 33 | +#include <linux/dma-map-ops.h> /* for dma_default_coherent */ |
33 | 34 | #include <linux/init.h>
|
34 | 35 | #include <linux/kernel.h>
|
35 | 36 | #include <linux/slab.h>
|
@@ -623,17 +624,18 @@ u32 au1xxx_dbdma_put_source(u32 chanid, dma_addr_t buf, int nbytes, u32 flags)
|
623 | 624 | dp->dscr_cmd0 &= ~DSCR_CMD0_IE;
|
624 | 625 |
|
625 | 626 | /*
|
626 |
| - * There is an errata on the Au1200/Au1550 parts that could result |
627 |
| - * in "stale" data being DMA'ed. It has to do with the snoop logic on |
628 |
| - * the cache eviction buffer. DMA_NONCOHERENT is on by default for |
629 |
| - * these parts. If it is fixed in the future, these dma_cache_inv will |
630 |
| - * just be nothing more than empty macros. See io.h. |
| 627 | + * There is an erratum on certain Au1200/Au1550 revisions that could |
| 628 | + * result in "stale" data being DMA'ed. It has to do with the snoop |
| 629 | + * logic on the cache eviction buffer. dma_default_coherent is set |
| 630 | + * to false on these parts. |
631 | 631 | */
|
632 |
| - dma_cache_wback_inv((unsigned long)buf, nbytes); |
| 632 | + if (!dma_default_coherent) |
| 633 | + dma_cache_wback_inv(KSEG0ADDR(buf), nbytes); |
633 | 634 | dp->dscr_cmd0 |= DSCR_CMD0_V; /* Let it rip */
|
634 | 635 | wmb(); /* drain writebuffer */
|
635 | 636 | dma_cache_wback_inv((unsigned long)dp, sizeof(*dp));
|
636 | 637 | ctp->chan_ptr->ddma_dbell = 0;
|
| 638 | + wmb(); /* force doorbell write out to dma engine */ |
637 | 639 |
|
638 | 640 | /* Get next descriptor pointer. */
|
639 | 641 | ctp->put_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr));
|
@@ -685,17 +687,18 @@ u32 au1xxx_dbdma_put_dest(u32 chanid, dma_addr_t buf, int nbytes, u32 flags)
|
685 | 687 | dp->dscr_source1, dp->dscr_dest0, dp->dscr_dest1);
|
686 | 688 | #endif
|
687 | 689 | /*
|
688 |
| - * There is an errata on the Au1200/Au1550 parts that could result in |
689 |
| - * "stale" data being DMA'ed. It has to do with the snoop logic on the |
690 |
| - * cache eviction buffer. DMA_NONCOHERENT is on by default for these |
691 |
| - * parts. If it is fixed in the future, these dma_cache_inv will just |
692 |
| - * be nothing more than empty macros. See io.h. |
| 690 | + * There is an erratum on certain Au1200/Au1550 revisions that could |
| 691 | + * result in "stale" data being DMA'ed. It has to do with the snoop |
| 692 | + * logic on the cache eviction buffer. dma_default_coherent is set |
| 693 | + * to false on these parts. |
693 | 694 | */
|
694 |
| - dma_cache_inv((unsigned long)buf, nbytes); |
| 695 | + if (!dma_default_coherent) |
| 696 | + dma_cache_inv(KSEG0ADDR(buf), nbytes); |
695 | 697 | dp->dscr_cmd0 |= DSCR_CMD0_V; /* Let it rip */
|
696 | 698 | wmb(); /* drain writebuffer */
|
697 | 699 | dma_cache_wback_inv((unsigned long)dp, sizeof(*dp));
|
698 | 700 | ctp->chan_ptr->ddma_dbell = 0;
|
| 701 | + wmb(); /* force doorbell write out to dma engine */ |
699 | 702 |
|
700 | 703 | /* Get next descriptor pointer. */
|
701 | 704 | ctp->put_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr));
|
|
0 commit comments