Some boards may have max clock limitation. Add a Pcd to notify driver.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jun Nie jun.nie@linaro.org --- Drivers/Mmc/DwEmmcDxe/DwEmmcDxe.c | 3 +++ Drivers/Mmc/DwEmmcDxe/DwEmmcDxe.dec | 1 + Drivers/Mmc/DwEmmcDxe/DwEmmcDxe.inf | 1 + 3 files changed, 5 insertions(+)
diff --git a/Drivers/Mmc/DwEmmcDxe/DwEmmcDxe.c b/Drivers/Mmc/DwEmmcDxe/DwEmmcDxe.c index fe23d11..c67dd0d 100644 --- a/Drivers/Mmc/DwEmmcDxe/DwEmmcDxe.c +++ b/Drivers/Mmc/DwEmmcDxe/DwEmmcDxe.c @@ -560,6 +560,9 @@ DwEmmcSetIos ( EFI_STATUS Status = EFI_SUCCESS; UINT32 Data;
+ if (BusClockFreq > PcdGet32 (PcdDwEmmcDxeMaxClockFrequencyInHz)) + return EFI_UNSUPPORTED; + if (TimingMode != EMMCBACKWARD) { Data = MmioRead32 (DWEMMC_UHSREG); switch (TimingMode) { diff --git a/Drivers/Mmc/DwEmmcDxe/DwEmmcDxe.dec b/Drivers/Mmc/DwEmmcDxe/DwEmmcDxe.dec index c4bf7ed..7b84a9a 100644 --- a/Drivers/Mmc/DwEmmcDxe/DwEmmcDxe.dec +++ b/Drivers/Mmc/DwEmmcDxe/DwEmmcDxe.dec @@ -40,3 +40,4 @@ # DwEmmc Driver PCDs gDwEmmcDxeTokenSpaceGuid.PcdDwEmmcDxeBaseAddress|0x0|UINT32|0x00000001 gDwEmmcDxeTokenSpaceGuid.PcdDwEmmcDxeClockFrequencyInHz|0x0|UINT32|0x00000002 + gDwEmmcDxeTokenSpaceGuid.PcdDwEmmcDxeMaxClockFrequencyInHz|0x0|UINT32|52000000 diff --git a/Drivers/Mmc/DwEmmcDxe/DwEmmcDxe.inf b/Drivers/Mmc/DwEmmcDxe/DwEmmcDxe.inf index c0cbba7..99176f1 100644 --- a/Drivers/Mmc/DwEmmcDxe/DwEmmcDxe.inf +++ b/Drivers/Mmc/DwEmmcDxe/DwEmmcDxe.inf @@ -49,6 +49,7 @@ [Pcd] gDwEmmcDxeTokenSpaceGuid.PcdDwEmmcDxeBaseAddress gDwEmmcDxeTokenSpaceGuid.PcdDwEmmcDxeClockFrequencyInHz + gDwEmmcDxeTokenSpaceGuid.PcdDwEmmcDxeMaxClockFrequencyInHz
[Depex] TRUE