From: zhangfei.gao@gmail.com (zhangfei gao)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V3 1/2] of: Add generic device tree DMA helpers
Date: Thu, 26 Jul 2012 12:56:02 +0800 [thread overview]
Message-ID: <CAMj5BkjbZsL_vSCfLsZ6UsdPrAHeQ+FwBFYbUM_L1w3wqCLuMQ@mail.gmail.com> (raw)
In-Reply-To: <1342756850.1726.74.camel@vkoul-udesk3>
On Fri, Jul 20, 2012 at 12:00 PM, Vinod Koul <vinod.koul@linux.intel.com> wrote:
> On Tue, 2012-07-17 at 19:24 +0000, Arnd Bergmann wrote:
>> On Friday 13 July 2012, Vinod Koul wrote:
>> > > Do you mean there must be a global table, or are you ok with putting
>> > > the information about a channel into the device that uses the channel,
>> > > as we do for most other subsystems (IRQ, GPIO, pinctrl, ...).
>> > > If not, what is the problem with that approach?
>> >
>> > Today, we simple ask, "give me dma channel with DMA_SLAVE capability".
>> >
>> > If we change it to "give me dma channel which suits my need" and have
>> > additional information in dmaengine to handle this request effectively.
>> >
>> > What that would mean is
>> > a) DMA channel either knows which channel to provide, Or
>> > b) Additional arguments provided to dmaengine API to help it find out
>> > which channel to provide.
>> >
>> > It would be good to have client ask for a specific channel. But in order
>> > to build generic clients, we face a problem that clients may not know
>> > how they mapped to dmac by SoC designer. Or the mux maybe entirely
>> > flexible on which channel.
>> >
>> > If we add this as DT property (which I assume should be platform
>> > specific), then client will know which channel to request.
>> > It can have two levels, dmac and channel. In case mux is flexible enough
>> > then client gets a channel and program the mux for this mapping.
>> >
>> > I think this is the most simplistic solution I have for this, thoughts?
>>
>> I think we're basically on the same page. Let's see if I have covered
>> all the cases we discussed so far. I've tried to update the binding that
>> Jon sent out initially with everything we've discussed, so please review
>> this to see if I understood you correctly.
> I think this looks fine to me. Few comments below on client side
>>
>> Arnd
>>
>>
>> * Generic DMA Controller and DMA request bindings
>>
>> Generic binding to provide a way for a driver using DMA Engine to retrieve the
>> DMA request or channel information that goes from a hardware device to a DMA
>> controller.
>>
>> * DMA controller
>>
>> Required property:
>> - #dma-cells: Number elements to describe DMA channel information. Must be
>> at least 2, allowing a phandle and a flags cell, but usually
>> is larger so a client can also specify a request or channel
>> number and/or some configuration.
>>
>> Optional properties:
>> - #dma-channels: Number of DMA channels supported by the controller.
>> - #dma-requests: Number of DMA requests signals supported by the controller.
>>
>> Example:
>>
>> sdma: dmaengine at 48000000 {
>> compatible = "ti,omap4-sdma"
>> reg = <0x48000000 0x1000>;
>> interrupts = <4>;
>> #dma-cells = <3>;
>> #dma-channels = <32>;
>> #dma-requests = <127>;
>> };
>>
>>
>> * DMA client
>>
>> Client drivers should specify the DMA property using a phandle to the controller
>> followed by the number of DMA request/channel and the transfer type of the
>> channel (eg. device-to-memory, memory-to-device, memory-to-memory, etc).
>>
>> Required property:
>> dmas: list of one or more dma specifiers, each consisting of
>> - phandle pointing to dma controller node
>> - flags word, a bit map that can hold these flags
>> * 0x00000001 channel can be used for transfer from device
>> * 0x00000002 channel can be user for transfer to device
> Is this for identifying which channel is for TX and RX? If not I am not
> sure I understood it well
>
>> - zero or more cells in a format specific to the the dma controller
>> node listed in the phandle. This typically contains a dma request
>> line number or a channel number, but can contain any data that
>> is used required for configuring a channel.
How about extend struct dma_slave_config, adding one member of
"request_line", if
"request line" is must config in most platform.
struct dma_slave_config {
~
u32 request_line;
}
The advantage is request_line can be get directly from
dmaengine_slave_config regardless of DT.
>>
>> Optional property:
>> dma-names: when present, this shall contain one identifier string
>> for each dma specifier in the dmas property. The specific strings
>> that can be used are defined in the binding of the DMA client
>> device. When multiple dma specifiers can be used as alternatives,
>> the dma-names for those dma specifiers must be identical.
>>
>> Any dma specifiers that have identical flags and identical dma-names
>> (if present) shall refer to different dma controllers that can be
>> used as alternatives, e.g. when a request line is connected to
>> multiple dma controllers. If multiple dma specifiers are listed that
>> have the same flags but refer to different functional channels,
>> the dma-names property must be used to distinguish them.
>>
>> Examples:
>>
>> 1. One DMA write channel, one DMA read/write channel:
>>
>> i2c1: i2c at 1 {
>> ...
>> dmas = <&sdma 2 1 &sdma 3 2>;
>> ...
>> };
>>
>> 2. A single read-write channel with two alternative dma controllers
>> providing it:
>>
>> dmas = <&dma0 3 5
>> &dma1 3 7
>> &dma2 3 2>;
>>
>> 3. A device with three channels, one of which has two alternatives:
>>
>> dmas = <&dma0 1 4 /* data read */
>> &dma0 2 6 /* data write */
>> &dma1 1 0 /* error read */
>> &dma2 1 0>; /* alternative error read */
>> dma-names = "data", "data", "error", "error";
>>
>> 4. A dma controller requiring complex configuration:
>>
>> dma: dmaengine at 48000000 {
>> compatible = "foo,foo-sdma"
>> reg = <0x48000000 0x1000>;
>> interrupts = <4>;
>> #dma-cells = <6>; /* phandle, flag, request, channel,
>> input-width, output-width */
> Why would we want the widths to be here?
> Assuming a DMA from System memory to a peripheral, source width should
> be system memory width and destination the peripheral width. IMO these
> should not be in dma property even if we need these
>> #dma-channels = <32>;
>> #dma-requests = <127>;
>> };
>>
>> mmc at 49000000 {
>> ...
>> dmas = <&dma 1 /* read */
>> 2 /* request line */
>> 5 /* channel */
>> 16 /* 16 bit bus width on read */
>> 8> /* 8 bit bus width on write */
>> <&dma 2 /* write */
>> 3 /* request line */
>> 6 /* channel */
>> 8 /* 8 bit bus width on read */
>> 16> /* 16 bit bus width on write */
> >From this looks like flag is for TX/RX, so maybe i read correct :)
>
> --
> ~Vinod
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2012-07-26 4:56 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
2012-05-03 23:25 ` Russell King - ARM Linux
2012-05-04 12:39 ` Arnd Bergmann
2012-05-04 15:06 ` Jon Hunter
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
2012-06-15 8:40 ` Arnd Bergmann
2012-06-22 22:52 ` Jon Hunter
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
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 [this message]
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
2012-07-06 15:28 ` Arnd Bergmann
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
2012-06-15 16:11 ` Mitch Bradley
2012-06-16 6:56 ` Arnd Bergmann
2012-06-21 11:21 ` Guennadi Liakhovetski
2012-06-21 14:56 ` Arnd Bergmann
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=CAMj5BkjbZsL_vSCfLsZ6UsdPrAHeQ+FwBFYbUM_L1w3wqCLuMQ@mail.gmail.com \
--to=zhangfei.gao@gmail.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).