Skip to content

Commit 7aba292

Browse files
Larisa Grigorebroonie
authored andcommitted
spi: spi-fsl-dspi: Reset SR flags before sending a new message
If, in a previous transfer, the controller sends more data than expected by the DSPI target, SR.RFDF (RX FIFO is not empty) will remain asserted. When flushing the FIFOs at the beginning of a new transfer (writing 1 into MCR.CLR_TXF and MCR.CLR_RXF), SR.RFDF should also be cleared. Otherwise, when running in target mode with DMA, if SR.RFDF remains asserted, the DMA callback will be fired before the controller sends any data. Take this opportunity to reset all Status Register fields. Fixes: 5ce3cc5 ("spi: spi-fsl-dspi: Provide support for DSPI slave mode operation (Vybryd vf610)") Signed-off-by: Larisa Grigore <[email protected]> Signed-off-by: James Clark <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 8a30a6d commit 7aba292

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/spi/spi-fsl-dspi.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -975,6 +975,8 @@ static int dspi_transfer_one_message(struct spi_controller *ctlr,
975975
SPI_MCR_CLR_TXF | SPI_MCR_CLR_RXF,
976976
SPI_MCR_CLR_TXF | SPI_MCR_CLR_RXF);
977977

978+
regmap_write(dspi->regmap, SPI_SR, SPI_SR_CLEAR);
979+
978980
spi_take_timestamp_pre(dspi->ctlr, dspi->cur_transfer,
979981
dspi->progress, !dspi->irq);
980982

0 commit comments

Comments
 (0)