From d87552a128c54859837ab9f403d08e75c4874990 Mon Sep 17 00:00:00 2001 From: Kamil Piszczek Date: Thu, 28 Apr 2022 18:22:56 +0200 Subject: [PATCH] drivers: bluetooth: hci: rpmsg: use chosen to abstract ipc instance Added chosen syntax in Device Tree to abstract the IPC device that is used with the IPC service module in the Bluetooth HCI RPMsg driver. Ported affected boards to declare this alias. Signed-off-by: Kamil Piszczek --- boards/arm/nrf5340dk_nrf5340/nrf5340_cpuapp_common.dts | 1 + boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpunet.dts | 1 + boards/arm/thingy53_nrf5340/thingy53_nrf5340_common.dts | 1 + boards/arm/thingy53_nrf5340/thingy53_nrf5340_cpunet.dts | 1 + drivers/bluetooth/hci/rpmsg.c | 3 ++- samples/bluetooth/hci_rpmsg/src/main.c | 3 ++- 6 files changed, 8 insertions(+), 2 deletions(-) diff --git a/boards/arm/nrf5340dk_nrf5340/nrf5340_cpuapp_common.dts b/boards/arm/nrf5340dk_nrf5340/nrf5340_cpuapp_common.dts index 5aedb30f723..6ea7397d154 100644 --- a/boards/arm/nrf5340dk_nrf5340/nrf5340_cpuapp_common.dts +++ b/boards/arm/nrf5340dk_nrf5340/nrf5340_cpuapp_common.dts @@ -13,6 +13,7 @@ zephyr,uart-mcumgr = &uart0; zephyr,bt-mon-uart = &uart0; zephyr,bt-c2h-uart = &uart0; + zephyr,bt-hci-rpmsg-ipc = &ipc0; }; leds { diff --git a/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpunet.dts b/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpunet.dts index 602eef55cf9..e07fed6a675 100644 --- a/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpunet.dts +++ b/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpunet.dts @@ -18,6 +18,7 @@ zephyr,uart-mcumgr = &uart0; zephyr,bt-mon-uart = &uart0; zephyr,bt-c2h-uart = &uart0; + zephyr,bt-hci-rpmsg-ipc = &ipc0; zephyr,sram = &sram1; zephyr,flash = &flash1; zephyr,code-partition = &slot0_partition; diff --git a/boards/arm/thingy53_nrf5340/thingy53_nrf5340_common.dts b/boards/arm/thingy53_nrf5340/thingy53_nrf5340_common.dts index 2276ed3831c..5e36c616a29 100644 --- a/boards/arm/thingy53_nrf5340/thingy53_nrf5340_common.dts +++ b/boards/arm/thingy53_nrf5340/thingy53_nrf5340_common.dts @@ -12,6 +12,7 @@ zephyr,uart-mcumgr = &uart0; zephyr,bt-mon-uart = &uart0; zephyr,bt-c2h-uart = &uart0; + zephyr,bt-hci-rpmsg-ipc = &ipc0; }; buttons { diff --git a/boards/arm/thingy53_nrf5340/thingy53_nrf5340_cpunet.dts b/boards/arm/thingy53_nrf5340/thingy53_nrf5340_cpunet.dts index 7696089b67d..0f30da65668 100644 --- a/boards/arm/thingy53_nrf5340/thingy53_nrf5340_cpunet.dts +++ b/boards/arm/thingy53_nrf5340/thingy53_nrf5340_cpunet.dts @@ -18,6 +18,7 @@ zephyr,uart-mcumgr = &uart0; zephyr,bt-mon-uart = &uart0; zephyr,bt-c2h-uart = &uart0; + zephyr,bt-hci-rpmsg-ipc = &ipc0; zephyr,sram = &sram1; zephyr,flash = &flash1; zephyr,code-partition = &slot0_partition; diff --git a/drivers/bluetooth/hci/rpmsg.c b/drivers/bluetooth/hci/rpmsg.c index 3cec7880cc0..c3ac887c046 100644 --- a/drivers/bluetooth/hci/rpmsg.c +++ b/drivers/bluetooth/hci/rpmsg.c @@ -283,7 +283,8 @@ static struct ipc_ept_cfg hci_ept_cfg = { static int bt_rpmsg_open(void) { int err; - const struct device *hci_ipc_instance = DEVICE_DT_GET(DT_NODELABEL(ipc0)); + const struct device *hci_ipc_instance = + DEVICE_DT_GET(DT_CHOSEN(zephyr_bt_hci_rpmsg_ipc)); BT_DBG(""); diff --git a/samples/bluetooth/hci_rpmsg/src/main.c b/samples/bluetooth/hci_rpmsg/src/main.c index 97b3c3ad68c..04985e576dc 100644 --- a/samples/bluetooth/hci_rpmsg/src/main.c +++ b/samples/bluetooth/hci_rpmsg/src/main.c @@ -268,7 +268,8 @@ static struct ipc_ept_cfg hci_ept_cfg = { void main(void) { int err; - const struct device *hci_ipc_instance = DEVICE_DT_GET(DT_NODELABEL(ipc0)); + const struct device *hci_ipc_instance = + DEVICE_DT_GET(DT_CHOSEN(zephyr_bt_hci_rpmsg_ipc)); /* incoming events and data from the controller */ static K_FIFO_DEFINE(rx_queue);