diff mbox

[v3,6/7] dmaengine: omap-dma: Remove mapping between virtual channels and requests

Message ID 1427459213-14611-7-git-send-email-peter.ujfalusi@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Peter Ujfalusi March 27, 2015, 12:26 p.m. UTC
Do not direct map the virtual channels to sDMA request number. When the
sDMA is behind of a crossbar this direct mapping can cause situations when
certain channel can not be requested since the crossbar request number
will no longer match with the sDMA request line.
The direct mapping for virtual channels with HW request lines will make it
harder to implement MEM_TO_MEM mode for the driver.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 drivers/dma/omap-dma.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Russell King - ARM Linux March 27, 2015, 8:22 p.m. UTC | #1
On Fri, Mar 27, 2015 at 02:26:52PM +0200, Peter Ujfalusi wrote:
> Do not direct map the virtual channels to sDMA request number. When the
> sDMA is behind of a crossbar this direct mapping can cause situations when
> certain channel can not be requested since the crossbar request number
> will no longer match with the sDMA request line.
> The direct mapping for virtual channels with HW request lines will make it
> harder to implement MEM_TO_MEM mode for the driver.

There's no point having 127 virtual DMA channels then... is there?
We might as well reduce the number down to a more reasonable set
rather than wasting memory.

> @@ -1049,7 +1050,6 @@ static int omap_dma_chan_init(struct omap_dmadev *od, int dma_sig)
>  		return -ENOMEM;
>  
>  	c->reg_map = od->reg_map;
> -	c->dma_sig = dma_sig;

That's the only user of dma_sig in this function.  Why not remove it from
the function prototype and its caller?
Peter Ujfalusi March 31, 2015, 3:44 p.m. UTC | #2
On 03/27/2015 10:22 PM, Russell King - ARM Linux wrote:
> On Fri, Mar 27, 2015 at 02:26:52PM +0200, Peter Ujfalusi wrote:
>> Do not direct map the virtual channels to sDMA request number. When the
>> sDMA is behind of a crossbar this direct mapping can cause situations when
>> certain channel can not be requested since the crossbar request number
>> will no longer match with the sDMA request line.
>> The direct mapping for virtual channels with HW request lines will make it
>> harder to implement MEM_TO_MEM mode for the driver.
> 
> There's no point having 127 virtual DMA channels then... is there?
> We might as well reduce the number down to a more reasonable set
> rather than wasting memory.

I was also come to the same conclusion. My plan was to change the virtual DMA
channels to the same as the sDMA's logical channels.

>> @@ -1049,7 +1050,6 @@ static int omap_dma_chan_init(struct omap_dmadev *od, int dma_sig)
>>  		return -ENOMEM;
>>  
>>  	c->reg_map = od->reg_map;
>> -	c->dma_sig = dma_sig;
> 
> That's the only user of dma_sig in this function.  Why not remove it from
> the function prototype and its caller?
>
diff mbox

Patch

diff --git a/drivers/dma/omap-dma.c b/drivers/dma/omap-dma.c
index 2b30acaa721f..d83e7bd8dc0a 100644
--- a/drivers/dma/omap-dma.c
+++ b/drivers/dma/omap-dma.c
@@ -593,6 +593,7 @@  static void omap_dma_free_chan_resources(struct dma_chan *chan)
 	omap_free_dma(c->dma_ch);
 
 	dev_dbg(od->ddev.dev, "freeing channel for %u\n", c->dma_sig);
+	c->dma_sig = 0;
 }
 
 static size_t omap_dma_sg_size(struct omap_sg *sg)
@@ -1049,7 +1050,6 @@  static int omap_dma_chan_init(struct omap_dmadev *od, int dma_sig)
 		return -ENOMEM;
 
 	c->reg_map = od->reg_map;
-	c->dma_sig = dma_sig;
 	c->vc.desc_free = omap_dma_desc_free;
 	vchan_init(&c->vc, &od->ddev);
 	INIT_LIST_HEAD(&c->node);
@@ -1220,10 +1220,14 @@  static struct platform_driver omap_dma_driver = {
 bool omap_dma_filter_fn(struct dma_chan *chan, void *param)
 {
 	if (chan->device->dev->driver == &omap_dma_driver.driver) {
+		struct omap_dmadev *od = to_omap_dma_dev(chan->device);
 		struct omap_chan *c = to_omap_dma_chan(chan);
 		unsigned req = *(unsigned *)param;
 
-		return req == c->dma_sig;
+		if (req <= od->dma_requests) {
+			c->dma_sig = req;
+			return true;
+		}
 	}
 	return false;
 }