diff mbox series

mmc: CQHCI: solve DMA boundary limitation of CQHCI driver

Message ID 20221116020012.19318-1-jyanchou@realtek.com
State New
Headers show
Series mmc: CQHCI: solve DMA boundary limitation of CQHCI driver | expand

Commit Message

Jyan Chou [周芷安] Nov. 16, 2022, 2 a.m. UTC
Because CQHCI has its own DMA descriptors, when using DMA,
if the DMA addr or buffer size has limitaion, we need to add an
option to set up tran_desc.

Signed-off-by: Jyan Chou <jyanchou@realtek.com>
---
 drivers/mmc/host/cqhci-core.c | 5 +++++
 drivers/mmc/host/cqhci.h      | 2 ++
 2 files changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/drivers/mmc/host/cqhci-core.c b/drivers/mmc/host/cqhci-core.c
index b3d7d6d8d654..4d6fb228a21e 100644
--- a/drivers/mmc/host/cqhci-core.c
+++ b/drivers/mmc/host/cqhci-core.c
@@ -516,6 +516,11 @@  static int cqhci_prep_tran_desc(struct mmc_request *mrq,
 
 	desc = get_trans_desc(cq_host, tag);
 
+	if (cq_host->ops->setup_tran_desc) {
+		cq_host->ops->setup_tran_desc(data, cq_host, desc, sg_count);
+		return 0;
+	}
+
 	for_each_sg(data->sg, sg, sg_count, i) {
 		addr = sg_dma_address(sg);
 		len = sg_dma_len(sg);
diff --git a/drivers/mmc/host/cqhci.h b/drivers/mmc/host/cqhci.h
index ba9387ed90eb..2e47461096e8 100644
--- a/drivers/mmc/host/cqhci.h
+++ b/drivers/mmc/host/cqhci.h
@@ -290,6 +290,8 @@  struct cqhci_host_ops {
 	int (*program_key)(struct cqhci_host *cq_host,
 			   const union cqhci_crypto_cfg_entry *cfg, int slot);
 #endif
+	void (*setup_tran_desc)(struct mmc_data *data,
+		struct cqhci_host *cq_host, u8 *desc, int sg_count);
 };
 
 static inline void cqhci_writel(struct cqhci_host *host, u32 val, int reg)