diff mbox series

mmc: tmio: Fix command error processing

Message ID 20201117131337.35307-1-wsa+renesas@sang-engineering.com
State New
Headers show
Series mmc: tmio: Fix command error processing | expand

Commit Message

Wolfram Sang Nov. 17, 2020, 1:13 p.m. UTC
From: Masaharu Hayakawa <masaharu.hayakawa.ry@renesas.com>

If some errors are detected at the same time as the access end
interrupt, the access end interrupt was not cleared. Especially with
DMA, because then the access end interrupt was never enabled and, thus,
never cleared. Clear the interrupt register always when a command error
occurs.

Signed-off-by: Masaharu Hayakawa <masaharu.hayakawa.ry@renesas.com>
[saito: rebase to v5.4]
Signed-off-by: Takeshi Saito <takeshi.saito.xv@renesas.com>
[wsa: rebase and extension of the commit message]
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

Because the test case is hard to reproduce (lots of radio noise and
temperature changes), I trust the BSP team here. But the reasoning makes
a lot of sense to me. I verified that there are no regressions with the
test cases I usually do. The patch is based on mmc/next as of today,
i.e. with all previous series included.

 drivers/mmc/host/tmio_mmc_core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Niklas Söderlund Nov. 18, 2020, 11:32 a.m. UTC | #1
Hi Wolfram,

Thanks for your work.

On 2020-11-17 14:13:37 +0100, Wolfram Sang wrote:
> From: Masaharu Hayakawa <masaharu.hayakawa.ry@renesas.com>

> 

> If some errors are detected at the same time as the access end

> interrupt, the access end interrupt was not cleared. Especially with

> DMA, because then the access end interrupt was never enabled and, thus,

> never cleared. Clear the interrupt register always when a command error

> occurs.

> 

> Signed-off-by: Masaharu Hayakawa <masaharu.hayakawa.ry@renesas.com>

> [saito: rebase to v5.4]

> Signed-off-by: Takeshi Saito <takeshi.saito.xv@renesas.com>

> [wsa: rebase and extension of the commit message]

> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

> ---

> 

> Because the test case is hard to reproduce (lots of radio noise and

> temperature changes), I trust the BSP team here. But the reasoning makes

> a lot of sense to me. I verified that there are no regressions with the

> test cases I usually do. The patch is based on mmc/next as of today,

> i.e. with all previous series included.


I agree the reasoning make sens and the patch looks good,

Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>


> 

>  drivers/mmc/host/tmio_mmc_core.c | 4 +++-

>  1 file changed, 3 insertions(+), 1 deletion(-)

> 

> diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c

> index cb4149fd12e0..7f4a28125010 100644

> --- a/drivers/mmc/host/tmio_mmc_core.c

> +++ b/drivers/mmc/host/tmio_mmc_core.c

> @@ -796,8 +796,10 @@ static void tmio_mmc_finish_request(struct tmio_mmc_host *host)

>  

>  	spin_unlock_irqrestore(&host->lock, flags);

>  

> -	if (mrq->cmd->error || (mrq->data && mrq->data->error))

> +	if (mrq->cmd->error || (mrq->data && mrq->data->error)) {

> +		tmio_mmc_ack_mmc_irqs(host, TMIO_MASK_IRQ); /* Clear all */

>  		tmio_mmc_abort_dma(host);

> +	}

>  

>  	/* Error means retune, but executed command was still successful */

>  	if (host->check_retune && host->check_retune(host))

> -- 

> 2.28.0

> 


-- 
Regards,
Niklas Söderlund
Ulf Hansson Nov. 23, 2020, 4:06 p.m. UTC | #2
On Tue, 17 Nov 2020 at 14:15, Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
>

> From: Masaharu Hayakawa <masaharu.hayakawa.ry@renesas.com>

>

> If some errors are detected at the same time as the access end

> interrupt, the access end interrupt was not cleared. Especially with

> DMA, because then the access end interrupt was never enabled and, thus,

> never cleared. Clear the interrupt register always when a command error

> occurs.

>

> Signed-off-by: Masaharu Hayakawa <masaharu.hayakawa.ry@renesas.com>

> [saito: rebase to v5.4]

> Signed-off-by: Takeshi Saito <takeshi.saito.xv@renesas.com>

> [wsa: rebase and extension of the commit message]

> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>


Applied for next, thanks!

Kind regards
Uffe


> ---

>

> Because the test case is hard to reproduce (lots of radio noise and

> temperature changes), I trust the BSP team here. But the reasoning makes

> a lot of sense to me. I verified that there are no regressions with the

> test cases I usually do. The patch is based on mmc/next as of today,

> i.e. with all previous series included.

>

>  drivers/mmc/host/tmio_mmc_core.c | 4 +++-

>  1 file changed, 3 insertions(+), 1 deletion(-)

>

> diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c

> index cb4149fd12e0..7f4a28125010 100644

> --- a/drivers/mmc/host/tmio_mmc_core.c

> +++ b/drivers/mmc/host/tmio_mmc_core.c

> @@ -796,8 +796,10 @@ static void tmio_mmc_finish_request(struct tmio_mmc_host *host)

>

>         spin_unlock_irqrestore(&host->lock, flags);

>

> -       if (mrq->cmd->error || (mrq->data && mrq->data->error))

> +       if (mrq->cmd->error || (mrq->data && mrq->data->error)) {

> +               tmio_mmc_ack_mmc_irqs(host, TMIO_MASK_IRQ); /* Clear all */

>                 tmio_mmc_abort_dma(host);

> +       }

>

>         /* Error means retune, but executed command was still successful */

>         if (host->check_retune && host->check_retune(host))

> --

> 2.28.0

>
diff mbox series

Patch

diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
index cb4149fd12e0..7f4a28125010 100644
--- a/drivers/mmc/host/tmio_mmc_core.c
+++ b/drivers/mmc/host/tmio_mmc_core.c
@@ -796,8 +796,10 @@  static void tmio_mmc_finish_request(struct tmio_mmc_host *host)
 
 	spin_unlock_irqrestore(&host->lock, flags);
 
-	if (mrq->cmd->error || (mrq->data && mrq->data->error))
+	if (mrq->cmd->error || (mrq->data && mrq->data->error)) {
+		tmio_mmc_ack_mmc_irqs(host, TMIO_MASK_IRQ); /* Clear all */
 		tmio_mmc_abort_dma(host);
+	}
 
 	/* Error means retune, but executed command was still successful */
 	if (host->check_retune && host->check_retune(host))