Skip to contentSkip to conversation

scsi: ufs: ufs-qcom: add fixup_dev_quirks vops

PATCH Superseded Manish Pandey 2 participants 3 messages Aug 28, 2024 – Sep 3, 2024

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 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.

Micron and Skhynix UFS device needs DELAY_BEFORE_LPM quirk to have a delay before VCC is powered off.

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 | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/ufs/host/ufs-qcom.c +20 -0
index 810e637047d0..9dbfbe643e5e 100644
@@ -834,6 +834,25 @@ static int ufs_qcom_apply_dev_quirks(struct ufs_hba *hba)
 	return err;
 }
 
+/* UFS device-specific quirks */
+static struct ufs_dev_quirk ufs_qcom_dev_fixups[] = {
+	{ .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 },
+	{ .wmanufacturerid = UFS_VENDOR_TOSHIBA,
+	  .model = UFS_ANY_MODEL,
+	  .quirk = UFS_DEVICE_QUIRK_DELAY_AFTER_LPM },
+	{}
+};
+
+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 +1817,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
#1 lore raw
Quoted 4 lines · Manish Pandey

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.

Why the quirks are enabled only for Qcom platforms? If these are required by the UFS device, then they should be added to ufs_fixups[] in ufshcd.c.

Quoted 3 lines

Micron and Skhynix UFS device needs DELAY_BEFORE_LPM quirk to have a delay before VCC is powered off.

Micron fix is already part of ufs_fixups[].

Quoted 4 lines

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.

This sounds like the issue is specific to Qcom platforms only.

Quoted 2 lines

---

Where is the changelog?

- Mani

Quoted 44 lines
 drivers/ufs/host/ufs-qcom.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/ufs/host/ufs-qcom.c +20 -0
index 810e637047d0..9dbfbe643e5e 100644
@@ -834,6 +834,25 @@ static int ufs_qcom_apply_dev_quirks(struct ufs_hba *hba)
 	return err;
 }
 
+/* UFS device-specific quirks */
+static struct ufs_dev_quirk ufs_qcom_dev_fixups[] = {
+	{ .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 },
+	{ .wmanufacturerid = UFS_VENDOR_TOSHIBA,
+	  .model = UFS_ANY_MODEL,
+	  .quirk = UFS_DEVICE_QUIRK_DELAY_AFTER_LPM },
+	{}
+};
+
+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 +1817,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
Signature · 1 line
மணிவண்ணன் சதாசிவம்
#2 lore raw
Quoted 9 lines · Manivannan Sadhasivam
Quoted 4 lines · Manish Pandey

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.

Why the quirks are enabled only for Qcom platforms? If these are required by the UFS device, then they should be added to ufs_fixups[] in ufshcd.c.

As of now, we are not sure if the same would be applicable to other vendors as well, so avoiding to add in ufs_fixups[].

Quoted 5 lines
Quoted 3 lines

Micron and Skhynix UFS device needs DELAY_BEFORE_LPM quirk to have a delay before VCC is powered off.

Micron fix is already part of ufs_fixups[].

Thanks for guidance, will take care in next patch set.

Quoted 8 lines
Quoted 5 lines

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.

This sounds like the issue is specific to Qcom platforms only.

Not sure, if for other vendors it is required. Hence adding for Qcom only.

Quoted 52 lines
Quoted 2 lines

---

Where is the changelog?

- Mani

Quoted 44 lines
  drivers/ufs/host/ufs-qcom.c | 20 ++++++++++++++++++++
  1 file changed, 20 insertions(+)
drivers/ufs/host/ufs-qcom.c +20 -0
index 810e637047d0..9dbfbe643e5e 100644
@@ -834,6 +834,25 @@ static int ufs_qcom_apply_dev_quirks(struct ufs_hba *hba)
  	return err;
  }
 
+/* UFS device-specific quirks */
+static struct ufs_dev_quirk ufs_qcom_dev_fixups[] = {
+	{ .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 },
+	{ .wmanufacturerid = UFS_VENDOR_TOSHIBA,
+	  .model = UFS_ANY_MODEL,
+	  .quirk = UFS_DEVICE_QUIRK_DELAY_AFTER_LPM },
+	{}
+};
+
+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 +1817,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