linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: linux-arm-kernel@lists.infradead.org,
	Kweh Hock Leong <hock.leong.kweh@intel.com>,
	Eric Miao <eric.y.miao@gmail.com>,
	Russell King <linux@arm.linux.org.uk>,
	Haojian Zhuang <haojian.zhuang@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	Chew Chiau Ee <chiau.ee.chew@intel.com>,
	Darren Hart <dvhart@linux.intel.com>,
	chiauee85@gmail.com, linux-kernel@vger.kernel.org,
	linux-spi@vger.kernel.org,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: Re: [PATCH] spi/pxa2xx-pci: Enable DMA binding through device name
Date: Fri, 25 Jul 2014 12:07:14 +0300	[thread overview]
Message-ID: <20140725090714.GY1857@lahna.fi.intel.com> (raw)
In-Reply-To: <7309109.iKHmHOxjzD@wuerfel>

On Fri, Jul 25, 2014 at 10:38:36AM +0200, Arnd Bergmann wrote:
> On Friday 25 July 2014 11:22:49 Mika Westerberg wrote:
> > > All you need to do is change your filter function to take the
> > > slave id from pxa_spi_info and stick it in there, e.g.
> > > 
> > > static bool pxa2xx_spi_dw_dma_filter(struct dma_chan *chan, void *param)
> > > {       
> > >         const struct pxa2xx_spi_master *pdata = param;
> > >         struct dw_dma_chan *dwc = to_dw_dma_chan(chan);
> > >         
> > >         dwc->request_line = fargs->req;
> > >         dwc->src_master = 0;
> > >         dwc->dst_master = 0;
> > >         
> > >         return 1;
> > > }           
> > 
> > Oh man. That makes pxa2xx_spi dependent on a certain specific DMA engine
> > driver.
> 
> I think you can improve this by putting the filter function (and a pointer
> to it) into the pxa2xx_spi_master data provided by the PCI driver.

Indeed, that looks better. It still makes the PCI part of the driver
dependent on a particular DMA engine driver but is certainly better than
the core pxa2xx_spi driver.

> On ARM, we usually provide those pointers through platform_data from
> the board file.
> 
> > > Note that the filter function by definition is specific to the dma
> > > controller, not the dma slave (that's why most people define it in
> > > the dmaengine driver), and the pxa2xx_spi_dma_filter() function used
> > > in spi-pxa2xx-dma.c looks like it was written for another dma engine:
> > 
> > I wonder what's the rationale that passing slave_id with
> > dma_slave_config is wrong? The current code works fine with that and is
> > is independent of the DMA engine driver (even though we know that it is
> > going to be dw-dma).
> > 
> > The dw-dma handles slave_id in its implementation of
> > dmaengine_slave_config().
> 
> The main point is that a single 'slave_id' is not actually enough to
> identify what a slave needs. In case of dw_dma, the dma engine actually
> requires three numbers (request line, source master, destination master)
> to identify it, and there is no good way to put all that information into
> a single integer. Other dma engines require a different set of data.
> 
> There are only two drivers left that actually use slave_id in this way,
> and only for the legacy (no DT or ACPI) case, every other driver uses
> either DT or a filter function. I believe the shmobile part will soon
> be done with, after shmobile has been converted to DT, and after that
> we should remove the slave_id field from the dma_slave_config interface.

OK, thanks for the explanation.

  reply	other threads:[~2014-07-25  9:07 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-24 10:01 [PATCH] spi/pxa2xx-pci: Enable DMA binding through device name Kweh Hock Leong
     [not found] ` <1406196111-22861-1-git-send-email-hock.leong.kweh-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-07-24 11:18   ` Andy Shevchenko
2014-07-24 11:42 ` Arnd Bergmann
2014-07-24 14:06   ` Mika Westerberg
     [not found]     ` <20140724140620.GP1857-3PARRvDOhMZrdx17CPfAsdBPR1lH4CV8@public.gmane.org>
2014-07-25  7:11       ` Mika Westerberg
2014-07-25  7:58         ` Arnd Bergmann
2014-07-25  8:22           ` Mika Westerberg
2014-07-25  8:38             ` Arnd Bergmann
2014-07-25  9:07               ` Mika Westerberg [this message]
     [not found]                 ` <20140725090714.GY1857-3PARRvDOhMZrdx17CPfAsdBPR1lH4CV8@public.gmane.org>
2014-07-25  9:55                   ` Mika Westerberg
     [not found]                     ` <20140725095559.GA1857-3PARRvDOhMZrdx17CPfAsdBPR1lH4CV8@public.gmane.org>
2014-07-25 10:19                       ` Arnd Bergmann
2014-07-25 10:45                         ` Andy Shevchenko
     [not found]                           ` <1406285147.8530.13.camel-XvqNBM/wLWRrdx17CPfAsdBPR1lH4CV8@public.gmane.org>
2014-07-25 15:55                             ` Arnd Bergmann
2014-07-25 21:45                               ` One Thousand Gnomes
2014-07-28 11:06                               ` Andy Shevchenko
     [not found]                                 ` <1406545580.8530.28.camel-XvqNBM/wLWRrdx17CPfAsdBPR1lH4CV8@public.gmane.org>
2014-07-28 11:56                                   ` Shevchenko, Andriy
2014-07-28 12:47                                   ` Arnd Bergmann
2014-07-28 13:34                                     ` Andy Shevchenko
     [not found]                                       ` <1406554444.8530.45.camel-XvqNBM/wLWRrdx17CPfAsdBPR1lH4CV8@public.gmane.org>
2014-07-28 14:02                                         ` Arnd Bergmann
2014-07-28  9:28                         ` Mika Westerberg

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=20140725090714.GY1857@lahna.fi.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=broonie@kernel.org \
    --cc=chiau.ee.chew@intel.com \
    --cc=chiauee85@gmail.com \
    --cc=dvhart@linux.intel.com \
    --cc=eric.y.miao@gmail.com \
    --cc=haojian.zhuang@gmail.com \
    --cc=hock.leong.kweh@intel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    /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).