public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Jun Nie <jun.nie@linaro.org>
To: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org,
	haojian.zhuang@linaro.org, edk2-devel@lists.01.org
Cc: shawn.guo@linaro.org, jason.liu@linaro.org, Jun Nie <jun.nie@linaro.org>
Subject: [PATCH v2 1/2] EmbeddedPkg/DwEmmcDxe: limit max clock for platform
Date: Wed,  5 Jul 2017 16:27:07 +0800	[thread overview]
Message-ID: <1499243228-1225-1-git-send-email-jun.nie@linaro.org> (raw)

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..bb26b69 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 ((PcdGet32 (PcdDwEmmcDxeMaxClockFreqInHz) != 0) &&
+      (BusClockFreq > PcdGet32 (PcdDwEmmcDxeMaxClockFreqInHz))) {
+    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..99b4f99 100644
--- a/EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.inf
+++ b/EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.inf
@@ -48,6 +48,7 @@
 [Pcd]
   gEmbeddedTokenSpaceGuid.PcdDwEmmcDxeBaseAddress
   gEmbeddedTokenSpaceGuid.PcdDwEmmcDxeClockFrequencyInHz
+  gEmbeddedTokenSpaceGuid.PcdDwEmmcDxeMaxClockFreqInHz
 
 [Depex]
   TRUE
diff --git a/EmbeddedPkg/EmbeddedPkg.dec b/EmbeddedPkg/EmbeddedPkg.dec
index 5ea2f22..2da9b2f 100644
--- a/EmbeddedPkg/EmbeddedPkg.dec
+++ b/EmbeddedPkg/EmbeddedPkg.dec
@@ -169,6 +169,7 @@
   # DwEmmc Driver PCDs
   gEmbeddedTokenSpaceGuid.PcdDwEmmcDxeBaseAddress|0x0|UINT32|0x00000035
   gEmbeddedTokenSpaceGuid.PcdDwEmmcDxeClockFrequencyInHz|0x0|UINT32|0x00000036
+  gEmbeddedTokenSpaceGuid.PcdDwEmmcDxeMaxClockFreqInHz|0x0|UINT32|0x00000037
 
   #
   # Android FastBoot
-- 
1.9.1



             reply	other threads:[~2017-07-05  8:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-05  8:27 Jun Nie [this message]
2017-07-05  8:27 ` [PATCH v2 2/2] EmbeddedPkg/DwEmmc: Adjust FIFO threshold Jun Nie
2017-07-06 15:22   ` Leif Lindholm
2017-07-07  9:13     ` Jun Nie
2017-07-06 15:24 ` [PATCH v2 1/2] EmbeddedPkg/DwEmmcDxe: limit max clock for platform Leif Lindholm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1499243228-1225-1-git-send-email-jun.nie@linaro.org \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox