[PATCH] mmc: renesas-sdhi: Stop transmission in case tuning block transfer fails

Paul Barker paul.barker.ct at bp.renesas.com
Tue Feb 20 12:05:54 CET 2024


On 20/02/2024 08:38, Marek Vasut wrote:
> The current code uses the state of tuning block received by SCC to
> determine whether or not to send transmission stop command. This is
> not correct. Use the state of tuning block transfer to determine
> whether or not to send transmission stop command instead, because
> the transmission stop command has to be sent in case the tuning
> block transfer failed.
> 
> This requires two changes, separate variable to store and check the
> state of tuning block received by SCC, and another separate variable
> to store and check return value from transmission stop command.
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas at mailbox.org>
> ---
> Cc: Hai Pham <hai.pham.ud at renesas.com>
> Cc: Jaehoon Chung <jh80.chung at samsung.com>
> Cc: Nobuhiro Iwamatsu <iwamatsu at nigauri.org>
> Cc: Paul Barker <paul.barker.ct at bp.renesas.com>
> Cc: Peng Fan <peng.fan at nxp.com>
> Cc: Sean Anderson <seanga2 at gmail.com>
> Cc: Tom Rini <trini at konsulko.com>
> Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh at renesas.com>
> ---
>  drivers/mmc/renesas-sdhi.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/mmc/renesas-sdhi.c b/drivers/mmc/renesas-sdhi.c
> index 316b75b35fe..c4d0733b621 100644
> --- a/drivers/mmc/renesas-sdhi.c
> +++ b/drivers/mmc/renesas-sdhi.c
> @@ -568,8 +568,8 @@ int renesas_sdhi_execute_tuning(struct udevice *dev, uint opcode)
>  	struct mmc *mmc = upriv->mmc;
>  	unsigned int tap_num;
>  	unsigned int taps = 0;
> -	int i, ret = 0;
> -	u32 caps;
> +	int i, ret = 0, sret;
> +	u32 caps, reg;
>  
>  	/* Only supported on Renesas RCar */
>  	if (!(priv->caps & TMIO_SD_CAP_RCAR_UHS))
> @@ -612,8 +612,8 @@ int renesas_sdhi_execute_tuning(struct udevice *dev, uint opcode)
>  		if (ret == 0)
>  			taps |= BIT(i);
>  
> -		ret = renesas_sdhi_compare_scc_data(priv);
> -		if (ret == 0)
> +		reg = renesas_sdhi_compare_scc_data(priv);
> +		if (reg == 0)
>  			priv->smpcmp |= BIT(i);
>  
>  		mdelay(1);
> @@ -624,9 +624,9 @@ int renesas_sdhi_execute_tuning(struct udevice *dev, uint opcode)
>  		 * eMMC.
>  		 */
>  		if (ret && (opcode == MMC_CMD_SEND_TUNING_BLOCK_HS200)) {
> -			ret = mmc_send_stop_transmission(mmc, false);
> -			if (ret < 0)
> -				dev_dbg(dev, "Tuning abort fail (%d)\n", ret);
> +			sret = mmc_send_stop_transmission(mmc, false);
> +			if (sret < 0)
> +				dev_dbg(dev, "Tuning abort fail (%d)\n", sret);
>  		}
>  	}
>  

Reviewed-by: Paul Barker <paul.barker.ct at bp.renesas.com>
Tested-by: Paul Barker <paul.barker.ct at bp.renesas.com>
  (tested on RZ/G2L with commit ad50a8151387 from
  https://source.denx.de/u-boot/custodians/u-boot-sh)

-- 
Paul Barker
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0x27F4B3459F002257.asc
Type: application/pgp-keys
Size: 3520 bytes
Desc: OpenPGP public key
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20240220/3b028d08/attachment.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 236 bytes
Desc: OpenPGP digital signature
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20240220/3b028d08/attachment.sig>


More information about the U-Boot mailing list