From: "Asutosh Das (asd)" <asutoshd@codeaurora.org>
To: Stanley Chu <stanley.chu@mediatek.com>,
linux-scsi@vger.kernel.org, martin.petersen@oracle.com,
avri.altman@wdc.com, alim.akhtar@samsung.com, jejb@linux.ibm.com
Cc: beanhuo@micron.com, cang@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
Subject: Re: [PATCH v1 3/3] scsi: ufs-mediatek: enable low-power mode for hibern8 state
Date: Mon, 20 Jan 2020 12:52:17 -0800 [thread overview]
Message-ID: <38b2614d-1fdd-8bad-63a1-e9bc5698cc66@codeaurora.org> (raw)
In-Reply-To: <20200117035108.19699-4-stanley.chu@mediatek.com>
On 1/16/2020 7:51 PM, Stanley Chu wrote:
> In MediaTek Chipsets, UniPro link and ufshci can enter proprietary
> low-power mode while link is in hibern8 state.
>
> Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
> ---
Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
> drivers/scsi/ufs/ufs-mediatek.c | 53 +++++++++++++++++++++++++++++++++
> 1 file changed, 53 insertions(+)
>
> diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c
> index d5194d0c4ef5..f32f3f34f6d0 100644
> --- a/drivers/scsi/ufs/ufs-mediatek.c
> +++ b/drivers/scsi/ufs/ufs-mediatek.c
> @@ -382,11 +382,60 @@ static void ufs_mtk_device_reset(struct ufs_hba *hba)
> dev_info(hba->dev, "device reset done\n");
> }
>
> +static int ufs_mtk_link_set_hpm(struct ufs_hba *hba)
> +{
> + int err;
> +
> + err = ufshcd_hba_enable(hba);
> + if (err)
> + return err;
> +
> + err = ufshcd_dme_set(hba,
> + UIC_ARG_MIB_SEL(VS_UNIPROPOWERDOWNCONTROL, 0),
> + 0);
> + if (err)
> + return err;
> +
> + err = ufshcd_uic_hibern8_exit(hba);
> + if (!err)
> + ufshcd_set_link_active(hba);
> + else
> + return err;
> +
> + err = ufshcd_make_hba_operational(hba);
> + if (err)
> + return err;
> +
> + return 0;
> +}
> +
> +static int ufs_mtk_link_set_lpm(struct ufs_hba *hba)
> +{
> + int err;
> +
> + err = ufshcd_dme_set(hba,
> + UIC_ARG_MIB_SEL(VS_UNIPROPOWERDOWNCONTROL, 0),
> + 1);
> + if (err) {
> + /* Resume UniPro state for following error recovery */
> + ufshcd_dme_set(hba,
> + UIC_ARG_MIB_SEL(VS_UNIPROPOWERDOWNCONTROL, 0),
> + 0);
> + return err;
> + }
> +
> + return 0;
> +}
> +
> static int ufs_mtk_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
> {
> + int err;
> struct ufs_mtk_host *host = ufshcd_get_variant(hba);
>
> if (ufshcd_is_link_hibern8(hba)) {
> + err = ufs_mtk_link_set_lpm(hba);
> + if (err)
> + return -EAGAIN;
> phy_power_off(host->mphy);
> ufs_mtk_setup_ref_clk(hba, false);
> }
> @@ -397,10 +446,14 @@ static int ufs_mtk_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
> static int ufs_mtk_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)
> {
> struct ufs_mtk_host *host = ufshcd_get_variant(hba);
> + int err;
>
> if (ufshcd_is_link_hibern8(hba)) {
> ufs_mtk_setup_ref_clk(hba, true);
> phy_power_on(host->mphy);
> + err = ufs_mtk_link_set_hpm(hba);
> + if (err)
> + return err;
> }
>
> return 0;
>
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
Linux Foundation Collaborative Project
next prev parent reply other threads:[~2020-01-20 20:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-17 3:51 [PATCH v1 0/3] scsi: ufs-mediatek: add MediaTek vendor implementation part II Stanley Chu
2020-01-17 3:51 ` [PATCH v1 1/3] scsi: ufs-mediatek: add dbg_register_dump implementation Stanley Chu
2020-01-19 14:05 ` Alim Akhtar
2020-01-17 3:51 ` [PATCH v1 2/3] scsi: ufs: export some functions for vendor usage Stanley Chu
2020-01-19 14:12 ` Alim Akhtar
2020-01-20 20:49 ` Asutosh Das (asd)
2020-01-17 3:51 ` [PATCH v1 3/3] scsi: ufs-mediatek: enable low-power mode for hibern8 state Stanley Chu
2020-01-19 14:27 ` Alim Akhtar
2020-01-20 20:52 ` Asutosh Das (asd) [this message]
2020-01-21 0:10 ` [PATCH v1 0/3] scsi: ufs-mediatek: add MediaTek vendor implementation part II 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=38b2614d-1fdd-8bad-63a1-e9bc5698cc66@codeaurora.org \
--to=asutoshd@codeaurora.org \
--cc=alim.akhtar@samsung.com \
--cc=andy.teng@mediatek.com \
--cc=avri.altman@wdc.com \
--cc=beanhuo@micron.com \
--cc=bvanassche@acm.org \
--cc=cang@codeaurora.org \
--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).