Skip to contentSkip to conversation

of: Add generic device tree DMA helpers

PATCH New Jon Hunter 12 participants 39 messages Sep 14, 2012 – Dec 20, 2012

Subsystems (3)
lore
Share & tools
lore

Jon Hunter

author
#0 lore raw

v6 cover of: Add generic device tree DMA helpers

Hi all,

I apologise for sending out so many updates in quick succession before everyone has had chance to review, however, I will be out of office next week and I know that several people have been waiting for this. Normally, I would not send out a series and disappear for a week, but Arnd agreed to help while I am out.

Arnd,
Feel free to make any changes you see fit while I am out or correct any balls-up I have made!

Cheers
Jon

This is based upon the work by Benoit Cousson [1] and Nicolas Ferre [2] to add some basic device-tree helpers to retrieve a DMA controller device_node and the DMA request/channel information.

v6: - minor corrections in DMA binding documentation
v5: - minor update to binding documentation
- added loop to exhaustively search for a slave channel in the case where there could be alternative channels available
v4: - revert the removal of xlate function from v3
- update the proposed binding format and APIs based upon discussions [3]
v3: - avoid passing an xlate function and instead pass DMA engine parameters
- define number of dma channels and requests in dma-controller node
v2: - remove of_dma_to_resource API
- make property #dma-cells required (no fallback anymore)
- another check in of_dma_xlate_onenumbercell() function

[1] http://article.gmane.org/gmane.linux.drivers.devicetree/12022
[2] http://article.gmane.org/gmane.linux.ports.arm.omap/73622
[3] http://marc.info/?l=linux-omap&m=133582085008539&w=2

Jon Hunter (2):
of: Add generic device tree DMA helpers
dmaengine: add helper function to request a slave DMA channel

 Documentation/devicetree/bindings/dma/dma.txt |   81 +++++++++
 drivers/dma/dmaengine.c                       |   16 ++
 drivers/of/Makefile                           |    2 +-
 drivers/of/dma.c                              |  219 +++++++++++++++++++++++++
 include/linux/dmaengine.h                     |    6 +
 include/linux/of_dma.h                        |   45 +++++
 6 files changed, 368 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
Signature · 1 line
1.7.9.5
author
#1 lore raw

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,
char *name)

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.

This implementation has been tested on OMAP4430 using the kernel v3.6-rc5. I have validated that MMC is working on the PANDA board with this implementation. My development branch for testing on OMAP can be found here [5].

v6: - minor corrections in DMA binding documentation
v5: - minor update to binding documentation
- added loop to exhaustively search for a slave channel in the case where there could be alternative channels available
v4: - revert the removal of xlate function from v3
- update the proposed binding format and APIs based upon discussions [3]
v3: - avoid passing an xlate function and instead pass DMA engine parameters
- define number of dma channels and requests in dma-controller node
v2: - remove of_dma_to_resource API
- make property #dma-cells required (no fallback anymore)
- another check in of_dma_xlate_onenumbercell() function

[1] http://article.gmane.org/gmane.linux.drivers.devicetree/12022
[2] http://article.gmane.org/gmane.linux.ports.arm.omap/73622
[3] http://marc.info/?l=linux-omap&m=133582085008539&w=2
[4] http://pad.linaro.org/arm-mini-summit-2012
[5] https://github.com/jonhunter/linux/tree/dev-dt-dma

Cc Nicolas Ferre <[email protected]>
Cc Benoit Cousson <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Grant Likely <[email protected]>
Cc Russell King <[email protected]>
Cc Rob Herring <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Vinod Koul <[email protected]>
Cc Dan Williams <[email protected]>
---
 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
