[PATCH] scsi: ufs: introduce dev_cmd_notify callback

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Some UFS host controller may need to synchronize dev command among
UFS host controllers.

Signed-off-by: Gyunghoon Kwon <goodjob.kwon@xxxxxxxxxxx>
---
 drivers/ufs/core/ufshcd.c |  2 ++
 include/ufs/ufshcd.h      | 10 ++++++++++
 2 files changed, 12 insertions(+)

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index c7b337480e3e..fb642c5e73a3 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -3021,8 +3021,10 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba,
 
 	ufshcd_add_query_upiu_trace(hba, UFS_QUERY_SEND, lrbp->ucd_req_ptr);
 
+	ufshcd_vops_dev_cmd_notify(hba, PRE_CHANGE);
 	ufshcd_send_command(hba, tag);
 	err = ufshcd_wait_for_dev_cmd(hba, lrbp, timeout);
+	ufshcd_vops_dev_cmd_notify(hba, POST_CHANGE);
 	ufshcd_add_query_upiu_trace(hba, err ? UFS_QUERY_ERR : UFS_QUERY_COMP,
 				    (struct utp_upiu_req *)lrbp->ucd_rsp_ptr);
 
diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
index a92271421718..376babf71432 100644
--- a/include/ufs/ufshcd.h
+++ b/include/ufs/ufshcd.h
@@ -293,6 +293,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
+ * @dev_cmd_notify: called to notify device management request is issued
  */
 struct ufs_hba_variant_ops {
 	const char *name;
@@ -331,6 +332,8 @@ 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	(*dev_cmd_notify)(struct ufs_hba *hba,
+				  enum ufs_notify_change_status);
 };
 
 /* clock gating state  */
@@ -1217,6 +1220,13 @@ static inline int ufshcd_vops_phy_initialization(struct ufs_hba *hba)
 	return 0;
 }
 
+static inline void ufshcd_vops_dev_cmd_notify(struct ufs_hba *hba,
+					enum ufs_notify_change_status status)
+{
+	if (hba->vops && hba->vops->dev_cmd_notify)
+		hba->vops->dev_cmd_notify(hba, status);
+}
+
 extern struct ufs_pm_lvl_states ufs_pm_lvl_states[];
 
 int ufshcd_dump_regs(struct ufs_hba *hba, size_t offset, size_t len,
-- 
2.37.1




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux