linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 1/2] scsi: ufs: export hibern8 entry
@ 2020-05-20 17:53 Asutosh Das
  2020-05-20 17:53 ` [PATCH v4 2/2] scsi: ufs-qcom: enter and exit hibern8 during clock scaling Asutosh Das
  0 siblings, 1 reply; 5+ messages in thread
From: Asutosh Das @ 2020-05-20 17:53 UTC (permalink / raw)
  To: cang, martin.petersen, PedroM.Sousa, linux-scsi
  Cc: Asutosh Das, linux-arm-msm, Alim Akhtar, Avri Altman,
	James E.J. Bottomley, Stanley Chu, Bean Huo, Bart Van Assche,
	Tomas Winkler, open list

Qualcomm controllers need to be in hibern8 before scaling up
or down the clocks. Hence, export the hibern8 entry function.

Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
---
 drivers/scsi/ufs/ufshcd.c | 4 ++--
 drivers/scsi/ufs/ufshcd.h | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index c3389c9..aaf4adf 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -243,7 +243,6 @@ static int ufshcd_probe_hba(struct ufs_hba *hba, bool async);
 static int __ufshcd_setup_clocks(struct ufs_hba *hba, bool on,
 				 bool skip_ref_clk);
 static int ufshcd_setup_clocks(struct ufs_hba *hba, bool on);
-static int ufshcd_uic_hibern8_enter(struct ufs_hba *hba);
 static inline void ufshcd_add_delay_before_dme_cmd(struct ufs_hba *hba);
 static int ufshcd_host_reset_and_restore(struct ufs_hba *hba);
 static void ufshcd_resume_clkscaling(struct ufs_hba *hba);
@@ -3877,7 +3876,7 @@ static int __ufshcd_uic_hibern8_enter(struct ufs_hba *hba)
 	return ret;
 }
 
-static int ufshcd_uic_hibern8_enter(struct ufs_hba *hba)
+int ufshcd_uic_hibern8_enter(struct ufs_hba *hba)
 {
 	int ret = 0, retries;
 
@@ -3889,6 +3888,7 @@ static int ufshcd_uic_hibern8_enter(struct ufs_hba *hba)
 out:
 	return ret;
 }
+EXPORT_SYMBOL_GPL(ufshcd_uic_hibern8_enter);
 
 int ufshcd_uic_hibern8_exit(struct ufs_hba *hba)
 {
diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
index 88d4202..defc12c 100644
--- a/drivers/scsi/ufs/ufshcd.h
+++ b/drivers/scsi/ufs/ufshcd.h
@@ -835,6 +835,7 @@ int ufshcd_wait_for_register(struct ufs_hba *hba, u32 reg, u32 mask,
 void ufshcd_parse_dev_ref_clk_freq(struct ufs_hba *hba, struct clk *refclk);
 void ufshcd_update_reg_hist(struct ufs_err_reg_hist *reg_hist,
 			    u32 reg);
+int ufshcd_uic_hibern8_enter(struct ufs_hba *hba);
 
 static inline void check_upiu_size(void)
 {
-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v4 2/2] scsi: ufs-qcom: enter and exit hibern8 during clock scaling
  2020-05-20 17:53 [PATCH v4 1/2] scsi: ufs: export hibern8 entry Asutosh Das
@ 2020-05-20 17:53 ` Asutosh Das
  2020-05-20 21:33   ` Avri Altman
  0 siblings, 1 reply; 5+ messages in thread
From: Asutosh Das @ 2020-05-20 17:53 UTC (permalink / raw)
  To: cang, martin.petersen, PedroM.Sousa, linux-scsi
  Cc: Asutosh Das, linux-arm-msm, Andy Gross, Bjorn Andersson,
	Alim Akhtar, Avri Altman, James E.J. Bottomley, open list

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(-)

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:
-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH v4 2/2] scsi: ufs-qcom: enter and exit hibern8 during clock scaling
  2020-05-20 17:53 ` [PATCH v4 2/2] scsi: ufs-qcom: enter and exit hibern8 during clock scaling Asutosh Das
@ 2020-05-20 21:33   ` Avri Altman
  2020-05-20 21:59     ` Asutosh Das (asd)
  0 siblings, 1 reply; 5+ messages in thread
From: Avri Altman @ 2020-05-20 21:33 UTC (permalink / raw)
  To: Asutosh Das, cang, martin.petersen, PedroM.Sousa, linux-scsi
  Cc: linux-arm-msm, Andy Gross, Bjorn Andersson, Alim Akhtar,
	James E.J. Bottomley, open list

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v4 2/2] scsi: ufs-qcom: enter and exit hibern8 during clock scaling
  2020-05-20 21:33   ` Avri Altman
@ 2020-05-20 21:59     ` Asutosh Das (asd)
       [not found]       ` <CAF2Aj3gpMhPf8dF7cxcW0AhwGmGtf=LbO6HPB0u3FxudWTBcoQ@mail.gmail.com>
  0 siblings, 1 reply; 5+ messages in thread
From: Asutosh Das (asd) @ 2020-05-20 21:59 UTC (permalink / raw)
  To: Avri Altman, cang, martin.petersen, PedroM.Sousa, linux-scsi
  Cc: linux-arm-msm, Andy Gross, Bjorn Andersson, Alim Akhtar,
	James E.J. Bottomley, open list

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

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v4 2/2] scsi: ufs-qcom: enter and exit hibern8 during clock scaling
       [not found]       ` <CAF2Aj3gpMhPf8dF7cxcW0AhwGmGtf=LbO6HPB0u3FxudWTBcoQ@mail.gmail.com>
@ 2021-05-25 16:44         ` Asutosh Das (asd)
  0 siblings, 0 replies; 5+ messages in thread
From: Asutosh Das (asd) @ 2021-05-25 16:44 UTC (permalink / raw)
  To: Lee Jones
  Cc: Avri Altman, cang, martin.petersen, PedroM.Sousa, linux-scsi,
	linux-arm-msm, Andy Gross, Bjorn Andersson, Alim Akhtar,
	James E.J. Bottomley, open list

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


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-05-25 16:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-20 17:53 [PATCH v4 1/2] scsi: ufs: export hibern8 entry Asutosh Das
2020-05-20 17:53 ` [PATCH v4 2/2] scsi: ufs-qcom: enter and exit hibern8 during clock scaling Asutosh Das
2020-05-20 21:33   ` Avri Altman
2020-05-20 21:59     ` Asutosh Das (asd)
     [not found]       ` <CAF2Aj3gpMhPf8dF7cxcW0AhwGmGtf=LbO6HPB0u3FxudWTBcoQ@mail.gmail.com>
2021-05-25 16:44         ` Asutosh Das (asd)

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).