All of lore.kernel.org
 help / color / mirror / Atom feed
From: Padmavathi Venna <padma.v@samsung.com>
To: linux-samsung-soc@vger.kernel.org,
	devicetree-discuss@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org, padma.v@samsung.com,
	padma.kvr@gmail.com
Cc: sbkim73@samsung.com, broonie@opensource.wolfsonmicro.com,
	kgene.kim@samsung.com, jassisinghbrar@gmail.com, arnd@arndb.de,
	vinod.koul@intel.com, grant.likely@secretlab.ca,
	jon-hunter@ti.com, boojin.kim@samsung.com,
	thomas.abraham@linaro.org
Subject: [PATCH V2 1/4] DMA: PL330: Add xlate function
Date: Fri, 01 Feb 2013 18:21:53 +0530	[thread overview]
Message-ID: <1359723116-18173-2-git-send-email-padma.v@samsung.com> (raw)
In-Reply-To: <1359723116-18173-1-git-send-email-padma.v@samsung.com>

Add xlate to translate the device-tree binding information into
the appropriate format. The filter function requires the dma
controller device and dma channel number as filter_params.

Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
---
 drivers/dma/pl330.c |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index 80680ee..6196cc0 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -25,6 +25,7 @@
 #include <linux/amba/pl330.h>
 #include <linux/scatterlist.h>
 #include <linux/of.h>
+#include <linux/of_dma.h>
 
 #include "dmaengine.h"
 #define PL330_MAX_CHAN		8
@@ -606,6 +607,11 @@ struct dma_pl330_desc {
 	struct dma_pl330_chan *pchan;
 };
 
+struct dma_pl330_filter_args {
+	struct dma_pl330_dmac *pdmac;
+	unsigned int chan_id;
+};
+
 static inline void _callback(struct pl330_req *r, enum pl330_op_err err)
 {
 	if (r && r->xfer_cb)
@@ -2352,6 +2358,31 @@ static void dma_pl330_rqcb(void *token, enum pl330_op_err err)
 	tasklet_schedule(&pch->task);
 }
 
+struct dma_chan *of_dma_pl330_xlate(struct of_phandle_args *dma_spec,
+						struct of_dma *ofdma)
+{
+	int count = dma_spec->args_count;
+	struct dma_pl330_dmac *pdmac = ofdma->of_dma_data;
+	struct dma_pl330_filter_args fargs;
+	dma_cap_mask_t cap;
+
+	if (!pdmac)
+		return NULL;
+
+	if (count != 1)
+		return NULL;
+
+	fargs.pdmac = pdmac;
+	fargs.chan_id = dma_spec->args[0];
+
+	dma_cap_zero(cap);
+	dma_cap_set(DMA_SLAVE, cap);
+	dma_cap_set(DMA_CYCLIC, cap);
+
+	return dma_request_channel(cap, pl330_filter, &fargs);
+}
+EXPORT_SYMBOL_GPL(of_dma_pl330_xlate);
+
 bool pl330_filter(struct dma_chan *chan, void *param)
 {
 	u8 *peri_id;
-- 
1.7.4.4

WARNING: multiple messages have this Message-ID (diff)
From: padma.v@samsung.com (Padmavathi Venna)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V2 1/4] DMA: PL330: Add xlate function
Date: Fri, 01 Feb 2013 18:21:53 +0530	[thread overview]
Message-ID: <1359723116-18173-2-git-send-email-padma.v@samsung.com> (raw)
In-Reply-To: <1359723116-18173-1-git-send-email-padma.v@samsung.com>

Add xlate to translate the device-tree binding information into
the appropriate format. The filter function requires the dma
controller device and dma channel number as filter_params.

Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
---
 drivers/dma/pl330.c |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index 80680ee..6196cc0 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -25,6 +25,7 @@
 #include <linux/amba/pl330.h>
 #include <linux/scatterlist.h>
 #include <linux/of.h>
+#include <linux/of_dma.h>
 
 #include "dmaengine.h"
 #define PL330_MAX_CHAN		8
