aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath9k/hw.c
diff options
context:
space:
mode:
authorSenthil Balasubramanian <senthilkumar@atheros.com>2009-02-12 03:27:03 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-02-27 14:51:46 -0500
commit8bd1d07f9345750bd4d767e6c1600919672f98ba (patch)
tree42b201403637888b4c5cde5e1fd096c373d4ca05 /drivers/net/wireless/ath9k/hw.c
parent81cb7623ad3b408f871fa36b774fc20d8dfccac0 (diff)
ath9k: Add open loop control support
This patch adds Open Loop Control support for Atheros chipsets that supports open loop power control. Signed-off-by: Senthil Balasubramanian <senthilkumar@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath9k/hw.c')
-rw-r--r--drivers/net/wireless/ath9k/hw.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/drivers/net/wireless/ath9k/hw.c b/drivers/net/wireless/ath9k/hw.c
index 4af1aac16785..e33c53fb6b7e 100644
--- a/drivers/net/wireless/ath9k/hw.c
+++ b/drivers/net/wireless/ath9k/hw.c
@@ -1202,10 +1202,23 @@ static u32 ath9k_hw_ini_fixup(struct ath_hw *ah,
1202 return ath9k_hw_def_ini_fixup(ah, pEepData, reg, value); 1202 return ath9k_hw_def_ini_fixup(ah, pEepData, reg, value);
1203} 1203}
1204 1204
1205static void ath9k_olc_init(struct ath_hw *ah)
1206{
1207 u32 i;
1208
1209 for (i = 0; i < AR9280_TX_GAIN_TABLE_SIZE; i++)
1210 ah->originalGain[i] =
1211 MS(REG_READ(ah, AR_PHY_TX_GAIN_TBL1 + i * 4),
1212 AR_PHY_TX_GAIN);
1213 ah->PDADCdelta = 0;
1214}
1215
1205static int ath9k_hw_process_ini(struct ath_hw *ah, 1216static int ath9k_hw_process_ini(struct ath_hw *ah,
1206 struct ath9k_channel *chan, 1217 struct ath9k_channel *chan,
1207 enum ath9k_ht_macmode macmode) 1218 enum ath9k_ht_macmode macmode)
1208{ 1219{
1220#define OLC_FOR_AR9280_20_LATER (AR_SREV_9280_20_OR_LATER(ah) && \
1221 ah->eep_ops->get_eeprom(ah, EEP_OL_PWRCTRL))
1209 int i, regWrites = 0; 1222 int i, regWrites = 0;
1210 struct ieee80211_channel *channel = chan->chan; 1223 struct ieee80211_channel *channel = chan->chan;
1211 u32 modesIndex, freqIndex; 1224 u32 modesIndex, freqIndex;
@@ -1308,6 +1321,9 @@ static int ath9k_hw_process_ini(struct ath_hw *ah,
1308 ath9k_hw_set_regs(ah, chan, macmode); 1321 ath9k_hw_set_regs(ah, chan, macmode);
1309 ath9k_hw_init_chain_masks(ah); 1322 ath9k_hw_init_chain_masks(ah);
1310 1323
1324 if (OLC_FOR_AR9280_20_LATER)
1325 ath9k_olc_init(ah);
1326
1311 status = ah->eep_ops->set_txpower(ah, chan, 1327 status = ah->eep_ops->set_txpower(ah, chan,
1312 ath9k_regd_get_ctl(ah, chan), 1328 ath9k_regd_get_ctl(ah, chan),
1313 channel->max_antenna_gain * 2, 1329 channel->max_antenna_gain * 2,
@@ -1515,6 +1531,7 @@ static bool ath9k_hw_set_reset_power_on(struct ath_hw *ah)
1515 AR_RTC_FORCE_WAKE_ON_INT); 1531 AR_RTC_FORCE_WAKE_ON_INT);
1516 1532
1517 REG_WRITE(ah, AR_RTC_RESET, 0); 1533 REG_WRITE(ah, AR_RTC_RESET, 0);
1534 udelay(2);
1518 REG_WRITE(ah, AR_RTC_RESET, 1); 1535 REG_WRITE(ah, AR_RTC_RESET, 1);
1519 1536
1520 if (!ath9k_hw_wait(ah, 1537 if (!ath9k_hw_wait(ah,
@@ -1582,7 +1599,10 @@ static void ath9k_hw_set_regs(struct ath_hw *ah, struct ath9k_channel *chan,
1582static bool ath9k_hw_chip_reset(struct ath_hw *ah, 1599static bool ath9k_hw_chip_reset(struct ath_hw *ah,
1583 struct ath9k_channel *chan) 1600 struct ath9k_channel *chan)
1584{ 1601{
1585 if (!ath9k_hw_set_reset_reg(ah, ATH9K_RESET_WARM)) 1602 if (OLC_FOR_AR9280_20_LATER) {
1603 if (!ath9k_hw_set_reset_reg(ah, ATH9K_RESET_POWER_ON))
1604 return false;
1605 } else if (!ath9k_hw_set_reset_reg(ah, ATH9K_RESET_WARM))
1586 return false; 1606 return false;
1587 1607
1588 if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE)) 1608 if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE))
@@ -3404,6 +3424,10 @@ bool ath9k_hw_getcapability(struct ath_hw *ah, enum ath9k_capability_type type,
3404 return 0; 3424 return 0;
3405 } 3425 }
3406 return false; 3426 return false;
3427 case ATH9K_CAP_DS:
3428 return (AR_SREV_9280_20_OR_LATER(ah) &&
3429 (ah->eep_ops->get_eeprom(ah, EEP_RC_CHAIN_MASK) == 1))
3430 ? false : true;
3407 default: 3431 default:
3408 return false; 3432 return false;
3409 } 3433 }