Browse Source

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>
pull/91396/head
Pete Dietl 1 month ago committed by Benjamin Cabé
parent
commit
c9e48c8c01
  1. 4
      drivers/spi/spi_sam0.c

4
drivers/spi/spi_sam0.c

@ -679,6 +679,10 @@ static int spi_sam0_init(const struct device *dev) @@ -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);

Loading…
Cancel
Save