lede/target/linux/bcm27xx/patches-6.12/950-0362-spi-dw-Handle-combined-tx-and-rx-messages.patch
=?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= d81c03f05e bcm27xx: add 6.12 patches from RPi repo
These patches were generated from:
https://github.com/raspberrypi/linux/commits/rpi-6.12.y
With the following command:
git format-patch -N v6.12.27..HEAD
(HEAD -> 8d3206ee456a5ecdf9ddbfd8e5e231e4f0cd716e)

Exceptions:
- (def)configs patches
- github workflows patches
- applied & reverted patches
- readme patches
- wireless patches

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2025-06-20 17:01:06 +08:00

65 lines
1.8 KiB
Diff

From f455de9888ee0745802a3bda4c13b818fbf56df3 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Tue, 29 Nov 2022 10:09:54 +0000
Subject: [PATCH] spi: dw: Handle combined tx and rx messages
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
drivers/spi/spi-dw-core.c | 12 +++++++++---
drivers/spi/spi-dw-mmio.c | 8 ++++++--
2 files changed, 15 insertions(+), 5 deletions(-)
--- a/drivers/spi/spi-dw-core.c
+++ b/drivers/spi/spi-dw-core.c
@@ -241,8 +241,11 @@ static irqreturn_t dw_spi_transfer_handl
*/
if (irq_status & DW_SPI_INT_TXEI) {
dw_writer(dws);
- if (!dws->tx_len)
+ if (!dws->tx_len) {
dw_spi_mask_intr(dws, DW_SPI_INT_TXEI);
+ if (!dws->rx_len)
+ spi_finalize_current_transfer(dws->host);
+ }
}
return IRQ_HANDLED;
@@ -369,8 +372,11 @@ static void dw_spi_irq_setup(struct dw_s
dws->transfer_handler = dw_spi_transfer_handler;
- imask = DW_SPI_INT_TXEI | DW_SPI_INT_TXOI |
- DW_SPI_INT_RXUI | DW_SPI_INT_RXOI | DW_SPI_INT_RXFI;
+ imask = 0;
+ if (dws->tx_len)
+ imask |= DW_SPI_INT_TXEI | DW_SPI_INT_TXOI;
+ if (dws->rx_len)
+ imask |= DW_SPI_INT_RXUI | DW_SPI_INT_RXOI | DW_SPI_INT_RXFI;
dw_spi_umask_intr(dws, imask);
}
--- a/drivers/spi/spi-dw-mmio.c
+++ b/drivers/spi/spi-dw-mmio.c
@@ -20,6 +20,7 @@
#include <linux/property.h>
#include <linux/regmap.h>
#include <linux/reset.h>
+#include <linux/interrupt.h>
#include "spi-dw.h"
@@ -341,8 +342,11 @@ static int dw_spi_mmio_probe(struct plat
dws->paddr = mem->start;
dws->irq = platform_get_irq(pdev, 0);
- if (dws->irq < 0)
- return dws->irq; /* -ENXIO */
+ if (dws->irq < 0) {
+ if (dws->irq != -ENXIO)
+ return dws->irq; /* -ENXIO */
+ dws->irq = IRQ_NOTCONNECTED;
+ }
dwsmmio->clk = devm_clk_get_enabled(&pdev->dev, NULL);
if (IS_ERR(dwsmmio->clk))