All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] mmc: sh_mmcif: add support for Device Tree DMA bindings
@ 2013-06-24 12:36 ` Guennadi Liakhovetski
  0 siblings, 0 replies; 6+ messages in thread
From: Guennadi Liakhovetski @ 2013-06-24 12:36 UTC (permalink / raw)
  To: linux-mmc; +Cc: linux-sh, Chris Ball, Magnus Damm

To use DMA in the Device Tree case the driver has to be modified
to use suitable API to obtain DMA channels.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
---

v2: use an "else if"

 drivers/mmc/host/sh_mmcif.c |   26 ++++++++++++++++----------
 1 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
index ba76a53..4fff404 100644
--- a/drivers/mmc/host/sh_mmcif.c
+++ b/drivers/mmc/host/sh_mmcif.c
@@ -386,25 +386,29 @@ static void sh_mmcif_request_dma(struct sh_mmcif_host *host,
 
 	host->dma_active = false;
 
-	if (!pdata)
-		return;
-
-	if (pdata->slave_id_tx <= 0 || pdata->slave_id_rx <= 0)
+	if (pdata) {
+		if (pdata->slave_id_tx <= 0 || pdata->slave_id_rx <= 0)
+			return;
+	} else if (!host->pd->dev.of_node) {
 		return;
+	}
 
 	/* We can only either use DMA for both Tx and Rx or not use it at all */
 	dma_cap_zero(mask);
 	dma_cap_set(DMA_SLAVE, mask);
 
-	host->chan_tx = dma_request_channel(mask, shdma_chan_filter,
-					    (void *)pdata->slave_id_tx);
+	host->chan_tx = dma_request_slave_channel_compat(mask, shdma_chan_filter,
+				pdata ? (void *)pdata->slave_id_tx : NULL,
+				&host->pd->dev, "tx");
 	dev_dbg(&host->pd->dev, "%s: TX: got channel %p\n", __func__,
 		host->chan_tx);
 
 	if (!host->chan_tx)
 		return;
 
-	cfg.slave_id = pdata->slave_id_tx;
+	/* In the OF case the driver will get the slave ID from the DT */
+	if (pdata)
+		cfg.slave_id = pdata->slave_id_tx;
 	cfg.direction = DMA_MEM_TO_DEV;
 	cfg.dst_addr = res->start + MMCIF_CE_DATA;
 	cfg.src_addr = 0;
@@ -412,15 +416,17 @@ static void sh_mmcif_request_dma(struct sh_mmcif_host *host,
 	if (ret < 0)
 		goto ecfgtx;
 
-	host->chan_rx = dma_request_channel(mask, shdma_chan_filter,
-					    (void *)pdata->slave_id_rx);
+	host->chan_rx = dma_request_slave_channel_compat(mask, shdma_chan_filter,
+				pdata ? (void *)pdata->slave_id_rx : NULL,
+				&host->pd->dev, "rx");
 	dev_dbg(&host->pd->dev, "%s: RX: got channel %p\n", __func__,
 		host->chan_rx);
 
 	if (!host->chan_rx)
 		goto erqrx;
 
-	cfg.slave_id = pdata->slave_id_rx;
+	if (pdata)
+		cfg.slave_id = pdata->slave_id_rx;
 	cfg.direction = DMA_DEV_TO_MEM;
 	cfg.dst_addr = 0;
 	cfg.src_addr = res->start + MMCIF_CE_DATA;
-- 
1.7.2.5


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

* [PATCH v2] mmc: sh_mmcif: add support for Device Tree DMA bindings
@ 2013-06-24 12:36 ` Guennadi Liakhovetski
  0 siblings, 0 replies; 6+ messages in thread
From: Guennadi Liakhovetski @ 2013-06-24 12:36 UTC (permalink / raw)
  To: linux-mmc; +Cc: linux-sh, Chris Ball, Magnus Damm

To use DMA in the Device Tree case the driver has to be modified
to use suitable API to obtain DMA channels.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
---

v2: use an "else if"

 drivers/mmc/host/sh_mmcif.c |   26 ++++++++++++++++----------
 1 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
