Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 140287
b: refs/heads/master
c: 8c6db1b
h: refs/heads/master
i:
  140285: e79f772
  140283: 3098a64
  140279: 39784a4
  140271: a426269
  140255: 2f53ad9
  140223: 72b1deb
  140159: 8e05783
  140031: c7c9efa
  139775: 358f409
  139263: 78d0ae8
v: v3
  • Loading branch information
Guennadi Liakhovetski authored and Dan Williams committed Apr 2, 2009
1 parent d8e9b5d commit 5cc369f
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 10 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: d9de451989a88a2003ca06e524aca4665c0c7f06
refs/heads/master: 8c6db1bbf80123839ec87bdd6cb364aea384623d
65 changes: 56 additions & 9 deletions trunk/drivers/dma/ipu/ipu_idmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -1442,8 +1442,8 @@ static struct dma_async_tx_descriptor *idmac_prep_slave_sg(struct dma_chan *chan
unsigned long flags;

/* We only can handle these three channels so far */
if (ichan->dma_chan.chan_id != IDMAC_SDC_0 && ichan->dma_chan.chan_id != IDMAC_SDC_1 &&
ichan->dma_chan.chan_id != IDMAC_IC_7)
if (chan->chan_id != IDMAC_SDC_0 && chan->chan_id != IDMAC_SDC_1 &&
chan->chan_id != IDMAC_IC_7)
return NULL;

if (direction != DMA_FROM_DEVICE && direction != DMA_TO_DEVICE) {
Expand Down Expand Up @@ -1484,7 +1484,7 @@ static void idmac_issue_pending(struct dma_chan *chan)

/* This is not always needed, but doesn't hurt either */
spin_lock_irqsave(&ipu->lock, flags);
ipu_select_buffer(ichan->dma_chan.chan_id, ichan->active_buffer);
ipu_select_buffer(chan->chan_id, ichan->active_buffer);
spin_unlock_irqrestore(&ipu->lock, flags);

/*
Expand Down Expand Up @@ -1541,6 +1541,28 @@ static void idmac_terminate_all(struct dma_chan *chan)
mutex_unlock(&ichan->chan_mutex);
}

#ifdef DEBUG
static irqreturn_t ic_sof_irq(int irq, void *dev_id)
{
struct idmac_channel *ichan = dev_id;
printk(KERN_DEBUG "Got SOF IRQ %d on Channel %d\n",
irq, ichan->dma_chan.chan_id);
disable_irq(irq);
return IRQ_HANDLED;
}

static irqreturn_t ic_eof_irq(int irq, void *dev_id)
{
struct idmac_channel *ichan = dev_id;
printk(KERN_DEBUG "Got EOF IRQ %d on Channel %d\n",
irq, ichan->dma_chan.chan_id);
disable_irq(irq);
return IRQ_HANDLED;
}

static int ic_sof = -EINVAL, ic_eof = -EINVAL;
#endif

static int idmac_alloc_chan_resources(struct dma_chan *chan)
{
struct idmac_channel *ichan = to_idmac_chan(chan);
Expand All @@ -1554,7 +1576,7 @@ static int idmac_alloc_chan_resources(struct dma_chan *chan)
chan->cookie = 1;
ichan->completed = -ENXIO;

ret = ipu_irq_map(ichan->dma_chan.chan_id);
ret = ipu_irq_map(chan->chan_id);
if (ret < 0)
goto eimap;

Expand All @@ -1575,17 +1597,28 @@ static int idmac_alloc_chan_resources(struct dma_chan *chan)
if (ret < 0)
goto erirq;

#ifdef DEBUG
if (chan->chan_id == IDMAC_IC_7) {
ic_sof = ipu_irq_map(69);
if (ic_sof > 0)
request_irq(ic_sof, ic_sof_irq, 0, "IC SOF", ichan);
ic_eof = ipu_irq_map(70);
if (ic_eof > 0)
request_irq(ic_eof, ic_eof_irq, 0, "IC EOF", ichan);
}
#endif

ichan->status = IPU_CHANNEL_INITIALIZED;

dev_dbg(&ichan->dma_chan.dev->device, "Found channel 0x%x, irq %d\n",
ichan->dma_chan.chan_id, ichan->eof_irq);
dev_dbg(&chan->dev->device, "Found channel 0x%x, irq %d\n",
chan->chan_id, ichan->eof_irq);

return ret;

erirq:
ipu_uninit_channel(idmac, ichan);
eichan:
ipu_irq_unmap(ichan->dma_chan.chan_id);
ipu_irq_unmap(chan->chan_id);
eimap:
return ret;
}
Expand All @@ -1600,8 +1633,22 @@ static void idmac_free_chan_resources(struct dma_chan *chan)
__idmac_terminate_all(chan);

if (ichan->status > IPU_CHANNEL_FREE) {
#ifdef DEBUG
if (chan->chan_id == IDMAC_IC_7) {
if (ic_sof > 0) {
free_irq(ic_sof, ichan);
ipu_irq_unmap(69);
ic_sof = -EINVAL;
}
if (ic_eof > 0) {
free_irq(ic_eof, ichan);
ipu_irq_unmap(70);
ic_eof = -EINVAL;
}
}
#endif
free_irq(ichan->eof_irq, ichan);
ipu_irq_unmap(ichan->dma_chan.chan_id);
ipu_irq_unmap(chan->chan_id);
}

ichan->status = IPU_CHANNEL_FREE;
Expand Down Expand Up @@ -1663,7 +1710,7 @@ static int __init ipu_idmac_init(struct ipu *ipu)
dma_chan->device = &idmac->dma;
dma_chan->cookie = 1;
dma_chan->chan_id = i;
list_add_tail(&ichan->dma_chan.device_node, &dma->channels);
list_add_tail(&dma_chan->device_node, &dma->channels);
}

idmac_write_icreg(ipu, 0x00000070, IDMAC_CONF);
Expand Down

0 comments on commit 5cc369f

Please sign in to comment.