summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Bus
diff options
context:
space:
mode:
authorAlbecki, Mateusz <mateusz.albecki@intel.com>2019-09-26 22:27:44 +0800
committerHao A Wu <hao.a.wu@intel.com>2019-09-29 09:13:24 +0800
commit76e1e5631f1ad9b2275ff31fefe83258c0812b3d (patch)
tree62e13c1c69c0c20c19d37bf65e224c5a8234849c /MdeModulePkg/Bus
parenta8c1fc70dbd56e367464c976ef8aa43e9349b87d (diff)
downloadedk2-76e1e5631f1ad9b2275ff31fefe83258c0812b3d.tar.gz
edk2-76e1e5631f1ad9b2275ff31fefe83258c0812b3d.tar.bz2
edk2-76e1e5631f1ad9b2275ff31fefe83258c0812b3d.zip
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>
Diffstat (limited to 'MdeModulePkg/Bus')
-rw-r--r--MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c8
1 files changed, 7 insertions, 1 deletions
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);
}