Re: [PATCH] ufs: core: Disable auto h8 before ssu
From: 高严凯
Date: Wed Oct 12 2022 - 04:49:35 EST
Dear Avri
TKS for your suggestion. and adjust timimg in own vop can solve this
problem surely.
but 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.
Not distinguishing pm_op can refer to ufshcd_auto_hibern8_enable in
__ufshcd_wl_resume.
Avri Altman <Avri.Altman@xxxxxxx> 于2022年10月12日周三 16:13写道:
>
> > >
> > > Dear Avri
> > > Unisoc reports resume fail on UFS(micron FS164) during suspend/resume
> > > test.
> > > We check host inserts auto H8 enter/exit event between SSU sleep
> > > command and H8 enter command in runtime suspend .
> > > Asfollows: SSU Sleep command --> auto H8 enter --> auto H8 exit -->
> > > H8 enter --> idle 2ms --> VCC off.
> > > However device AQL FW can’t enter LPM within 2ms after second H8
> > enter
> > > command.
> > > FW already enter LPM after receive auto H8 enter command , Next auto
> > > H8 exit command will trigger FW exit from LPM, it need take over 10ms,
> > and
> > > FW can’t enter
> > > LPM again after second H8 enter command until device complete exit
> > from
> > > LPM. So disable auto h8 before ssu is a reasonable solution to solve it.
> > > Hynix also has similar request.
> > Is this something common to all platforms?
> > If not, and you need your platform to disable h8 before ssu,
> > You can implement it in your own vop - see e.g.
> > commit 9561f58442e4 (scsi: ufs: mediatek: Support vops pre suspend to
> > disable auto-hibern8)
> Maybe to further clarify, I am not saying that your suggestion doesn't make sense.
> It's just that you need, IMHO, to make it part of ufshcd_vops_suspend, which I think
> Its ufshcd_system_suspend for every platform.
> And you need to get an ack on that from the other platform owners (maybe except
> Stanley who is doing it already).
>
> Btw, you are not checking the pm_op so your are disabling auto-h8 for runtime-suspend
> As well.
>
> And maybe elaborate the commit log with your explanation above - making it more clear.
>
> Thanks,
> Avri
> >
> > Thanks,
> > Avri
> >
> > >
> > > Avri Altman <Avri.Altman@xxxxxxx> 于2022年10月11日周二 15:07写道
> > :
> > > >
> > > > > From: Ten Gao <ten.gao@xxxxxxxxxx>
> > > > >
> > > > > Ensure auto h8 will not hit dme h8,and there won't be two h8 in a
> > > > > row after ssu.
> > > > I don't think the hw should do that.
> > > > Can you please share on which platform/host controller did you observe
> > > this?
> > > >
> > > > Thanks,
> > > > Avri
> > > > >
> > > > > Signed-off-by: Ten Gao <ten.gao@xxxxxxxxxx>
> > > > > ---
> > > > > drivers/ufs/core/ufshcd.c | 10 ++++++++++
> > > > > 1 file changed, 10 insertions(+)
> > > > >
> > > > > 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 */
> > > > > --
> > > > > 2.17.1
> > > >