Documentation/devicetree/bindings/dma/dma.txt new file +81 -0
new file mode 100644
index 0000000..a4f59a5
@@ -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 at 48000000 {
+		compatible = "ti,omap-sdma"
+		reg = <0x48000000 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 at 1 {
+		...
+		dmas = <&dma 2		/* read channel */
+			&dma 3>;	/* write channel */
+		dma-names = "rx", "tx"
+		...
+	};
+
+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"
+
+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";
drivers/of/Makefile +1 -1
index e027f44..eafa107 100644
@@ -1,4 +1,4 @@
-obj-y = base.o
+obj-y = base.o dma.o
 obj-$(CONFIG_OF_FLATTREE) += fdt.o
 obj-$(CONFIG_OF_PROMTREE) += pdt.o
 obj-$(CONFIG_OF_ADDRESS)  += address.o
drivers/of/dma.c new file +219 -0

219 lines not on this page · raw message

include/linux/of_dma.h new file +45 -0

45 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#2 lore raw

PATCH v6 1/2 of: Add generic device tree DMA helpers

Quoted 3 lines · Jon Hunter

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,

#3 lore raw

PATCH v6 1/2 of: Add generic device tree DMA helpers

In reply to Jon Hunter
Quoted 8 lines · Jon Hunter

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.

#4 lore raw

PATCH v6 1/2 of: Add generic device tree DMA helpers

Quoted 11 lines · Russell King - ARM Linux
Quoted 8 lines · Jon Hunter

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.

Quoted 4 lines

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

#5 lore raw

PATCH v6 1/2 of: Add generic device tree DMA helpers

Quoted 35 lines · Arnd Bergmann
Quoted 11 lines · Russell King - ARM Linux
Quoted 8 lines · Jon Hunter

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.

Quoted 4 lines

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.

Quoted 9 lines

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

Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
#6 lore raw

PATCH v6 1/2 of: Add generic device tree DMA helpers

Quoted 14 lines · David Brown

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.

Quoted 5 lines

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

#7 lore raw

PATCH v6 1/2 of: Add generic device tree DMA helpers

In reply to Arnd Bergmann
Quoted 12 lines · Arnd Bergmann
Quoted 11 lines · Russell King - ARM Linux
Quoted 8 lines · Jon Hunter

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.

Quoted 7 lines
Quoted 4 lines

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

Quoted 32 lines

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-discuss at lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss

#8 lore raw

PATCH v6 1/2 of: Add generic device tree DMA helpers

Quoted 2 lines · Mitch Bradley

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...

#9 lore raw

PATCH v6 1/2 of: Add generic device tree DMA helpers

In reply to Mitch Bradley
Quoted 5 lines · Mitch Bradley

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)?

Quoted 2 lines

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

#10 lore raw

PATCH v6 1/2 of: Add generic device tree DMA helpers

Quoted 10 lines · Arnd Bergmann
Quoted 5 lines · Mitch Bradley

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.

Quoted 11 lines
Quoted 3 lines

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.

Quoted 3 lines

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 ...

Quoted 3 lines

Arnd

#11 lore raw

PATCH v6 1/2 of: Add generic device tree DMA helpers

In reply to Jon Hunter

On Fri, Sep 14, 2012 at 05:41:56PM -0500, Jon Hunter wrote:

...

Typo nits in the binding examples below...

Quoted 28 lines
 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
Documentation/devicetree/bindings/dma/dma.txt new file +13 -0
new file mode 100644
index 0000000..a4f59a5
@@ -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.

Documentation/devicetree/bindings/dma/dma.txt line 23

Quoted 10 lines
Documentation/devicetree/bindings/dma/dma.txt new file +10 -0
+
+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@48000000 {
+		compatible = "ti,omap-sdma"

; here

Quoted 31 lines
Documentation/devicetree/bindings/dma/dma.txt new file +31 -0
+		reg = <0x48000000 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).

Documentation/devicetree/bindings/dma/dma.txt line 64

Quoted 10 lines
Documentation/devicetree/bindings/dma/dma.txt new file +10 -0
+
+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

Documentation/devicetree/bindings/dma/dma.txt line 73

Quoted 9 lines
Documentation/devicetree/bindings/dma/dma.txt new file +9 -0
+		...
+	};
+
+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 ;

Documentation/devicetree/bindings/dma/dma.txt line 81

Quoted 8 lines
Documentation/devicetree/bindings/dma/dma.txt new file +8 -0
+
+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

#12 lore raw

PATCH v6 1/2 of: Add generic device tree DMA helpers

In reply to Jon Hunter
Quoted 14 lines · Jon Hunter
Documentation/devicetree/bindings/dma/dma.txt new file +8 -0
new file mode 100644
index 0000000..a4f59a5
@@ -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

Documentation/devicetree/bindings/dma/dma.txt line 18

Quoted 10 lines
Documentation/devicetree/bindings/dma/dma.txt new file +10 -0
+
+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

#13 lore raw

PATCH v6 1/2 of: Add generic device tree DMA helpers

Quoted 10 lines · Matt Porter

Documentation/devicetree/bindings/dma/dma.txt line 18

Quoted 4 lines
Documentation/devicetree/bindings/dma/dma.txt new file +4 -0
+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

#14 lore raw

PATCH v6 1/2 of: Add generic device tree DMA helpers

Quoted 6 lines · Arnd Bergmann
Quoted 5 lines · Matt Porter
Quoted 4 lines
Documentation/devicetree/bindings/dma/dma.txt new file +4 -0
+Optional properties:
+- #dma-channels:     Number of DMA channels supported by the controller.
+- #dma-requests:     Number of DMA requests signals supported by the
+                     controller.
Quoted 8 lines
Quoted 5 lines

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

