scsi: ufs: Add error-handling of Auto-Hibernate
authorStanley Chu <stanley.chu@mediatek.com>
Tue, 21 May 2019 06:44:54 +0000 (14:44 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 18 Jun 2019 23:46:23 +0000 (19:46 -0400)
commit821744403913d957cb52263b2016fd5bd29c30d0
tree3fb06aed8c4be4f97fd5500e2836225edeed4123
parentf571b377ded7466e175e73c116df9ae09527dcb0
scsi: ufs: Add error-handling of Auto-Hibernate

Currently auto-hibernate is activated if host supports auto-hibern8
capability. However error-handling is not implemented, which makes the
feature somewhat risky.

If either "Hibernate Enter" or "Hibernate Exit" fail during auto-hibernate
flow, the corresponding interrupt "UIC_HIBERNATE_ENTER" or
"UIC_HIBERNATE_EXIT" shall be raised according to UFS specification.

This patch adds auto-hibernate error-handling:

 - Monitor "Hibernate Enter" and "Hibernate Exit" interrupts after
   auto-hibernate feature is activated.

 - If a failure happens, trigger error-handling just like
   "manual-hibernate" failure and apply the same recovery flow: schedule
   UFS error handler in ufshcd_check_errors(), and then do host reset and
   restore in UFS error handler.

Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Bean Huo <beanhuo@micron.com>
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
Reviewed-by: Avri Altman <Avri.Altman@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/ufs/ufshcd.c
drivers/scsi/ufs/ufshci.h