mirror of
https://github.com/apache/nuttx.git
synced 2026-08-31 14:13:04 +00:00
Merged in extent3d/nuttx (pull request #575)
SAMDL: SPI must be disabled before changing the mode bits in CTRLA register * SAMD External Interrupt Controller (EIC) support * removed comment * SAMDL: SPI must be disabled before changing the mode bits in CTRLA register Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
parent
0184f8818a
commit
1ec8a6f34c
1 changed files with 6 additions and 1 deletions
|
|
@ -944,7 +944,12 @@ static void spi_setmode(struct spi_dev_s *dev, enum spi_mode_e mode)
|
|||
{
|
||||
/* Yes... Set the mode appropriately */
|
||||
|
||||
/* First we need to disable SPI while we change the mode */
|
||||
|
||||
regval = spi_getreg32(priv, SAM_SPI_CTRLA_OFFSET);
|
||||
spi_putreg32(priv, regval & ~SPI_CTRLA_ENABLE, SAM_SPI_CTRLA_OFFSET);
|
||||
spi_wait_synchronization(priv);
|
||||
|
||||
regval &= ~(SPI_CTRLA_CPOL | SPI_CTRLA_CPHA);
|
||||
|
||||
switch (mode)
|
||||
|
|
@ -969,7 +974,7 @@ static void spi_setmode(struct spi_dev_s *dev, enum spi_mode_e mode)
|
|||
return;
|
||||
}
|
||||
|
||||
spi_putreg32(priv, regval, SAM_SPI_CTRLA_OFFSET);
|
||||
spi_putreg32(priv, regval | SPI_CTRLA_ENABLE, SAM_SPI_CTRLA_OFFSET);
|
||||
|
||||
/* Save the mode so that subsequent re-configurations will be faster */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue