[edk2-devel] [PATCH] bRefClkFreq UFS card attribute need to be programmed after fDeviceInit

Bandaru, Purna Chandra Rao posted 1 patch 2 years, 1 month ago
Failed in applying to current master (apply log)
.../Bus/Ufs/UfsPassThruDxe/UfsPassThru.c      | 34 +++++++++----------
1 file changed, 17 insertions(+), 17 deletions(-)
[edk2-devel] [PATCH] bRefClkFreq UFS card attribute need to be programmed after fDeviceInit
Posted by Bandaru, Purna Chandra Rao 2 years, 1 month ago
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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88028): https://edk2.groups.io/g/devel/message/88028
Mute This Topic: https://groups.io/mt/90020932/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] bRefClkFreq UFS card attribute need to be programmed after fDeviceInit
Posted by Wu, Hao A 2 years, 1 month ago
Will slightly modify the subject to:
MdeModulePkg/Ufs: bRefClkFreq attribute be programmed after fDeviceInit

Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Will wait a day before merging to see if comment from other reviewers.

Best Regards,
Hao Wu

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Bandaru,
> Purna Chandra Rao
> Sent: Friday, March 25, 2022 8:18 PM
> To: devel@edk2.groups.io
> Cc: Bandaru, Purna Chandra Rao <purna.chandra.rao.bandaru@intel.com>; Wu,
> Hao A <hao.a.wu@intel.com>; Albecki, Mateusz <mateusz.albecki@intel.com>;
> Gao, Liming <gaoliming@byosoft.com.cn>; Liu, Zhiguang
> <zhiguang.liu@intel.com>
> Subject: [edk2-devel] [PATCH] bRefClkFreq UFS card attribute need to be
> programmed after fDeviceInit
> 
> 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
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88080): https://edk2.groups.io/g/devel/message/88080
Mute This Topic: https://groups.io/mt/90020932/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] bRefClkFreq UFS card attribute need to be programmed after fDeviceInit
Posted by Wu, Hao A 2 years, 1 month ago
Pushed via:
PR - https://github.com/tianocore/edk2/pull/2701
Commit - https://github.com/tianocore/edk2/commit/7456990e8eebe3b935447253bb6d1d3129839122

Best Regards,
Hao Wu

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Wu, Hao A
> Sent: Monday, March 28, 2022 8:30 AM
> To: devel@edk2.groups.io; Bandaru, Purna Chandra Rao
> <purna.chandra.rao.bandaru@intel.com>
> Cc: Albecki, Mateusz <mateusz.albecki@intel.com>; Gao, Liming
> <gaoliming@byosoft.com.cn>; Liu, Zhiguang <zhiguang.liu@intel.com>
> Subject: Re: [edk2-devel] [PATCH] bRefClkFreq UFS card attribute need to be
> programmed after fDeviceInit
> 
> Will slightly modify the subject to:
> MdeModulePkg/Ufs: bRefClkFreq attribute be programmed after fDeviceInit
> 
> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Will wait a day before merging
> to see if comment from other reviewers.
> 
> Best Regards,
> Hao Wu
> 
> > -----Original Message-----
> > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of
> > Bandaru, Purna Chandra Rao
> > Sent: Friday, March 25, 2022 8:18 PM
> > To: devel@edk2.groups.io
> > Cc: Bandaru, Purna Chandra Rao <purna.chandra.rao.bandaru@intel.com>;
> > Wu, Hao A <hao.a.wu@intel.com>; Albecki, Mateusz
> > <mateusz.albecki@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>;
> > Liu, Zhiguang <zhiguang.liu@intel.com>
> > Subject: [edk2-devel] [PATCH] bRefClkFreq UFS card attribute need to
> > be programmed after fDeviceInit
> >
> > 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
> >
> >
> >
> >
> >
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88144): https://edk2.groups.io/g/devel/message/88144
Mute This Topic: https://groups.io/mt/90020932/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-