Commit 5786781d authored by Adam Lee's avatar Adam Lee Committed by Ben Hutchings

Bluetooth: ath3k: workaround the compatibility issue with xHCI controller

commit c561a575 upstream.

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: default avatarAdam Lee <adam.lee@canonical.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 4c5bc740
...@@ -172,6 +172,8 @@ static struct usb_device_id ath3k_blist_tbl[] = { ...@@ -172,6 +172,8 @@ static struct usb_device_id ath3k_blist_tbl[] = {
#define USB_REQ_DFU_DNLOAD 1 #define USB_REQ_DFU_DNLOAD 1
#define BULK_SIZE 4096 #define BULK_SIZE 4096
#define FW_HDR_SIZE 20 #define FW_HDR_SIZE 20
#define TIMEGAP_USEC_MIN 50
#define TIMEGAP_USEC_MAX 100
static int ath3k_load_firmware(struct usb_device *udev, static int ath3k_load_firmware(struct usb_device *udev,
const struct firmware *firmware) const struct firmware *firmware)
...@@ -202,6 +204,9 @@ static int ath3k_load_firmware(struct usb_device *udev, ...@@ -202,6 +204,9 @@ static int ath3k_load_firmware(struct usb_device *udev,
count -= 20; count -= 20;
while (count) { while (count) {
/* workaround the compatibility issue with xHCI controller*/
usleep_range(TIMEGAP_USEC_MIN, TIMEGAP_USEC_MAX);
size = min_t(uint, count, BULK_SIZE); size = min_t(uint, count, BULK_SIZE);
pipe = usb_sndbulkpipe(udev, 0x02); pipe = usb_sndbulkpipe(udev, 0x02);
memcpy(send_buf, firmware->data + sent, size); memcpy(send_buf, firmware->data + sent, size);
...@@ -278,6 +283,9 @@ static int ath3k_load_fwfile(struct usb_device *udev, ...@@ -278,6 +283,9 @@ static int ath3k_load_fwfile(struct usb_device *udev,
count -= size; count -= size;
while (count) { while (count) {
/* workaround the compatibility issue with xHCI controller*/
usleep_range(TIMEGAP_USEC_MIN, TIMEGAP_USEC_MAX);
size = min_t(uint, count, BULK_SIZE); size = min_t(uint, count, BULK_SIZE);
pipe = usb_sndbulkpipe(udev, 0x02); pipe = usb_sndbulkpipe(udev, 0x02);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment