bcm27xx: update 6.1 patches to latest version
[openwrt/staging/dangole.git] / target / linux / bcm27xx / patches-6.1 / 950-0883-spi-dw-Handle-combined-tx-and-rx-messages.patch
1 From 8a9c0607ce0daa91c48faefd70ea73bda54ed0ae Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.com>
3 Date: Tue, 29 Nov 2022 10:09:54 +0000
4 Subject: [PATCH] spi: dw: Handle combined tx and rx messages
5
6 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
7 ---
8 drivers/spi/spi-dw-core.c | 12 +++++++++---
9 drivers/spi/spi-dw-mmio.c | 8 ++++++--
10 2 files changed, 15 insertions(+), 5 deletions(-)
11
12 --- a/drivers/spi/spi-dw-core.c
13 +++ b/drivers/spi/spi-dw-core.c
14 @@ -244,8 +244,11 @@ static irqreturn_t dw_spi_transfer_handl
15 */
16 if (irq_status & DW_SPI_INT_TXEI) {
17 dw_writer(dws);
18 - if (!dws->tx_len)
19 + if (!dws->tx_len) {
20 dw_spi_mask_intr(dws, DW_SPI_INT_TXEI);
21 + if (!dws->rx_len)
22 + spi_finalize_current_transfer(dws->master);
23 + }
24 }
25
26 return IRQ_HANDLED;
27 @@ -372,8 +375,11 @@ static void dw_spi_irq_setup(struct dw_s
28
29 dws->transfer_handler = dw_spi_transfer_handler;
30
31 - imask = DW_SPI_INT_TXEI | DW_SPI_INT_TXOI |
32 - DW_SPI_INT_RXUI | DW_SPI_INT_RXOI | DW_SPI_INT_RXFI;
33 + imask = 0;
34 + if (dws->tx_len)
35 + imask |= DW_SPI_INT_TXEI | DW_SPI_INT_TXOI;
36 + if (dws->rx_len)
37 + imask |= DW_SPI_INT_RXUI | DW_SPI_INT_RXOI | DW_SPI_INT_RXFI;
38 dw_spi_umask_intr(dws, imask);
39 }
40
41 --- a/drivers/spi/spi-dw-mmio.c
42 +++ b/drivers/spi/spi-dw-mmio.c
43 @@ -20,6 +20,7 @@
44 #include <linux/property.h>
45 #include <linux/regmap.h>
46 #include <linux/reset.h>
47 +#include <linux/interrupt.h>
48
49 #include "spi-dw.h"
50
51 @@ -280,8 +281,11 @@ static int dw_spi_mmio_probe(struct plat
52 dws->paddr = mem->start;
53
54 dws->irq = platform_get_irq(pdev, 0);
55 - if (dws->irq < 0)
56 - return dws->irq; /* -ENXIO */
57 + if (dws->irq < 0) {
58 + if (dws->irq != -ENXIO)
59 + return dws->irq; /* -ENXIO */
60 + dws->irq = IRQ_NOTCONNECTED;
61 + }
62
63 dwsmmio->clk = devm_clk_get(&pdev->dev, NULL);
64 if (IS_ERR(dwsmmio->clk))