From: Raghuram Hegde <[email protected]>
Once Firmware download is complete, BULK IN URBs need not be
programmed till the Intel Bluetooth controller switches from
bootloader to operational firmware, as there will not be any data
sent on BULK IN endpoint.
If BULK IN URBs are programmed during this time, a USB turn-around
time error is seen for BULK IN tokens. This results in XHCI resetting
the endpoint data toggle sequence leading to data sequence sync-loss
between Host XHCI controller and Bluetooth controller.
The following fix is required to prevent data sequence sync-loss:
Kill the BULK IN URBs once FW download is complete and re-submit them
after Intel BT controller has booted to operational firmware.
Signed-off-by: Raghuram Hegde <[email protected]>
Signed-off-by: Chethan T N <[email protected]>
Cc: [email protected]
---
drivers/bluetooth/btusb.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index ded198328f21..e656acdfd84a 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -2332,6 +2332,15 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
duration = (unsigned long long) ktime_to_ns(delta) >> 10;
bt_dev_info(hdev, "Firmware loaded in %llu usecs", duration);
+
+ /* Once Firmware download is complete, Bulk endpoints will not be
+ * used until the Bluetooth controller boots with operational
+ * firmware. If we have the Bulk URBs scheduled when Intel Bluetooth
+ * controller switches from bootloader to operational firmware, we
+ * observe Bus Turn-around timeouts for Bulk IN tokens.So, to prevent
+ * such error condition, kill the URBs scheduled on Bulk endpoint.
+ */
+ usb_kill_anchored_urbs(&data->bulk_anchor);
done:
release_firmware(fw);
@@ -2395,6 +2404,18 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
*/
btintel_set_event_mask(hdev, false);
+ /* As the Intel bluetooth controller has now booted in operational
+ * mode, re-program the URBs for BULK IN endpoint
+ */
+ if (test_bit(BTUSB_BULK_RUNNING, &data->flags)) {
+ err = btusb_submit_bulk_urb(hdev, GFP_NOIO);
+ if (err < 0) {
+ clear_bit(BTUSB_BULK_RUNNING, &data->flags);
+ return err;
+ }
+ btusb_submit_bulk_urb(hdev, GFP_NOIO);
+ }
+
return 0;
}
--
2.7.4
Hi Sasha,
Please consider this patch for stable kernel releases from v4.4.176 onwards, as the support for Intel RAM based Bluetooth products is missing in the v3.18.136.
Thanks,
Raghuram
-----Original Message-----
From: Sasha Levin [mailto:[email protected]]
Sent: Monday, March 25, 2019 6:09 AM
To: Sasha Levin <[email protected]>; Tumkur Narayan, Chethan <[email protected]>; Hegde, Raghuram <[email protected]>; [email protected]
Cc: Hegde, Raghuram <[email protected]>; [email protected]; [email protected]
Subject: Re: [PATCH] btusb: Re-program BULK IN URBs once the Intel BT controller is in operational firmware mode.
Hi,
[This is an automated email]
This commit has been processed because it contains a -stable tag.
The stable tag indicates that it's relevant for the following trees: all
The bot has tested the following trees: v5.0.3, v4.19.30, v4.14.107, v4.9.164, v4.4.176, v3.18.136.
v5.0.3: Build OK!
v4.19.30: Build OK!
v4.14.107: Build OK!
v4.9.164: Build OK!
v4.4.176: Build OK!
v3.18.136: Failed to apply! Possible dependencies:
17b2772b8fe3 ("Bluetooth: Read Broadcom chip info for Apple Bluetooth devices")
18835dfa3ac5 ("Bluetooth: btusb: Use matching names for Broadcom firmware files")
1df1f5910825 ("Bluetooth: btusb: Use generic functionality by Broadcom module")
213445b2b40e ("Bluetooth: btintel: Enable extra Intel vendor events")
2cbd3f5ccd43 ("Bluetooth: btusb: Add internal callback for USB bulk rx data")
3267c884cefa ("Bluetooth: btusb: Add support for QCA ROME chipset family")
385a768c3be1 ("Bluetooth: btusb: Provide hardware error handler for Intel devices")
4185a0f5d043 ("Bluetooth: btusb: Use generic Intel support for address support")
48f0ed1bb685 ("Bluetooth: btintel: Introduce generic Intel Bluetooth support")
4fba30f07f51 ("Bluetooth: btbcm: Introduce generic Broadcom Bluetooth support")
4fcef8ed75af ("Bluetooth: Fix issue with Roper Class 1 Bluetooth Dongle")
6d2e50d24098 ("Bluetooth: btintel: Add support for enabling tracing functionality")
893ba5440a25 ("Bluetooth: btusb: Add support for USB based AMP controllers")
97307f51d7ce ("Bluetooth: btusb: Add internal recv_event callback for event processing")
973bb97e5aee ("Bluetooth: btintel: Add generic function for handling hardware errors")
bfbd45e9acd2 ("Bluetooth: Add device shutdown routine for Intel Bluetooth device")
cda0dd7809f8 ("Bluetooth: btusb: Add firmware loading for Intel Snowfield Peak devices")
d57dbe779e0e ("Bluetooth: btusb: Set the HCI_QUIRK_BROKEN_LOCAL_COMMANDS quirk")
d8270fbb3ffe ("Bluetooth: btintel: Set quirk for non-persistent diagnostic settings")
eeb6abe97390 ("Bluetooth: btusb: Use hardware error handler from Intel module")
How should we proceed with this patch?
--
Thanks,
Sasha