MdeModulePkg/SdMmcPciHcDxe: Hook SwitchClockFreq after SD clock start

For eMMC modules we used to notify the platform about frequency
change only after sending CMD13 which meant that platform
might not get a chance to apply required post frequency
change fixes to get the clock stable. To fix this
notification has been moved to SdMmcHcClockSupply function
just after we start the SD clock. During first time setup
the notification won't be sent to avoid changing old behavior.

Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Marcin Wojtas <mw@semihalf.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Cc: Liming Gao <liming.gao@intel.com>

Signed-off-by: Mateusz Albecki <mateusz.albecki@intel.com>
Tested-by: Marcin Wojtas <mw@semihalf.com>
Tested-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
This commit is contained in:
Albecki, Mateusz
2019-12-21 01:13:11 +08:00
committed by mergify[bot]
parent b948a49615
commit 49accdedf9
5 changed files with 81 additions and 142 deletions

View File

@@ -796,6 +796,30 @@ SdCardIdentification (
IN UINT8 Slot
);
/**
SD/MMC card clock supply.
Refer to SD Host Controller Simplified spec 3.0 Section 3.2.1 for details.
@param[in] Private A pointer to the SD_MMC_HC_PRIVATE_DATA instance.
@param[in] Slot The slot number of the SD card to send the command to.
@param[in] BusTiming BusTiming at which the frequency change is done.
@param[in] FirstTimeSetup Flag to indicate whether the clock is being setup for the first time.
@param[in] ClockFreq The max clock frequency to be set. The unit is KHz.
@retval EFI_SUCCESS The clock is supplied successfully.
@retval Others The clock isn't supplied successfully.
**/
EFI_STATUS
SdMmcHcClockSupply (
IN SD_MMC_HC_PRIVATE_DATA *Private,
IN UINT8 Slot,
IN SD_MMC_BUS_MODE BusTiming,
IN BOOLEAN FirstTimeSetup,
IN UINT64 ClockFreq
);
/**
Software reset the specified SD/MMC host controller.