public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: edk2-devel@lists.01.org
Cc: leif.lindholm@linaro.org,
	Pipat Methavanitpong <methavanitpong.pipat@socionext.com>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH edk2-platforms] Silicon/Fip006Dxe: map NOR_FLASH_INFO FSR flag with instance flag
Date: Thu, 30 Nov 2017 18:58:28 +0000	[thread overview]
Message-ID: <20171130185828.21277-1-ard.biesheuvel@linaro.org> (raw)

From: Pipat Methavanitpong <methavanitpong.pipat@socionext.com>

Now that we incorporated NorFlashInfoLib into the Fip006Dxe driver,
replace the code that explicitly enables flag status register polling
for Micron NOR flash with a test of the flags field provided by
NorFlashInfoLib, which carries the same information.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pipat Methavanitpong <methavanitpong.pipat@socionext.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.c | 22 +++++++-------------
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.c b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.c
index a521b1f3d167..8d6bca8739d0 100644
--- a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.c
+++ b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.c
@@ -1129,6 +1129,7 @@ NorFlashCreateInstance (
 {
   EFI_STATUS Status;
   NOR_FLASH_INSTANCE* Instance;
+  NOR_FLASH_INFO *FlashInfo;
   UINT8 JedecId[3];
 
   ASSERT(NorFlashInstance != NULL);
@@ -1157,23 +1158,15 @@ NorFlashCreateInstance (
   NorFlashReset (Instance);
 
   NorFlashReadID (Instance, JedecId);
+  Status = NorFlashGetInfo (JedecId, &FlashInfo, FALSE);
+  if (EFI_ERROR (Status)) {
+    goto FreeInstance;
+  }
 
-  DEBUG_CODE_BEGIN ();
-    {
-      NOR_FLASH_INFO    *FlashInfo;
-
-      Status = NorFlashGetInfo (JedecId, &FlashInfo, FALSE);
-      if (EFI_ERROR (Status)) {
-        goto FreeInstance;
-      }
-
-      NorFlashPrintInfo (FlashInfo);
-      FreePool (FlashInfo);
-    }
-  DEBUG_CODE_END ();
+  NorFlashPrintInfo (FlashInfo);
 
   Instance->Flags = 0;
-  if (JedecId[0] == NOR_FLASH_ID_STMICRO) {
+  if (FlashInfo->Flags & NOR_FLASH_WRITE_FSR) {
     Instance->Flags = NOR_FLASH_POLL_FSR;
   }
 
@@ -1198,6 +1191,7 @@ NorFlashCreateInstance (
   }
 
   *NorFlashInstance = Instance;
+  FreePool (FlashInfo);
   return EFI_SUCCESS;
 
 FreeInstance:
-- 
2.11.0



             reply	other threads:[~2017-11-30 18:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-30 18:58 Ard Biesheuvel [this message]
2017-12-01 12:59 ` [PATCH edk2-platforms] Silicon/Fip006Dxe: map NOR_FLASH_INFO FSR flag with instance flag Leif Lindholm
2017-12-01 17:52   ` Ard Biesheuvel

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=20171130185828.21277-1-ard.biesheuvel@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