Put Qualcomm's ufs controller to hibern8 during clock scaling
Subsystems (2)
v2 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.
Changes from v1:
- Removed the extra ufshcd_uic_hibern8_exit().
- Moved the ufshcd_uic_hibern8_enter() above the current ufshcd_uic_hibern8_exit().
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 | 1 + 3 files changed, 14 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 v2 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 | 1 + 2 files changed, 3 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 +1 -0
@@ -1001,6 +1001,7 @@ int ufshcd_init(struct ufs_hba *, void __iomem *, unsigned int);int ufshcd_link_recovery (struct ufs_hba *hba);int ufshcd_make_hba_operational (struct ufs_hba *hba);void ufshcd_remove (struct ufs_hba *); +int ufshcd_uic_hibern8_enter (struct ufs_hba *hba);int ufshcd_uic_hibern8_exit (struct ufs_hba *hba);void ufshcd_delay_us (unsigned long us,unsigned long tolerance); int ufshcd_wait_for_register(struct ufs_hba *hba, u32 reg, u32 mask,
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Re: [PATCH v2 1/2] scsi: ufs: export hibern8 entry and exit
Quoted 3 lines · Bao D. Nguyen
Qualcomm controllers need to be in hibern8 before scaling up or down the clocks. Hence, export the hibern8 entry and exit functions.
RE: [PATCH v2 1/2] scsi: ufs: export hibern8 entry and exit
In reply to Bao D. NguyenHello,
Quoted 16 lines
-----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]>; 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 v2 1/2] scsi: ufs: export hibern8 entry and exit
Quoted 8 lines
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.
Signed-off-by Asutosh Das <[email protected]>Signed-off-by Bao D. Nguyen <[email protected]>---
drivers/scsi/ufs/ufshcd.c static void ufshcd_hba_exit(struct ufs_hba *hba);
Quoted 9 lines
drivers/scsi/ufs/ufshcd.c| 4 ++--drivers/scsi/ufs/ufshcd.h| 1 +2 files changed, 3 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..124f50b
Quoted 6 lines
100644
drivers/scsi/ufs/ufshcd.h +0
-0@@ -1001,6 +1001,7 @@ int ufshcd_init(struct ufs_hba *, void __iomem *,unsigned int); int
ufshcd_link_recovery(struct ufs_hba *hba); intufshcd_make_hba_operational(struct ufs_hba *hba); void
ufshcd_remove(struct
Quoted 7 lines
ufs_hba*);
+intufshcd_uic_hibern8_enter(struct ufs_hba *hba);
intufshcd_uic_hibern8_exit(struct ufs_hba *hba); voidufshcd_delay_us(unsigned long us, unsigned long tolerance); int ufshcd_wait_for_register(structufs_hba*hba, u32 reg, u32 mask, --
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a
Quoted 1 line
Linux Foundation Collaborative Project
PATCH v2 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 v2 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 28, 2021 2:36 PM
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 v2 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
Martin K. Petersen
AppliedQuoted 8 lines · Bao D. Nguyen
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 exportufshcd_uic_hibern8_enter()so that Qualcomm's ufs controller can be put in hibern8 state.[...]
Applied to 5.16/scsi-queue, thanks!
[1/2] scsi: ufs: export hibern8 entry and exit
https://git.kernel.org/mkp/scsi/c/525943a586ef [2/2] scsi: ufs-qcom: enter and exit hibern8 during clock scaling https://git.kernel.org/mkp/scsi/c/a0cea83332ae
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering