[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240531103821.1583934-2-minwoo.im@samsung.com>
Date: Fri, 31 May 2024 19:38:19 +0900
From: Minwoo Im <minwoo.im@...sung.com>
To: "James E . J . Bottomley" <James.Bottomley@...senPartnership.com>,
"Martin K . Petersen" <martin.petersen@...cle.com>
Cc: Alim Akhtar <alim.akhtar@...sung.com>, Avri Altman
<avri.altman@....com>, Bart Van Assche <bvanassche@....org>, Minwoo Im
<minwoo.im@...sung.com>, gost.dev@...sung.com, linux-scsi@...r.kernel.org,
linux-kernel@...r.kernel.org, Jeuk Kim <jeuk20.kim@...sung.com>
Subject: [PATCH 1/3] ufs: mcq: Add ufshcd_mcq_queue_cfg_addr helper
This helper returns an offset address of MCQ queue configuration
registers. This is a prep patch for the following patch.
Signed-off-by: Minwoo Im <minwoo.im@...sung.com>
---
drivers/ufs/core/ufs-mcq.c | 14 ++++++++++++++
include/ufs/ufshcd.h | 1 +
2 files changed, 15 insertions(+)
diff --git a/drivers/ufs/core/ufs-mcq.c b/drivers/ufs/core/ufs-mcq.c
index 52210c4c20dc..46faa54aea94 100644
--- a/drivers/ufs/core/ufs-mcq.c
+++ b/drivers/ufs/core/ufs-mcq.c
@@ -18,6 +18,7 @@
#include <linux/iopoll.h>
#define MAX_QUEUE_SUP GENMASK(7, 0)
+#define QCFGPTR GENMASK(23, 16)
#define UFS_MCQ_MIN_RW_QUEUES 2
#define UFS_MCQ_MIN_READ_QUEUES 0
#define UFS_MCQ_MIN_POLL_QUEUES 0
@@ -116,6 +117,19 @@ struct ufs_hw_queue *ufshcd_mcq_req_to_hwq(struct ufs_hba *hba,
return &hba->uhq[hwq];
}
+/**
+ * ufshcd_mcq_queue_cfg_addr - get an start address of the MCQ Queue Config
+ * Registers.
+ * @hba: per adapter instance
+ *
+ * Return: Start address of MCQ Queue Config Registers in HCI
+ */
+unsigned int ufshcd_mcq_queue_cfg_addr(struct ufs_hba *hba)
+{
+ return FIELD_GET(QCFGPTR, hba->mcq_capabilities) * 0x200;
+}
+EXPORT_SYMBOL_GPL(ufshcd_mcq_queue_cfg_addr);
+
/**
* ufshcd_mcq_decide_queue_depth - decide the queue depth
* @hba: per adapter instance
diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
index df68fb1d4f3f..9e0581115b34 100644
--- a/include/ufs/ufshcd.h
+++ b/include/ufs/ufshcd.h
@@ -1278,6 +1278,7 @@ void ufshcd_update_evt_hist(struct ufs_hba *hba, u32 id, u32 val);
void ufshcd_hba_stop(struct ufs_hba *hba);
void ufshcd_schedule_eh_work(struct ufs_hba *hba);
void ufshcd_mcq_config_mac(struct ufs_hba *hba, u32 max_active_cmds);
+unsigned int ufshcd_mcq_queue_cfg_addr(struct ufs_hba *hba);
u32 ufshcd_mcq_read_cqis(struct ufs_hba *hba, int i);
void ufshcd_mcq_write_cqis(struct ufs_hba *hba, u32 val, int i);
unsigned long ufshcd_mcq_poll_cqe_lock(struct ufs_hba *hba,
--
2.34.1
Powered by blists - more mailing lists