diff options
author | Pavel Roskin <proski@gnu.org> | 2009-08-26 22:30:09 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-08-28 14:40:55 -0400 |
commit | 97a81f5c5033cb02ae56dd80ff9c38866c777bd8 (patch) | |
tree | fc88f10b4bc2a167baeb9d1c38022b9612de296e /drivers/net/wireless/ath/ath5k/attach.c | |
parent | 3b3ee43da43aca1cbf4c3651379b2b1492e49dd6 (diff) |
ath5k: don't use PCI ID to find the chip revision
AR5K_SREV is available even if the chip has been put to sleep. Relying
on the chip register allows binding non-standard PCI IDs by
echo VENDOR_ID PRODUCT_ID >/sys/bus/pci/drivers/ath5k/new_id
without having to specify the driver data as well.
Signed-off-by: Pavel Roskin <proski@gnu.org>
Acked-by: Bob Copeland <me@bobcopeland.com>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath5k/attach.c')
-rw-r--r-- | drivers/net/wireless/ath/ath5k/attach.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/net/wireless/ath/ath5k/attach.c b/drivers/net/wireless/ath/ath5k/attach.c index 4819f39da704..71a1bd254517 100644 --- a/drivers/net/wireless/ath/ath5k/attach.c +++ b/drivers/net/wireless/ath/ath5k/attach.c | |||
@@ -95,14 +95,13 @@ static int ath5k_hw_post(struct ath5k_hw *ah) | |||
95 | * ath5k_hw_attach - Check if hw is supported and init the needed structs | 95 | * ath5k_hw_attach - Check if hw is supported and init the needed structs |
96 | * | 96 | * |
97 | * @sc: The &struct ath5k_softc we got from the driver's attach function | 97 | * @sc: The &struct ath5k_softc we got from the driver's attach function |
98 | * @mac_version: The mac version id (check out ath5k.h) based on pci id | ||
99 | * | 98 | * |
100 | * Check if the device is supported, perform a POST and initialize the needed | 99 | * Check if the device is supported, perform a POST and initialize the needed |
101 | * structs. Returns -ENOMEM if we don't have memory for the needed structs, | 100 | * structs. Returns -ENOMEM if we don't have memory for the needed structs, |
102 | * -ENODEV if the device is not supported or prints an error msg if something | 101 | * -ENODEV if the device is not supported or prints an error msg if something |
103 | * else went wrong. | 102 | * else went wrong. |
104 | */ | 103 | */ |
105 | struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version) | 104 | struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc) |
106 | { | 105 | { |
107 | struct ath5k_hw *ah; | 106 | struct ath5k_hw *ah; |
108 | struct pci_dev *pdev = sc->pdev; | 107 | struct pci_dev *pdev = sc->pdev; |
@@ -136,9 +135,15 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version) | |||
136 | ah->ah_software_retry = false; | 135 | ah->ah_software_retry = false; |
137 | 136 | ||
138 | /* | 137 | /* |
139 | * Set the mac version based on the pci id | 138 | * Find the mac version |
140 | */ | 139 | */ |
141 | ah->ah_version = mac_version; | 140 | srev = ath5k_hw_reg_read(ah, AR5K_SREV); |
141 | if (srev < AR5K_SREV_AR5311) | ||
142 | ah->ah_version = AR5K_AR5210; | ||
143 | else if (srev < AR5K_SREV_AR5212) | ||
144 | ah->ah_version = AR5K_AR5211; | ||
145 | else | ||
146 | ah->ah_version = AR5K_AR5212; | ||
142 | 147 | ||
143 | /*Fill the ath5k_hw struct with the needed functions*/ | 148 | /*Fill the ath5k_hw struct with the needed functions*/ |
144 | ret = ath5k_hw_init_desc_functions(ah); | 149 | ret = ath5k_hw_init_desc_functions(ah); |
@@ -151,7 +156,6 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version) | |||
151 | goto err_free; | 156 | goto err_free; |
152 | 157 | ||
153 | /* Get MAC, PHY and RADIO revisions */ | 158 | /* Get MAC, PHY and RADIO revisions */ |
154 | srev = ath5k_hw_reg_read(ah, AR5K_SREV); | ||
155 | ah->ah_mac_srev = srev; | 159 | ah->ah_mac_srev = srev; |
156 | ah->ah_mac_version = AR5K_REG_MS(srev, AR5K_SREV_VER); | 160 | ah->ah_mac_version = AR5K_REG_MS(srev, AR5K_SREV_VER); |
157 | ah->ah_mac_revision = AR5K_REG_MS(srev, AR5K_SREV_REV); | 161 | ah->ah_mac_revision = AR5K_REG_MS(srev, AR5K_SREV_REV); |