aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath5k/attach.c
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
commitada47b5fe13d89735805b566185f4885f5a3f750 (patch)
tree644b88f8a71896307d71438e9b3af49126ffb22b /drivers/net/wireless/ath/ath5k/attach.c
parent43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff)
parent3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff)
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/net/wireless/ath/ath5k/attach.c')
-rw-r--r--drivers/net/wireless/ath/ath5k/attach.c34
1 files changed, 12 insertions, 22 deletions
diff --git a/drivers/net/wireless/ath/ath5k/attach.c b/drivers/net/wireless/ath/ath5k/attach.c
index 71a1bd254517..dc0786cc2639 100644
--- a/drivers/net/wireless/ath/ath5k/attach.c
+++ b/drivers/net/wireless/ath/ath5k/attach.c
@@ -21,6 +21,7 @@
21\*************************************/ 21\*************************************/
22 22
23#include <linux/pci.h> 23#include <linux/pci.h>
24#include <linux/slab.h>
24#include "ath5k.h" 25#include "ath5k.h"
25#include "reg.h" 26#include "reg.h"
26#include "debug.h" 27#include "debug.h"
@@ -101,25 +102,15 @@ static int ath5k_hw_post(struct ath5k_hw *ah)
101 * -ENODEV if the device is not supported or prints an error msg if something 102 * -ENODEV if the device is not supported or prints an error msg if something
102 * else went wrong. 103 * else went wrong.
103 */ 104 */
104struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc) 105int ath5k_hw_attach(struct ath5k_softc *sc)
105{ 106{
106 struct ath5k_hw *ah; 107 struct ath5k_hw *ah = sc->ah;
108 struct ath_common *common = ath5k_hw_common(ah);
107 struct pci_dev *pdev = sc->pdev; 109 struct pci_dev *pdev = sc->pdev;
108 struct ath5k_eeprom_info *ee; 110 struct ath5k_eeprom_info *ee;
109 int ret; 111 int ret;
110 u32 srev; 112 u32 srev;
111 113
112 /*If we passed the test malloc a ath5k_hw struct*/
113 ah = kzalloc(sizeof(struct ath5k_hw), GFP_KERNEL);
114 if (ah == NULL) {
115 ret = -ENOMEM;
116 ATH5K_ERR(sc, "out of memory\n");
117 goto err;
118 }
119
120 ah->ah_sc = sc;
121 ah->ah_iobase = sc->iobase;
122
123 /* 114 /*
124 * HW information 115 * HW information
125 */ 116 */
@@ -278,12 +269,12 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc)
278 goto err_free; 269 goto err_free;
279 } 270 }
280 271
272 ee = &ah->ah_capabilities.cap_eeprom;
273
281 /* 274 /*
282 * Write PCI-E power save settings 275 * Write PCI-E power save settings
283 */ 276 */
284 if ((ah->ah_version == AR5K_AR5212) && (pdev->is_pcie)) { 277 if ((ah->ah_version == AR5K_AR5212) && (pdev->is_pcie)) {
285 struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
286
287 ath5k_hw_reg_write(ah, 0x9248fc00, AR5K_PCIE_SERDES); 278 ath5k_hw_reg_write(ah, 0x9248fc00, AR5K_PCIE_SERDES);
288 ath5k_hw_reg_write(ah, 0x24924924, AR5K_PCIE_SERDES); 279 ath5k_hw_reg_write(ah, 0x24924924, AR5K_PCIE_SERDES);
289 280
@@ -321,7 +312,6 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc)
321 } 312 }
322 313
323 /* Crypto settings */ 314 /* Crypto settings */
324 ee = &ah->ah_capabilities.cap_eeprom;
325 ah->ah_aes_support = srev >= AR5K_SREV_AR5212_V4 && 315 ah->ah_aes_support = srev >= AR5K_SREV_AR5212_V4 &&
326 (ee->ee_version >= AR5K_EEPROM_VERSION_5_0 && 316 (ee->ee_version >= AR5K_EEPROM_VERSION_5_0 &&
327 !AR5K_EEPROM_AES_DIS(ee->ee_misc5)); 317 !AR5K_EEPROM_AES_DIS(ee->ee_misc5));
@@ -336,20 +326,21 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc)
336 ath5k_hw_set_lladdr(ah, (u8[ETH_ALEN]){}); 326 ath5k_hw_set_lladdr(ah, (u8[ETH_ALEN]){});
337 327
338 /* Set BSSID to bcast address: ff:ff:ff:ff:ff:ff for now */ 328 /* Set BSSID to bcast address: ff:ff:ff:ff:ff:ff for now */
339 memset(ah->ah_bssid, 0xff, ETH_ALEN); 329 memcpy(common->curbssid, ath_bcast_mac, ETH_ALEN);
340 ath5k_hw_set_associd(ah, ah->ah_bssid, 0); 330 ath5k_hw_set_associd(ah);
341 ath5k_hw_set_opmode(ah); 331 ath5k_hw_set_opmode(ah);
342 332
343 ath5k_hw_rfgain_opt_init(ah); 333 ath5k_hw_rfgain_opt_init(ah);
344 334
335 ath5k_hw_init_nfcal_hist(ah);
336
345 /* turn on HW LEDs */ 337 /* turn on HW LEDs */
346 ath5k_hw_set_ledstate(ah, AR5K_LED_INIT); 338 ath5k_hw_set_ledstate(ah, AR5K_LED_INIT);
347 339
348 return ah; 340 return 0;
349err_free: 341err_free:
350 kfree(ah); 342 kfree(ah);
351err: 343 return ret;
352 return ERR_PTR(ret);
353} 344}
354 345
355/** 346/**
@@ -369,5 +360,4 @@ void ath5k_hw_detach(struct ath5k_hw *ah)
369 ath5k_eeprom_detach(ah); 360 ath5k_eeprom_detach(ah);
370 361
371 /* assume interrupts are down */ 362 /* assume interrupts are down */
372 kfree(ah);
373} 363}