ath9k: add a number of ar93xx eeprom related fixes / enhancements
[openwrt/openwrt.git] / package / mac80211 / patches / 571-ath9k_xpa_timing_control.patch
1 --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
2 +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
3 @@ -3962,9 +3962,32 @@ static void ar9003_hw_txend_to_xpa_off_a
4 AR_PHY_XPA_TIMING_CTL_TX_END_XPAA_OFF, value);
5 }
6
7 +static void ar9003_hw_xpa_timing_control_apply(struct ath_hw *ah, bool is_2ghz)
8 +{
9 + struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
10 + u8 xpa_ctl;
11 +
12 + if (!(eep->baseEepHeader.featureEnable & 0x80))
13 + return;
14 +
15 + if (!AR_SREV_9300(ah) && !AR_SREV_9340(ah) && !AR_SREV_9580(ah))
16 + return;
17 +
18 + if (is_2ghz) {
19 + xpa_ctl = eep->modalHeader2G.txFrameToXpaOn;
20 + REG_RMW_FIELD(ah, AR_PHY_XPA_TIMING_CTL,
21 + AR_PHY_XPA_TIMING_CTL_FRAME_XPAB_ON, xpa_ctl);
22 + } else {
23 + xpa_ctl = eep->modalHeader5G.txFrameToXpaOn;
24 + REG_RMW_FIELD(ah, AR_PHY_XPA_TIMING_CTL,
25 + AR_PHY_XPA_TIMING_CTL_FRAME_XPAA_ON, xpa_ctl);
26 + }
27 +}
28 +
29 static void ath9k_hw_ar9300_set_board_values(struct ath_hw *ah,
30 struct ath9k_channel *chan)
31 {
32 + ar9003_hw_xpa_timing_control_apply(ah, IS_CHAN_2GHZ(chan));
33 ar9003_hw_xpa_bias_level_apply(ah, IS_CHAN_2GHZ(chan));
34 ar9003_hw_ant_ctrl_apply(ah, IS_CHAN_2GHZ(chan));
35 ar9003_hw_drive_strength_apply(ah);