diff options
author | Rajkumar Manoharan <rmanoharan@atheros.com> | 2010-11-19 06:23:22 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-11-24 16:19:41 -0500 |
commit | fa6e15e0b5952fd2cd99fc6d4f4473f6b9da18df (patch) | |
tree | d639e9f353110de10c3cefa8de4a1c2cd8280473 /drivers/net/wireless/ath/ath9k/hif_usb.c | |
parent | f7ec8fb4d6f8f3ecb8b11e9e46ece95aa66139cc (diff) |
ath9k_htc: Identify devices using driver_info
Categorize AR7010 & AR9287 devices based on driver_info
of usb_device_id, instead of PIDs. This avoids per-device cases
and minimize code changes for new device addition.
Signed-off-by: Rajkumar Manoharan <rmanoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/hif_usb.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hif_usb.c | 41 |
1 files changed, 14 insertions, 27 deletions
diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c index 6a0dbd153349..ae842dbf9b50 100644 --- a/drivers/net/wireless/ath/ath9k/hif_usb.c +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c | |||
@@ -786,7 +786,8 @@ static void ath9k_hif_usb_dealloc_urbs(struct hif_device_usb *hif_dev) | |||
786 | ath9k_hif_usb_dealloc_rx_urbs(hif_dev); | 786 | ath9k_hif_usb_dealloc_rx_urbs(hif_dev); |
787 | } | 787 | } |
788 | 788 | ||
789 | static int ath9k_hif_usb_download_fw(struct hif_device_usb *hif_dev) | 789 | static int ath9k_hif_usb_download_fw(struct hif_device_usb *hif_dev, |
790 | u32 drv_info) | ||
790 | { | 791 | { |
791 | int transfer, err; | 792 | int transfer, err; |
792 | const void *data = hif_dev->firmware->data; | 793 | const void *data = hif_dev->firmware->data; |
@@ -817,18 +818,10 @@ static int ath9k_hif_usb_download_fw(struct hif_device_usb *hif_dev) | |||
817 | } | 818 | } |
818 | kfree(buf); | 819 | kfree(buf); |
819 | 820 | ||
820 | switch (hif_dev->device_id) { | 821 | if (drv_info & AR7010_DEVICE) |
821 | case 0x7010: | ||
822 | case 0x7015: | ||
823 | case 0x9018: | ||
824 | case 0xA704: | ||
825 | case 0x1200: | ||
826 | firm_offset = AR7010_FIRMWARE_TEXT; | 822 | firm_offset = AR7010_FIRMWARE_TEXT; |
827 | break; | 823 | else |
828 | default: | ||
829 | firm_offset = AR9271_FIRMWARE_TEXT; | 824 | firm_offset = AR9271_FIRMWARE_TEXT; |
830 | break; | ||
831 | } | ||
832 | 825 | ||
833 | /* | 826 | /* |
834 | * Issue FW download complete command to firmware. | 827 | * Issue FW download complete command to firmware. |
@@ -846,7 +839,7 @@ static int ath9k_hif_usb_download_fw(struct hif_device_usb *hif_dev) | |||
846 | return 0; | 839 | return 0; |
847 | } | 840 | } |
848 | 841 | ||
849 | static int ath9k_hif_usb_dev_init(struct hif_device_usb *hif_dev) | 842 | static int ath9k_hif_usb_dev_init(struct hif_device_usb *hif_dev, u32 drv_info) |
850 | { | 843 | { |
851 | int ret, idx; | 844 | int ret, idx; |
852 | struct usb_host_interface *alt = &hif_dev->interface->altsetting[0]; | 845 | 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) | |||
862 | } | 855 | } |
863 | 856 | ||
864 | /* Download firmware */ | 857 | /* Download firmware */ |
865 | ret = ath9k_hif_usb_download_fw(hif_dev); | 858 | ret = ath9k_hif_usb_download_fw(hif_dev, drv_info); |
866 | if (ret) { | 859 | if (ret) { |
867 | dev_err(&hif_dev->udev->dev, | 860 | dev_err(&hif_dev->udev->dev, |
868 | "ath9k_htc: Firmware - %s download failed\n", | 861 | "ath9k_htc: Firmware - %s download failed\n", |
@@ -941,23 +934,15 @@ static int ath9k_hif_usb_probe(struct usb_interface *interface, | |||
941 | 934 | ||
942 | /* Find out which firmware to load */ | 935 | /* Find out which firmware to load */ |
943 | 936 | ||
944 | switch(hif_dev->device_id) { | 937 | if (id->driver_info & AR7010_DEVICE) |
945 | case 0x7010: | ||
946 | case 0x7015: | ||
947 | case 0x9018: | ||
948 | case 0xA704: | ||
949 | case 0x1200: | ||
950 | if (le16_to_cpu(udev->descriptor.bcdDevice) == 0x0202) | 938 | if (le16_to_cpu(udev->descriptor.bcdDevice) == 0x0202) |
951 | hif_dev->fw_name = FIRMWARE_AR7010_1_1; | 939 | hif_dev->fw_name = FIRMWARE_AR7010_1_1; |
952 | else | 940 | else |
953 | hif_dev->fw_name = FIRMWARE_AR7010; | 941 | hif_dev->fw_name = FIRMWARE_AR7010; |
954 | break; | 942 | else |
955 | default: | ||
956 | hif_dev->fw_name = FIRMWARE_AR9271; | 943 | hif_dev->fw_name = FIRMWARE_AR9271; |
957 | break; | ||
958 | } | ||
959 | 944 | ||
960 | ret = ath9k_hif_usb_dev_init(hif_dev); | 945 | ret = ath9k_hif_usb_dev_init(hif_dev, id->driver_info); |
961 | if (ret) { | 946 | if (ret) { |
962 | ret = -EINVAL; | 947 | ret = -EINVAL; |
963 | goto err_hif_init_usb; | 948 | goto err_hif_init_usb; |
@@ -965,7 +950,7 @@ static int ath9k_hif_usb_probe(struct usb_interface *interface, | |||
965 | 950 | ||
966 | ret = ath9k_htc_hw_init(hif_dev->htc_handle, | 951 | ret = ath9k_htc_hw_init(hif_dev->htc_handle, |
967 | &hif_dev->udev->dev, hif_dev->device_id, | 952 | &hif_dev->udev->dev, hif_dev->device_id, |
968 | hif_dev->udev->product); | 953 | hif_dev->udev->product, id->driver_info); |
969 | if (ret) { | 954 | if (ret) { |
970 | ret = -EINVAL; | 955 | ret = -EINVAL; |
971 | goto err_htc_hw_init; | 956 | goto err_htc_hw_init; |
@@ -1043,6 +1028,7 @@ static int ath9k_hif_usb_resume(struct usb_interface *interface) | |||
1043 | { | 1028 | { |
1044 | struct hif_device_usb *hif_dev = | 1029 | struct hif_device_usb *hif_dev = |
1045 | (struct hif_device_usb *) usb_get_intfdata(interface); | 1030 | (struct hif_device_usb *) usb_get_intfdata(interface); |
1031 | struct htc_target *htc_handle = hif_dev->htc_handle; | ||
1046 | int ret; | 1032 | int ret; |
1047 | 1033 | ||
1048 | ret = ath9k_hif_usb_alloc_urbs(hif_dev); | 1034 | ret = ath9k_hif_usb_alloc_urbs(hif_dev); |
@@ -1050,7 +1036,8 @@ static int ath9k_hif_usb_resume(struct usb_interface *interface) | |||
1050 | return ret; | 1036 | return ret; |
1051 | 1037 | ||
1052 | if (hif_dev->firmware) { | 1038 | if (hif_dev->firmware) { |
1053 | ret = ath9k_hif_usb_download_fw(hif_dev); | 1039 | ret = ath9k_hif_usb_download_fw(hif_dev, |
1040 | htc_handle->drv_priv->ah->common.driver_info); | ||
1054 | if (ret) | 1041 | if (ret) |
1055 | goto fail_resume; | 1042 | goto fail_resume; |
1056 | } else { | 1043 | } else { |
@@ -1060,7 +1047,7 @@ static int ath9k_hif_usb_resume(struct usb_interface *interface) | |||
1060 | 1047 | ||
1061 | mdelay(100); | 1048 | mdelay(100); |
1062 | 1049 | ||
1063 | ret = ath9k_htc_resume(hif_dev->htc_handle); | 1050 | ret = ath9k_htc_resume(htc_handle); |
1064 | 1051 | ||
1065 | if (ret) | 1052 | if (ret) |
1066 | goto fail_resume; | 1053 | goto fail_resume; |