Patch "spi: spi-cadence: Reverse the order of interleaved write and read operations" has been added to the 6.7-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

    spi: spi-cadence: Reverse the order of interleaved write and read operations

to the 6.7-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-spi-cadence-reverse-the-order-of-interleaved-wri.patch
and it can be found in the queue-6.7 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit c0fc58fd437b9b4b7572c19e39fc9534793b9171
Author: Amit Kumar Mahapatra <amit.kumar-mahapatra@xxxxxxx>
Date:   Mon Dec 18 14:36:52 2023 +0530

    spi: spi-cadence: Reverse the order of interleaved write and read operations
    
    [ Upstream commit 633cd6fe6e1993ba80e0954c2db127a0b1a3e66f ]
    
    In the existing implementation, when executing interleaved write and read
    operations in the ISR for a transfer length greater than the FIFO size,
    the TXFIFO write precedes the RXFIFO read. Consequently, the initially
    received data in the RXFIFO is pushed out and lost, leading to a failure
    in data integrity. To address this issue, reverse the order of interleaved
    operations and conduct the RXFIFO read followed by the TXFIFO write.
    
    Fixes: 6afe2ae8dc48 ("spi: spi-cadence: Interleave write of TX and read of RX FIFO")
    Signed-off-by: Amit Kumar Mahapatra <amit.kumar-mahapatra@xxxxxxx>
    Link: https://msgid.link/r/20231218090652.18403-1-amit.kumar-mahapatra@xxxxxxx
    Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/spi/spi-cadence.c b/drivers/spi/spi-cadence.c
index a50eb4db79de..e5140532071d 100644
--- a/drivers/spi/spi-cadence.c
+++ b/drivers/spi/spi-cadence.c
@@ -317,6 +317,15 @@ static void cdns_spi_process_fifo(struct cdns_spi *xspi, int ntx, int nrx)
 	xspi->rx_bytes -= nrx;
 
 	while (ntx || nrx) {
+		if (nrx) {
+			u8 data = cdns_spi_read(xspi, CDNS_SPI_RXD);
+
+			if (xspi->rxbuf)
+				*xspi->rxbuf++ = data;
+
+			nrx--;
+		}
+
 		if (ntx) {
 			if (xspi->txbuf)
 				cdns_spi_write(xspi, CDNS_SPI_TXD, *xspi->txbuf++);
@@ -326,14 +335,6 @@ static void cdns_spi_process_fifo(struct cdns_spi *xspi, int ntx, int nrx)
 			ntx--;
 		}
 
-		if (nrx) {
-			u8 data = cdns_spi_read(xspi, CDNS_SPI_RXD);
-
-			if (xspi->rxbuf)
-				*xspi->rxbuf++ = data;
-
-			nrx--;
-		}
 	}
 }
 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux