public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Shawn Lin <shawn.lin@rock-chips.com>
To: Kaustabh Chakraborty <kauschluss@disroot.org>,
	Ulf Hansson <ulfh@kernel.org>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Jaehoon Chung <jh80.chung@samsung.com>
Cc: shawn.lin@rock-chips.com, linux-mmc@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] mmc: dw_mmc: implement option for configuring DMA threshold
Date: Sun, 12 Apr 2026 19:15:55 +0800	[thread overview]
Message-ID: <c5b299e2-63e1-fd06-6688-6403d6c513e2@rock-chips.com> (raw)
In-Reply-To: <20260412-dwmmc-dma-thr-v1-2-75a2f658eee3@disroot.org>

Hi Kaustabh

在 2026/04/12 星期日 3:43, Kaustabh Chakraborty 写道:
> Some controllers, such as certain Exynos SDIO ones, are unable to
> perform DMA transfers of small amount of bytes properly. Following the
> device tree schema, implement the property to define the DMA transfer
> threshold (from a hard coded value of 16 bytes) so that lesser number of
> bytes can be transferred safely skipping DMA in such controllers. The
> value of 16 bytes stays as the default for controllers which do not
> define it.
> 
> Signed-off-by: Kaustabh Chakraborty <kauschluss@disroot.org>
> ---
>   drivers/mmc/host/dw_mmc.c | 6 ++++--
>   drivers/mmc/host/dw_mmc.h | 1 +
>   2 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index 20193ee7b73eb..0c0d269b5e033 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -40,7 +40,6 @@
>   				 SDMMC_INT_RESP_ERR | SDMMC_INT_HLE)
>   #define DW_MCI_ERROR_FLAGS	(DW_MCI_DATA_ERROR_FLAGS | \
>   				 DW_MCI_CMD_ERROR_FLAGS)
> -#define DW_MCI_DMA_THRESHOLD	16
>   
>   #define DW_MCI_FREQ_MAX	200000000	/* unit: HZ */
>   #define DW_MCI_FREQ_MIN	100000		/* unit: HZ */
> @@ -821,7 +820,7 @@ static int dw_mci_pre_dma_transfer(struct dw_mci *host,
>   	 * non-word-aligned buffers or lengths. Also, we don't bother
>   	 * with all the DMA setup overhead for short transfers.
>   	 */
> -	if (data->blocks * data->blksz < DW_MCI_DMA_THRESHOLD)
> +	if (data->blocks * data->blksz < host->dma_threshold)
>   		return -EINVAL;
>   
>   	if (data->blksz & 3)
> @@ -3137,6 +3136,9 @@ static int dw_mci_parse_dt(struct dw_mci *host)
>   	if (!host->data_addr_override)
>   		device_property_read_u32(dev, "data-addr", &host->data_addr_override);
>   
> +	if (device_property_read_u32(dev, "dma-threshold-bytes", &host->dma_threshold) < 0)
> +		host->dma_threshold = 16;
> +
>   	if (device_property_present(dev, "fifo-watermark-aligned"))
>   		host->wm_aligned = true;
>   
> diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h
> index 42e58be74ce09..5cdd342d01b68 100644
> --- a/drivers/mmc/host/dw_mmc.h
> +++ b/drivers/mmc/host/dw_mmc.h
> @@ -163,6 +163,7 @@ struct dw_mci {
>   	void __iomem		*regs;
>   	void __iomem		*fifo_reg;
>   	u32			data_addr_override;
> +	u32			dma_threshold;

In addition to fixing the issue mentioned in patch 1, please add a 
comment for this new member.

>   	bool			wm_aligned;
>   
>   	struct scatterlist	*sg;
> 

      reply	other threads:[~2026-04-12 11:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-11 19:43 [PATCH 0/2] Configuring DMA threshold value for DW-MMC controllers Kaustabh Chakraborty
2026-04-11 19:43 ` [PATCH 1/2] dt-bindings: mmc: dw-mshc-common: add option for configuring DMA threshold Kaustabh Chakraborty
2026-04-11 20:27   ` Krzysztof Kozlowski
2026-04-12  4:29     ` Kaustabh Chakraborty
2026-04-12  4:46       ` Kaustabh Chakraborty
2026-04-11 19:43 ` [PATCH 2/2] mmc: dw_mmc: implement " Kaustabh Chakraborty
2026-04-12 11:15   ` Shawn Lin [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=c5b299e2-63e1-fd06-6688-6403d6c513e2@rock-chips.com \
    --to=shawn.lin@rock-chips.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jh80.chung@samsung.com \
    --cc=kauschluss@disroot.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=ulfh@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox