diff options
author | Lukáš Turek <8an@praha12.net> | 2009-12-21 16:50:49 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-01-12 13:50:07 -0500 |
commit | e1aa369ec8fb981ef78bc5be3b3c58de7c5ff769 (patch) | |
tree | afe94e3f595edc13eae7ec6023f129786a432015 /drivers/net/wireless/ath/ath5k | |
parent | 310bc676e314e92c18257bfc916951879451ee32 (diff) |
ath5k: Fix functions for getting/setting slot time
Functions ath5k_hw_get_slot_time and ath5k_hw_set_slot_time were
converting microseconds to clocks only for AR5210, although it's needed
for all supported devices. The conversion was moved outside the
hardware-specific branches.
The original code also limited minimum slot time to 9, while turbo modes
use 6, this was fixed too.
Signed-off-by: Lukas Turek <8an@praha12.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath5k')
-rw-r--r-- | drivers/net/wireless/ath/ath5k/qcu.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/drivers/net/wireless/ath/ath5k/qcu.c b/drivers/net/wireless/ath/ath5k/qcu.c index eeebb9aef206..e322a104e7fe 100644 --- a/drivers/net/wireless/ath/ath5k/qcu.c +++ b/drivers/net/wireless/ath/ath5k/qcu.c | |||
@@ -520,12 +520,16 @@ int ath5k_hw_reset_tx_queue(struct ath5k_hw *ah, unsigned int queue) | |||
520 | */ | 520 | */ |
521 | unsigned int ath5k_hw_get_slot_time(struct ath5k_hw *ah) | 521 | unsigned int ath5k_hw_get_slot_time(struct ath5k_hw *ah) |
522 | { | 522 | { |
523 | unsigned int slot_time_clock; | ||
524 | |||
523 | ATH5K_TRACE(ah->ah_sc); | 525 | ATH5K_TRACE(ah->ah_sc); |
526 | |||
524 | if (ah->ah_version == AR5K_AR5210) | 527 | if (ah->ah_version == AR5K_AR5210) |
525 | return ath5k_hw_clocktoh(ath5k_hw_reg_read(ah, | 528 | slot_time_clock = ath5k_hw_reg_read(ah, AR5K_SLOT_TIME); |
526 | AR5K_SLOT_TIME) & 0xffff, ah->ah_turbo); | ||
527 | else | 529 | else |
528 | return ath5k_hw_reg_read(ah, AR5K_DCU_GBL_IFS_SLOT) & 0xffff; | 530 | slot_time_clock = ath5k_hw_reg_read(ah, AR5K_DCU_GBL_IFS_SLOT); |
531 | |||
532 | return ath5k_hw_clocktoh(slot_time_clock & 0xffff, ah->ah_turbo); | ||
529 | } | 533 | } |
530 | 534 | ||
531 | /* | 535 | /* |
@@ -533,15 +537,17 @@ unsigned int ath5k_hw_get_slot_time(struct ath5k_hw *ah) | |||
533 | */ | 537 | */ |
534 | int ath5k_hw_set_slot_time(struct ath5k_hw *ah, unsigned int slot_time) | 538 | int ath5k_hw_set_slot_time(struct ath5k_hw *ah, unsigned int slot_time) |
535 | { | 539 | { |
540 | u32 slot_time_clock = ath5k_hw_htoclock(slot_time, ah->ah_turbo); | ||
541 | |||
536 | ATH5K_TRACE(ah->ah_sc); | 542 | ATH5K_TRACE(ah->ah_sc); |
537 | if (slot_time < AR5K_SLOT_TIME_9 || slot_time > AR5K_SLOT_TIME_MAX) | 543 | |
544 | if (slot_time < 6 || slot_time_clock > AR5K_SLOT_TIME_MAX) | ||
538 | return -EINVAL; | 545 | return -EINVAL; |
539 | 546 | ||
540 | if (ah->ah_version == AR5K_AR5210) | 547 | if (ah->ah_version == AR5K_AR5210) |
541 | ath5k_hw_reg_write(ah, ath5k_hw_htoclock(slot_time, | 548 | ath5k_hw_reg_write(ah, slot_time_clock, AR5K_SLOT_TIME); |
542 | ah->ah_turbo), AR5K_SLOT_TIME); | ||
543 | else | 549 | else |
544 | ath5k_hw_reg_write(ah, slot_time, AR5K_DCU_GBL_IFS_SLOT); | 550 | ath5k_hw_reg_write(ah, slot_time_clock, AR5K_DCU_GBL_IFS_SLOT); |
545 | 551 | ||
546 | return 0; | 552 | return 0; |
547 | } | 553 | } |