index ba76a53..4fff404 100644
--- a/drivers/mmc/host/sh_mmcif.c
+++ b/drivers/mmc/host/sh_mmcif.c
@@ -386,25 +386,29 @@ static void sh_mmcif_request_dma(struct sh_mmcif_host *host,
 
 	host->dma_active = false;
 
-	if (!pdata)
-		return;
-
-	if (pdata->slave_id_tx <= 0 || pdata->slave_id_rx <= 0)
+	if (pdata) {
+		if (pdata->slave_id_tx <= 0 || pdata->slave_id_rx <= 0)
+			return;
+	} else if (!host->pd->dev.of_node) {
 		return;
+	}
 
 	/* We can only either use DMA for both Tx and Rx or not use it at all */
 	dma_cap_zero(mask);
 	dma_cap_set(DMA_SLAVE, mask);
 
-	host->chan_tx = dma_request_channel(mask, shdma_chan_filter,
-					    (void *)pdata->slave_id_tx);
+	host->chan_tx = dma_request_slave_channel_compat(mask, shdma_chan_filter,
+				pdata ? (void *)pdata->slave_id_tx : NULL,
+				&host->pd->dev, "tx");
 	dev_dbg(&host->pd->dev, "%s: TX: got channel %p\n", __func__,
 		host->chan_tx);
 
 	if (!host->chan_tx)
 		return;
 
-	cfg.slave_id = pdata->slave_id_tx;
+	/* In the OF case the driver will get the slave ID from the DT */
+	if (pdata)
+		cfg.slave_id = pdata->slave_id_tx;
 	cfg.direction = DMA_MEM_TO_DEV;
 	cfg.dst_addr = res->start + MMCIF_CE_DATA;
 	cfg.src_addr = 0;
@@ -412,15 +416,17 @@ static void sh_mmcif_request_dma(struct sh_mmcif_host *host,
 	if (ret < 0)
 		goto ecfgtx;
 
-	host->chan_rx = dma_request_channel(mask, shdma_chan_filter,
-					    (void *)pdata->slave_id_rx);
+	host->chan_rx = dma_request_slave_channel_compat(mask, shdma_chan_filter,
+				pdata ? (void *)pdata->slave_id_rx : NULL,
+				&host->pd->dev, "rx");
 	dev_dbg(&host->pd->dev, "%s: RX: got channel %p\n", __func__,
 		host->chan_rx);
 
 	if (!host->chan_rx)
 		goto erqrx;
 
-	cfg.slave_id = pdata->slave_id_rx;
+	if (pdata)
+		cfg.slave_id = pdata->slave_id_rx;
 	cfg.direction = DMA_DEV_TO_MEM;
 	cfg.dst_addr = 0;
 	cfg.src_addr = res->start + MMCIF_CE_DATA;
-- 
1.7.2.5


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

* Re: [PATCH v2] mmc: sh_mmcif: add support for Device Tree DMA bindings
  2013-06-24 12:36 ` Guennadi Liakhovetski
@ 2013-07-02 13:52   ` Guennadi Liakhovetski
  -1 siblings, 0 replies; 6+ messages in thread
From: Guennadi Liakhovetski @ 2013-07-02 13:52 UTC (permalink / raw)
  To: linux-mmc; +Cc: linux-sh, Chris Ball, Magnus Damm

Hi Chris

What's the plan about this patch? Do you think you'd be able to push it 
for 3.11 or rather 3.12?

Thanks
Guennadi

On Mon, 24 Jun 2013, Guennadi Liakhovetski wrote:

> To use DMA in the Device Tree case the driver has to be modified
> to use suitable API to obtain DMA channels.
> 
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
> ---
> 
> v2: use an "else if"
> 
>  drivers/mmc/host/sh_mmcif.c |   26 ++++++++++++++++----------
>  1 files changed, 16 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
> index ba76a53..4fff404 100644
> --- a/drivers/mmc/host/sh_mmcif.c
> +++ b/drivers/mmc/host/sh_mmcif.c
> @@ -386,25 +386,29 @@ static void sh_mmcif_request_dma(struct sh_mmcif_host *host,
>  
>  	host->dma_active = false;
>  
> -	if (!pdata)
> -		return;
> -
> -	if (pdata->slave_id_tx <= 0 || pdata->slave_id_rx <= 0)
> +	if (pdata) {
> +		if (pdata->slave_id_tx <= 0 || pdata->slave_id_rx <= 0)
> +			return;
> +	} else if (!host->pd->dev.of_node) {
>  		return;
> +	}
>  
>  	/* We can only either use DMA for both Tx and Rx or not use it at all */
>  	dma_cap_zero(mask);
>  	dma_cap_set(DMA_SLAVE, mask);
>  
> -	host->chan_tx = dma_request_channel(mask, shdma_chan_filter,
> -					    (void *)pdata->slave_id_tx);
> +	host->chan_tx = dma_request_slave_channel_compat(mask, shdma_chan_filter,
> +				pdata ? (void *)pdata->slave_id_tx : NULL,
> +				&host->pd->dev, "tx");
>  	dev_dbg(&host->pd->dev, "%s: TX: got channel %p\n", __func__,
>  		host->chan_tx);
>  
>  	if (!host->chan_tx)
>  		return;
>  
> -	cfg.slave_id = pdata->slave_id_tx;
> +	/* In the OF case the driver will get the slave ID from the DT */
> +	if (pdata)
> +		cfg.slave_id = pdata->slave_id_tx;
>  	cfg.direction = DMA_MEM_TO_DEV;
>  	cfg.dst_addr = res->start + MMCIF_CE_DATA;
>  	cfg.src_addr = 0;
> @@ -412,15 +416,17 @@ static void sh_mmcif_request_dma(struct sh_mmcif_host *host,
>  	if (ret < 0)
>  		goto ecfgtx;
>  
> -	host->chan_rx = dma_request_channel(mask, shdma_chan_filter,
> -					    (void *)pdata->slave_id_rx);
> +	host->chan_rx = dma_request_slave_channel_compat(mask, shdma_chan_filter,
> +				pdata ? (void *)pdata->slave_id_rx : NULL,
> +				&host->pd->dev, "rx");
>  	dev_dbg(&host->pd->dev, "%s: RX: got channel %p\n", __func__,
>  		host->chan_rx);
>  
>  	if (!host->chan_rx)
>  		goto erqrx;
>  
> -	cfg.slave_id = pdata->slave_id_rx;
> +	if (pdata)
> +		cfg.slave_id = pdata->slave_id_rx;
>  	cfg.direction = DMA_DEV_TO_MEM;
>  	cfg.dst_addr = 0;
>  	cfg.src_addr = res->start + MMCIF_CE_DATA;
> -- 
> 1.7.2.5
> 
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

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

* Re: [PATCH v2] mmc: sh_mmcif: add support for Device Tree DMA bindings
@ 2013-07-02 13:52   ` Guennadi Liakhovetski
  0 siblings, 0 replies; 6+ messages in thread
From: Guennadi Liakhovetski @ 2013-07-02 13:52 UTC (permalink / raw)
  To: linux-mmc; +Cc: linux-sh, Chris Ball, Magnus Damm

Hi Chris

What's the plan about this patch? Do you think you'd be able to push it 
for 3.11 or rather 3.12?

Thanks
Guennadi

On Mon, 24 Jun 2013, Guennadi Liakhovetski wrote:

> To use DMA in the Device Tree case the driver has to be modified
> to use suitable API to obtain DMA channels.
> 
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
> ---
> 
> v2: use an "else if"
> 
>  drivers/mmc/host/sh_mmcif.c |   26 ++++++++++++++++----------
>  1 files changed, 16 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
> index ba76a53..4fff404 100644
> --- a/drivers/mmc/host/sh_mmcif.c
> +++ b/drivers/mmc/host/sh_mmcif.c
> @@ -386,25 +386,29 @@ static void sh_mmcif_request_dma(struct sh_mmcif_host *host,
>  
>  	host->dma_active = false;
>  
> -	if (!pdata)
> -		return;
> -
> -	if (pdata->slave_id_tx <= 0 || pdata->slave_id_rx <= 0)
> +	if (pdata) {
> +		if (pdata->slave_id_tx <= 0 || pdata->slave_id_rx <= 0)
> +			return;
> +	} else if (!host->pd->dev.of_node) {
>  		return;
> +	}
>  
>  	/* We can only either use DMA for both Tx and Rx or not use it at all */
>  	dma_cap_zero(mask);
>  	dma_cap_set(DMA_SLAVE, mask);
>  
> -	host->chan_tx = dma_request_channel(mask, shdma_chan_filter,
> -					    (void *)pdata->slave_id_tx);
> +	host->chan_tx = dma_request_slave_channel_compat(mask, shdma_chan_filter,
> +				pdata ? (void *)pdata->slave_id_tx : NULL,
> +				&host->pd->dev, "tx");
>  	dev_dbg(&host->pd->dev, "%s: TX: got channel %p\n", __func__,
>  		host->chan_tx);
>  
>  	if (!host->chan_tx)
>  		return;
>  
> -	cfg.slave_id = pdata->slave_id_tx;
> +	/* In the OF case the driver will get the slave ID from the DT */
> +	if (pdata)
> +		cfg.slave_id = pdata->slave_id_tx;
>  	cfg.direction = DMA_MEM_TO_DEV;
>  	cfg.dst_addr = res->start + MMCIF_CE_DATA;
>  	cfg.src_addr = 0;
> @@ -412,15 +416,17 @@ static void sh_mmcif_request_dma(struct sh_mmcif_host *host,
>  	if (ret < 0)
>  		goto ecfgtx;
>  
> -	host->chan_rx = dma_request_channel(mask, shdma_chan_filter,
> -					    (void *)pdata->slave_id_rx);
> +	host->chan_rx = dma_request_slave_channel_compat(mask, shdma_chan_filter,
> +				pdata ? (void *)pdata->slave_id_rx : NULL,
> +				&host->pd->dev, "rx");
>  	dev_dbg(&host->pd->dev, "%s: RX: got channel %p\n", __func__,
>  		host->chan_rx);
>  
>  	if (!host->chan_rx)
>  		goto erqrx;
>  
> -	cfg.slave_id = pdata->slave_id_rx;
> +	if (pdata)
> +		cfg.slave_id = pdata->slave_id_rx;
>  	cfg.direction = DMA_DEV_TO_MEM;
>  	cfg.dst_addr = 0;
>  	cfg.src_addr = res->start + MMCIF_CE_DATA;
> -- 
> 1.7.2.5
> 
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

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

* Re: [PATCH v2] mmc: sh_mmcif: add support for Device Tree DMA bindings
  2013-06-24 12:36 ` Guennadi Liakhovetski
@ 2013-08-25  4:11   ` Chris Ball
  -1 siblings, 0 replies; 6+ messages in thread
From: Chris Ball @ 2013-08-25  4:11 UTC (permalink / raw)
  To: Guennadi Liakhovetski; +Cc: linux-mmc, linux-sh, Magnus Damm

Hi Guennadi,

On Mon, Jun 24 2013, Guennadi Liakhovetski wrote:
> To use DMA in the Device Tree case the driver has to be modified
> to use suitable API to obtain DMA channels.
>
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>

Thanks, pushed to mmc-next for 3.12.

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>

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

* Re: [PATCH v2] mmc: sh_mmcif: add support for Device Tree DMA bindings
@ 2013-08-25  4:11   ` Chris Ball
  0 siblings, 0 replies; 6+ messages in thread
From: Chris Ball @ 2013-08-25  4:11 UTC (permalink / raw)
  To: Guennadi Liakhovetski; +Cc: linux-mmc, linux-sh, Magnus Damm

Hi Guennadi,

On Mon, Jun 24 2013, Guennadi Liakhovetski wrote:
> To use DMA in the Device Tree case the driver has to be modified
> to use suitable API to obtain DMA channels.
>
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>

Thanks, pushed to mmc-next for 3.12.

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>

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

end of thread, other threads:[~2013-08-25  4:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-24 12:36 [PATCH v2] mmc: sh_mmcif: add support for Device Tree DMA bindings Guennadi Liakhovetski
2013-06-24 12:36 ` Guennadi Liakhovetski
2013-07-02 13:52 ` Guennadi Liakhovetski
2013-07-02 13:52   ` Guennadi Liakhovetski
2013-08-25  4:11 ` Chris Ball
2013-08-25  4:11   ` Chris Ball

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.