MdeModulePkg/SdMmcPciHcDxe: Fix SdMmcMmcLegacy bus timing handling

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>
This commit is contained in:
Albecki, Mateusz 2019-09-26 22:27:44 +08:00 committed by Hao A Wu
parent a8c1fc70db
commit 76e1e5631f
1 changed files with 7 additions and 1 deletions

View File

@ -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);
}