#15 lore raw

PATCH v6 1/2 of: Add generic device tree DMA helpers

Quoted 13 lines · Rob Herring
Quoted 12 lines · Arnd Bergmann
Quoted 10 lines · Matt Porter

Documentation/devicetree/bindings/dma/dma.txt line 18

Quoted 4 lines
Documentation/devicetree/bindings/dma/dma.txt new file +4 -0
+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.

Quoted 5 lines
Quoted 2 lines

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

#16 lore raw

PATCH v6 1/2 of: Add generic device tree DMA helpers

Quoted 17 lines · Matt Porter
Quoted 16 lines · Rob Herring
Quoted 14 lines · Arnd Bergmann
Quoted 10 lines · Matt Porter

Documentation/devicetree/bindings/dma/dma.txt line 18

Quoted 4 lines
Documentation/devicetree/bindings/dma/dma.txt new file +4 -0
+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.

Quoted 7 lines
Quoted 2 lines

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

#17 lore raw

PATCH v6 1/2 of: Add generic device tree DMA helpers

In reply to Arnd Bergmann
Quoted 6 lines · Arnd Bergmann
Quoted 5 lines · Matt Porter
Quoted 4 lines
Documentation/devicetree/bindings/dma/dma.txt new file +4 -0
+Optional properties:
+- #dma-channels:     Number of DMA channels supported by the controller.
+- #dma-requests:     Number of DMA requests signals supported by the
+                     controller.
Quoted 8 lines
Quoted 5 lines

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.

Quoted 7 lines

Arnd
_______________________________________________
devicetree-discuss mailing list
devicetree-discuss at lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss

#18 lore raw

PATCH v6 1/2 of: Add generic device tree DMA helpers

In reply to Jon Hunter
Quoted 3 lines · Jon Hunter

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]

Quoted 7 lines
---
 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:

author
#19 lore raw

PATCH v6 2/2 dmaengine: add helper function to request a slave DMA channel

In reply to Jon Hunter

Currently slave DMA channels are requested by calling dma_request_channel() and requires DMA clients to pass various filter parameters to obtain the appropriate channel.

With device-tree being used by architectures such as arm and the addition of device-tree helper functions to extract the relevant DMA client information from device-tree, add a new function to request a slave DMA channel using device-tree. This function is currently a simple wrapper that calls the device-tree of_dma_request_slave_channel() function.

Cc Nicolas Ferre <[email protected]>
Cc Benoit Cousson <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Grant Likely <[email protected]>
Cc Russell King <[email protected]>
Cc Rob Herring <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Vinod Koul <[email protected]>
Cc Dan Williams <[email protected]>
---
 drivers/dma/dmaengine.c   |   16 ++++++++++++++++
 include/linux/dmaengine.h |    6 ++++++
 2 files changed, 22 insertions(+)
drivers/dma/dmaengine.c +16 -0
index 3491654..9b466da 100644
@@ -62,6 +62,7 @@
 #include <linux/rculist.h>
 #include <linux/idr.h>
 #include <linux/slab.h>
+#include <linux/of_dma.h>
 
 static DEFINE_MUTEX(dma_list_mutex);
 static DEFINE_IDR(dma_idr);
@@ -546,6 +547,21 @@ struct dma_chan *__dma_request_channel(dma_cap_mask_t *mask, dma_filter_fn fn, v
 }
 EXPORT_SYMBOL_GPL(__dma_request_channel);
 
+/**
+ * dma_request_slave_channel - try to allocate an exclusive slave channel
+ * @dev:	pointer to client device structure
+ * @name:	slave channel name
+ */
+struct dma_chan *dma_request_slave_channel(struct device *dev, char *name)
+{
+	/* If device-tree is present get slave info from here */
+	if (dev->of_node)
+		return of_dma_request_slave_channel(dev->of_node, name);
+
+	return NULL;
+}
+EXPORT_SYMBOL_GPL(dma_request_slave_channel);
+
 void dma_release_channel(struct dma_chan *chan)
 {
 	mutex_lock(&dma_list_mutex);
include/linux/dmaengine.h +6 -0
index 9c02a45..9500aa5 100644
@@ -973,6 +973,7 @@ enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie);
 enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx);
 void dma_issue_pending_all(void);
 struct dma_chan *__dma_request_channel(dma_cap_mask_t *mask, dma_filter_fn fn, void *fn_param);
+struct dma_chan *dma_request_slave_channel(struct device *dev, char *name);
 void dma_release_channel(struct dma_chan *chan);
 #else
 static inline enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx)
@@ -987,6 +988,11 @@ static inline struct dma_chan *__dma_request_channel(dma_cap_mask_t *mask,
 {
 	return NULL;
 }
+static inline struct dma_chan *dma_request_slave_channel(struct device *dev,
+							 char *name)
+{
+	return NULL
+}
 static inline void dma_release_channel(struct dma_chan *chan)
 {
 }
Signature · 1 line
1.7.9.5
#20 lore raw

PATCH v6 2/2 dmaengine: add helper function to request a slave DMA channel

drivers/dma/dmaengine.c struct dma_chan *__dma_request_channel(dma_cap_mask_t *mask, dma_filter_fn fn, v · line 560

Quoted 12 lines · Jon Hunter

+/**
+ * dma_request_slave_channel - try to allocate an exclusive slave channel
+ * @dev: pointer to client device structure
+ * @name: slave channel name
+ */

drivers/dma/dmaengine.c +6 -0
+struct dma_chan *dma_request_slave_channel(struct device *dev, char *name)
+{
+       /* If device-tree is present get slave info from here */
+       if (dev->of_node)
+               return of_dma_request_slave_channel(dev->of_node, name);
+

Shouldn't this be conditionally compiled only when OF is built. I think this might be problematic for systems which doesn't have device tree. Or perhaps you can declare these symbols as dummy in of_dma.h when device tree is not selected.

Quoted 3 lines
drivers/dma/dmaengine.c +3 -0
+       return NULL;
+}
+EXPORT_SYMBOL_GPL(dma_request_slave_channel); 
Signature · 1 line
~Vinod
#21 lore raw

PATCH v6 2/2 dmaengine: add helper function to request a slave DMA channel

Quoted 17 lines · Vinod Koul

drivers/dma/dmaengine.c struct dma_chan *__dma_request_channel(dma_cap_mask_t *mask, dma_filter_fn fn, v · line 560

Quoted 12 lines · Jon Hunter

+/**
+ * dma_request_slave_channel - try to allocate an exclusive slave channel
+ * @dev: pointer to client device structure
+ * @name: slave channel name
+ */

drivers/dma/dmaengine.c +6 -0
+struct dma_chan *dma_request_slave_channel(struct device *dev, char *name)
+{
+       /* If device-tree is present get slave info from here */
+       if (dev->of_node)
+               return of_dma_request_slave_channel(dev->of_node, name);
+

Shouldn't this be conditionally compiled only when OF is built. I think this might be problematic for systems which doesn't have device tree. Or perhaps you can declare these symbols as dummy in of_dma.h when device tree is not selected.

Right, good point. I'd prefer the dummy functions, since that is in line with what a lot of other subsystems do:

#ifdef CONFIG_OF
extern int of_dma_controller_register(struct device_node *np,
struct dma_chan *(*of_dma_xlate)
(struct of_phandle_args *, struct of_dma *),
void *data);
extern void of_dma_controller_free(struct device_node *np); extern struct dma_chan *of_dma_request_slave_channel(struct device_node *np,

                                                    char *name);
extern struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
               struct of_dma *ofdma);

#else
static inline int of_dma_controller_register(struct device_node *np,
struct dma_chan *(*of_dma_xlate)
(struct of_phandle_args *, struct of_dma *), void *data)

{
	return -ENODEV;
}

static inline void of_dma_controller_free(struct device_node *np)
{
}
static inline struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
char *name)

{
	return NULL;
}
static inline struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
               struct of_dma *ofdma)
{
	return NULL;
}

#endif

I believe that Jon is on vacation this week, so if this is the only issue holding up the merge, maybe you can change this in his patch directly, or I can send an updated version if you prefer.

Arnd

#22 lore raw

PATCH v6 2/2 dmaengine: add helper function to request a slave DMA channel

Quoted 53 lines · Arnd Bergmann
Quoted 17 lines · Vinod Koul

drivers/dma/dmaengine.c struct dma_chan *__dma_request_channel(dma_cap_mask_t *mask, dma_filter_fn fn, v · line 560

Quoted 12 lines · Jon Hunter

+/**
+ * dma_request_slave_channel - try to allocate an exclusive slave channel
+ * @dev: pointer to client device structure
+ * @name: slave channel name
+ */

drivers/dma/dmaengine.c +6 -0
+struct dma_chan *dma_request_slave_channel(struct device *dev, char *name)
+{
+       /* If device-tree is present get slave info from here */
+       if (dev->of_node)
+               return of_dma_request_slave_channel(dev->of_node, name);
+

Shouldn't this be conditionally compiled only when OF is built. I think this might be problematic for systems which doesn't have device tree. Or perhaps you can declare these symbols as dummy in of_dma.h when device tree is not selected.

Right, good point. I'd prefer the dummy functions, since that is in line with what a lot of other subsystems do:

#ifdef CONFIG_OF
extern int of_dma_controller_register(struct device_node *np,
struct dma_chan *(*of_dma_xlate)
(struct of_phandle_args *, struct of_dma *),
void *data);
extern void of_dma_controller_free(struct device_node *np); extern struct dma_chan *of_dma_request_slave_channel(struct device_node *np,

                                                    char *name);
extern struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
               struct of_dma *ofdma);

#else
static inline int of_dma_controller_register(struct device_node *np,
struct dma_chan *(*of_dma_xlate)
(struct of_phandle_args *, struct of_dma *), void *data)

{
	return -ENODEV;
}

static inline void of_dma_controller_free(struct device_node *np)
{
}
static inline struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
char *name)

{
	return NULL;
}
static inline struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
               struct of_dma *ofdma)
{
	return NULL;
}
Quoted 5 lines

