f896ea5bcbc4234d599dd015e86f1d3ac6f60543
[openwrt/openwrt.git] / package / kernel / mac80211 / patches / rt2x00 / 015-rt2x00-remove-unneeded-check.patch
1 From 0bffbc98e6999bba38d8185a0ddb1ee77369eaec 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 ---
15 .../net/wireless/ralink/rt2x00/rt2800lib.c | 103 +++++++++---------
16 1 file changed, 50 insertions(+), 53 deletions(-)
17
18 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
19 +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
20 @@ -2966,6 +2966,7 @@ static void rt2800_config_channel_rf53xx
21 struct channel_info *info)
22 {
23 u8 rfcsr;
24 + int idx = rf->channel-1;
25
26 rt2800_rfcsr_write(rt2x00dev, 8, rf->rf1);
27 rt2800_rfcsr_write(rt2x00dev, 9, rf->rf3);
28 @@ -3003,60 +3004,56 @@ static void rt2800_config_channel_rf53xx
29
30 rt2800_freq_cal_mode1(rt2x00dev);
31
32 - if (rf->channel <= 14) {
33 - int idx = rf->channel-1;
34 + if (rt2x00_has_cap_bt_coexist(rt2x00dev)) {
35 + if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) {
36 + /* r55/r59 value array of channel 1~14 */
37 + static const char r55_bt_rev[] = {0x83, 0x83,
38 + 0x83, 0x73, 0x73, 0x63, 0x53, 0x53,
39 + 0x53, 0x43, 0x43, 0x43, 0x43, 0x43};
40 + static const char r59_bt_rev[] = {0x0e, 0x0e,
41 + 0x0e, 0x0e, 0x0e, 0x0b, 0x0a, 0x09,
42 + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07};
43 +
44 + rt2800_rfcsr_write(rt2x00dev, 55,
45 + r55_bt_rev[idx]);
46 + rt2800_rfcsr_write(rt2x00dev, 59,
47 + r59_bt_rev[idx]);
48 + } else {
49 + static const char r59_bt[] = {0x8b, 0x8b, 0x8b,
50 + 0x8b, 0x8b, 0x8b, 0x8b, 0x8a, 0x89,
51 + 0x88, 0x88, 0x86, 0x85, 0x84};
52
53 - if (rt2x00_has_cap_bt_coexist(rt2x00dev)) {
54 - if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) {
55 - /* r55/r59 value array of channel 1~14 */
56 - static const char r55_bt_rev[] = {0x83, 0x83,
57 - 0x83, 0x73, 0x73, 0x63, 0x53, 0x53,
58 - 0x53, 0x43, 0x43, 0x43, 0x43, 0x43};
59 - static const char r59_bt_rev[] = {0x0e, 0x0e,
60 - 0x0e, 0x0e, 0x0e, 0x0b, 0x0a, 0x09,
61 - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07};
62 -
63 - rt2800_rfcsr_write(rt2x00dev, 55,
64 - r55_bt_rev[idx]);
65 - rt2800_rfcsr_write(rt2x00dev, 59,
66 - r59_bt_rev[idx]);
67 - } else {
68 - static const char r59_bt[] = {0x8b, 0x8b, 0x8b,
69 - 0x8b, 0x8b, 0x8b, 0x8b, 0x8a, 0x89,
70 - 0x88, 0x88, 0x86, 0x85, 0x84};
71 + rt2800_rfcsr_write(rt2x00dev, 59, r59_bt[idx]);
72 + }
73 + } else {
74 + if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) {
75 + static const char r55_nonbt_rev[] = {0x23, 0x23,
76 + 0x23, 0x23, 0x13, 0x13, 0x03, 0x03,
77 + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03};
78 + static const char r59_nonbt_rev[] = {0x07, 0x07,
79 + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
80 + 0x07, 0x07, 0x06, 0x05, 0x04, 0x04};
81 +
82 + rt2800_rfcsr_write(rt2x00dev, 55,
83 + r55_nonbt_rev[idx]);
84 + rt2800_rfcsr_write(rt2x00dev, 59,
85 + r59_nonbt_rev[idx]);
86 + } else if (rt2x00_rt(rt2x00dev, RT5390) ||
87 + rt2x00_rt(rt2x00dev, RT5392) ||
88 + rt2x00_rt(rt2x00dev, RT6352)) {
89 + static const char r59_non_bt[] = {0x8f, 0x8f,
90 + 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8d,
91 + 0x8a, 0x88, 0x88, 0x87, 0x87, 0x86};
92 +
93 + rt2800_rfcsr_write(rt2x00dev, 59,
94 + r59_non_bt[idx]);
95 + } else if (rt2x00_rt(rt2x00dev, RT5350)) {
96 + static const char r59_non_bt[] = {0x0b, 0x0b,
97 + 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0a,
98 + 0x0a, 0x09, 0x08, 0x07, 0x07, 0x06};
99
100 - rt2800_rfcsr_write(rt2x00dev, 59, r59_bt[idx]);
101 - }
102 - } else {
103 - if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) {
104 - static const char r55_nonbt_rev[] = {0x23, 0x23,
105 - 0x23, 0x23, 0x13, 0x13, 0x03, 0x03,
106 - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03};
107 - static const char r59_nonbt_rev[] = {0x07, 0x07,
108 - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
109 - 0x07, 0x07, 0x06, 0x05, 0x04, 0x04};
110 -
111 - rt2800_rfcsr_write(rt2x00dev, 55,
112 - r55_nonbt_rev[idx]);
113 - rt2800_rfcsr_write(rt2x00dev, 59,
114 - r59_nonbt_rev[idx]);
115 - } else if (rt2x00_rt(rt2x00dev, RT5390) ||
116 - rt2x00_rt(rt2x00dev, RT5392) ||
117 - rt2x00_rt(rt2x00dev, RT6352)) {
118 - static const char r59_non_bt[] = {0x8f, 0x8f,
119 - 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8d,
120 - 0x8a, 0x88, 0x88, 0x87, 0x87, 0x86};
121 -
122 - rt2800_rfcsr_write(rt2x00dev, 59,
123 - r59_non_bt[idx]);
124 - } else if (rt2x00_rt(rt2x00dev, RT5350)) {
125 - static const char r59_non_bt[] = {0x0b, 0x0b,
126 - 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0a,
127 - 0x0a, 0x09, 0x08, 0x07, 0x07, 0x06};
128 -
129 - rt2800_rfcsr_write(rt2x00dev, 59,
130 - r59_non_bt[idx]);
131 - }
132 + rt2800_rfcsr_write(rt2x00dev, 59,
133 + r59_non_bt[idx]);
134 }
135 }
136 }