Skip to contentSkip to conversation

Patch "spi: pxa2xx: Set controller->max_transfer_size in dma mode" has been added to the 5.4-stable tree

PATCH [email protected] 1 participant 1 message Jan 16, 2020

Subsystems (3)
lore
Share & tools
lore

[email protected]

author Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

    spi: pxa2xx: Set controller->max_transfer_size in dma mode

to the 5.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
spi-pxa2xx-set-controller-max_transfer_size-in-dma-mode.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

From b2662a164f9dc48da8822e56600686d639056282 Mon Sep 17 00:00:00 2001
From: Daniel Vetter <[email protected]>
Date: Thu, 17 Oct 2019 08:44:26 +0200
Subject: spi: pxa2xx: Set controller->max_transfer_size in dma mode
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

From: Daniel Vetter <[email protected]>

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 <[email protected]>
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 <[email protected]>
Cc Noralf Trønnes <[email protected]>
Cc Andy Shevchenko <[email protected]>
Cc Daniel Mack <[email protected]>
Cc Haojian Zhuang <[email protected]>
Cc Robert Jarzmik <[email protected]>
Cc Mark Brown <[email protected]>
---
 drivers/spi/spi-pxa2xx.c |    7 +++++++
 1 file changed, 7 insertions(+)
drivers/spi/spi-pxa2xx.c +7 -0
@@ -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;
 		}
 	}
 

Patches currently in stable-queue which might be from [email protected] are

queue-5.4/revert-drm-virtio-switch-virtio_gpu_wait_ioctl-to-gem-helper.patch queue-5.4/spi-pxa2xx-set-controller-max_transfer_size-in-dma-mode.patch

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel