aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCyrille Pitchen <cyrille.pitchen@atmel.com>2015-01-27 10:30:29 -0500
committerVinod Koul <vinod.koul@intel.com>2015-02-05 02:12:28 -0500
commitcbb85e672690ad3d02e97aeba33a1e1f722bbacc (patch)
tree0a42e808a51270dc7491847df312384b6131604a
parent12385f458a27fe46da31483ed9f9ec5e9da575e7 (diff)
dmaengine: at_xdmac: wait for in-progress transaction to complete after 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>
-rw-r--r--drivers/dma/at_xdmac.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
index c39000b9980a..ed8a576cee7b 100644
--- a/drivers/dma/at_xdmac.c
+++ b/drivers/dma/at_xdmac.c
@@ -1136,9 +1136,14 @@ static int at_xdmac_device_pause(struct dma_chan *chan)
1136 1136
1137 dev_dbg(chan2dev(chan), "%s\n", __func__); 1137 dev_dbg(chan2dev(chan), "%s\n", __func__);
1138 1138
1139 if (test_and_set_bit(AT_XDMAC_CHAN_IS_PAUSED, &atchan->status))
1140 return 0;
1141
1139 spin_lock_bh(&atchan->lock); 1142 spin_lock_bh(&atchan->lock);
1140 at_xdmac_write(atxdmac, AT_XDMAC_GRWS, atchan->mask); 1143 at_xdmac_write(atxdmac, AT_XDMAC_GRWS, atchan->mask);
1141 set_bit(AT_XDMAC_CHAN_IS_PAUSED, &atchan->status); 1144 while (at_xdmac_chan_read(atchan, AT_XDMAC_CC)
1145 & (AT_XDMAC_CC_WRIP | AT_XDMAC_CC_RDIP))
1146 cpu_relax();
1142 spin_unlock_bh(&atchan->lock); 1147 spin_unlock_bh(&atchan->lock);
1143 1148
1144 return 0; 1149 return 0;