diff options
author | Alexandre Bounine <alexandre.bounine@idt.com> | 2016-03-22 14:26:08 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-03-22 15:36:02 -0700 |
commit | e3dd8cd4778ebc75c654f73d8673281078c81ed9 (patch) | |
tree | 361fad4c972f69069d9815f45a184a0a4a74bf5e /drivers/rapidio/devices/tsi721_dma.c | |
parent | 83dc2cbc1136108068637d5c98636647f7b82461 (diff) | |
download | op-kernel-dev-e3dd8cd4778ebc75c654f73d8673281078c81ed9.zip op-kernel-dev-e3dd8cd4778ebc75c654f73d8673281078c81ed9.tar.gz |
rapidio/tsi721: add shutdown notification callback
Add device driver specific shutdown notification callback.
Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Aurelien Jacquiot <a-jacquiot@ti.com>
Cc: Andre van Herk <andre.van.herk@prodrive-technologies.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rapidio/devices/tsi721_dma.c')
-rw-r--r-- | drivers/rapidio/devices/tsi721_dma.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/rapidio/devices/tsi721_dma.c b/drivers/rapidio/devices/tsi721_dma.c index 500e1e0..b490ec3 100644 --- a/drivers/rapidio/devices/tsi721_dma.c +++ b/drivers/rapidio/devices/tsi721_dma.c @@ -852,6 +852,36 @@ static int tsi721_terminate_all(struct dma_chan *dchan) return 0; } +static void tsi721_dma_stop(struct tsi721_bdma_chan *bdma_chan) +{ + if (!bdma_chan->active) + return; + spin_lock_bh(&bdma_chan->lock); + if (!tsi721_dma_is_idle(bdma_chan)) { + int timeout = 100000; + + /* stop the transfer in progress */ + iowrite32(TSI721_DMAC_CTL_SUSP, + bdma_chan->regs + TSI721_DMAC_CTL); + + /* Wait until DMA channel stops */ + while (!tsi721_dma_is_idle(bdma_chan) && --timeout) + udelay(1); + } + + spin_unlock_bh(&bdma_chan->lock); +} + +void tsi721_dma_stop_all(struct tsi721_device *priv) +{ + int i; + + for (i = 0; i < TSI721_DMA_MAXCH; i++) { + if (i != TSI721_DMACH_MAINT) + tsi721_dma_stop(&priv->bdma[i]); + } +} + int tsi721_register_dma(struct tsi721_device *priv) { int i; |