Re: [PATCH V6 1/2] of: Add generic device tree DMA helpers
On Tuesday 18 September 2012, Mitch Bradley wrote: There is a delicious irony here with respect to Shark. Shark has real Open Firmware. It's the platform that I used for the first OFW port to ARM. We (the Shark design team) had a version of NetBSD that would run on Shark without any native drivers, calling into the Open Firmware drivers. It was very useful for bringup. Very interesting, thanks for sharing this bit of history. Are you aware of other ARM systems using open firmware that we still support in Linux (besides the XO-1.75)? Is there ever a point when old architectures leave the Linux tree, or will people have to see grep hits from them until the end of time? As long as someone is interested in keeping an architecture or driver alive, it stays. If something is causing problems and we have reason to assume it will never be used again with current kernels, we toss them out. Russell has recently removed support for ARMv3 CPUs, but some of the StrongARM targets (especially SA-1100) are still being actively used, so the CPU support is not going away any time soon. If you have a bunch of Shark machines for testing and would like to port it over to device tree passing from its open firmware, you are definitely welcome ;-) Arnd -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V6 1/2] of: Add generic device tree DMA helpers
On Fri, Sep 14, 2012 at 05:41:56PM -0500, Jon Hunter wrote: ... Typo nits in the binding examples below... Documentation/devicetree/bindings/dma/dma.txt | 81 + drivers/of/Makefile |2 +- drivers/of/dma.c | 219 + include/linux/of_dma.h| 45 + 4 files changed, 346 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/dma/dma.txt create mode 100644 drivers/of/dma.c create mode 100644 include/linux/of_dma.h diff --git a/Documentation/devicetree/bindings/dma/dma.txt b/Documentation/devicetree/bindings/dma/dma.txt new file mode 100644 index 000..a4f59a5 --- /dev/null +++ b/Documentation/devicetree/bindings/dma/dma.txt @@ -0,0 +1,81 @@ +* 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:Must be at least 1. Used to provide DMA controller + specific information. See DMA client binding below for + more details. + +Optional properties: +- #dma-channels: Number of DMA channels supported by the controller. +- #dma-requests: Number of DMA requests signals supported by the + controller. + +Example: + + dma: dma@4800 { + compatible = ti,omap-sdma ; here + reg = 0x4800 0x1000; + interrupts = 0 12 0x4 + 0 13 0x4 + 0 14 0x4 + 0 15 0x4; + #dma-cells = 1; + #dma-channels = 32; + #dma-requests = 127; + }; + + +* DMA client + +Client drivers should specify the DMA property using a phandle to the controller +followed by DMA controller specific data. + +Required property: +- dmas: List of one or more DMA specifiers, each consisting of + - A phandle pointing to DMA controller node + - A number of integer cells, as determined by the + #dma-cells property in the node referenced by phandle + containing DMA controller specific information. 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. +- dma-names: Contains 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. + Multiple DMA specifiers can be used to represent + alternatives and in this case the dma-names for those + DMA specifiers must be identical (see examples). + +Examples: + +1. A device with one DMA read channel, one DMA write channel: + + i2c1: i2c@1 { + ... + dmas = dma 2 /* read channel */ + dma 3;/* write channel */ + dma-names = rx, tx ; here too + ... + }; + +2. A single read-write channel with three alternative DMA controllers: + + dmas = dma1 5 + dma2 7 + dma3 2; + dma-names = rx-tx, rx-tx, rx-tx again ; + +3. A device with three channels, one of which has two alternatives: + + dmas = dma1 2 /* read channel */ + dma1 3 /* write channel */ + dma2 0 /* error read */ + dma3 0; /* alternative error read */ + dma-names = rx, tx, error, error; Patch for these posted separately. -Matt -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V6 1/2] of: Add generic device tree DMA helpers
On Fri, Sep 14, 2012 at 05:41:56PM -0500, Jon Hunter wrote: diff --git a/Documentation/devicetree/bindings/dma/dma.txt b/Documentation/devicetree/bindings/dma/dma.txt new file mode 100644 index 000..a4f59a5 --- /dev/null +++ b/Documentation/devicetree/bindings/dma/dma.txt @@ -0,0 +1,81 @@ +* 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:Must be at least 1. Used to provide DMA controller + specific information. See DMA client binding below for + more details. + +Optional properties: +- #dma-channels: Number of DMA channels supported by the controller. +- #dma-requests: Number of DMA requests signals supported by the + controller. Shouldn't these two optional properties drop the prefix #? By convention adopted from the various original OF/ePAPR/etc specs, the only properties I would expect to see with this prefix are the *-cells cell sizes. A quick search indicates this is the case throughout all the current bindings. -Matt -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V6 1/2] of: Add generic device tree DMA helpers
On 09/14/2012 05:41 PM, Jon Hunter wrote: This is based upon the work by Benoit Cousson [1] and Nicolas Ferre [2] to add some basic helpers to retrieve a DMA controller device_node and the DMA request/channel information. [snip] Reviewed-by: Arnd Bergmann a...@arndb.de Reviewed-by: Nicolas Ferre nicolas.fe...@atmel.com Signed-off-by: Jon Hunter jon-hun...@ti.com --- Documentation/devicetree/bindings/dma/dma.txt | 81 + drivers/of/Makefile |2 +- drivers/of/dma.c | 219 + We've been moving in the direction of not putting subsystem related code under drivers/of, but rather with the subsystem. Although in some cases (i2c), the maintainers didn't want the OF code there. In any case, I guess this will go thru Vinod's tree, so: Acked-by: Rob Herring rob.herr...@calxeda.com -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V6 1/2] of: Add generic device tree DMA helpers
On Wednesday 19 September 2012, Matt Porter wrote: +Optional properties: +- #dma-channels: Number of DMA channels supported by the controller. +- #dma-requests: Number of DMA requests signals supported by the + controller. Shouldn't these two optional properties drop the prefix #? By convention adopted from the various original OF/ePAPR/etc specs, the only properties I would expect to see with this prefix are the *-cells cell sizes. A quick search indicates this is the case throughout all the current bindings. I always assumed that the # prefix is used to indicate that we are counting things instead of listing them. Arnd -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V6 1/2] of: Add generic device tree DMA helpers
On 09/19/2012 09:24 AM, Arnd Bergmann wrote: On Wednesday 19 September 2012, Matt Porter wrote: +Optional properties: +- #dma-channels: Number of DMA channels supported by the controller. +- #dma-requests: Number of DMA requests signals supported by the + controller. Shouldn't these two optional properties drop the prefix #? By convention adopted from the various original OF/ePAPR/etc specs, the only properties I would expect to see with this prefix are the *-cells cell sizes. A quick search indicates this is the case throughout all the current bindings. I always assumed that the # prefix is used to indicate that we are counting things instead of listing them. Lots of properties count things, but don't have a #. nr_gpios or spi chipselect counts for example. I'd say drop the #. Rob -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V6 1/2] of: Add generic device tree DMA helpers
On Wed, Sep 19, 2012 at 09:36:36AM -0500, Rob Herring wrote: On 09/19/2012 09:24 AM, Arnd Bergmann wrote: On Wednesday 19 September 2012, Matt Porter wrote: +Optional properties: +- #dma-channels: Number of DMA channels supported by the controller. +- #dma-requests: Number of DMA requests signals supported by the + controller. Shouldn't these two optional properties drop the prefix #? By convention adopted from the various original OF/ePAPR/etc specs, the only properties I would expect to see with this prefix are the *-cells cell sizes. A quick search indicates this is the case throughout all the current bindings. I always assumed that the # prefix is used to indicate that we are counting things instead of listing them. Lots of properties count things, but don't have a #. nr_gpios or spi chipselect counts for example. I'd say drop the #. Ok, I can drop another trivial patch since I hear Jon is on vacation. Yeah, I grepped all the bindings and it's only ever encountered on cell sizes. There's not even one example of it used as above. -Matt -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V6 1/2] of: Add generic device tree DMA helpers
On 9/19/2012 7:09 PM, Arnd Bergmann wrote: On Tuesday 18 September 2012, Mitch Bradley wrote: There is a delicious irony here with respect to Shark. Shark has real Open Firmware. It's the platform that I used for the first OFW port to ARM. We (the Shark design team) had a version of NetBSD that would run on Shark without any native drivers, calling into the Open Firmware drivers. It was very useful for bringup. Very interesting, thanks for sharing this bit of history. Are you aware of other ARM systems using open firmware that we still support in Linux (besides the XO-1.75)? There is the successor to the XO-1.75 that we working on now. I don't know of any others. We just did a big push to convert a bunch of drivers to DT so we will able to use the same kernel on XO-1.75 and XO-4. The conversion went pretty smoothly, but there is still a fair amount of testing, integration, and coordination to do. When things get a bit less hectic, we'll start submitting patches. Is there ever a point when old architectures leave the Linux tree, or will people have to see grep hits from them until the end of time? As long as someone is interested in keeping an architecture or driver alive, it stays. If something is causing problems and we have reason to assume it will never be used again with current kernels, we toss them out. Russell has recently removed support for ARMv3 CPUs, but some of the StrongARM targets (especially SA-1100) are still being actively used, so the CPU support is not going away any time soon. If you have a bunch of Shark machines for testing and would like to port it over to device tree passing from its open firmware, you are definitely welcome ;-) I'm too busy working on new machines :-) Old machines are an exercise in frustration, due to hardware that stops working over time and insufficient hardware resources to meet the expectations of modern software. Not to mention the financial advantages of doing work that someone cares about ... Arnd -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V6 1/2] of: Add generic device tree DMA helpers
On Wednesday 19 September 2012, Matt Porter wrote: On Wed, Sep 19, 2012 at 09:36:36AM -0500, Rob Herring wrote: On 09/19/2012 09:24 AM, Arnd Bergmann wrote: On Wednesday 19 September 2012, Matt Porter wrote: +Optional properties: +- #dma-channels: Number of DMA channels supported by the controller. +- #dma-requests: Number of DMA requests signals supported by the + controller. Shouldn't these two optional properties drop the prefix #? By convention adopted from the various original OF/ePAPR/etc specs, the only properties I would expect to see with this prefix are the *-cells cell sizes. A quick search indicates this is the case throughout all the current bindings. I always assumed that the # prefix is used to indicate that we are counting things instead of listing them. Lots of properties count things, but don't have a #. nr_gpios or spi chipselect counts for example. I'd say drop the #. Ok, I can drop another trivial patch since I hear Jon is on vacation. Yeah, I grepped all the bindings and it's only ever encountered on cell sizes. There's not even one example of it used as above. Ok, sounds good. Arnd -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V6 1/2] of: Add generic device tree DMA helpers
On 9/19/2012 10:24 PM, Arnd Bergmann wrote: On Wednesday 19 September 2012, Matt Porter wrote: +Optional properties: +- #dma-channels: Number of DMA channels supported by the controller. +- #dma-requests: Number of DMA requests signals supported by the + controller. Shouldn't these two optional properties drop the prefix #? By convention adopted from the various original OF/ePAPR/etc specs, the only properties I would expect to see with this prefix are the *-cells cell sizes. A quick search indicates this is the case throughout all the current bindings. I always assumed that the # prefix is used to indicate that we are counting things instead of listing them. Your assumption is historically correct. It seems that usage has drifted somewhat. Arnd ___ devicetree-discuss mailing list devicetree-disc...@lists.ozlabs.org https://lists.ozlabs.org/listinfo/devicetree-discuss -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V6 1/2] of: Add generic device tree DMA helpers
On Monday 17 September 2012, David Brown wrote: There is also a lot of similarity between the mmci hardware and the msm_sdcc hardware. Enough so, that it is probably better for us to make the mmci driver work with our hardware, rather than trying to keep msm_sdcc going. There is also an MSM nand device that appears to have not made it in. It is heavily dependent on the weird features of the DMA hardware. I don't have any current plans to support this device, since most boards using MSMs these days are using mmc/sd instead of bare NAND. Our DMA hardware is really weird, but should be a bit reasonable. It is also being gradually replaced in newer chips with a different DMA framework. As far as I'm concerned, I consider making our DMA driver(s) use the DMA engine API to be part of getting these platforms working with DT. It is planned, but there are quite a few things that need to be tackled first. Ok, thanks for the information. Arnd -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V6 1/2] of: Add generic device tree DMA helpers
On 9/18/2012 4:42 AM, Arnd Bergmann wrote: On Saturday 15 September 2012, Russell King - ARM Linux wrote: On Fri, Sep 14, 2012 at 05:41:56PM -0500, Jon Hunter wrote: 3. Supporting legacy devices not using DMA Engine These devices present a problem, as there may not be a uniform way to easily support them with regard to device tree. Ideally, these should be migrated to DMA engine. However, if this is not possible, then they should still be able to use this binding, the only constaint imposed by this implementation is that when requesting a DMA channel via of_dma_request_slave_channel(), it will return a type of dma_chan. As far as devices not using DMA engine, the answer is we don't support their specification in the DT model. Note that the legacy OMAP DMA API is scheduled for removal next year, so it's not going to be around that much longer. There are a few platforms using the ISA DMA API (rpc, h720x, shark, footbridge), and I agree that they are unlikely to see OF support, (Warning - historical rambling follows) There is a delicious irony here with respect to Shark. Shark has real Open Firmware. It's the platform that I used for the first OFW port to ARM. We (the Shark design team) had a version of NetBSD that would run on Shark without any native drivers, calling into the Open Firmware drivers. It was very useful for bringup. I wonder when was the last time anyone turned on a Shark? I ran my mail server on one until 8 years ago, when the incoming spam load began to saturate the 10 Mbit Ethernet. Shark had decent computational power, but the I/O system, built around a low cost PC I/O chip, didn't have much bandwidth. Also in that time frame (early 2000s), some of us Shark designers managed to grab a pile of Sharks that HP was going to scrap. (HP had inherited them as part of Compaq, who had acquired them as part of Digital.) We used them as production unit testers for a consumer gadget that we were building. But, alas, even that usage fell to the wayside. I redesigned the tester around an ATSAM7 chip and put the entire test setup into a tiny box. I still have a couple of Sharks, but they haven't been turned on for at least 6 years. Is there ever a point when old architectures leave the Linux tree, or will people have to see grep hits from them until the end of time? although if they did, it wouldn't be unreasonable to encode their DMA channels using the same binding. The other ones that are currently around with their own DMA implementation are bcmring -- platform is going away samsung -- gradually getting moved to dmaengine, already has its own binding that needs to be replaced with this one, so best do it at the same time. tegra -- old dma code gone in 3.7 pxa/mmp -- dmaengine implementation being worked on, should wait for that. msm -- dma implementation only used by two drivers (serial and mmc). Outside of arch/arm, at least sh, cris, unicore32 and blackfin have their own dma APIs based on the ISA interfaces. I don't currently see any of them moving towards DT, but it's definitely possible. Among the above MSM seems to be the most likely candidate to use the binding before moving to DT. The msm_sdcc driver is (like much of the msm platform code) lagging far behind the internel version that qualcomm have, and the device tree binding they are using is incompatible with the common MMC binding (and of course the DMA binding here) as well. For getting MSM up to speed compared with the other platforms, they have to use proper DT bindings as well as proper DMA engine support. Between those two, I'd prefer fixing the DT binding first, in order to limit the amount of changes that have to be done to external device tree files. Arnd ___ devicetree-discuss mailing list devicetree-disc...@lists.ozlabs.org https://lists.ozlabs.org/listinfo/devicetree-discuss -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V6 1/2] of: Add generic device tree DMA helpers
On Wed, Sep 19, 2012 at 06:19:06AM +0800, Mitch Bradley wrote: Is there ever a point when old architectures leave the Linux tree, or will people have to see grep hits from them until the end of time? That depends on use and the burden of keeping them in the tree. I'm not aware of much activity around Shark, and I'm not aware of Shark causing that many problems either... -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V6 1/2] of: Add generic device tree DMA helpers
On Saturday 15 September 2012, Russell King - ARM Linux wrote: On Fri, Sep 14, 2012 at 05:41:56PM -0500, Jon Hunter wrote: 3. Supporting legacy devices not using DMA Engine These devices present a problem, as there may not be a uniform way to easily support them with regard to device tree. Ideally, these should be migrated to DMA engine. However, if this is not possible, then they should still be able to use this binding, the only constaint imposed by this implementation is that when requesting a DMA channel via of_dma_request_slave_channel(), it will return a type of dma_chan. As far as devices not using DMA engine, the answer is we don't support their specification in the DT model. Note that the legacy OMAP DMA API is scheduled for removal next year, so it's not going to be around that much longer. There are a few platforms using the ISA DMA API (rpc, h720x, shark, footbridge), and I agree that they are unlikely to see OF support, although if they did, it wouldn't be unreasonable to encode their DMA channels using the same binding. The other ones that are currently around with their own DMA implementation are bcmring -- platform is going away samsung -- gradually getting moved to dmaengine, already has its own binding that needs to be replaced with this one, so best do it at the same time. tegra -- old dma code gone in 3.7 pxa/mmp -- dmaengine implementation being worked on, should wait for that. msm -- dma implementation only used by two drivers (serial and mmc). Outside of arch/arm, at least sh, cris, unicore32 and blackfin have their own dma APIs based on the ISA interfaces. I don't currently see any of them moving towards DT, but it's definitely possible. Among the above MSM seems to be the most likely candidate to use the binding before moving to DT. The msm_sdcc driver is (like much of the msm platform code) lagging far behind the internel version that qualcomm have, and the device tree binding they are using is incompatible with the common MMC binding (and of course the DMA binding here) as well. For getting MSM up to speed compared with the other platforms, they have to use proper DT bindings as well as proper DMA engine support. Between those two, I'd prefer fixing the DT binding first, in order to limit the amount of changes that have to be done to external device tree files. Arnd -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V6 1/2] of: Add generic device tree DMA helpers
On Mon, Sep 17, 2012 at 08:42:11PM +, Arnd Bergmann wrote: On Saturday 15 September 2012, Russell King - ARM Linux wrote: On Fri, Sep 14, 2012 at 05:41:56PM -0500, Jon Hunter wrote: 3. Supporting legacy devices not using DMA Engine These devices present a problem, as there may not be a uniform way to easily support them with regard to device tree. Ideally, these should be migrated to DMA engine. However, if this is not possible, then they should still be able to use this binding, the only constaint imposed by this implementation is that when requesting a DMA channel via of_dma_request_slave_channel(), it will return a type of dma_chan. As far as devices not using DMA engine, the answer is we don't support their specification in the DT model. Note that the legacy OMAP DMA API is scheduled for removal next year, so it's not going to be around that much longer. There are a few platforms using the ISA DMA API (rpc, h720x, shark, footbridge), and I agree that they are unlikely to see OF support, although if they did, it wouldn't be unreasonable to encode their DMA channels using the same binding. The other ones that are currently around with their own DMA implementation are bcmring -- platform is going away samsung -- gradually getting moved to dmaengine, already has its own binding that needs to be replaced with this one, so best do it at the same time. tegra -- old dma code gone in 3.7 pxa/mmp -- dmaengine implementation being worked on, should wait for that. msm -- dma implementation only used by two drivers (serial and mmc). Outside of arch/arm, at least sh, cris, unicore32 and blackfin have their own dma APIs based on the ISA interfaces. I don't currently see any of them moving towards DT, but it's definitely possible. Among the above MSM seems to be the most likely candidate to use the binding before moving to DT. The msm_sdcc driver is (like much of the msm platform code) lagging far behind the internel version that qualcomm have, and the device tree binding they are using is incompatible with the common MMC binding (and of course the DMA binding here) as well. For getting MSM up to speed compared with the other platforms, they have to use proper DT bindings as well as proper DMA engine support. Between those two, I'd prefer fixing the DT binding first, in order to limit the amount of changes that have to be done to external device tree files. There is also a lot of similarity between the mmci hardware and the msm_sdcc hardware. Enough so, that it is probably better for us to make the mmci driver work with our hardware, rather than trying to keep msm_sdcc going. There is also an MSM nand device that appears to have not made it in. It is heavily dependent on the weird features of the DMA hardware. I don't have any current plans to support this device, since most boards using MSMs these days are using mmc/sd instead of bare NAND. Our DMA hardware is really weird, but should be a bit reasonable. It is also being gradually replaced in newer chips with a different DMA framework. As far as I'm concerned, I consider making our DMA driver(s) use the DMA engine API to be part of getting these platforms working with DT. It is planned, but there are quite a few things that need to be tackled first. David -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V6 1/2] of: Add generic device tree DMA helpers
This is based upon the work by Benoit Cousson [1] and Nicolas Ferre [2] to add some basic helpers to retrieve a DMA controller device_node and the DMA request/channel information. Aim of DMA helpers - The purpose of device-tree is to describe the capabilites of the hardware. Thinking about DMA controllers purely from the context of the hardware to begin with, we can describe a device in terms of a DMA controller as follows ... 1. Number of DMA controllers 2. Number of channels (maybe physical or logical) 3. Mapping of DMA requests signals to DMA controller 4. Number of DMA interrupts 5. Mapping of DMA interrupts to channels - With the above in mind the aim of the DT DMA helper functions is to extract the above information from the DT and provide to the appropriate driver. However, due to the vast number of DMA controllers and not all are using a common driver (such as DMA Engine) it has been seen that this is not a trivial task. In previous discussions on this topic the following concerns have been raised ... 1. How does the binding support devices with multiple DMA controllers? 2. How to support both legacy DMA controllers not using DMA Engine as well as those that support DMA Engine. 3. When using with DMA Engine how do we support the various implementations where the opaque filter function parameter differs between implementations? 4. How do we handle DMA channels that are identified with a string versus a integer? - Hence the design of the DMA helpers has to accomodate the above or align on an agreement what can be or should be supported. Design of DMA helpers 1. Registering DMA controllers In the case of DMA controllers that are using DMA Engine, requesting a channel is performed by calling the following function. struct dma_chan *dma_request_channel(dma_cap_mask_t mask, dma_filter_fn filter_fn, void *filter_param); The mask variable is used to match a type of the device controller in a list of controllers. The filter_fn and filter_param are used to identify the required dma channel and return a handle to the dma channel of type dma_chan. From the examples I have seen, the mask and filter_fn are constant for a given DMA controller and therefore, we can specify these as controller specific data when registering the DMA controller with the device-tree DMA helpers. The filter_param variable is of an unknown type and is typically specific to the DMA engine implementation for a given DMA controller. To allow some flexibility in the type and formating of this filter_param we employ an xlate to translate the device-tree binding information into the appropriate format. The xlate function used for a DMA controller can also be specified when registering the DMA controller with the device-tree DMA helpers. Based upon the above, a function for registering the DMA controller with the DMA helpers now looks like the below. The data variable is used to pass a pointer to DMA controller specific data used by the xlate function. int of_dma_controller_register(struct device_node *np, struct dma_chan *(*of_dma_xlate) (struct of_phandle_args *, struct of_dma *), void *data) For example, in the case where DMA engine is used, we define the following structure (that stores the DMA engine capability mask and filter function) and pass this to the data variable in the above function. struct of_dma_filter_info { dma_cap_mask_t dma_cap; dma_filter_fn filter_fn; }; 2. Representing and requesting channel information Please see the dma binding documentation included in this patch for a description of how DMA controllers and client information should be represented with device-tree. For more information on how this binding came about please see [3]. In addition to this, feedback received from the Linux kernel summit showed a consensus (among those who attended) to use a name to identify DMA client information [4]. A DMA channel can be requested by calling the following function, where name is a required parameter used for identifying a DMA channel. This function has been designed to return a structure of type dma_chan to work with the DMA engine driver. Note that if DMA engine is used then drivers should be using the DMA engine API dma_request_slave_channel() (implemented in part 2 of this series, dmaengine: add helper function to request a slave DMA channel) which will in turn call the below function if device-tree is present. The aim being to have a common DMA engine interface regardless of whether device tree is being used. struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
Re: [PATCH V6 1/2] of: Add generic device tree DMA helpers
On 09/14/2012 04:41 PM, Jon Hunter wrote: This is based upon the work by Benoit Cousson [1] and Nicolas Ferre [2] to add some basic helpers to retrieve a DMA controller device_node and the DMA request/channel information. The binding looks good to me now, so, Reviewed-by: Stephen Warren swar...@wwwdotorg.org -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V6 1/2] of: Add generic device tree DMA helpers
On Fri, Sep 14, 2012 at 05:41:56PM -0500, Jon Hunter wrote: 3. Supporting legacy devices not using DMA Engine These devices present a problem, as there may not be a uniform way to easily support them with regard to device tree. Ideally, these should be migrated to DMA engine. However, if this is not possible, then they should still be able to use this binding, the only constaint imposed by this implementation is that when requesting a DMA channel via of_dma_request_slave_channel(), it will return a type of dma_chan. As far as devices not using DMA engine, the answer is we don't support their specification in the DT model. Note that the legacy OMAP DMA API is scheduled for removal next year, so it's not going to be around that much longer. -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html