[RAMEN9610-20933][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)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:23:38 +0000 (20:23 +0300)
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 1ce06226f79daec36886516474d0f9e528809c27..ddc0bc75d28fcb3c8d6ae777d4f563fef10b3bd1 100644 (file)
@@ -5639,7 +5639,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 |=
@@ -5764,6 +5770,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 53a2843320ead5ac62f4a2c4a73ca0a74911fa85..0ea3d55c3a2583ebb86f683bd18e46d456a4b39d 100644 (file)
@@ -670,6 +670,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;
        bool silence_err_logs;
 
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