From: JaeHun Jung Date: Wed, 20 Nov 2019 02:39:06 +0000 (+0900) Subject: [COMMON] scsi: ufs: Add reset for PA_ERROR interrupt storming control. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ca9f22ceb56fc6033a5034a330150e3a91a3c456;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [COMMON] scsi: ufs: Add reset for PA_ERROR interrupt storming control. Sometimes PA_ERROR could not recover phy status automatically. So, We shuld execute phy reset for recovery. Change-Id: Ic5d8a202712626fe4fb242daea8eedd73d31dc0e Signed-off-by: JaeHun Jung --- diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 173a1b8fe7a9..c2590970635b 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -5617,7 +5617,13 @@ static void ufshcd_update_uic_error(struct ufs_hba *hba) if (reg & UIC_DATA_LINK_LAYER_ERROR_PA_INIT) hba->uic_error |= UFSHCD_UIC_DL_PA_INIT_ERROR; - else if (hba->dev_quirks & + else if (reg & UIC_DATA_LINK_LAYER_ERROR_PA_ERROR_IND_RECEIVED) { + if (hba->saved_uic_phy_err_cnt > 10) { + hba->uic_error |= UFSHCD_UIC_DL_PA_INIT_ERROR; + hba->saved_uic_phy_err_cnt = 0; + } else + hba->saved_uic_phy_err_cnt++; + } else if (hba->dev_quirks & UFS_DEVICE_QUIRK_RECOVERY_FROM_DL_NAC_ERRORS) { if (reg & UIC_DATA_LINK_LAYER_ERROR_NAC_RECEIVED) hba->uic_error |= @@ -5742,6 +5748,8 @@ static void ufshcd_sl_intr(struct ufs_hba *hba, u32 intr_status) hba->errors = UFSHCD_ERROR_MASK & intr_status; if (hba->errors) ufshcd_check_errors(hba); + else + hba->saved_uic_phy_err_cnt = 0; if (intr_status & UFSHCD_UIC_MASK) ufshcd_uic_cmd_compl(hba, intr_status); diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 66fc19979732..f70a9d09bfed 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -669,6 +669,7 @@ struct ufs_hba { u32 uic_error; u32 saved_err; u32 saved_uic_err; + u32 saved_uic_phy_err_cnt; struct ufs_stats ufs_stats; u32 tcx_replay_timer_expired_cnt; diff --git a/drivers/scsi/ufs/ufshci.h b/drivers/scsi/ufs/ufshci.h index 63a22b991014..2ef54bf202a5 100644 --- a/drivers/scsi/ufs/ufshci.h +++ b/drivers/scsi/ufs/ufshci.h @@ -194,6 +194,7 @@ enum { #define UIC_DATA_LINK_LAYER_ERROR_FCX_PRO_TIMER_EXP UFS_BIT(3) #define UIC_DATA_LINK_LAYER_ERROR_RX_BUF_OF UFS_BIT(5) #define UIC_DATA_LINK_LAYER_ERROR_PA_INIT UFS_BIT(13) +#define UIC_DATA_LINK_LAYER_ERROR_PA_ERROR_IND_RECEIVED UFS_BIT(14) #define UIC_DATA_LINK_LAYER_ERROR_NAC_RECEIVED 0x0001 #define UIC_DATA_LINK_LAYER_ERROR_TCx_REPLAY_TIMEOUT 0x0002