Messages in this thread | | | Date | Fri, 04 Dec 2020 11:26:14 +0800 | From | Can Guo <> | Subject | Re: [PATCH 2/3] scsi: ufs: Keep device power on only fWriteBoosterBufferFlushDuringHibernate == 1 |
| |
On 2020-12-01 02:11, Bean Huo wrote: > From: Bean Huo <beanhuo@micron.com> > > Keep device power mode as active power mode and VCC supply only if > fWriteBoosterBufferFlushDuringHibernate setting 1 is successful. > > Signed-off-by: Bean Huo <beanhuo@micron.com> > --- > drivers/scsi/ufs/ufs.h | 2 ++ > drivers/scsi/ufs/ufshcd.c | 11 ++++++++++- > 2 files changed, 12 insertions(+), 1 deletion(-) > > diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h > index d593edb48767..311d5f7a024d 100644 > --- a/drivers/scsi/ufs/ufs.h > +++ b/drivers/scsi/ufs/ufs.h > @@ -530,6 +530,8 @@ struct ufs_dev_info { > bool f_power_on_wp_en; > /* Keeps information if any of the LU is power on write protected */ > bool is_lu_power_on_wp; > + /* Indicates if flush WB buffer during hibern8 successfully enabled > */ > + bool is_hibern8_wb_flush; > /* Maximum number of general LU supported by the UFS device */ > u8 max_lu_supported; > u8 wb_dedicated_lu; > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c > index 639ba9d1ccbb..eb7a2534b072 100644 > --- a/drivers/scsi/ufs/ufshcd.c > +++ b/drivers/scsi/ufs/ufshcd.c > @@ -285,10 +285,16 @@ static inline void ufshcd_wb_config(struct > ufs_hba *hba) > dev_err(hba->dev, "%s: Enable WB failed: %d\n", __func__, ret); > else > dev_info(hba->dev, "%s: Write Booster Configured\n", __func__); > + > ret = ufshcd_wb_toggle_flush_during_h8(hba, true); > - if (ret) > + if (ret) { > dev_err(hba->dev, "%s: En WB flush during H8: failed: %d\n", > __func__, ret); > + hba->dev_info.is_hibern8_wb_flush = false; > + } else { > + hba->dev_info.is_hibern8_wb_flush = true; > + } > + > ufshcd_wb_toggle_flush(hba, true); > } > > @@ -5440,6 +5446,9 @@ static bool ufshcd_wb_need_flush(struct ufs_hba > *hba) > > if (!ufshcd_is_wb_allowed(hba)) > return false; > + > + if (!hba->dev_info.is_hibern8_wb_flush) > + return false;
The check is in the wrong place - even if say fWriteBoosterBufferFlushDuringHibernate is failed to be enabled, ufshcd_wb_need_flush() still needs to reflect the fact that whether the wb buffer needs to be flushed or not - it should not be decided by the flag.
Thanks,
Can Guo.
> /* > * The ufs device needs the vcc to be ON to flush. > * With user-space reduction enabled, it's enough to enable flush
| |