From 2c4d55042c380769f3245d1264b4dab0f83efe86 Mon Sep 17 00:00:00 2001 From: Alexandre Bourdiol Date: Tue, 8 Mar 2022 09:43:51 +0100 Subject: [PATCH] drivers: bluetooth: hci: BlueNRG-MS: Hold on CS In case of BlueNRG-MS, it is necessary to prevent SPI driver to release CS, and instead, let current driver manage CS release. So, add SPI_HOLD_ON_CS to operation field Signed-off-by: Alexandre Bourdiol --- drivers/bluetooth/hci/spi.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/bluetooth/hci/spi.c b/drivers/bluetooth/hci/spi.c index 4cb8ff0c35f..6ba2fa7fb1c 100644 --- a/drivers/bluetooth/hci/spi.c +++ b/drivers/bluetooth/hci/spi.c @@ -116,8 +116,17 @@ struct bluenrg_aci_cmd_ll_param { static int bt_spi_send_aci_config_data_controller_mode(void); #endif /* CONFIG_BT_BLUENRG_ACI */ +#if defined(CONFIG_BT_SPI_BLUENRG) +/* In case of BlueNRG-MS, it is necessary to prevent SPI driver to release CS, + * and instead, let current driver manage CS release. see kick_cs()/release_cs() + * So, add SPI_HOLD_ON_CS to operation field. + */ +static const struct spi_dt_spec bus = SPI_DT_SPEC_INST_GET( + 0, SPI_OP_MODE_MASTER | SPI_TRANSFER_MSB | SPI_WORD_SET(8) | SPI_HOLD_ON_CS, 0); +#else static const struct spi_dt_spec bus = SPI_DT_SPEC_INST_GET( 0, SPI_OP_MODE_MASTER | SPI_TRANSFER_MSB | SPI_WORD_SET(8), 0); +#endif static struct spi_buf spi_tx_buf; static struct spi_buf spi_rx_buf;