From: Vinod Koul <vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
Cc: Zhangfei Gao
<zhangfei.gao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
device-tree
<devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org>,
Russell King - ARM Linux
<linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>,
linux-arm-kernel
<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
zhangfei gao
<zhangfei.gao-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH] dmaengine: Add hisilicon k3 DMA engine driver
Date: Fri, 21 Jun 2013 16:15:10 +0530 [thread overview]
Message-ID: <20130621104510.GH23141@intel.com> (raw)
In-Reply-To: <201306181609.14966.arnd-r2nGTMty4D4@public.gmane.org>
On Tue, Jun 18, 2013 at 04:09:14PM +0200, Arnd Bergmann wrote:
> On Tuesday 18 June 2013, zhangfei gao wrote:
> > On Tue, Jun 18, 2013 at 4:58 AM, Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org> wrote:
> > >
> > >> +static struct of_dma_filter_info k3_dma_filter;
> > >> +static bool k3_dma_filter_fn(struct dma_chan *chan, void *param)
> > >> +{
> > >> + return (*(int *)param == chan->chan_id);
> > >> +}
> > >
> > > This filter function works only as long as there is no more than
> > > one DMA engine in the system, which is something that needs to
> > > be documented better. Unfortunately, providing a filter
> > > function to be called by .xlate is currently the only way that
> > > the dma-engine API supports, but we should really get over that.
> > >
> > > Vinod: I think we need to add a way for a dmaengine driver to
> > > just return one of its channels to the xlate function. The
> > > current method is getting very silly, and it adds run-time and
> > > code complexity without any need.
> > >
> > > How about something like
> > >
> > > int dma_get_slave_channel(struct dma_chan *chan)
> > > {
> > > /* lock against __dma_request_channel */
> > > mutex_lock(&dma_list_mutex);
> > >
> > > if (chan->client_count == 0)
> > > ret = dma_chan_get(chan);
> > > else
> > > ret = -EBUSY;
> > >
> > > mutex_unlock(&dma_list_mutex);
> > >
> > > return ret;
> > > }
> > > EXPORT_SYMBOL_GPL(dma_get_slave_channel);
> >
> > Want to double check here.
> > Device need specific channel via request line, the requirement still
> > can be met, right?
>
> The driver can have a simple array of pointers that is indexed by
> the request number, so you end up with something like
>
> struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
> struct of_dma *ofdma)
> {
> struct k3_dma_dev *dev = ofdma->of_dma_data;
> unsigned int vchan = dma_spec->args[0];
>
> if (vchan > dev->nr_channels)
> return NULL;
>
> return dma_get_slave_channel(dev->vchan[vchan]);
> }
>
> With no need to have a filter function.
for SW muxes this may work well IMO
--
~Vinod
next prev parent reply other threads:[~2013-06-21 10:45 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-17 4:54 [PATCH] dmaengine: Add hisilicon k3 DMA engine driver Zhangfei Gao
[not found] ` <1371444872-26994-1-git-send-email-zhangfei.gao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-06-17 20:58 ` Arnd Bergmann
2013-06-18 2:33 ` zhangfei gao
2013-06-18 14:09 ` Arnd Bergmann
2013-06-18 14:22 ` zhangfei
[not found] ` <51C06D19.3020304-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-06-18 15:08 ` Arnd Bergmann
2013-06-21 10:49 ` Vinod Koul
[not found] ` <201306181609.14966.arnd-r2nGTMty4D4@public.gmane.org>
2013-06-21 10:45 ` Vinod Koul [this message]
[not found] ` <201306172258.08185.arnd-r2nGTMty4D4@public.gmane.org>
2013-06-21 10:43 ` Vinod Koul
[not found] ` <20130621104355.GG23141-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-06-21 11:41 ` Arnd Bergmann
2013-06-24 8:49 ` zhangfei gao
2013-06-24 16:15 ` Arnd Bergmann
2013-06-25 5:34 ` zhangfei gao
2013-06-21 10:40 ` Vinod Koul
2013-06-25 5:34 ` zhangfei gao
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=20130621104510.GH23141@intel.com \
--to=vinod.koul-ral2jqcrhueavxtiumwx3w@public.gmane.org \
--cc=arnd-r2nGTMty4D4@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org \
--cc=zhangfei.gao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=zhangfei.gao-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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;
as well as URLs for NNTP newsgroup(s).