* [PATCH 0/2] Configuring DMA threshold value for DW-MMC controllers
@ 2026-04-11 19:43 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 19:43 ` [PATCH 2/2] mmc: dw_mmc: implement " Kaustabh Chakraborty
0 siblings, 2 replies; 4+ messages in thread
From: Kaustabh Chakraborty @ 2026-04-11 19:43 UTC (permalink / raw)
To: Ulf Hansson, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Jaehoon Chung, Shawn Lin
Cc: linux-mmc, devicetree, linux-kernel, Kaustabh Chakraborty
In Samsung Exynos 7870 devices with Broadcom Wi-Fi, it has been observed
that small sized DMA transfers are unreliable and are not written
properly, which renders the cache incoherent.
Experimental observations say that DMA transfer sizes of somewhere
around 64 to 512 are intolerable. We must thus implement a mechanism to
fall back to PIO transfer in this case. One such approach, which this
series implements is allowing the DMA transfer threshold, which is
already defined in the driver, to be configurable.
Note that this patch is likely to be labelled as a workaround. These
smaller transfers seem to be successful from downstream kernels,
however efforts to figure out how so went in vain. It is also very
possible that the downstream Broadcom Wi-Fi SDIO driver uses PIO
transfers as well.
Signed-off-by: Kaustabh Chakraborty <kauschluss@disroot.org>
---
Kaustabh Chakraborty (2):
dt-bindings: mmc: dw-mshc-common: add option for configuring DMA threshold
mmc: dw_mmc: implement option for configuring DMA threshold
.../devicetree/bindings/mmc/synopsys-dw-mshc-common.yaml | 8 ++++++++
drivers/mmc/host/dw_mmc.c | 6 ++++--
drivers/mmc/host/dw_mmc.h | 1 +
3 files changed, 13 insertions(+), 2 deletions(-)
---
base-commit: 66672af7a095d89f082c5327f3b15bc2f93d558e
change-id: 20260412-dwmmc-dma-thr-1090d8285ea7
Best regards,
--
Kaustabh Chakraborty <kauschluss@disroot.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] dt-bindings: mmc: dw-mshc-common: add option for configuring DMA threshold
2026-04-11 19:43 [PATCH 0/2] Configuring DMA threshold value for DW-MMC controllers Kaustabh Chakraborty
@ 2026-04-11 19:43 ` Kaustabh Chakraborty
2026-04-11 20:27 ` Krzysztof Kozlowski
2026-04-11 19:43 ` [PATCH 2/2] mmc: dw_mmc: implement " Kaustabh Chakraborty
1 sibling, 1 reply; 4+ messages in thread
From: Kaustabh Chakraborty @ 2026-04-11 19:43 UTC (permalink / raw)
To: Ulf Hansson, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Jaehoon Chung, Shawn Lin
Cc: linux-mmc, devicetree, linux-kernel, Kaustabh Chakraborty
Some controllers, such as certain Exynos SDIO ones, are unable to
perform DMA transfers of small amount of bytes properly. Add a property
to configure the DMA transfer threshold.
Signed-off-by: Kaustabh Chakraborty <kauschluss@disroot.org>
---
.../devicetree/bindings/mmc/synopsys-dw-mshc-common.yaml | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/Documentation/devicetree/bindings/mmc/synopsys-dw-mshc-common.yaml b/Documentation/devicetree/bindings/mmc/synopsys-dw-mshc-common.yaml
index 6f11b2adf1036..1693277957a91 100644
--- a/Documentation/devicetree/bindings/mmc/synopsys-dw-mshc-common.yaml
+++ b/Documentation/devicetree/bindings/mmc/synopsys-dw-mshc-common.yaml
@@ -57,6 +57,14 @@ properties:
force fifo watermark setting accordingly.
$ref: /schemas/types.yaml#/definitions/flag
+ dma-threshold-bytes:
+ description:
+ DMA transfer takes place only if the transfer size is equal to or greater
+ than the number of bytes defined by the threshold value. Some controllers are
+ unable to perform the DMA transfer properly with small amounts of data.
+ This option allows to configure the threshold up to a comfortable value.
+ $ref: /schemas/types.yaml#/definitions/uint32
+
dmas:
maxItems: 1
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] mmc: dw_mmc: implement option for configuring DMA threshold
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 19:43 ` Kaustabh Chakraborty
1 sibling, 0 replies; 4+ messages in thread
From: Kaustabh Chakraborty @ 2026-04-11 19:43 UTC (permalink / raw)
To: Ulf Hansson, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Jaehoon Chung, Shawn Lin
Cc: linux-mmc, devicetree, linux-kernel, 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;
bool wm_aligned;
struct scatterlist *sg;
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] dt-bindings: mmc: dw-mshc-common: add option for configuring DMA threshold
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
0 siblings, 0 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2026-04-11 20:27 UTC (permalink / raw)
To: Kaustabh Chakraborty, Ulf Hansson, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Jaehoon Chung, Shawn Lin
Cc: linux-mmc, devicetree, linux-kernel
On 11/04/2026 21:43, Kaustabh Chakraborty wrote:
> Some controllers, such as certain Exynos SDIO ones, are unable to
> perform DMA transfers of small amount of bytes properly. Add a property
> to configure the DMA transfer threshold.
>
> Signed-off-by: Kaustabh Chakraborty <kauschluss@disroot.org>
> ---
> .../devicetree/bindings/mmc/synopsys-dw-mshc-common.yaml | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/mmc/synopsys-dw-mshc-common.yaml b/Documentation/devicetree/bindings/mmc/synopsys-dw-mshc-common.yaml
> index 6f11b2adf1036..1693277957a91 100644
> --- a/Documentation/devicetree/bindings/mmc/synopsys-dw-mshc-common.yaml
> +++ b/Documentation/devicetree/bindings/mmc/synopsys-dw-mshc-common.yaml
> @@ -57,6 +57,14 @@ properties:
> force fifo watermark setting accordingly.
> $ref: /schemas/types.yaml#/definitions/flag
>
> + dma-threshold-bytes:
> + description:
> + DMA transfer takes place only if the transfer size is equal to or greater
> + than the number of bytes defined by the threshold value. Some controllers are
> + unable to perform the DMA transfer properly with small amounts of data.
Looks like controller specific, thus should be deducible from the
compatible.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-04-11 20:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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-11 19:43 ` [PATCH 2/2] mmc: dw_mmc: implement " Kaustabh Chakraborty
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox