Put Qualcomm's ufs controller to hibern8 during clock scaling
Subsystems (2)
cover Put Qualcomm's ufs controller to hibern8 during clock scaling
Asutosh Das tried to upstream this change about a year ago. We would like to resume his work because Qualcomm's ufs controller needs to be in hibern8 before scaling up/down the clocks. Just like ufshcd_uic_hibern8_exit() is already being exported, we would like to export ufshcd_uic_hibern8_enter() so that Qualcomm's ufs controller can be put in hibern8 state.
Asutosh Das (2):
scsi: ufs: export hibern8 entry and exit
scsi: ufs-qcom: enter and exit hibern8 during clock scaling
drivers/scsi/ufs/ufs-qcom.c | 12 +++++++++++- drivers/scsi/ufs/ufshcd.c | 4 ++-- drivers/scsi/ufs/ufshcd.h | 2 ++ 3 files changed, 15 insertions(+), 3 deletions(-)
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH 1/2 scsi: ufs: export hibern8 entry and exit
From: Asutosh Das <[email protected]>
Qualcomm controllers need to be in hibern8 before scaling up or down the clocks. Hence, export the hibern8 entry and exit functions.
--- drivers/scsi/ufs/ufshcd.c | 4 ++-- drivers/scsi/ufs/ufshcd.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/scsi/ufs/ufshcd.c +2 -2
@@ -227,7 +227,6 @@ static void ufshcd_hba_exit(struct ufs_hba *hba);static int ufshcd_clear_ua_wluns (struct ufs_hba *hba);static int ufshcd_probe_hba (struct ufs_hba *hba,bool async);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);
@@ -4116,7 +4115,7 @@ int ufshcd_link_recovery(struct ufs_hba *hba) }EXPORT_SYMBOL_GPL (ufshcd_link_recovery); -static int ufshcd_uic_hibern8_enter (struct ufs_hba *hba) +int ufshcd_uic_hibern8_enter (struct ufs_hba *hba) {int ret;struct uic_command uic_cmd = {0 };
@@ -4138,6 +4137,7 @@ static int ufshcd_uic_hibern8_enter(struct ufs_hba *hba)return ret; } +EXPORT_SYMBOL_GPL (ufshcd_uic_hibern8_enter);int ufshcd_uic_hibern8_exit (struct ufs_hba *hba) {
drivers/scsi/ufs/ufshcd.h +2 -0
@@ -1397,4 +1397,6 @@ static inline int ufshcd_rpmb_rpm_put(struct ufs_hba *hba) return pm_runtime_put(&hba->sdev_rpmb->sdev_gendev); } +int ufshcd_uic_hibern8_enter (struct ufs_hba *hba); +int ufshcd_uic_hibern8_exit (struct ufs_hba *hba);#endif /* End of Header */
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
RE: [PATCH v1 1/2] scsi: ufs: export hibern8 entry and exit
Hi Bao
drivers/scsi/ufs/ufshcd.c static void ufshcd_hba_exit(struct ufs_hba *hba);
Quoted 33 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Bao D. Nguyen
Sent: Tuesday, September 21, 2021 2:38 AM
To: [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; Bao D . Nguyen <[email protected]>; Alim Akhtar <[email protected]>; Avri Altman <[email protected]>; James E.J. Bottomley <[email protected]>; Bean Huo <[email protected]>; Stanley Chu <[email protected]>; Bart Van Assche <[email protected]>; Jaegeuk Kim <[email protected]>; Adrian Hunter <[email protected]>; Keoseong Park <[email protected]>; open list <[email protected]>
Subject: [PATCH v1 1/2] scsi: ufs: export hibern8 entry and exitFrom: Asutosh Das <[email protected]>
Qualcomm controllers need to be in hibern8 before scaling up or down the clocks. Hence, export the hibern8 entry and exit functions.
Signed-off-by Asutosh Das <[email protected]>Signed-off-by Bao D. Nguyen <[email protected]>---
drivers/scsi/ufs/ufshcd.c| 4 ++--drivers/scsi/ufs/ufshcd.h| 2 ++2 files changed, 4 insertions(+), 2 deletions(-)drivers/scsi/ufs/ufshcd.c index renamed from drivers/scsi/ufs/ufshcd.c +0
-03841ab49..f3aad32 100644
drivers/scsi/ufs/ufshcd.c +0
-0@@ -227,7 +227,6 @@ static void ufshcd_hba_exit(struct ufs_hba *hba);
static
Quoted 22 lines
int
ufshcd_clear_ua_wluns(struct ufs_hba *hba); static intufshcd_probe_hba(struct ufs_hba *hba, bool async); static intufshcd_setup_clocks(struct ufs_hba *hba, bool on); -static intufshcd_uic_hibern8_enter(struct ufs_hba *hba); static inline voidufshcd_add_delay_before_dme_cmd(struct ufs_hba *hba); static intufshcd_host_reset_and_restore(struct ufs_hba *hba); static voidufshcd_resume_clkscaling(struct ufs_hba *hba); @@ -4116,7 +4115,7 @@ intufshcd_link_recovery(struct ufs_hba *hba)}EXPORT_SYMBOL_GPL(ufshcd_link_recovery);drivers/scsi/ufs/ufshcd.c +1
-1-static int ufshcd_uic_hibern8_enter (struct ufs_hba *hba) +int ufshcd_uic_hibern8_enter (struct ufs_hba *hba){ int ret; struct uic_command uic_cmd = {0};drivers/scsi/ufs/ufshcd.c +1
-0@@ -4138,6 +4137,7 @@ static int ufshcd_uic_hibern8_enter(struct ufs_hba *hba)return ret; } +EXPORT_SYMBOL_GPL (ufshcd_uic_hibern8_enter);
Quoted 2 lines
int
ufshcd_uic_hibern8_exit(struct ufs_hba *hba){ diff --gita/drivers/scsi/ufs/ufshcd.hb/drivers/scsi/ufs/ufshcd.hindex
52ea6f3..0cc55a2
drivers/scsi/ufs/ufshcd.h static inline int ufshcd_rpmb_rpm_put(struct ufs_hba · line 1402
Quoted 10 lines
100644
drivers/scsi/ufs/ufshcd.h +2
-0@@ -1397,4 +1397,6 @@ static inline int ufshcd_rpmb_rpm_put(struct ufs_hba *hba)return pm_runtime_put (&hba->sdev_rpmb->sdev_gendev); } +int ufshcd_uic_hibern8_enter (struct ufs_hba *hba);int +ufshcd_uic_hibern8_exit (struct ufs_hba *hba);
This will add ufshcd_uic_hibern8_exit() twice, it is already add by
commit: 9d19bf7ad168a8: scsi: ufs: export some functions for vendor usage
Also move ufshcd_uic_hibern8_enter() before _earlier_ ufshcd_uic_hibern8_exit() declaration.
Quoted 3 lines
#endif /* End of Header */
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a
Quoted 1 line
Linux Foundation Collaborative Project
Re: [PATCH v1 1/2] scsi: ufs: export hibern8 entry and exit
Quoted 71 lines · Alim Akhtar
Hi Bao
drivers/scsi/ufs/ufshcd.c static void ufshcd_hba_exit(struct ufs_hba *hba);
Quoted 33 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Bao D. Nguyen
Sent: Tuesday, September 21, 2021 2:38 AM
To: [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; Bao D . Nguyen <[email protected]>; Alim Akhtar <[email protected]>; Avri Altman <[email protected]>; James E.J. Bottomley <[email protected]>; Bean Huo <[email protected]>; Stanley Chu <[email protected]>; Bart Van Assche <[email protected]>; Jaegeuk Kim <[email protected]>; Adrian Hunter <[email protected]>; Keoseong Park <[email protected]>; open list <[email protected]>
Subject: [PATCH v1 1/2] scsi: ufs: export hibern8 entry and exitFrom: Asutosh Das <[email protected]>
Qualcomm controllers need to be in hibern8 before scaling up or down the clocks. Hence, export the hibern8 entry and exit functions.
Signed-off-by Asutosh Das <[email protected]>Signed-off-by Bao D. Nguyen <[email protected]>---
drivers/scsi/ufs/ufshcd.c| 4 ++--drivers/scsi/ufs/ufshcd.h| 2 ++2 files changed, 4 insertions(+), 2 deletions(-)drivers/scsi/ufs/ufshcd.c index renamed from drivers/scsi/ufs/ufshcd.c +0
-03841ab49..f3aad32 100644
drivers/scsi/ufs/ufshcd.c +0
-0@@ -227,7 +227,6 @@ static void ufshcd_hba_exit(struct ufs_hba *hba);static
Quoted 19 lines
int
ufshcd_clear_ua_wluns(struct ufs_hba *hba); static intufshcd_probe_hba(struct ufs_hba *hba, bool async); static intufshcd_setup_clocks(struct ufs_hba *hba, bool on); -static intufshcd_uic_hibern8_enter(struct ufs_hba *hba); static inline voidufshcd_add_delay_before_dme_cmd(struct ufs_hba *hba); static intufshcd_host_reset_and_restore(struct ufs_hba *hba); static voidufshcd_resume_clkscaling(struct ufs_hba *hba); @@ -4116,7 +4115,7 @@ intufshcd_link_recovery(struct ufs_hba *hba)}EXPORT_SYMBOL_GPL(ufshcd_link_recovery);drivers/scsi/ufs/ufshcd.c +1
-1-static int ufshcd_uic_hibern8_enter (struct ufs_hba *hba) +int ufshcd_uic_hibern8_enter (struct ufs_hba *hba){ int ret; struct uic_command uic_cmd = {0};drivers/scsi/ufs/ufshcd.c +0
-0@@ -4138,6 +4137,7 @@ static int ufshcd_uic_hibern8_enter(struct
ufs_hba
*hba)Quoted 6 lines
return ret; }+EXPORT_SYMBOL_GPL(ufshcd_uic_hibern8_enter);
int
ufshcd_uic_hibern8_exit(struct ufs_hba *hba){ diff --gita/drivers/scsi/ufs/ufshcd.hb/drivers/scsi/ufs/ufshcd.hindex52ea6f3..0cc55a2
Quoted 9 lines
100644
drivers/scsi/ufs/ufshcd.h +0
-0@@ -1397,4 +1397,6 @@ static inline int ufshcd_rpmb_rpm_put(struct
ufs_hba
*hba)return pm_runtime_put(&hba->sdev_rpmb->sdev_gendev); }
Quoted 5 lines
drivers/scsi/ufs/ufshcd.h
Quoted 2 lines
drivers/scsi/ufs/ufshcd.h +2
-0+int ufshcd_uic_hibern8_enter (struct ufs_hba *hba);int +ufshcd_uic_hibern8_exit (struct ufs_hba *hba);This will add
ufshcd_uic_hibern8_exit()twice, it is already add by
commit:9d19bf7ad168a8: scsi: ufs: export some functions for vendor usage
Thank you, Alim. I have corrected this in Patch V2.
Quoted 3 lines
Also move
ufshcd_uic_hibern8_enter()before _earlier_ufshcd_uic_hibern8_exit()declaration.
Yes, I have addressed this in the Patch V2. Please review. Thank you.
Quoted 6 lines
Quoted 4 lines
#endif /* End of Header */
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,a
Quoted 1 line
Linux Foundation Collaborative Project
PATCH 2/2 scsi: ufs-qcom: enter and exit hibern8 during clock scaling
In reply to Bao D. NguyenFrom: 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.
--- drivers/scsi/ufs/ufs-qcom.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/scsi/ufs/ufs-qcom.c +11 -1
@@ -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:
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
RE: [PATCH v1 2/2] scsi: ufs-qcom: enter and exit hibern8 during clock scaling
Hello,
Quoted 5 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Bao D. Nguyen
Sent: Tuesday, September 21, 2021 2:38 AM
Quoted 8 lines
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 v1 2/2] scsi: ufs-qcom: enter and exit hibern8 during clock
scaling
Quoted 5 lines
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
Quoted 5 lines
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
Quoted 4 lines
drivers/scsi/ufs/ufs-qcom.c| 12 +++++++++++-1 file changed, 11 insertions(+), 1 deletion(-)drivers/scsi/ufs/ufs-qcom.c +0
-0
index
Quoted 39 lines
92d4c61..92f5bb4 100644
drivers/scsi/ufs/ufs-qcom.c +11
-1@@ -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); }
Quoted 3 lines
out:
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a
Quoted 1 line
Linux Foundation Collaborative Project