Skip to content

Commit

Permalink
driver: bluetooth: hci: Add NXP BT module support
Browse files Browse the repository at this point in the history
Implement UART firmware download driver for NXP
BT module.

Only support Murata 2EL M.2 module on RT1170EVKB.

And only one instance can be supported now.

(cherry picked from commit d164f9c)

Original-Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
GitOrigin-RevId: d164f9c
Change-Id: I6527fa722f1f92a9816d3a27e9c0f1f91c5ffd80
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5629501
Tested-by: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com>
Tested-by: Jeremy Bettis <jbettis@chromium.org>
Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
  • Loading branch information
lylezhu2012 authored and Chromeos LUCI committed Jun 13, 2024
1 parent f08e32b commit 37fb666
Show file tree
Hide file tree
Showing 7 changed files with 1,324 additions and 1 deletion.
14 changes: 13 additions & 1 deletion boards/nxp/mimxrt1170_evk/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Hardware
- Expansion port

- Arduino interface
- M.2 WIFI/BT interface

- CAN bus connector

Expand Down Expand Up @@ -172,6 +173,8 @@ RT1170 EVKB (`mimxrt1170_evk@B//cm7/cm4`)
| VIDEO | on-chip | CSI; MIPI CSI-2 Rx. Tested with | Supported (M7) | Supported (M7) |
| | | :ref:`nxp_btb44_ov5640` shield | | |
+-----------+------------+-------------------------------------+-----------------+-----------------+
| UART | NXP NW61x | M.2 WIFI/BT module | Unsupported | Supported (M7) |
+-----------+------------+-------------------------------------+-----------------+-----------------+

The default configuration can be found in the defconfig files:
:zephyr_file:`boards/nxp/mimxrt1170_evk/mimxrt1170_evk_mimxrt1176_cm7_defconfig`
Expand Down Expand Up @@ -247,6 +250,14 @@ The MIMXRT1170 SoC has six pairs of pinmux/gpio controllers.
+---------------------------+----------------+------------------+
| GPIO_AD_20_SAI1_RX_DATA00 | SAI1_RX_DATA00 | SAI |
+---------------------------+----------------+------------------+
| GPIO_DISP_B2_10 | LPUART2_TX | M.2 BT HCI |
+---------------------------+----------------+------------------+
| GPIO_DISP_B2_11 | LPUART2_RX | M.2 BT HCI |
+---------------------------+----------------+------------------+
| GPIO_DISP_B2_12 | LPUART2_CTS_B | M.2 BT HCI |
+---------------------------+----------------+------------------+
| GPIO_DISP_B2_13 | LPUART1_RTS_B | M.2 BT HCI |
+---------------------------+----------------+------------------+

Dual Core samples
*****************
Expand Down Expand Up @@ -291,7 +302,8 @@ cost of reduced resolution
Serial Port
===========

The MIMXRT1170 SoC has 12 UARTs. One is configured for the console and the
The MIMXRT1170 SoC has 12 UARTs. ``LPUART1`` is configured for the console,
``LPUART2`` for the Bluetooth Host Controller Interface (BT HCI), and the
remaining are not used.

Programming and Debugging
Expand Down
11 changes: 11 additions & 0 deletions boards/nxp/mimxrt1170_evk/mimxrt1170_evk-pinctrl.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,17 @@
};
};

pinmux_lpuart2_flowcontrol: pinmux_lpuart2_flowcontrol {
group0 {
pinmux = <&iomuxc_gpio_disp_b2_11_lpuart2_rx>,
<&iomuxc_gpio_disp_b2_10_lpuart2_tx>,
<&iomuxc_gpio_disp_b2_12_lpuart2_cts_b>,
<&iomuxc_gpio_disp_b2_13_lpuart2_rts_b>;
drive-strength = "high";
slew-rate = "fast";
};
};

