diff mbox series

[v1,2/3] ufs: host: mediatek: fix mcq mode tm cmd timeout

Message ID 20231221110416.16176-3-peter.wang@mediatek.com (mailing list archive)
State Accepted, archived
Headers show
Series ufs: host: mediatek: Provide fixes in MediaTek platforms | expand

Commit Message

Peter Wang (王信友) Dec. 21, 2023, 11:04 a.m. UTC
From: Peter Wang <peter.wang@mediatek.com>

Fix tm cmd timeout issue in mcq mode by default resume call
ufshcd_make_hba_operational to set tm cmd dma address.
This flow same as ufs init make operational after link startup then
set mcq related register if use mcq mode.

Signed-off-by: Peter Wang <peter.wang@mediatek.com>
---
 drivers/ufs/host/ufs-mediatek.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

Comments

Chun-Hung Wu (巫駿宏) Dec. 25, 2023, 7:20 a.m. UTC | #1
On Thu, 2023-12-21 at 19:04 +0800, peter.wang@mediatek.com wrote:
> From: Peter Wang <peter.wang@mediatek.com>
> 
> Fix tm cmd timeout issue in mcq mode by default resume call
> ufshcd_make_hba_operational to set tm cmd dma address.
> This flow same as ufs init make operational after link startup then
> set mcq related register if use mcq mode.
> 
> Signed-off-by: Peter Wang <peter.wang@mediatek.com>
> ---
>  drivers/ufs/host/ufs-mediatek.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-
> mediatek.c
> index 104354a4d899..eb1934126c87 100644
> --- a/drivers/ufs/host/ufs-mediatek.c
> +++ b/drivers/ufs/host/ufs-mediatek.c
> @@ -1220,9 +1220,11 @@ static int ufs_mtk_link_set_hpm(struct ufs_hba
> *hba)
>  	}
>  	ufshcd_set_link_active(hba);
>  
> -	if (!hba->mcq_enabled) {
> -		err = ufshcd_make_hba_operational(hba);
> -	} else {
> +	err = ufshcd_make_hba_operational(hba);
> +	if (err)
> +		return err;
> +
> +	if (is_mcq_enabled(hba)) {
>  		ufs_mtk_config_mcq(hba, false);
>  		ufshcd_mcq_make_queues_operational(hba);
>  		ufshcd_mcq_config_mac(hba, hba->nutrs);
> @@ -1231,9 +1233,6 @@ static int ufs_mtk_link_set_hpm(struct ufs_hba
> *hba)
>  			      REG_UFS_MEM_CFG);
>  	}
>  
> -	if (err)
> -		return err;
> -
>  	return 0;
>  }
>  
Reviewed-by: Chun-Hung Wu <chun-hung.wu@mediatek.com>

Chun-Hung
diff mbox series

Patch

diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-mediatek.c
index 104354a4d899..eb1934126c87 100644
--- a/drivers/ufs/host/ufs-mediatek.c
+++ b/drivers/ufs/host/ufs-mediatek.c
@@ -1220,9 +1220,11 @@  static int ufs_mtk_link_set_hpm(struct ufs_hba *hba)
 	}
 	ufshcd_set_link_active(hba);
 
-	if (!hba->mcq_enabled) {
-		err = ufshcd_make_hba_operational(hba);
-	} else {
+	err = ufshcd_make_hba_operational(hba);
+	if (err)
+		return err;
+
+	if (is_mcq_enabled(hba)) {
 		ufs_mtk_config_mcq(hba, false);
 		ufshcd_mcq_make_queues_operational(hba);
 		ufshcd_mcq_config_mac(hba, hba->nutrs);
@@ -1231,9 +1233,6 @@  static int ufs_mtk_link_set_hpm(struct ufs_hba *hba)
 			      REG_UFS_MEM_CFG);
 	}
 
-	if (err)
-		return err;
-
 	return 0;
 }