]> Pileus Git - ~andy/linux/blobdiff - drivers/net/wireless/ath/ath9k/hif_usb.c
Merge tag 'dm-3.12-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/device...
[~andy/linux] / drivers / net / wireless / ath / ath9k / hif_usb.c
index 9e582e14da74609361b689e5f5741d425fd14659..6d5d716adc1b85d24782b9e38b14c7ef2b0f504a 100644 (file)
@@ -115,10 +115,10 @@ static int hif_usb_send_regout(struct hif_device_usb *hif_dev,
        cmd->skb = skb;
        cmd->hif_dev = hif_dev;
 
-       usb_fill_bulk_urb(urb, hif_dev->udev,
-                        usb_sndbulkpipe(hif_dev->udev, USB_REG_OUT_PIPE),
+       usb_fill_int_urb(urb, hif_dev->udev,
+                        usb_sndintpipe(hif_dev->udev, USB_REG_OUT_PIPE),
                         skb->data, skb->len,
-                        hif_usb_regout_cb, cmd);
+                        hif_usb_regout_cb, cmd, 1);
 
        usb_anchor_urb(urb, &hif_dev->regout_submitted);
        ret = usb_submit_urb(urb, GFP_KERNEL);
@@ -723,11 +723,11 @@ static void ath9k_hif_usb_reg_in_cb(struct urb *urb)
                        return;
                }
 
-               usb_fill_bulk_urb(urb, hif_dev->udev,
-                                usb_rcvbulkpipe(hif_dev->udev,
+               usb_fill_int_urb(urb, hif_dev->udev,
+                                usb_rcvintpipe(hif_dev->udev,
                                                 USB_REG_IN_PIPE),
                                 nskb->data, MAX_REG_IN_BUF_SIZE,
-                                ath9k_hif_usb_reg_in_cb, nskb);
+                                ath9k_hif_usb_reg_in_cb, nskb, 1);
        }
 
 resubmit:
@@ -909,11 +909,11 @@ static int ath9k_hif_usb_alloc_reg_in_urbs(struct hif_device_usb *hif_dev)
                        goto err_skb;
                }
 
-               usb_fill_bulk_urb(urb, hif_dev->udev,
-                                 usb_rcvbulkpipe(hif_dev->udev,
+               usb_fill_int_urb(urb, hif_dev->udev,
+                                 usb_rcvintpipe(hif_dev->udev,
                                                  USB_REG_IN_PIPE),
                                  skb->data, MAX_REG_IN_BUF_SIZE,
-                                 ath9k_hif_usb_reg_in_cb, skb);
+                                 ath9k_hif_usb_reg_in_cb, skb, 1);
 
                /* Anchor URB */
                usb_anchor_urb(urb, &hif_dev->reg_in_submitted);
@@ -1031,9 +1031,7 @@ static int ath9k_hif_usb_download_fw(struct hif_device_usb *hif_dev)
 
 static int ath9k_hif_usb_dev_init(struct hif_device_usb *hif_dev)
 {
-       struct usb_host_interface *alt = &hif_dev->interface->altsetting[0];
-       struct usb_endpoint_descriptor *endp;
-       int ret, idx;
+       int ret;
 
        ret = ath9k_hif_usb_download_fw(hif_dev);
        if (ret) {
@@ -1043,20 +1041,6 @@ static int ath9k_hif_usb_dev_init(struct hif_device_usb *hif_dev)
                return ret;
        }
 
-       /* On downloading the firmware to the target, the USB descriptor of EP4
-        * is 'patched' to change the type of the endpoint to Bulk. This will
-        * bring down CPU usage during the scan period.
-        */
-       for (idx = 0; idx < alt->desc.bNumEndpoints; idx++) {
-               endp = &alt->endpoint[idx].desc;
-               if ((endp->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
-                               == USB_ENDPOINT_XFER_INT) {
-                       endp->bmAttributes &= ~USB_ENDPOINT_XFERTYPE_MASK;
-                       endp->bmAttributes |= USB_ENDPOINT_XFER_BULK;
-                       endp->bInterval = 0;
-               }
-       }
-
        /* Alloc URBs */
        ret = ath9k_hif_usb_alloc_urbs(hif_dev);
        if (ret) {
@@ -1082,7 +1066,7 @@ static void ath9k_hif_usb_firmware_fail(struct hif_device_usb *hif_dev)
        struct device *dev = &hif_dev->udev->dev;
        struct device *parent = dev->parent;
 
-       complete(&hif_dev->fw_done);
+       complete_all(&hif_dev->fw_done);
 
        if (parent)
                device_lock(parent);
@@ -1131,7 +1115,7 @@ static void ath9k_hif_usb_firmware_cb(const struct firmware *fw, void *context)
 
        release_firmware(fw);
        hif_dev->flags |= HIF_USB_READY;
-       complete(&hif_dev->fw_done);
+       complete_all(&hif_dev->fw_done);
 
        return;
 
@@ -1268,7 +1252,7 @@ static void ath9k_hif_usb_reboot(struct usb_device *udev)
        if (!buf)
                return;
 
-       ret = usb_bulk_msg(udev, usb_sndbulkpipe(udev, USB_REG_OUT_PIPE),
+       ret = usb_interrupt_msg(udev, usb_sndintpipe(udev, USB_REG_OUT_PIPE),
                           buf, 4, NULL, HZ);
        if (ret)
                dev_err(&udev->dev, "ath9k_htc: USB reboot failed\n");
@@ -1295,7 +1279,9 @@ static void ath9k_hif_usb_disconnect(struct usb_interface *interface)
 
        usb_set_intfdata(interface, NULL);
 
-       if (!unplugged && (hif_dev->flags & HIF_USB_START))
+       /* If firmware was loaded we should drop it
+        * go back to first stage bootloader. */
+       if (!unplugged && (hif_dev->flags & HIF_USB_READY))
                ath9k_hif_usb_reboot(udev);
 
        kfree(hif_dev);
@@ -1316,7 +1302,10 @@ static int ath9k_hif_usb_suspend(struct usb_interface *interface,
        if (!(hif_dev->flags & HIF_USB_START))
                ath9k_htc_suspend(hif_dev->htc_handle);
 
-       ath9k_hif_usb_dealloc_urbs(hif_dev);
+       wait_for_completion(&hif_dev->fw_done);
+
+       if (hif_dev->flags & HIF_USB_READY)
+               ath9k_hif_usb_dealloc_urbs(hif_dev);
 
        return 0;
 }