#endif

I believe that Jon is on vacation this week, so if this is the only issue holding up the merge, maybe you can change this in his patch directly, or I can send an updated version if you prefer.

I worry that too much is going on here too quickly. We have some people working on changing the way DMA engine selects channels. Meanwhile we have other people trying to create an OF DMA engine API.

It seems that Vinod's working on a way for platforms to specify bindings to the DMA engine code, and the DMA engine code itself selects the appropriate channel. This patch, on the other hand, introduces a set of translation functions which need to be provided by platform code, which returns the dma_chan pointer.

This sounds like a recipe for a total abortion of interfaces. Only one of those two activities should be going on at any one time, or if they have to occur, they need coordination so that the we don't end up with two totally different schemes.

In the mad rush to DTify everything, don't make hasty decisions, because it is very difficult to change it later - especially something like this which defines how DT encodes this information.

#23 lore raw

PATCH v6 2/2 dmaengine: add helper function to request a slave DMA channel

Quoted 15 lines · Russell King - ARM Linux
Quoted 4 lines

I believe that Jon is on vacation this week, so if this is the only issue holding up the merge, maybe you can change this in his patch directly, or I can send an updated version if you prefer.

I worry that too much is going on here too quickly. We have some people working on changing the way DMA engine selects channels. Meanwhile we have other people trying to create an OF DMA engine API.

It seems that Vinod's working on a way for platforms to specify bindings to the DMA engine code, and the DMA engine code itself selects the appropriate channel. This patch, on the other hand, introduces a set of translation functions which need to be provided by platform code, which returns the dma_chan pointer.

Quoted 8 lines

This sounds like a recipe for a total abortion of interfaces. Only one of those two activities should be going on at any one time, or if they have to occur, they need coordination so that the we don't end up with two totally different schemes.

In the mad rush to DTify everything, don't make hasty decisions, because it is very difficult to change it later - especially something like this which defines how DT encodes this information.

We discussed this in KS and IMHO we need to merge these two approaches.

For DT bindings, I think the binding itself shouldn't change based on my work but I would like these same bindings to help build the DMA engine code mappings.

Now would it make sense to NOT merge these changes for 3.7 and postpone to 3.8. I can host these patches on a topic branch and merge them when we are ready. I plan to spend some good amount of time on my work this week so we should be ready pretty soon.
One these changes are merged, users can start moving to this scheme.

Signature · 1 line
~Vinod
#24 lore raw

PATCH v6 2/2 dmaengine: add helper function to request a slave DMA channel

Quoted 30 lines · Vinod Koul
Quoted 15 lines · Russell King - ARM Linux
Quoted 4 lines

I believe that Jon is on vacation this week, so if this is the only issue holding up the merge, maybe you can change this in his patch directly, or I can send an updated version if you prefer.

I worry that too much is going on here too quickly. We have some people working on changing the way DMA engine selects channels. Meanwhile we have other people trying to create an OF DMA engine API.

It seems that Vinod's working on a way for platforms to specify bindings to the DMA engine code, and the DMA engine code itself selects the appropriate channel. This patch, on the other hand, introduces a set of translation functions which need to be provided by platform code, which returns the dma_chan pointer.

Quoted 8 lines

This sounds like a recipe for a total abortion of interfaces. Only one of those two activities should be going on at any one time, or if they have to occur, they need coordination so that the we don't end up with two totally different schemes.

In the mad rush to DTify everything, don't make hasty decisions, because it is very difficult to change it later - especially something like this which defines how DT encodes this information.

We discussed this in KS and IMHO we need to merge these two approaches.

For DT bindings, I think the binding itself shouldn't change based on my work but I would like these same bindings to help build the DMA engine code mappings.

Quoted 5 lines

