From 573c18f42ad28f420d7210f2a9b19e64ab595af5 Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Fri, 16 Aug 2024 20:50:16 +1000 Subject: [PATCH] bluetooth: hci: dedicated symbols for SPI variants Add dedicated Kconfig symbols for the two SPI backend variants. This allows enabling the symbols by default from devicetree, and cleans up the cmake logic. Signed-off-by: Jordan Yates --- drivers/bluetooth/hci/CMakeLists.txt | 9 ++--- drivers/bluetooth/hci/Kconfig | 51 ++++++++++++++++++---------- 2 files changed, 35 insertions(+), 25 deletions(-) diff --git a/drivers/bluetooth/hci/CMakeLists.txt b/drivers/bluetooth/hci/CMakeLists.txt index 91daa9d9cb7..954477a54c7 100644 --- a/drivers/bluetooth/hci/CMakeLists.txt +++ b/drivers/bluetooth/hci/CMakeLists.txt @@ -20,13 +20,8 @@ endif() zephyr_library_sources_ifdef(CONFIG_BT_H4 h4.c) zephyr_library_sources_ifdef(CONFIG_BT_H5 h5.c) zephyr_library_sources_ifdef(CONFIG_BT_HCI_IPC ipc.c) -if(CONFIG_BT_SPI) - if ((CONFIG_DT_HAS_ST_HCI_SPI_V1_ENABLED) OR (CONFIG_DT_HAS_ST_HCI_SPI_V2_ENABLED)) - zephyr_library_sources(hci_spi_st.c) - else() - zephyr_library_sources(spi.c) - endif() -endif() +zephyr_library_sources_ifdef(CONFIG_BT_SPI_ZEPHYR spi.c) +zephyr_library_sources_ifdef(CONFIG_BT_SPI_BLUENRG hci_spi_st.c) zephyr_library_sources_ifdef(CONFIG_BT_CYW43XX h4_ifx_cyw43xxx.c) zephyr_library_sources_ifdef(CONFIG_BT_CYW208XX hci_ifx_cyw208xx.c) diff --git a/drivers/bluetooth/hci/Kconfig b/drivers/bluetooth/hci/Kconfig index 32ad3b72584..9355f40eeec 100644 --- a/drivers/bluetooth/hci/Kconfig +++ b/drivers/bluetooth/hci/Kconfig @@ -48,15 +48,46 @@ config BT_HCI_IPC using the IPC subsystem. config BT_SPI - bool "SPI HCI" + bool select SPI help Supports Bluetooth ICs using SPI as the communication protocol. HCI packets are sent and received as single Byte transfers, - prepended after a known header. Headers may vary per device, so + prepended after a known header. Headers may vary per device, so additional platform specific knowledge may need to be added as devices are. +config BT_SPI_INIT_PRIORITY + int "BT SPI init priority" + depends on BT_SPI + default 75 + +config BT_SPI_ZEPHYR + bool + default y + depends on DT_HAS_ZEPHYR_BT_HCI_SPI_ENABLED + select BT_SPI + help + Bluetooth HCI over SPI driver for communication with Bluetooth + controllers running Zephyr. + +config BT_SPI_BLUENRG + bool + default y + depends on DT_HAS_ST_HCI_SPI_V1_ENABLED || DT_HAS_ST_HCI_SPI_V2_ENABLED + select BT_SPI + help + Bluetooth HCI over SPI driver for communication with + STMicroelectronics BlueNRG devices. + +config BT_BLUENRG_ACI + bool "ACI message with BlueNRG-based devices" + depends on BT_SPI_BLUENRG + select BT_HCI_SET_PUBLIC_ADDR + help + Enable support for devices compatible with the BlueNRG Bluetooth + Stack. Current driver supports: ST BLUENRG-MS. + config BT_STM32_IPM bool default y @@ -159,22 +190,6 @@ config BT_AMBIQ_HCI Supports Ambiq Bluetooth SoC using SPI as the communication protocol. HCI packets are sent and received as single Byte transfers. - -if BT_SPI - -config BT_SPI_INIT_PRIORITY - int "BT SPI init priority" - default 75 - -config BT_BLUENRG_ACI - bool "ACI message with BlueNRG-based devices" - select BT_HCI_SET_PUBLIC_ADDR - help - Enable support for devices compatible with the BlueNRG Bluetooth - Stack. Current driver supports: ST BLUENRG-MS. - -endif # BT_SPI - config BT_HCI_INIT_PRIORITY int "BT HCI init priority" default 75 if BT_AMBIQ_HCI