From: Haojian Zhuang <haojian.zhuang@linaro.org>
To: ryan.harkin@linaro.org, edk2-devel@lists.01.org,
leif.lindholm@linaro.org, ard.biesheuvel@linaro.org
Cc: Haojian Zhuang <haojian.zhuang@linaro.org>
Subject: [PATCH v5 1/9] MmcDxe: wait OCR busy bit free
Date: Sun, 13 Nov 2016 14:47:50 +0800 [thread overview]
Message-ID: <1479019678-12621-2-git-send-email-haojian.zhuang@linaro.org> (raw)
In-Reply-To: <1479019678-12621-1-git-send-email-haojian.zhuang@linaro.org>
According to eMMC spec, OCR.PowerUp bit is also busy bit. If the busy
bit is '0', CMD1 should be sent and OCR should be fetched again. And add
a timeout counter on the repeated steps.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
Tested-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
---
EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c b/EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c
index 2d8038f..3f72b7f 100644
--- a/EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c
+++ b/EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c
@@ -222,14 +222,19 @@ MmcIdentificationMode (
// Send CMD1 to get OCR (MMC)
// This command only valid for MMC and eMMC
- Status = MmcHost->SendCommand (MmcHost, MMC_CMD1, EMMC_CMD1_CAPACITY_GREATER_THAN_2GB);
- if (Status == EFI_SUCCESS) {
+ Timeout = MAX_RETRY_COUNT;
+ do {
+ Status = MmcHost->SendCommand (MmcHost, MMC_CMD1, EMMC_CMD1_CAPACITY_GREATER_THAN_2GB);
+ if (EFI_ERROR (Status))
+ break;
Status = MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_OCR, (UINT32 *)&OcrResponse);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "MmcIdentificationMode() : Failed to receive OCR, Status=%r.\n", Status));
return Status;
}
-
+ Timeout--;
+ } while (!OcrResponse.Ocr.PowerUp && (Timeout > 0));
+ if (Status == EFI_SUCCESS) {
if (!OcrResponse.Ocr.PowerUp) {
DEBUG ((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD1): Card initialisation failure, Status=%r.\n", Status));
return EFI_DEVICE_ERROR;
--
2.7.4
next prev parent reply other threads:[~2016-11-13 6:48 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-13 6:47 [PATCH v5 0/9] enhance MMC Haojian Zhuang
2016-11-13 6:47 ` Haojian Zhuang [this message]
2016-11-13 6:47 ` [PATCH v5 2/9] MmcDxe: move ECSD into CardInfo structure Haojian Zhuang
2016-11-13 6:47 ` [PATCH v5 3/9] MmcDxe: declare ECSD structure Haojian Zhuang
2016-11-13 6:47 ` [PATCH v5 4/9] MmcDxe: add SPEC_VERS field in CSD structure Haojian Zhuang
2016-11-13 6:47 ` [PATCH v5 5/9] MmcDxe: add interface to change io width and speed Haojian Zhuang
2016-11-14 16:12 ` Leif Lindholm
2016-11-13 6:47 ` [PATCH v5 6/9] MmcDxe: set io bus width before reading EXTCSD Haojian Zhuang
2016-11-14 16:36 ` Leif Lindholm
2016-11-13 6:47 ` [PATCH v5 7/9] MmcDxe: set iospeed and bus width in SD stack Haojian Zhuang
2016-11-14 17:08 ` Leif Lindholm
2016-11-13 6:47 ` [PATCH v5 8/9] MmcDxe: expand to support multiple blocks Haojian Zhuang
2016-11-14 17:15 ` Leif Lindholm
2016-11-13 6:47 ` [PATCH v5 9/9] PL180: update for indentifying SD Haojian Zhuang
2016-11-14 17:27 ` Leif Lindholm
2016-11-14 15:53 ` [PATCH v5 0/9] enhance MMC Leif Lindholm
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-list 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=1479019678-12621-2-git-send-email-haojian.zhuang@linaro.org \
--to=devel@edk2.groups.io \
/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