linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Vinod Koul <vinod.koul@intel.com>
To: Alexander Popov <a13xp0p0v88@gmail.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
	Arnd Bergmann <arnd@arndb.de>, Gerhard Sittig <gsi@denx.de>,
	Andy Shevchenko <andriy.shevchenko@linux.jf.intel.com>,
	dmaengine@vger.kernel.org,
	Dan Williams <dan.j.williams@intel.com>,
	Anatolij Gustschin <agust@denx.de>,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH RFC v9 2/6] dma: mpc512x: add support for peripheral transfers
Date: Wed, 19 Mar 2014 19:38:57 +0530	[thread overview]
Message-ID: <20140319140857.GG1976@intel.com> (raw)
In-Reply-To: <CAF0T0X5egegHc3pheSbPRPuZaVaktMtdUiGPOLhcWZevH=pD=A@mail.gmail.com>

On Wed, Mar 19, 2014 at 05:26:47PM +0400, Alexander Popov wrote:
> Hello Andy
> 
> 2014-03-14 13:47 GMT+04:00 Andy Shevchenko <andriy.shevchenko@linux.intel.com>:
> > On Wed, 2014-03-12 at 15:47 +0400, Alexander Popov wrote:
> >> +     case DMA_SLAVE_CONFIG:
> >> +             /* Constraints:
> >> +              *  - only transfers between a peripheral device and
> >> +              *     memory are supported;
> >> +              *  - minimal transfer chunk is 4 bytes and consequently
> >> +              *     source and destination addresses must be 4-byte aligned
> >> +              *     and transfer size must be aligned on (4 * maxburst)
> >> +              *     boundary;
> >> +              *  - during the transfer RAM address is being incremented by
> >> +              *     the size of minimal transfer chunk;
> >> +              *  - peripheral port's address is constant during the transfer.
> >> +              */
> >> +
> >> +             cfg = (void *)arg;
> >> +
> >> +             if (!is_slave_direction(cfg->direction))
> >> +                     return -EINVAL;
> >
> > As far as I understand the intention you have not to use direction field
> > in the dma_slave_config. It will be removed once.
> >
> >> +
> >> +             if (cfg->src_addr_width != DMA_SLAVE_BUSWIDTH_4_BYTES &&
> >> +                     cfg->dst_addr_width != DMA_SLAVE_BUSWIDTH_4_BYTES)
> >> +                     return -EINVAL;
> >> +
> >> +             spin_lock_irqsave(&mchan->lock, flags);
> >> +
> >> +             if (cfg->direction == DMA_DEV_TO_MEM) {
> >> +                     mchan->per_paddr = cfg->src_addr;
> >> +                     mchan->tcd_nunits = cfg->src_maxburst;
> >> +             } else {
> >> +                     mchan->per_paddr = cfg->dst_addr;
> >> +                     mchan->tcd_nunits = cfg->dst_maxburst;
> >> +             }
> >
> > Ditto.
> 
> Excuse me, I don't understand this point.
> I have to use cfg->direction because in case of DMA_DEV_TO_MEM
> I use cfg->SRC_addr and cfg->SRC_maxburst and in case of
> DMA_MEM_TO_DEV I use cfg->DST_addr and cfg->DST_maxburst.
> Is it correct?
You store the complete config for both source and destination.
Then based on the descriptor direction you can retrive the values from channel
context and program

This way you _dont_ need to fix the direction and can use it both ways!

-- 
~Vinod

  reply	other threads:[~2014-03-19 14:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-12 11:47 [PATCH RFC v9 0/6] MPC512x DMA slave s/g support, OF DMA lookup Alexander Popov
2014-03-12 11:47 ` [PATCH RFC v9 1/6] dma: mpc512x: reorder mpc8308 specific instructions Alexander Popov
2014-03-12 11:47 ` [PATCH RFC v9 2/6] dma: mpc512x: add support for peripheral transfers Alexander Popov
2014-03-14  9:47   ` Andy Shevchenko
2014-03-19 13:26     ` Alexander Popov
2014-03-19 14:08       ` Vinod Koul [this message]
2014-03-12 11:47 ` [PATCH RFC v9 3/6] dma: mpc512x: replace devm_request_irq() with request_irq() Alexander Popov
2014-03-14  9:50   ` Andy Shevchenko
2014-03-12 11:47 ` [PATCH RFC v9 4/6] dma: of: Add common xlate function for matching by channel id Alexander Popov
2014-03-12 11:47 ` [PATCH RFC v9 5/6] dma: mpc512x: add device tree binding document Alexander Popov
2014-03-13 18:09   ` Mark Rutland
2014-03-14 10:43     ` Arnd Bergmann
2014-03-12 11:47 ` [PATCH RFC v9 6/6] dma: mpc512x: register for device tree channel lookup Alexander Popov

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=20140319140857.GG1976@intel.com \
    --to=vinod.koul@intel.com \
    --cc=a13xp0p0v88@gmail.com \
    --cc=agust@denx.de \
    --cc=andriy.shevchenko@linux.jf.intel.com \
    --cc=arnd@arndb.de \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=gsi@denx.de \
    --cc=lars@metafoo.de \
    --cc=linuxppc-dev@lists.ozlabs.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).