drivers: bluetooth: hci: add hardware reset for da1453x

Add ability to perform a hardware reset of the DA1453x during setup of
the HCI transport.

Signed-off-by: Ian Morris <ian.d.morris@outlook.com>
This commit is contained in:
Ian Morris 2024-10-30 08:48:32 -07:00 committed by Benjamin Cabé
commit 8e51ebf499
4 changed files with 97 additions and 0 deletions

View file

@ -29,6 +29,7 @@ if(CONFIG_DT_HAS_INFINEON_CAT1_BLESS_HCI_ENABLED)
endif() endif()
zephyr_library_sources_ifdef(CONFIG_SOC_NRF5340_CPUAPP nrf53_support.c) zephyr_library_sources_ifdef(CONFIG_SOC_NRF5340_CPUAPP nrf53_support.c)
zephyr_library_sources_ifdef(CONFIG_BT_AMBIQ_HCI hci_ambiq.c apollox_blue.c) zephyr_library_sources_ifdef(CONFIG_BT_AMBIQ_HCI hci_ambiq.c apollox_blue.c)
zephyr_library_sources_ifdef(CONFIG_BT_DA1453X hci_da1453x.c)
zephyr_library_sources_ifdef(CONFIG_BT_DA1469X hci_da1469x.c) zephyr_library_sources_ifdef(CONFIG_BT_DA1469X hci_da1469x.c)
zephyr_library_sources_ifdef(CONFIG_BT_NXP hci_nxp.c) zephyr_library_sources_ifdef(CONFIG_BT_NXP hci_nxp.c)
zephyr_library_sources_ifdef(CONFIG_BT_H4_NXP_CTLR hci_nxp_setup.c) zephyr_library_sources_ifdef(CONFIG_BT_H4_NXP_CTLR hci_nxp_setup.c)

View file

@ -160,6 +160,15 @@ config BT_PSOC6_BLESS
PSOC 6 BLESS driver with BLE Controller which operates in PSOC 6 BLESS driver with BLE Controller which operates in
Single CPU mode. Single CPU mode.
config BT_DA1453X
bool "DA1453x HCI driver"
default y
depends on DT_HAS_RENESAS_BT_HCI_DA1453X_ENABLED
select GPIO
help
Bluetooth HCI driver for communication with controller
running on DA1453x MCU.
config BT_DA1469X config BT_DA1469X
bool bool
default y default y

View file

@ -0,0 +1,59 @@
/*
* Copyright 2024 Ian Morris
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/devicetree.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/uart.h>
#define LOG_LEVEL CONFIG_BT_HCI_DRIVER_LOG_LEVEL
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(bt_hci_da1453x);
#define DT_DRV_COMPAT renesas_bt_hci_da1453x
int bt_hci_transport_setup(const struct device *h4)
{
int err = 0;
#if DT_INST_NODE_HAS_PROP(0, reset_gpios)
char c;
struct gpio_dt_spec bt_reset = GPIO_DT_SPEC_GET(DT_DRV_INST(0), reset_gpios);
if (!gpio_is_ready_dt(&bt_reset)) {
LOG_ERR("Error: failed to configure bt_reset %s pin %d", bt_reset.port->name,
bt_reset.pin);
return -EIO;
}
/* Set bt_reset as output and activate DA1453x reset */
err = gpio_pin_configure_dt(&bt_reset, GPIO_OUTPUT_ACTIVE);
if (err) {
LOG_ERR("Error %d: failed to configure bt_reset %s pin %d", err,
bt_reset.port->name, bt_reset.pin);
return err;
}
k_sleep(K_MSEC(DT_INST_PROP_OR(0, reset_assert_duration_ms, 0)));
/* Release the DA1453x from reset */
err = gpio_pin_set_dt(&bt_reset, 0);
if (err) {
return err;
}
/* Wait for the DA1453x to boot */
k_sleep(K_MSEC(DT_INST_PROP(0, boot_duration_ms)));
/* Drain bytes */
while (h4 && uart_fifo_read(h4, &c, 1)) {
continue;
}
#endif /* DT_INST_NODE_HAS_PROP(0, reset_gpios) */
return err;
}

View file

@ -0,0 +1,28 @@
# Copyright 2024 Ian Morris
# SPDX-License-Identifier: Apache-2.0
description: |
Extension of the Bluetooth H:4 HCI driver for a Renesas DA1453x based
controller, allowing control of the GPIO used to reset the DA1453x.
compatible: "renesas,bt-hci-da1453x"
include: base.yaml
properties:
reset-gpios:
type: phandle-array
description: |
This gpio is used to reset the DA1453x.
reset-assert-duration-ms:
type: int
description: |
Minimum duration to activate the reset-gpios pin.
If not specified no delay beyond the code path execution time is guaranteed.
boot-duration-ms:
type: int
default: 200
description: |
Minimum time to wait for the DA1453x to boot following a hardware reset.