devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jon Hunter <jon-hunter@ti.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Stephen Warren <swarren@wwwdotorg.org>,
	Jassi Brar <jaswinder.singh@linaro.org>,
	Stephen Warren <swarren@nvidia.com>,
	Benoit Cousson <b-cousson@ti.com>,
	device-tree <devicetree-discuss@lists.ozlabs.org>,
	Nicolas Ferre <nicolas.ferre@atmel.com>,
	Rob Herring <rob.herring@calxeda.com>,
	Grant Likely <grant.likely@secretlab.ca>,
	Russell King <linux@arm.linux.org.uk>,
	linux-omap <linux-omap@vger.kernel.org>,
	linux-arm <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH V3 1/2] of: Add generic device tree DMA helpers
Date: Thu, 14 Jun 2012 10:39:16 -0500	[thread overview]
Message-ID: <4FDA05A4.5090301@ti.com> (raw)
In-Reply-To: <201206141148.20371.arnd@arndb.de>


On 06/14/2012 06:48 AM, Arnd Bergmann wrote:
> On Wednesday 13 June 2012, Jon Hunter wrote:
> 
>>> As I said previously, I think just encoding the direction but not
>>> the client specific ID (meaning we would have to disambiguate
>>> the more complex cases that Stephen mentioned using a dma-names
>>> property) would be the best because it keeps the common case simple,
>>> but I could live with other things going in there too.
>>
>> Ok, so you are saying that there are some DMA controllers where there is
>> no channel/request ID and only a direction is needed? So an even simpler
>> case than what I had imagined.
> 
> No, that was not the case I was thinking about.

Ok, good because that would be the most simple dma controller I have
heard about ;-)

>> So in that case, I don't see why the first cell after the phandle could
>> not be an index which could be either a direction or request-id and then
>> the next cell after that be a secondary match variable.
>>
>> So simple case with just a index (either req-id or direction) ...
>>
>> dmas = <&dmac0 index>
>>
>> More complex case ...
>>
>> dmas = <&dmac0 index match>
>>
>> For example, for OMAP index = req-id and match = direction ...
>>
>> dmas = <&dmac0 req-id direction>
>>
>> Or am I way off the page?
> 
> The intention was instead to remove the need for the /index/ in those
> cases, because having a client-specific index in here makes it inconsistent
> with other similar bindings (reg, interrupts, gpios, ...) that people
> are familiar with. They use an implicit index by counting the
> fields in the respective properties.

So maybe "index" was not the right term to use here. What I meant was
that this is really the req/chan-id associated with this device. It is
not an arbitrary index that in turn gets resolved into the req-id. So in
other words, just like gpio where you have the gpio number, here you
have the dma req-id.

> The existing method we have for avoiding index numbers is to use
> named fields, like
> 
> 	dmas = <&dmac0 matchA>, <dmac1 matchB>, <dmac2 matchC>;
> 	dma-names = "rx", "rx", "tx";
> 
> This is similar to how we use named interrupt and mmio resources, but
> it requires that we always request the dma lines by name, which is
> slightly more complex than we might want it to be.

Ok, but how do you get the req-id from the above binding? Doesn't it
need to be stored there somewhere even for the most simplest case? Or
are you saying that in this case you are just returning a name and the
dma driver resolves that into a req-id?

> Because the vast majority of cases just use a single channel, or one
> channel per direction, my idea was to encode the direction in the
> dmas property, which lets us request a dma channel by direction from
> the driver side, without explicitly encoding the name.

Yes, thats fine and so the direction is really the match criteria in
this case.

> This would let us handle the following cases very easily:
> 
> 1. one read-write channel
> 
> 	dmas = <&dmac 0x3 match>;

Where 0x3 is the req-id? Just to confirm ;-)

Why not have match after the phandle to be consistent with the simple
example using name fields above?

> 2. a choice of two read-write channels:
> 
> 	dmas = <&dmacA 0x3 matchA>, <&dmacB 0x3 matchB>;
> 
> 3. one read-channel, one write channel:
> 
> 	dmas = <&dmac 0x1 match-read>, <&dmac 0x2 match-write>;
> 
> 4. a choice of two read channels and one write channel:
> 
> 	dmas = <&dmacA 0x1 match-readA>, <&dmacA 0x2 match-write> 
> 			<&dmacB match-readB>;
> 
> And only the cases where we have more multiple channels that differ
> in more aspects would require named properties:
> 
> 5. two different channels
> 
> 	dmas = <&dmac 0x3 match-rwdata>, <&dmac 0x1 match-status>;
> 	dma-names = "rwdata", "status";
> 
> 6. same as 5, but with a choice of channels:
> 
> 	dmas = <&dmacA 0x3 match-rwdataA>, <&dmacA 0x1 match-status>;
> 		<dmacB 0x3 match-rwdataB>;
> 	dma-names = "rwdata", "status", "rwdata";
> 
> 
> With a definition like that, we can implement a very simple device
> driver interface for the common cases, and a slightly more complex
> one for the more complex cases:
> 
> 1. chan = of_dma_request_channel(dev->of_node, 0);
> 2. chan = of_dma_request_channel(dev->of_node, 0);
> 3. rxchan = of_dma_request_channel(dev->of_node, DMA_MEM_TO_DEV);
>    txchan = of_dma_request_channel(dev->of_node, DMA_DEV_TO_MEM);
> 4. rxchan = of_dma_request_channel(dev->of_node, DMA_MEM_TO_DEV);
>    txchan = of_dma_request_channel(dev->of_node, DMA_DEV_TO_MEM);
> 5. chan = of_dma_request_named_channel(dev->of_node, "rwdata", 0);
>    auxchan = of_dma_request_named_channel(dev->of_node, "status", DMA_DEV_TO_MEM);
> 6. chan = of_dma_request_named_channel(dev->of_node, "rwdata", 0);
>    auxchan = of_dma_request_named_channel(dev->of_node, "status", DMA_DEV_TO_MEM);

Yes, that looks good to me.

Cheers
Jon

  reply	other threads:[~2012-06-14 15:39 UTC|newest]

Thread overview: 129+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-30 21:17 [PATCH V3 1/2] of: Add generic device tree DMA helpers Jon Hunter
2012-05-03 22:26 ` Stephen Warren
     [not found]   ` <4FA30604.1030401-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-05-03 23:25     ` Russell King - ARM Linux
2012-05-04 12:39     ` Arnd Bergmann
2012-05-04 15:06   ` Jon Hunter
     [not found]     ` <4FA3F08D.7030603-l0cyMroinI0@public.gmane.org>
2012-05-04 15:14       ` Russell King - ARM Linux
2012-05-04 18:21     ` Stephen Warren
2012-05-04 19:19       ` Jon Hunter
2012-05-04  6:56 ` Jassi Brar
2012-05-04 15:17   ` Jon Hunter
2012-05-04 19:01     ` Jassi Brar
2012-05-04 19:23       ` Arnd Bergmann
2012-05-05 17:10         ` Jassi Brar
2012-05-07 15:53           ` Stephen Warren
2012-05-07 17:19             ` Jassi Brar
2012-05-08 16:35               ` Stephen Warren
2012-05-08 19:09                 ` Jassi Brar
2012-05-09 12:30                   ` Arnd Bergmann
2012-05-09 19:10                   ` Stephen Warren
2012-05-09 21:38                     ` Jassi Brar
2012-05-10 17:00                       ` Stephen Warren
2012-05-10 19:59                         ` Jassi Brar
2012-05-11 19:28                           ` Stephen Warren
2012-05-11 21:06                             ` Jassi Brar
2012-05-11 23:51                               ` Stephen Warren
2012-05-12 13:40                                 ` Jassi Brar
2012-05-16  1:05                                   ` Jon Hunter
2012-05-17 13:18                         ` Russell King - ARM Linux
2012-05-07 17:21             ` Arnd Bergmann
2012-05-16  1:11       ` Jon Hunter
2012-05-16 12:37         ` Jassi Brar
2012-05-16 13:15           ` Jon Hunter
2012-05-16 15:44             ` Stephen Warren
2012-05-16 16:04               ` Jon Hunter
2012-05-16 16:01             ` Jon Hunter
2012-05-16 16:15               ` Stephen Warren
2012-05-16 16:22                 ` Jassi Brar
2012-05-16 17:09                   ` Jon Hunter
2012-05-16 19:42                   ` Arnd Bergmann
2012-05-16 21:16                     ` Jassi Brar
2012-05-17 19:32                       ` Stephen Warren
2012-05-18 17:12                         ` Jassi Brar
2012-05-18 21:04                       ` Arnd Bergmann
2012-05-16 23:59                     ` Stephen Warren
2012-05-17  4:05                       ` Jassi Brar
2012-05-18 20:49                       ` Arnd Bergmann
2012-05-18 21:07                         ` Stephen Warren
2012-05-18 21:43                           ` Arnd Bergmann
2012-05-18 22:20                             ` Stephen Warren
2012-05-19  8:44                               ` Arnd Bergmann
2012-05-21 17:33                                 ` Stephen Warren
2012-05-21 18:18                                   ` Arnd Bergmann
2012-05-21 20:32                                     ` Stephen Warren
2012-06-08 19:04                                       ` Jon Hunter
2012-06-09  0:04                                         ` Arnd Bergmann
2012-06-13 22:32                                           ` Jon Hunter
2012-06-14  4:45                                             ` Jassi Brar
2012-06-14 11:48                                             ` Arnd Bergmann
2012-06-14 15:39                                               ` Jon Hunter [this message]
2012-06-15  8:40                                                 ` Arnd Bergmann
2012-06-22 22:52                                               ` Jon Hunter
     [not found]                                                 ` <4FE4F718.3080204-l0cyMroinI0@public.gmane.org>
2012-06-22 23:12                                                   ` Russell King - ARM Linux
2012-06-25 16:51                                                     ` Jon Hunter
2012-06-25 18:04                                                       ` Vinod Koul
2012-06-25 20:30                                                         ` Arnd Bergmann
2012-06-26  9:40                                                           ` Vinod Koul
2012-06-26 14:59                                                             ` Arnd Bergmann
2012-06-26 17:50                                                               ` Vinod Koul
2012-06-26 20:27                                                                 ` Arnd Bergmann
2012-06-27 13:45                                                                   ` Vinod Koul
2012-06-27 15:20                                                                     ` Arnd Bergmann
2012-07-13  6:45                                                                       ` Vinod Koul
2012-07-13 21:52                                                                         ` Guennadi Liakhovetski
2012-07-17 19:24                                                                         ` Arnd Bergmann
2012-07-20  4:00                                                                           ` Vinod Koul
2012-07-20  8:39                                                                             ` Arnd Bergmann
2012-07-20  9:37                                                                               ` Vinod Koul
2012-07-24 19:07                                                                                 ` Jon Hunter
2012-07-24 19:27                                                                                   ` Arnd Bergmann
2012-07-26  6:42                                                                                   ` Vinod Koul
2012-07-26  7:14                                                                                     ` Arnd Bergmann
2012-07-26 11:28                                                                                       ` Vinod Koul
2012-07-26 15:53                                                                                         ` Jon Hunter
     [not found]                                                                                           ` <5011680A.6040400-l0cyMroinI0@public.gmane.org>
