Skip to contentSkip to conversation

Enable HOST_PA_TACTIVATE quirk for WDC UFS devices

PATCH Applied Can Guo 5 participants 8 messages Feb 24, 2020 – Feb 29, 2020

Subsystems (2)
lore
Share & tools
lore

Can Guo

author
#0 lore raw

v2 cover Enable HOST_PA_TACTIVATE quirk for WDC UFS devices

Changes since v1:
- Instead of using this quirk for all Soc vendors, enable this quirk only for QCOM's platforms.

Western Digital UFS devices require host PA_TACTIVATE to be lower than device PA_TACTIVATE, otherwise it may get stuck during hibern8 sequence.

Can Guo (2):
scsi: ufs: Allow vendor apply device quirks in advance
scsi: ufs-qcom: Apply QUIRK_HOST_TACTIVATE for WDC UFS devices

 drivers/scsi/ufs/ufs-qcom.c   | 3 +++
 drivers/scsi/ufs/ufs_quirks.h | 1 +
 drivers/scsi/ufs/ufshcd.c     | 4 ++--
 3 files changed, 6 insertions(+), 2 deletions(-)
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
author
#1 lore raw

PATCH v2 1/2 scsi: ufs: Allow vendor apply device quirks in advance

Currently ufshcd_vops_apply_dev_quirks() comes after all UniPro parameters have been tuned. Move it up so that vendors have a chance to apply device quirks in advance.

---
 drivers/scsi/ufs/ufshcd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/ufs/ufshcd.c +2 -2
index abd0e6b..03af432 100644
@@ -6804,14 +6804,14 @@ static void ufshcd_tune_unipro_params(struct ufs_hba *hba)
 		ufshcd_tune_pa_hibern8time(hba);
 	}
 
+	ufshcd_vops_apply_dev_quirks(hba);
+
 	if (hba->dev_quirks & UFS_DEVICE_QUIRK_PA_TACTIVATE)
 		/* set 1ms timeout for PA_TACTIVATE */
 		ufshcd_dme_set(hba, UIC_ARG_MIB(PA_TACTIVATE), 10);
 
 	if (hba->dev_quirks & UFS_DEVICE_QUIRK_HOST_PA_TACTIVATE)
 		ufshcd_quirk_tune_host_pa_tactivate(hba);
-
-	ufshcd_vops_apply_dev_quirks(hba);
 }
 
 static void ufshcd_clear_dbg_ufs_stats(struct ufs_hba *hba)
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
Reviewed-by on v2 1/2
#2 lore raw

Re: [PATCH v2 1/2] scsi: ufs: Allow vendor apply device quirks in advance

Hi Can,

Quoted 5 lines · Can Guo

Currently ufshcd_vops_apply_dev_quirks() comes after all UniPro parameters have been tuned. Move it up so that vendors have a chance to apply device quirks in advance.

As discussed, ufs-mediatek needs to do corresponding patch and I will submit it once this commit is merged.

author
#3 lore raw

Re: [PATCH v2 1/2] scsi: ufs: Allow vendor apply device quirks in advance

Hi Stanley,

Quoted 7 lines · Stanley Chu

Hi Can,

Quoted 4 lines · Can Guo

Currently ufshcd_vops_apply_dev_quirks() comes after all UniPro parameters have been tuned. Move it up so that vendors have a chance to apply device quirks in advance.

Quoted 6 lines
Quoted 1 line

As discussed, ufs-mediatek needs to do corresponding patch and I will submit it once this commit is merged.

Yes, sure, thanks for your cooperation. :)

Best Regards,
Can Guo.

author
#4 lore raw

PATCH v2 2/2 scsi: ufs-qcom: Apply QUIRK_HOST_TACTIVATE for WDC UFS devices

In reply to Can Guo

Western Digital UFS devices require host's PA_TACTIVATE to be lower than device's PA_TACTIVATE, otherwise it may get stuck during hibern8 sequence.

---
 drivers/scsi/ufs/ufs-qcom.c   | 3 +++
 drivers/scsi/ufs/ufs_quirks.h | 1 +
 2 files changed, 4 insertions(+)
drivers/scsi/ufs/ufs-qcom.c +3 -0
index c69c29a1c..4caa57f 100644
@@ -956,6 +956,9 @@ static int ufs_qcom_apply_dev_quirks(struct ufs_hba *hba)
 	if (hba->dev_quirks & UFS_DEVICE_QUIRK_HOST_PA_SAVECONFIGTIME)
 		err = ufs_qcom_quirk_host_pa_saveconfigtime(hba);
 
+	if (hba->dev_info.wmanufacturerid == UFS_VENDOR_WDC)
+		hba->dev_quirks |= UFS_DEVICE_QUIRK_HOST_PA_TACTIVATE;
+
 	return err;
 }
 
drivers/scsi/ufs/ufs_quirks.h +1 -0
index d0ab147..df7a1e6 100644
@@ -15,6 +15,7 @@
 #define UFS_VENDOR_TOSHIBA     0x198
 #define UFS_VENDOR_SAMSUNG     0x1CE
 #define UFS_VENDOR_SKHYNIX     0x1AD
+#define UFS_VENDOR_WDC         0x145
 
 /**
  * ufs_dev_fix - ufs device quirk info
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
Reviewed-by on v2 2/2
#6 lore raw

Re: [PATCH v2 2/2] scsi: ufs-qcom: Apply QUIRK_HOST_TACTIVATE for WDC UFS devices

In reply to Can Guo
Quoted 5 lines · Can Guo

Western Digital UFS devices require host's PA_TACTIVATE to be lower than device's PA_TACTIVATE, otherwise it may get stuck during hibern8 sequence.

---

Quoted 31 lines
  drivers/scsi/ufs/ufs-qcom.c   | 3 +++
  drivers/scsi/ufs/ufs_quirks.h | 1 +
  2 files changed, 4 insertions(+)
drivers/scsi/ufs/ufs-qcom.c +3 -0
index c69c29a1c..4caa57f 100644
@@ -956,6 +956,9 @@ static int ufs_qcom_apply_dev_quirks(struct ufs_hba *hba)
  	if (hba->dev_quirks & UFS_DEVICE_QUIRK_HOST_PA_SAVECONFIGTIME)
  		err = ufs_qcom_quirk_host_pa_saveconfigtime(hba);
 
+	if (hba->dev_info.wmanufacturerid == UFS_VENDOR_WDC)
+		hba->dev_quirks |= UFS_DEVICE_QUIRK_HOST_PA_TACTIVATE;
+
  	return err;
  }
 
drivers/scsi/ufs/ufs_quirks.h +1 -0
index d0ab147..df7a1e6 100644
@@ -15,6 +15,7 @@
  #define UFS_VENDOR_TOSHIBA     0x198
  #define UFS_VENDOR_SAMSUNG     0x1CE
  #define UFS_VENDOR_SKHYNIX     0x1AD
+#define UFS_VENDOR_WDC         0x145
 
  /**
   * ufs_dev_fix - ufs device quirk info
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
Linux Foundation Collaborative Project
#7 lore raw
In reply to Can Guo

Can,

Quoted 2 lines

Western Digital UFS devices require host PA_TACTIVATE to be lower than device PA_TACTIVATE, otherwise it may get stuck during hibern8 sequence.

Applied to 5.7/scsi-queue, thank you!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering