Skip to content

Commit

Permalink
dmaengine: at_xdmac: wait for in-progress transaction to complete aft…
Browse files Browse the repository at this point in the history
…er pausing a channel

Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
  • Loading branch information
Cyrille Pitchen authored and Vinod Koul committed Feb 5, 2015
1 parent 12385f4 commit cbb85e6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/dma/at_xdmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -1136,9 +1136,14 @@ static int at_xdmac_device_pause(struct dma_chan *chan)

dev_dbg(chan2dev(chan), "%s\n", __func__);

if (test_and_set_bit(AT_XDMAC_CHAN_IS_PAUSED, &atchan->status))
return 0;

spin_lock_bh(&atchan->lock);
at_xdmac_write(atxdmac, AT_XDMAC_GRWS, atchan->mask);
set_bit(AT_XDMAC_CHAN_IS_PAUSED, &atchan->status);
while (at_xdmac_chan_read(atchan, AT_XDMAC_CC)
& (AT_XDMAC_CC_WRIP | AT_XDMAC_CC_RDIP))
cpu_relax();
spin_unlock_bh(&atchan->lock);

return 0;
Expand Down

0 comments on commit cbb85e6

Please sign in to comment.