mirror of
https://github.com/openwrt/openwrt.git
synced 2025-02-09 12:21:33 +00:00
mac80211: rt2x00: remove errornous duplicate condition
https://patchwork.kernel.org/patch/11224189/ -- On 2019-10-28 06:07, wbob wrote: > Hello Roman, > > while reading around drivers/net/wireless/ralink/rt2x00/rt2800lib.c > I stumbled on what I think is an edit of yours made in error in march > 2017: > > https://github.com/torvalds/linux/commit/41977e86#diff-dae5dc10da180f3b055809a48118e18aR5281 > > RT6352 in line 5281 should not have been introduced as the "else if" > below line 5291 can then not take effect for a RT6352 device. Another > possibility is for line 5291 to be not for RT6352, but this seems > very unlikely. Are you able to clarify still after this substantial time? > > 5277: static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) > ... > 5279: } else if (rt2x00_rt(rt2x00dev, RT5390) || > 5280: rt2x00_rt(rt2x00dev, RT5392) || > 5281: rt2x00_rt(rt2x00dev, RT6352)) { > ... > 5291: } else if (rt2x00_rt(rt2x00dev, RT6352)) { > ... Hence remove errornous line 5281 to make the driver actually execute the correct initialization routine for MT7620 chips. As it was requested by Stanislaw Gruszka remove setting values of MIMO_PS_CFG and TX_PIN_CFG. MIMO_PS_CFG is responsible for MIMO power-safe mode (which is disabled), hence we can drop setting it. TX_PIN_CFG is set correctly in other functions, and as setting this value breaks some devices, rather don't set it here during init, but only modify it later on. Fixes: 41977e86c984 ("rt2x00: add support for MT7620") Reported-by: wbob <wbob@jify.de> Reported-by: Roman Yeryomin <roman@advem.lv> Signed-off-by: Daniel Golle <daniel@makrotopia.org> Acked-by: Stanislaw Gruszka <sgruszka@redhat.com> -- Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
parent
5f108bbc58
commit
43ae50978a
@ -0,0 +1,88 @@
|
|||||||
|
From patchwork Sat Nov 2 17:47:01 2019
|
||||||
|
Content-Type: text/plain; charset="utf-8"
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Transfer-Encoding: 7bit
|
||||||
|
X-Patchwork-Submitter: Daniel Golle <daniel@makrotopia.org>
|
||||||
|
X-Patchwork-Id: 11224189
|
||||||
|
X-Patchwork-Delegate: kvalo@adurom.com
|
||||||
|
Return-Path: <SRS0=CgQo=Y2=vger.kernel.org=linux-wireless-owner@kernel.org>
|
||||||
|
Date: Sat, 2 Nov 2019 18:47:01 +0100
|
||||||
|
From: Daniel Golle <daniel@makrotopia.org>
|
||||||
|
To: Stanislaw Gruszka <sgruszka@redhat.com>
|
||||||
|
Cc: linux-wireless@vger.kernel.org, Roman Yeryomin <roman@advem.lv>,
|
||||||
|
wbob <wbob@jify.de>
|
||||||
|
Subject: [PATCH v2] rt2800: remove errornous duplicate condition
|
||||||
|
Message-ID: <20191102174701.GA1489@makrotopia.org>
|
||||||
|
References: <20191102154639.GA4589@redhat.com>
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Disposition: inline
|
||||||
|
In-Reply-To: <20191102154639.GA4589@redhat.com>
|
||||||
|
User-Agent: Mutt/1.12.2 (2019-09-21)
|
||||||
|
Sender: linux-wireless-owner@vger.kernel.org
|
||||||
|
Precedence: bulk
|
||||||
|
List-ID: <linux-wireless.vger.kernel.org>
|
||||||
|
X-Mailing-List: linux-wireless@vger.kernel.org
|
||||||
|
|
||||||
|
On 2019-10-28 06:07, wbob wrote:
|
||||||
|
> Hello Roman,
|
||||||
|
>
|
||||||
|
> while reading around drivers/net/wireless/ralink/rt2x00/rt2800lib.c
|
||||||
|
> I stumbled on what I think is an edit of yours made in error in march
|
||||||
|
> 2017:
|
||||||
|
>
|
||||||
|
> https://github.com/torvalds/linux/commit/41977e86#diff-dae5dc10da180f3b055809a48118e18aR5281
|
||||||
|
>
|
||||||
|
> RT6352 in line 5281 should not have been introduced as the "else if"
|
||||||
|
> below line 5291 can then not take effect for a RT6352 device. Another
|
||||||
|
> possibility is for line 5291 to be not for RT6352, but this seems
|
||||||
|
> very unlikely. Are you able to clarify still after this substantial time?
|
||||||
|
>
|
||||||
|
> 5277: static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
|
||||||
|
> ...
|
||||||
|
> 5279: } else if (rt2x00_rt(rt2x00dev, RT5390) ||
|
||||||
|
> 5280: rt2x00_rt(rt2x00dev, RT5392) ||
|
||||||
|
> 5281: rt2x00_rt(rt2x00dev, RT6352)) {
|
||||||
|
> ...
|
||||||
|
> 5291: } else if (rt2x00_rt(rt2x00dev, RT6352)) {
|
||||||
|
> ...
|
||||||
|
|
||||||
|
Hence remove errornous line 5281 to make the driver actually
|
||||||
|
execute the correct initialization routine for MT7620 chips.
|
||||||
|
|
||||||
|
As it was requested by Stanislaw Gruszka remove setting values of
|
||||||
|
MIMO_PS_CFG and TX_PIN_CFG. MIMO_PS_CFG is responsible for MIMO
|
||||||
|
power-safe mode (which is disabled), hence we can drop setting it.
|
||||||
|
TX_PIN_CFG is set correctly in other functions, and as setting this
|
||||||
|
value breaks some devices, rather don't set it here during init, but
|
||||||
|
only modify it later on.
|
||||||
|
|
||||||
|
Fixes: 41977e86c984 ("rt2x00: add support for MT7620")
|
||||||
|
Reported-by: wbob <wbob@jify.de>
|
||||||
|
Reported-by: Roman Yeryomin <roman@advem.lv>
|
||||||
|
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||||
|
Acked-by: Stanislaw Gruszka <sgruszka@redhat.com>
|
||||||
|
---
|
||||||
|
drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 5 +----
|
||||||
|
1 file changed, 1 insertion(+), 4 deletions(-)
|
||||||
|
|
||||||
|
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
|
||||||
|
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
|
||||||
|
@@ -5839,8 +5839,7 @@ static int rt2800_init_registers(struct
|
||||||
|
rt2800_register_write(rt2x00dev, TX_TXBF_CFG_0, 0x8000fc21);
|
||||||
|
rt2800_register_write(rt2x00dev, TX_TXBF_CFG_3, 0x00009c40);
|
||||||
|
} else if (rt2x00_rt(rt2x00dev, RT5390) ||
|
||||||
|
- rt2x00_rt(rt2x00dev, RT5392) ||
|
||||||
|
- rt2x00_rt(rt2x00dev, RT6352)) {
|
||||||
|
+ rt2x00_rt(rt2x00dev, RT5392)) {
|
||||||
|
rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
|
||||||
|
rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606);
|
||||||
|
rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000);
|
||||||
|
@@ -5854,8 +5853,6 @@ static int rt2800_init_registers(struct
|
||||||
|
rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000401);
|
||||||
|
rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x000C0000);
|
||||||
|
rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000);
|
||||||
|
- rt2800_register_write(rt2x00dev, MIMO_PS_CFG, 0x00000002);
|
||||||
|
- rt2800_register_write(rt2x00dev, TX_PIN_CFG, 0x00150F0F);
|
||||||
|
rt2800_register_write(rt2x00dev, TX_ALC_VGA3, 0x00000000);
|
||||||
|
rt2800_register_write(rt2x00dev, TX0_BB_GAIN_ATTEN, 0x0);
|
||||||
|
rt2800_register_write(rt2x00dev, TX1_BB_GAIN_ATTEN, 0x0);
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#include "rt2x00.h"
|
#include "rt2x00.h"
|
||||||
#include "rt2800lib.h"
|
#include "rt2800lib.h"
|
||||||
@@ -9534,6 +9535,17 @@ static int rt2800_init_eeprom(struct rt2
|
@@ -9531,6 +9532,17 @@ static int rt2800_init_eeprom(struct rt2
|
||||||
rt2800_init_led(rt2x00dev, &rt2x00dev->led_assoc, LED_TYPE_ASSOC);
|
rt2800_init_led(rt2x00dev, &rt2x00dev->led_assoc, LED_TYPE_ASSOC);
|
||||||
rt2800_init_led(rt2x00dev, &rt2x00dev->led_qual, LED_TYPE_QUALITY);
|
rt2800_init_led(rt2x00dev, &rt2x00dev->led_qual, LED_TYPE_QUALITY);
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ Signed-off-by: Tomislav Po=C5=BEega <pozega.tomislav@gmail.com>
|
|||||||
bbp = rt2800_bbp_read(rt2x00dev, 4);
|
bbp = rt2800_bbp_read(rt2x00dev, 4);
|
||||||
rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 2 * conf_is_ht40(conf));
|
rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 2 * conf_is_ht40(conf));
|
||||||
rt2800_bbp_write(rt2x00dev, 4, bbp);
|
rt2800_bbp_write(rt2x00dev, 4, bbp);
|
||||||
@@ -9563,7 +9602,8 @@ static int rt2800_init_eeprom(struct rt2
|
@@ -9560,7 +9599,8 @@ static int rt2800_init_eeprom(struct rt2
|
||||||
*/
|
*/
|
||||||
eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1);
|
eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1);
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ Signed-off-by: Tomislav Po=C5=BEega <pozega.tomislav@gmail.com>
|
|||||||
if (rt2x00_get_field16(eeprom,
|
if (rt2x00_get_field16(eeprom,
|
||||||
EEPROM_NIC_CONF1_EXTERNAL_TX0_PA_3352))
|
EEPROM_NIC_CONF1_EXTERNAL_TX0_PA_3352))
|
||||||
__set_bit(CAPABILITY_EXTERNAL_PA_TX0,
|
__set_bit(CAPABILITY_EXTERNAL_PA_TX0,
|
||||||
@@ -9574,6 +9614,18 @@ static int rt2800_init_eeprom(struct rt2
|
@@ -9571,6 +9611,18 @@ static int rt2800_init_eeprom(struct rt2
|
||||||
&rt2x00dev->cap_flags);
|
&rt2x00dev->cap_flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
|
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
|
||||||
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
|
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
|
||||||
@@ -8425,6 +8425,58 @@ static void rt2800_init_rfcsr_5592(struc
|
@@ -8422,6 +8422,58 @@ static void rt2800_init_rfcsr_5592(struc
|
||||||
rt2800_led_open_drain_enable(rt2x00dev);
|
rt2800_led_open_drain_enable(rt2x00dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +59,7 @@
|
|||||||
static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev,
|
static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev,
|
||||||
bool set_bw, bool is_ht40)
|
bool set_bw, bool is_ht40)
|
||||||
{
|
{
|
||||||
@@ -9032,6 +9084,7 @@ static void rt2800_init_rfcsr_6352(struc
|
@@ -9029,6 +9081,7 @@ static void rt2800_init_rfcsr_6352(struc
|
||||||
rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00);
|
rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00);
|
||||||
rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C);
|
rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C);
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
|
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
|
||||||
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
|
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
|
||||||
@@ -8477,6 +8477,160 @@ void rt2800_rf_self_txdc_cal(struct rt2x
|
@@ -8474,6 +8474,160 @@ void rt2800_rf_self_txdc_cal(struct rt2x
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(rt2800_rf_self_txdc_cal);
|
EXPORT_SYMBOL_GPL(rt2800_rf_self_txdc_cal);
|
||||||
|
|
||||||
@ -161,7 +161,7 @@
|
|||||||
static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev,
|
static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev,
|
||||||
bool set_bw, bool is_ht40)
|
bool set_bw, bool is_ht40)
|
||||||
{
|
{
|
||||||
@@ -9084,6 +9238,7 @@ static void rt2800_init_rfcsr_6352(struc
|
@@ -9081,6 +9235,7 @@ static void rt2800_init_rfcsr_6352(struc
|
||||||
rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00);
|
rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00);
|
||||||
rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C);
|
rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C);
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
|
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
|
||||||
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
|
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
|
||||||
@@ -8631,6 +8631,71 @@ void rt2800_r_calibration(struct rt2x00_
|
@@ -8628,6 +8628,71 @@ void rt2800_r_calibration(struct rt2x00_
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(rt2800_r_calibration);
|
EXPORT_SYMBOL_GPL(rt2800_r_calibration);
|
||||||
|
|
||||||
@ -72,7 +72,7 @@
|
|||||||
static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev,
|
static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev,
|
||||||
bool set_bw, bool is_ht40)
|
bool set_bw, bool is_ht40)
|
||||||
{
|
{
|
||||||
@@ -9240,6 +9305,7 @@ static void rt2800_init_rfcsr_6352(struc
|
@@ -9237,6 +9302,7 @@ static void rt2800_init_rfcsr_6352(struc
|
||||||
|
|
||||||
rt2800_r_calibration(rt2x00dev);
|
rt2800_r_calibration(rt2x00dev);
|
||||||
rt2800_rf_self_txdc_cal(rt2x00dev);
|
rt2800_rf_self_txdc_cal(rt2x00dev);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
|
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
|
||||||
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
|
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
|
||||||
@@ -8696,6 +8696,386 @@ void rt2800_rxdcoc_calibration(struct rt
|
@@ -8693,6 +8693,386 @@ void rt2800_rxdcoc_calibration(struct rt
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(rt2800_rxdcoc_calibration);
|
EXPORT_SYMBOL_GPL(rt2800_rxdcoc_calibration);
|
||||||
|
|
||||||
@ -387,7 +387,7 @@
|
|||||||
static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev,
|
static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev,
|
||||||
bool set_bw, bool is_ht40)
|
bool set_bw, bool is_ht40)
|
||||||
{
|
{
|
||||||
@@ -9308,6 +9688,7 @@ static void rt2800_init_rfcsr_6352(struc
|
@@ -9305,6 +9685,7 @@ static void rt2800_init_rfcsr_6352(struc
|
||||||
rt2800_rxdcoc_calibration(rt2x00dev);
|
rt2800_rxdcoc_calibration(rt2x00dev);
|
||||||
rt2800_bw_filter_calibration(rt2x00dev, true);
|
rt2800_bw_filter_calibration(rt2x00dev, true);
|
||||||
rt2800_bw_filter_calibration(rt2x00dev, false);
|
rt2800_bw_filter_calibration(rt2x00dev, false);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
|
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
|
||||||
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
|
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
|
||||||
@@ -9076,6 +9076,954 @@ restore_value:
|
@@ -9073,6 +9073,954 @@ restore_value:
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(rt2800_rxiq_calibration);
|
EXPORT_SYMBOL_GPL(rt2800_rxiq_calibration);
|
||||||
|
|
||||||
@ -955,7 +955,7 @@
|
|||||||
static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev,
|
static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev,
|
||||||
bool set_bw, bool is_ht40)
|
bool set_bw, bool is_ht40)
|
||||||
{
|
{
|
||||||
@@ -9688,6 +10636,7 @@ static void rt2800_init_rfcsr_6352(struc
|
@@ -9685,6 +10633,7 @@ static void rt2800_init_rfcsr_6352(struc
|
||||||
rt2800_rxdcoc_calibration(rt2x00dev);
|
rt2800_rxdcoc_calibration(rt2x00dev);
|
||||||
rt2800_bw_filter_calibration(rt2x00dev, true);
|
rt2800_bw_filter_calibration(rt2x00dev, true);
|
||||||
rt2800_bw_filter_calibration(rt2x00dev, false);
|
rt2800_bw_filter_calibration(rt2x00dev, false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user