archive mirror
 help / color / mirror / Atom feed
* [PATCH 5.4 168/203] spi: pxa2xx: Set controller->max_transfer_size in dma mode
       [not found] ` <>
@ 2020-01-16 23:18   ` Greg Kroah-Hartman
  0 siblings, 0 replies; only message in thread
From: Greg Kroah-Hartman @ 2020-01-16 23:18 UTC (permalink / raw)
  To: linux-kernel-u79uwXL29TY76Z2rM5mHXA
  Cc: Greg Kroah-Hartman, stable-u79uwXL29TY76Z2rM5mHXA, Sam Ravnborg,
	Noralf Trønnes, Andy Shevchenko, Daniel Mack,
	Haojian Zhuang, Robert Jarzmik, Mark Brown,
	linux-spi-u79uwXL29TY76Z2rM5mHXA, Daniel Vetter

From: Daniel Vetter <daniel.vetter-/>

commit b2662a164f9dc48da8822e56600686d639056282 upstream.

In DMA mode we have a maximum transfer size, past that the driver
falls back to PIO (see the check at the top of pxa2xx_spi_transfer_one).
Falling back to PIO for big transfers defeats the point of a dma engine,
hence set the max transfer size to inform spi clients that they need
to do something smarter.

This was uncovered by the drm_mipi_dbi spi panel code, which does
large spi transfers, but stopped splitting them after:

commit e143364b4c1774f68e923a5a0bb0fca28ac25888
Author: Noralf Trønnes <>
Date:   Fri Jul 19 17:59:10 2019 +0200

    drm/tinydrm: Remove tinydrm_spi_max_transfer_size()

After this commit the code relied on the spi core to split transfers
into max dma-able blocks, which also papered over the PIO fallback issue.

Fix this by setting the overall max transfer size to the DMA limit,
but only when the controller runs in DMA mode.

Fixes: e143364b4c17 ("drm/tinydrm: Remove tinydrm_spi_max_transfer_size()")
Cc: Sam Ravnborg <>
Cc: Noralf Trønnes <>
Cc: Andy Shevchenko <>
Reported-and-tested-by: Andy Shevchenko <>
Cc: Daniel Mack <>
Cc: Haojian Zhuang <>
Cc: Robert Jarzmik <>
Cc: Mark Brown <>
Signed-off-by: Daniel Vetter <daniel.vetter-/>
Signed-off-by: Mark Brown <>
Signed-off-by: Greg Kroah-Hartman <>

 drivers/spi/spi-pxa2xx.c |    7 +++++++
 1 file changed, 7 insertions(+)

--- a/drivers/spi/spi-pxa2xx.c
+++ b/drivers/spi/spi-pxa2xx.c
@@ -1612,6 +1612,11 @@ static int pxa2xx_spi_fw_translate_cs(st
 	return cs;
+static size_t pxa2xx_spi_max_dma_transfer_size(struct spi_device *spi)
+	return MAX_DMA_LEN;
 static int pxa2xx_spi_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
@@ -1717,6 +1722,8 @@ static int pxa2xx_spi_probe(struct platf
 		} else {
 			controller->can_dma = pxa2xx_spi_can_dma;
 			controller->max_dma_len = MAX_DMA_LEN;
+			controller->max_transfer_size =
+				pxa2xx_spi_max_dma_transfer_size;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-01-16 23:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <>
     [not found] ` <>
2020-01-16 23:18   ` [PATCH 5.4 168/203] spi: pxa2xx: Set controller->max_transfer_size in dma mode Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).