mac80211: rt2x00: remove errornous duplicate condition
authorDaniel Golle <daniel@makrotopia.org>
Sun, 3 Nov 2019 17:31:02 +0000 (18:31 +0100)
committerDaniel Golle <daniel@makrotopia.org>
Sun, 3 Nov 2019 17:31:02 +0000 (18:31 +0100)
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>
package/kernel/mac80211/patches/rt2x00/020-rt2800-remove-errornous-duplicate-condition.patch [new file with mode: 0644]
package/kernel/mac80211/patches/rt2x00/610-rt2x00-change-led-polarity-from-OF.patch
package/kernel/mac80211/patches/rt2x00/650-rt2x00-add-support-for-external-PA-on-MT7620.patch
package/kernel/mac80211/patches/rt2x00/982-rt2x00-add-rf-self-txdc-calibration.patch
package/kernel/mac80211/patches/rt2x00/983-rt2x00-add-r-calibration.patch
package/kernel/mac80211/patches/rt2x00/984-rt2x00-add-rxdcoc-calibration.patch
package/kernel/mac80211/patches/rt2x00/985-rt2x00-add-rxiq-calibration.patch
package/kernel/mac80211/patches/rt2x00/986-rt2x00-add-TX-LOFT-calibration.patch

diff --git a/package/kernel/mac80211/patches/rt2x00/020-rt2800-remove-errornous-duplicate-condition.patch b/package/kernel/mac80211/patches/rt2x00/020-rt2800-remove-errornous-duplicate-condition.patch
new file mode 100644 (file)
index 0000000..91d12b5
--- /dev/null
@@ -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);
index 0efd3a157d4e3ecfc35f70b9dbb40f9f072b418d..fb6647350ea1a5db1be197cbaa3cbaf1d9661412 100644 (file)
@@ -8,7 +8,7 @@
  
  #include "rt2x00.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_qual, LED_TYPE_QUALITY);
  
index 9bbf2ad07e68445d9aa7e1b8eda6b90683215b4c..df234fe0dfb756c0b62f349a1382cc7cb8a6dca7 100644 (file)
@@ -76,7 +76,7 @@ Signed-off-by: Tomislav Po=C5=BEega <pozega.tomislav@gmail.com>
        bbp = rt2800_bbp_read(rt2x00dev, 4);
        rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 2 * conf_is_ht40(conf));
        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);
  
@@ -86,7 +86,7 @@ Signed-off-by: Tomislav Po=C5=BEega <pozega.tomislav@gmail.com>
                if (rt2x00_get_field16(eeprom,
                    EEPROM_NIC_CONF1_EXTERNAL_TX0_PA_3352))
                    __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);
        }
  
index 38558885ac588e8e77d43058c27964861f769978..ecf159d75a4db3e5c6d65a4f59ffca9befa43f70 100644 (file)
@@ -1,6 +1,6 @@
 --- a/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);
  }
  
@@ -59,7 +59,7 @@
  static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev,
                                       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, 17, 0x7C);
  
index e56044f88202f6c535008bdc23bb1da346c87ecb..5b59c95c9abbf4a7815c91bd27ffa1205481b515 100644 (file)
@@ -1,6 +1,6 @@
 --- a/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);
  
  static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev,
                                       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, 17, 0x7C);
  
index 79cc7807b2815e142bcd8b05a0d7441adfcbc981..7cbcc2864a9cecf16c78726e7d0025a69a03f617 100644 (file)
@@ -1,6 +1,6 @@
 --- a/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);
  
@@ -72,7 +72,7 @@
  static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev,
                                       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_rf_self_txdc_cal(rt2x00dev);
index 01bed89a6397bbd3e4bde6f2edd2f64ac1132ab3..6d4548f469417fffd868db76c0acb71fe8693330 100644 (file)
@@ -1,6 +1,6 @@
 --- a/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);
  
  static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev,
                                       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_bw_filter_calibration(rt2x00dev, true);
        rt2800_bw_filter_calibration(rt2x00dev, false);
index eca6573457f6aef18aaf41beec5f3b9b63ef94e0..111c2a42c21c3dc05bbd40ae449d429d94d99b30 100644 (file)
@@ -1,6 +1,6 @@
 --- a/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);
  
  static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev,
                                       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_bw_filter_calibration(rt2x00dev, true);
        rt2800_bw_filter_calibration(rt2x00dev, false);