drivers: spi: sam0: Reset SPI peripheral on init

Reset the SPI peripheral to its default state
and register values on init by setting its SWRST bit.
This is important since the driver assumes that certain
registers are at their default values.

Signed-off-by: Pete Dietl <petedietl@gmail.com>
This commit is contained in:
Pete Dietl 2025-06-01 13:42:14 -07:00 committed by Benjamin Cabé
commit c9e48c8c01

View file

@ -679,6 +679,10 @@ static int spi_sam0_init(const struct device *dev)
| GCLK_CLKCTRL_ID(cfg->gclk_id);
#endif
/* Ensure all registers are at their default values */
regs->CTRLA.bit.SWRST = 1;
wait_synchronization(regs);
/* Disable all SPI interrupts */
regs->INTENCLR.reg = SERCOM_SPI_INTENCLR_MASK;
wait_synchronization(regs);