Commit graph

651 commits

Author SHA1 Message Date
Andrzej Kaczmarek 6306596b27 drivers: hci: da1469x: Add driver for CMAC core on DA1469x
This adds HCI driver which enables communication with CMAC core on
Renesas SmartBond DA1469x series. The CMAC core is running an Apache
NimBLE controller binary and uses shared memory for communcation via
mailboxes.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2024-05-16 18:58:00 -04:00
Ali Hozhabri fae32ac0b8 drivers: bluetooth: hci: Fix int conversion warning
Fix int conversion warning (-Wint-conversion), which is caused by
parallel PRs.

Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
2024-05-09 10:28:58 +02:00
Théo Battrel b2e235d530 Bluetooth: Remove legacy debug symbols
The `BT_DEBUG_*` Kconfig symbols have been deprecated for more than 2
versions, remove them.

Update code that was still using them.

Remove the Bluetooth specific `Kconfig.template.log_config_bt` and use
`Kconfig.template.log_config_inherit` from the logging subsystem
instead, now that the legacy symbols can be removed.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2024-05-07 09:49:27 +02:00
Pisit Sawangvonganan 3d39926f94 bluetooth: hci: refactored bluetooth hci packet type indicators
Introduced a unified definition for HCI packet type indicators in
'bluetooth/hci_types.h. This change streamlines the code in
'drivers/bluetooth/hci/', reducing redundancy.
Enhances maintainability and consistency across all HCI drivers.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-05-01 10:33:12 +02:00
Nazar Palamar 6d684c91c2 drivers: bluetooth/cyw43xxx: check that hw_flow_control is set
Add BUILD_ASSERT to check that hw_flow_control is set.

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2024-04-23 15:35:53 +02:00
Aleksander Wasaznik a64d20f6f0 Bluetooth: host: sched-lock bt_recv()
`bt_recv` is invoked from the BT long work queue, which is preemptible.
The host uses cooperative scheduling to ensure thread safety.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-04-13 07:05:20 -04:00
Jędrzej Ciupis 2b23a52642 boards: nrf53: switch to the network CPU management API
Switch to the network CPU management API from direct nrfx calls.

Signed-off-by: Jędrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
2024-04-12 11:31:47 +02:00
Ali Hozhabri 0252b6ff88 drivers: bluetooth: hci: Support reading long events in ST SPI v1
Provide support for reading events longer than 127 bytes in
ST SPI protocol v1 by splitting them into several SPI transactions.

Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
2024-04-05 12:21:17 +02:00
Ali Hozhabri 7392bf284c drivers: bluetooth: hci: Support ISO packets in ST HCI SPI BT driver
Add support for ISO packets in ST HCI SPI BT driver.

Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
2024-04-05 12:21:01 +02:00
Aleksander Wasaznik b91728619c Bluetooth: host: remove CONFIG_BT_RECV_BLOCKING
This config selects a variant of the HCI driver interface that spills
out host internals unto the drivers and even the Zephyr controller. It
will now be removed in favor of driver interfaces that hide the
internals of the host.

The new default is `CONFIG_BT_RECV_WORKQ_BT`.

Any references to the removed kconfig are refactored out.

Any out-of-tree driver using the removed interface can be easily adapted
by copying the following implementations into the driver as private
functions:

 - `hci_driver.h:BT_HCI_EVT_FLAG_RECV_PRIO`
 - `hci_driver.h:BT_HCI_EVT_FLAG_RECV`
 - `hci_driver.h:bt_hci_evt_get_flags`
 - `hci_raw.c:bt_recv_prio`

In combination these symbols function as a interface adapter. These
symbols will be removed in this PR in subsequent commits.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-03-26 11:17:29 -05:00
Lingao Meng 137efd1c30 drivers: bluetooth: hci: Fix userchan insufficient buf cause dead-loop.
If insufficient buf for given event, will cause dead-loop.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2024-03-25 18:39:03 -04:00
Michele Sardo aa58fb0f0a drivers: bluetooth: hci: Enable SPI_LOCK_ON mode
Use SPI_LOCK_ON to lock configuration for multiple transaction while CS is
kept low.

