public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Eddie Huang <eddie.huang@mediatek.com>
To: Asutosh Das <quic_asutoshd@quicinc.com>,
	<martin.petersen@oracle.com>, <stanley.chu@mediatek.com>,
	<bvanassche@acm.org>, <linux-scsi@vger.kernel.org>
Cc: <avri.altman@wdc.com>, <liang-yen.wang@mediatek.com>,
	<linux-mediatek@lists.infradead.org>, <cc.chou@mediatek.com>,
	<powen.kao@mediatek.com>, Eddie Huang <eddie.huang@mediatek.com>
Subject: [PATCH v1 1/2] ufs: core: mcq: Add config_mcq_resource vops
Date: Wed, 26 Oct 2022 15:39:42 +0800	[thread overview]
Message-ID: <20221026073943.22111-2-eddie.huang@mediatek.com> (raw)
In-Reply-To: <20221026073943.22111-1-eddie.huang@mediatek.com>

SoCs vendor config MCQ register address resource in
config_mcq_resource vops

Signed-off-by: Eddie Huang <eddie.huang@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


  reply	other threads:[~2022-10-26  7:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-26  7:39 [PATCH v1 0/2] Add Mediatek UFS Multi Circular Queue Eddie Huang
2022-10-26  7:39 ` Eddie Huang [this message]
2022-10-26  7:39 ` [PATCH v1 2/2] ufs: mtk-host: Add MCQ feature Eddie Huang
2022-10-26  8:42   ` AngeloGioacchino Del Regno
2022-11-08  7:32     ` Eddie Huang (黃智傑)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221026073943.22111-2-eddie.huang@mediatek.com \
    --to=eddie.huang@mediatek.com \
    --cc=avri.altman@wdc.com \
    --cc=bvanassche@acm.org \
    --cc=cc.chou@mediatek.com \
    --cc=liang-yen.wang@mediatek.com \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=powen.kao@mediatek.com \
    --cc=quic_asutoshd@quicinc.com \
    --cc=stanley.chu@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox