drivers: spi: stm32: fix SPI being left on in slave mode

The current implementation unconditionally enables the SPI (sets
SPI_CR1_SPE) in transceive(), but disables it only in master mode.

The peripheral should only be enabled while the user has specifically
requested I/O. Fix this by always disabling the peripheral when I/O is
complete.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
This commit is contained in:
Marti Bolivar 2017-07-17 14:56:54 -04:00 committed by Anas Nashif
commit 78214d0569

View file

@ -62,9 +62,10 @@ static void spi_stm32_complete(struct spi_stm32_data *data, SPI_TypeDef *spi,
while (LL_SPI_IsActiveFlag_BSY(spi)) { while (LL_SPI_IsActiveFlag_BSY(spi)) {
/* NOP */ /* NOP */
} }
LL_SPI_Disable(spi);
} }
LL_SPI_Disable(spi);
#ifdef CONFIG_SPI_STM32_INTERRUPT #ifdef CONFIG_SPI_STM32_INTERRUPT
spi_context_complete(&data->ctx, status); spi_context_complete(&data->ctx, status);
#endif #endif