public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] EmbeddedPkg/DwEmmcDxe: limit max clock for platform
@ 2017-07-03  4:01 Jun Nie
  2017-07-03  4:01 ` [PATCH 2/2] EmbeddedPkg/DwEmmc: Adjust FIFO threshold Jun Nie
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jun Nie @ 2017-07-03  4:01 UTC (permalink / raw)
  To: ard.biesheuvel, leif.lindholm, haojian.zhuang, edk2-devel
  Cc: shawn.guo, jason.liu, Jun Nie

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>
---
 EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.c   | 4 ++++
 EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.inf | 1 +
 EmbeddedPkg/EmbeddedPkg.dec                 | 1 +
 3 files changed, 6 insertions(+)

diff --git a/EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.c b/EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.c
index fe23d11..308f3a7 100644
--- a/EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.c
+++ b/EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.c
@@ -560,6 +560,10 @@ 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/EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.inf b/EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.inf
index e3c8313..3582997 100644
--- a/EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.inf
+++ b/EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.inf
@@ -48,6 +48,7 @@
 [Pcd]
   gEmbeddedTokenSpaceGuid.PcdDwEmmcDxeBaseAddress
   gEmbeddedTokenSpaceGuid.PcdDwEmmcDxeClockFrequencyInHz
+  gDwEmmcDxeTokenSpaceGuid.PcdDwEmmcDxeMaxClockFrequencyInHz
 
 [Depex]
   TRUE
diff --git a/EmbeddedPkg/EmbeddedPkg.dec b/EmbeddedPkg/EmbeddedPkg.dec
index 0d4a062..aec8259 100644
--- a/EmbeddedPkg/EmbeddedPkg.dec
+++ b/EmbeddedPkg/EmbeddedPkg.dec
@@ -167,6 +167,7 @@
   # DwEmmc Driver PCDs
   gEmbeddedTokenSpaceGuid.PcdDwEmmcDxeBaseAddress|0x0|UINT32|0x00000035
   gEmbeddedTokenSpaceGuid.PcdDwEmmcDxeClockFrequencyInHz|0x0|UINT32|0x00000036
+  gDwEmmcDxeTokenSpaceGuid.PcdDwEmmcDxeMaxClockFrequencyInHz|0x0|UINT32|400000000
 
   #
   # Android FastBoot
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-07-03 13:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-03  4:01 [PATCH] EmbeddedPkg/DwEmmcDxe: limit max clock for platform Jun Nie
2017-07-03  4:01 ` [PATCH 2/2] EmbeddedPkg/DwEmmc: Adjust FIFO threshold Jun Nie
2017-07-03 13:21   ` Leif Lindholm
2017-07-03  9:40 ` [PATCH] EmbeddedPkg/DwEmmcDxe: limit max clock for platform Ard Biesheuvel
2017-07-03 12:36 ` Leif Lindholm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox