diff options
author | Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> | 2019-03-28 18:20:07 +0900 |
---|---|---|
committer | Takeshi Saito <takeshi.saito.xv@renesas.com> | 2019-04-01 17:28:08 +0900 |
commit | de462a6e5630bb3abe28e0eeb13f95e953fca50c (patch) | |
tree | d5cc846a2a9dfd617b60522116d1c6f34619e8c0 | |
parent | d21be5eb5cfce69bc73e07141904024853b62ca8 (diff) | |
download | renesas-bsp-de462a6e5630bb3abe28e0eeb13f95e953fca50c.tar.gz |
mmc: core: retry CMD1 in mmc_send_op_cond() even if the ocr = 0
According to eMMC specification, we should issue CMD1 repeatidly in
the idle state until the eMMC is ready even if the mmc_attach_mmc()
calls this function with ocr = 0. Otherwise some eMMC devices seems
to enter the inactive mode after mmc_init_card() issued CMD0 when
the eMMC device is busy.
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Patchwork: https://patchwork.kernel.org/patch/10874621/
Signed-off-by: Takeshi Saito <takeshi.saito.xv@renesas.com>
-rw-r--r-- | drivers/mmc/core/mmc_ops.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index 54686ca4bfb7e..631bae786fcf7 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -184,11 +184,7 @@ int mmc_send_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr) if (err) break; - /* if we're just probing, do a single pass */ - if (ocr == 0) - break; - - /* otherwise wait until reset completes */ + /* wait until reset completes */ if (mmc_host_is_spi(host)) { if (!(cmd.resp[0] & R1_SPI_IDLE)) break; @@ -200,6 +196,17 @@ int mmc_send_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr) err = -ETIMEDOUT; mmc_delay(10); + + /* + * According to eMMC specification, we should issue CMD1 + * repeatidly in the idle state until the eMMC is ready even if + * the mmc_attach_mmc() calls this function with ocr = 0. + * Otherwise some eMMC devices seem to enter the inactive mode + * after mmc_init_card() issued CMD0 when the eMMC device is + * busy. + */ + if (!ocr && !mmc_host_is_spi(host)) + cmd.arg = cmd.resp[0] | BIT(30); } if (rocr && !mmc_host_is_spi(host)) |