mac80211: sync latest version from trunk - improves stability and performance
[10.03/openwrt.git] / package / mac80211 / patches / 520-ath9k_paprd_ht40_fix.patch
1 --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
2 +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
3 @@ -4762,6 +4762,7 @@ static void ath9k_hw_ar9300_set_txpower(
4         struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah);
5         struct ath_common *common = ath9k_hw_common(ah);
6         struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
7 +       struct ar9300_modal_eep_header *modal_hdr;
8         u8 targetPowerValT2[ar9300RateSize];
9         u8 target_power_val_t2_eep[ar9300RateSize];
10         unsigned int i = 0, paprd_scale_factor = 0;
11 @@ -4771,15 +4772,17 @@ static void ath9k_hw_ar9300_set_txpower(
12  
13         if (ah->eep_ops->get_eeprom(ah, EEP_PAPRD)) {
14                 if (IS_CHAN_2GHZ(chan))
15 -                       ah->paprd_ratemask = (IS_CHAN_HT40(chan) ?
16 -                               le32_to_cpu(eep->modalHeader2G.papdRateMaskHt40) :
17 -                               le32_to_cpu(eep->modalHeader2G.papdRateMaskHt20))
18 -                               & AR9300_PAPRD_RATE_MASK;
19 +                       modal_hdr = &eep->modalHeader2G;
20                 else
21 -                       ah->paprd_ratemask = (IS_CHAN_HT40(chan) ?
22 -                               le32_to_cpu(eep->modalHeader5G.papdRateMaskHt40) :
23 -                               le32_to_cpu(eep->modalHeader5G.papdRateMaskHt20))
24 -                               & AR9300_PAPRD_RATE_MASK;
25 +                       modal_hdr = &eep->modalHeader5G;
26 +
27 +               ah->paprd_ratemask =
28 +                       le32_to_cpu(modal_hdr->papdRateMaskHt20) &
29 +                       AR9300_PAPRD_RATE_MASK;
30 +
31 +               ah->paprd_ratemask_ht40 =
32 +                       le32_to_cpu(modal_hdr->papdRateMaskHt40) &
33 +                       AR9300_PAPRD_RATE_MASK;
34  
35                 paprd_scale_factor = ar9003_get_paprd_scale_factor(ah, chan);
36                 min_pwridx = IS_CHAN_HT40(chan) ? ALL_TARGET_HT40_0_8_16 :
37 --- a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
38 +++ b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
39 @@ -134,7 +134,7 @@ static int ar9003_paprd_setup_single_tab
40         REG_RMW_FIELD(ah, AR_PHY_PAPRD_AM2PM, AR_PHY_PAPRD_AM2PM_MASK,
41                       ah->paprd_ratemask);
42         REG_RMW_FIELD(ah, AR_PHY_PAPRD_HT40, AR_PHY_PAPRD_HT40_MASK,
43 -                     AR_PHY_PAPRD_HT40_MASK);
44 +                     ah->paprd_ratemask_ht40);
45  
46         for (i = 0; i < ah->caps.max_txchains; i++) {
47                 REG_RMW_FIELD(ah, ctrl0[i],
48 --- a/drivers/net/wireless/ath/ath9k/hw.h
49 +++ b/drivers/net/wireless/ath/ath9k/hw.h
50 @@ -837,6 +837,7 @@ struct ath_hw {
51         unsigned int paprd_target_power;
52         unsigned int paprd_training_power;
53         unsigned int paprd_ratemask;
54 +       unsigned int paprd_ratemask_ht40;
55         bool paprd_table_write_done;
56         u32 paprd_gain_table_entries[PAPRD_GAIN_TABLE_ENTRIES];
57         u8 paprd_gain_table_index[PAPRD_GAIN_TABLE_ENTRIES];