devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jon Hunter <jon-hunter-l0cyMroinI0@public.gmane.org>
To: device-tree
	<devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org>,
	linux-omap <linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	linux-arm
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>
Cc: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	Vinod Koul <vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>,
	Dan Williams <djbw-b10kYP2dOMg@public.gmane.org>,
	Russell King <linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>
Subject: [PATCH V6 2/2] dmaengine: add helper function to request a slave DMA channel
Date: Fri, 14 Sep 2012 17:41:57 -0500	[thread overview]
Message-ID: <1347662517-4210-3-git-send-email-jon-hunter@ti.com> (raw)
In-Reply-To: <1347662517-4210-1-git-send-email-jon-hunter-l0cyMroinI0@public.gmane.org>

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 <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
Cc: Benoit Cousson <b-cousson-l0cyMroinI0@public.gmane.org>
Cc: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Cc: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
Cc: Russell King <linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>
Cc: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>
Cc: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
Cc: Vinod Koul <vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: Dan Williams <djbw-b10kYP2dOMg@public.gmane.org>

Acked-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
Signed-off-by: Jon Hunter <jon-hunter-l0cyMroinI0@public.gmane.org>
---
 drivers/dma/dmaengine.c   |   16 ++++++++++++++++
 include/linux/dmaengine.h |    6 ++++++
 2 files changed, 22 insertions(+)

diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index 3491654..9b466da 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -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);
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 9c02a45..9500aa5 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -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)
 {
 }
-- 
1.7.9.5

  parent reply	other threads:[~2012-09-14 22:41 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-14 22:41 [PATCH V6 0/2] of: Add generic device tree DMA helpers Jon Hunter
2012-09-14 22:41 ` [PATCH V6 1/2] " Jon Hunter
2012-09-14 22:46   ` Stephen Warren
2012-09-15  0:14   ` Russell King - ARM Linux
     [not found]     ` <20120915001431.GB12445-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2012-09-17 20:42       ` Arnd Bergmann
     [not found]         ` <201209172042.11860.arnd-r2nGTMty4D4@public.gmane.org>
2012-09-17 23:06           ` David Brown
     [not found]             ` <20120917230615.GA26502-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2012-09-18 12:50               ` Arnd Bergmann
2012-09-18 22:19         ` Mitch Bradley
     [not found]           ` <5058F35A.8040702-D5eQfiDGL7eakBO8gow8eQ@public.gmane.org>
2012-09-18 22:32             ` Russell King - ARM Linux
2012-09-19 11:09           ` Arnd Bergmann
     [not found]             ` <201209191109.16529.arnd-r2nGTMty4D4@public.gmane.org>
2012-09-19 14:40               ` Mitch Bradley
2012-09-19 13:52   ` Matt Porter
2012-09-19 14:07   ` Matt Porter
2012-09-19 14:24     ` Arnd Bergmann
2012-09-19 14:36       ` Rob Herring
2012-09-19 14:40         ` Matt Porter
2012-09-19 14:50           ` Arnd Bergmann
2012-09-19 21:25       ` Mitch Bradley
2012-09-19 14:10   ` Rob Herring
     [not found] ` <1347662517-4210-1-git-send-email-jon-hunter-l0cyMroinI0@public.gmane.org>
2012-09-14 22:41   ` Jon Hunter [this message]
2012-09-17  3:33     ` [PATCH V6 2/2] dmaengine: add helper function to request a slave DMA channel Vinod Koul
2012-09-17 11:59       ` Arnd Bergmann
2012-09-17 22:36         ` Russell King - ARM Linux
2012-09-18  3:13           ` Vinod Koul
2012-09-18 13:21             ` Matt Porter
2012-09-18 15:20               ` Arnd Bergmann
2012-09-18 18:10                 ` Russell King - ARM Linux
2012-09-24 22:25             ` Jon Hunter
2012-09-25  4:35               ` Vinod Koul
2012-10-16  2:43                 ` Shawn Guo
2012-10-16  2:39                   ` Vinod Koul
2012-11-09 20:01                     ` Jon Hunter
2012-11-16  1:37                       ` Vinod Koul
2012-11-16  8:39                         ` Nicolas Ferre
2012-11-16 15:45                         ` Jon Hunter
2012-11-28 17:06                           ` Vinod Koul
2012-12-19 17:12                         ` Jon Hunter
2012-12-20 14:57                           ` Vinod Koul
2012-09-18  3:00         ` Vinod Koul

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=1347662517-4210-3-git-send-email-jon-hunter@ti.com \
    --to=jon-hunter-l0cymroini0@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=djbw-b10kYP2dOMg@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org \
    --cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org \
    --cc=swarren-DDmLM1+adcrQT0dZR+AlfA@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).