Now would it make sense to NOT merge these changes for 3.7 and postpone to 3.8. I can host these patches on a topic branch and merge them when we are ready. I plan to spend some good amount of time on my work this week so we should be ready pretty soon.
One these changes are merged, users can start moving to this scheme.

FWIW, I'm already basing the EDMA dmaengine support for OMAP (specifically for AM335x) on using these helpers since AM335x *only* boots from DT.

-Matt

#25 lore raw

PATCH v6 2/2 dmaengine: add helper function to request a slave DMA channel

Quoted 10 lines · Matt Porter
Quoted 6 lines · Vinod Koul

Now would it make sense to NOT merge these changes for 3.7 and postpone to 3.8. I can host these patches on a topic branch and merge them when we are ready. I plan to spend some good amount of time on my work this week so we should be ready pretty soon.
One these changes are merged, users can start moving to this scheme.

FWIW, I'm already basing the EDMA dmaengine support for OMAP (specifically for AM335x) on using these helpers since AM335x only boots from DT.

I suspect the same thing will be happening for a lot of platforms after 3.7-rc1: ux500, lpc32xx, integrator, imx, mxs and probably others are all waiting for this so they can complete the move to DT-only booting.

Having some support for the new binding in 3.7 would be a great help to reduce interdependencies for the 3.8 merge cycle. Both the driver interface and the binding should actually be in a good shape now, so I'd very much appriciate it getting merged for 3.7, even if the implementation may have to change again in 3.8.

Arnd

#26 lore raw

PATCH v6 2/2 dmaengine: add helper function to request a slave DMA channel

Quoted 8 lines · Arnd Bergmann
Quoted 2 lines · Matt Porter

FWIW, I'm already basing the EDMA dmaengine support for OMAP (specifically for AM335x) on using these helpers since AM335x only boots from DT.

I suspect the same thing will be happening for a lot of platforms after 3.7-rc1: ux500, lpc32xx, integrator, imx, mxs and probably others are all waiting for this so they can complete the move to DT-only booting.

Integrator won't be, because no integrator platforms have DMA support. That only came in with the Versatile range, of which it's extremely dodgy and unreliable to use. So in general, ARMs platforms do not have working DMA support.

