]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/SdMmcPciHcDxe: Fix SdMmcMmcLegacy bus timing handling
authorAlbecki, Mateusz <mateusz.albecki@intel.com>
Thu, 26 Sep 2019 14:27:44 +0000 (22:27 +0800)
committerHao A Wu <hao.a.wu@intel.com>
Sun, 29 Sep 2019 01:13:24 +0000 (09:13 +0800)
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_PARAMETER
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.albecki@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Tested-by: Hao A Wu <hao.a.wu@intel.com>
Tested-by: Marcin Wojtas <mw@semihalf.com>
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c

index 3598a8538a49f89fa40c75fff090637ff98bb034..082904ccc5df5b7d3b220653480a8e2ecb5ee55b 100644 (file)
@@ -794,7 +794,7 @@ EmmcSwitchToHighSpeed (
   EFI_STATUS  Status;\r
   BOOLEAN     IsDdr;\r
 \r
-  if ((BusMode->BusTiming != SdMmcMmcHsSdr && BusMode->BusTiming != SdMmcMmcHsDdr) ||\r
+  if ((BusMode->BusTiming != SdMmcMmcHsSdr && BusMode->BusTiming != SdMmcMmcHsDdr && BusMode->BusTiming != SdMmcMmcLegacy) ||\r
       BusMode->ClockFreq > 52) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
@@ -1244,6 +1244,12 @@ EmmcSetBusMode (
   } else if (BusMode.BusTiming == SdMmcMmcHs200) {\r
     Status = EmmcSwitchToHS200 (PciIo, PassThru, Slot, Rca, &BusMode);\r
   } else {\r
+    //\r
+    // Note that EmmcSwitchToHighSpeed is also called for SdMmcMmcLegacy\r
+    // bus timing. This is because even though we might not want to\r
+    // change the timing itself we still want to allow customization of\r
+    // bus parameters such as clock frequency and bus width.\r
+    //\r
     Status = EmmcSwitchToHighSpeed (PciIo, PassThru, Slot, Rca, &BusMode);\r
   }\r
 \r