Skip to content

Commit ad8fd5d

Browse files
pdgendtnashif
authored andcommitted
drivers: spi: spi_mcux_ecspi: Ignore chip select channel with cs-gpios
The internal chip selects are limited to 4, however when using GPIOS does not pose this limitation. Also set internal channel to 0 if GPIOS are used. Signed-off-by: Pieter De Gendt <[email protected]> (cherry picked from commit 7250e98)
1 parent 0010b77 commit ad8fd5d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/spi/spi_mcux_ecspi.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ static int spi_mcux_configure(const struct device *dev,
162162
return -ENOTSUP;
163163
}
164164

165-
if (spi_cfg->slave > kECSPI_Channel3) {
165+
if (!spi_cs_is_gpio(spi_cfg) && spi_cfg->slave > kECSPI_Channel3) {
166166
LOG_ERR("Slave %d is greater than %d", spi_cfg->slave, kECSPI_Channel3);
167167
return -EINVAL;
168168
}
@@ -180,7 +180,8 @@ static int spi_mcux_configure(const struct device *dev,
180180

181181
ECSPI_MasterGetDefaultConfig(&master_config);
182182

183-
master_config.channel = (ecspi_channel_source_t)spi_cfg->slave;
183+
master_config.channel =
184+
spi_cs_is_gpio(spi_cfg) ? kECSPI_Channel0 : (ecspi_channel_source_t)spi_cfg->slave;
184185
master_config.channelConfig.polarity =
185186
(SPI_MODE_GET(spi_cfg->operation) & SPI_MODE_CPOL)
186187
? kECSPI_PolarityActiveLow

0 commit comments

Comments
 (0)