public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: tien.hock.loh@intel.com
To: edk2-devel@lists.01.org, leif.lindholm@linaro.org,
	ard.biesheuvel@linaro.org, thloh85@gmail.com
Subject: [PATCH 1/4] EmbeddedPkg/DwEmmc: Remove unnecessary MicroSecondDelay
Date: Fri, 22 Feb 2019 15:52:44 +0800	[thread overview]
Message-ID: <1550821967-1630-2-git-send-email-tien.hock.loh@intel.com> (raw)
In-Reply-To: <1550821967-1630-1-git-send-email-tien.hock.loh@intel.com>

From: "Loh, Tien Hock" <tien.hock.loh@intel.com>

Existing implementation checks for error regardless of if
DWEMMC_INT_CMD_DONE is set, causing the loop check to errors out
even when it shouldn't if the MicroSecondDelay doesn't do long
enough delays. This removes MicroSecondDelay and updates the
function to check for CMD_DONE before doing any error checking.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Loh Tien Hock <tien.hock.loh@intel.com>
---
 EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.c b/EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.c
index 0437e30..6d0f472 100644
--- a/EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.c
+++ b/EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.c
@@ -290,17 +290,15 @@ SendCommand (
   ErrMask = DWEMMC_INT_EBE | DWEMMC_INT_HLE | DWEMMC_INT_RTO |
             DWEMMC_INT_RCRC | DWEMMC_INT_RE;
   ErrMask |= DWEMMC_INT_DCRC | DWEMMC_INT_DRT | DWEMMC_INT_SBE;
+
   do {
-    MicroSecondDelay(500);
     Data = MmioRead32 (DWEMMC_RINTSTS);
-
-    if (Data & ErrMask) {
-      return EFI_DEVICE_ERROR;
-    }
-    if (Data & DWEMMC_INT_DTO) {     // Transfer Done
-      break;
-    }
   } while (!(Data & DWEMMC_INT_CMD_DONE));
+
+  if (Data & ErrMask) {
+    return EFI_DEVICE_ERROR;
+  }
+
   return EFI_SUCCESS;
 }
 
-- 
2.2.2



  reply	other threads:[~2019-02-22  7:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-22  7:52 [PATCH 0/4] EmbeddedPkg/DwEmmc: Fix bugs causing DwEmmc to fail to initialize tien.hock.loh
2019-02-22  7:52 ` tien.hock.loh [this message]
2019-02-22  7:52 ` [PATCH 2/4] EmbeddedPkg/DwEmmc: Fix SendCommand parameters tien.hock.loh
2019-02-22  7:52 ` [PATCH 3/4] EmbeddedPkg/DwEmmc: Fix DMA transfer length tien.hock.loh
2019-02-22  7:52 ` [PATCH 4/4] EmbeddedPkg/DwEmmc: Check DMA completion in SendCommand tien.hock.loh
2019-03-18  1:52 ` [PATCH 0/4] EmbeddedPkg/DwEmmc: Fix bugs causing DwEmmc to fail to initialize Loh, Tien Hock
  -- strict thread matches above, loose matches on Subject: below --
2019-02-22  8:06 tien.hock.loh
2019-02-22  8:06 ` [PATCH 1/4] EmbeddedPkg/DwEmmc: Remove unnecessary MicroSecondDelay tien.hock.loh
2018-10-25  5:52 [PATCH 0/4] EmbeddedPkg/DwEmmc: Fix bugs causing DwEmmc to fail to initialize tien.hock.loh
2018-10-25  5:52 ` [PATCH 1/4] EmbeddedPkg/DwEmmc: Remove unnecessary MicroSecondDelay tien.hock.loh

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=1550821967-1630-2-git-send-email-tien.hock.loh@intel.com \
    --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