mbox series

[v5,0/3] Add support for NXP bluetooth chipsets

Message ID 20230223103614.4137309-1-neeraj.sanjaykale@nxp.com
Headers show
Series Add support for NXP bluetooth chipsets | expand

Message

Neeraj Sanjay Kale Feb. 23, 2023, 10:36 a.m. UTC
This patch adds a driver for NXP bluetooth chipsets.

The driver is based on H4 protocol, and uses serdev APIs. It supports
host to chip power save feature, which is signalled by the host by
asserting break over UART TX lines, to put the chip into sleep state.

To support this feature, break_ctl has also been added to serdev-tty
along with a new serdev API serdev_device_break_ctl().

This driver is capable of downloading firmware into the chip over UART.

The document specifying device tree bindings for this driver is also
included in this patch series.

Neeraj Sanjay Kale (3):
  serdev: Add method to assert break signal over tty UART port
  dt-bindings: net: bluetooth: Add NXP bluetooth support
  Bluetooth: NXP: Add protocol support for NXP Bluetooth chipsets

 .../net/bluetooth/nxp,88w8987-bt.yaml         |   38 +
 MAINTAINERS                                   |    6 +
 drivers/bluetooth/Kconfig                     |   11 +
 drivers/bluetooth/Makefile                    |    1 +
 drivers/bluetooth/btnxpuart.c                 | 1313 +++++++++++++++++
 drivers/tty/serdev/core.c                     |   11 +
 drivers/tty/serdev/serdev-ttyport.c           |   17 +
 include/linux/serdev.h                        |    6 +
 8 files changed, 1403 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/bluetooth/nxp,88w8987-bt.yaml
 create mode 100644 drivers/bluetooth/btnxpuart.c

Comments

Neeraj Sanjay Kale March 1, 2023, 3:51 p.m. UTC | #1
Hi Sherry

> ......
> 
> > +static u8 *nxp_get_fw_name_from_chipid(struct hci_dev *hdev, u16
> > +chipid) {
> > +	u8 *fw_name = NULL;
> > +
> > +	switch (chipid) {
> > +	case CHIP_ID_W9098:
> > +		fw_name = FIRMWARE_W9098;
> > +		break;
> > +	case CHIP_ID_IW416:
> > +		fw_name = FIRMWARE_IW416;
> > +		break;
> > +	case CHIP_ID_IW612:
> > +		fw_name = FIRMWARE_IW612;
> 
> Suppose for each V3 BT chips, you not only need to update the fw_name, but
> also fw_dnld_use_high_baudrate. Don't use the default value in drv_data for
> all chips here.
fw_dnld_use_high_baudrate is not used in the V3 download mechanism, neither do we need it as of now in V3.

> > +
> > +	set_bit(BTNXPUART_FW_DOWNLOADING, &nxpdev->tx_state);
> > +	init_waitqueue_head(&nxpdev->suspend_wait_q);
> > +
> > +	if (!serdev_device_get_cts(nxpdev->serdev)) {
> > +		bt_dev_dbg(hdev, "CTS high. Need FW Download");
> 
> I don't think it's a good idea to use CTS status to determine the BT FW status,
> because many uart drivers only support auto hardware flow control, and
> cannot return the CTS line state.
> Such as for LPUART, serdev_device_get_cts() will always return TIOCM_CTS,
> so here FW may never be downloaded.
I have reworked this part of code and we are now waiting for 1 second to see if we are receiving any bootloader signature from the chip, and downloading FW or moving ahead accordingly.

Please check the v6 patch for the changes.

Thanks,
Neeraj