public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Bandaru, Purna Chandra Rao" <purna.chandra.rao.bandaru@intel.com>
To: devel@edk2.groups.io
Cc: Purna Chandra Rao Bandaru <purna.chandra.rao.bandaru@intel.com>,
	Wu Hao A <hao.a.wu@intel.com>,
	Albecki Mateusz <mateusz.albecki@intel.com>,
	Liming Gao <gaoliming@byosoft.com.cn>,
	Zhiguang Liu <zhiguang.liu@intel.com>
Subject: [PATCH] bRefClkFreq UFS card attribute need to be programmed after fDeviceInit
Date: Fri, 25 Mar 2022 17:48:00 +0530	[thread overview]
Message-ID: <d89b385f678971d1bc7ea952d79ef9b1648bbdd6.1648210538.git.purna.chandra.rao.bandaru@intel.com> (raw)

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3886

bRefClkFreq UFS card attribute need to be read and written after successful
fDeviceInit and NOP response so that link will be stable.

Cc: Wu Hao A <hao.a.wu@intel.com>
Cc: Albecki Mateusz <mateusz.albecki@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>

Signed-off-by: Purna Chandra Rao Bandaru <purna.chandra.rao.bandaru@intel.com>
---
 .../Bus/Ufs/UfsPassThruDxe/UfsPassThru.c      | 34 +++++++++----------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
index dc78e09678..ae593ff03a 100644
--- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
+++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
@@ -919,6 +919,23 @@ UfsPassThruDriverBindingStart (
     goto Error;
   }
 
+  //
+  // UFS 2.0 spec Section 13.1.3.3:
+  // At the end of the UFS Interconnect Layer initialization on both host and device side,
+  // the host shall send a NOP OUT UPIU to verify that the device UTP Layer is ready.
+  //
+  Status = UfsExecNopCmds (Private);
+  if (EFI_ERROR (Status)) {
+    DEBUG ((DEBUG_ERROR, "Ufs Sending NOP IN command Error, Status = %r\n", Status));
+    goto Error;
+  }
+
+  Status = UfsFinishDeviceInitialization (Private);
+  if (EFI_ERROR (Status)) {
+    DEBUG ((DEBUG_ERROR, "Device failed to finish initialization, Status = %r\n", Status));
+    goto Error;
+  }
+
   if ((mUfsHcPlatform != NULL) &&
       ((mUfsHcPlatform->RefClkFreq == EdkiiUfsCardRefClkFreq19p2Mhz) ||
        (mUfsHcPlatform->RefClkFreq == EdkiiUfsCardRefClkFreq26Mhz) ||
@@ -967,23 +984,6 @@ UfsPassThruDriverBindingStart (
     }
   }
 
-  //
-  // UFS 2.0 spec Section 13.1.3.3:
-  // At the end of the UFS Interconnect Layer initialization on both host and device side,
-  // the host shall send a NOP OUT UPIU to verify that the device UTP Layer is ready.
-  //
-  Status = UfsExecNopCmds (Private);
-  if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "Ufs Sending NOP IN command Error, Status = %r\n", Status));
-    goto Error;
-  }
-
-  Status = UfsFinishDeviceInitialization (Private);
-  if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "Device failed to finish initialization, Status = %r\n", Status));
-    goto Error;
-  }
-
   //
   // Check if 8 common luns are active and set corresponding bit mask.
   //
-- 
2.31.1.windows.1


             reply	other threads:[~2022-03-25 12:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-25 12:18 Bandaru, Purna Chandra Rao [this message]
2022-03-28  0:29 ` [edk2-devel] [PATCH] bRefClkFreq UFS card attribute need to be programmed after fDeviceInit Wu, Hao A
2022-03-29  1:47   ` Wu, Hao A

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=d89b385f678971d1bc7ea952d79ef9b1648bbdd6.1648210538.git.purna.chandra.rao.bandaru@intel.com \
    --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