From 2141bb4561bdbabe4e526b751179d55f431d1123 Mon Sep 17 00:00:00 2001 From: Benedikt Schmidt Date: Wed, 17 Jan 2024 17:44:38 +0100 Subject: [PATCH] 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 --- drivers/spi/Kconfig.stm32 | 13 ++++++------- drivers/spi/spi_ll_stm32.c | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/spi/Kconfig.stm32 b/drivers/spi/Kconfig.stm32 index 6a53f30cbc..04bc6dabcd 100644 --- a/drivers/spi/Kconfig.stm32 +++ b/drivers/spi/Kconfig.stm32 @@ -32,22 +32,21 @@ config SPI_STM32_USE_HW_SS help Use Slave Select pin instead of software Slave Select. -config SPI_STM32F7_ERRATA_BUSY +config SPI_STM32_ERRATA_BUSY bool default y - depends on SOC_STM32F745XX || SOC_STM32F746XX || \ - SOC_STM32F750XX || SOC_STM32F756XX + depends on SOC_SERIES_STM32F7X || SOC_SERIES_STM32L4X help Handles erratum "BSY bit may stay high at the end of a data - transfer in Slave mode". - Seen in Errata Sheet 0290 §2.11.2 + transfer in slave mode". + 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 int "timeout in us for the STM32 busy flag workaround" default 10000 -endif # SPI_STM32F7_ERRATA_BUSY +endif # SPI_STM32_ERRATA_BUSY endif # SPI_STM32 diff --git a/drivers/spi/spi_ll_stm32.c b/drivers/spi/spi_ll_stm32.c index b37e6b903e..c222a62443 100644 --- a/drivers/spi/spi_ll_stm32.c +++ b/drivers/spi/spi_ll_stm32.c @@ -922,7 +922,7 @@ static int transceive_dma(const struct device *dev, } #endif -#ifdef CONFIG_SPI_STM32F7_ERRATA_BUSY +#ifdef CONFIG_SPI_STM32_ERRATA_BUSY WAIT_FOR(ll_func_spi_dma_busy(spi) != 0, CONFIG_SPI_STM32_BUSY_FLAG_TIMEOUT, k_yield());