Change control of CS line from direct GPIO manipulation to SPI driver API.

Signed-off-by: Michele Sardo <msmttchr@gmail.com>
2024-03-15 15:50:03 +02:00
Vidar Berg ceff785434 drivers: bluetooth: hci: Apply workaround for HW anomaly on nRF53
Use the nrf_reset_network_force_off() function to release and set the
force-off signal.This ensures that the workaround for errata 161 is
applied.

Signed-off-by: Vidar Berg <vidar.berg@nordicsemi.no>
2024-03-15 14:32:01 +01:00
Ali Hozhabri bcf2ee9d49 drivers: bluetooth: hci: Special handling of hci_reset only for ST SPI v1
Exclude devices based on ST SPI protocol v2 from special handling of
hci_reset opcode as it is redundant.

Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
2024-03-11 15:13:48 +00:00
Ali Hozhabri 9d8d20febb drivers: bluetooth: hci: Support raw mode in ST HCI SPI BT driver
Add raw mode in ST HCI SPI BT driver to support host-less configuration.

Remove compilation dependency for BT_QUIRK_NO_RESET as it applies to all
configurations.

Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
2024-03-11 15:13:48 +00:00
Ali Hozhabri 35ae3e5353 drivers: bluetooth: hci: Move bt_spi_send_aci_config to setup function
Move bt_spi_send_aci_config to setup function.

Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
2024-03-11 15:13:48 +00:00
Emil Gydesen a5c2781c04 drivers: Bluetooth: HCI: Reduce logging of No available ISO buffers
In the case that there are no more ISO buffers left,
"No available ISO buffers" is logged. However, given the
nature of ISO where we are (very) likely to get additional ISO
very soon after (typically every 7.5 or 10ms for audio),
this will get logged a lot, and the logging may in some
cases actually prevent the application from handling and
freeing existng buffers due to the immense logging,
which may make this (minor) issue into a blocking issue.

This is fixed by reducing the logging to the first
occurence, and then only every 100 afterwards, which has
shown to reduce the risk of this effectively blocking
the application.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-03-08 15:18:54 +00:00
Lyle Zhu 40cf23daff Bluetooth: Rename BT_BREDR to BT_CLASSIC
Rename BT_BREDR to BT_CLASSIC
Rename CONFIG_BT_BREDR to CONFIG_BT_CLASSIC

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-03-07 11:26:45 +02:00
Jordan Yates bb27f0578b bluetooth: hci: spi: 0xFF is a valid payload length
A payload size of 0xFF is valid and should not be a reason to keep
looping for more headers. The complete reqiurement is now:
```
header_slave[STATUS_HEADER_READY] == READY_NOW &&
header_slave[STATUS_HEADER_TOREAD] > 0
```
This fixes events being dropped when the payload size is 255.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2024-02-28 19:47:55 -06:00
Ali Hozhabri 88369606e2 drivers: bluetooth: hci: Multiple write transaction support for BlueNRG-MS
Provide multiple write transaction support for BlueNRG-MS, st_hci_spi_v1
protocol. Since by default, BlueNRG-MS write buffer supports up to 127
bytes; however, it is possible to have consecutive write transactions
so as to send data more than 127 bytes.

Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
2024-02-26 11:47:32 +01:00
Pisit Sawangvonganan b8105c1408 drivers: bluetooth: ambiq: fix the naming of rx message buffer
This change renames the RX message buffer from g_hciRxMsg to rxmsg,
as it does not follow the Zephyr coding style.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-01-17 16:51:53 +01:00
Pisit Sawangvonganan 61e301a059 bluetooth: hci: place tx/rx message buffer in .noinit section
This change relocates the tx/rx message buffer from the .bss section
to the .noinit section. This adjustment is aimed at reducing boot time by
lowering the size of the .bss section, without impacting the operational
functionality of the buffer.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-01-17 16:51:53 +01:00
Ali Hozhabri a87a42dec7 drivers: bluetooth: hci: Add support for ST Proprietary extended event
Add support for handling ST Proprietary extended event.

Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
2024-01-10 15:07:36 +01:00
Ali Hozhabri 8b8be3c7aa drivers: bluetooth: hci: Remove ST vendor code from spi.c
Remove ST vendor code from spi.c.

