Patch "dmaengine: omap-dma: Fix dynamic lch_map allocation" has been added to the 4.9-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
dmaengine: omap-dma: Fix dynamic lch_map allocation
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
dmaengine-omap-dma-fix-dynamic-lch_map-allocation.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
836c3ce2566fb8c1754f8d7c9534cad9bc8a6879Mon Sep 17 00:00:00 2001
From: Peter Ujfalusi <[email protected]>
Date: Mon, 2 Jan 2017 12:07:37 +0200
Subject: dmaengine: omap-dma: Fix dynamic lch_map allocation
From: Peter Ujfalusi <[email protected]>
commit 836c3ce2566fb8c1754f8d7c9534cad9bc8a6879 upstream.
The original patch did not done what it was supposed to be doing and even worst it broke legacy boot (OMAP1).
The lch_map size should be the number of available logical channels in sDMA and the od->dma_requests should store the number of available DMA request lines usable in sDMA.
In legacy mode we do not have a way to get the DMA request count, in that case we use OMAP_SDMA_REQUESTS (127), despite the fact that OMAP1510 have only 31 DMA request line.
--- drivers/dma/omap-dma.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-)
drivers/dma/omap-dma.c +21 -9
@@ -1339,6 +1339,7 @@ static int omap_dma_probe(struct platforstruct omap_dmadev *od;struct resource *res;int rc, i, irq; +u32 lch_count; od =devm_kzalloc (&pdev->dev,sizeof (*od),GFP_KERNEL );if (!od)
@@ -1381,20 +1382,31 @@ static int omap_dma_probe(struct platforspin_lock_init (&od->lock);spin_lock_init (&od->irq_lock); -if (!pdev->dev.of_node) { - od->dma_requests = od->plat->dma_attr->lch_count; -if (unlikely (!od->dma_requests)) - od->dma_requests =OMAP_SDMA_REQUESTS ; - }else if (of_property_read_u32 (pdev->dev.of_node,"dma-requests" , - &od->dma_requests)) { +/* Number of DMA requests */ + od->dma_requests =OMAP_SDMA_REQUESTS ; +if (pdev->dev.of_node &&of_property_read_u32 (pdev->dev.of_node, +"dma-requests" , + &od->dma_requests)) {dev_info (&pdev->dev,"Missing dma-requests property, using %u.\n" ,OMAP_SDMA_REQUESTS ); - od->dma_requests =OMAP_SDMA_REQUESTS ; } - od->lch_map =devm_kcalloc (&pdev->dev, od->dma_requests, -sizeof (*od->lch_map),GFP_KERNEL ); +/* Number of available logical channels */ +if (!pdev->dev.of_node) { + lch_count = od->plat->dma_attr->lch_count; +if (unlikely (!lch_count)) + lch_count =OMAP_SDMA_CHANNELS ; + }else if (of_property_read_u32 (pdev->dev.of_node,"dma-channels" , + &lch_count)) { +dev_info (&pdev->dev, +"Missing dma-channels property, using %u.\n" , +OMAP_SDMA_CHANNELS ); + lch_count =OMAP_SDMA_CHANNELS ; + } + + od->lch_map =devm_kcalloc (&pdev->dev, lch_count,sizeof (*od->lch_map), +GFP_KERNEL );if (!od->lch_map)return -ENOMEM ;
Patches currently in stable-queue which might be from [email protected] are
queue-4.9/dmaengine-omap-dma-fix-dynamic-lch_map-allocation.patch