diff mbox

[v12,09/11] spi: omap2-mcspi: convert to dma_request_slave_channel_compat()

Message ID 1371762407-24544-10-git-send-email-joelagnel@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Fernandes, Joel A June 20, 2013, 9:06 p.m. UTC
From: Matt Porter <mporter@ti.com>

Convert dmaengine channel requests to use
dma_request_slave_channel_compat(). This supports the DT case of
platforms requiring channel selection from either the OMAP DMA or
the EDMA engine. AM33xx only boots from DT and is the only user
implementing EDMA so in the !DT case we can default to the OMAP DMA
filter.

Signed-off-by: Matt Porter <mporter@ti.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Joel A Fernandes <joelagnel@ti.com>
---
 drivers/spi/spi-omap2-mcspi.c |   64 ++++++++++++++++++++++++++++-------------
 1 file changed, 44 insertions(+), 20 deletions(-)

Comments

Poddar, Sourav June 21, 2013, 10:26 a.m. UTC | #1
Hi Mark,
On Friday 21 June 2013 02:36 AM, Joel A Fernandes wrote:
> From: Matt Porter<mporter@ti.com>
>
> Convert dmaengine channel requests to use
> dma_request_slave_channel_compat(). This supports the DT case of
> platforms requiring channel selection from either the OMAP DMA or
> the EDMA engine. AM33xx only boots from DT and is the only user
> implementing EDMA so in the !DT case we can default to the OMAP DMA
> filter.
>
> Signed-off-by: Matt Porter<mporter@ti.com>
> Acked-by: Mark Brown<broonie@opensource.wolfsonmicro.com>
> Signed-off-by: Joel A Fernandes<joelagnel@ti.com>
> ---
>   drivers/spi/spi-omap2-mcspi.c |   64 ++++++++++++++++++++++++++++-------------
>   1 file changed, 44 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
> index 86d2158..ca4ab78 100644
> --- a/drivers/spi/spi-omap2-mcspi.c
> +++ b/drivers/spi/spi-omap2-mcspi.c
> @@ -102,6 +102,9 @@ struct omap2_mcspi_dma {
>
>   	struct completion dma_tx_completion;
>   	struct completion dma_rx_completion;
> +
> +	char dma_rx_ch_name[14];
> +	char dma_tx_ch_name[14];
>   };
>
>   /* use PIO for small transfers, avoiding DMA setup/teardown overhead and
> @@ -830,12 +833,20 @@ static int omap2_mcspi_request_dma(struct spi_device *spi)
>   	dma_cap_zero(mask);
>   	dma_cap_set(DMA_SLAVE, mask);
>   	sig = mcspi_dma->dma_rx_sync_dev;
> -	mcspi_dma->dma_rx = dma_request_channel(mask, omap_dma_filter_fn,&sig);
> +
> +	mcspi_dma->dma_rx =
> +		dma_request_slave_channel_compat(mask, omap_dma_filter_fn,
> +						&sig,&master->dev,
> +						 mcspi_dma->dma_rx_ch_name);
>   	if (!mcspi_dma->dma_rx)
>   		goto no_dma;
>
>   	sig = mcspi_dma->dma_tx_sync_dev;
> -	mcspi_dma->dma_tx = dma_request_channel(mask, omap_dma_filter_fn,&sig);
> +	mcspi_dma->dma_tx =
> +		dma_request_slave_channel_compat(mask, omap_dma_filter_fn,
> +						&sig,&master->dev,
> +						 mcspi_dma->dma_tx_ch_name);
> +
>   	if (!mcspi_dma->dma_tx) {
>   		dma_release_channel(mcspi_dma->dma_rx);
>   		mcspi_dma->dma_rx = NULL;
> @@ -1256,29 +1267,42 @@ static int omap2_mcspi_probe(struct platform_device *pdev)
>   		goto free_master;
>
>   	for (i = 0; i<  master->num_chipselect; i++) {
> -		char dma_ch_name[14];
> +		char *dma_rx_ch_name = mcspi->dma_channels[i].dma_rx_ch_name;
> +		char *dma_tx_ch_name = mcspi->dma_channels[i].dma_tx_ch_name;
>   		struct resource *dma_res;
>
> -		sprintf(dma_ch_name, "rx%d", i);
> -		dma_res = platform_get_resource_byname(pdev, IORESOURCE_DMA,
> -				dma_ch_name);
> -		if (!dma_res) {
> -			dev_dbg(&pdev->dev, "cannot get DMA RX channel\n");
> -			status = -ENODEV;
> -			break;
> -		}
> +		sprintf(dma_rx_ch_name, "rx%d", i);
> +		if (!pdev->dev.of_node) {
> +			dma_res =
> +				platform_get_resource_byname(pdev,
> +							     IORESOURCE_DMA,
> +							     dma_rx_ch_name);
> +			if (!dma_res) {
> +				dev_dbg(&pdev->dev,
> +					"cannot get DMA RX channel\n");
> +				status = -ENODEV;
> +				break;
> +			}
>
> -		mcspi->dma_channels[i].dma_rx_sync_dev = dma_res->start;
> -		sprintf(dma_ch_name, "tx%d", i);
> -		dma_res = platform_get_resource_byname(pdev, IORESOURCE_DMA,
> -				dma_ch_name);
> -		if (!dma_res) {
> -			dev_dbg(&pdev->dev, "cannot get DMA TX channel\n");
> -			status = -ENODEV;
> -			break;
> +			mcspi->dma_channels[i].dma_rx_sync_dev =
> +				dma_res->start;
>   		}
> +		sprintf(dma_tx_ch_name, "tx%d", i);
> +		if (!pdev->dev.of_node) {
> +			dma_res =
> +				platform_get_resource_byname(pdev,
> +							     IORESOURCE_DMA,
> +							     dma_tx_ch_name);
> +			if (!dma_res) {
> +				dev_dbg(&pdev->dev,
> +					"cannot get DMA TX channel\n");
> +				status = -ENODEV;
> +				break;
> +			}
>
> -		mcspi->dma_channels[i].dma_tx_sync_dev = dma_res->start;
> +			mcspi->dma_channels[i].dma_tx_sync_dev =
> +				dma_res->start;
> +		}
>   	}
>
>   	if (status<  0)
Acked-by: Sourav Poddar <sourav.poddar@ti.com>
Tested-by: Sourav Poddar <sourav.poddar@ti.com>

This patch can go independently and does not depend on the rest of the
series.
Can these patch be pulled?
Sekhar Nori June 21, 2013, 10:37 a.m. UTC | #2
Fixing Mark's e-mail.

Mark,

On 6/21/2013 3:56 PM, Sourav Poddar wrote:
> Hi Mark,

> On Friday 21 June 2013 02:36 AM, Joel A Fernandes wrote:
>> From: Matt Porter<mporter@ti.com>
>>
>> Convert dmaengine channel requests to use
>> dma_request_slave_channel_compat(). This supports the DT case of
>> platforms requiring channel selection from either the OMAP DMA or
>> the EDMA engine. AM33xx only boots from DT and is the only user
>> implementing EDMA so in the !DT case we can default to the OMAP DMA
>> filter.
>>
>> Signed-off-by: Matt Porter<mporter@ti.com>
>> Acked-by: Mark Brown<broonie@opensource.wolfsonmicro.com>
>> Signed-off-by: Joel A Fernandes<joelagnel@ti.com>

[...]

> Acked-by: Sourav Poddar <sourav.poddar@ti.com>
> Tested-by: Sourav Poddar <sourav.poddar@ti.com>
> 
> This patch can go independently and does not depend on the rest of the
> series.
> Can these patch be pulled?

We can resend the patch if you don't have it from the mailing list.

Thanks,
Sekhar
Mark Brown June 21, 2013, 11:28 a.m. UTC | #3
On Fri, Jun 21, 2013 at 04:07:51PM +0530, Sekhar Nori wrote:

> We can resend the patch if you don't have it from the mailing list.

I'll probably have it assuming it's been sent to some mailing list I
read (the CC list here looks absurldy large...) but if you don't send me
the patch and/or ignore bounces then it's going to take longer.
Poddar, Sourav June 21, 2013, 12:22 p.m. UTC | #4
Hi Mark,
On Friday 21 June 2013 04:58 PM, Mark Brown wrote:
> On Fri, Jun 21, 2013 at 04:07:51PM +0530, Sekhar Nori wrote:
>
>> We can resend the patch if you don't have it from the mailing list.
> I'll probably have it assuming it's been sent to some mailing list I
> read (the CC list here looks absurldy large...) but if you don't send me
> the patch and/or ignore bounces then it's going to take longer.
I have send you this patch seperately.

Thanks ,
Sourav
diff mbox

Patch

diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index 86d2158..ca4ab78 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -102,6 +102,9 @@  struct omap2_mcspi_dma {
 
 	struct completion dma_tx_completion;
 	struct completion dma_rx_completion;
+
+	char dma_rx_ch_name[14];
+	char dma_tx_ch_name[14];
 };
 
 /* use PIO for small transfers, avoiding DMA setup/teardown overhead and
@@ -830,12 +833,20 @@  static int omap2_mcspi_request_dma(struct spi_device *spi)
 	dma_cap_zero(mask);
 	dma_cap_set(DMA_SLAVE, mask);
 	sig = mcspi_dma->dma_rx_sync_dev;
-	mcspi_dma->dma_rx = dma_request_channel(mask, omap_dma_filter_fn, &sig);
+
+	mcspi_dma->dma_rx =
+		dma_request_slave_channel_compat(mask, omap_dma_filter_fn,
+						 &sig, &master->dev,
+						 mcspi_dma->dma_rx_ch_name);
 	if (!mcspi_dma->dma_rx)
 		goto no_dma;
 
 	sig = mcspi_dma->dma_tx_sync_dev;
-	mcspi_dma->dma_tx = dma_request_channel(mask, omap_dma_filter_fn, &sig);
+	mcspi_dma->dma_tx =
+		dma_request_slave_channel_compat(mask, omap_dma_filter_fn,
+						 &sig, &master->dev,
+						 mcspi_dma->dma_tx_ch_name);
+
 	if (!mcspi_dma->dma_tx) {
 		dma_release_channel(mcspi_dma->dma_rx);
 		mcspi_dma->dma_rx = NULL;
@@ -1256,29 +1267,42 @@  static int omap2_mcspi_probe(struct platform_device *pdev)
 		goto free_master;
 
 	for (i = 0; i < master->num_chipselect; i++) {
-		char dma_ch_name[14];
+		char *dma_rx_ch_name = mcspi->dma_channels[i].dma_rx_ch_name;
+		char *dma_tx_ch_name = mcspi->dma_channels[i].dma_tx_ch_name;
 		struct resource *dma_res;
 
-		sprintf(dma_ch_name, "rx%d", i);
-		dma_res = platform_get_resource_byname(pdev, IORESOURCE_DMA,
-				dma_ch_name);
-		if (!dma_res) {
-			dev_dbg(&pdev->dev, "cannot get DMA RX channel\n");
-			status = -ENODEV;
-			break;
-		}
+		sprintf(dma_rx_ch_name, "rx%d", i);
+		if (!pdev->dev.of_node) {
+			dma_res =
+				platform_get_resource_byname(pdev,
+							     IORESOURCE_DMA,
+							     dma_rx_ch_name);
+			if (!dma_res) {
+				dev_dbg(&pdev->dev,
+					"cannot get DMA RX channel\n");
+				status = -ENODEV;
+				break;
+			}
 
-		mcspi->dma_channels[i].dma_rx_sync_dev = dma_res->start;
-		sprintf(dma_ch_name, "tx%d", i);
-		dma_res = platform_get_resource_byname(pdev, IORESOURCE_DMA,
-				dma_ch_name);
-		if (!dma_res) {
-			dev_dbg(&pdev->dev, "cannot get DMA TX channel\n");
-			status = -ENODEV;
-			break;
+			mcspi->dma_channels[i].dma_rx_sync_dev =
+				dma_res->start;
 		}
+		sprintf(dma_tx_ch_name, "tx%d", i);
+		if (!pdev->dev.of_node) {
+			dma_res =
+				platform_get_resource_byname(pdev,
+							     IORESOURCE_DMA,
+							     dma_tx_ch_name);
+			if (!dma_res) {
+				dev_dbg(&pdev->dev,
+					"cannot get DMA TX channel\n");
+				status = -ENODEV;
+				break;
+			}
 
-		mcspi->dma_channels[i].dma_tx_sync_dev = dma_res->start;
+			mcspi->dma_channels[i].dma_tx_sync_dev =
+				dma_res->start;
+		}
 	}
 
 	if (status < 0)