From 14a00f259f91a3e2b4dd9655823695e0c6f8eb52 Mon Sep 17 00:00:00 2001 From: Aksel Skauge Mellbye Date: Tue, 21 Jan 2025 14:52:51 +0100 Subject: [PATCH] drivers: spi: silabs: eusart: Always enable peripheral The EUSART peripheral must always be enabled in configure(), as its enable state gets cleared when the state machine is unretained in deep sleep. The rest of the config registers are retained, so they can continue to not be repainted on every configure() if the context is the same as last time. Remove unnecessary duplicated enable at the end of configure(), the SPIInit HAL function already performs enable. Signed-off-by: Aksel Skauge Mellbye --- drivers/spi/spi_silabs_eusart.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi_silabs_eusart.c b/drivers/spi/spi_silabs_eusart.c index 76fc027178c..947265d1018 100644 --- a/drivers/spi/spi_silabs_eusart.c +++ b/drivers/spi/spi_silabs_eusart.c @@ -62,7 +62,11 @@ static int spi_silabs_eusart_configure(const struct device *dev, const struct sp spi_frequency /= 2; if (spi_context_configured(&data->ctx, config)) { - /* Already configured. No need to do it again. */ + /* Already configured. No need to do it again, but must re-enable in case + * TXEN/RXEN were cleared due to deep sleep. + */ + EUSART_Enable(eusart_config->base, eusartEnable); + return 0; } @@ -145,9 +149,6 @@ static int spi_silabs_eusart_configure(const struct device *dev, const struct sp data->ctx.config = config; - /* Enable the peripheral */ - eusart_config->base->CMD = (uint32_t)eusartEnable; - return 0; }