Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8ac69546 authored by Russell King - ARM Linux's avatar Russell King - ARM Linux Committed by Vinod Koul
Browse files

dmaengine: ensure all DMA engine drivers initialize their cookies



Ensure all DMA engine drivers initialize their cookies in the same way,
so that they all behave in a similar fashion.  This means their first
issued cookie will be 2 rather than 1, and will increment to INT_MAX
before returning 1 and starting over.

In connection with this, Dan Williams said:
> Russell King wrote:
> > Secondly, some DMA engine drivers initialize the dma_chan cookie to 0,
> > others to 1.  Is there a reason for this, or are these all buggy?
>
> I know that ioat and iop-adma expect 0 to mean "I have cleaned up this
> descriptor and it is idle", and would break if zero was an in-flight
> cookie value.  The reserved usage of zero is an driver internal
> concern, but I have no problem formalizing it as a reserved value.

Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
Tested-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Acked-by: default avatarJassi Brar <jassisinghbrar@gmail.com>
[imx-sdma.c & mxs-dma.c]
Tested-by: default avatarShawn Guo <shawn.guo@linaro.org>
Signed-off-by: default avatarVinod Koul <vinod.koul@linux.intel.com>
parent 2a926e46
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -1292,6 +1292,7 @@ static int __devinit fsl_dma_chan_probe(struct fsldma_device *fdev,
	chan->idle = true;
	chan->idle = true;


	chan->common.device = &fdev->common;
	chan->common.device = &fdev->common;
	dma_cookie_init(&chan->common);


	/* find the IRQ line, if it exists in the device tree */
	/* find the IRQ line, if it exists in the device tree */
	chan->irq = irq_of_parse_and_map(node, 0);
	chan->irq = irq_of_parse_and_map(node, 0);
+1 −0
Original line number Original line Diff line number Diff line
@@ -347,6 +347,7 @@ static int __init imxdma_probe(struct platform_device *pdev)
		spin_lock_init(&imxdmac->lock);
		spin_lock_init(&imxdmac->lock);


		imxdmac->chan.device = &imxdma->dma_device;
		imxdmac->chan.device = &imxdma->dma_device;
		dma_cookie_init(&imxdmac->chan);
		imxdmac->channel = i;
		imxdmac->channel = i;


		/* Add the channel to the DMAC list */
		/* Add the channel to the DMAC list */
+1 −0
Original line number Original line Diff line number Diff line
@@ -1355,6 +1355,7 @@ static int __init sdma_probe(struct platform_device *pdev)
		spin_lock_init(&sdmac->lock);
		spin_lock_init(&sdmac->lock);


		sdmac->chan.device = &sdma->dma_device;
		sdmac->chan.device = &sdma->dma_device;
		dma_cookie_init(&sdmac->chan);
		sdmac->channel = i;
		sdmac->channel = i;


		/*
		/*
+1 −0
Original line number Original line Diff line number Diff line
@@ -109,6 +109,7 @@ void ioat_init_channel(struct ioatdma_device *device, struct ioat_chan_common *c
	chan->reg_base = device->reg_base + (0x80 * (idx + 1));
	chan->reg_base = device->reg_base + (0x80 * (idx + 1));
	spin_lock_init(&chan->cleanup_lock);
	spin_lock_init(&chan->cleanup_lock);
	chan->common.device = dma;
	chan->common.device = dma;
	dma_cookie_init(&chan->common);
	list_add_tail(&chan->common.device_node, &dma->channels);
	list_add_tail(&chan->common.device_node, &dma->channels);
	device->idx[idx] = chan;
	device->idx[idx] = chan;
	init_timer(&chan->timer);
	init_timer(&chan->timer);
+1 −0
Original line number Original line Diff line number Diff line
@@ -1545,6 +1545,7 @@ static int __devinit iop_adma_probe(struct platform_device *pdev)
	INIT_LIST_HEAD(&iop_chan->chain);
	INIT_LIST_HEAD(&iop_chan->chain);
	INIT_LIST_HEAD(&iop_chan->all_slots);
	INIT_LIST_HEAD(&iop_chan->all_slots);
	iop_chan->common.device = dma_dev;
	iop_chan->common.device = dma_dev;
	dma_cookie_init(&iop_chan->common);
	list_add_tail(&iop_chan->common.device_node, &dma_dev->channels);
	list_add_tail(&iop_chan->common.device_node, &dma_dev->channels);


	if (dma_has_cap(DMA_MEMCPY, dma_dev->cap_mask)) {
	if (dma_has_cap(DMA_MEMCPY, dma_dev->cap_mask)) {
Loading