[PATCH v1 1/2] ufs: core: mcq: Add config_mcq_resource vops

Eddie Huang eddie.huang at mediatek.com
Wed Oct 26 00:39:42 PDT 2022


SoCs vendor config MCQ register address resource in
config_mcq_resource vops

Signed-off-by: Eddie Huang <eddie.huang at mediatek.com>
---
 drivers/ufs/core/ufs-mcq.c     | 3 +++
 drivers/ufs/core/ufshcd-priv.h | 8 ++++++++
 include/ufs/ufshcd.h           | 1 +
 3 files changed, 12 insertions(+)

diff --git a/drivers/ufs/core/ufs-mcq.c b/drivers/ufs/core/ufs-mcq.c
index b51ba35..1fdb45a 100644
--- a/drivers/ufs/core/ufs-mcq.c
+++ b/drivers/ufs/core/ufs-mcq.c
@@ -173,6 +173,9 @@ static int ufshcd_mcq_config_resource(struct ufs_hba *hba)
 	struct resource *res_mem, *res_mcq;
 	int i, ret = 0;
 
+	if (ufshcd_mcq_vops_config_resource(hba) == 0)
+		return 0;
+
 	memcpy(hba->res, ufs_res_info, sizeof(ufs_res_info));
 
 	for (i = 0; i < RES_MAX; i++) {
diff --git a/drivers/ufs/core/ufshcd-priv.h b/drivers/ufs/core/ufshcd-priv.h
index 6e9bec6..2f71b0e 100644
--- a/drivers/ufs/core/ufshcd-priv.h
+++ b/drivers/ufs/core/ufshcd-priv.h
@@ -257,6 +257,14 @@ static inline int ufshcd_vops_get_outstanding_cqs(struct ufs_hba *hba,
 	return -EOPNOTSUPP;
 }
 
+static inline int ufshcd_mcq_vops_config_resource(struct ufs_hba *hba)
+{
+	if (hba->vops && hba->vops->config_mcq_resource)
+		return hba->vops->config_mcq_resource(hba);
+
+	return -EOPNOTSUPP;
+}
+
 extern const struct ufs_pm_lvl_states ufs_pm_lvl_states[];
 
 /**
diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
index 506fc6e..be323c9 100644
--- a/include/ufs/ufshcd.h
+++ b/include/ufs/ufshcd.h
@@ -339,6 +339,7 @@ struct ufs_hba_variant_ops {
 	int	(*op_runtime_config)(struct ufs_hba *hba);
 	int	(*get_outstanding_cqs)(struct ufs_hba *hba,
 				       unsigned long *ocqs);
+	int	(*config_mcq_resource)(struct ufs_hba *hba);
 };
 
 /* clock gating state  */
-- 
2.9.2




More information about the Linux-mediatek mailing list