diff mbox series

scsi:ufs:add quirk to keep write booster on

Message ID 20211111035844.395208-1-changfengnan@vivo.com (mailing list archive)
State Superseded
Headers show
Series scsi:ufs:add quirk to keep write booster on | expand

Commit Message

常凤楠 Nov. 11, 2021, 3:58 a.m. UTC
From: tanghuan <tanghuan@vivo.com>

Some samsung devices have performance issue when the
remaining space is low, and the write booster needs
to be always on.

Therefore, add quirk option UFS_DEVICE_QUIRK_KEEP_ON_WB

Signed-off-by: tanghuan <tanghuan@vivo.com>
---
 drivers/scsi/ufs/ufs_quirks.h |  6 ++++++
 drivers/scsi/ufs/ufshcd.c     | 13 +++++++++----
 2 files changed, 15 insertions(+), 4 deletions(-)

Comments

Avri Altman Nov. 11, 2021, 8:40 a.m. UTC | #1
> 
> From: tanghuan <tanghuan@vivo.com>
> 
> Some samsung devices have performance issue when the
> remaining space is low, and the write booster needs
> to be always on.
> 
> Therefore, add quirk option UFS_DEVICE_QUIRK_KEEP_ON_WB
> 
> Signed-off-by: tanghuan <tanghuan@vivo.com>
a) Someone needs to use this quirk, e.g. you need to set the quirk in ufs-exynos
b) I think that Samsung does not use clock-scaling
c) So maybe for Samsung, you need to use the quirk in ufshcd_wb_config(), prevent ufshcd_wb_toggle()

Thanks,
Avri

> ---
>  drivers/scsi/ufs/ufs_quirks.h |  6 ++++++
>  drivers/scsi/ufs/ufshcd.c     | 13 +++++++++----
>  2 files changed, 15 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/scsi/ufs/ufs_quirks.h b/drivers/scsi/ufs/ufs_quirks.h
> index 35ec9ea79869..532719eb4f50 100644
> --- a/drivers/scsi/ufs/ufs_quirks.h
> +++ b/drivers/scsi/ufs/ufs_quirks.h
> @@ -122,4 +122,10 @@ struct ufs_dev_fix {
>   */
>  #define UFS_DEVICE_QUIRK_SWAP_L2P_ENTRY_FOR_HPB_READ (1 << 12)
> 
> +/*
> + * Some SAMSUNG UFS devices require keep on Write Booster for prevent
> + * performance drop. Enable this quirk to keep on Write Booster
> + */
> +#define UFS_DEVICE_QUIRK_KEEP_ON_WB        (1 << 13)
> +
>  #endif /* UFS_QUIRKS_H_ */
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index dac8fbf221f7..acca346b43c4 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -1250,10 +1250,15 @@ static int ufshcd_devfreq_scale(struct ufs_hba
> *hba, bool scale_up)
>                 }
>         }
> 
> -       /* Enable Write Booster if we have scaled up else disable it */
> -       downgrade_write(&hba->clk_scaling_lock);
> -       is_writelock = false;
> -       ufshcd_wb_toggle(hba, scale_up);
> +       /*
> +        * if no need UFS_DEVICE_QUIRK_KEEP_ON_WB, Enable Write
> +        * Booster if we have scaled up else disable it
> +        */
> +       if (!(hba->dev_quirks & UFS_DEVICE_QUIRK_KEEP_ON_WB)) {
> +               downgrade_write(&hba->clk_scaling_lock);
> +               is_writelock = false;
> +               ufshcd_wb_ctrl(hba, scale_up);
> +       }
> 
>  out_unprepare:
>         ufshcd_clock_scaling_unprepare(hba, is_writelock);
> --
> 2.32.0
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufs_quirks.h b/drivers/scsi/ufs/ufs_quirks.h
index 35ec9ea79869..532719eb4f50 100644
--- a/drivers/scsi/ufs/ufs_quirks.h
+++ b/drivers/scsi/ufs/ufs_quirks.h
@@ -122,4 +122,10 @@  struct ufs_dev_fix {
  */
 #define UFS_DEVICE_QUIRK_SWAP_L2P_ENTRY_FOR_HPB_READ (1 << 12)
 
+/*
+ * Some SAMSUNG UFS devices require keep on Write Booster for prevent
+ * performance drop. Enable this quirk to keep on Write Booster
+ */
+#define UFS_DEVICE_QUIRK_KEEP_ON_WB        (1 << 13)
+
 #endif /* UFS_QUIRKS_H_ */
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index dac8fbf221f7..acca346b43c4 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -1250,10 +1250,15 @@  static int ufshcd_devfreq_scale(struct ufs_hba *hba, bool scale_up)
 		}
 	}
 
-	/* Enable Write Booster if we have scaled up else disable it */
-	downgrade_write(&hba->clk_scaling_lock);
-	is_writelock = false;
-	ufshcd_wb_toggle(hba, scale_up);
+	/*
+	 * if no need UFS_DEVICE_QUIRK_KEEP_ON_WB, Enable Write
+	 * Booster if we have scaled up else disable it
+	 */
+	if (!(hba->dev_quirks & UFS_DEVICE_QUIRK_KEEP_ON_WB)) {
+		downgrade_write(&hba->clk_scaling_lock);
+		is_writelock = false;
+		ufshcd_wb_ctrl(hba, scale_up);
+	}
 
 out_unprepare:
 	ufshcd_clock_scaling_unprepare(hba, is_writelock);