diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2009-09-10 01:43:17 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-10-07 16:39:25 -0400 |
commit | bcd8f54a84ce99ade91c250a9bc850a9fd3389c1 (patch) | |
tree | b17a29b781c0ea56f567d18f45e2d0cdc29bada2 /drivers/net/wireless/ath/ath5k/pcu.c | |
parent | 17753748e15eaf29c8db15c5c05b8dde5db6e64d (diff) |
atheros: use get_unaligned_le*() for bssid mask setting
Historically some macro helpers have been users for this,
AR5K_LOW_ID() and AR5K_HIGH_ID(), use upstream unaligned
helpers instead. This applid to ath5k and ar9170. ath9k
already uses this.
Worth noting is ath5k uses an ah_sta_id but that is already
the MAC address combined with the associaiton ID, ah_sta_id
is really ETH_ALEN in size.
Cc: Bob Copeland <me@bobcopeland.com>
Cc: Nick Kossifidis <mick@madwifi-project.org>
Cc: Christian Lamparter <chunkeey@web.de>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath5k/pcu.c')
-rw-r--r-- | drivers/net/wireless/ath/ath5k/pcu.c | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/drivers/net/wireless/ath/ath5k/pcu.c b/drivers/net/wireless/ath/ath5k/pcu.c index 43aa35806618..7bbcfe4fe34b 100644 --- a/drivers/net/wireless/ath/ath5k/pcu.c +++ b/drivers/net/wireless/ath/ath5k/pcu.c | |||
@@ -24,6 +24,8 @@ | |||
24 | * Protocol Control Unit Functions * | 24 | * Protocol Control Unit Functions * |
25 | \*********************************/ | 25 | \*********************************/ |
26 | 26 | ||
27 | #include <asm/unaligned.h> | ||
28 | |||
27 | #include "ath5k.h" | 29 | #include "ath5k.h" |
28 | #include "reg.h" | 30 | #include "reg.h" |
29 | #include "debug.h" | 31 | #include "debug.h" |
@@ -95,8 +97,8 @@ int ath5k_hw_set_opmode(struct ath5k_hw *ah) | |||
95 | /* | 97 | /* |
96 | * Set PCU registers | 98 | * Set PCU registers |
97 | */ | 99 | */ |
98 | low_id = AR5K_LOW_ID(ah->ah_sta_id); | 100 | low_id = get_unaligned_le32(ah->ah_sta_id); |
99 | high_id = AR5K_HIGH_ID(ah->ah_sta_id); | 101 | high_id = get_unaligned_le16(ah->ah_sta_id + 4); |
100 | ath5k_hw_reg_write(ah, low_id, AR5K_STA_ID0); | 102 | ath5k_hw_reg_write(ah, low_id, AR5K_STA_ID0); |
101 | ath5k_hw_reg_write(ah, pcu_reg | high_id, AR5K_STA_ID1); | 103 | ath5k_hw_reg_write(ah, pcu_reg | high_id, AR5K_STA_ID1); |
102 | 104 | ||
@@ -279,8 +281,8 @@ int ath5k_hw_set_lladdr(struct ath5k_hw *ah, const u8 *mac) | |||
279 | 281 | ||
280 | pcu_reg = ath5k_hw_reg_read(ah, AR5K_STA_ID1) & 0xffff0000; | 282 | pcu_reg = ath5k_hw_reg_read(ah, AR5K_STA_ID1) & 0xffff0000; |
281 | 283 | ||
282 | low_id = AR5K_LOW_ID(mac); | 284 | low_id = get_unaligned_le32(mac); |
283 | high_id = AR5K_HIGH_ID(mac); | 285 | high_id = get_unaligned_le16(mac + 4); |
284 | 286 | ||
285 | ath5k_hw_reg_write(ah, low_id, AR5K_STA_ID0); | 287 | ath5k_hw_reg_write(ah, low_id, AR5K_STA_ID0); |
286 | ath5k_hw_reg_write(ah, pcu_reg | high_id, AR5K_STA_ID1); | 288 | ath5k_hw_reg_write(ah, pcu_reg | high_id, AR5K_STA_ID1); |
@@ -306,17 +308,18 @@ void ath5k_hw_set_associd(struct ath5k_hw *ah, const u8 *bssid, u16 assoc_id) | |||
306 | * Set simple BSSID mask on 5212 | 308 | * Set simple BSSID mask on 5212 |
307 | */ | 309 | */ |
308 | if (ah->ah_version == AR5K_AR5212) { | 310 | if (ah->ah_version == AR5K_AR5212) { |
309 | ath5k_hw_reg_write(ah, AR5K_LOW_ID(ah->ah_bssid_mask), | 311 | ath5k_hw_reg_write(ah, get_unaligned_le32(ah->ah_bssid_mask), |
310 | AR5K_BSS_IDM0); | 312 | AR5K_BSS_IDM0); |
311 | ath5k_hw_reg_write(ah, AR5K_HIGH_ID(ah->ah_bssid_mask), | 313 | ath5k_hw_reg_write(ah, |
312 | AR5K_BSS_IDM1); | 314 | get_unaligned_le16(ah->ah_bssid_mask + 4), |
315 | AR5K_BSS_IDM1); | ||
313 | } | 316 | } |
314 | 317 | ||
315 | /* | 318 | /* |
316 | * Set BSSID which triggers the "SME Join" operation | 319 | * Set BSSID which triggers the "SME Join" operation |
317 | */ | 320 | */ |
318 | low_id = AR5K_LOW_ID(bssid); | 321 | low_id = get_unaligned_le32(bssid); |
319 | high_id = AR5K_HIGH_ID(bssid); | 322 | high_id = get_unaligned_le16(bssid); |
320 | ath5k_hw_reg_write(ah, low_id, AR5K_BSS_ID0); | 323 | ath5k_hw_reg_write(ah, low_id, AR5K_BSS_ID0); |
321 | ath5k_hw_reg_write(ah, high_id | ((assoc_id & 0x3fff) << | 324 | ath5k_hw_reg_write(ah, high_id | ((assoc_id & 0x3fff) << |
322 | AR5K_BSS_ID1_AID_S), AR5K_BSS_ID1); | 325 | AR5K_BSS_ID1_AID_S), AR5K_BSS_ID1); |
@@ -437,8 +440,8 @@ int ath5k_hw_set_bssid_mask(struct ath5k_hw *ah, const u8 *mask) | |||
437 | * on reset */ | 440 | * on reset */ |
438 | memcpy(ah->ah_bssid_mask, mask, ETH_ALEN); | 441 | memcpy(ah->ah_bssid_mask, mask, ETH_ALEN); |
439 | if (ah->ah_version == AR5K_AR5212) { | 442 | if (ah->ah_version == AR5K_AR5212) { |
440 | low_id = AR5K_LOW_ID(mask); | 443 | low_id = get_unaligned_le32(mask); |
441 | high_id = AR5K_HIGH_ID(mask); | 444 | high_id = get_unaligned_le16(mask + 4); |
442 | 445 | ||
443 | ath5k_hw_reg_write(ah, low_id, AR5K_BSS_IDM0); | 446 | ath5k_hw_reg_write(ah, low_id, AR5K_BSS_IDM0); |
444 | ath5k_hw_reg_write(ah, high_id, AR5K_BSS_IDM1); | 447 | ath5k_hw_reg_write(ah, high_id, AR5K_BSS_IDM1); |
@@ -1157,14 +1160,17 @@ int ath5k_hw_set_key_lladdr(struct ath5k_hw *ah, u16 entry, const u8 *mac) | |||
1157 | /* Invalid entry (key table overflow) */ | 1160 | /* Invalid entry (key table overflow) */ |
1158 | AR5K_ASSERT_ENTRY(entry, AR5K_KEYTABLE_SIZE); | 1161 | AR5K_ASSERT_ENTRY(entry, AR5K_KEYTABLE_SIZE); |
1159 | 1162 | ||
1160 | /* MAC may be NULL if it's a broadcast key. In this case no need to | 1163 | /* |
1161 | * to compute AR5K_LOW_ID and AR5K_HIGH_ID as we already know it. */ | 1164 | * MAC may be NULL if it's a broadcast key. In this case no need to |
1165 | * to compute get_unaligned_le32 and get_unaligned_le16 as we | ||
1166 | * already know it. | ||
1167 | */ | ||
1162 | if (!mac) { | 1168 | if (!mac) { |
1163 | low_id = 0xffffffff; | 1169 | low_id = 0xffffffff; |
1164 | high_id = 0xffff | AR5K_KEYTABLE_VALID; | 1170 | high_id = 0xffff | AR5K_KEYTABLE_VALID; |
1165 | } else { | 1171 | } else { |
1166 | low_id = AR5K_LOW_ID(mac); | 1172 | low_id = get_unaligned_le32(mac); |
1167 | high_id = AR5K_HIGH_ID(mac) | AR5K_KEYTABLE_VALID; | 1173 | high_id = get_unaligned_le16(mac + 4) | AR5K_KEYTABLE_VALID; |
1168 | } | 1174 | } |
1169 | 1175 | ||
1170 | ath5k_hw_reg_write(ah, low_id, AR5K_KEYTABLE_MAC0(entry)); | 1176 | ath5k_hw_reg_write(ah, low_id, AR5K_KEYTABLE_MAC0(entry)); |