[v4,18/23] scsi: ufs: core: Add reinit_notify() callback

Message ID 20221201174328.870152-19-manivannan.sadhasivam@linaro.org
State New
Headers
Series ufs: qcom: Add HS-G4 support |

Commit Message

Manivannan Sadhasivam Dec. 1, 2022, 5:43 p.m. UTC
  reinit_notify() callback can be used by the UFS controllers to perform
changes required for UFS core reinit.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
 drivers/ufs/core/ufshcd-priv.h | 6 ++++++
 include/ufs/ufshcd.h           | 2 ++
 2 files changed, 8 insertions(+)
  

Comments

Bart Van Assche Dec. 1, 2022, 6:05 p.m. UTC | #1
On 12/1/22 09:43, Manivannan Sadhasivam wrote:
> reinit_notify() callback can be used by the UFS controllers to perform
> changes required for UFS core reinit.

What does "UFS core" refer to in this context? Should "UFS core" perhaps 
be changed into "UFS controller phy"?

> diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
> index 5cf81dff60aa..af8c95077d96 100644
> --- a/include/ufs/ufshcd.h
> +++ b/include/ufs/ufshcd.h
> @@ -297,6 +297,7 @@ struct ufs_pwr_mode_info {
>    * @config_scaling_param: called to configure clock scaling parameters
>    * @program_key: program or evict an inline encryption key
>    * @event_notify: called to notify important events
> + * @reinit_notify: called to notify UFS core reinit

Please make this comment more clear. Nobody knows what "UFS core" means.

Thanks,

Bart.
  
Manivannan Sadhasivam Dec. 2, 2022, 7:32 a.m. UTC | #2
On Thu, Dec 01, 2022 at 10:05:57AM -0800, Bart Van Assche wrote:
> On 12/1/22 09:43, Manivannan Sadhasivam wrote:
> > reinit_notify() callback can be used by the UFS controllers to perform
> > changes required for UFS core reinit.
> 
> What does "UFS core" refer to in this context? Should "UFS core" perhaps be
> changed into "UFS controller phy"?
> 

By "UFS core" I meant the UFSHCD driver. Will change it.

> > diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
> > index 5cf81dff60aa..af8c95077d96 100644
> > --- a/include/ufs/ufshcd.h
> > +++ b/include/ufs/ufshcd.h
> > @@ -297,6 +297,7 @@ struct ufs_pwr_mode_info {
> >    * @config_scaling_param: called to configure clock scaling parameters
> >    * @program_key: program or evict an inline encryption key
> >    * @event_notify: called to notify important events
> > + * @reinit_notify: called to notify UFS core reinit
> 
> Please make this comment more clear. Nobody knows what "UFS core" means.
> 

Will change it to "called to notify reinit of UFSHCD during max gear switch"

Thanks,
Mani

> Thanks,
> 
> Bart.
>
  

Patch

diff --git a/drivers/ufs/core/ufshcd-priv.h b/drivers/ufs/core/ufshcd-priv.h
index a9e8e1f5afe7..2ce3c98e0711 100644
--- a/drivers/ufs/core/ufshcd-priv.h
+++ b/drivers/ufs/core/ufshcd-priv.h
@@ -226,6 +226,12 @@  static inline void ufshcd_vops_config_scaling_param(struct ufs_hba *hba,
 		hba->vops->config_scaling_param(hba, p, data);
 }
 
+static inline void ufshcd_vops_reinit_notify(struct ufs_hba *hba)
+{
+	if (hba->vops && hba->vops->reinit_notify)
+		hba->vops->reinit_notify(hba);
+}
+
 extern const struct ufs_pm_lvl_states ufs_pm_lvl_states[];
 
 /**
diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
index 5cf81dff60aa..af8c95077d96 100644
--- a/include/ufs/ufshcd.h
+++ b/include/ufs/ufshcd.h
@@ -297,6 +297,7 @@  struct ufs_pwr_mode_info {
  * @config_scaling_param: called to configure clock scaling parameters
  * @program_key: program or evict an inline encryption key
  * @event_notify: called to notify important events
+ * @reinit_notify: called to notify UFS core reinit
  */
 struct ufs_hba_variant_ops {
 	const char *name;
@@ -335,6 +336,7 @@  struct ufs_hba_variant_ops {
 			       const union ufs_crypto_cfg_entry *cfg, int slot);
 	void	(*event_notify)(struct ufs_hba *hba,
 				enum ufs_event_type evt, void *data);
+	void	(*reinit_notify)(struct ufs_hba *);
 };
 
 /* clock gating state  */