drivers: spi: fix unreliable SPI busy flag for some STM32 devices

Extend the workaround for the unreliable SPI busy flag
to all F7 and L4 devices, which are affected by the same
erratum.

Fixes  #67739

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
This commit is contained in:
Benedikt Schmidt 2024-01-17 17:44:38 +01:00 committed by Anas Nashif
parent 8ae315764c
commit 2141bb4561
2 changed files with 7 additions and 8 deletions

View file

@ -32,22 +32,21 @@ config SPI_STM32_USE_HW_SS
help help
Use Slave Select pin instead of software Slave Select. Use Slave Select pin instead of software Slave Select.
config SPI_STM32F7_ERRATA_BUSY config SPI_STM32_ERRATA_BUSY
bool bool
default y default y
depends on SOC_STM32F745XX || SOC_STM32F746XX || \ depends on SOC_SERIES_STM32F7X || SOC_SERIES_STM32L4X
SOC_STM32F750XX || SOC_STM32F756XX
help help
Handles erratum "BSY bit may stay high at the end of a data Handles erratum "BSY bit may stay high at the end of a data
transfer in Slave mode". transfer in slave mode".
Seen in Errata Sheet 0290 §2.11.2 Seen for instance in Errata Sheet 0290 §2.11.2
if SPI_STM32F7_ERRATA_BUSY if SPI_STM32_ERRATA_BUSY
config SPI_STM32_BUSY_FLAG_TIMEOUT config SPI_STM32_BUSY_FLAG_TIMEOUT
int "timeout in us for the STM32 busy flag workaround" int "timeout in us for the STM32 busy flag workaround"
default 10000 default 10000
endif # SPI_STM32F7_ERRATA_BUSY endif # SPI_STM32_ERRATA_BUSY
endif # SPI_STM32 endif # SPI_STM32

View file

@ -922,7 +922,7 @@ static int transceive_dma(const struct device *dev,
} }
#endif #endif
#ifdef CONFIG_SPI_STM32F7_ERRATA_BUSY #ifdef CONFIG_SPI_STM32_ERRATA_BUSY
WAIT_FOR(ll_func_spi_dma_busy(spi) != 0, WAIT_FOR(ll_func_spi_dma_busy(spi) != 0,
CONFIG_SPI_STM32_BUSY_FLAG_TIMEOUT, CONFIG_SPI_STM32_BUSY_FLAG_TIMEOUT,
k_yield()); k_yield());