]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/net/wireless/ath/ath9k/hif_usb.c
ath9k_htc: Identify devices using driver_info
[karo-tx-linux.git] / drivers / net / wireless / ath / ath9k / hif_usb.c
index 6a0dbd153349d1bbf556d54cf021db7bcefea5ef..ae842dbf9b5087a5ea456a2f241eb9ff806fe061 100644 (file)
@@ -786,7 +786,8 @@ static void ath9k_hif_usb_dealloc_urbs(struct hif_device_usb *hif_dev)
        ath9k_hif_usb_dealloc_rx_urbs(hif_dev);
 }
 
-static int ath9k_hif_usb_download_fw(struct hif_device_usb *hif_dev)
+static int ath9k_hif_usb_download_fw(struct hif_device_usb *hif_dev,
+                                    u32 drv_info)
 {
        int transfer, err;
        const void *data = hif_dev->firmware->data;
@@ -817,18 +818,10 @@ static int ath9k_hif_usb_download_fw(struct hif_device_usb *hif_dev)
        }
        kfree(buf);
 
-       switch (hif_dev->device_id) {
-       case 0x7010:
-       case 0x7015:
-       case 0x9018:
-       case 0xA704:
-       case 0x1200:
+       if (drv_info & AR7010_DEVICE)
                firm_offset = AR7010_FIRMWARE_TEXT;
-               break;
-       default:
+       else
                firm_offset = AR9271_FIRMWARE_TEXT;
-               break;
-       }
 
        /*
         * Issue FW download complete command to firmware.
@@ -846,7 +839,7 @@ static int ath9k_hif_usb_download_fw(struct hif_device_usb *hif_dev)
        return 0;
 }
 
-static int ath9k_hif_usb_dev_init(struct hif_device_usb *hif_dev)
+static int ath9k_hif_usb_dev_init(struct hif_device_usb *hif_dev, u32 drv_info)
 {
        int ret, idx;
        struct usb_host_interface *alt = &hif_dev->interface->altsetting[0];
@@ -862,7 +855,7 @@ static int ath9k_hif_usb_dev_init(struct hif_device_usb *hif_dev)
        }
 
        /* Download firmware */
-       ret = ath9k_hif_usb_download_fw(hif_dev);
+       ret = ath9k_hif_usb_download_fw(hif_dev, drv_info);
        if (ret) {
                dev_err(&hif_dev->udev->dev,
                        "ath9k_htc: Firmware - %s download failed\n",
@@ -941,23 +934,15 @@ static int ath9k_hif_usb_probe(struct usb_interface *interface,
 
        /* Find out which firmware to load */
 
-       switch(hif_dev->device_id) {
-       case 0x7010:
-       case 0x7015:
-       case 0x9018:
-       case 0xA704:
-       case 0x1200:
+       if (id->driver_info & AR7010_DEVICE)
                if (le16_to_cpu(udev->descriptor.bcdDevice) == 0x0202)
                        hif_dev->fw_name = FIRMWARE_AR7010_1_1;
                else
                        hif_dev->fw_name = FIRMWARE_AR7010;
-               break;
-       default:
+       else
                hif_dev->fw_name = FIRMWARE_AR9271;
-               break;
-       }
 
-       ret = ath9k_hif_usb_dev_init(hif_dev);
+       ret = ath9k_hif_usb_dev_init(hif_dev, id->driver_info);
        if (ret) {
                ret = -EINVAL;
                goto err_hif_init_usb;
@@ -965,7 +950,7 @@ 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->product);
+                               hif_dev->udev->product, id->driver_info);
        if (ret) {
                ret = -EINVAL;
                goto err_htc_hw_init;
@@ -1043,6 +1028,7 @@ static int ath9k_hif_usb_resume(struct usb_interface *interface)
 {
        struct hif_device_usb *hif_dev =
                (struct hif_device_usb *) usb_get_intfdata(interface);
+       struct htc_target *htc_handle = hif_dev->htc_handle;
        int ret;
 
        ret = ath9k_hif_usb_alloc_urbs(hif_dev);
@@ -1050,7 +1036,8 @@ static int ath9k_hif_usb_resume(struct usb_interface *interface)
                return ret;
 
        if (hif_dev->firmware) {
-               ret = ath9k_hif_usb_download_fw(hif_dev);
+               ret = ath9k_hif_usb_download_fw(hif_dev,
+                               htc_handle->drv_priv->ah->common.driver_info);
                if (ret)
                        goto fail_resume;
        } else {
@@ -1060,7 +1047,7 @@ static int ath9k_hif_usb_resume(struct usb_interface *interface)
 
        mdelay(100);
 
-       ret = ath9k_htc_resume(hif_dev->htc_handle);
+       ret = ath9k_htc_resume(htc_handle);
 
        if (ret)
                goto fail_resume;