MdeModulePkg/SdMmcPciHcDxe: Error handling enhance on tuning procedure

Enhance the code to reset tuning circuit when tuning error case happens.

Cc: Wu, Hao A <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian <feng.tian@intel.com>
This commit is contained in:
Feng Tian
2016-05-03 09:49:47 +08:00
parent e7e89b0861
commit 8c983d3e06
4 changed files with 56 additions and 21 deletions

View File

@@ -787,17 +787,24 @@ SdCardTuningClock (
return Status;
}
if ((HostCtrl2 & (BIT6 | BIT7)) == BIT7) {
if ((HostCtrl2 & (BIT6 | BIT7)) == 0) {
break;
}
if ((HostCtrl2 & (BIT6 | BIT7)) == BIT7) {
return EFI_SUCCESS;
}
} while (++Retry < 40);
if (Retry == 40) {
Status = EFI_TIMEOUT;
DEBUG ((EFI_D_ERROR, "SdCardTuningClock: Send tuning block exceeds 40 times\n"));
DEBUG ((EFI_D_ERROR, "SdCardTuningClock: Send tuning block fails at %d times with HostCtrl2 %02x\n", Retry, HostCtrl2));
//
// Abort the tuning procedure and reset the tuning circuit.
//
HostCtrl2 = (UINT8)~(BIT6 | BIT7);
Status = SdMmcHcAndMmio (PciIo, Slot, SD_MMC_HC_HOST_CTRL2, sizeof (HostCtrl2), &HostCtrl2);
if (EFI_ERROR (Status)) {
return Status;
}
return Status;
return EFI_DEVICE_ERROR;
}
/**