From: "Pete Batard" <pete@akeo.ie>
To: devel@edk2.groups.io
Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org,
philmd@redhat.com, samer.el-haj-mahmoud@arm.com,
andrey.warkentin@gmail.com
Subject: [edk2-platforms][PATCH v2 2/3] Platform/RPi/MmcDxe: Improve MMC driver stability
Date: Mon, 2 Dec 2019 17:16:21 +0000 [thread overview]
Message-ID: <20191202171622.10980-3-pete@akeo.ie> (raw)
In-Reply-To: <20191202171622.10980-1-pete@akeo.ie>
From: Andrei Warkentin <andrey.warkentin@gmail.com>
For reasons that aren't entirely understood, SCR reads can randomly
fail on the Raspberry Pi 4. It can be on the first boot or during
subsequent reboots.
To alleviate this, and improve the overall behavior of the code,
we modify CheckCardsCallback () to retry InitializeMmcDevice ()
in case of failure.
Signed-off-by: Pete Batard <pete@akeo.ie>
---
Platform/RaspberryPi/Drivers/MmcDxe/Mmc.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/Platform/RaspberryPi/Drivers/MmcDxe/Mmc.c b/Platform/RaspberryPi/Drivers/MmcDxe/Mmc.c
index c3c7279e4707..f6c4cc7bc3a3 100644
--- a/Platform/RaspberryPi/Drivers/MmcDxe/Mmc.c
+++ b/Platform/RaspberryPi/Drivers/MmcDxe/Mmc.c
@@ -2,6 +2,7 @@
*
* Main file of the MMC Dxe driver. The driver entrypoint is defined into this file.
*
+ * Copyright (c) 2019, Andrei Warkentin <andrey.warkentin@gmail.com>
* Copyright (c) 2011-2013, ARM Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -367,7 +368,11 @@ CheckCardsCallback (
MmcHostInstance->Initialized = !MmcHostInstance->Initialized;
if (MmcHostInstance->BlockIo.Media->MediaPresent) {
- InitializeMmcDevice (MmcHostInstance);
+ Status = InitializeMmcDevice (MmcHostInstance);
+ if (EFI_ERROR (Status)) {
+ MmcHostInstance->Initialized = !MmcHostInstance->Initialized;
+ continue;
+ }
}
Status = gBS->ReinstallProtocolInterface (
--
2.21.0.windows.1
next prev parent reply other threads:[~2019-12-02 17:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-02 17:16 [edk2-platforms][PATCH v2 0/3] Further RPi4 support groundwork Pete Batard
2019-12-02 17:16 ` [edk2-platforms][PATCH v2 1/3] Platform/RPi/MmcDxe: Factorize SCR call and clean up MMC init Pete Batard
2019-12-02 17:16 ` Pete Batard [this message]
2019-12-02 17:16 ` [edk2-platforms][PATCH v2 3/3] Platform/RPi: Set SD routing according to model Pete Batard
2019-12-02 17:43 ` [edk2-platforms][PATCH v2 0/3] Further RPi4 support groundwork Ard Biesheuvel
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=20191202171622.10980-3-pete@akeo.ie \
--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