linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Can Guo <cang@codeaurora.org>
To: Kiwoong Kim <kwmad.kim@samsung.com>
Cc: linux-scsi@vger.kernel.org, alim.akhtar@samsung.com,
	avri.altman@wdc.com, jejb@linux.ibm.com,
	martin.petersen@oracle.com, beanhuo@micron.com,
	asutoshd@codeaurora.org, bvanassche@acm.org,
	grant.jung@samsung.com, sc.suh@samsung.com, hy50.seo@samsung.com,
	sh425.lee@samsung.com, bhoon95.kim@samsung.com
Subject: Re: [RFC PATCH v1] ufs: relocate turning off device power sources
Date: Mon, 21 Dec 2020 10:37:11 +0800	[thread overview]
Message-ID: <ba859a31c04068671dfca42aa7cf9d05@codeaurora.org> (raw)
In-Reply-To: <000001d6d73a$e44dd770$ace98650$@samsung.com>

On 2020-12-21 09:44, Kiwoong Kim wrote:
>> On 2020-12-19 14:27, Kiwoong Kim wrote:
>> > UFS specification says that while powering off the device, RST_n
>> > signal and REF_CLK signal should be between VSS and VCCQ.
>> > One of ways to make it is to drive both RST_n and REF_CLK to low.
>> >
>> > However, the current location of turning off them doesn't guarantee
>> > that. ufshcd_link_state_transition make enter hibern8 but it's not
>> > supposed to adjust the level of REF_CLK. Adding
>> > ufshcd_vops_device_reset isn't proper because it just drives the level
>> > of RST_n to low and then to high, not keep low.
>> > In this situation, it could make those levels be diverged from those
>> > proper ranges with actual hardware situations, especially right when
>> > the driver turns off power.
>> >
>> > The easist way to make it is just to move the location of turning off
>> > because lowering the levels can be enabled through the callbacks named
>> > suspend and setup_clocks.
>> >
>> > Signed-off-by: Kiwoong Kim <kwmad.kim@samsung.com>
>> > ---
>> >  drivers/scsi/ufs/ufshcd.c | 9 +++++++--
>> >  1 file changed, 7 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
>> > index 92d433d..dab9840 100644
>> > --- a/drivers/scsi/ufs/ufshcd.c
>> > +++ b/drivers/scsi/ufs/ufshcd.c
>> > @@ -8633,8 +8633,6 @@ static int ufshcd_suspend(struct ufs_hba *hba,
>> > enum ufs_pm_op pm_op)
>> >  	if (ret)
>> >  		goto set_dev_active;
>> >
>> > -	ufshcd_vreg_set_lpm(hba);
>> > -
>> >  disable_clks:
>> >  	/*
>> >  	 * Call vendor specific suspend callback. As these callbacks may
>> > access @@ -8662,6 +8660,13 @@ static int ufshcd_suspend(struct ufs_hba
>> > *hba, enum ufs_pm_op pm_op)
>> >  					hba->clk_gating.state);
>> >  	}
>> >
>> > +	/*
>> > +	 * It should follows driving RST_n and REF_CLK
>> > +	 * in the range specified in UFS specification
>> > +	 */
>> > +	if (!ufshcd_is_ufs_dev_active(hba))
>> > +		ufshcd_vreg_set_lpm(hba);
>> > +
>> >  	/* Put the host controller in low power mode if possible */
>> >  	ufshcd_hba_vreg_set_lpm(hba);
>> >  	goto out;
>> 
>> Ziqi Chen has a change to totally fix the UFS power-on/off spec 
>> violation,
>> see https://lore.kernel.org/patchwork/patch/1351118/ and he is working 
>> on
>> V2, can we wait for his change?
> 
> Two questions.
> 1. If his patch covers what I said, it's okay.

Yes, it does cover your fix as you can tell from V1.

> 2. What does he plan to post?

Within today.

Thanks,

Can Guo.

> What do you think?
> 
> Thanks.
> Kiwoong Kim
>> 
>> Thanks,
>> 
>> Can Guo.

      reply	other threads:[~2020-12-21  2:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20201219063815epcas2p1ffd277f7e53d9680abb460f55a53c599@epcas2p1.samsung.com>
2020-12-19  6:27 ` [RFC PATCH v1] ufs: relocate turning off device power sources Kiwoong Kim
2020-12-20  5:34   ` Can Guo
2020-12-21  1:44     ` Kiwoong Kim
2020-12-21  2:37       ` Can Guo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ba859a31c04068671dfca42aa7cf9d05@codeaurora.org \
    --to=cang@codeaurora.org \
    --cc=alim.akhtar@samsung.com \
    --cc=asutoshd@codeaurora.org \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=bhoon95.kim@samsung.com \
    --cc=bvanassche@acm.org \
    --cc=grant.jung@samsung.com \
    --cc=hy50.seo@samsung.com \
    --cc=jejb@linux.ibm.com \
    --cc=kwmad.kim@samsung.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=sc.suh@samsung.com \
    --cc=sh425.lee@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).