From d434693c156a94ab45b1d6683804d1a37051a58d Mon Sep 17 00:00:00 2001 From: Daniel Gaston Ochoa Date: Thu, 17 Aug 2023 17:12:21 +0100 Subject: [PATCH] stm32h7: spi: Use TXC instead of EOT Check the TXC flag instead of EOT for the case of endless transactions (TSIZE = 0), which in this case is always as the stm32 SPI driver doesn't set TSIZE. Signed-off-by: Daniel Gaston Ochoa --- drivers/spi/spi_ll_stm32.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi_ll_stm32.h b/drivers/spi/spi_ll_stm32.h index 4785d3e989..949b8882dd 100644 --- a/drivers/spi/spi_ll_stm32.h +++ b/drivers/spi/spi_ll_stm32.h @@ -177,7 +177,11 @@ static inline void ll_func_disable_int_errors(SPI_TypeDef *spi) static inline uint32_t ll_func_spi_is_busy(SPI_TypeDef *spi) { #if DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_spi) - return LL_SPI_IsActiveFlag_EOT(spi); + if (LL_SPI_GetTransferSize(spi) == 0) { + return LL_SPI_IsActiveFlag_TXC(spi) == 0; + } else { + return LL_SPI_IsActiveFlag_EOT(spi) == 0; + } #else return LL_SPI_IsActiveFlag_BSY(spi); #endif /* st_stm32h7_spi */