MdeModulePkg/SdMmcHcDxe: Implement revision 3 of SdMmcOverrideProtocol
https://bugzilla.tianocore.org/show_bug.cgi?id=1882 Implement support for GetOperatingParamters notify phase in SdMmcHcDxe driver. GetOperatingParameters notify phase is signaled before we start card detection and initialization. Code has been updated for both eMMC and SD card controllers to take into consideration those new parameters. Initialization process has been divided into 2 steps. In the first step we bring the link up to the point where we can get card identification data(Extended CSD in eMMC case and SWITCH command response in SD card case). This data is later used along with controller capabilities and operating parameters passed in GetOperatingParameters phase to choose preferred bus settings in GetTargetBusSettings function. Those settings are later on to start bus training to high speeds. If user passes incompatible setting with selected bus timing driver will assume it's standard behavior with respect to that setting. For instance if HS400 has been selected as a target bus timing due to card and controller support bus width setting of 4 and 1 bit won't be respected and 8 bit setting will be chosen instead. Tests on Marvell boards were also performed by Marcin Wojtas <mw@semihalf.com>: https://edk2.groups.io/g/devel/message/42999 Board 1 (out of tree): SD - OK, MMC - OK Board 2: (Armada80x0McBin): SD - OK, MMC - OK Board 3: (Armada70x0Db): SD - problems, MMC - OK Please note that the problem on Armada70x0Db SD devices are introduced by adding new types of SD bus modes, a subsequent patch within edk2-platforms repository will be proposed to address it. (More details can be referred from the above link.) Signed-off-by: Mateusz Albecki <mateusz.albecki@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Regression-tested-by: Sumit Garg <sumit.garg@linaro.org>
This commit is contained in:
committed by
Hao A Wu
parent
f56cc67f62
commit
adec1f5deb
@@ -1339,6 +1339,40 @@ SdMmcHcUhsSignaling (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Set driver strength in host controller.
|
||||
|
||||
@param[in] PciIo The PCI IO protocol instance.
|
||||
@param[in] SlotIndex The slot index of the card.
|
||||
@param[in] DriverStrength DriverStrength to set in the controller.
|
||||
|
||||
@retval EFI_SUCCESS Driver strength programmed successfully.
|
||||
@retval Others Failed to set driver strength.
|
||||
**/
|
||||
EFI_STATUS
|
||||
SdMmcSetDriverStrength (
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN UINT8 SlotIndex,
|
||||
IN SD_DRIVER_STRENGTH_TYPE DriverStrength
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT16 HostCtrl2;
|
||||
|
||||
if (DriverStrength == SdDriverStrengthIgnore) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
HostCtrl2 = (UINT16)~SD_MMC_HC_CTRL_DRIVER_STRENGTH_MASK;
|
||||
Status = SdMmcHcAndMmio (PciIo, SlotIndex, SD_MMC_HC_HOST_CTRL2, sizeof (HostCtrl2), &HostCtrl2);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
HostCtrl2 = (DriverStrength << 4) & SD_MMC_HC_CTRL_DRIVER_STRENGTH_MASK;
|
||||
return SdMmcHcOrMmio (PciIo, SlotIndex, SD_MMC_HC_HOST_CTRL2, sizeof (HostCtrl2), &HostCtrl2);
|
||||
}
|
||||
|
||||
/**
|
||||
Turn on/off LED.
|
||||
|
||||
|
Reference in New Issue
Block a user