All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>,
	Grant Likely <grant.likely@secretlab.ca>,
	Benoit Cousson <b-cousson@ti.com>,
	rob.herring@calxeda.com, devicetree-discuss@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org,
	Stephen Warren <swarren@nvidia.com>,
	linux-omap@vger.kernel.org, Vinod Koul <vinod.koul@intel.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Thomas Abraham <thomas.abraham@linaro.org>
Subject: Re: [PATCH] of: Add generic device tree DMA helpers
Date: Mon, 19 Mar 2012 16:11:58 +0000	[thread overview]
Message-ID: <201203191611.59064.arnd@arndb.de> (raw)
In-Reply-To: <20120319153334.GF16389@n2100.arm.linux.org.uk>

On Monday 19 March 2012, Russell King - ARM Linux wrote:
> Firstly, define what you mean by "the DMA parameters".  Things like burst
> size, register width, register address?  That should all be known by the
> peripheral driver and not be encoded into DT in any way - and this
> information should be passed to the DMA engine driver for the well defined
> API for that purpose.

This seems to be different for each controller, I tried to use
a generic term here. In case of stedma40 (which is probably the most
complex one today), it would be this structure:

struct stedma40_chan_cfg {
        enum stedma40_xfer_dir                   dir;
        bool                                     high_priority;
        bool                                     realtime;
        enum stedma40_mode                       mode;
        enum stedma40_mode_opt                   mode_opt;
        int                                      src_dev_type;
        int                                      dst_dev_type;
        struct stedma40_half_channel_info        src_info;
        struct stedma40_half_channel_info        dst_info;

        bool                                     use_fixed_channel; 
        int                                      phy_channel;
};

All these fields are set up by the platform code today, not by
the device driver, so it would be logical to have them represented
in the device tree, though some of the fields might turn out to
be in the wrong place already.

> Secondly, there are platforms (Samsung) where peripherals are connected
> to more than one DMA controller, and either DMA controller can be used -
> I'm told by Jassi that there's reasons why you'd want to select one or
> other as the target at runtime.

How common is that? If there are only a few drivers that have this
requirement, we could have this represented in the driver binding, by
listing multiple channels and giving the device the choice.

A possible way to deal with this is to list all the alternatives
in the device tree and using the dma-names property to name them,
giving the same name to those that we need to pick one of.

> I think instead, rather than trying to fix this now, we persist with what
> we have, but organize an effort to clean up and restructure the DMA engine
> code so that:
> 
> (a) things like the Samsung, and ARM board oddities can be easily dealt
>  with in a driver independent manner.
> (b) get rid of all the duplicated functionality between each different
>  DMA engine implementation, separating this out into core code, and
>  simplifying the drivers.

At that point, we definitely need to involve the dmaenigne maintainers
who have unfortunately not been on Cc for the whole discussion so
far.

I actually hope that a lot of the issues go away if we come up with
good device tree bindings that can cover the existing corner cases
while providing a simple interface for device drivers to use.

> The big problem I see is that if we try to represent the existing
> solution in DT, we're going to get locked into that way of doing things
> and then any major restructuring of the DMA engine stuff will become an
> impossibility - especially if we start specifying things by DMA request
> signal numbers on DMA engines.

Note that Thomas Abraham has already introduced a DT support for
pl330, which is sadly seems to be anything but generic.

	Arnd

WARNING: multiple messages have this Message-ID (diff)
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] of: Add generic device tree DMA helpers
Date: Mon, 19 Mar 2012 16:11:58 +0000	[thread overview]
Message-ID: <201203191611.59064.arnd@arndb.de> (raw)
In-Reply-To: <20120319153334.GF16389@n2100.arm.linux.org.uk>

On Monday 19 March 2012, Russell King - ARM Linux wrote:
> Firstly, define what you mean by "the DMA parameters".  Things like burst
> size, register width, register address?  That should all be known by the
> peripheral driver and not be encoded into DT in any way - and this
> information should be passed to the DMA engine driver for the well defined
> API for that purpose.

This seems to be different for each controller, I tried to use
a generic term here. In case of stedma40 (which is probably the most
complex one today), it would be this structure:

