mac80211: Fix rt2x00 exports
[oweals/openwrt.git] / package / kernel / mac80211 / patches / rt2x00 / 020-rt2800-remove-errornous-duplicate-condition.patch
1 From patchwork Sat Nov  2 17:47:01 2019
2 Content-Type: text/plain; charset="utf-8"
3 MIME-Version: 1.0
4 Content-Transfer-Encoding: 7bit
5 X-Patchwork-Submitter: Daniel Golle <daniel@makrotopia.org>
6 X-Patchwork-Id: 11224189
7 X-Patchwork-Delegate: kvalo@adurom.com
8 Return-Path: <SRS0=CgQo=Y2=vger.kernel.org=linux-wireless-owner@kernel.org>
9 Date: Sat, 2 Nov 2019 18:47:01 +0100
10 From: Daniel Golle <daniel@makrotopia.org>
11 To: Stanislaw Gruszka <sgruszka@redhat.com>
12 Cc: linux-wireless@vger.kernel.org, Roman Yeryomin <roman@advem.lv>,
13         wbob <wbob@jify.de>
14 Subject: [PATCH v2] rt2800: remove errornous duplicate condition
15 Message-ID: <20191102174701.GA1489@makrotopia.org>
16 References: <20191102154639.GA4589@redhat.com>
17 MIME-Version: 1.0
18 Content-Disposition: inline
19 In-Reply-To: <20191102154639.GA4589@redhat.com>
20 User-Agent: Mutt/1.12.2 (2019-09-21)
21 Sender: linux-wireless-owner@vger.kernel.org
22 Precedence: bulk
23 List-ID: <linux-wireless.vger.kernel.org>
24 X-Mailing-List: linux-wireless@vger.kernel.org
25
26 On 2019-10-28 06:07, wbob wrote:
27 > Hello Roman,
28 >
29 > while reading around drivers/net/wireless/ralink/rt2x00/rt2800lib.c
30 > I stumbled on what I think is an edit of yours made in error in march
31 > 2017:
32 >
33 > https://github.com/torvalds/linux/commit/41977e86#diff-dae5dc10da180f3b055809a48118e18aR5281
34 >
35 > RT6352 in line 5281 should not have been introduced as the "else if"
36 > below line 5291 can then not take effect for a RT6352 device. Another
37 > possibility is for line 5291 to be not for RT6352, but this seems
38 > very unlikely. Are you able to clarify still after this substantial time?
39 >
40 > 5277: static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
41 > ...
42 > 5279:  } else if (rt2x00_rt(rt2x00dev, RT5390) ||
43 > 5280:         rt2x00_rt(rt2x00dev, RT5392) ||
44 > 5281:         rt2x00_rt(rt2x00dev, RT6352)) {
45 > ...
46 > 5291:  } else if (rt2x00_rt(rt2x00dev, RT6352)) {
47 > ...
48
49 Hence remove errornous line 5281 to make the driver actually
50 execute the correct initialization routine for MT7620 chips.
51
52 As it was requested by Stanislaw Gruszka remove setting values of
53 MIMO_PS_CFG and TX_PIN_CFG. MIMO_PS_CFG is responsible for MIMO
54 power-safe mode (which is disabled), hence we can drop setting it.
55 TX_PIN_CFG is set correctly in other functions, and as setting this
56 value breaks some devices, rather don't set it here during init, but
57 only modify it later on.
58
59 Fixes: 41977e86c984 ("rt2x00: add support for MT7620")
60 Reported-by: wbob <wbob@jify.de>
61 Reported-by: Roman Yeryomin <roman@advem.lv>
62 Signed-off-by: Daniel Golle <daniel@makrotopia.org>
63 Acked-by: Stanislaw Gruszka <sgruszka@redhat.com>
64 ---
65  drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 5 +----
66  1 file changed, 1 insertion(+), 4 deletions(-)
67
68 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
69 +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
70 @@ -5839,8 +5839,7 @@ static int rt2800_init_registers(struct
71                 rt2800_register_write(rt2x00dev, TX_TXBF_CFG_0, 0x8000fc21);
72                 rt2800_register_write(rt2x00dev, TX_TXBF_CFG_3, 0x00009c40);
73         } else if (rt2x00_rt(rt2x00dev, RT5390) ||
74 -                  rt2x00_rt(rt2x00dev, RT5392) ||
75 -                  rt2x00_rt(rt2x00dev, RT6352)) {
76 +                  rt2x00_rt(rt2x00dev, RT5392)) {
77                 rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
78                 rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606);
79                 rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000);
80 @@ -5854,8 +5853,6 @@ static int rt2800_init_registers(struct
81                 rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000401);
82                 rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x000C0000);
83                 rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000);
84 -               rt2800_register_write(rt2x00dev, MIMO_PS_CFG, 0x00000002);
85 -               rt2800_register_write(rt2x00dev, TX_PIN_CFG, 0x00150F0F);
86                 rt2800_register_write(rt2x00dev, TX_ALC_VGA3, 0x00000000);
87                 rt2800_register_write(rt2x00dev, TX0_BB_GAIN_ATTEN, 0x0);
88                 rt2800_register_write(rt2x00dev, TX1_BB_GAIN_ATTEN, 0x0);