linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] mmc: atmel-mci: cleanup and probe deferring
@ 2014-11-21 15:33 Ludovic Desroches
  2014-11-21 15:33 ` [PATCH v2 1/4] mmc: atmel-mci: remove useless DMA stuff for non-dt devices Ludovic Desroches
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Ludovic Desroches @ 2014-11-21 15:33 UTC (permalink / raw)
  To: linux-mmc, linux-arm-kernel
  Cc: ulf.hansson, chris, nicolas.ferre, arnd, Ludovic Desroches

Hi,

Some cleanup to introduce probe deferring if dma controller is not probed.

The purpose of this second version is to have the __init/__exit attributes
removal in a patch that can be backported into stable kernels.

Ludovic Desroches (4):
  mmc: atmel-mci: remove useless DMA stuff for non-dt devices
  mmc: atmel-mci: remove __init/__exit attributes
  mmc: atmel-mci: stop using specific initcall
  mmc: atmel-mci: use probe deferring if dma controller is not ready yet

 drivers/mmc/host/atmel-mci.c | 75 ++++++++++++++++++--------------------------
 1 file changed, 30 insertions(+), 45 deletions(-)

-- 
2.0.3


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

* [PATCH v2 1/4] mmc: atmel-mci: remove useless DMA stuff for non-dt devices
  2014-11-21 15:33 [PATCH v2 0/4] mmc: atmel-mci: cleanup and probe deferring Ludovic Desroches
@ 2014-11-21 15:33 ` Ludovic Desroches
  2014-11-21 15:33 ` [PATCH v2 2/4] mmc: atmel-mci: remove __init/__exit attributes Ludovic Desroches
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Ludovic Desroches @ 2014-11-21 15:33 UTC (permalink / raw)
  To: linux-mmc, linux-arm-kernel
  Cc: ulf.hansson, chris, nicolas.ferre, arnd, Ludovic Desroches

All devices with a DMA controller are DT compliant and legacy support
has been removed. For those reasons, some DMA stuff is useless.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
---
 drivers/mmc/host/atmel-mci.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index ba38f94..b9226b3 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -2267,17 +2267,9 @@ static void atmci_cleanup_slot(struct atmel_mci_slot *slot,
 
 static bool atmci_configure_dma(struct atmel_mci *host)
 {
-	struct mci_platform_data	*pdata;
-	dma_cap_mask_t mask;
-
 	if (host == NULL)
 		return false;
 
-	pdata = host->pdev->dev.platform_data;
-
-	dma_cap_zero(mask);
-	dma_cap_set(DMA_SLAVE, mask);
-
 	host->dma.chan = dma_request_slave_channel(&host->pdev->dev, "rxtx");
 	if (!host->dma.chan) {
 		dev_warn(&host->pdev->dev, "no DMA channel available\n");
-- 
2.0.3


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

* [PATCH v2 2/4] mmc: atmel-mci: remove __init/__exit attributes
  2014-11-21 15:33 [PATCH v2 0/4] mmc: atmel-mci: cleanup and probe deferring Ludovic Desroches
  2014-11-21 15:33 ` [PATCH v2 1/4] mmc: atmel-mci: remove useless DMA stuff for non-dt devices Ludovic Desroches