struct stedma40_chan_cfg {
        enum stedma40_xfer_dir                   dir;
        bool                                     high_priority;
        bool                                     realtime;
        enum stedma40_mode                       mode;
        enum stedma40_mode_opt                   mode_opt;
        int                                      src_dev_type;
        int                                      dst_dev_type;
        struct stedma40_half_channel_info        src_info;
        struct stedma40_half_channel_info        dst_info;

        bool                                     use_fixed_channel; 
        int                                      phy_channel;
};

All these fields are set up by the platform code today, not by
the device driver, so it would be logical to have them represented
in the device tree, though some of the fields might turn out to
be in the wrong place already.

> Secondly, there are platforms (Samsung) where peripherals are connected
> to more than one DMA controller, and either DMA controller can be used -
> I'm told by Jassi that there's reasons why you'd want to select one or
> other as the target at runtime.

How common is that? If there are only a few drivers that have this
requirement, we could have this represented in the driver binding, by
listing multiple channels and giving the device the choice.

A possible way to deal with this is to list all the alternatives
in the device tree and using the dma-names property to name them,
giving the same name to those that we need to pick one of.

> I think instead, rather than trying to fix this now, we persist with what
> we have, but organize an effort to clean up and restructure the DMA engine
> code so that:
> 
> (a) things like the Samsung, and ARM board oddities can be easily dealt
>  with in a driver independent manner.
> (b) get rid of all the duplicated functionality between each different
>  DMA engine implementation, separating this out into core code, and
>  simplifying the drivers.

At that point, we definitely need to involve the dmaenigne maintainers
who have unfortunately not been on Cc for the whole discussion so
far.

I actually hope that a lot of the issues go away if we come up with
good device tree bindings that can cover the existing corner cases
while providing a simple interface for device drivers to use.

> The big problem I see is that if we try to represent the existing
> solution in DT, we're going to get locked into that way of doing things
> and then any major restructuring of the DMA engine stuff will become an
> impossibility - especially if we start specifying things by DMA request
> signal numbers on DMA engines.

Note that Thomas Abraham has already introduced a DT support for
pl330, which is sadly seems to be anything but generic.

	Arnd

  reply	other threads:[~2012-03-19 16:12 UTC|newest]

Thread overview: 160+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-27 17:29 [RFC PATCH 1/2] of: Add generic device tree DMA helpers Cousson, Benoit
2012-01-27 17:29 ` Cousson, Benoit
2012-01-27 18:13 ` Stephen Warren
2012-01-27 18:13   ` Stephen Warren
2012-01-27 20:36   ` Cousson, Benoit
2012-01-27 20:36     ` Cousson, Benoit
2012-01-28 18:12     ` Grant Likely
2012-01-28 18:12       ` Grant Likely
2012-01-28 18:06 ` Grant Likely
2012-01-28 18:06   ` Grant Likely
2012-01-31 21:26   ` Cousson, Benoit
2012-01-31 21:26     ` Cousson, Benoit
2012-02-02  4:52     ` Grant Likely
2012-02-02  4:52       ` Grant Likely
2012-01-31 23:09   ` Russell King - ARM Linux
2012-01-31 23:09     ` Russell King - ARM Linux
2012-02-01 10:50     ` Cousson, Benoit
2012-02-01 10:50       ` Cousson, Benoit
     [not found]       ` <4F2918F6.9040100-l0cyMroinI0@public.gmane.org>
2012-02-02  8:45         ` Russell King - ARM Linux
2012-02-02  8:45           ` Russell King - ARM Linux
     [not found]           ` <20120202084539.GC1275-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2012-02-02  8:54             ` Cousson, Benoit
2012-02-02  8:54               ` Cousson, Benoit
2012-02-22 10:59 ` Nicolas Ferre
2012-02-22 10:59   ` Nicolas Ferre
2012-02-23 10:03   ` Cousson, Benoit
2012-02-23 10:03     ` Cousson, Benoit
2012-02-23 15:51     ` Nicolas Ferre
2012-02-23 15:51       ` Nicolas Ferre
2012-02-23 15:57       ` Cousson, Benoit
2012-02-23 15:57         ` Cousson, Benoit
     [not found]         ` <4F4661DE.90704-l0cyMroinI0@public.gmane.org>
