Bluetooth: btusb: Fix atheros firmware download error
[cascardo/linux.git] / drivers / bluetooth / btusb.c
index 811f9b9..2f633df 100644 (file)
@@ -62,6 +62,7 @@ static struct usb_driver btusb_driver;
 #define BTUSB_REALTEK          0x20000
 #define BTUSB_BCM2045          0x40000
 #define BTUSB_IFNUM_2          0x80000
+#define BTUSB_CW6622           0x100000
 
 static const struct usb_device_id btusb_table[] = {
        /* Generic Bluetooth USB device */
@@ -248,9 +249,11 @@ static const struct usb_device_id blacklist_table[] = {
 
        /* QCA ROME chipset */
        { USB_DEVICE(0x0cf3, 0xe007), .driver_info = BTUSB_QCA_ROME },
+       { USB_DEVICE(0x0cf3, 0xe009), .driver_info = BTUSB_QCA_ROME },
        { USB_DEVICE(0x0cf3, 0xe300), .driver_info = BTUSB_QCA_ROME },
        { USB_DEVICE(0x0cf3, 0xe360), .driver_info = BTUSB_QCA_ROME },
        { USB_DEVICE(0x0489, 0xe092), .driver_info = BTUSB_QCA_ROME },
+       { USB_DEVICE(0x04ca, 0x3011), .driver_info = BTUSB_QCA_ROME },
 
        /* Broadcom BCM2035 */
        { USB_DEVICE(0x0a5c, 0x2009), .driver_info = BTUSB_BCM92035 },
@@ -290,7 +293,8 @@ static const struct usb_device_id blacklist_table[] = {
        { USB_DEVICE(0x0400, 0x080a), .driver_info = BTUSB_BROKEN_ISOC },
 
        /* CONWISE Technology based adapters with buggy SCO support */
-       { USB_DEVICE(0x0e5e, 0x6622), .driver_info = BTUSB_BROKEN_ISOC },
+       { USB_DEVICE(0x0e5e, 0x6622),
+         .driver_info = BTUSB_BROKEN_ISOC | BTUSB_CW6622},
 
        /* Roper Class 1 Bluetooth Dongle (Silicon Wave based) */
        { USB_DEVICE(0x1310, 0x0001), .driver_info = BTUSB_SWAVE },
@@ -310,6 +314,7 @@ static const struct usb_device_id blacklist_table[] = {
        /* Marvell Bluetooth devices */
        { USB_DEVICE(0x1286, 0x2044), .driver_info = BTUSB_MARVELL },
        { USB_DEVICE(0x1286, 0x2046), .driver_info = BTUSB_MARVELL },
+       { USB_DEVICE(0x1286, 0x204e), .driver_info = BTUSB_MARVELL },
 
        /* Intel Bluetooth devices */
        { USB_DEVICE(0x8087, 0x07da), .driver_info = BTUSB_CSR },
@@ -1038,6 +1043,10 @@ static int btusb_open(struct hci_dev *hdev)
 
        BT_DBG("%s", hdev->name);
 
+       err = usb_autopm_get_interface(data->intf);
+       if (err < 0)
+               return err;
+
        /* Patching USB firmware files prior to starting any URBs of HCI path
         * It is more safe to use USB bulk channel for downloading USB patch
         */
@@ -1047,10 +1056,6 @@ static int btusb_open(struct hci_dev *hdev)
                        return err;
        }
 
-       err = usb_autopm_get_interface(data->intf);
-       if (err < 0)
-               return err;
-
        data->intf->needs_remote_wakeup = 1;
 
        if (test_and_set_bit(BTUSB_INTR_RUNNING, &data->flags))
@@ -2221,9 +2226,8 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
        err = wait_on_bit_timeout(&data->flags, BTUSB_DOWNLOADING,
                                  TASK_INTERRUPTIBLE,
                                  msecs_to_jiffies(5000));
-       if (err == 1) {
+       if (err == -EINTR) {
                BT_ERR("%s: Firmware loading interrupted", hdev->name);
-               err = -EINTR;
                goto done;
        }
 
@@ -2275,7 +2279,7 @@ done:
                                  TASK_INTERRUPTIBLE,
                                  msecs_to_jiffies(1000));
 
-       if (err == 1) {
+       if (err == -EINTR) {
                BT_ERR("%s: Device boot interrupted", hdev->name);
                return -EINTR;
        }
@@ -2845,6 +2849,9 @@ static int btusb_probe(struct usb_interface *intf,
        hdev->send   = btusb_send_frame;
        hdev->notify = btusb_notify;
 
+       if (id->driver_info & BTUSB_CW6622)
+               set_bit(HCI_QUIRK_BROKEN_STORED_LINK_KEY, &hdev->quirks);
+
        if (id->driver_info & BTUSB_BCM2045)
                set_bit(HCI_QUIRK_BROKEN_STORED_LINK_KEY, &hdev->quirks);