On Thu, Aug 11, 2022 at 03:33:03AM -0700, Can Guo wrote:Ok.
From: Asutosh Das <quic_asutoshd@xxxxxxxxxxx>
Adds MCQ support to UFS.
The design uses shared tags across all the hw queues.
The queue-depth is chosen within range supported by controller &
device. It also takes EXT_IID into account while choosing the queue
depth.
It supports default, read, poll and a dev cmd queue.
It enables MCQ after determining the queue-depth that the ufs
device supports.
Co-developed-by: Can Guo <quic_cang@xxxxxxxxxxx>
As per the Documentation, "Co-developed-by" should be followed by
"Signed-off-by" of the author. So you can just move this "Co-developed-by"
below Asutosh's S-o-b and that should be fine.
The current changes make up a single functional base MCQ driver.Signed-off-by: Asutosh Das <quic_asutoshd@xxxxxxxxxxx>
Signed-off-by: Can Guo <quic_cang@xxxxxxxxxxx>
---
drivers/ufs/core/Makefile | 2 +-
drivers/ufs/core/ufs-mcq.c | 524 +++++++++++++++++++++++++++++++++++++++++++++
drivers/ufs/core/ufshcd.c | 394 ++++++++++++++++++++++++++--------
include/ufs/ufs.h | 5 +
include/ufs/ufshcd.h | 223 ++++++++++++++++++-
include/ufs/ufshci.h | 77 +++++++
6 files changed, 1135 insertions(+), 90 deletions(-)
This patch is too big to review. Could you please split it into multiple
patches?
Here queue depth is abbreviated to qd which I think is inline with what the function does. So I prefer to keep it as qd.
s/qd/depth
Existing ufs driver dma addresses have the suffix addr, Refer struct ufshcd_lrb. So it is in line with the current naming convention.+
+ val = ufshcd_readl(hba, REG_UFS_MCQ_CFG);
+struct ufs_hw_queue {
+ void *sqe_base_addr;
s/sqe_base_addr/sqe_base
>> + dma_addr_t sqe_dma_addr;
s/sqe_dma_addr/sqe_dma
+ struct cq_entry *cqe_base_addr;
s/cqe_base_addr/cqe_base
+ dma_addr_t cqe_dma_addr;
s/cqe_dma_addr/cqe_dma
[...]+ u32 max_entries;
+ u32 id;
+
+ void __iomem *mcq_sq_hp;
+ void __iomem *mcq_sq_tp;
+ void __iomem *mcq_cq_hp;
+ void __iomem *mcq_cq_tp;
Not sure if I understand this correctly. Let me check this internally and get back.+ MCQ_CFG_n(REG_SQATTR, i));If you are writing to the same memory region, like in this case "mcq_base",
then you should be able to use _relaxed variants as the writes to the same
device memory are guaranteed to be in-order.
This also removes the overhead associated with __iowmb included in writel.
Please audit this change throught the driver and use _relaxed variants where
applicable.
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.