diff mbox series

[v2,1/2] ufs: introduce skipping manual flush for wb

Message ID 62ef1c22df6e3fb3c7fa532523b2cf437cd4fcbc.1598236010.git.kwmad.kim@samsung.com (mailing list archive)
State Superseded
Headers show
Series skipping manual flush for write booster | expand

Commit Message

Kiwoong Kim Aug. 24, 2020, 2:29 a.m. UTC
We have two knobs to flush for write booster, i.e.
fWriteBoosterEn, fWriteBoosterBufferFlushEn.
However, many product makers uses only fWriteBoosterBufferFlushEn,
because this can reportedly cover most scenarios and
there have been some reports that flush by fWriteBoosterEn could
lead raise power consumption thanks to unexpected internal
operations. So we need a way to enable or disable fWriteBoosterEn.

Signed-off-by: Kiwoong Kim <kwmad.kim@samsung.com>
---
 drivers/scsi/ufs/ufshcd.c | 3 +++
 drivers/scsi/ufs/ufshcd.h | 5 +++++
 2 files changed, 8 insertions(+)

Comments

Avri Altman Aug. 24, 2020, 6:49 a.m. UTC | #1
> 
> We have two knobs to flush for write booster, i.e.
> fWriteBoosterEn, fWriteBoosterBufferFlushEn.
fWriteBoosterBufferFlushDuringHibernate and fWriteBoosterBufferFlushEn.

> However, many product makers uses only fWriteBoosterBufferFlushEn,
Uses only fWriteBoosterBufferFlushDuringHibernate

> because this can reportedly cover most scenarios and
> there have been some reports that flush by fWriteBoosterEn could
flush by fWriteBoosterBufferFlushEn could

> lead raise power consumption thanks to unexpected internal
> operations. So we need a way to enable or disable fWriteBoosterEn.
operations. For those case, this quirk will allow to avoid manual flush.

> 
> Signed-off-by: Kiwoong Kim <kwmad.kim@samsung.com>
> ---
>  drivers/scsi/ufs/ufshcd.c | 3 +++
>  drivers/scsi/ufs/ufshcd.h | 5 +++++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index ed03051..7c79a8f 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -5277,6 +5277,9 @@ static int ufshcd_wb_toggle_flush_during_h8(struct
> ufs_hba *hba, bool set)
> 
>  static inline void ufshcd_wb_toggle_flush(struct ufs_hba *hba, bool enable)
>  {
> +       if (hba->quirks & UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL)
> +               return;
> +
>         if (enable)
>                 ufshcd_wb_buf_flush_enable(hba);
>         else
> diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
> index e5353d6..cfafd6e 100644
> --- a/drivers/scsi/ufs/ufshcd.h
> +++ b/drivers/scsi/ufs/ufshcd.h
> @@ -511,6 +511,11 @@ enum ufshcd_quirks {
>          * OCS FATAL ERROR with device error through sense data
>          */
>         UFSHCD_QUIRK_BROKEN_OCS_FATAL_ERROR             = 1 << 10,
> +
> +       /*
> +        * This quirk needs to disable manual flush for write booster
> +        */
> +       UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL          = 1 << 11,
>  };
> 
>  enum ufshcd_caps {
> --
> 2.7.4
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index ed03051..7c79a8f 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -5277,6 +5277,9 @@  static int ufshcd_wb_toggle_flush_during_h8(struct ufs_hba *hba, bool set)
 
 static inline void ufshcd_wb_toggle_flush(struct ufs_hba *hba, bool enable)
 {
+	if (hba->quirks & UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL)
+		return;
+
 	if (enable)
 		ufshcd_wb_buf_flush_enable(hba);
 	else
diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
index e5353d6..cfafd6e 100644
--- a/drivers/scsi/ufs/ufshcd.h
+++ b/drivers/scsi/ufs/ufshcd.h
@@ -511,6 +511,11 @@  enum ufshcd_quirks {
 	 * OCS FATAL ERROR with device error through sense data
 	 */
 	UFSHCD_QUIRK_BROKEN_OCS_FATAL_ERROR		= 1 << 10,
+
+	/*
+	 * This quirk needs to disable manual flush for write booster
+	 */
+	UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL		= 1 << 11,
 };
 
 enum ufshcd_caps {