From: Greg Kroah-Hartman Date: Thu, 8 Aug 2019 10:01:18 +0000 (+0200) Subject: 4.19-stable patches X-Git-Tag: v5.2.8~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4422279540deca4f77687cf41cea4fc6d1a26b8b;p=thirdparty%2Fkernel%2Fstable-queue.git 4.19-stable patches added patches: spi-bcm2835-fix-3-wire-mode-if-dma-is-enabled.patch --- diff --git a/queue-4.19/series b/queue-4.19/series index 0490800a6cf..dc17fd070d4 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -42,3 +42,4 @@ cgroup-implement-css_task_iter_skip.patch cgroup-include-dying-leaders-with-live-threads-in-procs-iterations.patch cgroup-css_task_iter_skip-d-iterators-must-be-advanced-before-accessed.patch cgroup-fix-css_task_iter_advance_css_set-cset-skip-condition.patch +spi-bcm2835-fix-3-wire-mode-if-dma-is-enabled.patch diff --git a/queue-4.19/spi-bcm2835-fix-3-wire-mode-if-dma-is-enabled.patch b/queue-4.19/spi-bcm2835-fix-3-wire-mode-if-dma-is-enabled.patch new file mode 100644 index 00000000000..23d517c12fb --- /dev/null +++ b/queue-4.19/spi-bcm2835-fix-3-wire-mode-if-dma-is-enabled.patch @@ -0,0 +1,54 @@ +From 8d8bef50365847134b51c1ec46786bc2873e4e47 Mon Sep 17 00:00:00 2001 +From: Lukas Wunner +Date: Wed, 3 Jul 2019 12:29:31 +0200 +Subject: spi: bcm2835: Fix 3-wire mode if DMA is enabled +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Lukas Wunner + +commit 8d8bef50365847134b51c1ec46786bc2873e4e47 upstream. + +Commit 6935224da248 ("spi: bcm2835: enable support of 3-wire mode") +added 3-wire support to the BCM2835 SPI driver by setting the REN bit +(Read Enable) in the CS register when receiving data. The REN bit puts +the transmitter in high-impedance state. The driver recognizes that +data is to be received by checking whether the rx_buf of a transfer is +non-NULL. + +Commit 3ecd37edaa2a ("spi: bcm2835: enable dma modes for transfers +meeting certain conditions") subsequently broke 3-wire support because +it set the SPI_MASTER_MUST_RX flag which causes spi_map_msg() to replace +rx_buf with a dummy buffer if it is NULL. As a result, rx_buf is +*always* non-NULL if DMA is enabled. + +Reinstate 3-wire support by not only checking whether rx_buf is non-NULL, +but also checking that it is not the dummy buffer. + +Fixes: 3ecd37edaa2a ("spi: bcm2835: enable dma modes for transfers meeting certain conditions") +Reported-by: Nuno Sá +Signed-off-by: Lukas Wunner +Cc: stable@vger.kernel.org # v4.2+ +Cc: Martin Sperl +Acked-by: Stefan Wahren +Link: https://lore.kernel.org/r/328318841455e505370ef8ecad97b646c033dc8a.1562148527.git.lukas@wunner.de +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/spi/spi-bcm2835.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/spi/spi-bcm2835.c ++++ b/drivers/spi/spi-bcm2835.c +@@ -554,7 +554,8 @@ static int bcm2835_spi_transfer_one(stru + bcm2835_wr(bs, BCM2835_SPI_CLK, cdiv); + + /* handle all the 3-wire mode */ +- if ((spi->mode & SPI_3WIRE) && (tfr->rx_buf)) ++ if (spi->mode & SPI_3WIRE && tfr->rx_buf && ++ tfr->rx_buf != master->dummy_rx) + cs |= BCM2835_SPI_CS_REN; + else + cs &= ~BCM2835_SPI_CS_REN;