2012-07-31 11:06                                                                                             ` Vinod Koul
2012-07-26 17:43                                                                                     ` Jon Hunter
2012-07-31 11:12                                                                                       ` Vinod Koul
2012-08-01 20:43                                                                                         ` Jon Hunter
2012-08-03  9:55                                                                                           ` Vinod Koul
2012-07-20  9:08                                                                             ` Robert Jarzmik
2012-07-20  9:41                                                                               ` Vinod Koul
2012-07-26  4:56                                                                             ` zhangfei gao
2012-07-23 21:29                                                                           ` Stephen Warren
2012-07-24  7:19                                                                             ` Arnd Bergmann
2012-07-24 16:04                                                                               ` Stephen Warren
2012-07-24 18:55                                                                                 ` Arnd Bergmann
2012-07-24 12:54                                                                             ` Sergei Shtylyov
2012-07-06 11:36                                                           ` Guennadi Liakhovetski
     [not found]                                                             ` <Pine.LNX.4.64.1207061315470.29809-0199iw4Nj15frtckUFj5Ag@public.gmane.org>
2012-07-06 15:28                                                               ` Arnd Bergmann
     [not found]                                                                 ` <201207061528.58291.arnd-r2nGTMty4D4@public.gmane.org>
2012-07-06 15:43                                                                   ` Guennadi Liakhovetski
2012-07-06 17:31                                                                     ` Arnd Bergmann
2012-07-06 21:01                                                                     ` Russell King - ARM Linux
2012-07-06 20:57                                                               ` Russell King - ARM Linux
2012-07-06 22:49                                                                 ` Guennadi Liakhovetski
2012-07-13  6:51                                                             ` Vinod Koul
2012-06-14 15:17                                           ` Guennadi Liakhovetski
2012-06-14 21:52                                             ` Jon Hunter
2012-06-15  8:41                                               ` Guennadi Liakhovetski
2012-06-15  9:00                                               ` Arnd Bergmann
2012-06-15  9:18                                                 ` Guennadi Liakhovetski
2012-06-15 11:27                                                   ` Arnd Bergmann
     [not found]                                                     ` <201206151127.24386.arnd-r2nGTMty4D4@public.gmane.org>
2012-06-15 16:11                                                       ` Mitch Bradley
     [not found]                                                         ` <4FDB5ECF.3000701-D5eQfiDGL7eakBO8gow8eQ@public.gmane.org>
2012-06-16  6:56                                                           ` Arnd Bergmann
2012-06-21 11:21                                                     ` Guennadi Liakhovetski
2012-06-21 14:56                                                       ` Arnd Bergmann
     [not found]                     ` <201205161942.20296.arnd-r2nGTMty4D4@public.gmane.org>
2012-05-17 13:22                       ` Russell King - ARM Linux
2012-05-17 13:52                         ` Mark Brown
2012-05-17 14:16                           ` Russell King - ARM Linux
2012-05-16 16:16               ` Jassi Brar
2012-05-16 17:12                 ` Jon Hunter
2012-05-16 17:24                   ` Jassi Brar
2012-05-16 17:37                     ` Jon Hunter
2012-05-16 17:46                       ` Stephen Warren
2012-05-16 18:03                         ` Jon Hunter
2012-05-04 15:22   ` Jon Hunter
2012-05-04 15:56 ` Arnd Bergmann
2012-05-04 17:19   ` Jon Hunter
2012-05-04 19:06     ` Arnd Bergmann
2012-05-04 19:26       ` Jon Hunter
2012-05-04 18:30   ` 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=4FDA05A4.5090301@ti.com \
    --to=jon-hunter@ti.com \
    --cc=arnd@arndb.de \
    --cc=b-cousson@ti.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@secretlab.ca \
    --cc=jaswinder.singh@linaro.org \
    --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=swarren@wwwdotorg.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).