From: Can Guo <cang@codeaurora.org>
To: Stanley Chu <stanley.chu@mediatek.com>
Cc: linux-scsi@vger.kernel.org, martin.petersen@oracle.com,
avri.altman@wdc.com, alim.akhtar@samsung.com, jejb@linux.ibm.com,
beanhuo@micron.com, asutoshd@codeaurora.org,
matthias.bgg@gmail.com, bvanassche@acm.org,
linux-mediatek@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, kuohong.wang@mediatek.com,
peter.wang@mediatek.com, chun-hung.wu@mediatek.com,
andy.teng@mediatek.com, chaotian.jing@mediatek.com,
cc.chou@mediatek.com
Subject: Re: [PATCH v1 1/2] scsi: ufs: Introduce device quirk "DELAY_AFTER_LPM"
Date: Wed, 29 Jul 2020 17:21:47 +0800 [thread overview]
Message-ID: <1cf315e12d21dd91906321d7303cff99@codeaurora.org> (raw)
In-Reply-To: <20200729051840.31318-2-stanley.chu@mediatek.com>
On 2020-07-29 13:18, Stanley Chu wrote:
> Some UFS devices require delay after VCC power rail is turned-off.
> Introduce a device quirk "DELAY_AFTER_LPM" to add 5ms delays after
> VCC power-off during suspend flow.
>
> Signed-off-by: Andy Teng <andy.teng@mediatek.com>
> Signed-off-by: Peter Wang <peter.wang@mediatek.com>
> Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
> ---
> drivers/scsi/ufs/ufs_quirks.h | 7 +++++++
> drivers/scsi/ufs/ufshcd.c | 11 +++++++++++
> 2 files changed, 18 insertions(+)
>
> diff --git a/drivers/scsi/ufs/ufs_quirks.h
> b/drivers/scsi/ufs/ufs_quirks.h
> index 2a0041493e30..07f559ac5883 100644
> --- a/drivers/scsi/ufs/ufs_quirks.h
> +++ b/drivers/scsi/ufs/ufs_quirks.h
> @@ -109,4 +109,11 @@ struct ufs_dev_fix {
> */
> #define UFS_DEVICE_QUIRK_SUPPORT_EXTENDED_FEATURES (1 << 10)
>
> +/*
> + * Some UFS devices require delay after VCC power rail is turned-off.
> + * Enable this quirk to introduce 5ms delays after VCC power-off
> during
> + * suspend flow.
> + */
> +#define UFS_DEVICE_QUIRK_DELAY_AFTER_LPM (1 << 11)
> +
> #endif /* UFS_QUIRKS_H_ */
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index acba2271c5d3..63f4e2f75aa1 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -8111,6 +8111,8 @@ static int ufshcd_link_state_transition(struct
> ufs_hba *hba,
>
> static void ufshcd_vreg_set_lpm(struct ufs_hba *hba)
> {
> + bool vcc_off = false;
> +
> /*
> * It seems some UFS devices may keep drawing more than sleep current
> * (atleast for 500us) from UFS rails (especially from VCCQ rail).
> @@ -8139,13 +8141,22 @@ static void ufshcd_vreg_set_lpm(struct ufs_hba
> *hba)
> if (ufshcd_is_ufs_dev_poweroff(hba) && ufshcd_is_link_off(hba) &&
> !hba->dev_info.is_lu_power_on_wp) {
> ufshcd_setup_vreg(hba, false);
> + vcc_off = true;
> } else if (!ufshcd_is_ufs_dev_active(hba)) {
> ufshcd_toggle_vreg(hba->dev, hba->vreg_info.vcc, false);
> + vcc_off = true;
> if (!ufshcd_is_link_active(hba)) {
> ufshcd_config_vreg_lpm(hba, hba->vreg_info.vccq);
> ufshcd_config_vreg_lpm(hba, hba->vreg_info.vccq2);
> }
> }
> +
> + /*
> + * Some UFS devices require delay after VCC power rail is turned-off.
> + */
> + if (vcc_off && hba->vreg_info.vcc &&
> + hba->dev_quirks & UFS_DEVICE_QUIRK_DELAY_AFTER_LPM)
> + usleep_range(5000, 5100);
> }
>
> static int ufshcd_vreg_set_hpm(struct ufs_hba *hba)
Reviewed-by: Can Guo <cang@codeaurora.org>
next prev parent reply other threads:[~2020-07-29 9:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-29 5:18 [PATCH v1 0/2] scsi: ufs: Introduce and apply DELAY_AFTER_LPM device quirk Stanley Chu
2020-07-29 5:18 ` [PATCH v1 1/2] scsi: ufs: Introduce device quirk "DELAY_AFTER_LPM" Stanley Chu
2020-07-29 5:31 ` Can Guo
2020-07-29 6:17 ` Stanley Chu
2020-07-29 9:21 ` Can Guo [this message]
2020-07-29 5:18 ` [PATCH v1 2/2] scsi: ufs-mediatek: Apply DELAY_AFTER_LPM quirk to Micron devices Stanley Chu
2020-07-29 7:32 ` [PATCH v1 0/2] scsi: ufs: Introduce and apply DELAY_AFTER_LPM device quirk Avri Altman
2020-07-30 2:24 ` Martin K. Petersen
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=1cf315e12d21dd91906321d7303cff99@codeaurora.org \
--to=cang@codeaurora.org \
--cc=alim.akhtar@samsung.com \
--cc=andy.teng@mediatek.com \
--cc=asutoshd@codeaurora.org \
--cc=avri.altman@wdc.com \
--cc=beanhuo@micron.com \
--cc=bvanassche@acm.org \
--cc=cc.chou@mediatek.com \
--cc=chaotian.jing@mediatek.com \
--cc=chun-hung.wu@mediatek.com \
--cc=jejb@linux.ibm.com \
--cc=kuohong.wang@mediatek.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=matthias.bgg@gmail.com \
--cc=peter.wang@mediatek.com \
--cc=stanley.chu@mediatek.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).