All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
To: linux-renesas-soc@vger.kernel.org
Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Subject: [PATCH RFC 2/4] mmc: host: renesas_sdhi_sys_dmac: Do not fall back to PIO
Date: Fri, 22 Nov 2019 15:13:49 +0900	[thread overview]
Message-ID: <1574403231-18512-3-git-send-email-yoshihiro.shimoda.uh@renesas.com> (raw)
In-Reply-To: <1574403231-18512-1-git-send-email-yoshihiro.shimoda.uh@renesas.com>

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


  parent reply	other threads:[~2019-11-22  6:13 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-22  6:13 [PATCH RFC 0/4] mmc: host: renesas_sdhi_sys_dmac: change dma_buswidth Yoshihiro Shimoda
2019-11-22  6:13 ` [PATCH RFC 1/4] mmc: host: renesas_sdhi_sys_dmac: Use dma_buswidth instead of hardcoded value Yoshihiro Shimoda
2019-11-26 10:45   ` Ulrich Hecht
2019-11-22  6:13 ` Yoshihiro Shimoda [this message]
2019-11-26 10:45   ` [PATCH RFC 2/4] mmc: host: renesas_sdhi_sys_dmac: Do not fall back to PIO Ulrich Hecht
2019-11-22  6:13 ` [PATCH RFC 3/4] mmc: host: renesas_sdhi_sys_dmac: add DMACR setting Yoshihiro Shimoda
2019-11-26 10:46   ` Ulrich Hecht
2019-12-02  8:19     ` Yoshihiro Shimoda
2019-11-22  6:13 ` [PATCH RFC 4/4] mmc: host: renesas_sdhi_sys_dmac: Set dma_buswidth value to 32 byte Yoshihiro Shimoda
2019-11-26 10:46   ` Ulrich Hecht
2019-11-28 21:07   ` Wolfram Sang
2019-12-02  8:38     ` Yoshihiro Shimoda
2019-12-02  8:54       ` Wolfram Sang
2019-11-26 10:45 ` [PATCH RFC 0/4] mmc: host: renesas_sdhi_sys_dmac: change dma_buswidth Ulrich Hecht
2019-12-02  8:09   ` Yoshihiro Shimoda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1574403231-18512-3-git-send-email-yoshihiro.shimoda.uh@renesas.com \
    --to=yoshihiro.shimoda.uh@renesas.com \
    --cc=linux-renesas-soc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.