diff mbox series

[v5,4/8] scsi: ufs-mediatek: add fixup_dev_quirks vops

Message ID 20200503113415.21034-5-stanley.chu@mediatek.com (mailing list archive)
State New, archived
Headers show
Series scsi: ufs: support LU Dedicated buffer mode for WriteBooster | expand

Commit Message

Stanley Chu May 3, 2020, 11:34 a.m. UTC
Add fixup_dev_quirk vops in MediaTek UFS platforms and provide
an initial vendor-specific device quirk table.

Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
---
 drivers/scsi/ufs/ufs-mediatek.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

Comments

Avri Altman May 4, 2020, 10:55 a.m. UTC | #1
> @@ -555,10 +561,8 @@ static int ufs_mtk_apply_dev_quirks(struct ufs_hba
> *hba)
>         struct ufs_dev_info *dev_info = &hba->dev_info;
>         u16 mid = dev_info->wmanufacturerid;
> 
> -       if (mid == UFS_VENDOR_SAMSUNG) {
> -               hba->dev_quirks &= ~UFS_DEVICE_QUIRK_HOST_PA_TACTIVATE;
> +       if (mid == UFS_VENDOR_SAMSUNG)
>                 ufshcd_dme_set(hba, UIC_ARG_MIB(PA_TACTIVATE), 6);
> -       }
> 
>         /*
>          * Decide waiting time before gating reference clock and
> @@ -575,6 +579,17 @@ static int ufs_mtk_apply_dev_quirks(struct ufs_hba
> *hba)
>         return 0;
>  }
> 
> +void ufs_mtk_fixup_dev_quirks(struct ufs_hba *hba)
> +{
> +       struct ufs_dev_info *dev_info = &hba->dev_info;
> +       u16 mid = dev_info->wmanufacturerid;
> +
> +       ufshcd_fixup_device_setup(hba, ufs_mtk_dev_fixups);
> +
> +       if (mid == UFS_VENDOR_SAMSUNG)
> +               hba->dev_quirks &= ~UFS_DEVICE_QUIRK_HOST_PA_TACTIVATE;
Why move it? It is a unipro/hci param.
Avri Altman May 4, 2020, 11:03 a.m. UTC | #2
> >
> > +void ufs_mtk_fixup_dev_quirks(struct ufs_hba *hba)
> > +{
> > +       struct ufs_dev_info *dev_info = &hba->dev_info;
> > +       u16 mid = dev_info->wmanufacturerid;
> > +
> > +       ufshcd_fixup_device_setup(hba, ufs_mtk_dev_fixups);
> > +
> > +       if (mid == UFS_VENDOR_SAMSUNG)
> > +               hba->dev_quirks &= ~UFS_DEVICE_QUIRK_HOST_PA_TACTIVATE;
> Why move it? It is a unipro/hci param.
Actually - please ignore.

Thanks,
Avri
Avri Altman May 4, 2020, 11:04 a.m. UTC | #3
> 
> Add fixup_dev_quirk vops in MediaTek UFS platforms and provide
> an initial vendor-specific device quirk table.
> 
> Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c
index 673c16596fb2..ce7ba529e613 100644
--- a/drivers/scsi/ufs/ufs-mediatek.c
+++ b/drivers/scsi/ufs/ufs-mediatek.c
@@ -30,6 +30,12 @@ 
 #define ufs_mtk_device_reset_ctrl(high, res) \
 	ufs_mtk_smc(UFS_MTK_SIP_DEVICE_RESET, high, res)
 
+static struct ufs_dev_fix ufs_mtk_dev_fixups[] = {
+	UFS_FIX(UFS_VENDOR_SKHYNIX, "H9HQ21AFAMZDAR",
+		UFS_DEVICE_QUIRK_SUPPORT_EXTENDED_FEATURES),
+	END_FIX
+};
+
 static void ufs_mtk_cfg_unipro_cg(struct ufs_hba *hba, bool enable)
 {
 	u32 tmp;
@@ -555,10 +561,8 @@  static int ufs_mtk_apply_dev_quirks(struct ufs_hba *hba)
 	struct ufs_dev_info *dev_info = &hba->dev_info;
 	u16 mid = dev_info->wmanufacturerid;
 
-	if (mid == UFS_VENDOR_SAMSUNG) {
-		hba->dev_quirks &= ~UFS_DEVICE_QUIRK_HOST_PA_TACTIVATE;
+	if (mid == UFS_VENDOR_SAMSUNG)
 		ufshcd_dme_set(hba, UIC_ARG_MIB(PA_TACTIVATE), 6);
-	}
 
 	/*
 	 * Decide waiting time before gating reference clock and
@@ -575,6 +579,17 @@  static int ufs_mtk_apply_dev_quirks(struct ufs_hba *hba)
 	return 0;
 }
 
+void ufs_mtk_fixup_dev_quirks(struct ufs_hba *hba)
+{
+	struct ufs_dev_info *dev_info = &hba->dev_info;
+	u16 mid = dev_info->wmanufacturerid;
+
+	ufshcd_fixup_device_setup(hba, ufs_mtk_dev_fixups);
+
+	if (mid == UFS_VENDOR_SAMSUNG)
+		hba->dev_quirks &= ~UFS_DEVICE_QUIRK_HOST_PA_TACTIVATE;
+}
+
 /**
  * struct ufs_hba_mtk_vops - UFS MTK specific variant operations
  *
@@ -589,6 +604,7 @@  static struct ufs_hba_variant_ops ufs_hba_mtk_vops = {
 	.link_startup_notify = ufs_mtk_link_startup_notify,
 	.pwr_change_notify   = ufs_mtk_pwr_change_notify,
 	.apply_dev_quirks    = ufs_mtk_apply_dev_quirks,
+	.fixup_dev_quirks    = ufs_mtk_fixup_dev_quirks,
 	.suspend             = ufs_mtk_suspend,
 	.resume              = ufs_mtk_resume,
 	.dbg_register_dump   = ufs_mtk_dbg_register_dump,