drivers: spi: nrfx: Deactivate CS from thread context

... so that it is possible to use a GPIO expander pin as the CS line.
Communication with the expander may involve an operation that cannot
be done from the interrupt context (e.g. an I2C transaction).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
This commit is contained in:
Andrzej Głąbek 2024-01-05 10:26:59 +01:00 committed by Carles Cufí
parent 3f6373eb36
commit db4344b659
2 changed files with 4 additions and 4 deletions

View file

@ -161,8 +161,6 @@ static void finish_transaction(const struct device *dev, int error)
struct spi_nrfx_data *dev_data = dev->data;
struct spi_context *ctx = &dev_data->ctx;
spi_context_cs_control(ctx, false);
LOG_DBG("Transaction finished with status %d", error);
spi_context_complete(ctx, dev, error);
@ -277,6 +275,8 @@ static int transceive(const struct device *dev,
/* Clean up the driver state. */
k_sem_reset(&dev_data->ctx.sync);
}
spi_context_cs_control(&dev_data->ctx, false);
}
spi_context_release(&dev_data->ctx, error);

View file

@ -294,8 +294,6 @@ static void finish_transaction(const struct device *dev, int error)
struct spi_nrfx_data *dev_data = dev->data;
struct spi_context *ctx = &dev_data->ctx;
spi_context_cs_control(ctx, false);
LOG_DBG("Transaction finished with status %d", error);
spi_context_complete(ctx, dev, error);
@ -470,6 +468,8 @@ static int transceive(const struct device *dev,
anomaly_58_workaround_clear(dev_data);
#endif
}
spi_context_cs_control(&dev_data->ctx, false);
}
spi_context_release(&dev_data->ctx, error);