summaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2020-12-07 09:31:19 +0100
committerMartin K. Petersen <martin.petersen@oracle.com>2020-12-09 17:34:20 +0100
commit044d5bda7117891d6d0d56f2f807b7b11e120abd (patch)
tree179eb2b7c548198e9d7ad4c6f0e7395c49b31196 /drivers/scsi
parentscsi: ufs-pci: Ensure UFS device is in PowerDown mode for suspend-to-disk ->p... (diff)
downloadlinux-044d5bda7117891d6d0d56f2f807b7b11e120abd.tar.xz
linux-044d5bda7117891d6d0d56f2f807b7b11e120abd.zip
scsi: ufs-pci: Fix recovery from hibernate exit errors for Intel controllers
Intel controllers can end up in an unrecoverable state after a hibernate exit error unless a full reset and restore is done before anything else. Force that to happen. Link: https://lore.kernel.org/r/20201207083120.26732-4-adrian.hunter@intel.com Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/ufs/ufshcd-pci.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/scsi/ufs/ufshcd-pci.c b/drivers/scsi/ufs/ufshcd-pci.c
index 5d33c39fa82f..888d8c9ca3a5 100644
--- a/drivers/scsi/ufs/ufshcd-pci.c
+++ b/drivers/scsi/ufs/ufshcd-pci.c
@@ -178,6 +178,23 @@ static int ufs_intel_resume(struct ufs_hba *hba, enum ufs_pm_op op)
REG_UTP_TASK_REQ_LIST_BASE_L);
ufshcd_writel(hba, upper_32_bits(hba->utmrdl_dma_addr),
REG_UTP_TASK_REQ_LIST_BASE_H);
+
+ if (ufshcd_is_link_hibern8(hba)) {
+ int ret = ufshcd_uic_hibern8_exit(hba);
+
+ if (!ret) {
+ ufshcd_set_link_active(hba);
+ } else {
+ dev_err(hba->dev, "%s: hibern8 exit failed %d\n",
+ __func__, ret);
+ /*
+ * Force reset and restore. Any other actions can lead
+ * to an unrecoverable state.
+ */
+ ufshcd_set_link_off(hba);
+ }
+ }
+
return 0;
}