From: Stefan Bosch <stefan_b@posteo.net>
To: u-boot@lists.denx.de
Subject: [RESEND PATCH v1 1/1] mmc: fix response timeout after switch command
Date: Sat, 23 Jan 2021 13:37:41 +0100 [thread overview]
Message-ID: <20210123123741.3224-2-stefan_b@posteo.net> (raw)
In-Reply-To: <20210123123741.3224-1-stefan_b@posteo.net>
After issuing the switch command: Wait until 'current state' of the card
status becomes 'tran'. This prevents from response timeout at the next
command because of 'current state' = 'data'.
Signed-off-by: Stefan Bosch <stefan_b@posteo.net>
---
drivers/mmc/mmc.c | 3 ++-
include/mmc.h | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index a47700e313..8ccd2058a9 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -823,7 +823,8 @@ static int __mmc_switch(struct mmc *mmc, u8 set, u8 index, u8 value,
value);
return -EIO;
}
- if (!ret && (status & MMC_STATUS_RDY_FOR_DATA))
+ if (!ret && (status & MMC_STATUS_RDY_FOR_DATA) &&
+ (status & MMC_STATUS_CURR_STATE) == MMC_STATE_TRANS)
return 0;
udelay(100);
} while (get_timer(start) < timeout_ms);
diff --git a/include/mmc.h b/include/mmc.h
index 1d377e0281..18402494c6 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -178,6 +178,7 @@ static inline bool mmc_is_tuning_cmd(uint cmdidx)
#define MMC_STATUS_ERROR (1 << 19)
#define MMC_STATE_PRG (7 << 9)
+#define MMC_STATE_TRANS (4 << 9)
#define MMC_VDD_165_195 0x00000080 /* VDD voltage 1.65 - 1.95 */
#define MMC_VDD_20_21 0x00000100 /* VDD voltage 2.0 ~ 2.1 */
--
2.17.1
next prev parent reply other threads:[~2021-01-23 12:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-23 12:37 [RESEND PATCH v1 0/1] mmc: fix response timeout after switch command Stefan Bosch
2021-01-23 12:37 ` Stefan Bosch [this message]
2021-01-26 23:38 ` [RESEND PATCH v1 1/1] " Jaehoon Chung
2021-01-28 19:23 ` Stefan Bosch
2021-01-28 22:00 ` Jaehoon Chung
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210123123741.3224-2-stefan_b@posteo.net \
--to=stefan_b@posteo.net \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox