Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: ludovic.desroches@atmel.com (Ludovic Desroches)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH] dma: at_xdmac: creation of the atmel eXtended DMA Controller driver
Date: Wed, 11 Jun 2014 10:12:48 +0200	[thread overview]
Message-ID: <20140611081248.GS1701@ldesroches-Latitude-E6320> (raw)
In-Reply-To: <8696483.Dng95cR5kK@wuerfel>

On Wed, Jun 11, 2014 at 09:41:47AM +0200, Arnd Bergmann wrote:
> On Wednesday 11 June 2014 09:35:25 Ludovic Desroches wrote:
> > > > +     if (dma_spec->args_count != 2) {
> > > > +             dev_err(&pdev->dev, "dma phandler args: bad number of args\n");
> > > > +             return NULL;
> > > > +     }
> > > > +
> > > > +     dma_cap_zero(mask);
> > > > +     dma_cap_set(DMA_SLAVE, mask);
> > > > +     chan = dma_request_channel(mask, NULL, NULL);
> > > > +     if (!chan) {
> > > > +             dev_err(&pdev->dev, "can't get a dma channel\n");
> > > > +             return NULL;
> > > > +     }
> > > 
> > > You must use dma_get_any_slave_channel. dma_request_channel gives you a
> > > channel from a random dma engine that is present in the system, not
> > > necessarily the one you are managing here.
> > 
> > It is planned to use dma_get_any_slave_channel but currently I am doing
> > tests on a 3.10 kernel that's why I am still using dma_request_channel.
> 
> Ok, I see. The correct way to do this then would be to have a filter
> function that compares the channel's dmadevice pointer to the one
> you get from the of_dma_data pointer. Since you already plan to
> change this, and you probably know that there are no other engines
> in the system, maybe you can do it like this in the meantime:
> 
> 	/* FIXME: use dma_get_any_slave_chan to avoid the WARN_ON */
> 	if (!chan || WARN_ON(chan->device != dev)) {
> 		dev_err(&pdev->dev, "can't get a dma channel\n");
> 		return NULL;
> 	}
> 

I have noticed that the filter function was missing in the RFC version.
I had to add it since there are two xdma controllers in the system.

static bool at_xdmac_filter(struct dma_chan *chan, void *slave)                 
{                                                                               
        struct device *dma_dev = (struct device *) slave;                       
                                                                                
        if (dma_dev == chan->device->dev)                                       
                return true;                                                    
        else                                                                    
                return false;                                                   
}


Ludovic

  reply	other threads:[~2014-06-11  8:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-27  8:35 [RFC PATCH] dma: at_xdmac: creation of the atmel eXtended DMA Controller driver Ludovic Desroches
2014-05-29 10:04 ` Josh Wu
2014-06-10 15:41 ` Maxime Ripard
2014-06-10 17:58   ` Arnd Bergmann
2014-06-10 19:15   ` Arnd Bergmann
2014-06-11  7:35     ` Ludovic Desroches
2014-06-11  7:41       ` Arnd Bergmann
2014-06-11  8:12         ` Ludovic Desroches [this message]
2014-06-11  9:04           ` Arnd Bergmann
2014-06-11  7:59   ` Ludovic Desroches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140611081248.GS1701@ldesroches-Latitude-E6320 \
    --to=ludovic.desroches@atmel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox