aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/amba-pl08x.c
diff options
context:
space:
mode:
authorRussell King - ARM Linux <linux@arm.linux.org.uk>2011-01-03 17:42:55 -0500
committerDan Williams <dan.j.williams@intel.com>2011-01-04 22:16:13 -0500
commit5f638b4f313e345bf02700910e581bccf71212f5 (patch)
tree423d49f0935c3f2977e3aae1cb7b4d402d0c257a /drivers/dma/amba-pl08x.c
parentd6cf7b597f7158616106068930d1c6203d9359eb (diff)
ARM: PL08x: fix fill_bytes calculation
The number of bytes we want to fill into any LLI is the minimum of: - number of bytes remaining in the transfer - number of bytes we can transfer in a single LLI - number of bytes we can transfer without overflowing the source boundary - number of bytes we can transfer without overflowing the destination boundary The minimum of the first two is already calculated (target_len). We limit the boundary calculations to this number of bytes, which will then give us the number of bytes we can place into this LLI. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Acked-by: Linus Walleij <linus.walleij@stericsson.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/dma/amba-pl08x.c')
-rw-r--r--drivers/dma/amba-pl08x.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c
index 91dd6bfcc30f..be7fa174d6c0 100644
--- a/drivers/dma/amba-pl08x.c
+++ b/drivers/dma/amba-pl08x.c
@@ -685,31 +685,25 @@ static int pl08x_fill_llis_for_desc(struct pl08x_driver_data *pl08x,
685 target_len = min(remainder, max_bytes_per_lli); 685 target_len = min(remainder, max_bytes_per_lli);
686 686
687 /* 687 /*
688 * Set bus lengths for incrementing buses 688 * Set bus lengths for incrementing buses to the
689 * to number of bytes which fill to next memory 689 * number of bytes which fill to next memory boundary,
690 * boundary 690 * limiting on the target length calculated above.
691 */ 691 */
692 if (cctl & PL080_CONTROL_SRC_INCR) 692 if (cctl & PL080_CONTROL_SRC_INCR)
693 txd->srcbus.fill_bytes = 693 txd->srcbus.fill_bytes =
694 pl08x_pre_boundary( 694 pl08x_pre_boundary(txd->srcbus.addr,
695 txd->srcbus.addr, 695 target_len);
696 remainder);
697 else 696 else
698 txd->srcbus.fill_bytes = 697 txd->srcbus.fill_bytes = target_len;
699 max_bytes_per_lli;
700 698
701 if (cctl & PL080_CONTROL_DST_INCR) 699 if (cctl & PL080_CONTROL_DST_INCR)
702 txd->dstbus.fill_bytes = 700 txd->dstbus.fill_bytes =
703 pl08x_pre_boundary( 701 pl08x_pre_boundary(txd->dstbus.addr,
704 txd->dstbus.addr, 702 target_len);
705 remainder);
706 else 703 else
707 txd->dstbus.fill_bytes = 704 txd->dstbus.fill_bytes = target_len;
708 max_bytes_per_lli;
709 705
710 /* 706 /* Find the nearest */
711 * Find the nearest
712 */
713 lli_len = min(txd->srcbus.fill_bytes, 707 lli_len = min(txd->srcbus.fill_bytes,
714 txd->dstbus.fill_bytes); 708 txd->dstbus.fill_bytes);
715 709