From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
To: ulf.hansson@linaro.org, wsa+renesas@sang-engineering.com
Cc: linux-mmc@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Subject: [PATCH 3/3] mmc: renesas_sdhi_internal_dmac: Fix dma unmapping in error cases
Date: Thu, 21 May 2020 16:01:06 +0900 [thread overview]
Message-ID: <1590044466-28372-4-git-send-email-yoshihiro.shimoda.uh@renesas.com> (raw)
In-Reply-To: <1590044466-28372-1-git-send-email-yoshihiro.shimoda.uh@renesas.com>
If this controller doesn't issue interrupt for response of command,
this driver lacks to call dma_unmap_sg(). So, fix the issue by
using end() of struct tmio_mmc_dma_ops.
Reported-by: Takeshi Saito <takeshi.saito.xv@renesas.com>
Fixes: 2a68ea7896e3 ("mmc: renesas-sdhi: add support for R-Car Gen3 SDHI DMAC")
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
drivers/mmc/host/renesas_sdhi_internal_dmac.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/mmc/host/renesas_sdhi_internal_dmac.c b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
index 201b8ed..32ab991 100644
--- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c
+++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
@@ -233,6 +233,9 @@ static bool renesas_sdhi_internal_dmac_complete(struct tmio_mmc_host *host)
{
enum dma_data_direction dir;
+ if (!host->dma_on)
+ return false;
+
if (!host->data)
return false;
@@ -247,6 +250,8 @@ static bool renesas_sdhi_internal_dmac_complete(struct tmio_mmc_host *host)
if (dir == DMA_FROM_DEVICE)
clear_bit(SDHI_INTERNAL_DMAC_RX_IN_USE, &global_flags);
+ host->dma_on = false;
+
return true;
}
@@ -263,6 +268,12 @@ static void renesas_sdhi_internal_dmac_complete_tasklet_fn(unsigned long arg)
spin_unlock_irq(&host->lock);
}
+static void renesas_sdhi_internal_dmac_end_dma(struct tmio_mmc_host *host)
+{
+ if (host->data)
+ renesas_sdhi_internal_dmac_complete(host);
+}
+
static void
renesas_sdhi_internal_dmac_request_dma(struct tmio_mmc_host *host,
struct tmio_mmc_data *pdata)
@@ -300,6 +311,7 @@ static const struct tmio_mmc_dma_ops renesas_sdhi_internal_dmac_dma_ops = {
.release = renesas_sdhi_internal_dmac_release_dma,
.abort = renesas_sdhi_internal_dmac_abort_dma,
.dataend = renesas_sdhi_internal_dmac_dataend_dma,
+ .end = renesas_sdhi_internal_dmac_end_dma,
};
/*
--
2.7.4
next prev parent reply other threads:[~2020-05-21 7:01 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-21 7:01 [PATCH 0/3] mmc: tmio and renesas_sdhi_internal_dmac: fix dma unmapping Yoshihiro Shimoda
2020-05-21 7:01 ` [PATCH 1/3] mmc: tmio: core: Add end operation into tmio_mmc_dma_ops Yoshihiro Shimoda
2020-06-11 20:32 ` Wolfram Sang
2020-06-12 4:18 ` Yoshihiro Shimoda
2020-05-21 7:01 ` [PATCH 2/3] mmc: renesas_sdhi_internal_dmac: clean up the code for dma complete Yoshihiro Shimoda
2020-05-21 7:01 ` Yoshihiro Shimoda [this message]
2020-05-21 7:44 ` [PATCH 0/3] mmc: tmio and renesas_sdhi_internal_dmac: fix dma unmapping Yoshihiro Shimoda
2020-06-02 12:51 ` wsa+renesas
2020-06-04 2:52 ` Yoshihiro Shimoda
2020-07-06 13:16 ` Ulf Hansson
2020-07-06 14:00 ` wsa+renesas
2020-07-06 14:49 ` Ulf Hansson
2020-07-06 14:51 ` wsa+renesas
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=1590044466-28372-4-git-send-email-yoshihiro.shimoda.uh@renesas.com \
--to=yoshihiro.shimoda.uh@renesas.com \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=ulf.hansson@linaro.org \
--cc=wsa+renesas@sang-engineering.com \
/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 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).