[PATCH] mmc: tmio: Always check for errors after receiving an IRQ

Yoshihiro Shimoda yoshihiro.shimoda.uh at renesas.com
Thu Oct 26 10:42:20 CEST 2023


Hello Marek-san,

> From: U-Boot  On Behalf Of Marek Vasut, Sent: Sunday, October 15, 2023 6:56 AM
> 
> Unconditionally check for errors even after successful reception
> of IRQ flag, since the hardware may set both an IRQ completion
> flag and an error flag at the same time.
> 
> This mode of failure happens in case of an error during transfer,
> in which case the hardware may set the expected IRQ completion
> flag as well as error flags. The later is currently not checked
> by the driver and such an error is not detected. Improve the
> error detection.
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas at mailbox.org>
> ---
> Cc: Jaehoon Chung <jh80.chung at samsung.com>
> Cc: Nobuhiro Iwamatsu <iwamatsu at nigauri.org>
> Cc: Peng Fan <peng.fan at nxp.com>
> ---

Thank you for the patch. It looks good to me. So,

Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh at renesas.com>

Also, our outsourcing member tested it on R-Car H3 Salvator-XS and
it works without any regression. So,

Tested-by: Thuan Nguyen Hong <thuan.nguyen-hong at banvien.com.vn>

Best regards,
Yoshihiro Shimoda

>  drivers/mmc/tmio-common.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/tmio-common.c b/drivers/mmc/tmio-common.c
> index d1e26815996..83eaf361f0c 100644
> --- a/drivers/mmc/tmio-common.c
> +++ b/drivers/mmc/tmio-common.c
> @@ -122,7 +122,10 @@ static int tmio_sd_wait_for_irq(struct udevice *dev, struct mmc_cmd *cmd,
>  	long wait = 1000000;
>  	int ret;
> 
> -	while (!(tmio_sd_readl(priv, reg) & flag)) {
> +	while (true) {
> +		if (tmio_sd_readl(priv, reg) & flag)
> +			return tmio_sd_check_error(dev, cmd);
> +
>  		if (wait-- < 0) {
>  			dev_err(dev, "timeout\n");
>  			return -ETIMEDOUT;
> --
> 2.42.0



More information about the U-Boot mailing list