]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
scsi: ufs: core: Remove UFS_DEVICE_QUIRK_DELAY_AFTER_LPM quirk
authorBao D. Nguyen <quic_nguyenb@quicinc.com>
Mon, 13 Oct 2025 19:38:15 +0000 (12:38 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 22 Oct 2025 01:22:17 +0000 (21:22 -0400)
After the UFS device VCC is turned off, all the UFS device manufacturers
require a period of power-off time before the VCC can be turned on
again. This requirement has been confirmed with all the UFS device
manufacturer's datasheets.

Remove the UFS_DEVICE_QUIRK_DELAY_AFTER_LPM quirk in the UFS core driver
and implement a universal delay that is required by all the UFS device
manufacturers. In addition, remove the support for this quirk in the
platform drivers.

Signed-off-by: Bao D. Nguyen <quic_nguyenb@quicinc.com>
Reviewed-by: Peter Wang <peter.wang@mediatek.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Link: https://patch.msgid.link/25f134d5a42e8b8365be64d512d1bb5fc2bce6ff.1760383740.git.quic_nguyenb@quicinc.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/ufs/core/ufshcd.c
drivers/ufs/host/ufs-mediatek.c
drivers/ufs/host/ufs-qcom.c
include/ufs/ufs_quirks.h

index 8339fec975b9230c67cc6c5338fed2fbf01af2af..4ca652c02ac2e916c95e8bf1111217ce061aa25f 100644 (file)
@@ -9774,10 +9774,9 @@ static void ufshcd_vreg_set_lpm(struct ufs_hba *hba)
        }
 
        /*
-        * Some UFS devices require delay after VCC power rail is turned-off.
+        * All UFS devices require delay after VCC power rail is turned-off.
         */
-       if (vcc_off && hba->vreg_info.vcc &&
-               hba->dev_quirks & UFS_DEVICE_QUIRK_DELAY_AFTER_LPM)
+       if (vcc_off && hba->vreg_info.vcc && !hba->vreg_info.vcc->always_on)
                usleep_range(5000, 5100);
 }
 
index 758a393a9de1a280d5604b0bd045d65f5f548f00..bbfb2d51be92f644edd3508eba5b6c110282491e 100644 (file)
@@ -41,8 +41,7 @@ static void _ufs_mtk_clk_scale(struct ufs_hba *hba, bool scale_up);
 static const struct ufs_dev_quirk ufs_mtk_dev_fixups[] = {
        { .wmanufacturerid = UFS_ANY_VENDOR,
          .model = UFS_ANY_MODEL,
-         .quirk = UFS_DEVICE_QUIRK_DELAY_AFTER_LPM |
-               UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM },
+         .quirk = UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM },
        { .wmanufacturerid = UFS_VENDOR_SKHYNIX,
          .model = "H9HQ21AFAMZDAR",
          .quirk = UFS_DEVICE_QUIRK_SUPPORT_EXTENDED_FEATURES },
@@ -1889,15 +1888,13 @@ static void ufs_mtk_fixup_dev_quirks(struct ufs_hba *hba)
 {
        ufshcd_fixup_dev_quirks(hba, ufs_mtk_dev_fixups);
 
-       if (ufs_mtk_is_broken_vcc(hba) && hba->vreg_info.vcc &&
-           (hba->dev_quirks & UFS_DEVICE_QUIRK_DELAY_AFTER_LPM)) {
+       if (ufs_mtk_is_broken_vcc(hba) && hba->vreg_info.vcc) {
                hba->vreg_info.vcc->always_on = true;
                /*
                 * VCC will be kept always-on thus we don't
-                * need any delay during regulator operations
+                * need any delay before putting device's VCC in LPM mode.
                 */
-               hba->dev_quirks &= ~(UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM |
-                       UFS_DEVICE_QUIRK_DELAY_AFTER_LPM);
+               hba->dev_quirks &= ~UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM;
        }
 
        ufs_mtk_vreg_fix_vcc(hba);
index 3e83dc51d53857d5a855df4e4dfa837747559dad..038064fb6ec2e97b9efbf79151289b13093e42cb 100644 (file)
@@ -1024,9 +1024,6 @@ 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 },
        { .wmanufacturerid = UFS_VENDOR_WDC,
          .model = UFS_ANY_MODEL,
          .quirk = UFS_DEVICE_QUIRK_HOST_PA_TACTIVATE },
index 83563247c36cb26863a3ad5fb304218f6150fa31..e9c59ec1ceae275bdefc3d1dc4d7ec69174e346c 100644 (file)
@@ -100,13 +100,6 @@ struct ufs_dev_quirk {
  */
 #define UFS_DEVICE_QUIRK_SUPPORT_EXTENDED_FEATURES (1 << 10)
 
-/*
- * Some UFS devices require delay after VCC power rail is turned-off.
- * Enable this quirk to introduce 5ms delays after VCC power-off during
- * suspend flow.
- */
-#define UFS_DEVICE_QUIRK_DELAY_AFTER_LPM        (1 << 11)
-
 /*
  * Some ufs devices may need more time to be in hibern8 before exiting.
  * Enable this quirk to give it an additional 100us.