From f02c95ad5af51d35bc0281c08d47b5a22931d26c Mon Sep 17 00:00:00 2001 From: Alessandro Manganaro Date: Thu, 1 Aug 2024 10:31:20 +0200 Subject: [PATCH 1/2] drivers: bluetooth: hci: Fix stm32wb BLE behavior Implementing HCI setup function to have a correct and proper initialization procedure to fix #75318 issue Signed-off-by: Alessandro Manganaro (cherry picked from commit 7ca2072ed08c1d8def71b7038611a542dd3fe464) --- drivers/bluetooth/hci/ipm_stm32wb.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/bluetooth/hci/ipm_stm32wb.c b/drivers/bluetooth/hci/ipm_stm32wb.c index 7e672636b8febe..f476083dc8cb88 100644 --- a/drivers/bluetooth/hci/ipm_stm32wb.c +++ b/drivers/bluetooth/hci/ipm_stm32wb.c @@ -565,6 +565,19 @@ static int bt_ipm_open(const struct device *dev, bt_hci_recv_t recv) K_PRIO_COOP(CONFIG_BT_DRIVER_RX_HIGH_PRIO), 0, K_NO_WAIT); + hci->recv = recv; + + LOG_DBG("IPM Channel Open Completed"); + + return 0; +} + +static int bt_ipm_setup(const struct device *dev, const struct bt_hci_setup_params *params) +{ + ARG_UNUSED(params); + ARG_UNUSED(dev); + int err; + #ifdef CONFIG_BT_HCI_HOST err = bt_ipm_ble_init(); if (err) { @@ -572,9 +585,7 @@ static int bt_ipm_open(const struct device *dev, bt_hci_recv_t recv) } #endif /* CONFIG_BT_HCI_HOST */ - hci->recv = recv; - - LOG_DBG("IPM Channel Open Completed"); + LOG_DBG("IPM Channel Setup Completed"); return 0; } @@ -613,6 +624,7 @@ static const struct bt_hci_driver_api drv = { .close = bt_ipm_close, #endif .send = bt_ipm_send, + .setup = bt_ipm_setup, }; static int _bt_ipm_init(const struct device *dev) From ac880ad84d2d8899efd78c094e8f3faff9d81065 Mon Sep 17 00:00:00 2001 From: Alessandro Manganaro Date: Thu, 1 Aug 2024 10:31:58 +0200 Subject: [PATCH 2/2] drivers: bluetooth: hci: Fix stm32wb BLE behavior Enabling BT_HCI_SETUP for STM32WB55 to have a correct and proper initialization procedure to fix #75318 issue Signed-off-by: Alessandro Manganaro (cherry picked from commit 4fc77248de904d26942b2afb63c4a79a05008243) --- drivers/bluetooth/hci/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/bluetooth/hci/Kconfig b/drivers/bluetooth/hci/Kconfig index e6adca872e54b2..8b11212b41b0df 100644 --- a/drivers/bluetooth/hci/Kconfig +++ b/drivers/bluetooth/hci/Kconfig @@ -63,6 +63,7 @@ config BT_STM32_IPM depends on DT_HAS_ST_STM32WB_RF_ENABLED select USE_STM32_HAL_CORTEX select HAS_STM32LIB + select BT_HCI_SETUP help TODO