Commit c722d40f authored by George Norton's avatar George Norton Committed by Anas Nashif
Browse files

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: default avatarGeorge Norton <george_norton_uk@hotmail.com>
parent 47108c3c
Loading
Loading
Loading
Loading
+2 −0
Changes for drivers/spi/spi_pl022.c: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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);