@ 2014-11-21 15:33 ` Ludovic Desroches
  2014-11-21 15:33 ` [PATCH v2 3/4] mmc: atmel-mci: stop using specific initcall Ludovic Desroches
  2014-11-21 15:33 ` [PATCH v2 4/4] mmc: atmel-mci: use probe deferring if dma controller is not ready yet Ludovic Desroches
  3 siblings, 0 replies; 9+ messages in thread
From: Ludovic Desroches @ 2014-11-21 15:33 UTC (permalink / raw)
  To: linux-mmc, linux-arm-kernel
  Cc: ulf.hansson, chris, nicolas.ferre, arnd, Ludovic Desroches, stable

Using __init/__exit attributes can cause several breakages so remove
them.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Cc: <stable@vger.kernel.org> # 3.2.x
---
 drivers/mmc/host/atmel-mci.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index b9226b3..169b4eb 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -2137,7 +2137,7 @@ static irqreturn_t atmci_detect_interrupt(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
-static int __init atmci_init_slot(struct atmel_mci *host,
+static int atmci_init_slot(struct atmel_mci *host,
 		struct mci_slot_pdata *slot_data, unsigned int id,
 		u32 sdc_reg, u32 sdio_irq)
 {
@@ -2295,7 +2295,7 @@ static bool atmci_configure_dma(struct atmel_mci *host)
  * HSMCI provides DMA support and a new config register but no more supports
  * PDC.
  */
-static void __init atmci_get_cap(struct atmel_mci *host)
+static void atmci_get_cap(struct atmel_mci *host)
 {
 	unsigned int version;
 
@@ -2344,7 +2344,7 @@ static void __init atmci_get_cap(struct atmel_mci *host)
 	}
 }
 
-static int __init atmci_probe(struct platform_device *pdev)
+static int atmci_probe(struct platform_device *pdev)
 {
 	struct mci_platform_data	*pdata;
 	struct atmel_mci		*host;
@@ -2480,7 +2480,7 @@ err_init_slot:
 	return ret;
 }
 
-static int __exit atmci_remove(struct platform_device *pdev)
+static int atmci_remove(struct platform_device *pdev)
 {
 	struct atmel_mci	*host = platform_get_drvdata(pdev);
 	unsigned int		i;
@@ -2510,19 +2510,19 @@ static int __exit atmci_remove(struct platform_device *pdev)
 }
 
 static struct platform_driver atmci_driver = {
-	.remove		= __exit_p(atmci_remove),
+	.remove		= atmci_remove,
 	.driver		= {
 		.name		= "atmel_mci",
 		.of_match_table	= of_match_ptr(atmci_dt_ids),
 	},
 };
 
-static int __init atmci_init(void)
+static int atmci_init(void)
 {
 	return platform_driver_probe(&atmci_driver, atmci_probe);
 }
 
-static void __exit atmci_exit(void)
+static void atmci_exit(void)
 {
 	platform_driver_unregister(&atmci_driver);
 }
-- 
2.0.3


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

* [PATCH v2 3/4] mmc: atmel-mci: stop using specific initcall
  2014-11-21 15:33 [PATCH v2 0/4] mmc: atmel-mci: cleanup and probe deferring Ludovic Desroches
  2014-11-21 15:33 ` [PATCH v2 1/4] mmc: atmel-mci: remove useless DMA stuff for non-dt devices Ludovic Desroches
  2014-11-21 15:33 ` [PATCH v2 2/4] mmc: atmel-mci: remove __init/__exit attributes Ludovic Desroches
@ 2014-11-21 15:33 ` Ludovic Desroches
  2014-11-21 15:33 ` [PATCH v2 4/4] mmc: atmel-mci: use probe deferring if dma controller is not ready yet Ludovic Desroches
  3 siblings, 0 replies; 9+ messages in thread
From: Ludovic Desroches @ 2014-11-21 15:33 UTC (permalink / raw)
  To: linux-mmc, linux-arm-kernel
  Cc: ulf.hansson, chris, nicolas.ferre, arnd, Ludovic Desroches

No more use late initcall to manage probing order. Use probe deferring
if needed.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
---
 drivers/mmc/host/atmel-mci.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index 169b4eb..28546c3 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -2510,25 +2510,14 @@ static int atmci_remove(struct platform_device *pdev)
 }
 
 static struct platform_driver atmci_driver = {
+	.probe		= atmci_probe,
 	.remove		= atmci_remove,
 	.driver		= {
 		.name		= "atmel_mci",
 		.of_match_table	= of_match_ptr(atmci_dt_ids),
 	},
 };
-
-static int atmci_init(void)
-{
-	return platform_driver_probe(&atmci_driver, atmci_probe);
-}
-
-static void atmci_exit(void)
-{
-	platform_driver_unregister(&atmci_driver);
-}
-
-late_initcall(atmci_init); /* try to load after dma driver when built-in */
-module_exit(atmci_exit);
+module_platform_driver(atmci_driver);
 
 MODULE_DESCRIPTION("Atmel Multimedia Card Interface driver");
 MODULE_AUTHOR("Haavard Skinnemoen (Atmel)");
-- 
2.0.3


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

* [PATCH v2 4/4] mmc: atmel-mci: use probe deferring if dma controller is not ready yet
  2014-11-21 15:33 [PATCH v2 0/4] mmc: atmel-mci: cleanup and probe deferring Ludovic Desroches
                   ` (2 preceding siblings ...)
  2014-11-21 15:33 ` [PATCH v2 3/4] mmc: atmel-mci: stop using specific initcall Ludovic Desroches
@ 2014-11-21 15:33 ` Ludovic Desroches
  2014-11-25 12:37   ` Ulf Hansson
  3 siblings, 1 reply; 9+ messages in thread
From: Ludovic Desroches @ 2014-11-21 15:33 UTC (permalink / raw)
  To: linux-mmc, linux-arm-kernel
  Cc: ulf.hansson, chris, nicolas.ferre, arnd, Ludovic Desroches

Return probe defer if requesting a dma channel without a dma controller
probed.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
---
 drivers/mmc/host/atmel-mci.c | 46 ++++++++++++++++++++++++--------------------
 1 file changed, 25 insertions(+), 21 deletions(-)

diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index 28546c3..d3c269e 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -2265,29 +2265,29 @@ static void atmci_cleanup_slot(struct atmel_mci_slot *slot,
 	mmc_free_host(slot->mmc);
 }
 
-static bool atmci_configure_dma(struct atmel_mci *host)
+static int atmci_configure_dma(struct atmel_mci *host)
 {
-	if (host == NULL)
-		return false;
+	int ret = 0;
 
-	host->dma.chan = dma_request_slave_channel(&host->pdev->dev, "rxtx");
-	if (!host->dma.chan) {
-		dev_warn(&host->pdev->dev, "no DMA channel available\n");
-		return false;
-	} else {
-		dev_info(&host->pdev->dev,
-					"using %s for DMA transfers\n",
-					dma_chan_name(host->dma.chan));
-
-		host->dma_conf.src_addr = host->mapbase + ATMCI_RDR;
-		host->dma_conf.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
-		host->dma_conf.src_maxburst = 1;
-		host->dma_conf.dst_addr = host->mapbase + ATMCI_TDR;
-		host->dma_conf.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
-		host->dma_conf.dst_maxburst = 1;
-		host->dma_conf.device_fc = false;
-		return true;
+	host->dma.chan = dma_request_slave_channel_reason(&host->pdev->dev, "rxtx");
+	if (IS_ERR(host->dma.chan)) {
+		ret = PTR_ERR(host->dma.chan);
+		host->dma.chan = NULL;
+		return ret;
 	}
+
+	dev_info(&host->pdev->dev, "using %s for DMA transfers\n",
+		 dma_chan_name(host->dma.chan));
+
+	host->dma_conf.src_addr = host->mapbase + ATMCI_RDR;
+	host->dma_conf.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
+	host->dma_conf.src_maxburst = 1;
+	host->dma_conf.dst_addr = host->mapbase + ATMCI_TDR;
+	host->dma_conf.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
+	host->dma_conf.dst_maxburst = 1;
+	host->dma_conf.device_fc = false;
+
+	return ret;
 }
 
 /*
@@ -2403,7 +2403,10 @@ static int atmci_probe(struct platform_device *pdev)
 
 	/* Get MCI capabilities and set operations according to it */
 	atmci_get_cap(host);
-	if (atmci_configure_dma(host)) {
+	ret = atmci_configure_dma(host);
+	if (ret == -EPROBE_DEFER)
+		goto err_dma_probe_defer;
+	if (ret == 0) {
 		host->prepare_data = &atmci_prepare_data_dma;
 		host->submit_data = &atmci_submit_data_dma;
 		host->stop_transfer = &atmci_stop_transfer_dma;
@@ -2476,6 +2479,7 @@ err_init_slot:
 	del_timer_sync(&host->timer);
 	if (host->dma.chan)
 		dma_release_channel(host->dma.chan);
+err_dma_probe_defer:
 	free_irq(irq, host);
 	return ret;
 }
-- 
2.0.3


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

* Re: [PATCH v2 4/4] mmc: atmel-mci: use probe deferring if dma controller is not ready yet
  2014-11-21 15:33 ` [PATCH v2 4/4] mmc: atmel-mci: use probe deferring if dma controller is not ready yet Ludovic Desroches
