ath5k: move ath5k_hw_register_timeout() into reset.c
ath5k_hw_register_timeout() was duplicated between phy.c and reset.c. Since it is too big and too much used to be an inline function, move it away from the ath5k.h header into reset.c. Remove _ATH5K_RESET and _ATH5K_PHY defines. Signed-off-by: Pavel Roskin <proski@gnu.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Родитель
a25d1e4cd7
Коммит
ec182d9763
|
@ -1172,6 +1172,8 @@ int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial);
|
||||||
int ath5k_hw_on_hold(struct ath5k_hw *ah);
|
int ath5k_hw_on_hold(struct ath5k_hw *ah);
|
||||||
int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
|
int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
|
||||||
struct ieee80211_channel *channel, bool change_channel);
|
struct ieee80211_channel *channel, bool change_channel);
|
||||||
|
int ath5k_hw_register_timeout(struct ath5k_hw *ah, u32 reg, u32 flag, u32 val,
|
||||||
|
bool is_set);
|
||||||
/* Power management functions */
|
/* Power management functions */
|
||||||
|
|
||||||
/* DMA Related Functions */
|
/* DMA Related Functions */
|
||||||
|
@ -1328,29 +1330,6 @@ static inline void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
|
||||||
iowrite32(val, ah->ah_iobase + reg);
|
iowrite32(val, ah->ah_iobase + reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_ATH5K_RESET) || defined(_ATH5K_PHY)
|
|
||||||
/*
|
|
||||||
* Check if a register write has been completed
|
|
||||||
*/
|
|
||||||
static int ath5k_hw_register_timeout(struct ath5k_hw *ah, u32 reg, u32 flag,
|
|
||||||
u32 val, bool is_set)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
u32 data;
|
|
||||||
|
|
||||||
for (i = AR5K_TUNE_REGISTER_TIMEOUT; i > 0; i--) {
|
|
||||||
data = ath5k_hw_reg_read(ah, reg);
|
|
||||||
if (is_set && (data & flag))
|
|
||||||
break;
|
|
||||||
else if ((data & flag) == val)
|
|
||||||
break;
|
|
||||||
udelay(15);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (i <= 0) ? -EAGAIN : 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static inline u32 ath5k_hw_bitswap(u32 val, unsigned int bits)
|
static inline u32 ath5k_hw_bitswap(u32 val, unsigned int bits)
|
||||||
{
|
{
|
||||||
u32 retval = 0, bit, i;
|
u32 retval = 0, bit, i;
|
||||||
|
|
|
@ -20,8 +20,6 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define _ATH5K_PHY
|
|
||||||
|
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
|
|
||||||
#include "ath5k.h"
|
#include "ath5k.h"
|
||||||
|
@ -3144,5 +3142,3 @@ int ath5k_hw_set_txpower_limit(struct ath5k_hw *ah, u8 txpower)
|
||||||
|
|
||||||
return ath5k_hw_txpower(ah, channel, ee_mode, txpower);
|
return ath5k_hw_txpower(ah, channel, ee_mode, txpower);
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef _ATH5K_PHY
|
|
||||||
|
|
|
@ -19,8 +19,6 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define _ATH5K_RESET
|
|
||||||
|
|
||||||
/*****************************\
|
/*****************************\
|
||||||
Reset functions and helpers
|
Reset functions and helpers
|
||||||
\*****************************/
|
\*****************************/
|
||||||
|
@ -34,6 +32,27 @@
|
||||||
#include "base.h"
|
#include "base.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check if a register write has been completed
|
||||||
|
*/
|
||||||
|
int ath5k_hw_register_timeout(struct ath5k_hw *ah, u32 reg, u32 flag, u32 val,
|
||||||
|
bool is_set)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
u32 data;
|
||||||
|
|
||||||
|
for (i = AR5K_TUNE_REGISTER_TIMEOUT; i > 0; i--) {
|
||||||
|
data = ath5k_hw_reg_read(ah, reg);
|
||||||
|
if (is_set && (data & flag))
|
||||||
|
break;
|
||||||
|
else if ((data & flag) == val)
|
||||||
|
break;
|
||||||
|
udelay(15);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (i <= 0) ? -EAGAIN : 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ath5k_hw_write_ofdm_timings - set OFDM timings on AR5212
|
* ath5k_hw_write_ofdm_timings - set OFDM timings on AR5212
|
||||||
*
|
*
|
||||||
|
@ -1386,5 +1405,3 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef _ATH5K_RESET
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче