diff mbox series

ufs: core: Disable auto h8 before ssu

Message ID 20221011021653.27277-1-gaoyankaigeren@gmail.com
State New
Headers show
Series ufs: core: Disable auto h8 before ssu | expand

Commit Message

高严凯 Oct. 11, 2022, 2:16 a.m. UTC
From: Ten Gao <ten.gao@unisoc.com>

Ensure auto h8 will not hit dme h8,and there won't be two h8 in a row
after ssu.

Signed-off-by: Ten Gao <ten.gao@unisoc.com>
---
 drivers/ufs/core/ufshcd.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

高严凯 Oct. 20, 2022, 5:15 a.m. UTC | #1
Dear ALL
Do you agree this patch? I'd like to hear your opinion about this.

Thanks.

高严凯 <gaoyankaigeren@gmail.com> 于2022年10月14日周五 18:15写道:
>
> hi Bean
> Yes, This is the time from when the system enters idle to when auto h8
> is issued.
> This patch is just to ensure that there is no continuous action of
> "auto h8 exit" before dme h8 enter, it has nothing to do with idle
> time.
> The reason I want to ensure this order is because when there is an
> action of "auto h8 exit", most devices take a certain amount of time
> to get the state ready.
> Immediately after the action of "auto h8 exit" is completed and "dme
> h8 enter" is followed, the device will be abnormal.
> And I think it's more of a common patch for all platforms, Patch can
> adapt different vendors,and align to ufshcd_auto_hibern8_enable in
> __ufshcd_wl_resume.
>
> Bean Huo <huobean@gmail.com> 于2022年10月14日周五 13:48写道:
> >
> > On Fri, 2022-10-14 at 10:44 +0800, 高严凯 wrote:
> > > " UFSHCI has idle time before bringing Link into hibern8 mode, " I
> > > think  ufs put the link to h8 during the time
> >
> >
> > no,  it is ufs controller. see the ufshci spec:
> >
> > "Auto-Hibern8 Idle Timer Value (AH8ITV): This is the timer that UFS
> > subsystem must be idle before UFS host *controller* may put UniPro link
> > into Hibernate state autonomously. The idle timer value is multiplied
> > by the indicated timer scale to yield an absolute timer value. ....
> >
> > ...
> > Any non-zero value will enable Auto-Hibernate idle timer.
> > UFS host controller shall put Unipro link out of Hibernate state when
> > the link communication is required. The mechanism to decide when the
> > Unipro link needs to become active is host controller specific
> > implementation, and is transparent to the software."
> >
> >
Bart Van Assche Oct. 20, 2022, 5:47 p.m. UTC | #2
On 10/19/22 22:15, 高严凯 wrote:
> Do you agree this patch? I'd like to hear your opinion about this.

Hi,

On Linux kernel mailing lists it is expected that replies are posted 
below the original email instead of above. Please follow this 
convention. More information is available at 
https://en.wikipedia.org/wiki/Posting_style#Bottom-posting.

Please also do the following:
* Fix the issues reported by the kernel test robot.
* Follow the recommendations from Avri and Bean.

Thanks,

Bart.
diff mbox series

Patch

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index a202d7d5240d..42f93648d796 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -4256,6 +4256,14 @@  void ufshcd_auto_hibern8_update(struct ufs_hba *hba, u32 ahit)
 }
 EXPORT_SYMBOL_GPL(ufshcd_auto_hibern8_update);
 
+void ufshcd_auto_hibern8_disable(struct ufs_hba *hba)
+{
+	if (!ufshcd_is_auto_hibern8_supported(hba))
+		return;
+
+	ufshcd_writel(hba, 0, REG_AUTO_HIBERNATE_IDLE_TIMER);
+}
+
 void ufshcd_auto_hibern8_enable(struct ufs_hba *hba)
 {
 	if (!ufshcd_is_auto_hibern8_supported(hba))
@@ -9036,6 +9044,8 @@  static int __ufshcd_wl_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
 	if (ret)
 		goto enable_scaling;
 
+	ufshcd_auto_hibern8_disable(hba);
+
 	if (req_dev_pwr_mode != hba->curr_dev_pwr_mode) {
 		if (pm_op != UFS_RUNTIME_PM)
 			/* ensure that bkops is disabled */