drivers: spi: stm32h7: Avoid unnecessary FIFO flush

The RxFIFO is already flushed any time a transceive operation
finishes, there is no need for doing it also before the
transaction start.

The aim of this change is to simplify the logic and to
(potentially) reduce the minimum time between transactions.

Signed-off-by: Daniel Gaston Ochoa <dgastonochoa@gmail.com>
This commit is contained in:
Daniel Gaston Ochoa 2024-09-28 12:12:10 +01:00 committed by Henrik Brix Andersen
parent b302212c5a
commit f05fb41587
2 changed files with 5 additions and 11 deletions

View File

@ -823,13 +823,6 @@ static int transceive(const struct device *dev,
#endif /* DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_spi) */
#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32_spi_fifo)
/* Flush RX buffer */
while (ll_func_rx_is_not_empty(spi)) {
(void) LL_SPI_ReceiveData8(spi);
}
#endif /* DT_HAS_COMPAT_STATUS_OKAY(st_stm32_spi_fifo) */
LL_SPI_Enable(spi);
#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_spi)

View File

@ -218,12 +218,13 @@ static inline void ll_func_set_fifo_threshold_16bit(SPI_TypeDef *spi)
static inline void ll_func_disable_spi(SPI_TypeDef *spi)
{
#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_spi)
#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32_spi_fifo)
/* Flush RX buffer */
while (LL_SPI_IsActiveFlag_RXP(spi)) {
(void)LL_SPI_ReceiveData8(spi);
while (ll_func_rx_is_not_empty(spi)) {
(void) LL_SPI_ReceiveData8(spi);
}
#endif /* st_stm32h7_spi */
#endif /* DT_HAS_COMPAT_STATUS_OKAY(st_stm32_spi_fifo) */
LL_SPI_Disable(spi);
while (LL_SPI_IsEnabled(spi)) {