pinmux_sai1: pinmux_sai1 {
group0 {
pinmux = <&iomuxc_gpio_ad_17_sai1_mclk>,
Expand Down
27 changes: 27 additions & 0 deletions boards/nxp/mimxrt1170_evk/mimxrt1170_evk_mimxrt1176_cm7_B.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
zephyr,flash-controller = &w25q512nw;
zephyr,flash = &w25q512nw;
zephyr,code-partition = &slot0_partition;
zephyr,bt-hci = &bt_hci_uart;
};

aliases {
Expand Down Expand Up @@ -75,3 +76,29 @@
status = "okay";
};
};

m2_hci_uart: &lpuart2 {
pinctrl-0 = <&pinmux_lpuart2_flowcontrol>;
pinctrl-1 = <&pinmux_lpuart2_sleep>;
pinctrl-names = "default", "sleep";

bt_hci_uart: bt_hci_uart {
compatible = "zephyr,bt-hci-uart";

m2_bt_module {
compatible = "nxp,bt-hci-uart";
sdio-reset-gpios = <&gpio9 15 GPIO_ACTIVE_HIGH>;
w-disable-gpios = <&gpio9 30 GPIO_ACTIVE_HIGH>;
hci-operation-speed = <115200>;
hw-flow-control;
fw-download-primary-speed = <115200>;
fw-download-secondary-speed = <3000000>;
fw-download-secondary-flowcontrol;
};
};
};

&m2_hci_uart {
status = "okay";
current-speed = <115200>;
};
1 change: 1 addition & 0 deletions drivers/bluetooth/hci/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ 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_DA1469X hci_da1469x.c)
zephyr_library_sources_ifdef(CONFIG_BT_NXP hci_nxp.c)
zephyr_library_sources_ifdef(CONFIG_BT_H4_NXP_CTLR hci_nxp_setup.c)
45 changes: 45 additions & 0 deletions drivers/bluetooth/hci/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -248,3 +248,48 @@ config BT_SILABS_HCI_BUFFER_MEMORY
help
Select the size of allocated memory buffer for the Silicon Labs
Bluetooth Library.

config BT_H4_NXP_CTLR
bool "NXP Bluetooth Controller [EXPERIMENTAL]"
select GPIO
# select UART_USE_RUNTIME_CONFIGURE
select EXPERIMENTAL
depends on BT_H4
select CRC
default y
depends on DT_HAS_NXP_BT_HCI_UART_ENABLED
help
Enables support for NXP Bluetooth Controller.
Murata 2EL M.2 Moudle base on NXP IW612 Chipset which supports
Wi-Fi® 802.11a/b/g/n/ac/ax + Bluetooth® 5.3 BR/EDR/LE + IEEE802.1.5.4
up to 601 Mbps data rate on Wi-Fi® and 2Mbps data rate on Bluetooth®.
4-wire UART@3M baud is supported. PCM for audio is also supported.
Details of the module could be fond on
https://www.embeddedartists.com/products/2el-m-2-module/

The configuration depends on the firmware (named uart_nw61x_se.h)
of Murata 2EL M.2 Moudle. It could be downloaded here
https://github.com/NXP/wifi_nxp/blob/MCUX_2.15.000/wifi_bt_firmware/nw61x/uart_nw61x_se.h
And it needs to be placed into the folder <zephyrproject>/zephyr/
drivers/bluetooth/hci.

More inforamtion about NXP Bluetooth profuct could be found on
https://www.nxp.com/products/wireless-connectivity/wi-fi-plus-bluetooth-plus-802-15-4:WIFI-BLUETOOTH

if BT_H4_NXP_CTLR

config BT_H4_NXP_CTLR_WAIT_HDR_SIG_TIMEOUT
int "Timeout for waiting HDR Signure"
range 1000 60000
default 2500
help
Timeout for waiting HDR Signure. Unit is millisecond.

config BT_H4_NXP_CTLR_WAIT_TIME_AFTER_UPLOAD
int "Waiting time after firmware is uploaded"
range 1000 5000
default 1000
help
Waiting time after firmware is uploaded. Unit is millisecond.

endif #BT_H4_NXP_CTLR
Loading

0 comments on commit 37fb666

Please sign in to comment.