Commit 01b9813d authored by Tomasz Bursztyka's avatar Tomasz Bursztyka Committed by Carles Cufi
Browse files

drivers/spi: Return an error on SPI_HALF_DUPLEX for relevant drivers



This feature will need to be, however, implemented driver by driver
afterwards.

Signed-off-by: default avatarTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
parent 20b8d74d
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -242,6 +242,11 @@ static void spi_b91_txrx(const struct device *dev, uint32_t len)
static bool spi_b91_is_config_supported(const struct spi_config *config,
					struct spi_b91_cfg *b91_config)
{
	if (config->operation & SPI_HALF_DUPLEX) {
		LOG_ERR("Half-duplex not supported");
		return false;
	}

	/* check for loop back */
	if (config->operation & SPI_MODE_LOOP) {
		LOG_ERR("Loop back mode not supported");
+5 −0
Original line number Diff line number Diff line
@@ -59,6 +59,11 @@ static int spi_cc13xx_cc26xx_configure(const struct device *dev,
		return 0;
	}

	if (config->operation & SPI_HALF_DUPLEX) {
		LOG_ERR("Half-duplex not supported");
		return -ENOTSUP;
	}

	/* Slave mode has not been implemented */
	if (SPI_OP_MODE_GET(config->operation) != SPI_OP_MODE_MASTER) {
		LOG_ERR("Slave mode is not supported");
+5 −0
Original line number Diff line number Diff line
@@ -207,6 +207,11 @@ static int spi_dw_configure(const struct spi_dw_config *info,
		return 0;
	}

	if (config->operation & SPI_HALF_DUPLEX) {
		LOG_ERR("Half-duplex not supported");
		return -ENOTSUP;
	}

	/* Verify if requested op mode is relevant to this controller */
	if (config->operation & SPI_OP_MODE_SLAVE) {
		if (!(info->op_modes & SPI_CTX_RUNTIME_OP_MODE_SLAVE)) {
+5 −0
Original line number Diff line number Diff line
@@ -235,6 +235,11 @@ static int IRAM_ATTR spi_esp32_configure(const struct device *dev,

	ctx->config = spi_cfg;

	if (spi_cfg->operation & SPI_HALF_DUPLEX) {
		LOG_ERR("Half-duplex not supported");
		return -ENOTSUP;
	}

	if (spi_cfg->operation & SPI_OP_MODE_SLAVE) {
		LOG_ERR("Slave mode not supported");
		return -ENOTSUP;
+5 −0
Original line number Diff line number Diff line
@@ -57,6 +57,11 @@ static int spi_config(const struct device *dev,
	const struct spi_gecko_config *gecko_config = dev->config;
	struct spi_gecko_data *data = DEV_DATA(dev);

	if (config->operation & SPI_HALF_DUPLEX) {
		LOG_ERR("Half-duplex not supported");
		return -ENOTSUP;
	}

	if (SPI_WORD_SIZE_GET(config->operation) != SPI_WORD_SIZE) {
		LOG_ERR("Word size must be %d", SPI_WORD_SIZE);
		return -ENOTSUP;
Loading