2012-02-27 13:09           ` Nicolas Ferre
2012-02-27 13:09             ` Nicolas Ferre
2012-02-27 14:22             ` Cousson, Benoit
2012-02-27 14:22               ` Cousson, Benoit
2012-02-27 17:28               ` Nicolas Ferre
2012-02-27 17:28                 ` Nicolas Ferre
2012-02-29 14:54 ` [RFC PATCH] of: DMA helpers: manage generic requests specification Nicolas Ferre
2012-02-29 14:54   ` Nicolas Ferre
2012-02-29 20:54   ` Stephen Warren
2012-02-29 20:54     ` Stephen Warren
2012-03-05 13:14     ` Cousson, Benoit
2012-03-05 13:14       ` Cousson, Benoit
2012-03-05 18:30       ` Stephen Warren
2012-03-05 18:30         ` Stephen Warren
2012-03-05 19:57         ` Russell King - ARM Linux
2012-03-05 19:57           ` Russell King - ARM Linux
2012-03-05 10:55   ` Cousson, Benoit
2012-03-05 10:55     ` Cousson, Benoit
2012-03-05 15:36   ` Grant Likely
2012-03-05 15:36     ` Grant Likely
2012-03-14 17:47     ` Nicolas Ferre
2012-03-14 17:47       ` Nicolas Ferre
2012-03-14 18:16       ` Stephen Warren
2012-03-14 18:16         ` Stephen Warren
     [not found] ` <4F22DEF2.5000807-l0cyMroinI0@public.gmane.org>
2012-03-15  8:38   ` [PATCH] of: Add generic device tree DMA helpers Nicolas Ferre
2012-03-15  8:38     ` Nicolas Ferre
2012-03-15  9:22     ` Arnd Bergmann
2012-03-15  9:22       ` Arnd Bergmann
2012-03-15  9:26       ` Russell King - ARM Linux
2012-03-15  9:26         ` Russell King - ARM Linux
2012-03-15 10:09         ` Arnd Bergmann
2012-03-15 10:09           ` Arnd Bergmann
2012-03-17  9:42         ` Grant Likely
2012-03-17  9:42           ` Grant Likely
2012-03-17 16:03           ` Arnd Bergmann
2012-03-17 16:03             ` Arnd Bergmann
2012-03-18  9:08             ` Grant Likely
2012-03-18  9:08               ` Grant Likely
2012-03-15 10:27       ` Thierry Reding
2012-03-15 10:27         ` Thierry Reding
2012-03-17 10:47         ` Grant Likely
2012-03-17 10:47           ` Grant Likely
2012-03-18  9:22           ` Thierry Reding
2012-03-18  9:22             ` Thierry Reding
2012-03-18 15:10             ` Arnd Bergmann
2012-03-18 15:10               ` Arnd Bergmann
2012-03-18 18:22             ` Grant Likely
2012-03-18 18:22               ` Grant Likely
2012-03-19 13:02           ` Mark Brown
2012-03-19 13:02             ` Mark Brown
2012-03-19 15:01             ` Arnd Bergmann
2012-03-19 15:01               ` Arnd Bergmann
2012-03-19 15:07               ` Stephen Warren
2012-03-19 15:07                 ` Stephen Warren
2012-03-19 15:45                 ` Arnd Bergmann
2012-03-19 15:45                   ` Arnd Bergmann
     [not found]                   ` <201203191545.40933.arnd-r2nGTMty4D4@public.gmane.org>
2012-03-19 16:54                     ` Stephen Warren
2012-03-19 16:54                       ` Stephen Warren
2012-03-15 16:30       ` Cousson, Benoit
2012-03-15 16:30         ` Cousson, Benoit
2012-03-15 19:57         ` Russell King - ARM Linux
2012-03-15 19:57           ` Russell King - ARM Linux
     [not found]           ` <20120315195753.GA2842-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2012-03-15 20:41             ` Arnd Bergmann