@ 2014-11-25 12:37   ` Ulf Hansson
  2014-11-25 14:25     ` [PATCH] " Ludovic Desroches
  0 siblings, 1 reply; 9+ messages in thread
From: Ulf Hansson @ 2014-11-25 12:37 UTC (permalink / raw)
  To: Ludovic Desroches
  Cc: linux-mmc, linux-arm-kernel, Chris Ball, Nicolas Ferre, Arnd Bergmann

On 21 November 2014 at 16:33, Ludovic Desroches
<ludovic.desroches@atmel.com> wrote:
> Return probe defer if requesting a dma channel without a dma controller
> probed.
>
> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
> ---
>  drivers/mmc/host/atmel-mci.c | 46 ++++++++++++++++++++++++--------------------
>  1 file changed, 25 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
> index 28546c3..d3c269e 100644
> --- a/drivers/mmc/host/atmel-mci.c
> +++ b/drivers/mmc/host/atmel-mci.c
> @@ -2265,29 +2265,29 @@ static void atmci_cleanup_slot(struct atmel_mci_slot *slot,
>         mmc_free_host(slot->mmc);
>  }
>
> -static bool atmci_configure_dma(struct atmel_mci *host)
> +static int atmci_configure_dma(struct atmel_mci *host)
>  {
> -       if (host == NULL)
> -               return false;
> +       int ret = 0;
>
> -       host->dma.chan = dma_request_slave_channel(&host->pdev->dev, "rxtx");
> -       if (!host->dma.chan) {
> -               dev_warn(&host->pdev->dev, "no DMA channel available\n");
> -               return false;
> -       } else {
> -               dev_info(&host->pdev->dev,
> -                                       "using %s for DMA transfers\n",
> -                                       dma_chan_name(host->dma.chan));
> -
> -               host->dma_conf.src_addr = host->mapbase + ATMCI_RDR;
> -               host->dma_conf.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
> -               host->dma_conf.src_maxburst = 1;
> -               host->dma_conf.dst_addr = host->mapbase + ATMCI_TDR;
> -               host->dma_conf.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
> -               host->dma_conf.dst_maxburst = 1;
> -               host->dma_conf.device_fc = false;
> -               return true;
> +       host->dma.chan = dma_request_slave_channel_reason(&host->pdev->dev, "rxtx");
> +       if (IS_ERR(host->dma.chan)) {
> +               ret = PTR_ERR(host->dma.chan);
> +               host->dma.chan = NULL;
> +               return ret;

As minor improvement you could just do "return PTR_ERR(host->dma.chan);"

Then add a check for "IS_ERR(host->dma.chan)" at those other places
that needs it.

>         }
> +
> +       dev_info(&host->pdev->dev, "using %s for DMA transfers\n",
> +                dma_chan_name(host->dma.chan));
> +
> +       host->dma_conf.src_addr = host->mapbase + ATMCI_RDR;
> +       host->dma_conf.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
> +       host->dma_conf.src_maxburst = 1;
> +       host->dma_conf.dst_addr = host->mapbase + ATMCI_TDR;
> +       host->dma_conf.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
> +       host->dma_conf.dst_maxburst = 1;
> +       host->dma_conf.device_fc = false;
> +
> +       return ret;
>  }
>
>  /*
> @@ -2403,7 +2403,10 @@ static int atmci_probe(struct platform_device *pdev)
>
>         /* Get MCI capabilities and set operations according to it */
>         atmci_get_cap(host);
> -       if (atmci_configure_dma(host)) {
> +       ret = atmci_configure_dma(host);
> +       if (ret == -EPROBE_DEFER)
> +               goto err_dma_probe_defer;
> +       if (ret == 0) {
>                 host->prepare_data = &atmci_prepare_data_dma;
>                 host->submit_data = &atmci_submit_data_dma;
>                 host->stop_transfer = &atmci_stop_transfer_dma;
> @@ -2476,6 +2479,7 @@ err_init_slot:
>         del_timer_sync(&host->timer);
>         if (host->dma.chan)
>                 dma_release_channel(host->dma.chan);
> +err_dma_probe_defer:
>         free_irq(irq, host);
>         return ret;
>  }
> --
> 2.0.3
>

Kind regards
Uffe

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

* [PATCH] mmc: atmel-mci: use probe deferring if dma controller is not ready yet
  2014-11-25 12:37   ` Ulf Hansson
@ 2014-11-25 14:25     ` Ludovic Desroches
  2014-11-28 11:09       ` Ulf Hansson
  0 siblings, 1 reply; 9+ messages in thread
From: Ludovic Desroches @ 2014-11-25 14:25 UTC (permalink / raw)
  To: ulf.hansson
  Cc: linux-mmc, linux-arm-kernel, chris, nicolas.ferre, arnd,
	Ludovic Desroches

Return probe defer if requesting a dma channel without a dma controller
probed.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
---

Hi Ulf,

I didn't send the whole set of patches for this small change, tell me if you
want a new series.

 drivers/mmc/host/atmel-mci.c | 49 ++++++++++++++++++++++----------------------
 1 file changed, 25 insertions(+), 24 deletions(-)

diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index 28546c3..f4daef9 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -2265,29 +2265,26 @@ static void atmci_cleanup_slot(struct atmel_mci_slot *slot,
 	mmc_free_host(slot->mmc);
 }
 
-static bool atmci_configure_dma(struct atmel_mci *host)
+static int atmci_configure_dma(struct atmel_mci *host)
 {
-	if (host == NULL)
-		return false;
+	int ret = 0;
 
-	host->dma.chan = dma_request_slave_channel(&host->pdev->dev, "rxtx");
-	if (!host->dma.chan) {
-		dev_warn(&host->pdev->dev, "no DMA channel available\n");
-		return false;
-	} else {
-		dev_info(&host->pdev->dev,
-					"using %s for DMA transfers\n",
-					dma_chan_name(host->dma.chan));
-
-		host->dma_conf.src_addr = host->mapbase + ATMCI_RDR;
-		host->dma_conf.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
-		host->dma_conf.src_maxburst = 1;
-		host->dma_conf.dst_addr = host->mapbase + ATMCI_TDR;
-		host->dma_conf.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
-		host->dma_conf.dst_maxburst = 1;
-		host->dma_conf.device_fc = false;
-		return true;
-	}
+	host->dma.chan = dma_request_slave_channel_reason(&host->pdev->dev, "rxtx");
+	if (IS_ERR(host->dma.chan))
+		return PTR_ERR(host->dma.chan);
+
+	dev_info(&host->pdev->dev, "using %s for DMA transfers\n",
+		 dma_chan_name(host->dma.chan));
+
+	host->dma_conf.src_addr = host->mapbase + ATMCI_RDR;
+	host->dma_conf.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
+	host->dma_conf.src_maxburst = 1;
+	host->dma_conf.dst_addr = host->mapbase + ATMCI_TDR;
+	host->dma_conf.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
+	host->dma_conf.dst_maxburst = 1;
+	host->dma_conf.device_fc = false;
+
+	return ret;
 }
 
 /*
@@ -2403,7 +2400,10 @@ static int atmci_probe(struct platform_device *pdev)
 
 	/* Get MCI capabilities and set operations according to it */
 	atmci_get_cap(host);
-	if (atmci_configure_dma(host)) {
+	ret = atmci_configure_dma(host);
+	if (ret == -EPROBE_DEFER)
+		goto err_dma_probe_defer;
+	if (ret == 0) {
 		host->prepare_data = &atmci_prepare_data_dma;
 		host->submit_data = &atmci_submit_data_dma;
 		host->stop_transfer = &atmci_stop_transfer_dma;
@@ -2474,8 +2474,9 @@ err_dma_alloc:
 	}
 err_init_slot:
 	del_timer_sync(&host->timer);
-	if (host->dma.chan)
+	if (!IS_ERR(host->dma.chan))
 		dma_release_channel(host->dma.chan);
+err_dma_probe_defer:
 	free_irq(irq, host);
 	return ret;
 }
@@ -2501,7 +2502,7 @@ static int atmci_remove(struct platform_device *pdev)
 	clk_disable_unprepare(host->mck);
 
 	del_timer_sync(&host->timer);
-	if (host->dma.chan)
+	if (!IS_ERR(host->dma.chan))
 		dma_release_channel(host->dma.chan);
 
 	free_irq(platform_get_irq(pdev, 0), host);
-- 
2.0.3


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

* Re: [PATCH] mmc: atmel-mci: use probe deferring if dma controller is not ready yet
  2014-11-25 14:25     ` [PATCH] " Ludovic Desroches
@ 2014-11-28 11:09       ` Ulf Hansson
  2014-11-28 13:53         ` Ludovic Desroches
  0 siblings, 1 reply; 9+ messages in thread
From: Ulf Hansson @ 2014-11-28 11:09 UTC (permalink / raw)
  To: Ludovic Desroches
  Cc: linux-mmc, linux-arm-kernel, Chris Ball, Nicolas Ferre, Arnd Bergmann

On 25 November 2014 at 15:25, Ludovic Desroches
<ludovic.desroches@atmel.com> wrote:
> Return probe defer if requesting a dma channel without a dma controller
> probed.
>
> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
> ---
>
> Hi Ulf,
>
> I didn't send the whole set of patches for this small change, tell me if you
> want a new series.

I tried to apply the patchset and get two problems.

1) This patch 4 has checkpatch errors.
2) I hit conflicts on patch2.