(I actually carry a private patch set which does enable full support on Versatile platforms, but given the general brokenness of the platform I see no reason to merge it and cause people issues with the platform when they find out that DMA is broken in weird and wonderful ways depending on the FPGA build they've happened to end up with...)

author
#27 lore raw

PATCH v6 2/2 dmaengine: add helper function to request a slave DMA channel

In reply to Vinod Koul

Hi Vinod,

Quoted 30 lines · Vinod Koul
Quoted 15 lines · Russell King - ARM Linux
Quoted 4 lines

I believe that Jon is on vacation this week, so if this is the only issue holding up the merge, maybe you can change this in his patch directly, or I can send an updated version if you prefer.

I worry that too much is going on here too quickly. We have some people working on changing the way DMA engine selects channels. Meanwhile we have other people trying to create an OF DMA engine API.

It seems that Vinod's working on a way for platforms to specify bindings to the DMA engine code, and the DMA engine code itself selects the appropriate channel. This patch, on the other hand, introduces a set of translation functions which need to be provided by platform code, which returns the dma_chan pointer.

Quoted 8 lines

This sounds like a recipe for a total abortion of interfaces. Only one of those two activities should be going on at any one time, or if they have to occur, they need coordination so that the we don't end up with two totally different schemes.

In the mad rush to DTify everything, don't make hasty decisions, because it is very difficult to change it later - especially something like this which defines how DT encodes this information.

We discussed this in KS and IMHO we need to merge these two approaches.

For DT bindings, I think the binding itself shouldn't change based on my work but I would like these same bindings to help build the DMA engine code mappings.

Quoted 5 lines

Now would it make sense to NOT merge these changes for 3.7 and postpone to 3.8. I can host these patches on a topic branch and merge them when we are ready. I plan to spend some good amount of time on my work this week so we should be ready pretty soon.
One these changes are merged, users can start moving to this scheme.

I just wanted to see how things are progressing your side. Did you create a topic branch for this? If so let me know where I can find it, I did not find a branch on your infradead git tree.

I wanted to pull in the latest patches for some testing.

Cheers
Jon

#28 lore raw

PATCH v6 2/2 dmaengine: add helper function to request a slave DMA channel

Quoted 10 lines · Jon Hunter
Quoted 9 lines

For DT bindings, I think the binding itself shouldn't change based on my work but I would like these same bindings to help build the DMA engine code mappings.

Now would it make sense to NOT merge these changes for 3.7 and postpone to 3.8. I can host these patches on a topic branch and merge them when we are ready. I plan to spend some good amount of time on my work this week so we should be ready pretty soon.
One these changes are merged, users can start moving to this scheme.

Quoted 5 lines

I just wanted to see how things are progressing your side. Did you create a topic branch for this? If so let me know where I can find it, I did not find a branch on your infradead git tree.

I wanted to pull in the latest patches for some testing.

Sorry for delay, I had everything ready, but couldn't manage to commit and push. I have pushed to topic/dmaengine_dt, it is pushing out now...

This has your two patches, my fix for build breakage, and Matt's typo patch. This is based on my next.

Signature · 1 line
~Vinod
#29 lore raw

PATCH v6 2/2 dmaengine: add helper function to request a slave DMA channel

Quoted 11 lines · Vinod Koul
Quoted 10 lines · Jon Hunter
Quoted 9 lines

For DT bindings, I think the binding itself shouldn't change based on my work but I would like these same bindings to help build the DMA engine code mappings.

Now would it make sense to NOT merge these changes for 3.7 and postpone to 3.8. I can host these patches on a topic branch and merge them when we are ready. I plan to spend some good amount of time on my work this week so we should be ready pretty soon.
One these changes are merged, users can start moving to this scheme.

Quoted 8 lines
Quoted 5 lines

I just wanted to see how things are progressing your side. Did you create a topic branch for this? If so let me know where I can find it, I did not find a branch on your infradead git tree.

I wanted to pull in the latest patches for some testing.

Sorry for delay, I had everything ready, but couldn't manage to commit and push. I have pushed to topic/dmaengine_dt, it is pushing out now...

Vinod,

Looks it seemed 3.7-rc1. Does that mean we have to wait for 3.8, or will it show on later -rc for 3.7?

Shawn

#30 lore raw

PATCH v6 2/2 dmaengine: add helper function to request a slave DMA channel

Quoted 16 lines · Shawn Guo
Quoted 15 lines · Vinod Koul
Quoted 14 lines · Jon Hunter
Quoted 9 lines

For DT bindings, I think the binding itself shouldn't change based on my work but I would like these same bindings to help build the DMA engine code mappings.

Now would it make sense to NOT merge these changes for 3.7 and postpone to 3.8. I can host these patches on a topic branch and merge them when we are ready. I plan to spend some good amount of time on my work this week so we should be ready pretty soon.
One these changes are merged, users can start moving to this scheme.

I just wanted to see how things are progressing your side. Did you create a topic branch for this? If so let me know where I can find it, I did not find a branch on your infradead git tree.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

I wanted to pull in the latest patches for some testing.

Sorry for delay, I had everything ready, but couldn't manage to commit and push. I have pushed to topic/dmaengine_dt, it is pushing out now...

Vinod,

Looks it seemed 3.7-rc1. Does that mean we have to wait for 3.8, or will it show on later -rc for 3.7?

Yes this will be merged once we work out the common interface, otherwise we will end up redoing interfaces for all drivers.

Signature · 1 line
~Vinod
author
#31 lore raw

PATCH v6 2/2 dmaengine: add helper function to request a slave DMA channel

Quoted 21 lines · Vinod Koul
Quoted 20 lines · Shawn Guo
Quoted 19 lines · Vinod Koul
Quoted 10 lines · Jon Hunter
Quoted 9 lines

For DT bindings, I think the binding itself shouldn't change based on my work but I would like these same bindings to help build the DMA engine code mappings.

Now would it make sense to NOT merge these changes for 3.7 and postpone to 3.8. I can host these patches on a topic branch and merge them when we are ready. I plan to spend some good amount of time on my work this week so we should be ready pretty soon.
One these changes are merged, users can start moving to this scheme.

Quoted 5 lines

I just wanted to see how things are progressing your side. Did you create a topic branch for this? If so let me know where I can find it, I did not find a branch on your infradead git tree.

I wanted to pull in the latest patches for some testing.

Sorry for delay, I had everything ready, but couldn't manage to commit and push. I have pushed to topic/dmaengine_dt, it is pushing out now...

Quoted 6 lines
Quoted 4 lines

Vinod,

Looks it seemed 3.7-rc1. Does that mean we have to wait for 3.8, or will it show on later -rc for 3.7?

Yes this will be merged once we work out the common interface, otherwise we will end up redoing interfaces for all drivers.

Hi Vinod,

A few people have been asking me if getting device-tree support for DMA engine is plan for record for v3.8. I know that you were working through implementing a common interface and so I wanted to check how that is going. Do you have any insight to when device-tree support may get added?

Cheers
Jon

#32 lore raw

PATCH v6 2/2 dmaengine: add helper function to request a slave DMA channel

Quoted 7 lines · Jon Hunter

Hi Vinod,

A few people have been asking me if getting device-tree support for DMA engine is plan for record for v3.8. I know that you were working through implementing a common interface and so I wanted to check how that is going. Do you have any insight to when device-tree support may get added?

I have not been able to do much work on this for last couple of weeks. I hope to do it in by this weekend. If not I will merge yours and then uppdate.

Anyway, DT would be there in 3.8 with or without my changes.

Signature · 1 line
~Vinod
#33 lore raw

PATCH v6 2/2 dmaengine: add helper function to request a slave DMA channel

On 11/16/2012 02:37 AM, Vinod Koul :

Quoted 8 lines · Jon Hunter
Quoted 7 lines

Hi Vinod,

A few people have been asking me if getting device-tree support for DMA engine is plan for record for v3.8. I know that you were working through implementing a common interface and so I wanted to check how that is going. Do you have any insight to when device-tree support may get added?

Quoted 5 lines

I have not been able to do much work on this for last couple of weeks. I hope to do it in by this weekend. If not I will merge yours and then uppdate.

Anyway, DT would be there in 3.8 with or without my changes.

Vinod,

So, can we imagine having this tree in linux-next rapidly (with or without your changes)?

Thanks, best regards,

Signature · 1 line
Nicolas Ferre
author
#34 lore raw

PATCH v6 2/2 dmaengine: add helper function to request a slave DMA channel

In reply to Vinod Koul
Quoted 8 lines · Vinod Koul
Quoted 7 lines · Jon Hunter

Hi Vinod,

A few people have been asking me if getting device-tree support for DMA engine is plan for record for v3.8. I know that you were working through implementing a common interface and so I wanted to check how that is going. Do you have any insight to when device-tree support may get added?

Quoted 5 lines

I have not been able to do much work on this for last couple of weeks. I hope to do it in by this weekend. If not I will merge yours and then uppdate.

Anyway, DT would be there in 3.8 with or without my changes.

Thanks, Vinod. Can you make sure you also pick up the two fixes [1][2] I sent out?

Cheers
Jon

[1] http://marc.info/?l=linux-omap&m=134859981920598&w=2
[2] http://marc.info/?l=linux-omap&m=134998461526129&w=2

Applied
#35 lore raw

PATCH v6 2/2 dmaengine: add helper function to request a slave DMA channel

Quoted 10 lines · Jon Hunter

Thanks, Vinod. Can you make sure you also pick up the two fixes [1][2] I sent out?

Cheers
Jon

[1] http://marc.info/?l=linux-omap&m=134859981920598&w=2
[2] http://marc.info/?l=linux-omap&m=134998461526129&w=2

Applied both and merged the branch to my next.
It should show up in linux-next tomorrow

Please check

Thanks

Signature · 2 lines
Vinod Koul
Intel Corp.
author
#36 lore raw

PATCH v6 2/2 dmaengine: add helper function to request a slave DMA channel

In reply to Vinod Koul

Hi Vinod,

Quoted 8 lines · Vinod Koul
Quoted 7 lines · Jon Hunter

Hi Vinod,

A few people have been asking me if getting device-tree support for DMA engine is plan for record for v3.8. I know that you were working through implementing a common interface and so I wanted to check how that is going. Do you have any insight to when device-tree support may get added?

Quoted 5 lines

I have not been able to do much work on this for last couple of weeks. I hope to do it in by this weekend. If not I will merge yours and then uppdate.

Anyway, DT would be there in 3.8 with or without my changes.

I am not sure if I have missed your pull request, but wanted to see if you had or were going to send a pull request for the DT changes for v3.8? I believe that the merge window ends this week.

Cheers
Jon

#37 lore raw

PATCH v6 2/2 dmaengine: add helper function to request a slave DMA channel

Quoted 3 lines · Jon Hunter

I am not sure if I have missed your pull request, but wanted to see if you had or were going to send a pull request for the DT changes for v3.8? I believe that the merge window ends this week.

Not yet sent. I was waiting on Dan's changes, just merged and pushed those.
Pull request should show up in couple of days.

Thanks

Signature · 2 lines
Vinod Koul
Intel Corp.
#38 lore raw

PATCH v6 2/2 dmaengine: add helper function to request a slave DMA channel

In reply to Arnd Bergmann
Quoted 5 lines · Arnd Bergmann

On Monday 17 September 2012, Vinod Koul wrote:

I believe that Jon is on vacation this week, so if this is the only issue holding up the merge, maybe you can change this in his patch directly, or I can send an updated version if you prefer.

Yes that was my idea as well, we do similar stuff in dmaengine.

Okay I think we are good for merging this, I will add the patch for this as well.

If anyone has objection please speak up _now_

Signature · 1 line
~Vinod