提交 817f6d1a 编写于 作者: S Sebastian Siewior 提交者: David S. Miller

net/davinci_cpdma: don't check for jiffies with interrupts

__cpdma_chan_process() holds the lock with interrupts off (and its
caller as well), same goes for cpdma_ctlr_start(). With interrupts off,
jiffies will not make any progress and if the wait condition never gets
true we wait for ever.
Tgis patch adds a a simple udelay and counting down attempt.
Acked-by: NMugunthan V N <mugunthanvnm@ti.com>
Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 2bac7cb3
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <linux/err.h> #include <linux/err.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/delay.h>
#include "davinci_cpdma.h" #include "davinci_cpdma.h"
...@@ -312,14 +313,16 @@ int cpdma_ctlr_start(struct cpdma_ctlr *ctlr) ...@@ -312,14 +313,16 @@ int cpdma_ctlr_start(struct cpdma_ctlr *ctlr)
} }
if (ctlr->params.has_soft_reset) { if (ctlr->params.has_soft_reset) {
unsigned long timeout = jiffies + HZ/10; unsigned timeout = 10 * 100;
dma_reg_write(ctlr, CPDMA_SOFTRESET, 1); dma_reg_write(ctlr, CPDMA_SOFTRESET, 1);
while (time_before(jiffies, timeout)) { while (timeout) {
if (dma_reg_read(ctlr, CPDMA_SOFTRESET) == 0) if (dma_reg_read(ctlr, CPDMA_SOFTRESET) == 0)
break; break;
udelay(10);
timeout--;
} }
WARN_ON(!time_before(jiffies, timeout)); WARN_ON(!timeout);
} }
for (i = 0; i < ctlr->num_chan; i++) { for (i = 0; i < ctlr->num_chan; i++) {
...@@ -868,7 +871,7 @@ int cpdma_chan_stop(struct cpdma_chan *chan) ...@@ -868,7 +871,7 @@ int cpdma_chan_stop(struct cpdma_chan *chan)
struct cpdma_desc_pool *pool = ctlr->pool; struct cpdma_desc_pool *pool = ctlr->pool;
unsigned long flags; unsigned long flags;
int ret; int ret;
unsigned long timeout; unsigned timeout;
spin_lock_irqsave(&chan->lock, flags); spin_lock_irqsave(&chan->lock, flags);
if (chan->state != CPDMA_STATE_ACTIVE) { if (chan->state != CPDMA_STATE_ACTIVE) {
...@@ -883,14 +886,15 @@ int cpdma_chan_stop(struct cpdma_chan *chan) ...@@ -883,14 +886,15 @@ int cpdma_chan_stop(struct cpdma_chan *chan)
dma_reg_write(ctlr, chan->td, chan_linear(chan)); dma_reg_write(ctlr, chan->td, chan_linear(chan));
/* wait for teardown complete */ /* wait for teardown complete */
timeout = jiffies + HZ/10; /* 100 msec */ timeout = 100 * 100; /* 100 ms */
while (time_before(jiffies, timeout)) { while (timeout) {
u32 cp = chan_read(chan, cp); u32 cp = chan_read(chan, cp);
if ((cp & CPDMA_TEARDOWN_VALUE) == CPDMA_TEARDOWN_VALUE) if ((cp & CPDMA_TEARDOWN_VALUE) == CPDMA_TEARDOWN_VALUE)
break; break;
cpu_relax(); udelay(10);
timeout--;
} }
WARN_ON(!time_before(jiffies, timeout)); WARN_ON(!timeout);
chan_write(chan, cp, CPDMA_TEARDOWN_VALUE); chan_write(chan, cp, CPDMA_TEARDOWN_VALUE);
/* handle completed packets */ /* handle completed packets */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册