Skip to content

Commit bce51b7

Browse files
dgastonochoafabiobaltieri
authored andcommitted
drivers: spi: stm32h7: avoid unnecessary suspend
The SPI stm32 H7 driver always suspends the SPI transaction when finishing the transceive operation. This, according to the stm32 H7 datasheet, must only be done when the SPI master is configured as receive-only, and the driver always configures it as full-duplex. Hence, remove this unnecessary operation for clarify and for a potential reduction in the minimum time between SPI transceive operations. Signed-off-by: Daniel Gaston Ochoa <[email protected]>
1 parent aeec014 commit bce51b7

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

drivers/spi/spi_ll_stm32.h

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -219,26 +219,16 @@ static inline void ll_func_set_fifo_threshold_16bit(SPI_TypeDef *spi)
219219
static inline void ll_func_disable_spi(SPI_TypeDef *spi)
220220
{
221221
#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_spi)
222-
if (LL_SPI_IsActiveMasterTransfer(spi)) {
223-
LL_SPI_SuspendMasterTransfer(spi);
224-
while (LL_SPI_IsActiveMasterTransfer(spi)) {
225-
/* NOP */
226-
}
227-
}
228-
229-
LL_SPI_Disable(spi);
230-
while (LL_SPI_IsEnabled(spi)) {
231-
/* NOP */
232-
}
233-
234222
/* Flush RX buffer */
235223
while (LL_SPI_IsActiveFlag_RXP(spi)) {
236224
(void)LL_SPI_ReceiveData8(spi);
237225
}
238-
LL_SPI_ClearFlag_SUSP(spi);
239-
#else
240-
LL_SPI_Disable(spi);
241226
#endif /* st_stm32h7_spi */
227+
LL_SPI_Disable(spi);
228+
229+
while (LL_SPI_IsEnabled(spi)) {
230+
/* NOP */
231+
}
242232
}
243233

244234
#endif /* ZEPHYR_DRIVERS_SPI_SPI_LL_STM32_H_ */

0 commit comments

Comments
 (0)