Update CMakeLists to select ST vendor file for ST BlueNRG devices.

Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
2024-01-10 15:07:36 +01:00
Ali Hozhabri 98d6dbf787 drivers: bluetooth: hci: Add Bluetooth driver for ST HCI SPI protocol
Copy ST specific SPI protocol code from spi.c to a vendor specific file.

Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
2024-01-10 15:07:36 +01:00
Ali Hozhabri ccc97125f8 drivers: bluetooth: hci: Fix uninitialized array index, issue #66806
Fix issue #66806, caused by PR #65172.

Return -EINVAL from bt_spi_get_header if op is neither SPI_READ nor
SPI_WRITE.

Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
2024-01-04 09:42:50 +01:00
Sylvio Alves f68fbd6984 driver: ble: esp32: implement deinit function
Current ESP32 BLE interface does not allow disabling
BLE. This PR adds proper deinit call.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-12-22 09:54:00 +01:00
Erwan Gouriou 098df08bbc drivers: bluetooth: stm32wba: Configure flash manager
Configure flash manager at BLE init.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2023-12-21 09:19:24 +01:00
Erwan Gouriou 54d7793e82 drivers: bluethooth: stm32wba: Add HCI driver for STM32WBA
Add HCI Driver for STM32WBA devices.
Based on B91 HCI driver.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2023-12-18 17:31:08 +00:00
Aaron Ye d385150bb0 drivers: bluetooth: Add Ambiq HCI driver for Apollo4 Blue Plus.
This commits create the dts binding for Ambiq BT HCI instance.
And create the SPI based common HCI driver for Ambiq Apollox
Blue SoC and the extended soc driver for HCI.

Signed-off-by: Aaron Ye <aye@ambiq.com>
2023-12-18 14:54:53 +01:00
Ali Hozhabri e3ec41e15c drivers: bluetooth: hci: Remove config BT_SPI_BLUENRG
Remove BT_SPI_BLUENRG Kconfig parameter as it is redundant according to
the new changes introduced by ST SPI protocol V1 and V2.

Remove "config BT_SPI_BLUENRG" from the boards that were using it.

Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
2023-12-11 23:57:49 +00:00
Ali Hozhabri a67bc25b5f drivers: bluetooth: hci: Introduce ST SPI protocol V2
Introduce STMicroelectronics SPI protocol V2 which is used in BlueNRG-1
and successor devices.

Change the size of the variable "size" to 16 bits as it is necessary for ST
BlueNRG-1 and successor devices.

Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
2023-12-11 23:57:49 +00:00
Ali Hozhabri 810df7cef9 drivers: bluetooth: hci: Remove header acquisition from bt_spi_send
Replace the header acquisition scope in bt_spi_send with bt_spi_get_header.

Add WRITE_DATA_CONDITION in order not to retransmit data without reading
the header as it is meaningless for ST BlueNRG devices.

Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
2023-12-11 23:57:49 +00:00
Ali Hozhabri 36b0e26e64 drivers: bluetooth: hci: Restructure spi.c to handle different protocols
Update structure of spi.c to have a better and cleaner separation
between STMicroelectronics and Zephyr SPI protocol.

Introduce bt_spi_get_header to separate algorithms well for
header acquisition in different protocols.

Remove header acquisition from bt_spi_rx_thread to make it simpler.

Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
2023-12-11 23:57:49 +00:00
Jonathan Rico ea04fd95f9 Bluetooth: ATT: remove BT_ATT_ENFORCE_FLOW
Enforcing the peer's behavior is not strictly necessary. All the host
should do is make sure it is resilient to a spec-violating peer.

Moreover, a growing number of platforms were disabling the check, as the
spec allows "batching" HCI num complete packets events, stalling ATT RX.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Co-authored-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2023-12-06 17:53:54 +00:00
Armin Brauns b8856aed0d drivers: bluetooth: add more documentation for BT_HCI_SET_PUBLIC_ADDR
Hopefully this should now aid driver developers as well as application
developers.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-12-06 16:42:41 +02:00
Armin Brauns 281f27ec38 drivers: bluetooth: fix and clean up BlueNRG HCI setup() function
If no public address was set, it should just do nothing instead of
erroring. The function should also be static and there's no need to copy
the address struct.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-12-06 16:42:41 +02:00
Abderrahmane Jarmouni 3ce60d2d34 drivers: bluetooth: hci: ipm_stm32wb: naming fix
STM32CubeWB v1.18.0 replaces Master with Central & Slave with Peripheral
in the file app_conf.h (modified in the commit updating lib/stm32wb)

Signed-off-by: Abderrahmane Jarmouni <abderrahmane.jarmouni-ext@st.com>
2023-12-06 12:10:08 +00:00
Michele Sardo 0f44d62740 drivers: bluetooth: hci: handle event with high priority flag
Make sure that events flagged as high priority are handled when
CONFIG_BT_RECV_BLOCKING is not defined.

Fix for #65892.

Signed-off-by: Michele Sardo <msmttchr@gmail.com>
2023-12-04 14:18:20 +01:00
Armin Brauns 4321f86f1e drivers: allow setting BlueNRG public address
The zephyr bluetooth stack expects the controller to know its public
address, if any. At least for BlueNRG, the public address is forgotten with
every reset/power cycle, so there needs to be a way to set it from within
zephyr. This is accomplished using the `Aci_Hal_Write_Config_Data` HCI
command, as described in PM0237.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-11-29 10:44:25 +01:00
Armin Brauns 57b04c1eb0 drivers: refactor BlueNRG SPI driver for more config options
"LL only" is not the only config option of potential interest, e.g. the
public address is also important.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-11-29 10:44:25 +01:00
Armin Brauns 5b1b260f80 bluetooth: add HCI driver parameter to set controller's public address
This allows HCI drivers to expose vendor-specific functions to set the
public address.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-11-29 10:44:25 +01:00
Jordan Yates e1cd9f335d bluetooth: hci: spi: handle interrupt return code
Handle the GPIO module failing to configure the interrupt line.

Fixes #65583

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-11-25 08:53:49 -05:00
Jordan Yates 8b95376625 bluetooth: hci: increase SPI driver stack size
Increase the SPI RX driver stack size by 128 bytes. Overflows have
previously been observed on real hardware at the default stack size of
512.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-11-25 08:53:49 -05:00
Krzysztof Chruściński 1f0320441b drivers: bluetooth: hci: cyw43xxx: Add dependency to UART runtime config
Force enabling of the UART runtime configuration for CYW43XXX.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2023-11-15 10:02:18 +01:00
Nazar Palamar 5c3abe9197 drivers: bluetooth: rename BT_CYW43XXX to BT_AIROC
rename BT_CYW43XXX to BT_AIROC to be compatible with
WIFI_AIROC

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2023-11-08 15:07:37 +00:00
Jordan Yates 2283b02ce4 bluetooth: hci: spi: delay between header and data
The HCI receive path has a delay between reading the header and payload
from the controller to give the controller time to setup the SPI
peripheral for the next transaction. Add the same delay on the transmit
path for the same reasons.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-11-06 10:11:33 +01:00
Jordan Yates 0f903f04ac bluetooth: hci: spi: log TX retransmissions
Add log output when the HCI interface is forced to retransmit a packet
because the controller is not ready.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-11-06 10:11:33 +01:00
Ali Hozhabri 396e1ce9b0 drivers: bluetooth: hci: Use macros instead of hard-coding
Replace hard-coded values with suitable macros.

Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
2023-11-03 11:45:38 +01:00
Ali Hozhabri 7038e03695 drivers: bluetooth: hci: SPI configuration
Modify SPI configuration to match the features introduced in PR #63437.

Set the property "controller-data-delay-us" to zero for boards
which are using BlueNRG-MS.

Fix Chip Select configuration for stm32l562e_dk board.

Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
2023-11-03 11:45:38 +01:00