From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=tien.hock.loh@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 49A46211CCD5A for ; Thu, 21 Feb 2019 23:53:11 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Feb 2019 23:53:11 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,398,1544515200"; d="scan'208";a="146371382" Received: from pg-iccf0308.altera.com ([10.104.2.61]) by fmsmga004.fm.intel.com with ESMTP; 21 Feb 2019 23:53:09 -0800 From: tien.hock.loh@intel.com To: edk2-devel@lists.01.org, leif.lindholm@linaro.org, ard.biesheuvel@linaro.org, thloh85@gmail.com Date: Fri, 22 Feb 2019 15:52:44 +0800 Message-Id: <1550821967-1630-2-git-send-email-tien.hock.loh@intel.com> X-Mailer: git-send-email 2.2.2 In-Reply-To: <1550821967-1630-1-git-send-email-tien.hock.loh@intel.com> References: <1550821967-1630-1-git-send-email-tien.hock.loh@intel.com> Subject: [PATCH 1/4] EmbeddedPkg/DwEmmc: Remove unnecessary MicroSecondDelay X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Feb 2019 07:53:11 -0000 From: "Loh, Tien Hock" 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 --- 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