Commit e1aa369e authored by Lukáš Turek's avatar Lukáš Turek Committed by John W. Linville

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: default avatarLukas Turek <8an@praha12.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 310bc676
...@@ -520,12 +520,16 @@ int ath5k_hw_reset_tx_queue(struct ath5k_hw *ah, unsigned int queue) ...@@ -520,12 +520,16 @@ int ath5k_hw_reset_tx_queue(struct ath5k_hw *ah, unsigned int queue)
*/ */
unsigned int ath5k_hw_get_slot_time(struct ath5k_hw *ah) unsigned int ath5k_hw_get_slot_time(struct ath5k_hw *ah)
{ {
unsigned int slot_time_clock;
ATH5K_TRACE(ah->ah_sc); ATH5K_TRACE(ah->ah_sc);
if (ah->ah_version == AR5K_AR5210) if (ah->ah_version == AR5K_AR5210)
return ath5k_hw_clocktoh(ath5k_hw_reg_read(ah, slot_time_clock = ath5k_hw_reg_read(ah, AR5K_SLOT_TIME);
AR5K_SLOT_TIME) & 0xffff, ah->ah_turbo);
else else
return ath5k_hw_reg_read(ah, AR5K_DCU_GBL_IFS_SLOT) & 0xffff; slot_time_clock = ath5k_hw_reg_read(ah, AR5K_DCU_GBL_IFS_SLOT);
return ath5k_hw_clocktoh(slot_time_clock & 0xffff, ah->ah_turbo);
} }
/* /*
...@@ -533,15 +537,17 @@ unsigned int ath5k_hw_get_slot_time(struct ath5k_hw *ah) ...@@ -533,15 +537,17 @@ unsigned int ath5k_hw_get_slot_time(struct ath5k_hw *ah)
*/ */
int ath5k_hw_set_slot_time(struct ath5k_hw *ah, unsigned int slot_time) int ath5k_hw_set_slot_time(struct ath5k_hw *ah, unsigned int slot_time)
{ {
u32 slot_time_clock = ath5k_hw_htoclock(slot_time, ah->ah_turbo);
ATH5K_TRACE(ah->ah_sc); ATH5K_TRACE(ah->ah_sc);
if (slot_time < AR5K_SLOT_TIME_9 || slot_time > AR5K_SLOT_TIME_MAX)
if (slot_time < 6 || slot_time_clock > AR5K_SLOT_TIME_MAX)
return -EINVAL; return -EINVAL;
if (ah->ah_version == AR5K_AR5210) if (ah->ah_version == AR5K_AR5210)
ath5k_hw_reg_write(ah, ath5k_hw_htoclock(slot_time, ath5k_hw_reg_write(ah, slot_time_clock, AR5K_SLOT_TIME);
ah->ah_turbo), AR5K_SLOT_TIME);
else else
ath5k_hw_reg_write(ah, slot_time, AR5K_DCU_GBL_IFS_SLOT); ath5k_hw_reg_write(ah, slot_time_clock, AR5K_DCU_GBL_IFS_SLOT);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment