[PATCH] mmc: rpmb: poll mmc status after sending rpmb request
Peng Fan
peng.fan at oss.nxp.com
Wed Jun 14 13:50:15 CEST 2023
On 5/25/2023 1:45 PM, Ji Luo wrote:
> polling the mmc status to make sure the rpmb request has been
> sent and the mmc is not in BUSY state. This avoids potential
> rpmb request failure during rpmb data write.
>
> Signed-off-by: Ji Luo <ji.luo at nxp.com>
Reviewed-by: Peng Fan <peng.fan at nxp.com>
> ---
> drivers/mmc/rpmb.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/drivers/mmc/rpmb.c b/drivers/mmc/rpmb.c
> index b68d98573c..8bf19fd696 100644
> --- a/drivers/mmc/rpmb.c
> +++ b/drivers/mmc/rpmb.c
> @@ -94,6 +94,7 @@ static int mmc_rpmb_request(struct mmc *mmc, const struct s_rpmb *s,
> struct mmc_cmd cmd = {0};
> struct mmc_data data;
> struct sdhci_host *host = mmc->priv;
> + int timeout_ms = 1000;
> int ret;
>
> ret = mmc_set_blockcount(mmc, count, is_rel_write);
> @@ -123,6 +124,15 @@ static int mmc_rpmb_request(struct mmc *mmc, const struct s_rpmb *s,
> #endif
> return 1;
> }
> +
> + /* poll for the ready status */
> + if (mmc_poll_for_busy(mmc, timeout_ms)) {
> +#ifdef CONFIG_MMC_RPMB_TRACE
> + printf("%s:mmc is busy!\n", __func__);
> +#endif
> + return 1;
> + }
> +
> return 0;
> }
> static int mmc_rpmb_response(struct mmc *mmc, struct s_rpmb *s,
More information about the U-Boot
mailing list