Skip to content

Commit cfb63ba

Browse files
committed
Merge branch 'fixes' of git://git.infradead.org/users/vkoul/slave-dma
Pull slave-dmaengine fixes from Vinod Koul: "The first one fixes issue in pl330 to check for DT compatible and the second one fixes omap-dma to start without delay" * 'fixes' of git://git.infradead.org/users/vkoul/slave-dma: dmaengine: omap-dma: Start DMA without delay for cyclic channels DMA: PL330: Add check if device tree compatible
2 parents a3ab02b + 7650246 commit cfb63ba

2 files changed

Lines changed: 41 additions & 17 deletions

File tree

‎drivers/dma/omap-dma.c‎

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -276,12 +276,20 @@ static void omap_dma_issue_pending(struct dma_chan *chan)
276276

277277
spin_lock_irqsave(&c->vc.lock, flags);
278278
if (vchan_issue_pending(&c->vc) && !c->desc) {
279-
struct omap_dmadev *d = to_omap_dma_dev(chan->device);
280-
spin_lock(&d->lock);
281-
if (list_empty(&c->node))
282-
list_add_tail(&c->node, &d->pending);
283-
spin_unlock(&d->lock);
284-
tasklet_schedule(&d->task);
279+
/*
280+
* c->cyclic is used only by audio and in this case the DMA need
281+
* to be started without delay.
282+
*/
283+
if (!c->cyclic) {
284+
struct omap_dmadev *d = to_omap_dma_dev(chan->device);
285+
spin_lock(&d->lock);
286+
if (list_empty(&c->node))
287+
list_add_tail(&c->node, &d->pending);
288+
spin_unlock(&d->lock);
289+
tasklet_schedule(&d->task);
290+
} else {
291+
omap_dma_start_desc(c);
292+
}
285293
}
286294
spin_unlock_irqrestore(&c->vc.lock, flags);
287295
}

‎drivers/dma/pl330.c‎

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2882,7 +2882,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
28822882
{
28832883
struct dma_pl330_platdata *pdat;
28842884
struct dma_pl330_dmac *pdmac;
2885-
struct dma_pl330_chan *pch;
2885+
struct dma_pl330_chan *pch, *_p;
28862886
struct pl330_info *pi;
28872887
struct dma_device *pd;
28882888
struct resource *res;
@@ -2984,7 +2984,16 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
29842984
ret = dma_async_device_register(pd);
29852985
if (ret) {
29862986
dev_err(&adev->dev, "unable to register DMAC\n");
2987-
goto probe_err2;
2987+
goto probe_err3;
2988+
}
2989+
2990+
if (adev->dev.of_node) {
2991+
ret = of_dma_controller_register(adev->dev.of_node,
2992+
of_dma_pl330_xlate, pdmac);
2993+
if (ret) {
2994+
dev_err(&adev->dev,
2995+
"unable to register DMA to the generic DT DMA helpers\n");
2996+
}
29882997
}
29892998

29902999
dev_info(&adev->dev,
@@ -2995,16 +3004,21 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
29953004
pi->pcfg.data_bus_width / 8, pi->pcfg.num_chan,
29963005
pi->pcfg.num_peri, pi->pcfg.num_events);
29973006

2998-
ret = of_dma_controller_register(adev->dev.of_node,
2999-
of_dma_pl330_xlate, pdmac);
3000-
if (ret) {
3001-
dev_err(&adev->dev,
3002-
"unable to register DMA to the generic DT DMA helpers\n");
3003-
goto probe_err2;
3004-
}
3005-
30063007
return 0;
3008+
probe_err3:
3009+
amba_set_drvdata(adev, NULL);
30073010

3011+
/* Idle the DMAC */
3012+
list_for_each_entry_safe(pch, _p, &pdmac->ddma.channels,
3013+
chan.device_node) {
3014+
3015+
/* Remove the channel */
3016+
list_del(&pch->chan.device_node);
3017+
3018+
/* Flush the channel */
3019+
pl330_control(&pch->chan, DMA_TERMINATE_ALL, 0);
3020+
pl330_free_chan_resources(&pch->chan);
3021+
}
30083022
probe_err2:
30093023
pl330_del(pi);
30103024
probe_err1:
@@ -3023,8 +3037,10 @@ static int pl330_remove(struct amba_device *adev)
30233037
if (!pdmac)
30243038
return 0;
30253039

3026-
of_dma_controller_free(adev->dev.of_node);
3040+
if (adev->dev.of_node)
3041+
of_dma_controller_free(adev->dev.of_node);
30273042

3043+
dma_async_device_unregister(&pdmac->ddma);
30283044
amba_set_drvdata(adev, NULL);
30293045

30303046
/* Idle the DMAC */

0 commit comments

Comments
 (0)