mac80211: rt2x00: some improvements for rt5592
authorShiji Yang <yangshiji66@qq.com>
Wed, 25 Dec 2024 11:39:29 +0000 (19:39 +0800)
committerHauke Mehrtens <hauke@hauke-m.de>
Sat, 4 Jan 2025 21:06:36 +0000 (22:06 +0100)
This patch contains some performance and stability improvements
for RT5592:

1. Fix RFCSR register init values for RT5592.
2. Fix BBP register init values for RT5592.

Signed-off-by: Shiji Yang <yangshiji66@qq.com>
Link: https://github.com/openwrt/openwrt/pull/16845
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
package/kernel/mac80211/patches/rt2x00/622-01-rt2x00-fix-RFCSR-register-init-values-for-RT5592.patch [new file with mode: 0644]
package/kernel/mac80211/patches/rt2x00/622-02-rt2x00-fix-BBP-register-init-values-for-RT5592.patch [new file with mode: 0644]
package/kernel/mac80211/patches/rt2x00/994-rt2x00-import-support-for-external-LNA-on-MT7620.patch
package/kernel/mac80211/patches/rt2x00/996-rt2x00-mt7620-differentiate-based-on-SoC-CHIP_VER.patch

diff --git a/package/kernel/mac80211/patches/rt2x00/622-01-rt2x00-fix-RFCSR-register-init-values-for-RT5592.patch b/package/kernel/mac80211/patches/rt2x00/622-01-rt2x00-fix-RFCSR-register-init-values-for-RT5592.patch
new file mode 100644 (file)
index 0000000..15d1601
--- /dev/null
@@ -0,0 +1,230 @@
+From b48887d5de9921d0ff9e88068e3cd555a383d702 Mon Sep 17 00:00:00 2001
+From: Shiji Yang <yangshiji66@outlook.com>
+Date: Sun, 22 Dec 2024 17:06:59 +0800
+Subject: [PATCH 1/2] rt2x00: fix RFCSR register init values for RT5592
+
+Based on Raink proprietary driver 2.7.1.5, correct the initial
+values of some RFCSR registers for RT5592.
+
+Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
+---
+ .../net/wireless/ralink/rt2x00/rt2800lib.c    | 122 ++++++++----------
+ 1 file changed, 53 insertions(+), 69 deletions(-)
+
+--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+@@ -3576,9 +3576,8 @@ static void rt2800_config_channel_rf55xx
+               /* TODO RF27 <- tssi */
+-              rfcsr = rf->channel <= 10 ? 0x07 : 0x06;
+-              rt2800_rfcsr_write(rt2x00dev, 23, rfcsr);
+-              rt2800_rfcsr_write(rt2x00dev, 59, rfcsr);
++              rt2800_rfcsr_write(rt2x00dev, 23, rf->channel <= 10 ? 0x08 : 0x07);
++              rt2800_rfcsr_write(rt2x00dev, 59, rf->channel <= 4 ? 0x06 : 0x04);
+               if (is_11b) {
+                       /* CCK */
+@@ -3599,7 +3598,7 @@ static void rt2800_config_channel_rf55xx
+               power_bound = POWER_BOUND;
+               ep_reg = 0x2;
+       } else {
+-              rt2800_rfcsr_write(rt2x00dev, 10, 0x97);
++              rt2800_rfcsr_write(rt2x00dev, 10, 0x95);
+               /* FIMXE: RF11 overwrite */
+               rt2800_rfcsr_write(rt2x00dev, 11, 0x40);
+               rt2800_rfcsr_write(rt2x00dev, 25, 0xBF);
+@@ -3608,13 +3607,15 @@ static void rt2800_config_channel_rf55xx
+               rt2800_rfcsr_write(rt2x00dev, 37, 0x04);
+               rt2800_rfcsr_write(rt2x00dev, 38, 0x85);
+               rt2800_rfcsr_write(rt2x00dev, 40, 0x42);
+-              rt2800_rfcsr_write(rt2x00dev, 41, 0xBB);
++              rt2800_rfcsr_write(rt2x00dev, 41, 0xAB);
+               rt2800_rfcsr_write(rt2x00dev, 42, 0xD7);
+-              rt2800_rfcsr_write(rt2x00dev, 45, 0x41);
++              rt2800_rfcsr_write(rt2x00dev, 45, 0x01);
+               rt2800_rfcsr_write(rt2x00dev, 48, 0x00);
+               rt2800_rfcsr_write(rt2x00dev, 57, 0x77);
++              rt2800_rfcsr_write(rt2x00dev, 58, 0x19);
+               rt2800_rfcsr_write(rt2x00dev, 60, 0x05);
+               rt2800_rfcsr_write(rt2x00dev, 61, 0x01);
++              rt2800_rfcsr_write(rt2x00dev, 62, 0x19);
+               /* TODO RF27 <- tssi */
+@@ -3623,82 +3624,59 @@ static void rt2800_config_channel_rf55xx
+                       rt2800_rfcsr_write(rt2x00dev, 12, 0x2E);
+                       rt2800_rfcsr_write(rt2x00dev, 13, 0x22);
+                       rt2800_rfcsr_write(rt2x00dev, 22, 0x60);
+-                      rt2800_rfcsr_write(rt2x00dev, 23, 0x7F);
+-                      if (rf->channel <= 50)
+-                              rt2800_rfcsr_write(rt2x00dev, 24, 0x09);
+-                      else if (rf->channel >= 52)
+-                              rt2800_rfcsr_write(rt2x00dev, 24, 0x07);
++                      rt2800_rfcsr_write(rt2x00dev, 23, 0x7E);
++                      rt2800_rfcsr_write(rt2x00dev, 24, 0x07);
+                       rt2800_rfcsr_write(rt2x00dev, 39, 0x1C);
+                       rt2800_rfcsr_write(rt2x00dev, 43, 0x5B);
+-                      rt2800_rfcsr_write(rt2x00dev, 44, 0X40);
+                       rt2800_rfcsr_write(rt2x00dev, 46, 0X00);
+-                      rt2800_rfcsr_write(rt2x00dev, 51, 0xFE);
+-                      rt2800_rfcsr_write(rt2x00dev, 52, 0x0C);
+-                      rt2800_rfcsr_write(rt2x00dev, 54, 0xF8);
++                      rt2800_rfcsr_write(rt2x00dev, 51, 0xFD);
++                      rt2800_rfcsr_write(rt2x00dev, 52, 0x0E);
++                      rt2800_rfcsr_write(rt2x00dev, 55, 0x04);
++                      rt2800_rfcsr_write(rt2x00dev, 56, 0xBB);
++                      rt2800_rfcsr_write(rt2x00dev, 59, 0x7C);
++
+                       if (rf->channel <= 50) {
+-                              rt2800_rfcsr_write(rt2x00dev, 55, 0x06),
+-                              rt2800_rfcsr_write(rt2x00dev, 56, 0xD3);
++                              rt2800_rfcsr_write(rt2x00dev, 44, 0X32);
++                              rt2800_rfcsr_write(rt2x00dev, 54, 0xF9);
+                       } else if (rf->channel >= 52) {
+-                              rt2800_rfcsr_write(rt2x00dev, 55, 0x04);
+-                              rt2800_rfcsr_write(rt2x00dev, 56, 0xBB);
++                              rt2800_rfcsr_write(rt2x00dev, 44, 0X2A);
++                              rt2800_rfcsr_write(rt2x00dev, 54, 0xF8);
+                       }
+-
+-                      rt2800_rfcsr_write(rt2x00dev, 58, 0x15);
+-                      rt2800_rfcsr_write(rt2x00dev, 59, 0x7F);
+-                      rt2800_rfcsr_write(rt2x00dev, 62, 0x15);
+-
+               } else if (rf->channel >= 100 && rf->channel <= 165) {
+-
+                       rt2800_rfcsr_write(rt2x00dev, 12, 0x0E);
+                       rt2800_rfcsr_write(rt2x00dev, 13, 0x42);
+                       rt2800_rfcsr_write(rt2x00dev, 22, 0x40);
+-                      if (rf->channel <= 153) {
+-                              rt2800_rfcsr_write(rt2x00dev, 23, 0x3C);
+-                              rt2800_rfcsr_write(rt2x00dev, 24, 0x06);
+-                      } else if (rf->channel >= 155) {
+-                              rt2800_rfcsr_write(rt2x00dev, 23, 0x38);
+-                              rt2800_rfcsr_write(rt2x00dev, 24, 0x05);
+-                      }
++                      rt2800_rfcsr_write(rt2x00dev, 52, 0x06);
++                      rt2800_rfcsr_write(rt2x00dev, 55, 0x01);
++
+                       if (rf->channel <= 138) {
++                              rt2800_rfcsr_write(rt2x00dev, 23, 0x7C);
+                               rt2800_rfcsr_write(rt2x00dev, 39, 0x1A);
+                               rt2800_rfcsr_write(rt2x00dev, 43, 0x3B);
+-                              rt2800_rfcsr_write(rt2x00dev, 44, 0x20);
+                               rt2800_rfcsr_write(rt2x00dev, 46, 0x18);
+-                      } else if (rf->channel >= 140) {
++                      } else {
++                              rt2800_rfcsr_write(rt2x00dev, 23, 0x78);
+                               rt2800_rfcsr_write(rt2x00dev, 39, 0x18);
+                               rt2800_rfcsr_write(rt2x00dev, 43, 0x1B);
+-                              rt2800_rfcsr_write(rt2x00dev, 44, 0x10);
+                               rt2800_rfcsr_write(rt2x00dev, 46, 0X08);
+                       }
+-                      if (rf->channel <= 124)
+-                              rt2800_rfcsr_write(rt2x00dev, 51, 0xFC);
+-                      else if (rf->channel >= 126)
+-                              rt2800_rfcsr_write(rt2x00dev, 51, 0xEC);
+-                      if (rf->channel <= 138)
+-                              rt2800_rfcsr_write(rt2x00dev, 52, 0x06);
+-                      else if (rf->channel >= 140)
+-                              rt2800_rfcsr_write(rt2x00dev, 52, 0x06);
+-                      rt2800_rfcsr_write(rt2x00dev, 54, 0xEB);
+-                      if (rf->channel <= 138)
+-                              rt2800_rfcsr_write(rt2x00dev, 55, 0x01);
+-                      else if (rf->channel >= 140)
+-                              rt2800_rfcsr_write(rt2x00dev, 55, 0x00);
+-                      if (rf->channel <= 128)
+-                              rt2800_rfcsr_write(rt2x00dev, 56, 0xBB);
+-                      else if (rf->channel >= 130)
+-                              rt2800_rfcsr_write(rt2x00dev, 56, 0xAB);
+-                      if (rf->channel <= 116)
+-                              rt2800_rfcsr_write(rt2x00dev, 58, 0x1D);
+-                      else if (rf->channel >= 118)
+-                              rt2800_rfcsr_write(rt2x00dev, 58, 0x15);
+-                      if (rf->channel <= 138)
+-                              rt2800_rfcsr_write(rt2x00dev, 59, 0x3F);
+-                      else if (rf->channel >= 140)
+-                              rt2800_rfcsr_write(rt2x00dev, 59, 0x7C);
+-                      if (rf->channel <= 116)
+-                              rt2800_rfcsr_write(rt2x00dev, 62, 0x1D);
+-                      else if (rf->channel >= 118)
+-                              rt2800_rfcsr_write(rt2x00dev, 62, 0x15);
++
++                      if (rf->channel <= 114) {
++                              rt2800_rfcsr_write(rt2x00dev, 24, 0x02);
++                              rt2800_rfcsr_write(rt2x00dev, 44, 0x1A);
++                              rt2800_rfcsr_write(rt2x00dev, 54, 0xEA);
++                              rt2800_rfcsr_write(rt2x00dev, 56, 0xB3);
++                      } else {
++                              rt2800_rfcsr_write(rt2x00dev, 24, 0x03);
++                              rt2800_rfcsr_write(rt2x00dev, 44, 0x0A);
++                              rt2800_rfcsr_write(rt2x00dev, 54, 0xF9);
++                              rt2800_rfcsr_write(rt2x00dev, 56, 0x9B);
++                      }
++
++                      rt2800_rfcsr_write(rt2x00dev, 51, rf->channel <= 124 ? 0xFC : 0xEC);
++                      rt2800_rfcsr_write(rt2x00dev, 58, rf->channel <= 116 ? 0x1D : 0x15);
++                      rfcsr = (rf->channel >= 116 && rf->channel <= 138) ? 0x7E : 0x7C;
++                      rt2800_rfcsr_write(rt2x00dev, 59, rfcsr);
+               }
+               power_bound = POWER_BOUND_5G;
+@@ -3710,7 +3688,7 @@ static void rt2800_config_channel_rf55xx
+               rt2x00_set_field8(&rfcsr, RFCSR49_TX, power_bound);
+       else
+               rt2x00_set_field8(&rfcsr, RFCSR49_TX, info->default_power1);
+-      if (is_type_ep)
++      if (!is_type_ep)
+               rt2x00_set_field8(&rfcsr, RFCSR49_EP, ep_reg);
+       rt2800_rfcsr_write(rt2x00dev, 49, rfcsr);
+@@ -3719,7 +3697,7 @@ static void rt2800_config_channel_rf55xx
+               rt2x00_set_field8(&rfcsr, RFCSR50_TX, power_bound);
+       else
+               rt2x00_set_field8(&rfcsr, RFCSR50_TX, info->default_power2);
+-      if (is_type_ep)
++      if (!is_type_ep)
+               rt2x00_set_field8(&rfcsr, RFCSR50_EP, ep_reg);
+       rt2800_rfcsr_write(rt2x00dev, 50, rfcsr);
+@@ -3740,7 +3718,6 @@ static void rt2800_config_channel_rf55xx
+       rt2x00_set_field8(&rfcsr, RFCSR1_RX2_PD, 0);
+       rt2800_rfcsr_write(rt2x00dev, 1, rfcsr);
+-      rt2800_rfcsr_write(rt2x00dev, 6, 0xe4);
+       if (conf_is_ht40(conf))
+               rt2800_rfcsr_write(rt2x00dev, 30, 0x16);
+@@ -8505,12 +8482,15 @@ static void rt2800_init_rfcsr_5392(struc
+ static void rt2800_init_rfcsr_5592(struct rt2x00_dev *rt2x00dev)
+ {
++      u16 eeprom;
++
+       rt2800_rf_init_calibration(rt2x00dev, 30);
+       rt2800_rfcsr_write(rt2x00dev, 1, 0x3F);
++      rt2800_rfcsr_write(rt2x00dev, 2, 0x80);
+       rt2800_rfcsr_write(rt2x00dev, 3, 0x08);
+       rt2800_rfcsr_write(rt2x00dev, 5, 0x10);
+-      rt2800_rfcsr_write(rt2x00dev, 6, 0xE4);
++      rt2800_rfcsr_write(rt2x00dev, 6, 0xE0);
+       rt2800_rfcsr_write(rt2x00dev, 7, 0x00);
+       rt2800_rfcsr_write(rt2x00dev, 14, 0x00);
+       rt2800_rfcsr_write(rt2x00dev, 15, 0x00);
+@@ -8526,9 +8506,13 @@ static void rt2800_init_rfcsr_5592(struc
+       rt2800_rfcsr_write(rt2x00dev, 34, 0x07);
+       rt2800_rfcsr_write(rt2x00dev, 35, 0x12);
+       rt2800_rfcsr_write(rt2x00dev, 47, 0x0C);
+-      rt2800_rfcsr_write(rt2x00dev, 53, 0x22);
++      rt2800_rfcsr_write(rt2x00dev, 53, 0x44);
+       rt2800_rfcsr_write(rt2x00dev, 63, 0x07);
++      eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF2);
++      if (!rt2x00_get_field16(eeprom, EEPROM_NIC_CONF2_CRYSTAL))
++              rt2800_rfcsr_write(rt2x00dev, 6, 0xE4);
++
+       rt2800_rfcsr_write(rt2x00dev, 2, 0x80);
+       msleep(1);
diff --git a/package/kernel/mac80211/patches/rt2x00/622-02-rt2x00-fix-BBP-register-init-values-for-RT5592.patch b/package/kernel/mac80211/patches/rt2x00/622-02-rt2x00-fix-BBP-register-init-values-for-RT5592.patch
new file mode 100644 (file)
index 0000000..19d1951
--- /dev/null
@@ -0,0 +1,119 @@
+From 1847d817df5585f9d957d16ed2a56ceb41cf6df7 Mon Sep 17 00:00:00 2001
+From: Shiji Yang <yangshiji66@outlook.com>
+Date: Sun, 22 Dec 2024 17:06:59 +0800
+Subject: [PATCH 2/2] rt2x00: fix BBP register init values for RT5592
+
+Based on Raink proprietary driver 2.7.1.5, correct the initial
+values of some BBP registers for RT5592.
+
+Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
+---
+ .../net/wireless/ralink/rt2x00/rt2800lib.c    | 32 +++++++++----------
+ 1 file changed, 15 insertions(+), 17 deletions(-)
+
+--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+@@ -3746,6 +3746,7 @@ static void rt2800_config_channel_rf55xx
+       rt2800_bbp_write(rt2x00dev, 80, (rf->channel <= 14) ? 0x0E : 0x08);
+       rt2800_bbp_write(rt2x00dev, 81, (rf->channel <= 14) ? 0x3A : 0x38);
+       rt2800_bbp_write(rt2x00dev, 82, (rf->channel <= 14) ? 0x62 : 0x92);
++      rt2800_bbp_write(rt2x00dev, 95, (rf->channel <= 14) ? 0x9A : 0x1A);
+       /* GLRT band configuration */
+       rt2800_bbp_write(rt2x00dev, 195, 128);
+@@ -3758,7 +3759,7 @@ static void rt2800_config_channel_rf55xx
+       rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0x32 : 0x20);
+       rt2800_bbp_write(rt2x00dev, 195, 133);
+       rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0x28 : 0x7F);
+-      rt2800_bbp_write(rt2x00dev, 195, 124);
++      rt2800_bbp_write(rt2x00dev, 195, 134);
+       rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0x19 : 0x7F);
+ }
+@@ -4304,7 +4305,8 @@ static void rt2800_config_channel(struct
+               rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain);
+               rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain);
+               rt2800_bbp_write(rt2x00dev, 64, 0x37 - rt2x00dev->lna_gain);
+-              if (rt2x00_rt(rt2x00dev, RT6352))
++              if (rt2x00_rt(rt2x00dev, RT5592) ||
++                  rt2x00_rt(rt2x00dev, RT6352))
+                       rt2800_bbp_write(rt2x00dev, 86, 0x38);
+               else
+                       rt2800_bbp_write(rt2x00dev, 86, 0);
+@@ -4313,6 +4315,7 @@ static void rt2800_config_channel(struct
+       if (rf->channel <= 14) {
+               if (!rt2x00_rt(rt2x00dev, RT5390) &&
+                   !rt2x00_rt(rt2x00dev, RT5392) &&
++                  !rt2x00_rt(rt2x00dev, RT5592) &&
+                   !rt2x00_rt(rt2x00dev, RT6352)) {
+                       if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
+                               rt2800_bbp_write(rt2x00dev, 82, 0x62);
+@@ -4336,17 +4339,20 @@ static void rt2800_config_channel(struct
+               else if (rt2x00_rt(rt2x00dev, RT3593) ||
+                        rt2x00_rt(rt2x00dev, RT3883))
+                       rt2800_bbp_write(rt2x00dev, 82, 0x82);
+-              else if (!rt2x00_rt(rt2x00dev, RT6352))
++              else if (!rt2x00_rt(rt2x00dev, RT5592) &&
++                       !rt2x00_rt(rt2x00dev, RT6352))
+                       rt2800_bbp_write(rt2x00dev, 82, 0xf2);
+               if (rt2x00_rt(rt2x00dev, RT3593) ||
+                   rt2x00_rt(rt2x00dev, RT3883))
+                       rt2800_bbp_write(rt2x00dev, 83, 0x9a);
+-              if (rt2x00_has_cap_external_lna_a(rt2x00dev))
+-                      rt2800_bbp_write(rt2x00dev, 75, 0x46);
+-              else
+-                      rt2800_bbp_write(rt2x00dev, 75, 0x50);
++              if (!rt2x00_rt(rt2x00dev, RT5592)) {
++                      if (rt2x00_has_cap_external_lna_a(rt2x00dev))
++                              rt2800_bbp_write(rt2x00dev, 75, 0x46);
++                      else
++                              rt2800_bbp_write(rt2x00dev, 75, 0x50);
++              }
+       }
+       reg = rt2800_register_read(rt2x00dev, TX_BAND_CFG);
+@@ -5783,12 +5789,10 @@ static inline void rt2800_set_vgc(struct
+               if (rt2x00_rt(rt2x00dev, RT3572) ||
+                   rt2x00_rt(rt2x00dev, RT3593) ||
+                   rt2x00_rt(rt2x00dev, RT3883) ||
++                  rt2x00_rt(rt2x00dev, RT5592) ||
+                   rt2x00_rt(rt2x00dev, RT6352)) {
+                       rt2800_bbp_write_with_rx_chain(rt2x00dev, 66,
+                                                      vgc_level);
+-              } else if (rt2x00_rt(rt2x00dev, RT5592)) {
+-                      rt2800_bbp_write(rt2x00dev, 83, qual->rssi > -65 ? 0x4a : 0x7a);
+-                      rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, vgc_level);
+               } else {
+                       rt2800_bbp_write(rt2x00dev, 66, vgc_level);
+               }
+@@ -7016,7 +7020,6 @@ static void rt2800_init_bbp_5592(struct
+       rt2800_bbp_write(rt2x00dev, 88, 0x90);
+       rt2800_bbp_write(rt2x00dev, 91, 0x04);
+       rt2800_bbp_write(rt2x00dev, 92, 0x02);
+-      rt2800_bbp_write(rt2x00dev, 95, 0x9a);
+       rt2800_bbp_write(rt2x00dev, 98, 0x12);
+       rt2800_bbp_write(rt2x00dev, 103, 0xC0);
+       rt2800_bbp_write(rt2x00dev, 104, 0x92);
+@@ -7027,6 +7030,7 @@ static void rt2800_init_bbp_5592(struct
+       rt2800_bbp_write(rt2x00dev, 134, 0xD0);
+       rt2800_bbp_write(rt2x00dev, 135, 0xF6);
+       rt2800_bbp_write(rt2x00dev, 137, 0x0F);
++      rt2800_bbp_write(rt2x00dev, 148, 0x84);
+       /* Initialize GLRT (Generalized Likehood Radio Test) */
+       rt2800_init_bbp_5592_glrt(rt2x00dev);
+@@ -7051,12 +7055,6 @@ static void rt2800_init_bbp_5592(struct
+               rt2x00_set_field8(&value, BBP254_BIT7, 1);
+               rt2800_bbp_write(rt2x00dev, 254, value);
+       }
+-
+-      rt2800_init_freq_calibration(rt2x00dev);
+-
+-      rt2800_bbp_write(rt2x00dev, 84, 0x19);
+-      if (rt2x00_rt_rev_gte(rt2x00dev, RT5592, REV_RT5592C))
+-              rt2800_bbp_write(rt2x00dev, 103, 0xc0);
+ }
+ static void rt2800_init_bbp_6352(struct rt2x00_dev *rt2x00dev)
index 9d15d181d72fb4ca037ab9f1547998ad3571c9fe..88a72fd03ec31b926a8c99e99e568e50afb9aeb2 100644 (file)
@@ -52,7 +52,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
  static const unsigned int rt2800_eeprom_map[EEPROM_WORD_COUNT] = {
        [EEPROM_CHIP_ID]                = 0x0000,
        [EEPROM_VERSION]                = 0x0001,
-@@ -10446,8 +10464,10 @@ static void rt2800_restore_rf_bbp_rt6352
+@@ -10428,8 +10446,10 @@ static void rt2800_restore_rf_bbp_rt6352
  static void rt2800_calibration_rt6352_stage1(struct rt2x00_dev *rt2x00dev)
  {
        if (rt2x00_has_cap_external_pa(rt2x00dev) ||
@@ -64,7 +64,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
  
        rt2800_r_calibration(rt2x00dev);
  }
-@@ -10471,6 +10491,8 @@ static void rt2800_calibration_rt6352_st
+@@ -10453,6 +10473,8 @@ static void rt2800_calibration_rt6352_st
            !rt2x00_has_cap_external_lna_bg(rt2x00dev))
                return;
  
index f4cc0443224a4820d6b5feca9f39a87a3c42b5d0..eb0237a389381e90656e4f5d4fae5aa2d9b5a960 100644 (file)
@@ -14,7 +14,7 @@
   */
 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
 +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -3864,14 +3864,16 @@ static void rt2800_config_channel_rf7620
+@@ -3842,14 +3842,16 @@ static void rt2800_config_channel_rf7620
        rt2x00_set_field8(&rfcsr, RFCSR19_K, rf->rf4);
        rt2800_rfcsr_write(rt2x00dev, 19, rfcsr);
  
@@ -39,7 +39,7 @@
  
        rfcsr = rt2800_rfcsr_read(rt2x00dev, 1);
        rt2x00_set_field8(&rfcsr, RFCSR1_TX2_EN_MT7620,
-@@ -3905,18 +3907,23 @@ static void rt2800_config_channel_rf7620
+@@ -3883,18 +3885,23 @@ static void rt2800_config_channel_rf7620
                rt2800_rfcsr_write_dccal(rt2x00dev, 59, 0x20);
        }
  
@@ -73,7 +73,7 @@
  
        if (!test_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags)) {
                if (conf_is_ht40(conf)) {
-@@ -4030,25 +4037,29 @@ static void rt2800_config_alc_rt6352(str
+@@ -4008,25 +4015,29 @@ static void rt2800_config_alc_rt6352(str
        if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev, MAC_STATUS_CFG_BBP_RF_BUSY)))
                rt2x00_warn(rt2x00dev, "RF busy while configuring ALC\n");
  
        rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, mac_sys_ctrl);
  
        rt2800_vco_calibration(rt2x00dev);
-@@ -4541,7 +4552,8 @@ static void rt2800_config_channel(struct
+@@ -4524,7 +4535,8 @@ static void rt2800_config_channel(struct
        if (rt2x00_rt(rt2x00dev, RT6352)) {
                /* BBP for GLRT BW */
                bbp = conf_is_ht40(conf) ?
                      0x15 : 0x1a;
                rt2800_bbp_glrt_write(rt2x00dev, 141, bbp);
  
-@@ -6061,18 +6073,34 @@ static int rt2800_init_registers(struct
+@@ -6042,18 +6054,34 @@ static int rt2800_init_registers(struct
        } else if (rt2x00_rt(rt2x00dev, RT5350)) {
                rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
        } else if (rt2x00_rt(rt2x00dev, RT6352)) {
                reg = rt2800_register_read(rt2x00dev, TX_ALC_CFG_1);
                rt2x00_set_field32(&reg, TX_ALC_CFG_1_ROS_BUSY_EN, 0);
                rt2800_register_write(rt2x00dev, TX_ALC_CFG_1, reg);
-@@ -7185,14 +7213,16 @@ static void rt2800_init_bbp_6352(struct
+@@ -7160,14 +7188,16 @@ static void rt2800_init_bbp_6352(struct
        rt2800_bbp_write(rt2x00dev, 188, 0x00);
        rt2800_bbp_write(rt2x00dev, 189, 0x00);
  
  
        /* BBP for G band GLRT function (BBP_128 ~ BBP_221) */
        rt2800_bbp_glrt_write(rt2x00dev, 0, 0x00);
-@@ -10422,6 +10452,9 @@ static void rt2800_restore_rf_bbp_rt6352
+@@ -10404,6 +10434,9 @@ static void rt2800_restore_rf_bbp_rt6352
                rt2800_register_write(rt2x00dev, RF_BYPASS3, 0x0);
        }
  
        if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
                rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x16);
                rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x23);
-@@ -10503,6 +10536,9 @@ static void rt2800_calibration_rt6352_st
+@@ -10485,6 +10518,9 @@ static void rt2800_calibration_rt6352_st
                rt2800_register_write(rt2x00dev, RF_BYPASS3, reg);
        }
  
        if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
                rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x66);
                rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x20);
-@@ -10593,31 +10629,36 @@ static void rt2800_init_rfcsr_6352(struc
+@@ -10575,31 +10611,36 @@ static void rt2800_init_rfcsr_6352(struc
        rt2800_rfcsr_write(rt2x00dev, 42, 0x5B);
        rt2800_rfcsr_write(rt2x00dev, 43, 0x00);
  
  
        /* Initialize RF channel register to default value */
        rt2800_rfcsr_write_chanreg(rt2x00dev, 0, 0x03);
-@@ -10683,63 +10724,71 @@ static void rt2800_init_rfcsr_6352(struc
+@@ -10665,63 +10706,71 @@ static void rt2800_init_rfcsr_6352(struc
  
        rt2800_rfcsr_write_bank(rt2x00dev, 6, 45, 0xC5);
  
  
        /* Initialize RF DC calibration register to default value */
        rt2800_rfcsr_write_dccal(rt2x00dev, 0, 0x47);
-@@ -10802,12 +10851,17 @@ static void rt2800_init_rfcsr_6352(struc
+@@ -10784,12 +10833,17 @@ static void rt2800_init_rfcsr_6352(struc
        rt2800_rfcsr_write_dccal(rt2x00dev, 62, 0x00);
        rt2800_rfcsr_write_dccal(rt2x00dev, 63, 0x00);