From c722d40fad23e9e7fb57d8f95aacf2911f1c4c13 Mon Sep 17 00:00:00 2001 From: George Norton Date: Tue, 10 Jun 2025 11:18:21 +0100 Subject: [PATCH] drivers: spi: spi_pl022: disable the SSP before reconfiguring When reconfiguring the SSP, some changes do not immediately take effect in particular changes to the clock polarity are not applied. Disabling and re-enabling the SSP forces the new configuration to take effect immediately. Signed-off-by: George Norton --- drivers/spi/spi_pl022.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/spi/spi_pl022.c b/drivers/spi/spi_pl022.c index 375b4df4681..9a2c493d99f 100644 --- a/drivers/spi/spi_pl022.c +++ b/drivers/spi/spi_pl022.c @@ -406,6 +406,8 @@ static int spi_pl022_configure(const struct device *dev, cr1 |= SSP_CR1_MASK_SSE; /* Always enable SPI */ cr1 |= (op & SPI_MODE_LOOP) ? SSP_CR1_MASK_LBM : 0; + /* Disable the SSP before it is reconfigured */ + SSP_WRITE_REG(SSP_CR1(cfg->reg), 0); SSP_WRITE_REG(SSP_CPSR(cfg->reg), prescale); SSP_WRITE_REG(SSP_CR0(cfg->reg), cr0); SSP_WRITE_REG(SSP_CR1(cfg->reg), cr1);