Skip to contentSkip to conversation

add fixup_dev_quirks vops for ufs-qcom

PATCH Superseded Manish Pandey 2 participants 8 messages Aug 20, 2024 – Aug 27, 2024

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover add fixup_dev_quirks vops for ufs-qcom

Add fixup_dev_quirk vops in QCOM UFS platforms and provide an initial vendor-specific device quirk table.

Micron and Skhynix UFS device needs DELAY_BEFORE_LPM quirk to have a delay before VCC is powered off. So add Micron and Skhynix vendors ID and this quirk for both.

Toshiba UFS devices require delay after VCC power rail is turned-off in QCOM platforms. Hence add Toshiba vendor ID and DELAY_AFTER_LPM quirk for Toshiba UFS devices in QCOM platforms.

Manish Pandey (3):
scsi: ufs: ufs-qcom: add fixup_dev_quirks vops
scsi: ufs: ufs-qcom: Add DELAY_BEFORE_LPM quirk for Micron and Skhynix
scsi: ufs: ufs-qcom: Apply DELAY_AFTER_LPM quirk for Toshiba devices

 drivers/ufs/host/ufs-qcom.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/3 scsi: ufs: ufs-qcom: add fixup_dev_quirks vops

Add fixup_dev_quirk vops in QCOM UFS platforms and provide an initial vendor-specific device quirk table to add UFS device specific quirks which are enabled only for specified UFS devices.

---
 drivers/ufs/host/ufs-qcom.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/ufs/host/ufs-qcom.c +11 -0
index 810e637047d0..290558843ca5 100644
@@ -834,6 +834,16 @@ static int ufs_qcom_apply_dev_quirks(struct ufs_hba *hba)
 	return err;
 }
 
