aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2010-04-26 15:04:35 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-04-27 16:09:18 -0400
commit6b42e8d03bef975085c0397806d00fbd1df67eb8 (patch)
tree42ddfa6f922ad677ee55355822c555de2a11cb10 /drivers
parent5b75d0fca5b8cd2657fb240f2112e272a115b2f9 (diff)
ath9k_hw: fix fast clock handling for 5GHz channels
Combine multiple checks that were supposed to check for the same conditions, but didn't. Always enable fast PLL clock on AR9280 2.0 Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/ath/ath9k/ar5008_phy.c5
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9002_phy.c16
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_phy.c4
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c8
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.h5
5 files changed, 18 insertions, 20 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ar5008_phy.c b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
index de8ce1291a46..b2c17c98bb38 100644
--- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
@@ -850,7 +850,7 @@ static int ar5008_hw_process_ini(struct ath_hw *ah,
850 850
851 REG_WRITE_ARRAY(&ah->iniBB_RfGain, freqIndex, regWrites); 851 REG_WRITE_ARRAY(&ah->iniBB_RfGain, freqIndex, regWrites);
852 852
853 if (AR_SREV_9280_20(ah) && IS_CHAN_A_5MHZ_SPACED(chan)) { 853 if (IS_CHAN_A_FAST_CLOCK(ah, chan)) {
854 REG_WRITE_ARRAY(&ah->iniModesAdditional, modesIndex, 854 REG_WRITE_ARRAY(&ah->iniModesAdditional, modesIndex,
855 regWrites); 855 regWrites);
856 } 856 }
@@ -892,8 +892,7 @@ static void ar5008_hw_set_rfmode(struct ath_hw *ah, struct ath9k_channel *chan)
892 rfMode |= (IS_CHAN_5GHZ(chan)) ? 892 rfMode |= (IS_CHAN_5GHZ(chan)) ?
893 AR_PHY_MODE_RF5GHZ : AR_PHY_MODE_RF2GHZ; 893 AR_PHY_MODE_RF5GHZ : AR_PHY_MODE_RF2GHZ;
894 894
895 if ((AR_SREV_9280_20(ah) || AR_SREV_9300_20_OR_LATER(ah)) 895 if (IS_CHAN_A_FAST_CLOCK(ah, chan))
896 && IS_CHAN_A_5MHZ_SPACED(chan))
897 rfMode |= (AR_PHY_MODE_DYNAMIC | AR_PHY_MODE_DYN_CCK_DISABLE); 896 rfMode |= (AR_PHY_MODE_DYNAMIC | AR_PHY_MODE_DYN_CCK_DISABLE);
898 897
899 REG_WRITE(ah, AR_PHY_MODE, rfMode); 898 REG_WRITE(ah, AR_PHY_MODE, rfMode);
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_phy.c b/drivers/net/wireless/ath/ath9k/ar9002_phy.c
index 18cfe1a9781c..ed314e89bfe1 100644
--- a/drivers/net/wireless/ath/ath9k/ar9002_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.c
@@ -455,16 +455,12 @@ static u32 ar9002_hw_compute_pll_control(struct ath_hw *ah,
455 pll |= SM(0x2, AR_RTC_9160_PLL_CLKSEL); 455 pll |= SM(0x2, AR_RTC_9160_PLL_CLKSEL);
456 456
457 if (chan && IS_CHAN_5GHZ(chan)) { 457 if (chan && IS_CHAN_5GHZ(chan)) {
458 pll |= SM(0x28, AR_RTC_9160_PLL_DIV); 458 if (IS_CHAN_A_FAST_CLOCK(ah, chan))
459 459 pll = 0x142c;
460 460 else if (AR_SREV_9280_20(ah))
461 if (AR_SREV_9280_20(ah)) { 461 pll = 0x2850;
462 if (((chan->channel % 20) == 0) 462 else
463 || ((chan->channel % 10) == 0)) 463 pll |= SM(0x28, AR_RTC_9160_PLL_DIV);
464 pll = 0x2850;
465 else
466 pll = 0x142c;
467 }
468 } else { 464 } else {
469 pll |= SM(0x2c, AR_RTC_9160_PLL_DIV); 465 pll |= SM(0x2c, AR_RTC_9160_PLL_DIV);
470 } 466 }
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
index bf8ec687f9e0..806f4a54b620 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
@@ -583,7 +583,7 @@ static int ar9003_hw_process_ini(struct ath_hw *ah,
583 * For 5GHz channels requiring Fast Clock, apply 583 * For 5GHz channels requiring Fast Clock, apply
584 * different modal values. 584 * different modal values.
585 */ 585 */
586 if (IS_CHAN_A_5MHZ_SPACED(chan)) 586 if (IS_CHAN_A_FAST_CLOCK(ah, chan))
587 REG_WRITE_ARRAY(&ah->iniModesAdditional, 587 REG_WRITE_ARRAY(&ah->iniModesAdditional,
588 modesIndex, regWrites); 588 modesIndex, regWrites);
589 589
@@ -613,7 +613,7 @@ static void ar9003_hw_set_rfmode(struct ath_hw *ah,
613 rfMode |= (IS_CHAN_B(chan) || IS_CHAN_G(chan)) 613 rfMode |= (IS_CHAN_B(chan) || IS_CHAN_G(chan))
614 ? AR_PHY_MODE_DYNAMIC : AR_PHY_MODE_OFDM; 614 ? AR_PHY_MODE_DYNAMIC : AR_PHY_MODE_OFDM;
615 615
616 if (IS_CHAN_A_5MHZ_SPACED(chan)) 616 if (IS_CHAN_A_FAST_CLOCK(ah, chan))
617 rfMode |= (AR_PHY_MODE_DYNAMIC | AR_PHY_MODE_DYN_CCK_DISABLE); 617 rfMode |= (AR_PHY_MODE_DYNAMIC | AR_PHY_MODE_DYN_CCK_DISABLE);
618 618
619 REG_WRITE(ah, AR_PHY_MODE, rfMode); 619 REG_WRITE(ah, AR_PHY_MODE, rfMode);
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 7bb700151ca6..8f37f1c2a380 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -1228,8 +1228,7 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
1228 (chan->channel != ah->curchan->channel) && 1228 (chan->channel != ah->curchan->channel) &&
1229 ((chan->channelFlags & CHANNEL_ALL) == 1229 ((chan->channelFlags & CHANNEL_ALL) ==
1230 (ah->curchan->channelFlags & CHANNEL_ALL)) && 1230 (ah->curchan->channelFlags & CHANNEL_ALL)) &&
1231 !(AR_SREV_9280(ah) || IS_CHAN_A_5MHZ_SPACED(chan) || 1231 !AR_SREV_9280(ah)) {
1232 IS_CHAN_A_5MHZ_SPACED(ah->curchan))) {
1233 1232
1234 if (ath9k_hw_channel_change(ah, chan)) { 1233 if (ath9k_hw_channel_change(ah, chan)) {
1235 ath9k_hw_loadnf(ah, ah->curchan); 1234 ath9k_hw_loadnf(ah, ah->curchan);
@@ -2202,6 +2201,11 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah)
2202 pCap->txs_len = sizeof(struct ar9003_txs); 2201 pCap->txs_len = sizeof(struct ar9003_txs);
2203 } else { 2202 } else {
2204 pCap->tx_desc_len = sizeof(struct ath_desc); 2203 pCap->tx_desc_len = sizeof(struct ath_desc);
2204 if (AR_SREV_9280_20(ah) &&
2205 ((ah->eep_ops->get_eeprom(ah, EEP_MINOR_REV) <=
2206 AR5416_EEP_MINOR_VER_16) ||
2207 ah->eep_ops->get_eeprom(ah, EEP_FSTCLK_5G)))
2208 pCap->hw_caps |= ATH9K_HW_CAP_FASTCLOCK;
2205 } 2209 }
2206 2210
2207 if (AR_SREV_9300_20_OR_LATER(ah)) 2211 if (AR_SREV_9300_20_OR_LATER(ah))
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index 7a1347b2453f..bc682da28b2a 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -369,10 +369,9 @@ struct ath9k_channel {
369#define IS_CHAN_2GHZ(_c) (((_c)->channelFlags & CHANNEL_2GHZ) != 0) 369#define IS_CHAN_2GHZ(_c) (((_c)->channelFlags & CHANNEL_2GHZ) != 0)
370#define IS_CHAN_HALF_RATE(_c) (((_c)->channelFlags & CHANNEL_HALF) != 0) 370#define IS_CHAN_HALF_RATE(_c) (((_c)->channelFlags & CHANNEL_HALF) != 0)
371#define IS_CHAN_QUARTER_RATE(_c) (((_c)->channelFlags & CHANNEL_QUARTER) != 0) 371#define IS_CHAN_QUARTER_RATE(_c) (((_c)->channelFlags & CHANNEL_QUARTER) != 0)
372#define IS_CHAN_A_5MHZ_SPACED(_c) \ 372#define IS_CHAN_A_FAST_CLOCK(_ah, _c) \
373 ((((_c)->channelFlags & CHANNEL_5GHZ) != 0) && \ 373 ((((_c)->channelFlags & CHANNEL_5GHZ) != 0) && \
374 (((_c)->channel % 20) != 0) && \ 374 ((_ah)->caps.hw_caps & ATH9K_HW_CAP_FASTCLOCK))
375 (((_c)->channel % 10) != 0))
376 375
377/* These macros check chanmode and not channelFlags */ 376/* These macros check chanmode and not channelFlags */
378#define IS_CHAN_B(_c) ((_c)->chanmode == CHANNEL_B) 377#define IS_CHAN_B(_c) ((_c)->chanmode == CHANNEL_B)