public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
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 4/5] Platform/RPi/MmcDxe: Improve MMC driver stability
Date: Wed, 27 Nov 2019 12:37:05 +0000	[thread overview]
Message-ID: <20191127123706.4604-5-pete@akeo.ie> (raw)
In-Reply-To: <20191127123706.4604-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


  parent reply	other threads:[~2019-11-27 12:37 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-27 12:37 [edk2-platforms][PATCH 0/5] Further RPi4 support groundwork Pete Batard
2019-11-27 12:37 ` [edk2-platforms][PATCH 1/5] Silicon/Bcm283x: Clean up Bcm2836.h header Pete Batard
2019-11-27 12:48   ` Ard Biesheuvel
2019-11-27 12:56     ` Pete Batard
2019-11-27 13:00       ` Ard Biesheuvel
2019-11-27 13:09         ` Pete Batard
2019-11-27 13:17           ` Ard Biesheuvel
2019-11-27 13:21             ` Pete Batard
2019-11-27 14:47   ` Philippe Mathieu-Daudé
2019-11-27 14:59     ` [edk2-devel] " Pete Batard
2019-11-27 15:18       ` Philippe Mathieu-Daudé
2019-11-27 12:37 ` [edk2-platforms][PATCH 2/5] Silicon/Bcm283x: Add FIFO mode for RNG Pete Batard
2019-11-27 12:44   ` Ard Biesheuvel
2019-11-27 12:47     ` Pete Batard
2019-11-27 12:37 ` [edk2-platforms][PATCH 3/5] Platform/RPi/MmcDxe: Factorize SCR call and clean up MMC init Pete Batard
2019-11-27 12:37 ` Pete Batard [this message]
2019-11-27 12:37 ` [edk2-platforms][PATCH 5/5] Platform/RPi: Set SD routing according to model Pete Batard
2019-11-27 15:24   ` Philippe Mathieu-Daudé
2019-11-27 16:33     ` Pete Batard
2019-11-27 17:04       ` Leif Lindholm
2019-11-27 17:17         ` Philippe Mathieu-Daudé

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=20191127123706.4604-5-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