mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
Merge patch series "Remove UFS_DEVICE_QUIRK_DELAY_AFTER_LPM quirk"
Bao D. Nguyen <quic_nguyenb@quicinc.com> says: Multiple ufs device manufacturers request support for the UFS_DEVICE_QUIRK_DELAY_AFTER_LPM quirk in the Qualcomm's platform driver. After checking further with the major UFS manufacturers engineering teams such as Samsung, Kioxia, SK Hynix and Micron, all the manufacturers require this quirk. Since the quirk is needed by all the ufs device manufacturers, remove the quirk in the ufs core driver and implement a universal delay for all the ufs devices. In addition to verifying with the public device's datasheets, the ufs device manufacturer's engineering teams confirmed the required vcc power-off time for the devices is a minimum of 1ms before vcc can be powered on again. The existing 5ms delay implemented in the ufs core driver seems too conservative, so replace the hard coded 5ms delay with a variable default to 2ms setting to improve the system resume latency. The platform drivers can override this setting as needed. Link: https://patch.msgid.link/cover.1760383740.git.quic_nguyenb@quicinc.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
@@ -9777,11 +9777,11 @@ 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)
|
||||
usleep_range(5000, 5100);
|
||||
if (vcc_off && hba->vreg_info.vcc && !hba->vreg_info.vcc->always_on)
|
||||
usleep_range(hba->vcc_off_delay_us,
|
||||
hba->vcc_off_delay_us + 100);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
@@ -10708,6 +10708,13 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
|
||||
UFS_SLEEP_PWR_MODE,
|
||||
UIC_LINK_HIBERN8_STATE);
|
||||
|
||||
/*
|
||||
* Most ufs devices require 1ms delay after vcc is powered off before
|
||||
* it can be powered on again. Set the default to 2ms. The platform
|
||||
* drivers can override this setting as needed.
|
||||
*/
|
||||
hba->vcc_off_delay_us = 2000;
|
||||
|
||||
init_completion(&hba->dev_cmd.complete);
|
||||
|
||||
err = ufshcd_hba_init(hba);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 },
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -1117,6 +1117,8 @@ struct ufs_hba {
|
||||
int critical_health_count;
|
||||
atomic_t dev_lvl_exception_count;
|
||||
u64 dev_lvl_exception_id;
|
||||
|
||||
u32 vcc_off_delay_us;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user