mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] mci: imx-esdhc-common: Don't clear unhandled status bits
@ 2022-06-21 10:15 Robin van der Gracht
  2022-06-22  7:51 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Robin van der Gracht @ 2022-06-21 10:15 UTC (permalink / raw)
  To: Barebox; +Cc: Andrey Smirnov, robin

A DMA cmd + data transfer can finish or stop (i.e. on a block gap) before
the status register is cleared. In that case we'll lose track of state
causing sdhci_transfer_data_dma() to loop forever waiting for status bits
that are already cleared.

Clearing SDHCI_INT_CMD_COMPLETE should suffice here. Since it's not
evaluated a second time, clearing it at the start of the function is
sufficient so we can just remove the erroneous status write.

Signed-off-by: Robin van der Gracht <robin@protonic.nl>
---
 drivers/mci/imx-esdhc-common.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/mci/imx-esdhc-common.c b/drivers/mci/imx-esdhc-common.c
index a12db43c88..27293e44b7 100644
--- a/drivers/mci/imx-esdhc-common.c
+++ b/drivers/mci/imx-esdhc-common.c
@@ -176,7 +176,6 @@ int __esdhc_send_cmd(struct fsl_esdhc_host *host, struct mci_cmd *cmd,
 	}
 
 	irqstat = sdhci_read32(&host->sdhci, SDHCI_INT_STATUS);
-	sdhci_write32(&host->sdhci, SDHCI_INT_STATUS, irqstat);
 
 	if (irqstat & CMD_ERR)
 		return -EIO;
-- 
2.34.1




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

* Re: [PATCH] mci: imx-esdhc-common: Don't clear unhandled status bits
  2022-06-21 10:15 [PATCH] mci: imx-esdhc-common: Don't clear unhandled status bits Robin van der Gracht
@ 2022-06-22  7:51 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2022-06-22  7:51 UTC (permalink / raw)
  To: Robin van der Gracht; +Cc: Barebox, Andrey Smirnov

On Tue, Jun 21, 2022 at 12:15:29PM +0200, Robin van der Gracht wrote:
> A DMA cmd + data transfer can finish or stop (i.e. on a block gap) before
> the status register is cleared. In that case we'll lose track of state
> causing sdhci_transfer_data_dma() to loop forever waiting for status bits
> that are already cleared.
> 
> Clearing SDHCI_INT_CMD_COMPLETE should suffice here. Since it's not
> evaluated a second time, clearing it at the start of the function is
> sufficient so we can just remove the erroneous status write.
> 
> Signed-off-by: Robin van der Gracht <robin@protonic.nl>
> ---
>  drivers/mci/imx-esdhc-common.c | 1 -
>  1 file changed, 1 deletion(-)

Applied to master, thanks

Sascha

> 
> diff --git a/drivers/mci/imx-esdhc-common.c b/drivers/mci/imx-esdhc-common.c
> index a12db43c88..27293e44b7 100644
> --- a/drivers/mci/imx-esdhc-common.c
> +++ b/drivers/mci/imx-esdhc-common.c
> @@ -176,7 +176,6 @@ int __esdhc_send_cmd(struct fsl_esdhc_host *host, struct mci_cmd *cmd,
>  	}
>  
>  	irqstat = sdhci_read32(&host->sdhci, SDHCI_INT_STATUS);
> -	sdhci_write32(&host->sdhci, SDHCI_INT_STATUS, irqstat);
>  
>  	if (irqstat & CMD_ERR)
>  		return -EIO;
> -- 
> 2.34.1
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



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

end of thread, other threads:[~2022-06-22  7:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-21 10:15 [PATCH] mci: imx-esdhc-common: Don't clear unhandled status bits Robin van der Gracht
2022-06-22  7:51 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox