[PATCH v1 01/10] ufs: host: mediatek: Enhance recovery on hibernation exit failure

Bart Van Assche bvanassche at acm.org
Mon Aug 25 08:46:32 PDT 2025


On 8/25/25 3:10 AM, peter.wang at mediatek.com wrote:
> @@ -1697,8 +1698,20 @@ static void ufs_mtk_auto_hibern8_disable(struct ufs_hba *hba)
>   	ufs_mtk_wait_idle_state(hba, 5);
>   
>   	ret = ufs_mtk_wait_link_state(hba, VS_LINK_UP, 100);
> -	if (ret)
> +	if (ret) {
>   		dev_warn(hba->dev, "exit h8 state fail, ret=%d\n", ret);
> +
> +		spin_lock_irqsave(hba->host->host_lock, flags);
> +		hba->force_reset = true;
> +		hba->ufshcd_state = UFSHCD_STATE_EH_SCHEDULED_FATAL;
> +		schedule_work(&hba->eh_work);
> +		spin_unlock_irqrestore(hba->host->host_lock, flags);
> +
> +		/* trigger error handler and break suspend */
> +		ret = -EBUSY;
> +	}
> +
> +	return ret;
>   }

Hi Peter,

UFS host drivers shouldn't touch hba->force_reset, hba->ufshcd_state nor 
hba->eh_work. Please add a helper function in the UFS driver core and 
export it.

Thanks,

Bart.



More information about the Linux-mediatek mailing list