From: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
To: Laxman Dewangan
<ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
Vinod Koul <vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>,
Thierry Reding
<thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Alexandre Courbot
<gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Pawel Moll <pawel.moll-5wv7dgnIgG8@public.gmane.org>,
Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
Ian Campbell
<ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org>,
Kumar Gala <galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
dmaengine-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Subject: [PATCH 1/3] dmaengine: of: Allow #dma-cells to be zero
Date: Fri, 25 Sep 2015 15:56:38 +0100 [thread overview]
Message-ID: <1443193000-457-2-git-send-email-jonathanh@nvidia.com> (raw)
In-Reply-To: <1443193000-457-1-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Currently, the #dma-cells property must be 1 or more. However, for some
DMA controllers, where DMA clients may use any DMA channel and it is not
necessary to specify any other DMA information in the device-tree DMA
binding, setting #dma-cells to 0 is desirable. The Tegra210 ADMA
controller is an example of a DMA controller where neither the DMA
channel or the hardware request signal need to be encoded in the
device-tree binding.
By allowing DMA controllers to set #dma-cells to 0, means that the
"dma-names" property for these controllers is not needed. Therefore,
update the of_dma_request_slave_channel() and of_dma_match_channel()
functions to ignore this property if no name is provided.
Signed-off-by: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
Documentation/devicetree/bindings/dma/dma.txt | 12 ++++++++----
drivers/dma/of-dma.c | 23 +++++++++++++++--------
2 files changed, 23 insertions(+), 12 deletions(-)
diff --git a/Documentation/devicetree/bindings/dma/dma.txt b/Documentation/devicetree/bindings/dma/dma.txt
index 6312fb00ce8d..4d73916fc879 100644
--- a/Documentation/devicetree/bindings/dma/dma.txt
+++ b/Documentation/devicetree/bindings/dma/dma.txt
@@ -8,9 +8,12 @@ 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.
+- #dma-cells: Used to provide DMA controller specific information.
+ Can be 0 for DMA controllers where clients may use
+ any channel and any DMA specific information, such
+ as a hardware request signal, does not need to be
+ encoded in the binding. See DMA client binding below
+ for more details.
Optional properties:
- dma-channels: Number of DMA channels supported by the controller.
@@ -79,7 +82,8 @@ Required property:
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).
+ DMA specifiers must be identical (see examples). This
+ is optional for DMA controllers where #dma-cells is 0.
Examples:
diff --git a/drivers/dma/of-dma.c b/drivers/dma/of-dma.c
index 1e1f2986eba8..ef3d260610ea 100644
--- a/drivers/dma/of-dma.c
+++ b/drivers/dma/of-dma.c
@@ -214,11 +214,13 @@ static int of_dma_match_channel(struct device_node *np, const char *name,
{
const char *s;
- if (of_property_read_string_index(np, "dma-names", index, &s))
- return -ENODEV;
+ if (name) {
+ if (of_property_read_string_index(np, "dma-names", index, &s))
+ return -ENODEV;
- if (strcmp(name, s))
- return -ENODEV;
+ if (strcmp(name, s))
+ return -ENODEV;
+ }
if (of_parse_phandle_with_args(np, "dmas", "#dma-cells", index,
dma_spec))
@@ -230,7 +232,7 @@ static int of_dma_match_channel(struct device_node *np, const char *name,
/**
* of_dma_request_slave_channel - Get the DMA slave channel
* @np: device node to get DMA request from
- * @name: name of desired channel
+ * @name: name of desired channel (optional)
*
* Returns pointer to appropriate DMA channel on success or an error pointer.
*/
@@ -243,8 +245,8 @@ struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
int count, i;
int ret_no_channel = -ENODEV;
- if (!np || !name) {
- pr_err("%s: not enough information provided\n", __func__);
+ if (!np) {
+ pr_err("%s: device node is not valid\n", __func__);
return ERR_PTR(-ENODEV);
}
@@ -252,7 +254,12 @@ struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
if (!of_find_property(np, "dmas", NULL))
return ERR_PTR(-ENODEV);
- count = of_property_count_strings(np, "dma-names");
+ /*
+ * If a name is not provided, then assume that there is one
+ * DMA specifier in the list for the client and so set the
+ * count to 1 and see if this matches.
+ */
+ count = name ? of_property_count_strings(np, "dma-names") : 1;
if (count < 0) {
pr_err("%s: dma-names property of node '%s' missing or empty\n",
__func__, np->full_name);
--
2.1.4
next prev parent reply other threads:[~2015-09-25 14:56 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-25 14:56 [PATCH 0/3] Add support for Tegra210 ADMA Jon Hunter
[not found] ` <1443193000-457-1-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-09-25 14:56 ` Jon Hunter [this message]
[not found] ` <1443193000-457-2-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-09-25 15:05 ` [PATCH 1/3] dmaengine: of: Allow #dma-cells to be zero Arnd Bergmann
2015-09-25 14:56 ` [PATCH 2/3] Documentation: DT: Add binding documentation for NVIDIA ADMA Jon Hunter
[not found] ` <1443193000-457-3-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-09-25 1:16 ` Mark Rutland
2015-09-25 14:56 ` [PATCH 3/3] dmaengine: tegra-adma: Add support for Tegra210 ADMA Jon Hunter
[not found] ` <1443193000-457-4-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-09-25 15:03 ` Arnd Bergmann
2015-09-25 15:17 ` Jon Hunter
[not found] ` <56056589.9010704-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-09-25 15:32 ` Arnd Bergmann
2015-09-25 15:38 ` Jon Hunter
[not found] ` <56056A8F.5010103-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-09-25 15:42 ` Stephen Warren
2015-09-25 15:47 ` Arnd Bergmann
2015-09-28 14:57 ` Jon Hunter
2015-09-28 14:57 ` Jon Hunter
[not found] ` <5609556A.8060908-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-09-28 15:07 ` Arnd Bergmann
2015-09-29 12:18 ` Jon Hunter
[not found] ` <560A817E.6010405-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-09-29 12:39 ` Arnd Bergmann
2015-09-29 14:18 ` Jon Hunter
[not found] ` <560A9D9F.2070109-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-09-29 15:34 ` Arnd Bergmann
2015-09-29 15:45 ` Jon Hunter
2015-09-30 16:37 ` Stephen Warren
2015-09-30 16:27 ` Stephen Warren
2015-09-28 16:36 ` Stephen Warren
[not found] ` <56096C9E.7070608-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2015-09-29 8:13 ` Jon Hunter
[not found] ` <560A4847.8090007-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-09-29 14:25 ` Jon Hunter
2015-09-30 16:25 ` Stephen Warren
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1443193000-457-2-git-send-email-jonathanh@nvidia.com \
--to=jonathanh-ddmlm1+adcrqt0dzr+alfa@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=dmaengine-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
--cc=gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org \
--cc=ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
--cc=pawel.moll-5wv7dgnIgG8@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
--cc=thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.