Please resend the complete patchset fixing the above.

Kind regards
Uffe

>
>  drivers/mmc/host/atmel-mci.c | 49 ++++++++++++++++++++++----------------------
>  1 file changed, 25 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
> index 28546c3..f4daef9 100644
> --- a/drivers/mmc/host/atmel-mci.c
> +++ b/drivers/mmc/host/atmel-mci.c
> @@ -2265,29 +2265,26 @@ static void atmci_cleanup_slot(struct atmel_mci_slot *slot,
>         mmc_free_host(slot->mmc);
>  }
>
> -static bool atmci_configure_dma(struct atmel_mci *host)
> +static int atmci_configure_dma(struct atmel_mci *host)
>  {
> -       if (host == NULL)
> -               return false;
> +       int ret = 0;
>
> -       host->dma.chan = dma_request_slave_channel(&host->pdev->dev, "rxtx");
> -       if (!host->dma.chan) {
> -               dev_warn(&host->pdev->dev, "no DMA channel available\n");
> -               return false;
> -       } else {
> -               dev_info(&host->pdev->dev,
> -                                       "using %s for DMA transfers\n",
> -                                       dma_chan_name(host->dma.chan));
> -
> -               host->dma_conf.src_addr = host->mapbase + ATMCI_RDR;
> -               host->dma_conf.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
> -               host->dma_conf.src_maxburst = 1;
> -               host->dma_conf.dst_addr = host->mapbase + ATMCI_TDR;
> -               host->dma_conf.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
> -               host->dma_conf.dst_maxburst = 1;
> -               host->dma_conf.device_fc = false;
> -               return true;
> -       }
> +       host->dma.chan = dma_request_slave_channel_reason(&host->pdev->dev, "rxtx");
> +       if (IS_ERR(host->dma.chan))
> +               return PTR_ERR(host->dma.chan);
> +
> +       dev_info(&host->pdev->dev, "using %s for DMA transfers\n",
> +                dma_chan_name(host->dma.chan));
> +
> +       host->dma_conf.src_addr = host->mapbase + ATMCI_RDR;
> +       host->dma_conf.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
> +       host->dma_conf.src_maxburst = 1;
> +       host->dma_conf.dst_addr = host->mapbase + ATMCI_TDR;
> +       host->dma_conf.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
> +       host->dma_conf.dst_maxburst = 1;
> +       host->dma_conf.device_fc = false;
> +
> +       return ret;
>  }
>
>  /*
> @@ -2403,7 +2400,10 @@ static int atmci_probe(struct platform_device *pdev)
>
>         /* Get MCI capabilities and set operations according to it */
>         atmci_get_cap(host);
> -       if (atmci_configure_dma(host)) {
> +       ret = atmci_configure_dma(host);
> +       if (ret == -EPROBE_DEFER)
> +               goto err_dma_probe_defer;
> +       if (ret == 0) {
>                 host->prepare_data = &atmci_prepare_data_dma;
>                 host->submit_data = &atmci_submit_data_dma;
>                 host->stop_transfer = &atmci_stop_transfer_dma;
> @@ -2474,8 +2474,9 @@ err_dma_alloc:
>         }
>  err_init_slot:
>         del_timer_sync(&host->timer);
> -       if (host->dma.chan)
> +       if (!IS_ERR(host->dma.chan))
>                 dma_release_channel(host->dma.chan);
> +err_dma_probe_defer:
>         free_irq(irq, host);
>         return ret;
>  }
> @@ -2501,7 +2502,7 @@ static int atmci_remove(struct platform_device *pdev)
>         clk_disable_unprepare(host->mck);
>
>         del_timer_sync(&host->timer);
> -       if (host->dma.chan)
> +       if (!IS_ERR(host->dma.chan))
>                 dma_release_channel(host->dma.chan);
>
>         free_irq(platform_get_irq(pdev, 0), host);
> --
> 2.0.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] mmc: atmel-mci: use probe deferring if dma controller is not ready yet
  2014-11-28 11:09       ` Ulf Hansson
@ 2014-11-28 13:53         ` Ludovic Desroches
  0 siblings, 0 replies; 9+ messages in thread
