mmc: rpmb: poll mmc status after sending rpmb request
PATCH 1/1 mmc: rpmb: poll mmc status after sending rpmb request
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 <[email protected]>
--- drivers/mmc/rpmb.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/mmc/rpmb.c +10 -0
@@ -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,
Signature · 1 line
2.25.1
Quoted 5 lines · Ji Luo
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 <[email protected]>
Reviewed-by Peng Fan <[email protected]>
Quoted 32 lines
--- drivers/mmc/rpmb.c | 10 ++++++++++ 1 file changed, 10 insertions(+)drivers/mmc/rpmb.c +10
-0@@ -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,