scsi: ufs: Add UFS_DEVICE_QUIRK_PA_HIBER8TIME quirk

This adds the quirk to increase the hibern8 timeout
on the host.

Change-Id: I716124224d67942e257e17e7482ce9f32b8a5744
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
This commit is contained in:
Asutosh Das 2020-08-03 20:15:55 -07:00
commit 8941234ea1
3 changed files with 41 additions and 1 deletions

View file

@ -1620,6 +1620,29 @@ static void ufshcd_parse_pm_levels(struct ufs_hba *hba)
hba->spm_lvl = spm_lvl;
}
#if defined(CONFIG_SCSI_UFSHCD_QTI)
static void ufs_qcom_override_pa_h8time(struct ufs_hba *hba)
{
int ret;
u32 loc_tx_h8time_cap = 0;
ret = ufshcd_dme_get(hba, UIC_ARG_MIB_SEL(TX_HIBERN8TIME_CAPABILITY,
UIC_ARG_MPHY_TX_GEN_SEL_INDEX(0)),
&loc_tx_h8time_cap);
if (ret) {
dev_err(hba->dev, "Failed getting max h8 time: %d\n", ret);
return;
}
/* 1 implies 100 us */
ret = ufshcd_dme_set(hba, UIC_ARG_MIB(PA_HIBERN8TIME),
loc_tx_h8time_cap + 1);
if (ret)
dev_err(hba->dev, "Failed updating PA_HIBERN8TIME: %d\n", ret);
}
#endif
static int ufs_qcom_apply_dev_quirks(struct ufs_hba *hba)
{
unsigned long flags;
@ -1646,6 +1669,10 @@ static int ufs_qcom_apply_dev_quirks(struct ufs_hba *hba)
if (hba->dev_info.wmanufacturerid == UFS_VENDOR_MICRON)
hba->dev_quirks |= UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM;
#if defined(CONFIG_SCSI_UFSHCD_QTI)
if (hba->dev_quirks & UFS_DEVICE_QUIRK_PA_HIBER8TIME)
ufs_qcom_override_pa_h8time(hba);
#endif
return err;
}

View file

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2014-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2014-2020, The Linux Foundation. All rights reserved.
*/
#ifndef _UFS_QUIRKS_H_
@ -159,5 +159,12 @@ struct ufs_dev_fix {
* supported features on such devices.
*/
#define UFS_DEVICE_QUIRK_SUPPORT_EXTENDED_FEATURES (1 << 14)
#if defined(CONFIG_SCSI_UFSHCD_QTI)
/*
* Some ufs devices may need more time to be in hibern8 before exiting.
* Enable this quirk to give it an additional 100us.
*/
#define UFS_DEVICE_QUIRK_PA_HIBER8TIME (1 << 15)
#endif
#endif /* UFS_QUIRKS_H_ */

View file

@ -240,6 +240,12 @@ static struct ufs_dev_fix ufs_fixups[] = {
UFS_DEVICE_QUIRK_HOST_PA_SAVECONFIGTIME),
UFS_FIX(UFS_VENDOR_SKHYNIX, "hB8aL1" /*H28U62301AMR*/,
UFS_DEVICE_QUIRK_HOST_VS_DEBUGSAVECONFIGTIME),
#if defined(CONFIG_SCSI_UFSHCD_QTI)
UFS_FIX(UFS_VENDOR_SAMSUNG, "KLUEG8UHDB-C2D1",
UFS_DEVICE_QUIRK_PA_HIBER8TIME),
UFS_FIX(UFS_VENDOR_SAMSUNG, "KLUDG4UHDB-B2D1",
UFS_DEVICE_QUIRK_PA_HIBER8TIME),
#endif
END_FIX
};