2021-09-28 09:09:44

by Bao D. Nguyen

[permalink] [raw]
Subject: [PATCH v2 2/2] scsi: ufs-qcom: enter and exit hibern8 during clock scaling

From: Asutosh Das <[email protected]>

Qualcomm controller needs to be in hibern8 before scaling clocks.
This change puts the controller in hibern8 state before scaling
and brings it out after scaling of clocks.

Signed-off-by: Asutosh Das <[email protected]>
Signed-off-by: Bao D. Nguyen <[email protected]>
---
drivers/scsi/ufs/ufs-qcom.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
index 92d4c61..92f5bb4 100644
--- a/drivers/scsi/ufs/ufs-qcom.c
+++ b/drivers/scsi/ufs/ufs-qcom.c
@@ -1212,24 +1212,34 @@ static int ufs_qcom_clk_scale_notify(struct ufs_hba *hba,
int err = 0;

if (status == PRE_CHANGE) {
+ err = ufshcd_uic_hibern8_enter(hba);
+ if (err)
+ return err;
if (scale_up)
err = ufs_qcom_clk_scale_up_pre_change(hba);
else
err = ufs_qcom_clk_scale_down_pre_change(hba);
+ if (err)
+ ufshcd_uic_hibern8_exit(hba);
+
} else {
if (scale_up)
err = ufs_qcom_clk_scale_up_post_change(hba);
else
err = ufs_qcom_clk_scale_down_post_change(hba);

- if (err || !dev_req_params)
+
+ if (err || !dev_req_params) {
+ ufshcd_uic_hibern8_exit(hba);
goto out;
+ }

ufs_qcom_cfg_timers(hba,
dev_req_params->gear_rx,
dev_req_params->pwr_rx,
dev_req_params->hs_rate,
false);
+ ufshcd_uic_hibern8_exit(hba);
}

out:
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


2021-09-29 03:29:08

by Alim Akhtar

[permalink] [raw]
Subject: RE: [PATCH v2 2/2] scsi: ufs-qcom: enter and exit hibern8 during clock scaling

Hello,

>-----Original Message-----
>From: [email protected]
>[mailto:[email protected]] On Behalf Of Bao D.
>Nguyen
>Sent: Tuesday, September 28, 2021 2:36 PM
>To: [email protected]; [email protected];
>[email protected]; [email protected]
>Cc: [email protected]; Bao D . Nguyen
><[email protected]>; Andy Gross <[email protected]>; Bjorn Andersson
><[email protected]>; Alim Akhtar <[email protected]>; Avri
>Altman <[email protected]>; James E.J. Bottomley <[email protected]>;
>open list <[email protected]>
>Subject: [PATCH v2 2/2] scsi: ufs-qcom: enter and exit hibern8 during clock
scaling
>
>From: Asutosh Das <[email protected]>
>
>Qualcomm controller needs to be in hibern8 before scaling clocks.
>This change puts the controller in hibern8 state before scaling and brings
it out
>after scaling of clocks.
>
>Signed-off-by: Asutosh Das <[email protected]>
>Signed-off-by: Bao D. Nguyen <[email protected]>
>---

Reviewed-by: Alim Akhtar <[email protected]>

> drivers/scsi/ufs/ufs-qcom.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
index
>92d4c61..92f5bb4 100644
>--- a/drivers/scsi/ufs/ufs-qcom.c
>+++ b/drivers/scsi/ufs/ufs-qcom.c
>@@ -1212,24 +1212,34 @@ static int ufs_qcom_clk_scale_notify(struct ufs_hba
>*hba,
> int err = 0;
>
> if (status == PRE_CHANGE) {
>+ err = ufshcd_uic_hibern8_enter(hba);
>+ if (err)
>+ return err;
> if (scale_up)
> err = ufs_qcom_clk_scale_up_pre_change(hba);
> else
> err = ufs_qcom_clk_scale_down_pre_change(hba);
>+ if (err)
>+ ufshcd_uic_hibern8_exit(hba);
>+
> } else {
> if (scale_up)
> err = ufs_qcom_clk_scale_up_post_change(hba);
> else
> err = ufs_qcom_clk_scale_down_post_change(hba);
>
>- if (err || !dev_req_params)
>+
>+ if (err || !dev_req_params) {
>+ ufshcd_uic_hibern8_exit(hba);
> goto out;
>+ }
>
> ufs_qcom_cfg_timers(hba,
> dev_req_params->gear_rx,
> dev_req_params->pwr_rx,
> dev_req_params->hs_rate,
> false);
>+ ufshcd_uic_hibern8_exit(hba);
> }
>
> out:
>--
>The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a
>Linux Foundation Collaborative Project