diff mbox series

[v9,12/17] scsi: ufs: mediatek: Rework the code for disabling auto-hibernation

Message ID 20230816195447.3703954-13-bvanassche@acm.org
State Superseded
Headers show
Series Improve performance for zoned UFS devices | expand

Commit Message

Bart Van Assche Aug. 16, 2023, 7:53 p.m. UTC
Call ufshcd_auto_hibern8_update() instead of writing directly into the
auto-hibernation control register. This patch is part of an effort to
move all auto-hibernation register changes into the UFSHCI driver core.

Cc: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/ufs/host/ufs-mediatek.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Bao D. Nguyen Aug. 17, 2023, 6:40 p.m. UTC | #1
On 8/16/2023 12:53 PM, Bart Van Assche wrote:
> Call ufshcd_auto_hibern8_update() instead of writing directly into the
> auto-hibernation control register. This patch is part of an effort to
> move all auto-hibernation register changes into the UFSHCI driver core.
> 
> Cc: Martin K. Petersen <martin.petersen@oracle.com>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>   drivers/ufs/host/ufs-mediatek.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-mediatek.c
> index e68b05976f9e..a3cf30e603ca 100644
> --- a/drivers/ufs/host/ufs-mediatek.c
> +++ b/drivers/ufs/host/ufs-mediatek.c
> @@ -1252,7 +1252,7 @@ static void ufs_mtk_auto_hibern8_disable(struct ufs_hba *hba)
>   	int ret;
>   
>   	/* disable auto-hibern8 */
> -	ufshcd_writel(hba, 0, REG_AUTO_HIBERNATE_IDLE_TIMER);
> +	ufshcd_auto_hibern8_update(hba, 0);
Since you now use ufshcd_auto_hibern8_update(), the caller should not 
need to check for ufshcd_is_auto_hibern8_supported() because this is 
already part of the hibern8_update(). Suggest remove the if statement 
from the caller.

	if (ufshcd_is_auto_hibern8_supported(hba))
		ufs_mtk_auto_hibern8_disable(hba);

>   
>   	/* wait host return to idle state when auto-hibern8 off */
>   	ufs_mtk_wait_idle_state(hba, 5);
Bart Van Assche Aug. 17, 2023, 7:13 p.m. UTC | #2
On 8/17/23 11:40, Bao D. Nguyen wrote:
> On 8/16/2023 12:53 PM, Bart Van Assche wrote:
>> diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-mediatek.c
>> index e68b05976f9e..a3cf30e603ca 100644
>> --- a/drivers/ufs/host/ufs-mediatek.c
>> +++ b/drivers/ufs/host/ufs-mediatek.c
>> @@ -1252,7 +1252,7 @@ static void ufs_mtk_auto_hibern8_disable(struct ufs_hba *hba)
>>       int ret;
>>       /* disable auto-hibern8 */
>> -    ufshcd_writel(hba, 0, REG_AUTO_HIBERNATE_IDLE_TIMER);
>> +    ufshcd_auto_hibern8_update(hba, 0);
> 
> Since you now use ufshcd_auto_hibern8_update(), the caller should not need to check for ufshcd_is_auto_hibern8_supported() because this is already part of the hibern8_update(). Suggest remove the if statement from the caller.
 >
> 
>      if (ufshcd_is_auto_hibern8_supported(hba))
>          ufs_mtk_auto_hibern8_disable(hba);
> 
>>       /* wait host return to idle state when auto-hibern8 off */
>>       ufs_mtk_wait_idle_state(hba, 5);

I think that check in the caller is still useful to skip the wait loop in
ufs_mtk_auto_hibern8_disable() if auto-hibernation is not supported.

Thanks,

Bart.
diff mbox series

Patch

diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-mediatek.c
index e68b05976f9e..a3cf30e603ca 100644
--- a/drivers/ufs/host/ufs-mediatek.c
+++ b/drivers/ufs/host/ufs-mediatek.c
@@ -1252,7 +1252,7 @@  static void ufs_mtk_auto_hibern8_disable(struct ufs_hba *hba)
 	int ret;
 
 	/* disable auto-hibern8 */
-	ufshcd_writel(hba, 0, REG_AUTO_HIBERNATE_IDLE_TIMER);
+	ufshcd_auto_hibern8_update(hba, 0);
 
 	/* wait host return to idle state when auto-hibern8 off */
 	ufs_mtk_wait_idle_state(hba, 5);