public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH resend 2/2] dma: pl330: Use the common of_dma_xlate_by_chan_id
  2013-05-12 16:02 [PATCH resend 1/2] dma: of: Add common xlate function for matching by channel id Lars-Peter Clausen
@ 2013-05-12 16:02 ` Lars-Peter Clausen
  0 siblings, 0 replies; 3+ messages in thread
From: Lars-Peter Clausen @ 2013-05-12 16:02 UTC (permalink / raw)
  To: Vinod Koul, Dan Williams
  Cc: Jon Hunter, Padmavathi Venna, Arnd Bergmann, linux-kernel,
	Lars-Peter Clausen

Use the generic of_dma_xlate_by_chan_id xlate callback instead of a custom
implementation.

There is one minor difference between the generic of_dma_xlate_by_chan_id
function and the pl330 specific one. of_dma_xlate_by_chan_id only sets the
DMA_SLAVE capability for the channel capability mask, while the pl330 driver
additionally sets the DMA_CYCLIC capability. But since all pl330 channels which
have the DMA_SLAVE capability set also have DMA_CYCLIC capability set both
functions will have the same result.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 drivers/dma/pl330.c | 41 +----------------------------------------
 1 file changed, 1 insertion(+), 40 deletions(-)

diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index a17553f..c831fae 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -608,11 +608,6 @@ 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)
@@ -2358,16 +2353,6 @@ static void dma_pl330_rqcb(void *token, enum pl330_op_err err)
 	tasklet_schedule(&pch->task);
 }
 
-static bool pl330_dt_filter(struct dma_chan *chan, void *param)
-{
-	struct dma_pl330_filter_args *fargs = param;
-
-	if (chan->device != &fargs->pdmac->ddma)
-		return false;
-
-	return (chan->chan_id == fargs->chan_id);
-}
-
 bool pl330_filter(struct dma_chan *chan, void *param)
 {
 	u8 *peri_id;
@@ -2380,30 +2365,6 @@ bool pl330_filter(struct dma_chan *chan, void *param)
 }
 EXPORT_SYMBOL(pl330_filter);
 
-static 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_dt_filter, &fargs);
-}
-
 static int pl330_alloc_chan_resources(struct dma_chan *chan)
 {
 	struct dma_pl330_chan *pch = to_pchan(chan);
@@ -2989,7 +2950,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
 
 	if (adev->dev.of_node) {
 		ret = of_dma_controller_register(adev->dev.of_node,
-					 of_dma_pl330_xlate, pdmac);
+					 of_dma_pl330_xlate, pd);
 		if (ret) {
 			dev_err(&adev->dev,
 			"unable to register DMA to the generic DT DMA helpers\n");
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH resend 2/2] dma: pl330: Use the common of_dma_xlate_by_chan_id
@ 2013-05-14  8:53 PADMAVATHI VENNA
  2013-05-14  9:08 ` Lars-Peter Clausen
  0 siblings, 1 reply; 3+ messages in thread
From: PADMAVATHI VENNA @ 2013-05-14  8:53 UTC (permalink / raw)
  To: Lars-Peter Clausen, Vinod Koul, Dan Williams
  Cc: Jon Hunter, Arnd Bergmann, linux-kernel@vger.kernel.org

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=windows-1252, Size: 3117 bytes --]

Hi Lars,

As I remember Vinod had asked you to keep DMA_CYCLIC capability on both controller and client side.  But I didn't see in this patch set. 
Otherwise your patches looks good to me.

Thanks
Padma
------- Original Message -------
Sender : Lars-Peter Clausen<lars@metafoo.de>
Date : May 13, 2013 01:02 (GMT+09:00)
Title : [PATCH resend 2/2] dma: pl330: Use the common of_dma_xlate_by_chan_id

Use the generic of_dma_xlate_by_chan_id xlate callback instead of a custom
implementation.

There is one minor difference between the generic of_dma_xlate_by_chan_id
function and the pl330 specific one. of_dma_xlate_by_chan_id only sets the
DMA_SLAVE capability for the channel capability mask, while the pl330 driver
additionally sets the DMA_CYCLIC capability. But since all pl330 channels which
have the DMA_SLAVE capability set also have DMA_CYCLIC capability set both
functions will have the same result.

Signed-off-by: Lars-Peter Clausen 
---
drivers/dma/pl330.c | 41 +----------------------------------------
1 file changed, 1 insertion(+), 40 deletions(-)

diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index a17553f..c831fae 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -608,11 +608,6 @@ 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)
@@ -2358,16 +2353,6 @@ static void dma_pl330_rqcb(void *token, enum pl330_op_err err)
tasklet_schedule(&pch->task);
}

-static bool pl330_dt_filter(struct dma_chan *chan, void *param)
-{
- struct dma_pl330_filter_args *fargs = param;
-
- if (chan->device != &fargs->pdmac->ddma)
- return false;
-
- return (chan->chan_id == fargs->chan_id);
-}
-
bool pl330_filter(struct dma_chan *chan, void *param)
{
u8 *peri_id;
@@ -2380,30 +2365,6 @@ bool pl330_filter(struct dma_chan *chan, void *param)
}
EXPORT_SYMBOL(pl330_filter);

