[PATCH] mci: arasan: add dma write support
Steffen Trumtrar
s.trumtrar at pengutronix.de
Fri Mar 8 02:49:59 PST 2024
Switch from PIO to DMA mode in send_cmd.
Signed-off-by: Steffen Trumtrar <s.trumtrar at pengutronix.de>
---
Everything needed for the Arasan SDHCI to use DMA instead of PIO is
already present. Switch to it.
Tested on: ZynqMP.
---
drivers/mci/arasan-sdhci.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/drivers/mci/arasan-sdhci.c b/drivers/mci/arasan-sdhci.c
index 59afac7372..973e08779d 100644
--- a/drivers/mci/arasan-sdhci.c
+++ b/drivers/mci/arasan-sdhci.c
@@ -147,6 +147,7 @@ static int arasan_sdhci_send_cmd(struct mci_host *mci, struct mci_cmd *cmd,
{
struct arasan_sdhci_host *host = to_arasan_sdhci_host(mci);
u32 mask, command, xfer;
+ dma_addr_t dma;
int ret;
ret = sdhci_wait_idle(&host->sdhci, cmd);
@@ -156,13 +157,14 @@ static int arasan_sdhci_send_cmd(struct mci_host *mci, struct mci_cmd *cmd,
sdhci_write32(&host->sdhci, SDHCI_INT_STATUS, ~0);
mask = SDHCI_INT_CMD_COMPLETE;
- if (data && data->flags == MMC_DATA_READ)
- mask |= SDHCI_INT_DATA_AVAIL;
if (cmd->resp_type & MMC_RSP_BUSY)
mask |= SDHCI_INT_XFER_COMPLETE;
- sdhci_set_cmd_xfer_mode(&host->sdhci,
- cmd, data, false, &command, &xfer);
+ sdhci_setup_data_dma(&host->sdhci, data, &dma);
+
+ sdhci_set_cmd_xfer_mode(&host->sdhci, cmd, data,
+ dma == SDHCI_NO_DMA ? false : true,
+ &command, &xfer);
sdhci_write8(&host->sdhci, SDHCI_TIMEOUT_CONTROL, TIMEOUT_VAL);
if (data) {
@@ -174,15 +176,15 @@ static int arasan_sdhci_send_cmd(struct mci_host *mci, struct mci_cmd *cmd,
sdhci_write32(&host->sdhci, SDHCI_ARGUMENT, cmd->cmdarg);
sdhci_write16(&host->sdhci, SDHCI_COMMAND, command);
- ret = sdhci_wait_for_done(&host->sdhci, mask);
+ ret = sdhci_wait_for_done(&host->sdhci, SDHCI_INT_CMD_COMPLETE);
if (ret)
goto error;
sdhci_read_response(&host->sdhci, cmd);
- sdhci_write32(&host->sdhci, SDHCI_INT_STATUS, mask);
+ sdhci_write32(&host->sdhci, SDHCI_INT_STATUS, SDHCI_INT_CMD_COMPLETE);
if (data)
- ret = sdhci_transfer_data_pio(&host->sdhci, data);
+ ret = sdhci_transfer_data_dma(&host->sdhci, data, dma);
error:
if (ret) {
---
base-commit: ed7c14536d521793199abf0597164a46ba68e8e5
change-id: 20240308-v2024-02-0-topic-arasan-dma-support-edd318cce298
Best regards,
--
Steffen Trumtrar <s.trumtrar at pengutronix.de>
More information about the barebox
mailing list