drivers: spi: Fix Ambiq apollo4p SPI mode configuration.
The commit fixes the SPI mode improper configuration. Otherwise the MODE_3 and MODE_0 cases would never be entered as expected. Signed-off-by: Aaron Ye <aye@ambiq.com>
This commit is contained in:
parent
06e8e9f5f5
commit
4e7d1b0f74
|
@ -76,12 +76,14 @@ static int spi_config(const struct device *dev, const struct spi_config *config)
|
|||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
if (config->operation & (SPI_MODE_CPOL | SPI_MODE_CPHA)) {
|
||||
if (config->operation & (SPI_MODE_CPOL && SPI_MODE_CPHA)) {
|
||||
if (config->operation & SPI_MODE_CPOL) {
|
||||
if (config->operation & SPI_MODE_CPHA) {
|
||||
data->iom_cfg.eSpiMode = AM_HAL_IOM_SPI_MODE_3;
|
||||
} else if (config->operation & SPI_MODE_CPOL) {
|
||||
} else {
|
||||
data->iom_cfg.eSpiMode = AM_HAL_IOM_SPI_MODE_2;
|
||||
} else if (config->operation & SPI_MODE_CPHA) {
|
||||
}
|
||||
} else {
|
||||
if (config->operation & SPI_MODE_CPHA) {
|
||||
data->iom_cfg.eSpiMode = AM_HAL_IOM_SPI_MODE_1;
|
||||
} else {
|
||||
data->iom_cfg.eSpiMode = AM_HAL_IOM_SPI_MODE_0;
|
||||
|
|
Loading…
Reference in a new issue