From 649795a7cba36cbecfd269fb6f69a0ed5286d04a Mon Sep 17 00:00:00 2001 From: Tomasz Bursztyka Date: Mon, 15 May 2017 11:34:04 +0200 Subject: [PATCH] drivers/spi: Handle SPI_HOLD_ON_CS in spi context through gpio If CS is controlled over GPIO, it will be possible to keep the slave up and running (though no transaction will be going on) using this configuration bit. Signed-off-by: Tomasz Bursztyka --- drivers/spi/spi_context.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/spi/spi_context.h b/drivers/spi/spi_context.h index a0039b68cd2..f2ee333286f 100644 --- a/drivers/spi/spi_context.h +++ b/drivers/spi/spi_context.h @@ -132,6 +132,10 @@ static inline void spi_context_cs_control(struct spi_context *ctx, bool on) ctx->config->cs->gpio_pin, 0); k_busy_wait(ctx->config->cs->delay); } else { + if (ctx->config->operation & SPI_HOLD_ON_CS) { + return; + } + k_busy_wait(ctx->config->cs->delay); gpio_pin_write(ctx->config->cs->gpio_dev, ctx->config->cs->gpio_pin, 1);