Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: ufs: core: Remove UFS_DEVICE_QUIRK_DELAY_AFTER_LPM quirk

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>

authored by

Bao D. Nguyen and committed by
Martin K. Petersen
f8e82ae6 3a866087

+6 -20
+2 -3
drivers/ufs/core/ufshcd.c
··· 9774 9774 } 9775 9775 9776 9776 /* 9777 - * Some UFS devices require delay after VCC power rail is turned-off. 9777 + * All UFS devices require delay after VCC power rail is turned-off. 9778 9778 */ 9779 - if (vcc_off && hba->vreg_info.vcc && 9780 - hba->dev_quirks & UFS_DEVICE_QUIRK_DELAY_AFTER_LPM) 9779 + if (vcc_off && hba->vreg_info.vcc && !hba->vreg_info.vcc->always_on) 9781 9780 usleep_range(5000, 5100); 9782 9781 } 9783 9782
+4 -7
drivers/ufs/host/ufs-mediatek.c
··· 41 41 static const struct ufs_dev_quirk ufs_mtk_dev_fixups[] = { 42 42 { .wmanufacturerid = UFS_ANY_VENDOR, 43 43 .model = UFS_ANY_MODEL, 44 - .quirk = UFS_DEVICE_QUIRK_DELAY_AFTER_LPM | 45 - UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM }, 44 + .quirk = UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM }, 46 45 { .wmanufacturerid = UFS_VENDOR_SKHYNIX, 47 46 .model = "H9HQ21AFAMZDAR", 48 47 .quirk = UFS_DEVICE_QUIRK_SUPPORT_EXTENDED_FEATURES }, ··· 1888 1889 { 1889 1890 ufshcd_fixup_dev_quirks(hba, ufs_mtk_dev_fixups); 1890 1891 1891 - if (ufs_mtk_is_broken_vcc(hba) && hba->vreg_info.vcc && 1892 - (hba->dev_quirks & UFS_DEVICE_QUIRK_DELAY_AFTER_LPM)) { 1892 + if (ufs_mtk_is_broken_vcc(hba) && hba->vreg_info.vcc) { 1893 1893 hba->vreg_info.vcc->always_on = true; 1894 1894 /* 1895 1895 * VCC will be kept always-on thus we don't 1896 - * need any delay during regulator operations 1896 + * need any delay before putting device's VCC in LPM mode. 1897 1897 */ 1898 - hba->dev_quirks &= ~(UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM | 1899 - UFS_DEVICE_QUIRK_DELAY_AFTER_LPM); 1898 + hba->dev_quirks &= ~UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM; 1900 1899 } 1901 1900 1902 1901 ufs_mtk_vreg_fix_vcc(hba);
-3
drivers/ufs/host/ufs-qcom.c
··· 1024 1024 { .wmanufacturerid = UFS_VENDOR_SKHYNIX, 1025 1025 .model = UFS_ANY_MODEL, 1026 1026 .quirk = UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM }, 1027 - { .wmanufacturerid = UFS_VENDOR_TOSHIBA, 1028 - .model = UFS_ANY_MODEL, 1029 - .quirk = UFS_DEVICE_QUIRK_DELAY_AFTER_LPM }, 1030 1027 { .wmanufacturerid = UFS_VENDOR_WDC, 1031 1028 .model = UFS_ANY_MODEL, 1032 1029 .quirk = UFS_DEVICE_QUIRK_HOST_PA_TACTIVATE },
-7
include/ufs/ufs_quirks.h
··· 101 101 #define UFS_DEVICE_QUIRK_SUPPORT_EXTENDED_FEATURES (1 << 10) 102 102 103 103 /* 104 - * Some UFS devices require delay after VCC power rail is turned-off. 105 - * Enable this quirk to introduce 5ms delays after VCC power-off during 106 - * suspend flow. 107 - */ 108 - #define UFS_DEVICE_QUIRK_DELAY_AFTER_LPM (1 << 11) 109 - 110 - /* 111 104 * Some ufs devices may need more time to be in hibern8 before exiting. 112 105 * Enable this quirk to give it an additional 100us. 113 106 */