2019-06-14 07:24:30

by Sascha Hauer

[permalink] [raw]
Subject: [PATCH 0/3] Marvell HCI fixes and serdev support

First two patches are a fix for the Marvell HCI driver which fails to
properly upload the firmware. Third patch adds simple serdev support
to the driver.

Sascha

Sascha Hauer (3):
Bluetooth: hci_ldisc: Add function to wait for characters to be sent
Bluetooth: hci_mrvl: Wait for final ack before switching baudrate
Bluetooth: hci_mrvl: Add serdev support

.../bindings/net/marvell-bluetooth.txt | 25 +++++++
drivers/bluetooth/Kconfig | 1 +
drivers/bluetooth/hci_ldisc.c | 8 +++
drivers/bluetooth/hci_mrvl.c | 72 ++++++++++++++++++-
drivers/bluetooth/hci_uart.h | 1 +
5 files changed, 106 insertions(+), 1 deletion(-)
create mode 100644 Documentation/devicetree/bindings/net/marvell-bluetooth.txt

--
2.20.1


2019-06-14 07:24:44

by Sascha Hauer

[permalink] [raw]
Subject: [PATCH 1/3] Bluetooth: hci_ldisc: Add function to wait for characters to be sent

The hci UART line discipline sends its characters in a workqueue. Some
devices like the Marvell Bluetooth chips need to make sure that all
queued characters are sent before switching the baudrate. This adds
a function to synchronize with the workqueue.

Signed-off-by: Sascha Hauer <[email protected]>
---
drivers/bluetooth/hci_ldisc.c | 8 ++++++++
drivers/bluetooth/hci_uart.h | 1 +
2 files changed, 9 insertions(+)

diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
index c84f985f348d..8950e07889fe 100644
--- a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -178,6 +178,7 @@ static void hci_uart_write_work(struct work_struct *work)
goto restart;

clear_bit(HCI_UART_SENDING, &hu->tx_state);
+ wake_up_bit(&hu->tx_state, HCI_UART_SENDING);
}

void hci_uart_init_work(struct work_struct *work)
@@ -213,6 +214,13 @@ int hci_uart_init_ready(struct hci_uart *hu)
return 0;
}

+int hci_uart_wait_until_sent(struct hci_uart *hu)
+{
+ return wait_on_bit_timeout(&hu->tx_state, HCI_UART_SENDING,
+ TASK_INTERRUPTIBLE,
+ msecs_to_jiffies(2000));
+}
+
/* ------- Interface to HCI layer ------ */
/* Reset device */
static int hci_uart_flush(struct hci_dev *hdev)
diff --git a/drivers/bluetooth/hci_uart.h b/drivers/bluetooth/hci_uart.h
index d8cf005e3c5d..f11af3912ce6 100644
--- a/drivers/bluetooth/hci_uart.h
+++ b/drivers/bluetooth/hci_uart.h
@@ -100,6 +100,7 @@ int hci_uart_register_device(struct hci_uart *hu, const struct hci_uart_proto *p
void hci_uart_unregister_device(struct hci_uart *hu);

int hci_uart_tx_wakeup(struct hci_uart *hu);
+int hci_uart_wait_until_sent(struct hci_uart *hu);
int hci_uart_init_ready(struct hci_uart *hu);
void hci_uart_init_work(struct work_struct *work);
void hci_uart_set_baudrate(struct hci_uart *hu, unsigned int speed);
--
2.20.1

2019-07-06 13:27:03

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [PATCH 0/3] Marvell HCI fixes and serdev support

Hallo Sascha,

> First two patches are a fix for the Marvell HCI driver which fails to
> properly upload the firmware. Third patch adds simple serdev support
> to the driver.
>
> Sascha
>
> Sascha Hauer (3):
> Bluetooth: hci_ldisc: Add function to wait for characters to be sent
> Bluetooth: hci_mrvl: Wait for final ack before switching baudrate
> Bluetooth: hci_mrvl: Add serdev support
>
> .../bindings/net/marvell-bluetooth.txt | 25 +++++++
> drivers/bluetooth/Kconfig | 1 +
> drivers/bluetooth/hci_ldisc.c | 8 +++
> drivers/bluetooth/hci_mrvl.c | 72 ++++++++++++++++++-
> drivers/bluetooth/hci_uart.h | 1 +
> 5 files changed, 106 insertions(+), 1 deletion(-)
> create mode 100644 Documentation/devicetree/bindings/net/marvell-bluetooth.txt

all 4 patches have been applied to bluetooth-next tree.

Regards

Marcel