ath9k: fix some more endian issues
[openwrt.git] / package / mac80211 / patches / 520-ath9k_endian_fixes.patch
1 --- a/drivers/net/wireless/ath/ath9k/eeprom.h
2 +++ b/drivers/net/wireless/ath/ath9k/eeprom.h
3 @@ -236,6 +236,15 @@
4  #define CTL_EDGE_TPOWER(_ctl) ((_ctl) & 0x3f)
5  #define CTL_EDGE_FLAGS(_ctl) (((_ctl) >> 6) & 0x03)
6  
7 +#define LNA_CTL_BUF_MODE       BIT(0)
8 +#define LNA_CTL_ISEL_LO                BIT(1)
9 +#define LNA_CTL_ISEL_HI                BIT(2)
10 +#define LNA_CTL_BUF_IN         BIT(3)
11 +#define LNA_CTL_FEM_BAND       BIT(4)
12 +#define LNA_CTL_LOCAL_BIAS     BIT(5)
13 +#define LNA_CTL_FORCE_XPA      BIT(6)
14 +#define LNA_CTL_USE_ANT1       BIT(7)
15 +
16  enum eeprom_param {
17         EEP_NFTHRESH_5,
18         EEP_NFTHRESH_2,
19 @@ -381,10 +390,7 @@ struct modal_eep_header {
20         u8 xatten2Margin[AR5416_MAX_CHAINS];
21         u8 ob_ch1;
22         u8 db_ch1;
23 -       u8 useAnt1:1,
24 -           force_xpaon:1,
25 -           local_bias:1,
26 -           femBandSelectUsed:1, xlnabufin:1, xlnaisel:2, xlnabufmode:1;
27 +       u8 lna_ctl;
28         u8 miscBits;
29         u16 xpaBiasLvlFreq[3];
30         u8 futureModal[6];
31 --- a/drivers/net/wireless/ath/ath9k/eeprom_def.c
32 +++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c
33 @@ -451,9 +451,10 @@ static void ath9k_hw_def_set_board_value
34                 ath9k_hw_analog_shift_rmw(ah, AR_AN_TOP2,
35                                           AR_AN_TOP2_LOCALBIAS,
36                                           AR_AN_TOP2_LOCALBIAS_S,
37 -                                         pModal->local_bias);
38 +                                         !!(pModal->lna_ctl &
39 +                                            LNA_CTL_LOCAL_BIAS));
40                 REG_RMW_FIELD(ah, AR_PHY_XPA_CFG, AR_PHY_FORCE_XPA_CFG,
41 -                             pModal->force_xpaon);
42 +                             !!(pModal->lna_ctl & LNA_CTL_FORCE_XPA));
43         }
44  
45         REG_RMW_FIELD(ah, AR_PHY_SETTLING, AR_PHY_SETTLING_SWITCH,
46 @@ -1432,9 +1433,9 @@ static u8 ath9k_hw_def_get_num_ant_confi
47  
48         num_ant_config = 1;
49  
50 -       if (pBase->version >= 0x0E0D)
51 -               if (pModal->useAnt1)
52 -                       num_ant_config += 1;
53 +       if (pBase->version >= 0x0E0D &&
54 +           (pModal->lna_ctl & LNA_CTL_USE_ANT1))
55 +               num_ant_config += 1;
56  
57         return num_ant_config;
58  }