]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/net/wireless/ath/ath9k/hif_usb.c
ath9k_htc: Add new devices into AR7010
[net-next-2.6.git] / drivers / net / wireless / ath / ath9k / hif_usb.c
index 17e7a9a367e70340a42d13c57beb167bfd4979d3..dfb6560dab9205c7502cc0a546c3549635d696f2 100644 (file)
@@ -35,8 +35,14 @@ static struct usb_device_id ath9k_hif_usb_ids[] = {
        { USB_DEVICE(0x07D1, 0x3A10) }, /* Dlink Wireless 150 */
        { USB_DEVICE(0x13D3, 0x3327) }, /* Azurewave */
        { USB_DEVICE(0x13D3, 0x3328) }, /* Azurewave */
+       { USB_DEVICE(0x13D3, 0x3346) }, /* IMC Networks */
+       { USB_DEVICE(0x13D3, 0x3348) }, /* Azurewave */
+       { USB_DEVICE(0x13D3, 0x3349) }, /* Azurewave */
+       { USB_DEVICE(0x13D3, 0x3350) }, /* Azurewave */
        { USB_DEVICE(0x04CA, 0x4605) }, /* Liteon */
        { USB_DEVICE(0x083A, 0xA704) }, /* SMC Networks */
+       { USB_DEVICE(0x040D, 0x3801) }, /* VIA */
+       { USB_DEVICE(0x1668, 0x1200) }, /* Verizon */
        { },
 };
 
@@ -92,10 +98,10 @@ static int hif_usb_send_regout(struct hif_device_usb *hif_dev,
        cmd->skb = skb;
        cmd->hif_dev = hif_dev;
 
-       usb_fill_int_urb(urb, hif_dev->udev,
-                        usb_sndintpipe(hif_dev->udev, USB_REG_OUT_PIPE),
+       usb_fill_bulk_urb(urb, hif_dev->udev,
+                        usb_sndbulkpipe(hif_dev->udev, USB_REG_OUT_PIPE),
                         skb->data, skb->len,
-                        hif_usb_regout_cb, cmd, 1);
+                        hif_usb_regout_cb, cmd);
 
        usb_anchor_urb(urb, &hif_dev->regout_submitted);
        ret = usb_submit_urb(urb, GFP_KERNEL);
@@ -540,10 +546,11 @@ static void ath9k_hif_usb_reg_in_cb(struct urb *urb)
                        return;
                }
 
-               usb_fill_int_urb(urb, hif_dev->udev,
-                                usb_rcvintpipe(hif_dev->udev, USB_REG_IN_PIPE),
+               usb_fill_bulk_urb(urb, hif_dev->udev,
+                                usb_rcvbulkpipe(hif_dev->udev,
+                                                USB_REG_IN_PIPE),
                                 nskb->data, MAX_REG_IN_BUF_SIZE,
-                                ath9k_hif_usb_reg_in_cb, nskb, 1);
+                                ath9k_hif_usb_reg_in_cb, nskb);
 
                ret = usb_submit_urb(urb, GFP_ATOMIC);
                if (ret) {
@@ -719,10 +726,11 @@ static int ath9k_hif_usb_alloc_reg_in_urb(struct hif_device_usb *hif_dev)
        if (!skb)
                goto err;
 
-       usb_fill_int_urb(hif_dev->reg_in_urb, hif_dev->udev,
-                        usb_rcvintpipe(hif_dev->udev, USB_REG_IN_PIPE),
+       usb_fill_bulk_urb(hif_dev->reg_in_urb, hif_dev->udev,
+                        usb_rcvbulkpipe(hif_dev->udev,
+                                        USB_REG_IN_PIPE),
                         skb->data, MAX_REG_IN_BUF_SIZE,
-                        ath9k_hif_usb_reg_in_cb, skb, 1);
+                        ath9k_hif_usb_reg_in_cb, skb);
 
        if (usb_submit_urb(hif_dev->reg_in_urb, GFP_KERNEL) != 0)
                goto err;
@@ -799,10 +807,18 @@ static int ath9k_hif_usb_download_fw(struct hif_device_usb *hif_dev)
        }
        kfree(buf);
 
-       if ((hif_dev->device_id == 0x7010) || (hif_dev->device_id == 0x7015))
+       switch (hif_dev->device_id) {
+       case 0x7010:
+       case 0x7015:
+       case 0x9018:
+       case 0xA704:
+       case 0x1200:
                firm_offset = AR7010_FIRMWARE_TEXT;
-       else
+               break;
+       default:
                firm_offset = AR9271_FIRMWARE_TEXT;
+               break;
+       }
 
        /*
         * Issue FW download complete command to firmware.
@@ -822,7 +838,9 @@ 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)
 {
-       int ret;
+       int ret, idx;
+       struct usb_host_interface *alt = &hif_dev->interface->altsetting[0];
+       struct usb_endpoint_descriptor *endp;
 
        /* Request firmware */
        ret = request_firmware(&hif_dev->firmware, hif_dev->fw_name,
@@ -833,14 +851,6 @@ static int ath9k_hif_usb_dev_init(struct hif_device_usb *hif_dev)
                goto err_fw_req;
        }
 
-       /* Alloc URBs */
-       ret = ath9k_hif_usb_alloc_urbs(hif_dev);
-       if (ret) {
-               dev_err(&hif_dev->udev->dev,
-                       "ath9k_htc: Unable to allocate URBs\n");
-               goto err_urb;
-       }
-
        /* Download firmware */
        ret = ath9k_hif_usb_download_fw(hif_dev);
        if (ret) {
@@ -850,6 +860,28 @@ static int ath9k_hif_usb_dev_init(struct hif_device_usb *hif_dev)
                goto err_fw_download;
        }
 
+       /* 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) {
+               dev_err(&hif_dev->udev->dev,
+                       "ath9k_htc: Unable to allocate URBs\n");
+               goto err_urb;
+       }
+
        return 0;
 
 err_fw_download:
@@ -903,6 +935,8 @@ static int ath9k_hif_usb_probe(struct usb_interface *interface,
        case 0x7010:
        case 0x7015:
        case 0x9018:
+       case 0xA704:
+       case 0x1200:
                if (le16_to_cpu(udev->descriptor.bcdDevice) == 0x0202)
                        hif_dev->fw_name = FIRMWARE_AR7010_1_1;
                else
@@ -920,7 +954,8 @@ static int ath9k_hif_usb_probe(struct usb_interface *interface,
        }
 
        ret = ath9k_htc_hw_init(hif_dev->htc_handle,
-                               &hif_dev->udev->dev, hif_dev->device_id);
+                               &hif_dev->udev->dev, hif_dev->device_id,
+                               hif_dev->udev->product);
        if (ret) {
                ret = -EINVAL;
                goto err_htc_hw_init;