fix:[Common] Fix HS switch routine for DDR mode

Switch to High Speed clock frequency before switching bus width for HS DDR mode

Signed-off-by: Michele Rosato <michele.rosato@garrison.com>
This commit is contained in:
michele.rosato
2024-03-07 14:19:31 +00:00
committed by Guo Dong
parent 1a4bce3bf8
commit 50cdd5d8be

View File

@@ -970,9 +970,27 @@ MmcSwitchToHighSpeed (
UINT8 HostCtrl1;
UINT8 HostCtrl2;
Status = MmcSwitchBusWidth (Private, Rca, IsDdr, BusWidth);
if (EFI_ERROR (Status)) {
return Status;
HsTiming = 1;
if (IsDdr) {
Status = MmcSwitchClockFreq (Private, Rca, HsTiming, ClockFreq);
if (EFI_ERROR (Status)) {
return Status;
}
Status = MmcSwitchBusWidth (Private, Rca, IsDdr, BusWidth);
if (EFI_ERROR (Status)) {
return Status;
}
} else {
Status = MmcSwitchBusWidth (Private, Rca, IsDdr, BusWidth);
if (EFI_ERROR (Status)) {
return Status;
}
Status = MmcSwitchClockFreq (Private, Rca, HsTiming, ClockFreq);
if (EFI_ERROR (Status)) {
return Status;
}
}
//
@@ -1003,12 +1021,6 @@ MmcSwitchToHighSpeed (
HostCtrl2 = 0;
}
Status = SdMmcHcOrMmio (Private->SdMmcHcBase, SD_MMC_HC_HOST_CTRL2, sizeof (HostCtrl2), &HostCtrl2);
if (EFI_ERROR (Status)) {
return Status;
}
HsTiming = 1;
Status = MmcSwitchClockFreq (Private, Rca, HsTiming, ClockFreq);
return Status;
}