Bluetooth: ath3k: workaround the compatibility issue with xHCI controller
authorAdam Lee <adam.lee@canonical.com>
Wed, 28 Jan 2015 20:30:27 +0000 (15:30 -0500)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 29 Jan 2015 18:12:21 +0000 (19:12 +0100)
BugLink: https://bugs.launchpad.net/bugs/1400215
ath3k devices fail to load firmwares on xHCI buses, but work well on
EHCI, this might be a compatibility issue between xHCI and ath3k chips.
As my testing result, those chips will work on xHCI buses again with
this patch.

This workaround is from Qualcomm, they also did some workarounds in
Windows driver.

Signed-off-by: Adam Lee <adam.lee@canonical.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
drivers/bluetooth/ath3k.c

index 13a64d0c69e28a219c7660da5a8295affcde91f7..de4c8499cbac958f0100f0004e38884839281729 100644 (file)
@@ -176,6 +176,8 @@ static const struct usb_device_id ath3k_blist_tbl[] = {
 #define USB_REQ_DFU_DNLOAD     1
 #define BULK_SIZE              4096
 #define FW_HDR_SIZE            20
+#define TIMEGAP_USEC_MIN       50
+#define TIMEGAP_USEC_MAX       100
 
 static int ath3k_load_firmware(struct usb_device *udev,
                                const struct firmware *firmware)
@@ -207,6 +209,9 @@ static int ath3k_load_firmware(struct usb_device *udev,
        pipe = usb_sndbulkpipe(udev, 0x02);
 
        while (count) {
+               /* workaround the compatibility issue with xHCI controller*/
+               usleep_range(TIMEGAP_USEC_MIN, TIMEGAP_USEC_MAX);
+
                size = min_t(uint, count, BULK_SIZE);
                memcpy(send_buf, firmware->data + sent, size);
 
@@ -304,6 +309,9 @@ static int ath3k_load_fwfile(struct usb_device *udev,
        pipe = usb_sndbulkpipe(udev, 0x02);
 
        while (count) {
+               /* workaround the compatibility issue with xHCI controller*/
+               usleep_range(TIMEGAP_USEC_MIN, TIMEGAP_USEC_MAX);
+
                size = min_t(uint, count, BULK_SIZE);
                memcpy(send_buf, firmware->data + sent, size);