[COMMON] scsi: ufs: Add reset for PA_ERROR interrupt storming control.
authorJaeHun Jung <jh0801.jung@samsung.com>
Wed, 20 Nov 2019 02:39:06 +0000 (11:39 +0900)
committerlingsen1 <lingsen1@lenovo.com>
Fri, 22 Nov 2019 05:44:42 +0000 (13:44 +0800)
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 <jh0801.jung@samsung.com>
drivers/scsi/ufs/ufshcd.c
drivers/scsi/ufs/ufshcd.h
drivers/scsi/ufs/ufshci.h

index 173a1b8fe7a9a44ea07aa709c7785232c9d44b27..c2590970635b65669d2df551de16ba380748bf79 100644 (file)
@@ -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);
index 66fc1997973232464e7fb5bf5c93d780d84b1f04..f70a9d09bfedc7f177dad541805ba12192793427 100644 (file)
@@ -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;
index 63a22b991014d4a5c70636acdcf90198d46f17a4..2ef54bf202a5c8ed93782f6aaae66a6055b9d163 100644 (file)
@@ -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