@@ -606,6 +607,11 @@ struct dma_pl330_desc {
 	struct dma_pl330_chan *pchan;
 };
 
+struct dma_pl330_filter_args {
+	struct dma_pl330_dmac *pdmac;
+	unsigned int chan_id;
+};
+
 static inline void _callback(struct pl330_req *r, enum pl330_op_err err)
 {
 	if (r && r->xfer_cb)
@@ -2352,6 +2358,31 @@ static void dma_pl330_rqcb(void *token, enum pl330_op_err err)
 	tasklet_schedule(&pch->task);
 }
 
+struct dma_chan *of_dma_pl330_xlate(struct of_phandle_args *dma_spec,
+						struct of_dma *ofdma)
+{
+	int count = dma_spec->args_count;
+	struct dma_pl330_dmac *pdmac = ofdma->of_dma_data;
+	struct dma_pl330_filter_args fargs;
+	dma_cap_mask_t cap;
+
+	if (!pdmac)
+		return NULL;
+
+	if (count != 1)
+		return NULL;
+
+	fargs.pdmac = pdmac;
+	fargs.chan_id = dma_spec->args[0];
+
+	dma_cap_zero(cap);
+	dma_cap_set(DMA_SLAVE, cap);
+	dma_cap_set(DMA_CYCLIC, cap);
+
+	return dma_request_channel(cap, pl330_filter, &fargs);
+}
+EXPORT_SYMBOL_GPL(of_dma_pl330_xlate);
+
 bool pl330_filter(struct dma_chan *chan, void *param)
 {
 	u8 *peri_id;
-- 
1.7.4.4

  reply	other threads:[~2013-02-01 12:51 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-01 12:51 [PATCH V2 0/4] Add generic DMA DT binding support Padmavathi Venna
2013-02-01 12:51 ` Padmavathi Venna
2013-02-01 12:51 ` Padmavathi Venna [this message]
2013-02-01 12:51   ` [PATCH V2 1/4] DMA: PL330: Add xlate function Padmavathi Venna
2013-02-01 14:57   ` Arnd Bergmann
2013-02-01 14:57     ` Arnd Bergmann
     [not found] ` <1359723116-18173-1-git-send-email-padma.v-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-02-01 12:51   ` [PATCH V2 2/4] DMA: PL330: Register the DMA controller with the generic DMA helpers Padmavathi Venna
2013-02-01 12:51     ` Padmavathi Venna
2013-02-01 14:58     ` Arnd Bergmann
2013-02-01 14:58       ` Arnd Bergmann
2013-02-01 12:51   ` [PATCH V2 3/4] ARM: dts: Add #dma-cells for generic dma binding support Padmavathi Venna
2013-02-01 12:51     ` Padmavathi Venna
2013-02-01 15:16     ` Arnd Bergmann
2013-02-01 15:16       ` Arnd Bergmann
2013-02-01 12:51   ` [PATCH V2 4/4] DMA: PL330: Modify pl330 filter based on new generic dma dt bindings Padmavathi Venna
2013-02-01 12:51     ` Padmavathi Venna
2013-02-01 15:23     ` Arnd Bergmann
2013-02-01 15:23       ` Arnd Bergmann
2013-02-02  2:30       ` Padma Venkat
2013-02-02  2:30         ` Padma Venkat
2013-02-02 15:09         ` Arnd Bergmann
2013-02-02 15:09           ` Arnd Bergmann
2013-02-04  5:21           ` Padma Venkat
2013-02-04  5:21             ` Padma Venkat

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=1359723116-18173-2-git-send-email-padma.v@samsung.com \
    --to=padma.v@samsung.com \
    --cc=arnd@arndb.de \
    --cc=boojin.kim@samsung.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@secretlab.ca \
    --cc=jassisinghbrar@gmail.com \
    --cc=jon-hunter@ti.com \
    --cc=kgene.kim@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=padma.kvr@gmail.com \
    --cc=sbkim73@samsung.com \
    --cc=thomas.abraham@linaro.org \
    --cc=vinod.koul@intel.com \
    /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.