EmbeddedPkg/DwEmmcDxe: limit max clock for platform
authorJun Nie <jun.nie@linaro.org>
Wed, 5 Jul 2017 08:27:07 +0000 (16:27 +0800)
committerLeif Lindholm <leif.lindholm@linaro.org>
Mon, 17 Jul 2017 16:54:06 +0000 (17:54 +0100)
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>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.c
EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.inf
EmbeddedPkg/EmbeddedPkg.dec

index fe23d113ee1204f4525bb7340f41f8e52c979c2d..bb26b69fd16b89ff89aea72af95191ebb59224e5 100644 (file)
@@ -560,6 +560,10 @@ DwEmmcSetIos (
   EFI_STATUS Status = EFI_SUCCESS;\r
   UINT32    Data;\r
 \r
+  if ((PcdGet32 (PcdDwEmmcDxeMaxClockFreqInHz) != 0) &&\r
+      (BusClockFreq > PcdGet32 (PcdDwEmmcDxeMaxClockFreqInHz))) {\r
+    return EFI_UNSUPPORTED;\r
+  }\r
   if (TimingMode != EMMCBACKWARD) {\r
     Data = MmioRead32 (DWEMMC_UHSREG);\r
     switch (TimingMode) {\r
index e3c8313bc506b62ae3d4ab915e40cfc02114fbd6..99b4f990f67bb6c800c0e9071f5851dd286a6cbc 100644 (file)
@@ -48,6 +48,7 @@
 [Pcd]\r
   gEmbeddedTokenSpaceGuid.PcdDwEmmcDxeBaseAddress\r
   gEmbeddedTokenSpaceGuid.PcdDwEmmcDxeClockFrequencyInHz\r
+  gEmbeddedTokenSpaceGuid.PcdDwEmmcDxeMaxClockFreqInHz\r
 \r
 [Depex]\r
   TRUE\r
index 0d4a0625a34257ffbe00ad33e123706cd42e9227..3cb30a49cf3a8e440525824565a8019f98e6b75b 100644 (file)
   # DwEmmc Driver PCDs\r
   gEmbeddedTokenSpaceGuid.PcdDwEmmcDxeBaseAddress|0x0|UINT32|0x00000035\r
   gEmbeddedTokenSpaceGuid.PcdDwEmmcDxeClockFrequencyInHz|0x0|UINT32|0x00000036\r
+  gEmbeddedTokenSpaceGuid.PcdDwEmmcDxeMaxClockFreqInHz|0x0|UINT32|0x00000037\r
 \r
   #\r
   # Android FastBoot\r