-static 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_dt_filter, &fargs);
-}
-
static int pl330_alloc_chan_resources(struct dma_chan *chan)
{
struct dma_pl330_chan *pch = to_pchan(chan);
@@ -2989,7 +2950,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)

if (adev->dev.of_node) {
ret = of_dma_controller_register(adev->dev.of_node,
- of_dma_pl330_xlate, pdmac);
+ of_dma_pl330_xlate, pd);
if (ret) {
dev_err(&adev->dev,
"unable to register DMA to the generic DT DMA helpers\n");
-- 
1.8.0ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH resend 2/2] dma: pl330: Use the common of_dma_xlate_by_chan_id
  2013-05-14  8:53 [PATCH resend 2/2] dma: pl330: Use the common of_dma_xlate_by_chan_id PADMAVATHI VENNA
@ 2013-05-14  9:08 ` Lars-Peter Clausen
  0 siblings, 0 replies; 3+ messages in thread
From: Lars-Peter Clausen @ 2013-05-14  9:08 UTC (permalink / raw)
  To: padma.v
  Cc: Vinod Koul, Dan Williams, Jon Hunter, Arnd Bergmann,
	linux-kernel@vger.kernel.org

On 05/14/2013 10:53 AM, PADMAVATHI VENNA wrote:
> Hi Lars,
> 
> As I remember Vinod had asked you to keep DMA_CYCLIC capability on both controller and client side.  But I didn't see in this patch set. 

That doesn't make too much sense, since it means you'd only be able to
request channels for controllers which support cyclic transfers.

> Otherwise your patches looks good to me.
> 
> Thanks
> Padma
> ------- Original Message -------
> Sender : Lars-Peter Clausen<lars@metafoo.de>
> Date : May 13, 2013 01:02 (GMT+09:00)
> Title : [PATCH resend 2/2] dma: pl330: Use the common of_dma_xlate_by_chan_id
> 
> Use the generic of_dma_xlate_by_chan_id xlate callback instead of a custom
> implementation.
> 
> There is one minor difference between the generic of_dma_xlate_by_chan_id
> function and the pl330 specific one. of_dma_xlate_by_chan_id only sets the
> DMA_SLAVE capability for the channel capability mask, while the pl330 driver
> additionally sets the DMA_CYCLIC capability. But since all pl330 channels which
> have the DMA_SLAVE capability set also have DMA_CYCLIC capability set both
> functions will have the same result.
> 
> Signed-off-by: Lars-Peter Clausen 
> ---
> drivers/dma/pl330.c | 41 +----------------------------------------
> 1 file changed, 1 insertion(+), 40 deletions(-)
> 
> diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
> index a17553f..c831fae 100644
> --- a/drivers/dma/pl330.c
> +++ b/drivers/dma/pl330.c
> @@ -608,11 +608,6 @@ 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)
> @@ -2358,16 +2353,6 @@ static void dma_pl330_rqcb(void *token, enum pl330_op_err err)
> tasklet_schedule(&pch->task);
> }
> 
> -static bool pl330_dt_filter(struct dma_chan *chan, void *param)
> -{
> - struct dma_pl330_filter_args *fargs = param;
> -
> - if (chan->device != &fargs->pdmac->ddma)
> - return false;
> -
> - return (chan->chan_id == fargs->chan_id);
> -}
> -
> bool pl330_filter(struct dma_chan *chan, void *param)
> {
> u8 *peri_id;
> @@ -2380,30 +2365,6 @@ bool pl330_filter(struct dma_chan *chan, void *param)
> }
> EXPORT_SYMBOL(pl330_filter);
> 
> -static 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_dt_filter, &fargs);
> -}
> -
> static int pl330_alloc_chan_resources(struct dma_chan *chan)
> {
> struct dma_pl330_chan *pch = to_pchan(chan);
> @@ -2989,7 +2950,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
> 
> if (adev->dev.of_node) {
> ret = of_dma_controller_register(adev->dev.of_node,
> - of_dma_pl330_xlate, pdmac);
> + of_dma_pl330_xlate, pd);
> if (ret) {
> dev_err(&adev->dev,
> "unable to register DMA to the generic DT DMA helpers\n");


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-05-14  9:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-14  8:53 [PATCH resend 2/2] dma: pl330: Use the common of_dma_xlate_by_chan_id PADMAVATHI VENNA
2013-05-14  9:08 ` Lars-Peter Clausen
  -- strict thread matches above, loose matches on Subject: below --
2013-05-12 16:02 [PATCH resend 1/2] dma: of: Add common xlate function for matching by channel id Lars-Peter Clausen
2013-05-12 16:02 ` [PATCH resend 2/2] dma: pl330: Use the common of_dma_xlate_by_chan_id Lars-Peter Clausen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox