diff options
author | Sujith Manoharan <Sujith.Manoharan@atheros.com> | 2010-12-07 06:01:38 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-12-07 17:08:06 -0500 |
commit | 0b5ead91cda63e0db964dadc77601233434f60cb (patch) | |
tree | 989e877003120c769f8d155dee129033f96029f2 /drivers/net/wireless | |
parent | c658e5db01117bf2a321a9a782754dd5b10e2f15 (diff) |
ath9k_htc: Cleanup device identification
ath.ko is a common module shared between ath5k, ar9170usb, ath9k and ath9k_htc.
Adding driver specific data to the shared structure would impact all the
drivers. Handling USB device recognition for devices specific to ath9k_htc
can be handled within the driver itself.
Also, AR7010 refers to the processor used in both AR9280/AR9287 based
devices. Rename the device enumerations accordingly.
While at it, check properly for the bus type when choosing the EEPROM
base address for UB95.
Signed-off-by: Sujith Manoharan <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/ath/ath.h | 6 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/eeprom_9287.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hif_usb.c | 32 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hif_usb.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/htc_drv_init.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/reg.h | 8 |
7 files changed, 31 insertions, 30 deletions
diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h index 272dfef25453..3eb95e268f03 100644 --- a/drivers/net/wireless/ath/ath.h +++ b/drivers/net/wireless/ath/ath.h | |||
@@ -104,11 +104,6 @@ enum ath_cipher { | |||
104 | ATH_CIPHER_MIC = 127 | 104 | ATH_CIPHER_MIC = 127 |
105 | }; | 105 | }; |
106 | 106 | ||
107 | enum ath_drv_info { | ||
108 | AR7010_DEVICE = BIT(0), | ||
109 | AR9287_DEVICE = BIT(1), | ||
110 | }; | ||
111 | |||
112 | /** | 107 | /** |
113 | * struct ath_ops - Register read/write operations | 108 | * struct ath_ops - Register read/write operations |
114 | * | 109 | * |
@@ -153,7 +148,6 @@ struct ath_common { | |||
153 | u8 rx_chainmask; | 148 | u8 rx_chainmask; |
154 | 149 | ||
155 | u32 rx_bufsize; | 150 | u32 rx_bufsize; |
156 | u32 driver_info; | ||
157 | 151 | ||
158 | u32 keymax; | 152 | u32 keymax; |
159 | DECLARE_BITMAP(keymap, ATH_KEYMAX); | 153 | DECLARE_BITMAP(keymap, ATH_KEYMAX); |
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_9287.c b/drivers/net/wireless/ath/ath9k/eeprom_9287.c index 9ec4bc80f758..065402f2e402 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c +++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c | |||
@@ -37,10 +37,10 @@ static bool ath9k_hw_ar9287_fill_eeprom(struct ath_hw *ah) | |||
37 | int addr, eep_start_loc; | 37 | int addr, eep_start_loc; |
38 | eep_data = (u16 *)eep; | 38 | eep_data = (u16 *)eep; |
39 | 39 | ||
40 | if (!common->driver_info) | 40 | if (common->bus_ops->ath_bus_type == ATH_USB) |
41 | eep_start_loc = AR9287_EEP_START_LOC; | ||
42 | else | ||
43 | eep_start_loc = AR9287_HTC_EEP_START_LOC; | 41 | eep_start_loc = AR9287_HTC_EEP_START_LOC; |
42 | else | ||
43 | eep_start_loc = AR9287_EEP_START_LOC; | ||
44 | 44 | ||
45 | if (!ath9k_hw_use_flash(ah)) { | 45 | if (!ath9k_hw_use_flash(ah)) { |
46 | ath_dbg(common, ATH_DBG_EEPROM, | 46 | ath_dbg(common, ATH_DBG_EEPROM, |
diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c index 8946e8ad1b85..cc1e5b3444a4 100644 --- a/drivers/net/wireless/ath/ath9k/hif_usb.c +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c | |||
@@ -28,16 +28,7 @@ MODULE_FIRMWARE(FIRMWARE_AR9271); | |||
28 | static struct usb_device_id ath9k_hif_usb_ids[] = { | 28 | static struct usb_device_id ath9k_hif_usb_ids[] = { |
29 | { USB_DEVICE(0x0cf3, 0x9271) }, /* Atheros */ | 29 | { USB_DEVICE(0x0cf3, 0x9271) }, /* Atheros */ |
30 | { USB_DEVICE(0x0cf3, 0x1006) }, /* Atheros */ | 30 | { USB_DEVICE(0x0cf3, 0x1006) }, /* Atheros */ |
31 | { USB_DEVICE(0x0cf3, 0x7010), | ||
32 | .driver_info = AR7010_DEVICE }, | ||
33 | /* Atheros */ | ||
34 | { USB_DEVICE(0x0cf3, 0x7015), | ||
35 | .driver_info = AR7010_DEVICE | AR9287_DEVICE }, | ||
36 | /* Atheros */ | ||
37 | { USB_DEVICE(0x0846, 0x9030) }, /* Netgear N150 */ | 31 | { USB_DEVICE(0x0846, 0x9030) }, /* Netgear N150 */ |
38 | { USB_DEVICE(0x0846, 0x9018), | ||
39 | .driver_info = AR7010_DEVICE }, | ||
40 | /* Netgear WNDA3200 */ | ||
41 | { USB_DEVICE(0x07D1, 0x3A10) }, /* Dlink Wireless 150 */ | 32 | { USB_DEVICE(0x07D1, 0x3A10) }, /* Dlink Wireless 150 */ |
42 | { USB_DEVICE(0x13D3, 0x3327) }, /* Azurewave */ | 33 | { USB_DEVICE(0x13D3, 0x3327) }, /* Azurewave */ |
43 | { USB_DEVICE(0x13D3, 0x3328) }, /* Azurewave */ | 34 | { USB_DEVICE(0x13D3, 0x3328) }, /* Azurewave */ |
@@ -46,13 +37,20 @@ static struct usb_device_id ath9k_hif_usb_ids[] = { | |||
46 | { USB_DEVICE(0x13D3, 0x3349) }, /* Azurewave */ | 37 | { USB_DEVICE(0x13D3, 0x3349) }, /* Azurewave */ |
47 | { USB_DEVICE(0x13D3, 0x3350) }, /* Azurewave */ | 38 | { USB_DEVICE(0x13D3, 0x3350) }, /* Azurewave */ |
48 | { USB_DEVICE(0x04CA, 0x4605) }, /* Liteon */ | 39 | { USB_DEVICE(0x04CA, 0x4605) }, /* Liteon */ |
49 | { USB_DEVICE(0x083A, 0xA704), | ||
50 | .driver_info = AR7010_DEVICE }, | ||
51 | /* SMC Networks */ | ||
52 | { USB_DEVICE(0x040D, 0x3801) }, /* VIA */ | 40 | { USB_DEVICE(0x040D, 0x3801) }, /* VIA */ |
41 | |||
42 | { USB_DEVICE(0x0cf3, 0x7015), | ||
43 | .driver_info = AR9287_USB }, /* Atheros */ | ||
53 | { USB_DEVICE(0x1668, 0x1200), | 44 | { USB_DEVICE(0x1668, 0x1200), |
54 | .driver_info = AR7010_DEVICE | AR9287_DEVICE }, | 45 | .driver_info = AR9287_USB }, /* Verizon */ |
55 | /* Verizon */ | 46 | |
47 | { USB_DEVICE(0x0cf3, 0x7010), | ||
48 | .driver_info = AR9280_USB }, /* Atheros */ | ||
49 | { USB_DEVICE(0x0846, 0x9018), | ||
50 | .driver_info = AR9280_USB }, /* Netgear WNDA3200 */ | ||
51 | { USB_DEVICE(0x083A, 0xA704), | ||
52 | .driver_info = AR9280_USB }, /* SMC Networks */ | ||
53 | |||
56 | { }, | 54 | { }, |
57 | }; | 55 | }; |
58 | 56 | ||
@@ -818,7 +816,7 @@ static int ath9k_hif_usb_download_fw(struct hif_device_usb *hif_dev, | |||
818 | } | 816 | } |
819 | kfree(buf); | 817 | kfree(buf); |
820 | 818 | ||
821 | if (drv_info & AR7010_DEVICE) | 819 | if (IS_AR7010_DEVICE(drv_info)) |
822 | firm_offset = AR7010_FIRMWARE_TEXT; | 820 | firm_offset = AR7010_FIRMWARE_TEXT; |
823 | else | 821 | else |
824 | firm_offset = AR9271_FIRMWARE_TEXT; | 822 | firm_offset = AR9271_FIRMWARE_TEXT; |
@@ -934,7 +932,7 @@ static int ath9k_hif_usb_probe(struct usb_interface *interface, | |||
934 | 932 | ||
935 | /* Find out which firmware to load */ | 933 | /* Find out which firmware to load */ |
936 | 934 | ||
937 | if (id->driver_info & AR7010_DEVICE) | 935 | if (IS_AR7010_DEVICE(id->driver_info)) |
938 | if (le16_to_cpu(udev->descriptor.bcdDevice) == 0x0202) | 936 | if (le16_to_cpu(udev->descriptor.bcdDevice) == 0x0202) |
939 | hif_dev->fw_name = FIRMWARE_AR7010_1_1; | 937 | hif_dev->fw_name = FIRMWARE_AR7010_1_1; |
940 | else | 938 | else |
@@ -1034,7 +1032,7 @@ static int ath9k_hif_usb_resume(struct usb_interface *interface) | |||
1034 | 1032 | ||
1035 | if (hif_dev->firmware) { | 1033 | if (hif_dev->firmware) { |
1036 | ret = ath9k_hif_usb_download_fw(hif_dev, | 1034 | ret = ath9k_hif_usb_download_fw(hif_dev, |
1037 | htc_handle->drv_priv->ah->common.driver_info); | 1035 | htc_handle->drv_priv->ah->hw_version.usbdev); |
1038 | if (ret) | 1036 | if (ret) |
1039 | goto fail_resume; | 1037 | goto fail_resume; |
1040 | } else { | 1038 | } else { |
diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.h b/drivers/net/wireless/ath/ath9k/hif_usb.h index 2daf97b11c08..e4a5e2e79541 100644 --- a/drivers/net/wireless/ath/ath9k/hif_usb.h +++ b/drivers/net/wireless/ath/ath9k/hif_usb.h | |||
@@ -17,6 +17,8 @@ | |||
17 | #ifndef HTC_USB_H | 17 | #ifndef HTC_USB_H |
18 | #define HTC_USB_H | 18 | #define HTC_USB_H |
19 | 19 | ||
20 | #define IS_AR7010_DEVICE(_v) (((_v) == AR9280_USB) || ((_v) == AR9287_USB)) | ||
21 | |||
20 | #define AR9271_FIRMWARE 0x501000 | 22 | #define AR9271_FIRMWARE 0x501000 |
21 | #define AR9271_FIRMWARE_TEXT 0x903000 | 23 | #define AR9271_FIRMWARE_TEXT 0x903000 |
22 | #define AR7010_FIRMWARE_TEXT 0x906000 | 24 | #define AR7010_FIRMWARE_TEXT 0x906000 |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c index f89f6635abae..680cd369f144 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c | |||
@@ -246,7 +246,7 @@ static int ath9k_init_htc_services(struct ath9k_htc_priv *priv, u16 devid, | |||
246 | * the HIF layer, shouldn't matter much. | 246 | * the HIF layer, shouldn't matter much. |
247 | */ | 247 | */ |
248 | 248 | ||
249 | if (drv_info & AR7010_DEVICE) | 249 | if (IS_AR7010_DEVICE(drv_info)) |
250 | priv->htc->credits = 45; | 250 | priv->htc->credits = 45; |
251 | else | 251 | else |
252 | priv->htc->credits = 33; | 252 | priv->htc->credits = 33; |
@@ -630,6 +630,7 @@ static int ath9k_init_priv(struct ath9k_htc_priv *priv, | |||
630 | 630 | ||
631 | ah->hw_version.devid = devid; | 631 | ah->hw_version.devid = devid; |
632 | ah->hw_version.subsysid = 0; /* FIXME */ | 632 | ah->hw_version.subsysid = 0; /* FIXME */ |
633 | ah->hw_version.usbdev = drv_info; | ||
633 | ah->ah_flags |= AH_USE_EEPROM; | 634 | ah->ah_flags |= AH_USE_EEPROM; |
634 | priv->ah = ah; | 635 | priv->ah = ah; |
635 | 636 | ||
@@ -640,7 +641,6 @@ static int ath9k_init_priv(struct ath9k_htc_priv *priv, | |||
640 | common->hw = priv->hw; | 641 | common->hw = priv->hw; |
641 | common->priv = priv; | 642 | common->priv = priv; |
642 | common->debug_mask = ath9k_debug; | 643 | common->debug_mask = ath9k_debug; |
643 | common->driver_info = drv_info; | ||
644 | 644 | ||
645 | spin_lock_init(&priv->wmi->wmi_lock); | 645 | spin_lock_init(&priv->wmi->wmi_lock); |
646 | spin_lock_init(&priv->beacon_lock); | 646 | spin_lock_init(&priv->beacon_lock); |
@@ -891,7 +891,7 @@ int ath9k_htc_resume(struct htc_target *htc_handle) | |||
891 | return ret; | 891 | return ret; |
892 | 892 | ||
893 | ret = ath9k_init_htc_services(priv, priv->ah->hw_version.devid, | 893 | ret = ath9k_init_htc_services(priv, priv->ah->hw_version.devid, |
894 | priv->ah->common.driver_info); | 894 | priv->ah->hw_version.usbdev); |
895 | return ret; | 895 | return ret; |
896 | } | 896 | } |
897 | #endif | 897 | #endif |
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h index fcfd63efe55a..d83cc3b4685b 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h | |||
@@ -446,6 +446,7 @@ struct ath9k_hw_version { | |||
446 | u16 analog5GhzRev; | 446 | u16 analog5GhzRev; |
447 | u16 analog2GhzRev; | 447 | u16 analog2GhzRev; |
448 | u16 subsysid; | 448 | u16 subsysid; |
449 | enum ath_usb_dev usbdev; | ||
449 | }; | 450 | }; |
450 | 451 | ||
451 | /* Generic TSF timer definitions */ | 452 | /* Generic TSF timer definitions */ |
diff --git a/drivers/net/wireless/ath/ath9k/reg.h b/drivers/net/wireless/ath/ath9k/reg.h index d3257f783a64..4df5659c6c16 100644 --- a/drivers/net/wireless/ath/ath9k/reg.h +++ b/drivers/net/wireless/ath/ath9k/reg.h | |||
@@ -871,8 +871,14 @@ | |||
871 | (AR_SREV_9285_12_OR_LATER(_ah) && \ | 871 | (AR_SREV_9285_12_OR_LATER(_ah) && \ |
872 | ((REG_READ(_ah, AR_AN_SYNTH9) & 0x7) == 0x1)) | 872 | ((REG_READ(_ah, AR_AN_SYNTH9) & 0x7) == 0x1)) |
873 | 873 | ||
874 | enum ath_usb_dev { | ||
875 | AR9280_USB = 1, /* AR7010 + AR9280, UB94 */ | ||
876 | AR9287_USB = 2, /* AR7010 + AR9287, UB95 */ | ||
877 | }; | ||
878 | |||
874 | #define AR_DEVID_7010(_ah) \ | 879 | #define AR_DEVID_7010(_ah) \ |
875 | ((_ah)->common.driver_info & AR7010_DEVICE) | 880 | (((_ah)->hw_version.usbdev == AR9280_USB) || \ |
881 | ((_ah)->hw_version.usbdev == AR9287_USB)) | ||
876 | 882 | ||
877 | #define AR_RADIO_SREV_MAJOR 0xf0 | 883 | #define AR_RADIO_SREV_MAJOR 0xf0 |
878 | #define AR_RAD5133_SREV_MAJOR 0xc0 | 884 | #define AR_RAD5133_SREV_MAJOR 0xc0 |