aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath9k/hw.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ath9k/hw.c')
-rw-r--r--drivers/net/wireless/ath9k/hw.c71
1 files changed, 19 insertions, 52 deletions
diff --git a/drivers/net/wireless/ath9k/hw.c b/drivers/net/wireless/ath9k/hw.c
index 9eafada743d..5d7287549c0 100644
--- a/drivers/net/wireless/ath9k/hw.c
+++ b/drivers/net/wireless/ath9k/hw.c
@@ -392,8 +392,6 @@ static struct ath_hal_5416 *ath9k_hw_newstate(u16 devid,
392 void __iomem *mem, 392 void __iomem *mem,
393 int *status) 393 int *status)
394{ 394{
395 static const u8 defbssidmask[ETH_ALEN] =
396 { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
397 struct ath_hal_5416 *ahp; 395 struct ath_hal_5416 *ahp;
398 struct ath_hal *ah; 396 struct ath_hal *ah;
399 397
@@ -432,7 +430,6 @@ static struct ath_hal_5416 *ath9k_hw_newstate(u16 devid,
432 ahp->ah_acktimeout = (u32) -1; 430 ahp->ah_acktimeout = (u32) -1;
433 ahp->ah_ctstimeout = (u32) -1; 431 ahp->ah_ctstimeout = (u32) -1;
434 ahp->ah_globaltxtimeout = (u32) -1; 432 ahp->ah_globaltxtimeout = (u32) -1;
435 memcpy(&ahp->ah_bssidmask, defbssidmask, ETH_ALEN);
436 433
437 ahp->ah_gBeaconRate = 0; 434 ahp->ah_gBeaconRate = 0;
438 435
@@ -488,19 +485,18 @@ static int ath9k_hw_init_macaddr(struct ath_hal *ah)
488 u32 sum; 485 u32 sum;
489 int i; 486 int i;
490 u16 eeval; 487 u16 eeval;
491 struct ath_hal_5416 *ahp = AH5416(ah);
492 488
493 sum = 0; 489 sum = 0;
494 for (i = 0; i < 3; i++) { 490 for (i = 0; i < 3; i++) {
495 eeval = ath9k_hw_get_eeprom(ah, AR_EEPROM_MAC(i)); 491 eeval = ath9k_hw_get_eeprom(ah, AR_EEPROM_MAC(i));
496 sum += eeval; 492 sum += eeval;
497 ahp->ah_macaddr[2 * i] = eeval >> 8; 493 ah->macaddr[2 * i] = eeval >> 8;
498 ahp->ah_macaddr[2 * i + 1] = eeval & 0xff; 494 ah->macaddr[2 * i + 1] = eeval & 0xff;
499 } 495 }
500 if (sum == 0 || sum == 0xffff * 3) { 496 if (sum == 0 || sum == 0xffff * 3) {
501 DPRINTF(ah->ah_sc, ATH_DBG_EEPROM, 497 DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
502 "mac address read failed: %pM\n", 498 "mac address read failed: %pM\n",
503 ahp->ah_macaddr); 499 ah->macaddr);
504 return -EADDRNOTAVAIL; 500 return -EADDRNOTAVAIL;
505 } 501 }
506 502
@@ -2251,8 +2247,8 @@ int ath9k_hw_reset(struct ath_hal *ah, struct ath9k_channel *chan,
2251 2247
2252 ath9k_hw_decrease_chain_power(ah, chan); 2248 ath9k_hw_decrease_chain_power(ah, chan);
2253 2249
2254 REG_WRITE(ah, AR_STA_ID0, get_unaligned_le32(ahp->ah_macaddr)); 2250 REG_WRITE(ah, AR_STA_ID0, get_unaligned_le32(ah->macaddr));
2255 REG_WRITE(ah, AR_STA_ID1, get_unaligned_le16(ahp->ah_macaddr + 4) 2251 REG_WRITE(ah, AR_STA_ID1, get_unaligned_le16(ah->macaddr + 4)
2256 | macStaId1 2252 | macStaId1
2257 | AR_STA_ID1_RTS_USE_DEF 2253 | AR_STA_ID1_RTS_USE_DEF
2258 | (ah->ah_config. 2254 | (ah->ah_config.
@@ -2260,14 +2256,14 @@ int ath9k_hw_reset(struct ath_hal *ah, struct ath9k_channel *chan,
2260 | ahp->ah_staId1Defaults); 2256 | ahp->ah_staId1Defaults);
2261 ath9k_hw_set_operating_mode(ah, ah->ah_opmode); 2257 ath9k_hw_set_operating_mode(ah, ah->ah_opmode);
2262 2258
2263 REG_WRITE(ah, AR_BSSMSKL, get_unaligned_le32(ahp->ah_bssidmask)); 2259 REG_WRITE(ah, AR_BSSMSKL, get_unaligned_le32(sc->bssidmask));
2264 REG_WRITE(ah, AR_BSSMSKU, get_unaligned_le16(ahp->ah_bssidmask + 4)); 2260 REG_WRITE(ah, AR_BSSMSKU, get_unaligned_le16(sc->bssidmask + 4));
2265 2261
2266 REG_WRITE(ah, AR_DEF_ANTENNA, saveDefAntenna); 2262 REG_WRITE(ah, AR_DEF_ANTENNA, saveDefAntenna);
2267 2263
2268 REG_WRITE(ah, AR_BSS_ID0, get_unaligned_le32(ahp->ah_bssid)); 2264 REG_WRITE(ah, AR_BSS_ID0, get_unaligned_le32(sc->curbssid));
2269 REG_WRITE(ah, AR_BSS_ID1, get_unaligned_le16(ahp->ah_bssid + 4) | 2265 REG_WRITE(ah, AR_BSS_ID1, get_unaligned_le16(sc->curbssid + 4) |
2270 ((ahp->ah_assocId & 0x3fff) << AR_BSS_ID1_AID_S)); 2266 ((sc->curaid & 0x3fff) << AR_BSS_ID1_AID_S));
2271 2267
2272 REG_WRITE(ah, AR_ISR, ~0); 2268 REG_WRITE(ah, AR_ISR, ~0);
2273 2269
@@ -3669,20 +3665,9 @@ bool ath9k_hw_set_txpowerlimit(struct ath_hal *ah, u32 limit)
3669 return true; 3665 return true;
3670} 3666}
3671 3667
3672void ath9k_hw_getmac(struct ath_hal *ah, u8 *mac) 3668void ath9k_hw_setmac(struct ath_hal *ah, const u8 *mac)
3673{
3674 struct ath_hal_5416 *ahp = AH5416(ah);
3675
3676 memcpy(mac, ahp->ah_macaddr, ETH_ALEN);
3677}
3678
3679bool ath9k_hw_setmac(struct ath_hal *ah, const u8 *mac)
3680{ 3669{
3681 struct ath_hal_5416 *ahp = AH5416(ah); 3670 memcpy(ah->macaddr, mac, ETH_ALEN);
3682
3683 memcpy(ahp->ah_macaddr, mac, ETH_ALEN);
3684
3685 return true;
3686} 3671}
3687 3672
3688void ath9k_hw_setopmode(struct ath_hal *ah) 3673void ath9k_hw_setopmode(struct ath_hal *ah)
@@ -3696,35 +3681,17 @@ void ath9k_hw_setmcastfilter(struct ath_hal *ah, u32 filter0, u32 filter1)
3696 REG_WRITE(ah, AR_MCAST_FIL1, filter1); 3681 REG_WRITE(ah, AR_MCAST_FIL1, filter1);
3697} 3682}
3698 3683
3699void ath9k_hw_getbssidmask(struct ath_hal *ah, u8 *mask) 3684void ath9k_hw_setbssidmask(struct ath_softc *sc)
3700{ 3685{
3701 struct ath_hal_5416 *ahp = AH5416(ah); 3686 REG_WRITE(sc->sc_ah, AR_BSSMSKL, get_unaligned_le32(sc->bssidmask));
3702 3687 REG_WRITE(sc->sc_ah, AR_BSSMSKU, get_unaligned_le16(sc->bssidmask + 4));
3703 memcpy(mask, ahp->ah_bssidmask, ETH_ALEN);
3704} 3688}
3705 3689
3706bool ath9k_hw_setbssidmask(struct ath_hal *ah, const u8 *mask) 3690void ath9k_hw_write_associd(struct ath_softc *sc)
3707{ 3691{
3708 struct ath_hal_5416 *ahp = AH5416(ah); 3692 REG_WRITE(sc->sc_ah, AR_BSS_ID0, get_unaligned_le32(sc->curbssid));
3709 3693 REG_WRITE(sc->sc_ah, AR_BSS_ID1, get_unaligned_le16(sc->curbssid + 4) |
3710 memcpy(ahp->ah_bssidmask, mask, ETH_ALEN); 3694 ((sc->curaid & 0x3fff) << AR_BSS_ID1_AID_S));
3711
3712 REG_WRITE(ah, AR_BSSMSKL, get_unaligned_le32(ahp->ah_bssidmask));
3713 REG_WRITE(ah, AR_BSSMSKU, get_unaligned_le16(ahp->ah_bssidmask + 4));
3714
3715 return true;
3716}
3717
3718void ath9k_hw_write_associd(struct ath_hal *ah, const u8 *bssid, u16 assocId)
3719{
3720 struct ath_hal_5416 *ahp = AH5416(ah);
3721
3722 memcpy(ahp->ah_bssid, bssid, ETH_ALEN);
3723 ahp->ah_assocId = assocId;
3724
3725 REG_WRITE(ah, AR_BSS_ID0, get_unaligned_le32(ahp->ah_bssid));
3726 REG_WRITE(ah, AR_BSS_ID1, get_unaligned_le16(ahp->ah_bssid + 4) |
3727 ((assocId & 0x3fff) << AR_BSS_ID1_AID_S));
3728} 3695}
3729 3696
3730u64 ath9k_hw_gettsf64(struct ath_hal *ah) 3697u64 ath9k_hw_gettsf64(struct ath_hal *ah)