+static struct ufs_dev_quirk ufs_qcom_dev_fixups[] = {
+	/* add UFS device specific quirks */
+	{}
+};
+
+static void ufs_qcom_fixup_dev_quirks(struct ufs_hba *hba)
+{
+	ufshcd_fixup_dev_quirks(hba, ufs_qcom_dev_fixups);
+}
+
 static u32 ufs_qcom_get_ufs_hci_version(struct ufs_hba *hba)
 {
 	return ufshci_version(2, 0);
@@ -1798,6 +1808,7 @@ static const struct ufs_hba_variant_ops ufs_hba_qcom_vops = {
 	.link_startup_notify    = ufs_qcom_link_startup_notify,
 	.pwr_change_notify	= ufs_qcom_pwr_change_notify,
 	.apply_dev_quirks	= ufs_qcom_apply_dev_quirks,
+	.fixup_dev_quirks       = ufs_qcom_fixup_dev_quirks,
 	.suspend		= ufs_qcom_suspend,
 	.resume			= ufs_qcom_resume,
 	.dbg_register_dump	= ufs_qcom_dump_dbg_regs,
Signature · 1 line
2.17.1
#2 lore raw

Re: [PATCH 1/3] scsi: ufs: ufs-qcom: add fixup_dev_quirks vops

drivers/ufs/host/ufs-qcom.c static int ufs_qcom_apply_dev_quirks(struct ufs_hba *hba) · line 840

Quoted 4 lines · Manish Pandey
drivers/ufs/host/ufs-qcom.c +4 -0
+static struct ufs_dev_quirk ufs_qcom_dev_fixups[] = {
+	/* add UFS device specific quirks */
+	{}
+};

Please change the comment into /* UFS device-specific quirks */ and move it above the array definition. I think that's the style followed by kernel code.

Thanks,

Bart.

#3 lore raw

PATCH 2/3 scsi: ufs: ufs-qcom: Add DELAY_BEFORE_LPM quirk for Micron and Skhynix

In reply to Manish Pandey

Micron and Skhynix UFS device needs DELAY_BEFORE_LPM quirk to have a delay before VCC is powered off. So add Micron and SKHYNIX vendors ID and this quirk for both devices in QCOM platforms.

---
 drivers/ufs/host/ufs-qcom.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/ufs/host/ufs-qcom.c +6 -0
index 290558843ca5..6d2622e79d3f 100644
@@ -836,6 +836,12 @@ static int ufs_qcom_apply_dev_quirks(struct ufs_hba *hba)
 
 static struct ufs_dev_quirk ufs_qcom_dev_fixups[] = {
 	/* add UFS device specific quirks */
+	{ .wmanufacturerid = UFS_VENDOR_MICRON,
+	  .model = UFS_ANY_MODEL,
+	  .quirk = UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM },
+	{ .wmanufacturerid = UFS_VENDOR_SKHYNIX,
+	  .model = UFS_ANY_MODEL,
+	  .quirk = UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM },
 	{}
 };
 
Signature · 1 line
2.17.1
#4 lore raw

Re: [PATCH 2/3] scsi: ufs: ufs-qcom: Add DELAY_BEFORE_LPM quirk for Micron and Skhynix

drivers/ufs/host/ufs-qcom.c static int ufs_qcom_apply_dev_quirks(struct ufs_hba *hba) · line 846

Quoted 10 lines · Manish Pandey

static struct ufs_dev_quirk ufs_qcom_dev_fixups[] = {
/* add UFS device specific quirks */

drivers/ufs/host/ufs-qcom.c +6 -0
+	{ .wmanufacturerid = UFS_VENDOR_MICRON,
+	  .model = UFS_ANY_MODEL,
+	  .quirk = UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM },
+	{ .wmanufacturerid = UFS_VENDOR_SKHYNIX,
+	  .model = UFS_ANY_MODEL,
+	  .quirk = UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM },
  	{}
  };

What makes these quirks specific for Qualcomm controllers? Are these quirks perhaps required for all UFSHCI controllers?

Thanks,

Bart.

#5 lore raw

PATCH 3/3 scsi: ufs: ufs-qcom: Apply DELAY_AFTER_LPM quirk for Toshiba devices

In reply to Manish Pandey

Toshiba UFS devices require delay after VCC power rail is turned-off in QCOM platforms. Hence add Toshiba vendor ID and DELAY_AFTER_LPM quirk for Toshiba UFS devices in QCOM platforms.

---
 drivers/ufs/host/ufs-qcom.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/ufs/host/ufs-qcom.c +3 -0
index 6d2622e79d3f..61f8c3f22ab9 100644
@@ -842,6 +842,9 @@ static struct ufs_dev_quirk ufs_qcom_dev_fixups[] = {
 	{ .wmanufacturerid = UFS_VENDOR_SKHYNIX,
 	  .model = UFS_ANY_MODEL,
 	  .quirk = UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM },
+	{ .wmanufacturerid = UFS_VENDOR_TOSHIBA,
+	  .model = UFS_ANY_MODEL,
+	  .quirk = UFS_DEVICE_QUIRK_DELAY_AFTER_LPM },
 	{}
 };
 
Signature · 1 line
2.17.1
#6 lore raw

Re: [PATCH 3/3] scsi: ufs: ufs-qcom: Apply DELAY_AFTER_LPM quirk for Toshiba devices

drivers/ufs/host/ufs-qcom.c static struct ufs_dev_quirk ufs_qcom_dev_fixups[] = { · line 847

Quoted 3 lines · Manish Pandey
drivers/ufs/host/ufs-qcom.c +3 -0
+	{ .wmanufacturerid = UFS_VENDOR_TOSHIBA,
+	  .model = UFS_ANY_MODEL,
+	  .quirk = UFS_DEVICE_QUIRK_DELAY_AFTER_LPM },

Isn't three patches a bit much for these changes? I think all three patches can be combined into a single patch without making it harder for reviewers to understand what is going on.

Thanks,

Bart.

#7 lore raw

Re: [PATCH 3/3] scsi: ufs: ufs-qcom: Apply DELAY_AFTER_LPM quirk for Toshiba devices

Quoted 5 lines · Bart Van Assche
Quoted 3 lines · Manish Pandey

+    { .wmanufacturerid = UFS_VENDOR_TOSHIBA, +      .model = UFS_ANY_MODEL,
+      .quirk = UFS_DEVICE_QUIRK_DELAY_AFTER_LPM },

Quoted 9 lines

Isn't three patches a bit much for these changes? I think all three patches can be combined into a single patch without making it harder for reviewers to understand what is going on.

Thanks,

Bart.

Thanks Bart for quick review.
I will merge all 3 changes to a single change in next patch set [V2].

Regards
Manish