Skip to content

Commit e4a5c19

Browse files
Alain Volmatbroonie
authored andcommitted
spi: stm32h7: fix full duplex irq handler handling
In case of Full-Duplex mode, DXP flag is set when RXP and TXP flags are set. But to avoid 2 different handlings, just add TXP and RXP flag in the mask instead of DXP, and then keep the initial handling of TXP and RXP events. Also rephrase comment about EOTIE which is one of the interrupt enable bits. It is not triggered by any event. Signed-off-by: Amelie Delaunay <[email protected]> Signed-off-by: Alain Volmat <[email protected]> Reviewed-by: Amelie Delaunay <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent b470e10 commit e4a5c19

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

drivers/spi/spi-stm32.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -884,15 +884,18 @@ static irqreturn_t stm32h7_spi_irq_thread(int irq, void *dev_id)
884884
ier = readl_relaxed(spi->base + STM32H7_SPI_IER);
885885

886886
mask = ier;
887-
/* EOTIE is triggered on EOT, SUSP and TXC events. */
887+
/*
888+
* EOTIE enables irq from EOT, SUSP and TXC events. We need to set
889+
* SUSP to acknowledge it later. TXC is automatically cleared
890+
*/
891+
888892
mask |= STM32H7_SPI_SR_SUSP;
889893
/*
890-
* When TXTF is set, DXPIE and TXPIE are cleared. So in case of
891-
* Full-Duplex, need to poll RXP event to know if there are remaining
892-
* data, before disabling SPI.
894+
* DXPIE is set in Full-Duplex, one IT will be raised if TXP and RXP
895+
* are set. So in case of Full-Duplex, need to poll TXP and RXP event.
893896
*/
894-
if (spi->rx_buf && !spi->cur_usedma)
895-
mask |= STM32H7_SPI_SR_RXP;
897+
if ((spi->cur_comm == SPI_FULL_DUPLEX) && !spi->cur_usedma)
898+
mask |= STM32H7_SPI_SR_TXP | STM32H7_SPI_SR_RXP;
896899

897900
if (!(sr & mask)) {
898901
dev_warn(spi->dev, "spurious IT (sr=0x%08x, ier=0x%08x)\n",

0 commit comments

Comments
 (0)