From: Ludovic Desroches @ 2014-11-28 13:53 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Ludovic Desroches, linux-mmc, linux-arm-kernel, Chris Ball,
	Nicolas Ferre, Arnd Bergmann

On Fri, Nov 28, 2014 at 12:09:47PM +0100, Ulf Hansson wrote:
> On 25 November 2014 at 15:25, Ludovic Desroches
> <ludovic.desroches@atmel.com> wrote:
> > Return probe defer if requesting a dma channel without a dma controller
> > probed.
> >
> > Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
> > ---
> >
> > Hi Ulf,
> >
> > I didn't send the whole set of patches for this small change, tell me if you
> > want a new series.
> 
> I tried to apply the patchset and get two problems.
> 
> 1) This patch 4 has checkpatch errors.

Strange, I did it and I only had a 80 columns warning, I'll check if I
didn't do something wrong.

> 2) I hit conflicts on patch2.
> 

Ok I'll rebase it on your next branch.

> Please resend the complete patchset fixing the above.

Regards

Ludovic

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

end of thread, other threads:[~2014-11-28 13:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-21 15:33 [PATCH v2 0/4] mmc: atmel-mci: cleanup and probe deferring Ludovic Desroches
2014-11-21 15:33 ` [PATCH v2 1/4] mmc: atmel-mci: remove useless DMA stuff for non-dt devices Ludovic Desroches
2014-11-21 15:33 ` [PATCH v2 2/4] mmc: atmel-mci: remove __init/__exit attributes Ludovic Desroches
2014-11-21 15:33 ` [PATCH v2 3/4] mmc: atmel-mci: stop using specific initcall Ludovic Desroches
2014-11-21 15:33 ` [PATCH v2 4/4] mmc: atmel-mci: use probe deferring if dma controller is not ready yet Ludovic Desroches
2014-11-25 12:37   ` Ulf Hansson
2014-11-25 14:25     ` [PATCH] " Ludovic Desroches
2014-11-28 11:09       ` Ulf Hansson
2014-11-28 13:53         ` Ludovic Desroches

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).