]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/Ufs: bRefClkFreq attribute be programmed after fDeviceInit
authorBandaru, Purna Chandra Rao <purna.chandra.rao.bandaru@intel.com>
Fri, 25 Mar 2022 12:18:00 +0000 (20:18 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Tue, 29 Mar 2022 01:42:31 +0000 (01:42 +0000)
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>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c

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