linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: aisheng.dong@freescale.com (Dong Aisheng)
To: linux-arm-kernel@lists.infradead.org
Subject: RFC: changing DMA slave configuration API
Date: Mon, 11 Jun 2012 17:33:33 +0800	[thread overview]
Message-ID: <20120611093332.GC26681@shlinux2.ap.freescale.net> (raw)
In-Reply-To: <1339390249.1927.1623.camel@vkoul-udesk3>

On Mon, Jun 11, 2012 at 10:20:49AM +0530, Vinod Koul wrote:
> On Sun, 2012-06-10 at 12:22 +0100, Russell King - ARM Linux wrote:
> > On Sun, Jun 10, 2012 at 07:19:47PM +0800, Barry Song wrote:
> > > 2012/6/10 Russell King - ARM Linux <linux@arm.linux.org.uk>:
> > > > Dan, Vinod,
> > > >
> > > > There's a change I would like to do to the DMA slave configuration.
> > > > It's currently a pain to have the source and destination parameters in
> > > > the dma_slave_config structure as separate elements; it means when you
> > > > want to extract them, you end up with code in DMA engine drivers like:
> > > >
> > > > +       if (dir == DMA_DEV_TO_MEM) {
> > > > +               dev_addr = c->src_addr;
> > > > +               dev_width = c->src_addr_width;
> > > > +               burst = c->src_maxburst;
> > > > +       } else if (dir == DMA_MEM_TO_DEV) {
> > > > +               dev_addr = c->dst_addr;
> > > > +               dev_width = c->dst_addr_width;
> > > > +               burst = c->dst_maxburst;
> > > > +       }
> > > >
> > > > If we redefine the structure as below, this all becomes more simple:
> > > >
> > > > +       if (dir == DMA_DEV_TO_MEM)
> > > > +               cfg = &c->dev_src;
> > > > +       else if (dir == DMA_MEM_TO_DEV)
> > > > +               cfg = &c->dev_dst;
> > > 
> > > it seems that might mean an union in your dma_slave_cfg, but not
> > > co-exitense of both?
> > 
> > No, I want both so it's possible to select between the two when preparing
> > a DMA slave transfer.
> > 
> > > struct dma_slave_cfg {
> > > +       union {
> > >               struct dma_dev_cfg dev_src;
> > >               struct dma_dev_cfg dev_dst;
> > >        }
> > >        bool device_fc;
> > > };
> > 
> > If you do that, the union becomes pointless, and you might as well have:
> > 
> > struct dma_slave_cfg {
> > 	struct dma_dev_cfg dev;
> > 	bool device_fc;
> > };
> > 
> > instead.
> Hi Russell,
> 
> I think it is a good idea. And I would like to extend it even a little
> bit. Do we have any users of peripheral to peripheral slave dma?
Yes, IMX sdma does support such kind of transfer.
The driver still does not support it currently.

> IIRC  that is not the case, or does anyone know of existence or plans
> for such a h/w?
> 
i.MX5 and i.MX6.

> If not, lets junk the src/dst fields and keep burst, length, addr fields
> which point to the peripheral values.
> 
> Alternatively if we need both, then we can't have union and Russell's
> idea seems good one :)
> 
Russell's idea seems reasonable and we may want to support peripheral to
peripheral in the future.

Regards
Dong Aisheng

  parent reply	other threads:[~2012-06-11  9:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-10 10:20 RFC: changing DMA slave configuration API Russell King - ARM Linux
2012-06-10 11:19 ` Barry Song
2012-06-10 11:22   ` Russell King - ARM Linux
2012-06-11  4:50     ` Vinod Koul
2012-06-11  8:24       ` Russell King - ARM Linux
2012-06-12  6:04         ` Vinod Koul
2012-06-11  9:33       ` Dong Aisheng [this message]
2012-06-12  5:54         ` Vinod Koul
2012-06-11 20:36       ` David Brown
2012-08-14 10:55       ` Linus Walleij

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=20120611093332.GC26681@shlinux2.ap.freescale.net \
    --to=aisheng.dong@freescale.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;
as well as URLs for NNTP newsgroup(s).