Merge pull request #72 from hzhuang1/replace_delay_2
MdeModulePkg/UfsPassThruDxe: use loop to polling UTRLRSR
diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
index 335bd99..fbb31ed 100644
--- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
+++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
@@ -811,12 +811,14 @@
UINT32 Data;
EFI_STATUS Status;
- Status = UfsMmioRead32 (Private, UFS_HC_UTRLRSR_OFFSET, &Data);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- if ((Data & UFS_HC_UTRLRSR) != UFS_HC_UTRLRSR) {
+ for (;;) {
+ Status = UfsMmioRead32 (Private, UFS_HC_UTRLRSR_OFFSET, &Data);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ if ((Data & UFS_HC_UTRLRSR) == UFS_HC_UTRLRSR) {
+ break;
+ }
Status = UfsMmioWrite32 (Private, UFS_HC_UTRLRSR_OFFSET, UFS_HC_UTRLRSR);
if (EFI_ERROR (Status)) {
return Status;
@@ -1195,7 +1197,6 @@
ASSERT (QueryResp != NULL);
CmdDescSize = Trd->RuO * sizeof (UINT32) + Trd->RuL * sizeof (UINT32);
- MicroSecondDelay (100000);
//
// Start to execute the transfer request.
//
@@ -1363,7 +1364,6 @@
ASSERT (NopInUpiu != NULL);
CmdDescSize = Trd->RuO * sizeof (UINT32) + Trd->RuL * sizeof (UINT32);
- MicroSecondDelay (100000);
//
// Start to execute the transfer request.
//