aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/ath/ath9k/hif_usb.c41
-rw-r--r--drivers/net/wireless/ath/ath9k/htc.h2
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_init.c35
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_hst.c5
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_hst.h3
-rw-r--r--drivers/net/wireless/ath/ath9k/reg.h6
6 files changed, 37 insertions, 55 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
789static int ath9k_hif_usb_download_fw(struct hif_device_usb *hif_dev) 789static 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
849static int ath9k_hif_usb_dev_init(struct hif_device_usb *hif_dev) 842static 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;
diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/ath/ath9k/htc.h
index db00289103fc..afe39a911906 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -461,7 +461,7 @@ void ath9k_init_leds(struct ath9k_htc_priv *priv);
461void ath9k_deinit_leds(struct ath9k_htc_priv *priv); 461void ath9k_deinit_leds(struct ath9k_htc_priv *priv);
462 462
463int ath9k_htc_probe_device(struct htc_target *htc_handle, struct device *dev, 463int ath9k_htc_probe_device(struct htc_target *htc_handle, struct device *dev,
464 u16 devid, char *product); 464 u16 devid, char *product, u32 drv_info);
465void ath9k_htc_disconnect_device(struct htc_target *htc_handle, bool hotunplug); 465void ath9k_htc_disconnect_device(struct htc_target *htc_handle, bool hotunplug);
466#ifdef CONFIG_PM 466#ifdef CONFIG_PM
467int ath9k_htc_resume(struct htc_target *htc_handle); 467int ath9k_htc_resume(struct htc_target *htc_handle);
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
index cba904a3e320..071d0c974747 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
@@ -181,7 +181,8 @@ static inline int ath9k_htc_connect_svc(struct ath9k_htc_priv *priv,
181 return htc_connect_service(priv->htc, &req, ep_id); 181 return htc_connect_service(priv->htc, &req, ep_id);
182} 182}
183 183
184static int ath9k_init_htc_services(struct ath9k_htc_priv *priv, u16 devid) 184static int ath9k_init_htc_services(struct ath9k_htc_priv *priv, u16 devid,
185 u32 drv_info)
185{ 186{
186 int ret; 187 int ret;
187 188
@@ -245,17 +246,10 @@ static int ath9k_init_htc_services(struct ath9k_htc_priv *priv, u16 devid)
245 * the HIF layer, shouldn't matter much. 246 * the HIF layer, shouldn't matter much.
246 */ 247 */
247 248
248 switch(devid) { 249 if (drv_info & AR7010_DEVICE)
249 case 0x7010:
250 case 0x7015:
251 case 0x9018:
252 case 0xA704:
253 case 0x1200:
254 priv->htc->credits = 45; 250 priv->htc->credits = 45;
255 break; 251 else
256 default:
257 priv->htc->credits = 33; 252 priv->htc->credits = 33;
258 }
259 253
260 ret = htc_init(priv->htc); 254 ret = htc_init(priv->htc);
261 if (ret) 255 if (ret)
@@ -627,7 +621,8 @@ static void ath9k_init_btcoex(struct ath9k_htc_priv *priv)
627} 621}
628 622
629static int ath9k_init_priv(struct ath9k_htc_priv *priv, 623static int ath9k_init_priv(struct ath9k_htc_priv *priv,
630 u16 devid, char *product) 624 u16 devid, char *product,
625 u32 drv_info)
631{ 626{
632 struct ath_hw *ah = NULL; 627 struct ath_hw *ah = NULL;
633 struct ath_common *common; 628 struct ath_common *common;
@@ -651,6 +646,7 @@ static int ath9k_init_priv(struct ath9k_htc_priv *priv,
651 common->hw = priv->hw; 646 common->hw = priv->hw;
652 common->priv = priv; 647 common->priv = priv;
653 common->debug_mask = ath9k_debug; 648 common->debug_mask = ath9k_debug;
649 common->driver_info = drv_info;
654 650
655 spin_lock_init(&priv->wmi->wmi_lock); 651 spin_lock_init(&priv->wmi->wmi_lock);
656 spin_lock_init(&priv->beacon_lock); 652 spin_lock_init(&priv->beacon_lock);
@@ -763,7 +759,7 @@ static void ath9k_set_hw_capab(struct ath9k_htc_priv *priv,
763} 759}
764 760
765static int ath9k_init_device(struct ath9k_htc_priv *priv, 761static int ath9k_init_device(struct ath9k_htc_priv *priv,
766 u16 devid, char *product) 762 u16 devid, char *product, u32 drv_info)
767{ 763{
768 struct ieee80211_hw *hw = priv->hw; 764 struct ieee80211_hw *hw = priv->hw;
769 struct ath_common *common; 765 struct ath_common *common;
@@ -772,7 +768,7 @@ static int ath9k_init_device(struct ath9k_htc_priv *priv,
772 struct ath_regulatory *reg; 768 struct ath_regulatory *reg;
773 769
774 /* Bring up device */ 770 /* Bring up device */
775 error = ath9k_init_priv(priv, devid, product); 771 error = ath9k_init_priv(priv, devid, product, drv_info);
776 if (error != 0) 772 if (error != 0)
777 goto err_init; 773 goto err_init;
778 774
@@ -830,7 +826,7 @@ err_init:
830} 826}
831 827
832int ath9k_htc_probe_device(struct htc_target *htc_handle, struct device *dev, 828int ath9k_htc_probe_device(struct htc_target *htc_handle, struct device *dev,
833 u16 devid, char *product) 829 u16 devid, char *product, u32 drv_info)
834{ 830{
835 struct ieee80211_hw *hw; 831 struct ieee80211_hw *hw;
836 struct ath9k_htc_priv *priv; 832 struct ath9k_htc_priv *priv;
@@ -857,14 +853,14 @@ int ath9k_htc_probe_device(struct htc_target *htc_handle, struct device *dev,
857 goto err_free; 853 goto err_free;
858 } 854 }
859 855
860 ret = ath9k_init_htc_services(priv, devid); 856 ret = ath9k_init_htc_services(priv, devid, drv_info);
861 if (ret) 857 if (ret)
862 goto err_init; 858 goto err_init;
863 859
864 /* The device may have been unplugged earlier. */ 860 /* The device may have been unplugged earlier. */
865 priv->op_flags &= ~OP_UNPLUGGED; 861 priv->op_flags &= ~OP_UNPLUGGED;
866 862
867 ret = ath9k_init_device(priv, devid, product); 863 ret = ath9k_init_device(priv, devid, product, drv_info);
868 if (ret) 864 if (ret)
869 goto err_init; 865 goto err_init;
870 866
@@ -894,14 +890,15 @@ void ath9k_htc_disconnect_device(struct htc_target *htc_handle, bool hotunplug)
894#ifdef CONFIG_PM 890#ifdef CONFIG_PM
895int ath9k_htc_resume(struct htc_target *htc_handle) 891int ath9k_htc_resume(struct htc_target *htc_handle)
896{ 892{
893 struct ath9k_htc_priv *priv = htc_handle->drv_priv;
897 int ret; 894 int ret;
898 895
899 ret = ath9k_htc_wait_for_target(htc_handle->drv_priv); 896 ret = ath9k_htc_wait_for_target(priv);
900 if (ret) 897 if (ret)
901 return ret; 898 return ret;
902 899
903 ret = ath9k_init_htc_services(htc_handle->drv_priv, 900 ret = ath9k_init_htc_services(priv, priv->ah->hw_version.devid,
904 htc_handle->drv_priv->ah->hw_version.devid); 901 priv->ah->common.driver_info);
905 return ret; 902 return ret;
906} 903}
907#endif 904#endif
diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.c b/drivers/net/wireless/ath/ath9k/htc_hst.c
index 861ec9269309..c41ab8c30161 100644
--- a/drivers/net/wireless/ath/ath9k/htc_hst.c
+++ b/drivers/net/wireless/ath/ath9k/htc_hst.c
@@ -462,9 +462,10 @@ void ath9k_htc_hw_free(struct htc_target *htc)
462} 462}
463 463
464int ath9k_htc_hw_init(struct htc_target *target, 464int ath9k_htc_hw_init(struct htc_target *target,
465 struct device *dev, u16 devid, char *product) 465 struct device *dev, u16 devid,
466 char *product, u32 drv_info)
466{ 467{
467 if (ath9k_htc_probe_device(target, dev, devid, product)) { 468 if (ath9k_htc_probe_device(target, dev, devid, product, drv_info)) {
468 printk(KERN_ERR "Failed to initialize the device\n"); 469 printk(KERN_ERR "Failed to initialize the device\n");
469 return -ENODEV; 470 return -ENODEV;
470 } 471 }
diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.h b/drivers/net/wireless/ath/ath9k/htc_hst.h
index 07b6509d5896..6fc1b21faa5d 100644
--- a/drivers/net/wireless/ath/ath9k/htc_hst.h
+++ b/drivers/net/wireless/ath/ath9k/htc_hst.h
@@ -239,7 +239,8 @@ struct htc_target *ath9k_htc_hw_alloc(void *hif_handle,
239 struct device *dev); 239 struct device *dev);
240void ath9k_htc_hw_free(struct htc_target *htc); 240void ath9k_htc_hw_free(struct htc_target *htc);
241int ath9k_htc_hw_init(struct htc_target *target, 241int ath9k_htc_hw_init(struct htc_target *target,
242 struct device *dev, u16 devid, char *product); 242 struct device *dev, u16 devid, char *product,
243 u32 drv_info);
243void ath9k_htc_hw_deinit(struct htc_target *target, bool hot_unplug); 244void ath9k_htc_hw_deinit(struct htc_target *target, bool hot_unplug);
244 245
245#endif /* HTC_HST_H */ 246#endif /* HTC_HST_H */
diff --git a/drivers/net/wireless/ath/ath9k/reg.h b/drivers/net/wireless/ath/ath9k/reg.h
index 9d68237e4d9c..a597cc8d8644 100644
--- a/drivers/net/wireless/ath/ath9k/reg.h
+++ b/drivers/net/wireless/ath/ath9k/reg.h
@@ -864,11 +864,7 @@
864 ((REG_READ(_ah, AR_AN_SYNTH9) & 0x7) == 0x1)) 864 ((REG_READ(_ah, AR_AN_SYNTH9) & 0x7) == 0x1))
865 865
866#define AR_DEVID_7010(_ah) \ 866#define AR_DEVID_7010(_ah) \
867 (((_ah)->hw_version.devid == 0x7010) || \ 867 ((_ah)->common.driver_info & AR7010_DEVICE)
868 ((_ah)->hw_version.devid == 0x7015) || \
869 ((_ah)->hw_version.devid == 0x9018) || \
870 ((_ah)->hw_version.devid == 0xA704) || \
871 ((_ah)->hw_version.devid == 0x1200))
872 868
873#define AR_RADIO_SREV_MAJOR 0xf0 869#define AR_RADIO_SREV_MAJOR 0xf0
874#define AR_RAD5133_SREV_MAJOR 0xc0 870#define AR_RAD5133_SREV_MAJOR 0xc0