2012-03-15 20:41               ` Arnd Bergmann
2012-03-15 21:39               ` Cousson, Benoit
2012-03-15 21:39                 ` Cousson, Benoit
2012-03-15 21:55                 ` Russell King - ARM Linux
2012-03-15 21:55                   ` Russell King - ARM Linux
2012-03-16  9:56                   ` Arnd Bergmann
2012-03-16  9:56                     ` Arnd Bergmann
2012-03-20 14:02                 ` Matt Porter
2012-03-20 14:02                   ` Matt Porter
2012-03-15 23:45           ` Nicolas Pitre
2012-03-15 23:45             ` Nicolas Pitre
2012-03-16 10:03     ` Arnd Bergmann
2012-03-16 10:03       ` Arnd Bergmann
2012-03-16 11:19       ` Cousson, Benoit
2012-03-16 11:19         ` Cousson, Benoit
2012-03-16 12:04         ` Arnd Bergmann
2012-03-16 12:04           ` Arnd Bergmann
2012-03-16 13:28           ` Cousson, Benoit
2012-03-16 13:28             ` Cousson, Benoit
2012-03-16 13:36             ` Nicolas Ferre
2012-03-16 13:36               ` Nicolas Ferre
2012-03-17  9:40     ` Grant Likely
2012-03-17  9:40       ` Grant Likely
2012-03-18 20:13       ` Arnd Bergmann
2012-03-18 20:13         ` Arnd Bergmann
2012-03-18 20:44         ` Grant Likely
2012-03-18 20:44           ` Grant Likely
2012-03-18 21:58           ` Arnd Bergmann
2012-03-18 21:58             ` Arnd Bergmann
2012-03-18 22:12             ` Arnd Bergmann
2012-03-18 22:12               ` Arnd Bergmann
2012-03-19 13:37         ` Nicolas Ferre
2012-03-19 13:37           ` Nicolas Ferre
2012-03-19 15:20           ` Russell King - ARM Linux
2012-03-19 15:20             ` Russell King - ARM Linux
2012-03-19 15:58             ` Cousson, Benoit
2012-03-19 15:58               ` Cousson, Benoit
2012-03-19 13:30       ` Nicolas Ferre
2012-03-19 13:30         ` Nicolas Ferre
2012-03-19 14:06         ` Arnd Bergmann
2012-03-19 14:06           ` Arnd Bergmann
2012-03-19 15:33           ` Russell King - ARM Linux
2012-03-19 15:33             ` Russell King - ARM Linux
2012-03-19 16:11             ` Arnd Bergmann [this message]
2012-03-19 16:11               ` Arnd Bergmann
2012-03-19 18:06               ` Jassi Brar
2012-03-19 18:06                 ` Jassi Brar
2012-03-19 16:31             ` Nicolas Ferre
2012-03-19 16:31               ` Nicolas Ferre
2012-03-19 17:49               ` Cousson, Benoit
2012-03-19 17:49                 ` Cousson, Benoit
2012-03-19 14:45         ` Grant Likely
2012-03-19 14:45           ` Grant Likely
2012-03-20 14:54           ` Nicolas Ferre
2012-03-20 14:54             ` Nicolas Ferre
2012-03-20 10:13     ` [PATCH v2 1/2] " Nicolas Ferre
2012-03-20 10:13       ` Nicolas Ferre
2012-03-20 10:13       ` [PATCH 2/2] of: selftest/dma: Add selftest for new DT DMA request helpers Nicolas Ferre
2012-03-20 10:13         ` Nicolas Ferre
2012-03-20 14:16         ` Grant Likely
2012-03-20 14:16           ` Grant Likely
2012-03-20 10:17       ` [PATCH] of: dma/fixup Nicolas Ferre
2012-03-20 10:17         ` Nicolas Ferre
     [not found]       ` <6b5dc1fadfd03a48093338b6981c0a7ae7662212.1332237596.git.nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2012-03-20 13:03         ` [PATCH v2 1/2] of: Add generic device tree DMA helpers Arnd Bergmann
2012-03-20 13:03           ` Arnd Bergmann
2012-03-20 15:38       ` Stephen Warren
2012-03-20 15:38         ` Stephen Warren

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=201203191611.59064.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=b-cousson@ti.com \
    --cc=dan.j.williams@intel.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@secretlab.ca \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=nicolas.ferre@atmel.com \
    --cc=rob.herring@calxeda.com \
    --cc=swarren@nvidia.com \
    --cc=thomas.abraham@linaro.org \
    --cc=vinod.koul@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.