diff mbox series

[RFC,2/4] mmc: host: renesas_sdhi_sys_dmac: Do not fall back to PIO

Message ID 1574403231-18512-3-git-send-email-yoshihiro.shimoda.uh@renesas.com (mailing list archive)
State Under Review
Delegated to: Geert Uytterhoeven
Headers show
Series mmc: host: renesas_sdhi_sys_dmac: change dma_buswidth | expand

Commit Message

Yoshihiro Shimoda Nov. 22, 2019, 6:13 a.m. UTC
Falling back to PIO forever is not convenience if a buffer condition
is not match with the hardware once. So, this patch removes it.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/mmc/host/renesas_sdhi_sys_dmac.c | 35 +++++++-------------------------
 1 file changed, 7 insertions(+), 28 deletions(-)

Comments

Ulrich Hecht Nov. 26, 2019, 10:45 a.m. UTC | #1
> On November 22, 2019 at 7:13 AM Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> wrote:
> 
> 
> Falling back to PIO forever is not convenience if a buffer condition
> is not match with the hardware once. So, this patch removes it.
> 
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> ---
>  drivers/mmc/host/renesas_sdhi_sys_dmac.c | 35 +++++++-------------------------
>  1 file changed, 7 insertions(+), 28 deletions(-)
> 
> diff --git a/drivers/mmc/host/renesas_sdhi_sys_dmac.c b/drivers/mmc/host/renesas_sdhi_sys_dmac.c
> index 30f34a3..09137cc 100644
> --- a/drivers/mmc/host/renesas_sdhi_sys_dmac.c
> +++ b/drivers/mmc/host/renesas_sdhi_sys_dmac.c
> @@ -175,7 +175,7 @@ static void renesas_sdhi_sys_dmac_start_dma_rx(struct tmio_mmc_host *host)
>  	}
>  
>  	if (sg->length < min_len)
> -		return;
> +		goto pio;
>  
>  	/* The only sg element can be unaligned, use our bounce buffer then */
>  	if (!aligned) {
> @@ -200,23 +200,13 @@ static void renesas_sdhi_sys_dmac_start_dma_rx(struct tmio_mmc_host *host)
>  			ret = cookie;
>  		}
>  		host->dma_on = true;
> +		renesas_sdhi_sys_dmac_enable_dma(host, true);
>  	}
>  pio:
>  	if (!desc) {
> -		/* DMA failed, fall back to PIO */
>  		renesas_sdhi_sys_dmac_enable_dma(host, false);
> -		if (ret >= 0)
> -			ret = -EIO;
> -		host->chan_rx = NULL;
> -		dma_release_channel(chan);
> -		/* Free the Tx channel too */
> -		chan = host->chan_tx;
> -		if (chan) {
> -			host->chan_tx = NULL;
> -			dma_release_channel(chan);
> -		}
> -		dev_warn(&host->pdev->dev,
> -			 "DMA failed: %d, falling back to PIO\n", ret);
> +		host->dma_on = false;
> +		dev_dbg(&host->pdev->dev, "DMA failed: %d\n", ret);
>  	}
>  }
>  
> @@ -248,7 +238,7 @@ static void renesas_sdhi_sys_dmac_start_dma_tx(struct tmio_mmc_host *host)
>  	}
>  
>  	if (sg->length < min_len)
> -		return;
> +		goto pio;
>  
>  	/* The only sg element can be unaligned, use our bounce buffer then */
>  	if (!aligned) {
> @@ -281,20 +271,9 @@ static void renesas_sdhi_sys_dmac_start_dma_tx(struct tmio_mmc_host *host)
>  	}
>  pio:
>  	if (!desc) {
> -		/* DMA failed, fall back to PIO */
>  		renesas_sdhi_sys_dmac_enable_dma(host, false);
> -		if (ret >= 0)
> -			ret = -EIO;
> -		host->chan_tx = NULL;
> -		dma_release_channel(chan);
> -		/* Free the Rx channel too */
> -		chan = host->chan_rx;
> -		if (chan) {
> -			host->chan_rx = NULL;
> -			dma_release_channel(chan);
> -		}
> -		dev_warn(&host->pdev->dev,
> -			 "DMA failed: %d, falling back to PIO\n", ret);
> +		host->dma_on = false;
> +		dev_dbg(&host->pdev->dev, "DMA failed: %d\n", ret);
>  	}
>  }
>  
> -- 
> 2.7.4

Reviewed-by: Ulrich Hecht <uli+renesas@fpond.eu>

CU
Uli
diff mbox series

Patch

diff --git a/drivers/mmc/host/renesas_sdhi_sys_dmac.c b/drivers/mmc/host/renesas_sdhi_sys_dmac.c
index 30f34a3..09137cc 100644
--- a/drivers/mmc/host/renesas_sdhi_sys_dmac.c
+++ b/drivers/mmc/host/renesas_sdhi_sys_dmac.c
@@ -175,7 +175,7 @@  static void renesas_sdhi_sys_dmac_start_dma_rx(struct tmio_mmc_host *host)
 	}
 
 	if (sg->length < min_len)
-		return;
+		goto pio;
 
 	/* The only sg element can be unaligned, use our bounce buffer then */
 	if (!aligned) {
@@ -200,23 +200,13 @@  static void renesas_sdhi_sys_dmac_start_dma_rx(struct tmio_mmc_host *host)
 			ret = cookie;
 		}
 		host->dma_on = true;
+		renesas_sdhi_sys_dmac_enable_dma(host, true);
 	}
 pio:
 	if (!desc) {
-		/* DMA failed, fall back to PIO */
 		renesas_sdhi_sys_dmac_enable_dma(host, false);
-		if (ret >= 0)
-			ret = -EIO;
-		host->chan_rx = NULL;
-		dma_release_channel(chan);
-		/* Free the Tx channel too */
-		chan = host->chan_tx;
-		if (chan) {
-			host->chan_tx = NULL;
-			dma_release_channel(chan);
-		}
-		dev_warn(&host->pdev->dev,
-			 "DMA failed: %d, falling back to PIO\n", ret);
+		host->dma_on = false;
+		dev_dbg(&host->pdev->dev, "DMA failed: %d\n", ret);
 	}
 }
 
@@ -248,7 +238,7 @@  static void renesas_sdhi_sys_dmac_start_dma_tx(struct tmio_mmc_host *host)
 	}
 
 	if (sg->length < min_len)
-		return;
+		goto pio;
 
 	/* The only sg element can be unaligned, use our bounce buffer then */
 	if (!aligned) {
@@ -281,20 +271,9 @@  static void renesas_sdhi_sys_dmac_start_dma_tx(struct tmio_mmc_host *host)
 	}
 pio:
 	if (!desc) {
-		/* DMA failed, fall back to PIO */
 		renesas_sdhi_sys_dmac_enable_dma(host, false);
-		if (ret >= 0)
-			ret = -EIO;
-		host->chan_tx = NULL;
-		dma_release_channel(chan);
-		/* Free the Rx channel too */
-		chan = host->chan_rx;
-		if (chan) {
-			host->chan_rx = NULL;
-			dma_release_channel(chan);
-		}
-		dev_warn(&host->pdev->dev,
-			 "DMA failed: %d, falling back to PIO\n", ret);
+		host->dma_on = false;
+		dev_dbg(&host->pdev->dev, "DMA failed: %d\n", ret);
 	}
 }