Rebase from upstream commit : 3bb9dcf44627ffdd313fe92c563ae454b6ff8aa6
[librecmc/librecmc.git] / package / kernel / mac80211 / patches / rt2x00 / 015-rt2x00-remove-unneeded-check.patch
1 From 17ae2acd1a6f5148edd80d84194e5d7c80be360e Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Tomislav=20Po=C5=BEega?= <pozega.tomislav@gmail.com>
3 Date: Wed, 13 Feb 2019 11:09:12 +0100
4 Subject: [PATCH 15/28] rt2x00: remove unneeded check
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 Remove band check from rf53xx channel config routine since all chips
10 using it are single band.
11
12 Signed-off-by: Tomislav Požega <pozega.tomislav@gmail.com>
13 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
14 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
15 ---
16  .../net/wireless/ralink/rt2x00/rt2800lib.c    | 103 +++++++++---------
17  1 file changed, 50 insertions(+), 53 deletions(-)
18
19 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
20 +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
21 @@ -2966,6 +2966,7 @@ static void rt2800_config_channel_rf53xx
22                                          struct channel_info *info)
23  {
24         u8 rfcsr;
25 +       int idx = rf->channel-1;
26  
27         rt2800_rfcsr_write(rt2x00dev, 8, rf->rf1);
28         rt2800_rfcsr_write(rt2x00dev, 9, rf->rf3);
29 @@ -3003,60 +3004,56 @@ static void rt2800_config_channel_rf53xx
30  
31         rt2800_freq_cal_mode1(rt2x00dev);
32  
33 -       if (rf->channel <= 14) {
34 -               int idx = rf->channel-1;
35 +       if (rt2x00_has_cap_bt_coexist(rt2x00dev)) {
36 +               if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) {
37 +                       /* r55/r59 value array of channel 1~14 */
38 +                       static const char r55_bt_rev[] = {0x83, 0x83,
39 +                               0x83, 0x73, 0x73, 0x63, 0x53, 0x53,
40 +                               0x53, 0x43, 0x43, 0x43, 0x43, 0x43};
41 +                       static const char r59_bt_rev[] = {0x0e, 0x0e,
42 +                               0x0e, 0x0e, 0x0e, 0x0b, 0x0a, 0x09,
43 +                               0x07, 0x07, 0x07, 0x07, 0x07, 0x07};
44 +
45 +                       rt2800_rfcsr_write(rt2x00dev, 55,
46 +                                          r55_bt_rev[idx]);
47 +                       rt2800_rfcsr_write(rt2x00dev, 59,
48 +                                          r59_bt_rev[idx]);
49 +               } else {
50 +                       static const char r59_bt[] = {0x8b, 0x8b, 0x8b,
51 +                               0x8b, 0x8b, 0x8b, 0x8b, 0x8a, 0x89,
52 +                               0x88, 0x88, 0x86, 0x85, 0x84};
53  
54 -               if (rt2x00_has_cap_bt_coexist(rt2x00dev)) {
55 -                       if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) {
56 -                               /* r55/r59 value array of channel 1~14 */
57 -                               static const char r55_bt_rev[] = {0x83, 0x83,
58 -                                       0x83, 0x73, 0x73, 0x63, 0x53, 0x53,
59 -                                       0x53, 0x43, 0x43, 0x43, 0x43, 0x43};
60 -                               static const char r59_bt_rev[] = {0x0e, 0x0e,
61 -                                       0x0e, 0x0e, 0x0e, 0x0b, 0x0a, 0x09,
62 -                                       0x07, 0x07, 0x07, 0x07, 0x07, 0x07};
63 -
64 -                               rt2800_rfcsr_write(rt2x00dev, 55,
65 -                                                  r55_bt_rev[idx]);
66 -                               rt2800_rfcsr_write(rt2x00dev, 59,
67 -                                                  r59_bt_rev[idx]);
68 -                       } else {
69 -                               static const char r59_bt[] = {0x8b, 0x8b, 0x8b,
70 -                                       0x8b, 0x8b, 0x8b, 0x8b, 0x8a, 0x89,
71 -                                       0x88, 0x88, 0x86, 0x85, 0x84};
72 +                       rt2800_rfcsr_write(rt2x00dev, 59, r59_bt[idx]);
73 +               }
74 +       } else {
75 +               if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) {
76 +                       static const char r55_nonbt_rev[] = {0x23, 0x23,
77 +                               0x23, 0x23, 0x13, 0x13, 0x03, 0x03,
78 +                               0x03, 0x03, 0x03, 0x03, 0x03, 0x03};
79 +                       static const char r59_nonbt_rev[] = {0x07, 0x07,
80 +                               0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
81 +                               0x07, 0x07, 0x06, 0x05, 0x04, 0x04};
82 +
83 +                       rt2800_rfcsr_write(rt2x00dev, 55,
84 +                                          r55_nonbt_rev[idx]);
85 +                       rt2800_rfcsr_write(rt2x00dev, 59,
86 +                                          r59_nonbt_rev[idx]);
87 +               } else if (rt2x00_rt(rt2x00dev, RT5390) ||
88 +                          rt2x00_rt(rt2x00dev, RT5392) ||
89 +                          rt2x00_rt(rt2x00dev, RT6352)) {
90 +                       static const char r59_non_bt[] = {0x8f, 0x8f,
91 +                               0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8d,
92 +                               0x8a, 0x88, 0x88, 0x87, 0x87, 0x86};
93 +
94 +                       rt2800_rfcsr_write(rt2x00dev, 59,
95 +                                          r59_non_bt[idx]);
96 +               } else if (rt2x00_rt(rt2x00dev, RT5350)) {
97 +                       static const char r59_non_bt[] = {0x0b, 0x0b,
98 +                               0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0a,
99 +                               0x0a, 0x09, 0x08, 0x07, 0x07, 0x06};
100  
101 -                               rt2800_rfcsr_write(rt2x00dev, 59, r59_bt[idx]);
102 -                       }
103 -               } else {
104 -                       if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) {
105 -                               static const char r55_nonbt_rev[] = {0x23, 0x23,
106 -                                       0x23, 0x23, 0x13, 0x13, 0x03, 0x03,
107 -                                       0x03, 0x03, 0x03, 0x03, 0x03, 0x03};
108 -                               static const char r59_nonbt_rev[] = {0x07, 0x07,
109 -                                       0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
110 -                                       0x07, 0x07, 0x06, 0x05, 0x04, 0x04};
111 -
112 -                               rt2800_rfcsr_write(rt2x00dev, 55,
113 -                                                  r55_nonbt_rev[idx]);
114 -                               rt2800_rfcsr_write(rt2x00dev, 59,
115 -                                                  r59_nonbt_rev[idx]);
116 -                       } else if (rt2x00_rt(rt2x00dev, RT5390) ||
117 -                                  rt2x00_rt(rt2x00dev, RT5392) ||
118 -                                  rt2x00_rt(rt2x00dev, RT6352)) {
119 -                               static const char r59_non_bt[] = {0x8f, 0x8f,
120 -                                       0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8d,
121 -                                       0x8a, 0x88, 0x88, 0x87, 0x87, 0x86};
122 -
123 -                               rt2800_rfcsr_write(rt2x00dev, 59,
124 -                                                  r59_non_bt[idx]);
125 -                       } else if (rt2x00_rt(rt2x00dev, RT5350)) {
126 -                               static const char r59_non_bt[] = {0x0b, 0x0b,
127 -                                       0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0a,
128 -                                       0x0a, 0x09, 0x08, 0x07, 0x07, 0x06};
129 -
130 -                               rt2800_rfcsr_write(rt2x00dev, 59,
131 -                                                  r59_non_bt[idx]);
132 -                       }
133 +                       rt2800_rfcsr_write(rt2x00dev, 59,
134 +                                          r59_non_bt[idx]);
135                 }
136         }
137  }