Skip to content

Commit faac32d

Browse files
ptr324martinkpetersen
authored andcommitted
scsi: ufs: host: mediatek: Enhance recovery on hibernation exit failure
Improve the recovery process for hibernation exit failures. Trigger the error handler and break the suspend operation to ensure effective recovery from hibernation errors. Activate the error handling mechanism by ufshcd_force_error_recovery and scheduling the error handler work. Signed-off-by: Peter Wang <peter.wang@mediatek.com> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 5863638 commit faac32d

3 files changed

Lines changed: 14 additions & 4 deletions

File tree

drivers/ufs/core/ufshcd.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6446,13 +6446,14 @@ void ufshcd_schedule_eh_work(struct ufs_hba *hba)
64466446
}
64476447
}
64486448

6449-
static void ufshcd_force_error_recovery(struct ufs_hba *hba)
6449+
void ufshcd_force_error_recovery(struct ufs_hba *hba)
64506450
{
64516451
spin_lock_irq(hba->host->host_lock);
64526452
hba->force_reset = true;
64536453
ufshcd_schedule_eh_work(hba);
64546454
spin_unlock_irq(hba->host->host_lock);
64556455
}
6456+
EXPORT_SYMBOL_GPL(ufshcd_force_error_recovery);
64566457

64576458
static void ufshcd_clk_scaling_allow(struct ufs_hba *hba, bool allow)
64586459
{

drivers/ufs/host/ufs-mediatek.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1686,7 +1686,7 @@ static void ufs_mtk_dev_vreg_set_lpm(struct ufs_hba *hba, bool lpm)
16861686
}
16871687
}
16881688

1689-
static void ufs_mtk_auto_hibern8_disable(struct ufs_hba *hba)
1689+
static int ufs_mtk_auto_hibern8_disable(struct ufs_hba *hba)
16901690
{
16911691
int ret;
16921692

@@ -1697,8 +1697,16 @@ static void ufs_mtk_auto_hibern8_disable(struct ufs_hba *hba)
16971697
ufs_mtk_wait_idle_state(hba, 5);
16981698

16991699
ret = ufs_mtk_wait_link_state(hba, VS_LINK_UP, 100);
1700-
if (ret)
1700+
if (ret) {
17011701
dev_warn(hba->dev, "exit h8 state fail, ret=%d\n", ret);
1702+
1703+
ufshcd_force_error_recovery(hba);
1704+
1705+
/* trigger error handler and break suspend */
1706+
ret = -EBUSY;
1707+
}
1708+
1709+
return ret;
17021710
}
17031711

17041712
static int ufs_mtk_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op,
@@ -1709,7 +1717,7 @@ static int ufs_mtk_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op,
17091717

17101718
if (status == PRE_CHANGE) {
17111719
if (ufshcd_is_auto_hibern8_supported(hba))
1712-
ufs_mtk_auto_hibern8_disable(hba);
1720+
return ufs_mtk_auto_hibern8_disable(hba);
17131721
return 0;
17141722
}
17151723

include/ufs/ufshcd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1508,5 +1508,6 @@ int __ufshcd_write_ee_control(struct ufs_hba *hba, u32 ee_ctrl_mask);
15081508
int ufshcd_write_ee_control(struct ufs_hba *hba);
15091509
int ufshcd_update_ee_control(struct ufs_hba *hba, u16 *mask,
15101510
const u16 *other_mask, u16 set, u16 clr);
1511+
void ufshcd_force_error_recovery(struct ufs_hba *hba);
15111512

15121513
#endif /* End of Header */

0 commit comments

Comments
 (0)