diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2010-02-18 11:30:02 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2010-03-01 21:12:03 -0500 |
commit | c014906a870ce70e009def0c9d170ccabeb0be63 (patch) | |
tree | b1cfb6520ed0bcdfb0f1b32282b94658a989b04f /drivers/dma/shdma.c | |
parent | c8e3149ba7de24dfd4c37bb0df23c878cdecd8d4 (diff) |
dmaengine: shdma: extend .device_terminate_all() to record partial transfer
This patch extends the .device_terminate_all() method of the shdma driver
to return number of bytes transfered in the current descriptor.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers/dma/shdma.c')
-rw-r--r-- | drivers/dma/shdma.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c index ea6779f3e73f..5d17e09cb625 100644 --- a/drivers/dma/shdma.c +++ b/drivers/dma/shdma.c | |||
@@ -587,6 +587,19 @@ static void sh_dmae_terminate_all(struct dma_chan *chan) | |||
587 | if (!chan) | 587 | if (!chan) |
588 | return; | 588 | return; |
589 | 589 | ||
590 | dmae_halt(sh_chan); | ||
591 | |||
592 | spin_lock_bh(&sh_chan->desc_lock); | ||
593 | if (!list_empty(&sh_chan->ld_queue)) { | ||
594 | /* Record partial transfer */ | ||
595 | struct sh_desc *desc = list_entry(sh_chan->ld_queue.next, | ||
596 | struct sh_desc, node); | ||
597 | desc->partial = (desc->hw.tcr - sh_dmae_readl(sh_chan, TCR)) << | ||
598 | sh_chan->xmit_shift; | ||
599 | |||
600 | } | ||
601 | spin_unlock_bh(&sh_chan->desc_lock); | ||
602 | |||
590 | sh_dmae_chan_ld_cleanup(sh_chan, true); | 603 | sh_dmae_chan_ld_cleanup(sh_chan, true); |
591 | } | 604 | } |
592 | 605 | ||
@@ -701,6 +714,9 @@ static void sh_chan_xfer_ld_queue(struct sh_dmae_chan *sh_chan) | |||
701 | /* Find the first not transferred desciptor */ | 714 | /* Find the first not transferred desciptor */ |
702 | list_for_each_entry(desc, &sh_chan->ld_queue, node) | 715 | list_for_each_entry(desc, &sh_chan->ld_queue, node) |
703 | if (desc->mark == DESC_SUBMITTED) { | 716 | if (desc->mark == DESC_SUBMITTED) { |
717 | dev_dbg(sh_chan->dev, "Queue #%d to %d: %u@%x -> %x\n", | ||
718 | desc->async_tx.cookie, sh_chan->id, | ||
719 | desc->hw.tcr, desc->hw.sar, desc->hw.dar); | ||
704 | /* Get the ld start address from ld_queue */ | 720 | /* Get the ld start address from ld_queue */ |
705 | dmae_set_reg(sh_chan, &desc->hw); | 721 | dmae_set_reg(sh_chan, &desc->hw); |
706 | dmae_start(sh_chan); | 722 | dmae_start(sh_chan); |