diff mbox series

[v4,2/2] scsi: ufs-qcom: enter and exit hibern8 during clock scaling

Message ID 9b67c25eb7c0bf80075b36660aebdb3788207353.1589997078.git.asutoshd@codeaurora.org (mailing list archive)
State Changes Requested
Headers show
Series [v4,1/2] scsi: ufs: export hibern8 entry | expand

Commit Message

Asutosh Das (asd) May 20, 2020, 5:53 p.m. UTC
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 <asutoshd@codeaurora.org>
---
 drivers/scsi/ufs/ufs-qcom.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

Comments

Avri Altman May 20, 2020, 9:33 p.m. UTC | #1
Hi,

> 
> 
> 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 <asutoshd@codeaurora.org>

I guess that your previous versions are pretty far back - ,
I noticed a comment by Pedro, so you might want to resend this series.

What happens if the pre-change is successful,
but you are not getting to the post change because, e.g. ufshcd_set_clk_freq failed?

Also, this piece of code is ~5 years old, so you might want to elaborate on how come hibernation is now needed.

Thanks,
Avri
Asutosh Das (asd) May 20, 2020, 9:59 p.m. UTC | #2
Hi Avri,

On 5/20/2020 2:33 PM, Avri Altman wrote:
> Hi,
> 
>>
>>
>> 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 <asutoshd@codeaurora.org>
> 
> I guess that your previous versions are pretty far back - ,
> I noticed a comment by Pedro, so you might want to resend this series.
> 
Ok.

> What happens if the pre-change is successful,
> but you are not getting to the post change because, e.g. ufshcd_set_clk_freq failed?
> 
I agree. Let me check this.

> Also, this piece of code is ~5 years old, so you might want to elaborate on how come hibernation is now needed.
> 
> Thanks,
> Avri
> 

Thanks for the review. Hibernation was needed since long actually.
I guess it was never pushed upstream.

Thanks,
-asd
Asutosh Das (asd) May 25, 2021, 4:44 p.m. UTC | #3
On 5/25/2021 12:57 AM, Lee Jones wrote:
> On Wed, 20 May 2020 at 22:59, Asutosh Das (asd) <asutoshd@codeaurora.org 
> <mailto:asutoshd@codeaurora.org>> wrote:
> 
>     Hi Avri,
> 
>     On 5/20/2020 2:33 PM, Avri Altman wrote:
>      > Hi,
>      >
>      >>
>      >>
>      >> 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 <asutoshd@codeaurora.org
>     <mailto:asutoshd@codeaurora.org>>
>      >
>      > I guess that your previous versions are pretty far back - ,
>      > I noticed a comment by Pedro, so you might want to resend this
>     series.
>      >
>     Ok.
> 
>      > What happens if the pre-change is successful,
>      > but you are not getting to the post change because, e.g.
>     ufshcd_set_clk_freq failed?
>      >
>     I agree. Let me check this.
> 
>      > Also, this piece of code is ~5 years old, so you might want to
>     elaborate on how come hibernation is now needed.
>      >
>      > Thanks,
>      > Avri
>      >
> 
>     Thanks for the review. Hibernation was needed since long actually.
>     I guess it was never pushed upstream.
> 
> 
> Good morning Asd,
> 
> Any luck with getting this upstream?
> 
> Looks like this was the last submission.
> 
> Did something change?  Is this no longer required?
> 
Hi Lee
This slipped away. I may not get to this soon.
I'd prefer to drop it for now and come back to it when I've some time.

Thanks,
-asd

> -- 
> Lee Jones [李琼斯]
> Linaro Services Senior Technical Lead
> Linaro.org │ Open source software for ARM SoCs
> Follow Linaro: Facebook | Twitter | Blog
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
index 00ce8d6..3a4ed64 100644
--- a/drivers/scsi/ufs/ufs-qcom.c
+++ b/drivers/scsi/ufs/ufs-qcom.c
@@ -1418,18 +1418,27 @@  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,
@@ -1437,6 +1446,7 @@  static int ufs_qcom_clk_scale_notify(struct ufs_hba *hba,
 				    dev_req_params->hs_rate,
 				    false);
 		ufs_qcom_update_bus_bw_vote(host);
+		err = ufshcd_uic_hibern8_exit(hba);
 	}
 
 out: