Commit 52bf134f authored by Sergey Khimich's avatar Sergey Khimich Committed by Ulf Hansson

mmc: cqhci: Add cqhci set_tran_desc() callback

There are could be specific limitations for some mmc
controllers for setting cqhci transfer descriptors.
So add callback to allow implement driver specific function.
Signed-off-by: default avatarSergey Khimich <serghox@gmail.com>
Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20240319115932.4108904-2-serghox@gmail.comSigned-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent f4a5dddd
...@@ -474,7 +474,7 @@ static int cqhci_dma_map(struct mmc_host *host, struct mmc_request *mrq) ...@@ -474,7 +474,7 @@ static int cqhci_dma_map(struct mmc_host *host, struct mmc_request *mrq)
return sg_count; return sg_count;
} }
static void cqhci_set_tran_desc(u8 *desc, dma_addr_t addr, int len, bool end, void cqhci_set_tran_desc(u8 *desc, dma_addr_t addr, int len, bool end,
bool dma64) bool dma64)
{ {
__le32 *attr = (__le32 __force *)desc; __le32 *attr = (__le32 __force *)desc;
...@@ -495,6 +495,7 @@ static void cqhci_set_tran_desc(u8 *desc, dma_addr_t addr, int len, bool end, ...@@ -495,6 +495,7 @@ static void cqhci_set_tran_desc(u8 *desc, dma_addr_t addr, int len, bool end,
dataddr[0] = cpu_to_le32(addr); dataddr[0] = cpu_to_le32(addr);
} }
} }
EXPORT_SYMBOL(cqhci_set_tran_desc);
static int cqhci_prep_tran_desc(struct mmc_request *mrq, static int cqhci_prep_tran_desc(struct mmc_request *mrq,
struct cqhci_host *cq_host, int tag) struct cqhci_host *cq_host, int tag)
...@@ -522,7 +523,11 @@ static int cqhci_prep_tran_desc(struct mmc_request *mrq, ...@@ -522,7 +523,11 @@ static int cqhci_prep_tran_desc(struct mmc_request *mrq,
if ((i+1) == sg_count) if ((i+1) == sg_count)
end = true; end = true;
if (cq_host->ops->set_tran_desc)
cq_host->ops->set_tran_desc(cq_host, &desc, addr, len, end, dma64);
else
cqhci_set_tran_desc(desc, addr, len, end, dma64); cqhci_set_tran_desc(desc, addr, len, end, dma64);
desc += cq_host->trans_desc_len; desc += cq_host->trans_desc_len;
} }
......
...@@ -293,6 +293,9 @@ struct cqhci_host_ops { ...@@ -293,6 +293,9 @@ struct cqhci_host_ops {
int (*program_key)(struct cqhci_host *cq_host, int (*program_key)(struct cqhci_host *cq_host,
const union cqhci_crypto_cfg_entry *cfg, int slot); const union cqhci_crypto_cfg_entry *cfg, int slot);
#endif #endif
void (*set_tran_desc)(struct cqhci_host *cq_host, u8 **desc,
dma_addr_t addr, int len, bool end, bool dma64);
}; };
static inline void cqhci_writel(struct cqhci_host *host, u32 val, int reg) static inline void cqhci_writel(struct cqhci_host *host, u32 val, int reg)
...@@ -318,6 +321,7 @@ irqreturn_t cqhci_irq(struct mmc_host *mmc, u32 intmask, int cmd_error, ...@@ -318,6 +321,7 @@ irqreturn_t cqhci_irq(struct mmc_host *mmc, u32 intmask, int cmd_error,
int cqhci_init(struct cqhci_host *cq_host, struct mmc_host *mmc, bool dma64); int cqhci_init(struct cqhci_host *cq_host, struct mmc_host *mmc, bool dma64);
struct cqhci_host *cqhci_pltfm_init(struct platform_device *pdev); struct cqhci_host *cqhci_pltfm_init(struct platform_device *pdev);
int cqhci_deactivate(struct mmc_host *mmc); int cqhci_deactivate(struct mmc_host *mmc);
void cqhci_set_tran_desc(u8 *desc, dma_addr_t addr, int len, bool end, bool dma64);
static inline int cqhci_suspend(struct mmc_host *mmc) static inline int cqhci_suspend(struct mmc_host *mmc)
{ {
return cqhci_deactivate(mmc); return cqhci_deactivate(mmc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment