REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2218

There is a bug in current driver code that makes
it impossible for it to work with devices that
only work in legacy speed mode since the function
EmmcSwitchToHighSpeed will return with EFI_INVALID_ARGUMENT
for such bus mode. Since the logic in that function will
work well for SdMmcMmcLegacy this patch just allows
to call this function with SdMmcMmcLegacy bus mode.

Signed-off-by: Mateusz Albecki <mateusz.albe...@intel.com>
Cc: Hao A Wu <hao.a...@intel.com>
Cc: Marcin Wojtas <m...@semihalf.com>
---
 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c 
b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
index 3598a8538a..082904ccc5 100644
--- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
+++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
@@ -794,7 +794,7 @@ EmmcSwitchToHighSpeed (
   EFI_STATUS  Status;
   BOOLEAN     IsDdr;
 
-  if ((BusMode->BusTiming != SdMmcMmcHsSdr && BusMode->BusTiming != 
SdMmcMmcHsDdr) ||
+  if ((BusMode->BusTiming != SdMmcMmcHsSdr && BusMode->BusTiming != 
SdMmcMmcHsDdr && BusMode->BusTiming != SdMmcMmcLegacy) ||
       BusMode->ClockFreq > 52) {
     return EFI_INVALID_PARAMETER;
   }
@@ -1244,6 +1244,12 @@ EmmcSetBusMode (
   } else if (BusMode.BusTiming == SdMmcMmcHs200) {
     Status = EmmcSwitchToHS200 (PciIo, PassThru, Slot, Rca, &BusMode);
   } else {
+    //
+    // Note that EmmcSwitchToHighSpeed is also called for SdMmcMmcLegacy
+    // bus timing. This is because even though we might not want to
+    // change the timing itself we still want to allow customization of
+    // bus parameters such as clock frequency and bus width.
+    //
     Status = EmmcSwitchToHighSpeed (PciIo, PassThru, Slot, Rca, &BusMode);
   }
 
-- 
2.14.1.windows.1

--------------------------------------------------------------------

Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial 
Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | 
Kapital zakladowy 200.000 PLN.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i 
moze zawierac informacje poufne. W razie przypadkowego otrzymania tej 
wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; 
jakiekolwiek
przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole 
use of the intended recipient(s). If you are not the intended recipient, please 
contact the sender and delete all copies; any review or distribution by
others is strictly prohibited.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#48116): https://edk2.groups.io/g/devel/message/48116
Mute This Topic: https://groups.io/mt/34299257/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to