mac80211: rt2x00: some improvements for RT5592

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>
This commit is contained in:
Shiji Yang 2024-11-25 09:42:51 +08:00
parent 5f38f4827d
commit ab02c46282
4 changed files with 362 additions and 13 deletions

View File

@ -0,0 +1,230 @@
From e9aaf44b5bdd7e5864cbfce49098c4e3f8fc972f 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
@@ -3567,9 +3567,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 */
@@ -3590,7 +3589,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);
@@ -3599,13 +3598,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 */
@@ -3614,82 +3615,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;
@@ -3701,7 +3679,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);
@@ -3710,7 +3688,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);
@@ -3731,7 +3709,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);
@@ -8497,12 +8474,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);
@@ -8518,9 +8498,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);

View File

@ -0,0 +1,119 @@
From 83e98b82c5f675e9664b42d3c4d3fec894caaf6b 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
@@ -3737,6 +3737,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);
@@ -3749,7 +3750,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);
}
@@ -4295,7 +4296,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);
@@ -4304,6 +4306,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);
@@ -4327,17 +4330,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);
@@ -5774,12 +5780,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);
}
@@ -7008,7 +7012,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);
@@ -7019,6 +7022,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);
@@ -7043,12 +7047,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)

View File

@ -52,7 +52,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
static const unsigned int rt2800_eeprom_map[EEPROM_WORD_COUNT] = { static const unsigned int rt2800_eeprom_map[EEPROM_WORD_COUNT] = {
[EEPROM_CHIP_ID] = 0x0000, [EEPROM_CHIP_ID] = 0x0000,
[EEPROM_VERSION] = 0x0001, [EEPROM_VERSION] = 0x0001,
@@ -10438,8 +10456,10 @@ static void rt2800_restore_rf_bbp_rt6352 @@ -10420,8 +10438,10 @@ static void rt2800_restore_rf_bbp_rt6352
static void rt2800_calibration_rt6352_stage1(struct rt2x00_dev *rt2x00dev) static void rt2800_calibration_rt6352_stage1(struct rt2x00_dev *rt2x00dev)
{ {
if (rt2x00_has_cap_external_pa(rt2x00dev) || if (rt2x00_has_cap_external_pa(rt2x00dev) ||
@ -64,7 +64,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
rt2800_r_calibration(rt2x00dev); rt2800_r_calibration(rt2x00dev);
} }
@@ -10463,6 +10483,8 @@ static void rt2800_calibration_rt6352_st @@ -10445,6 +10465,8 @@ static void rt2800_calibration_rt6352_st
!rt2x00_has_cap_external_lna_bg(rt2x00dev)) !rt2x00_has_cap_external_lna_bg(rt2x00dev))
return; return;

View File

@ -14,7 +14,7 @@
*/ */
--- 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
@@ -3855,14 +3855,16 @@ static void rt2800_config_channel_rf7620 @@ -3833,14 +3833,16 @@ static void rt2800_config_channel_rf7620
rt2x00_set_field8(&rfcsr, RFCSR19_K, rf->rf4); rt2x00_set_field8(&rfcsr, RFCSR19_K, rf->rf4);
rt2800_rfcsr_write(rt2x00dev, 19, rfcsr); rt2800_rfcsr_write(rt2x00dev, 19, rfcsr);
@ -39,7 +39,7 @@
rfcsr = rt2800_rfcsr_read(rt2x00dev, 1); rfcsr = rt2800_rfcsr_read(rt2x00dev, 1);
rt2x00_set_field8(&rfcsr, RFCSR1_TX2_EN_MT7620, rt2x00_set_field8(&rfcsr, RFCSR1_TX2_EN_MT7620,
@@ -3896,18 +3898,23 @@ static void rt2800_config_channel_rf7620 @@ -3874,18 +3876,23 @@ static void rt2800_config_channel_rf7620
rt2800_rfcsr_write_dccal(rt2x00dev, 59, 0x20); rt2800_rfcsr_write_dccal(rt2x00dev, 59, 0x20);
} }
@ -73,7 +73,7 @@
if (!test_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags)) { if (!test_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags)) {
if (conf_is_ht40(conf)) { if (conf_is_ht40(conf)) {
@@ -4021,25 +4028,29 @@ static void rt2800_config_alc_rt6352(str @@ -3999,25 +4006,29 @@ static void rt2800_config_alc_rt6352(str
if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev, MAC_STATUS_CFG_BBP_RF_BUSY))) if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev, MAC_STATUS_CFG_BBP_RF_BUSY)))
rt2x00_warn(rt2x00dev, "RF busy while configuring ALC\n"); rt2x00_warn(rt2x00dev, "RF busy while configuring ALC\n");
@ -121,7 +121,7 @@
rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, mac_sys_ctrl); rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, mac_sys_ctrl);
rt2800_vco_calibration(rt2x00dev); rt2800_vco_calibration(rt2x00dev);
@@ -4532,7 +4543,8 @@ static void rt2800_config_channel(struct @@ -4515,7 +4526,8 @@ static void rt2800_config_channel(struct
if (rt2x00_rt(rt2x00dev, RT6352)) { if (rt2x00_rt(rt2x00dev, RT6352)) {
/* BBP for GLRT BW */ /* BBP for GLRT BW */
bbp = conf_is_ht40(conf) ? bbp = conf_is_ht40(conf) ?
@ -131,7 +131,7 @@
0x15 : 0x1a; 0x15 : 0x1a;
rt2800_bbp_glrt_write(rt2x00dev, 141, bbp); rt2800_bbp_glrt_write(rt2x00dev, 141, bbp);
@@ -6052,18 +6064,34 @@ static int rt2800_init_registers(struct @@ -6033,18 +6045,34 @@ static int rt2800_init_registers(struct
} else if (rt2x00_rt(rt2x00dev, RT5350)) { } else if (rt2x00_rt(rt2x00dev, RT5350)) {
rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404); rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
} else if (rt2x00_rt(rt2x00dev, RT6352)) { } else if (rt2x00_rt(rt2x00dev, RT6352)) {
@ -178,7 +178,7 @@
reg = rt2800_register_read(rt2x00dev, TX_ALC_CFG_1); reg = rt2800_register_read(rt2x00dev, TX_ALC_CFG_1);
rt2x00_set_field32(&reg, TX_ALC_CFG_1_ROS_BUSY_EN, 0); rt2x00_set_field32(&reg, TX_ALC_CFG_1_ROS_BUSY_EN, 0);
rt2800_register_write(rt2x00dev, TX_ALC_CFG_1, reg); rt2800_register_write(rt2x00dev, TX_ALC_CFG_1, reg);
@@ -7177,14 +7205,16 @@ static void rt2800_init_bbp_6352(struct @@ -7152,14 +7180,16 @@ static void rt2800_init_bbp_6352(struct
rt2800_bbp_write(rt2x00dev, 188, 0x00); rt2800_bbp_write(rt2x00dev, 188, 0x00);
rt2800_bbp_write(rt2x00dev, 189, 0x00); rt2800_bbp_write(rt2x00dev, 189, 0x00);
@ -203,7 +203,7 @@
/* BBP for G band GLRT function (BBP_128 ~ BBP_221) */ /* BBP for G band GLRT function (BBP_128 ~ BBP_221) */
rt2800_bbp_glrt_write(rt2x00dev, 0, 0x00); rt2800_bbp_glrt_write(rt2x00dev, 0, 0x00);
@@ -10414,6 +10444,9 @@ static void rt2800_restore_rf_bbp_rt6352 @@ -10396,6 +10426,9 @@ static void rt2800_restore_rf_bbp_rt6352
rt2800_register_write(rt2x00dev, RF_BYPASS3, 0x0); rt2800_register_write(rt2x00dev, RF_BYPASS3, 0x0);
} }
@ -213,7 +213,7 @@
if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x16); rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x16);
rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x23); rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x23);
@@ -10495,6 +10528,9 @@ static void rt2800_calibration_rt6352_st @@ -10477,6 +10510,9 @@ static void rt2800_calibration_rt6352_st
rt2800_register_write(rt2x00dev, RF_BYPASS3, reg); rt2800_register_write(rt2x00dev, RF_BYPASS3, reg);
} }
@ -223,7 +223,7 @@
if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x66); rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x66);
rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x20); rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x20);
@@ -10585,31 +10621,36 @@ static void rt2800_init_rfcsr_6352(struc @@ -10567,31 +10603,36 @@ static void rt2800_init_rfcsr_6352(struc
rt2800_rfcsr_write(rt2x00dev, 42, 0x5B); rt2800_rfcsr_write(rt2x00dev, 42, 0x5B);
rt2800_rfcsr_write(rt2x00dev, 43, 0x00); rt2800_rfcsr_write(rt2x00dev, 43, 0x00);
@ -285,7 +285,7 @@
/* Initialize RF channel register to default value */ /* Initialize RF channel register to default value */
rt2800_rfcsr_write_chanreg(rt2x00dev, 0, 0x03); rt2800_rfcsr_write_chanreg(rt2x00dev, 0, 0x03);
@@ -10675,63 +10716,71 @@ static void rt2800_init_rfcsr_6352(struc @@ -10657,63 +10698,71 @@ static void rt2800_init_rfcsr_6352(struc
rt2800_rfcsr_write_bank(rt2x00dev, 6, 45, 0xC5); rt2800_rfcsr_write_bank(rt2x00dev, 6, 45, 0xC5);
@ -412,7 +412,7 @@
/* Initialize RF DC calibration register to default value */ /* Initialize RF DC calibration register to default value */
rt2800_rfcsr_write_dccal(rt2x00dev, 0, 0x47); rt2800_rfcsr_write_dccal(rt2x00dev, 0, 0x47);
@@ -10794,12 +10843,17 @@ static void rt2800_init_rfcsr_6352(struc @@ -10776,12 +10825,17 @@ static void rt2800_init_rfcsr_6352(struc
rt2800_rfcsr_write_dccal(rt2x00dev, 62, 0x00); rt2800_rfcsr_write_dccal(rt2x00dev, 62, 0x00);
rt2800_rfcsr_write_dccal(rt2x00dev, 63, 0x00); rt2800_rfcsr_write_dccal(rt2x00dev, 63, 0x00);