All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] mci: arasan: add dma write support
Date: Wed, 13 Mar 2024 08:45:42 +0100	[thread overview]
Message-ID: <ZfFZppHWRMrkNpCS@pengutronix.de> (raw)
In-Reply-To: <20240308-v2024-02-0-topic-arasan-dma-support-v1-1-079e10b6ea88@pengutronix.de>

On Fri, Mar 08, 2024 at 11:49:59AM +0100, Steffen Trumtrar wrote:
> Switch from PIO to DMA mode in send_cmd.
> 
> Signed-off-by: Steffen Trumtrar <s.trumtrar@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(-)

The subject says the patch adds DMA *write* support. It's generally DMA
support, not only for write, right? I fixed that up accordingly while
applying.

Sascha

> 
> 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@pengutronix.de>
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



      parent reply	other threads:[~2024-03-13  7:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-08 10:49 [PATCH] mci: arasan: add dma write support Steffen Trumtrar
2024-03-13  7:44 ` Sascha Hauer
2024-03-13  7:45 ` Sascha Hauer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZfFZppHWRMrkNpCS@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.trumtrar@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.