Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 369752
b: refs/heads/master
c: 817f6d1
h: refs/heads/master
v: v3
  • Loading branch information
Sebastian Siewior authored and David S. Miller committed Apr 25, 2013
1 parent 6bd8d58 commit b2bec20
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2bac7cb316d1327c457a715bac5fd56bbc42bc63
refs/heads/master: 817f6d1a13754b043e1a6c1cb713763022860689
20 changes: 12 additions & 8 deletions trunk/drivers/net/ethernet/ti/davinci_cpdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <linux/err.h>
#include <linux/dma-mapping.h>
#include <linux/io.h>
#include <linux/delay.h>

#include "davinci_cpdma.h"

Expand Down Expand Up @@ -312,14 +313,16 @@ int cpdma_ctlr_start(struct cpdma_ctlr *ctlr)
}

if (ctlr->params.has_soft_reset) {
unsigned long timeout = jiffies + HZ/10;
unsigned timeout = 10 * 100;

dma_reg_write(ctlr, CPDMA_SOFTRESET, 1);
while (time_before(jiffies, timeout)) {
while (timeout) {
if (dma_reg_read(ctlr, CPDMA_SOFTRESET) == 0)
break;
udelay(10);
timeout--;
}
WARN_ON(!time_before(jiffies, timeout));
WARN_ON(!timeout);
}

for (i = 0; i < ctlr->num_chan; i++) {
Expand Down Expand Up @@ -868,7 +871,7 @@ int cpdma_chan_stop(struct cpdma_chan *chan)
struct cpdma_desc_pool *pool = ctlr->pool;
unsigned long flags;
int ret;
unsigned long timeout;
unsigned timeout;

spin_lock_irqsave(&chan->lock, flags);
if (chan->state != CPDMA_STATE_ACTIVE) {
Expand All @@ -883,14 +886,15 @@ int cpdma_chan_stop(struct cpdma_chan *chan)
dma_reg_write(ctlr, chan->td, chan_linear(chan));

/* wait for teardown complete */
timeout = jiffies + HZ/10; /* 100 msec */
while (time_before(jiffies, timeout)) {
timeout = 100 * 100; /* 100 ms */
while (timeout) {
u32 cp = chan_read(chan, cp);
if ((cp & CPDMA_TEARDOWN_VALUE) == CPDMA_TEARDOWN_VALUE)
break;
cpu_relax();
udelay(10);
timeout--;
}
WARN_ON(!time_before(jiffies, timeout));
WARN_ON(!timeout);
chan_write(chan, cp, CPDMA_TEARDOWN_VALUE);

/* handle completed packets */
Expand Down

0 comments on commit b2bec20

Please sign in to comment.