mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-28 15:05:20 +02:00
51b8905a69
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@23350 3c298f89-4303-0410-b956-a3cf2f4a3e73
117 lines
3.5 KiB
Diff
117 lines
3.5 KiB
Diff
--- a/drivers/net/wireless/ath/ath.h
|
|
+++ b/drivers/net/wireless/ath/ath.h
|
|
@@ -145,6 +145,8 @@ struct ath_common {
|
|
DECLARE_BITMAP(tkip_keymap, ATH_KEYMAX);
|
|
enum ath_crypt_caps crypt_caps;
|
|
|
|
+ unsigned int clockrate;
|
|
+
|
|
struct ath_regulatory regulatory;
|
|
const struct ath_ops *ops;
|
|
const struct ath_bus_ops *bus_ops;
|
|
--- a/drivers/net/wireless/ath/ath9k/hw.c
|
|
+++ b/drivers/net/wireless/ath/ath9k/hw.c
|
|
@@ -91,29 +91,32 @@ static void ath9k_hw_ani_cache_ini_regs(
|
|
/* Helper Functions */
|
|
/********************/
|
|
|
|
-static u32 ath9k_hw_mac_clks(struct ath_hw *ah, u32 usecs)
|
|
+static void ath9k_hw_set_clockrate(struct ath_hw *ah)
|
|
{
|
|
struct ieee80211_conf *conf = &ath9k_hw_common(ah)->hw->conf;
|
|
+ struct ath_common *common = ath9k_hw_common(ah);
|
|
+ unsigned int clockrate;
|
|
|
|
if (!ah->curchan) /* should really check for CCK instead */
|
|
- return usecs *ATH9K_CLOCK_RATE_CCK;
|
|
- if (conf->channel->band == IEEE80211_BAND_2GHZ)
|
|
- return usecs *ATH9K_CLOCK_RATE_2GHZ_OFDM;
|
|
-
|
|
- if (ah->caps.hw_caps & ATH9K_HW_CAP_FASTCLOCK)
|
|
- return usecs * ATH9K_CLOCK_FAST_RATE_5GHZ_OFDM;
|
|
+ clockrate = ATH9K_CLOCK_RATE_CCK;
|
|
+ else if (conf->channel->band == IEEE80211_BAND_2GHZ)
|
|
+ clockrate = ATH9K_CLOCK_RATE_2GHZ_OFDM;
|
|
+ else if (ah->caps.hw_caps & ATH9K_HW_CAP_FASTCLOCK)
|
|
+ clockrate = ATH9K_CLOCK_FAST_RATE_5GHZ_OFDM;
|
|
else
|
|
- return usecs * ATH9K_CLOCK_RATE_5GHZ_OFDM;
|
|
+ clockrate = ATH9K_CLOCK_RATE_5GHZ_OFDM;
|
|
+
|
|
+ if (conf_is_ht40(conf))
|
|
+ clockrate *= 2;
|
|
+
|
|
+ common->clockrate = clockrate;
|
|
}
|
|
|
|
static u32 ath9k_hw_mac_to_clks(struct ath_hw *ah, u32 usecs)
|
|
{
|
|
- struct ieee80211_conf *conf = &ath9k_hw_common(ah)->hw->conf;
|
|
+ struct ath_common *common = ath9k_hw_common(ah);
|
|
|
|
- if (conf_is_ht40(conf))
|
|
- return ath9k_hw_mac_clks(ah, usecs) * 2;
|
|
- else
|
|
- return ath9k_hw_mac_clks(ah, usecs);
|
|
+ return usecs * common->clockrate;
|
|
}
|
|
|
|
bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout)
|
|
@@ -1168,6 +1171,7 @@ static bool ath9k_hw_channel_change(stru
|
|
"Failed to set channel\n");
|
|
return false;
|
|
}
|
|
+ ath9k_hw_set_clockrate(ah);
|
|
|
|
ah->eep_ops->set_txpower(ah, chan,
|
|
ath9k_regd_get_ctl(regulatory, chan),
|
|
@@ -1380,6 +1384,8 @@ int ath9k_hw_reset(struct ath_hw *ah, st
|
|
if (r)
|
|
return r;
|
|
|
|
+ ath9k_hw_set_clockrate(ah);
|
|
+
|
|
ENABLE_REGWRITE_BUFFER(ah);
|
|
|
|
for (i = 0; i < AR_NUM_DCU; i++)
|
|
--- a/drivers/net/wireless/ath/ath9k/ani.c
|
|
+++ b/drivers/net/wireless/ath/ath9k/ani.c
|
|
@@ -465,35 +465,13 @@ static void ath9k_hw_ani_lower_immunity(
|
|
ath9k_hw_set_cck_nil(ah, aniState->cckNoiseImmunityLevel - 1);
|
|
}
|
|
|
|
-static u8 ath9k_hw_chan_2_clockrate_mhz(struct ath_hw *ah)
|
|
-{
|
|
- struct ath9k_channel *chan = ah->curchan;
|
|
- struct ieee80211_conf *conf = &ath9k_hw_common(ah)->hw->conf;
|
|
- u8 clockrate; /* in MHz */
|
|
-
|
|
- if (!ah->curchan) /* should really check for CCK instead */
|
|
- clockrate = ATH9K_CLOCK_RATE_CCK;
|
|
- else if (conf->channel->band == IEEE80211_BAND_2GHZ)
|
|
- clockrate = ATH9K_CLOCK_RATE_2GHZ_OFDM;
|
|
- else if (IS_CHAN_A_FAST_CLOCK(ah, chan))
|
|
- clockrate = ATH9K_CLOCK_FAST_RATE_5GHZ_OFDM;
|
|
- else
|
|
- clockrate = ATH9K_CLOCK_RATE_5GHZ_OFDM;
|
|
-
|
|
- if (conf_is_ht40(conf))
|
|
- return clockrate * 2;
|
|
-
|
|
- return clockrate;
|
|
-}
|
|
-
|
|
static int32_t ath9k_hw_ani_get_listen_time(struct ath_hw *ah)
|
|
{
|
|
+ struct ath_common *common = ath9k_hw_common(ah);
|
|
int32_t listen_time;
|
|
- int32_t clock_rate;
|
|
|
|
ath9k_hw_update_cycle_counters(ah);
|
|
- clock_rate = ath9k_hw_chan_2_clockrate_mhz(ah) * 1000;
|
|
- listen_time = ah->listen_time / clock_rate;
|
|
+ listen_time = ah->listen_time / (common->clockrate * 1000);
|
|
ah->listen_time = 0;
|
|
|
|
return listen_time;
|