Patch "spi: microchip-core: ensure TX and RX FIFOs are empty at start of a transfer" has been added to the 6.10-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: microchip-core: ensure TX and RX FIFOs are empty at start of a transfer

to the 6.10-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-microchip-core-ensure-tx-and-rx-fifos-are-empty-.patch
and it can be found in the queue-6.10 subdirectory.

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



commit e70e68cf88a875ac18d974f4b1d358c36cd44189
Author: Steve Wilkins <steve.wilkins@xxxxxxxxxxxxx>
Date:   Mon Jul 15 12:13:56 2024 +0100

    spi: microchip-core: ensure TX and RX FIFOs are empty at start of a transfer
    
    [ Upstream commit 9cf71eb0faef4bff01df4264841b8465382d7927 ]
    
    While transmitting with rx_len == 0, the RX FIFO is not going to be
    emptied in the interrupt handler. A subsequent transfer could then
    read crap from the previous transfer out of the RX FIFO into the
    start RX buffer. The core provides a register that will empty the RX and
    TX FIFOs, so do that before each transfer.
    
    Fixes: 9ac8d17694b6 ("spi: add support for microchip fpga spi controllers")
    Signed-off-by: Steve Wilkins <steve.wilkins@xxxxxxxxxxxxx>
    Signed-off-by: Conor Dooley <conor.dooley@xxxxxxxxxxxxx>
    Link: https://patch.msgid.link/20240715-flammable-provoke-459226d08e70@wendy
    Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/spi/spi-microchip-core.c b/drivers/spi/spi-microchip-core.c
index 78a073664f60b..99c25e6a937fd 100644
--- a/drivers/spi/spi-microchip-core.c
+++ b/drivers/spi/spi-microchip-core.c
@@ -91,6 +91,8 @@
 #define REG_CONTROL2		(0x28)
 #define REG_COMMAND		(0x2c)
 #define  COMMAND_CLRFRAMECNT	BIT(4)
+#define  COMMAND_TXFIFORST		BIT(3)
+#define  COMMAND_RXFIFORST		BIT(2)
 #define REG_PKTSIZE		(0x30)
 #define REG_CMD_SIZE		(0x34)
 #define REG_HWSTATUS		(0x38)
@@ -493,6 +495,8 @@ static int mchp_corespi_transfer_one(struct spi_controller *host,
 	mchp_corespi_set_xfer_size(spi, (spi->tx_len > FIFO_DEPTH)
 				   ? FIFO_DEPTH : spi->tx_len);
 
+	mchp_corespi_write(spi, REG_COMMAND, COMMAND_RXFIFORST | COMMAND_TXFIFORST);
+
 	mchp_corespi_write(spi, REG_SLAVE_SELECT, spi->pending_slave_select);
 
 	while (spi->tx_len)




[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