Commit 7d59e9f1 authored by Pieter De Gendt's avatar Pieter De Gendt Committed by Dan Kalowsky
Browse files

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: default avatarPieter De Gendt <pieter.degendt@basalte.be>
(cherry picked from commit 7250e987)
parent de825415
Loading
Loading
Loading
Loading
+3 −2
Changes for drivers/spi/spi_mcux_ecspi.c: 3 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -163,7 +163,7 @@ static int spi_mcux_configure(const struct device *dev,
		return -ENOTSUP;
	}

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

	ECSPI_MasterGetDefaultConfig(&master_config);

	master_config.channel = (ecspi_channel_source_t)spi_cfg->slave;
	master_config.channel =
		spi_cs_is_gpio(spi_cfg) ? kECSPI_Channel0 : (ecspi_channel_source_t)spi_cfg->slave;
	master_config.channelConfig.polarity =
		(SPI_MODE_GET(spi_cfg->operation) & SPI_MODE_CPOL)
		? kECSPI_PolarityActiveLow