All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/4] rt2x00: remove unneeded check
@ 2018-10-09 11:56 Stanislaw Gruszka
  2018-10-09 11:56 ` [PATCH v3 2/4] rt2x00: remove confusing AGC register Stanislaw Gruszka
                   ` (3 more replies)
  0 siblings, 4 replies; 19+ messages in thread
From: Stanislaw Gruszka @ 2018-10-09 11:56 UTC (permalink / raw)
  To: linux-wireless
  Cc: Daniel Golle, Mathias Kresin, Felix Fietkau, Tomislav Požega

From: Tomislav Požega <pozega.tomislav@gmail.com>

Remove band check from rf53xx channel config routine since all chips
using it are single band.

Signed-off-by: Tomislav Požega <pozega.tomislav@gmail.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
v2 -> v3:
- fix wrongly applied hung during rebase
- add SoB

 drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 103 ++++++++++++-------------
 1 file changed, 50 insertions(+), 53 deletions(-)

diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
index 9e7b8933d30c..1a2bf6c49b82 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
@@ -2963,6 +2963,7 @@ static void rt2800_config_channel_rf53xx(struct rt2x00_dev *rt2x00dev,
 					 struct rf_channel *rf,
 					 struct channel_info *info)
 {
+	int idx = rf->channel-1;
 	u8 rfcsr;
 
 	rt2800_rfcsr_write(rt2x00dev, 8, rf->rf1);
@@ -3001,60 +3002,56 @@ static void rt2800_config_channel_rf53xx(struct rt2x00_dev *rt2x00dev,
 
 	rt2800_freq_cal_mode1(rt2x00dev);
 
-	if (rf->channel <= 14) {
-		int idx = rf->channel-1;
-
-		if (rt2x00_has_cap_bt_coexist(rt2x00dev)) {
-			if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) {
-				/* r55/r59 value array of channel 1~14 */
-				static const char r55_bt_rev[] = {0x83, 0x83,
-					0x83, 0x73, 0x73, 0x63, 0x53, 0x53,
-					0x53, 0x43, 0x43, 0x43, 0x43, 0x43};
-				static const char r59_bt_rev[] = {0x0e, 0x0e,
-					0x0e, 0x0e, 0x0e, 0x0b, 0x0a, 0x09,
-					0x07, 0x07, 0x07, 0x07, 0x07, 0x07};
-
-				rt2800_rfcsr_write(rt2x00dev, 55,
-						   r55_bt_rev[idx]);
-				rt2800_rfcsr_write(rt2x00dev, 59,
-						   r59_bt_rev[idx]);
-			} else {
-				static const char r59_bt[] = {0x8b, 0x8b, 0x8b,
-					0x8b, 0x8b, 0x8b, 0x8b, 0x8a, 0x89,
-					0x88, 0x88, 0x86, 0x85, 0x84};
-
-				rt2800_rfcsr_write(rt2x00dev, 59, r59_bt[idx]);
-			}
+	if (rt2x00_has_cap_bt_coexist(rt2x00dev)) {
+		if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) {
+			/* r55/r59 value array of channel 1~14 */
+			static const char r55_bt_rev[] = {0x83, 0x83,
+				0x83, 0x73, 0x73, 0x63, 0x53, 0x53,
+				0x53, 0x43, 0x43, 0x43, 0x43, 0x43};
+			static const char r59_bt_rev[] = {0x0e, 0x0e,
+				0x0e, 0x0e, 0x0e, 0x0b, 0x0a, 0x09,
+				0x07, 0x07, 0x07, 0x07, 0x07, 0x07};
+
+			rt2800_rfcsr_write(rt2x00dev, 55,
+					   r55_bt_rev[idx]);
+			rt2800_rfcsr_write(rt2x00dev, 59,
+					   r59_bt_rev[idx]);
 		} else {
-			if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) {
-				static const char r55_nonbt_rev[] = {0x23, 0x23,
-					0x23, 0x23, 0x13, 0x13, 0x03, 0x03,
-					0x03, 0x03, 0x03, 0x03, 0x03, 0x03};
-				static const char r59_nonbt_rev[] = {0x07, 0x07,
-					0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
-					0x07, 0x07, 0x06, 0x05, 0x04, 0x04};
-
-				rt2800_rfcsr_write(rt2x00dev, 55,
-						   r55_nonbt_rev[idx]);
-				rt2800_rfcsr_write(rt2x00dev, 59,
-						   r59_nonbt_rev[idx]);
-			} else if (rt2x00_rt(rt2x00dev, RT5390) ||
-				   rt2x00_rt(rt2x00dev, RT5392) ||
-				   rt2x00_rt(rt2x00dev, RT6352)) {
-				static const char r59_non_bt[] = {0x8f, 0x8f,
-					0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8d,
-					0x8a, 0x88, 0x88, 0x87, 0x87, 0x86};
-
-				rt2800_rfcsr_write(rt2x00dev, 59,
-						   r59_non_bt[idx]);
-			} else if (rt2x00_rt(rt2x00dev, RT5350)) {
-				static const char r59_non_bt[] = {0x0b, 0x0b,
-					0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0a,
-					0x0a, 0x09, 0x08, 0x07, 0x07, 0x06};
-
-				rt2800_rfcsr_write(rt2x00dev, 59,
-						   r59_non_bt[idx]);
-			}
+			static const char r59_bt[] = {0x8b, 0x8b, 0x8b,
+				0x8b, 0x8b, 0x8b, 0x8b, 0x8a, 0x89,
+				0x88, 0x88, 0x86, 0x85, 0x84};
+
+			rt2800_rfcsr_write(rt2x00dev, 59, r59_bt[idx]);
+		}
+	} else {
+		if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) {
+			static const char r55_nonbt_rev[] = {0x23, 0x23,
+				0x23, 0x23, 0x13, 0x13, 0x03, 0x03,
+				0x03, 0x03, 0x03, 0x03, 0x03, 0x03};
+			static const char r59_nonbt_rev[] = {0x07, 0x07,
+				0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
+				0x07, 0x07, 0x06, 0x05, 0x04, 0x04};
+
+			rt2800_rfcsr_write(rt2x00dev, 55,
+					   r55_nonbt_rev[idx]);
+			rt2800_rfcsr_write(rt2x00dev, 59,
+					   r59_nonbt_rev[idx]);
+		} else if (rt2x00_rt(rt2x00dev, RT5390) ||
+			   rt2x00_rt(rt2x00dev, RT5392) ||
+			   rt2x00_rt(rt2x00dev, RT6352)) {
+			static const char r59_non_bt[] = {0x8f, 0x8f,
+				0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8d,
+				0x8a, 0x88, 0x88, 0x87, 0x87, 0x86};
+
+			rt2800_rfcsr_write(rt2x00dev, 59,
+					   r59_non_bt[idx]);
+		} else if (rt2x00_rt(rt2x00dev, RT5350)) {
+			static const char r59_non_bt[] = {0x0b, 0x0b,
+				0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0a,
+				0x0a, 0x09, 0x08, 0x07, 0x07, 0x06};
+
+			rt2800_rfcsr_write(rt2x00dev, 59,
+					   r59_non_bt[idx]);
 		}
 	}
 }
-- 
2.7.5


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v3 2/4] rt2x00: remove confusing AGC register
  2018-10-09 11:56 [PATCH v3 1/4] rt2x00: remove unneeded check Stanislaw Gruszka
@ 2018-10-09 11:56 ` Stanislaw Gruszka
  2018-10-09 12:27   ` Daniel Golle
  2018-10-09 11:56 ` [PATCH v3 3/4] rt2x00: update TX_SW_CFG2 value Stanislaw Gruszka
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 19+ messages in thread
From: Stanislaw Gruszka @ 2018-10-09 11:56 UTC (permalink / raw)
  To: linux-wireless
  Cc: Daniel Golle, Mathias Kresin, Felix Fietkau, Tomislav Požega

Register 66 was causing issues on RT6352 if set to the same value as
in MTK driver. With 1c reg value device was working fine in both HT20
and HT40 modes.

Signed-off-by: Tomislav Požega <pozega.tomislav@gmail.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
 drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
index 1a2bf6c49b82..3a04eaef8511 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
@@ -3981,11 +3981,7 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
 		rt2800_bbp_write(rt2x00dev, 196, reg);
 
 		/* AGC init */
-		if (rt2x00_rt(rt2x00dev, RT6352))
-			reg = 0x04;
-		else
-			reg = rf->channel <= 14 ? 0x1c : 0x24;
-
+		reg = rf->channel <= 14 ? 0x1c : 0x24;
 		reg += 2 * rt2x00dev->lna_gain;
 		rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg);
 
-- 
2.7.5


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v3 3/4] rt2x00: update TX_SW_CFG2 value
  2018-10-09 11:56 [PATCH v3 1/4] rt2x00: remove unneeded check Stanislaw Gruszka
  2018-10-09 11:56 ` [PATCH v3 2/4] rt2x00: remove confusing AGC register Stanislaw Gruszka
@ 2018-10-09 11:56 ` Stanislaw Gruszka
  2018-10-09 11:56 ` [PATCH v3 4/4] rt2800: fix registers init for MT7620 Stanislaw Gruszka
  2018-10-11 10:06 ` [PATCH v3 1/4] rt2x00: remove unneeded check Stanislaw Gruszka
  3 siblings, 0 replies; 19+ messages in thread
From: Stanislaw Gruszka @ 2018-10-09 11:56 UTC (permalink / raw)
  To: linux-wireless
  Cc: Daniel Golle, Mathias Kresin, Felix Fietkau, Tomislav Požega

From: Tomislav Požega <pozega.tomislav@gmail.com>

Use default value of TX_SW_CFG2 register that is in charge
of LNA timings. Works for somewhat higher RX throughput.

Signed-off-by: Tomislav Požega <pozega.tomislav@gmail.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
 drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

v2->v3:
 - add SoB

diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
index 3a04eaef8511..daf20d7424ac 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
@@ -5465,7 +5465,7 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
 	} else if (rt2x00_rt(rt2x00dev, RT6352)) {
 		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, TX_SW_CFG2, 0x000C0408);
 		rt2800_register_write(rt2x00dev, MIMO_PS_CFG, 0x00000002);
 		rt2800_register_write(rt2x00dev, TX_PIN_CFG, 0x00150F0F);
 		rt2800_register_write(rt2x00dev, TX_ALC_VGA3, 0x06060606);
-- 
2.7.5


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v3 4/4] rt2800: fix registers init for MT7620
  2018-10-09 11:56 [PATCH v3 1/4] rt2x00: remove unneeded check Stanislaw Gruszka
  2018-10-09 11:56 ` [PATCH v3 2/4] rt2x00: remove confusing AGC register Stanislaw Gruszka
  2018-10-09 11:56 ` [PATCH v3 3/4] rt2x00: update TX_SW_CFG2 value Stanislaw Gruszka
@ 2018-10-09 11:56 ` Stanislaw Gruszka
  2018-10-09 23:27   ` Tom Psyborg
  2018-10-11 10:06 ` [PATCH v3 1/4] rt2x00: remove unneeded check Stanislaw Gruszka
  3 siblings, 1 reply; 19+ messages in thread
From: Stanislaw Gruszka @ 2018-10-09 11:56 UTC (permalink / raw)
  To: linux-wireless
  Cc: Daniel Golle, Mathias Kresin, Felix Fietkau, Tomislav Požega

There is dupliceted 'if (rt2x00_rt(rt2x00dev, RT6352))' entry that couses
we do not perform proper register initaliztion for RT6352 (MT7620 SOCs).

Reported-by: Tomislav Požega <pozega.tomislav@gmail.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
 drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
index daf20d7424ac..170e7c87f7bc 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
@@ -5451,8 +5451,7 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
 					      0x00000000);
 		}
 	} 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);
-- 
2.7.5


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH v3 2/4] rt2x00: remove confusing AGC register
  2018-10-09 11:56 ` [PATCH v3 2/4] rt2x00: remove confusing AGC register Stanislaw Gruszka
@ 2018-10-09 12:27   ` Daniel Golle
  2018-10-09 12:47     ` Stanislaw Gruszka
  0 siblings, 1 reply; 19+ messages in thread
From: Daniel Golle @ 2018-10-09 12:27 UTC (permalink / raw)
  To: Stanislaw Gruszka
  Cc: linux-wireless, Mathias Kresin, Felix Fietkau, Tomislav Požega

Hi Stanislaw,

On Tue, Oct 09, 2018 at 01:56:08PM +0200,  Gruszka wrote:
> Register 66 was causing issues on RT6352 if set to the same value as
> in MTK driver. With 1c reg value device was working fine in both HT20
> and HT40 modes.

My guess is that this may change once we add proper TSSI which involes
parts of AGC init as well. I suggest to add a comment in the code to
reflect that.


> 
> Signed-off-by: Tomislav Požega <pozega.tomislav@gmail.com>
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
> ---
>  drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
> index 1a2bf6c49b82..3a04eaef8511 100644
> --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
> +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
> @@ -3981,11 +3981,7 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
>  		rt2800_bbp_write(rt2x00dev, 196, reg);
>  
>  		/* AGC init */
> -		if (rt2x00_rt(rt2x00dev, RT6352))
> -			reg = 0x04;
> -		else
> -			reg = rf->channel <= 14 ? 0x1c : 0x24;
> -
> +		reg = rf->channel <= 14 ? 0x1c : 0x24;
>  		reg += 2 * rt2x00dev->lna_gain;

We can summerize the two lines into
		reg = 0x1c + (2 * rt2x00dev->lna_gain);
which is also what is was before introducing support for MT7620.


>  		rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg);


Cheers


Daniel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v3 2/4] rt2x00: remove confusing AGC register
  2018-10-09 12:27   ` Daniel Golle
@ 2018-10-09 12:47     ` Stanislaw Gruszka
  2018-10-09 13:07       ` Daniel Golle
  0 siblings, 1 reply; 19+ messages in thread
From: Stanislaw Gruszka @ 2018-10-09 12:47 UTC (permalink / raw)
  To: Daniel Golle
  Cc: linux-wireless, Mathias Kresin, Felix Fietkau, Tomislav Požega

Hi

On Tue, Oct 09, 2018 at 02:27:22PM +0200, Daniel Golle wrote:
> On Tue, Oct 09, 2018 at 01:56:08PM +0200,  Gruszka wrote:
> > Register 66 was causing issues on RT6352 if set to the same value as
> > in MTK driver. With 1c reg value device was working fine in both HT20
> > and HT40 modes.
> 
> My guess is that this may change once we add proper TSSI which involes
> parts of AGC init as well. I suggest to add a comment in the code to
> reflect that.

I don't understand what you suggest, could you be more specific ?

> > diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
> > index 1a2bf6c49b82..3a04eaef8511 100644
> > --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
> > +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
> > @@ -3981,11 +3981,7 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
> >  		rt2800_bbp_write(rt2x00dev, 196, reg);
> >  
> >  		/* AGC init */
> > -		if (rt2x00_rt(rt2x00dev, RT6352))
> > -			reg = 0x04;
> > -		else
> > -			reg = rf->channel <= 14 ? 0x1c : 0x24;
> > -
> > +		reg = rf->channel <= 14 ? 0x1c : 0x24;
> >  		reg += 2 * rt2x00dev->lna_gain;
> 
> We can summerize the two lines into
> 		reg = 0x1c + (2 * rt2x00dev->lna_gain);
> which is also what is was before introducing support for MT7620.

I think you mean

reg = (rf->channel <= 14 ? 0x1c : 0x24) + 2 * rt2x00dev->lna_gain; 

to do not break 5GHz support for RT5592.  I can change that in
separate patch, since this one in not technically wrong.

Thanks
Stanislaw


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v3 2/4] rt2x00: remove confusing AGC register
  2018-10-09 12:47     ` Stanislaw Gruszka
@ 2018-10-09 13:07       ` Daniel Golle
  2018-10-09 13:23         ` Stanislaw Gruszka
  0 siblings, 1 reply; 19+ messages in thread
From: Daniel Golle @ 2018-10-09 13:07 UTC (permalink / raw)
  To: Stanislaw Gruszka
  Cc: linux-wireless, Mathias Kresin, Felix Fietkau, Tomislav Požega

On Tue, Oct 09, 2018 at 02:47:48PM +0200, Stanislaw Gruszka wrote:
> Hi
> 
> On Tue, Oct 09, 2018 at 02:27:22PM +0200, Daniel Golle wrote:
> > On Tue, Oct 09, 2018 at 01:56:08PM +0200,  Gruszka wrote:
> > > Register 66 was causing issues on RT6352 if set to the same value as
> > > in MTK driver. With 1c reg value device was working fine in both HT20
> > > and HT40 modes.
> > 
> > My guess is that this may change once we add proper TSSI which involes
> > parts of AGC init as well. I suggest to add a comment in the code to
> > reflect that.
> 
> I don't understand what you suggest, could you be more specific ?

simply add these lines:
/*
 * Despite the vendor driver using different values here, use 0x1c
 * for now. This may have to be changed once TSSI got implemented
 */

> 
> > > diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
> > > index 1a2bf6c49b82..3a04eaef8511 100644
> > > --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
> > > +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
> > > @@ -3981,11 +3981,7 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
> > >  		rt2800_bbp_write(rt2x00dev, 196, reg);
> > >  
> > >  		/* AGC init */
> > > -		if (rt2x00_rt(rt2x00dev, RT6352))
> > > -			reg = 0x04;
> > > -		else
> > > -			reg = rf->channel <= 14 ? 0x1c : 0x24;
> > > -
> > > +		reg = rf->channel <= 14 ? 0x1c : 0x24;
> > >  		reg += 2 * rt2x00dev->lna_gain;
> > 
> > We can summerize the two lines into
> > 		reg = 0x1c + (2 * rt2x00dev->lna_gain);
> > which is also what is was before introducing support for MT7620.
> 
> I think you mean
> 
> reg = (rf->channel <= 14 ? 0x1c : 0x24) + 2 * rt2x00dev->lna_gain; 
> 
> to do not break 5GHz support for RT5592.  I can change that in
> separate patch, since this one in not technically wrong.
> 
> Thanks
> Stanislaw
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v3 2/4] rt2x00: remove confusing AGC register
  2018-10-09 13:07       ` Daniel Golle
@ 2018-10-09 13:23         ` Stanislaw Gruszka
  0 siblings, 0 replies; 19+ messages in thread
From: Stanislaw Gruszka @ 2018-10-09 13:23 UTC (permalink / raw)
  To: Daniel Golle
  Cc: linux-wireless, Mathias Kresin, Felix Fietkau, Tomislav Požega

On Tue, Oct 09, 2018 at 03:07:15PM +0200, Daniel Golle wrote:
> simply add these lines:
> /*
>  * Despite the vendor driver using different values here, use 0x1c
>  * for now. This may have to be changed once TSSI got implemented
>  */

I will add this in sparate patch.

Thanks
Stanislaw

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v3 4/4] rt2800: fix registers init for MT7620
  2018-10-09 11:56 ` [PATCH v3 4/4] rt2800: fix registers init for MT7620 Stanislaw Gruszka
@ 2018-10-09 23:27   ` Tom Psyborg
  2018-10-10  7:14     ` Stanislaw Gruszka
  0 siblings, 1 reply; 19+ messages in thread
From: Tom Psyborg @ 2018-10-09 23:27 UTC (permalink / raw)
  To: Stanislaw Gruszka
  Cc: linux-wireless, Daniel Golle, Mathias Kresin, Felix Fietkau

On 09/10/2018, Stanislaw Gruszka <sgruszka@redhat.com> wrote:
> There is dupliceted 'if (rt2x00_rt(rt2x00dev, RT6352))' entry that couses
> we do not perform proper register initaliztion for RT6352 (MT7620 SOCs).
>
> Reported-by: Tomislav Požega <pozega.tomislav@gmail.com>
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
> ---
>  drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
> b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
> index daf20d7424ac..170e7c87f7bc 100644
> --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
> +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
> @@ -5451,8 +5451,7 @@ static int rt2800_init_registers(struct rt2x00_dev
> *rt2x00dev)
>  					      0x00000000);
>  		}
>  	} 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);
> --
> 2.7.5
>
>


have you got chance to test
https://github.com/psyborg55/linux/commit/24b46d482590a87553df1de0b5c8032f363cb7cf
 ?

 using this code to determine 7620 soc

 if (rt == RT5390 && rt2x00_is_soc(rt2x00dev))
         rt = RT6352;

 somehow did not work in rt2800_init_registers routine. i could verify
 that by removing tx_sw_cfg registers from rt6352 and the wifi would
 still work, unless removed them from rt5390 also

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v3 4/4] rt2800: fix registers init for MT7620
  2018-10-09 23:27   ` Tom Psyborg
@ 2018-10-10  7:14     ` Stanislaw Gruszka
  2018-10-10 12:06       ` Daniel Golle
  0 siblings, 1 reply; 19+ messages in thread
From: Stanislaw Gruszka @ 2018-10-10  7:14 UTC (permalink / raw)
  To: Tom Psyborg; +Cc: linux-wireless, Daniel Golle, Mathias Kresin, Felix Fietkau

On Wed, Oct 10, 2018 at 01:27:31AM +0200, Tom Psyborg wrote:
> On 09/10/2018, Stanislaw Gruszka <sgruszka@redhat.com> wrote:
> > There is dupliceted 'if (rt2x00_rt(rt2x00dev, RT6352))' entry that couses
> > we do not perform proper register initaliztion for RT6352 (MT7620 SOCs).
> >
> > Reported-by: Tomislav Požega <pozega.tomislav@gmail.com>
> > Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
> > ---
> >  drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
> > b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
> > index daf20d7424ac..170e7c87f7bc 100644
> > --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
> > +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
> > @@ -5451,8 +5451,7 @@ static int rt2800_init_registers(struct rt2x00_dev
> > *rt2x00dev)
> >  					      0x00000000);
> >  		}
> >  	} 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);
> > --
> > 2.7.5
> >
> >
> 
> 
> have you got chance to test
> https://github.com/psyborg55/linux/commit/24b46d482590a87553df1de0b5c8032f363cb7cf
>  ?
> 
>  using this code to determine 7620 soc
> 
>  if (rt == RT5390 && rt2x00_is_soc(rt2x00dev))
>          rt = RT6352;
> 
>  somehow did not work in rt2800_init_registers routine. i could verify
>  that by removing tx_sw_cfg registers from rt6352 and the wifi would
>  still work, unless removed them from rt5390 also

I tested by adding additional printk("Init RT6352 registers\n"); in 
if (rt2x00_rt(rt2x00dev, RT6352)) branch. The message was printed:

[   68.049946] ieee80211 phy0: rt2x00_set_rt: Info - RT chipset 6352, rev 0500 detected
[   68.065392] ieee80211 phy0: rt2x00_set_rf: Info - RF chipset 7620 detected
[   68.079777] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
[   68.177760] kmodloader: done loading kernel modules from /etc/modules.d/*
[   68.825758] urandom_read: 5 callbacks suppressed
[   68.825768] random: jshn: uninitialized urandom read (4 bytes read)
[   77.792400] 8021q: adding VLAN 0 to HW filter on device eth0
[   77.825045] br-lan: port 1(eth0.1) entered blocking state
[   77.836032] br-lan: port 1(eth0.1) entered disabled state
[   77.847156] device eth0.1 entered promiscuous mode
[   77.856739] device eth0 entered promiscuous mode
[   77.931043] br-lan: port 1(eth0.1) entered blocking state
[   77.941861] br-lan: port 1(eth0.1) entered forwarding state
[   77.953171] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
[   78.849852] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
[   82.302306] Init RT6352 registers

Perhaps rt2x00_is_soc(rt2x00dev) does not work on this particular system
that you have and device is configured as RT5390 ? I.e. maybe this is
PCIe device. This should be printed in :

ieee80211 phy0: rt2x00_set_rt: Info - RT chipset 6352, rev 0500 detected

line, you should have 'RT chipset 5390' instead.

Thanks
Stanislaw

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v3 4/4] rt2800: fix registers init for MT7620
  2018-10-10  7:14     ` Stanislaw Gruszka
@ 2018-10-10 12:06       ` Daniel Golle
  2018-10-10 12:45         ` Stanislaw Gruszka
  0 siblings, 1 reply; 19+ messages in thread
From: Daniel Golle @ 2018-10-10 12:06 UTC (permalink / raw)
  To: Stanislaw Gruszka
  Cc: Tom Psyborg, linux-wireless, Mathias Kresin, Felix Fietkau

Hi Stanislaw,

On Wed, Oct 10, 2018 at 09:14:52AM +0200, Stanislaw Gruszka wrote:
> On Wed, Oct 10, 2018 at 01:27:31AM +0200, Tom Psyborg wrote:
> > On 09/10/2018, Stanislaw Gruszka <sgruszka@redhat.com> wrote:
> > > There is dupliceted 'if (rt2x00_rt(rt2x00dev, RT6352))' entry that couses
> > > we do not perform proper register initaliztion for RT6352 (MT7620 SOCs).
> > >
> > > Reported-by: Tomislav Požega <pozega.tomislav@gmail.com>
> > > Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
> > > ---
> > >  drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 +--
> > >  1 file changed, 1 insertion(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
> > > b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
> > > index daf20d7424ac..170e7c87f7bc 100644
> > > --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
> > > +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
> > > @@ -5451,8 +5451,7 @@ static int rt2800_init_registers(struct rt2x00_dev
> > > *rt2x00dev)
> > >  					      0x00000000);
> > >  		}
> > >  	} 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);
> > > --
> > > 2.7.5
> > >
> > >
> > 
> > 
> > have you got chance to test
> > https://github.com/psyborg55/linux/commit/24b46d482590a87553df1de0b5c8032f363cb7cf
> >  ?
> > 
> >  using this code to determine 7620 soc
> > 
> >  if (rt == RT5390 && rt2x00_is_soc(rt2x00dev))
> >          rt = RT6352;
> > 
> >  somehow did not work in rt2800_init_registers routine. i could verify
> >  that by removing tx_sw_cfg registers from rt6352 and the wifi would
> >  still work, unless removed them from rt5390 also
> 
> I tested by adding additional printk("Init RT6352 registers\n"); in 
> if (rt2x00_rt(rt2x00dev, RT6352)) branch. The message was printed:
> 
> [   68.049946] ieee80211 phy0: rt2x00_set_rt: Info - RT chipset 6352, rev 0500 detected
> [   68.065392] ieee80211 phy0: rt2x00_set_rf: Info - RF chipset 7620 detected
> [   68.079777] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
> [   68.177760] kmodloader: done loading kernel modules from /etc/modules.d/*
> [   68.825758] urandom_read: 5 callbacks suppressed
> [   68.825768] random: jshn: uninitialized urandom read (4 bytes read)
> [   77.792400] 8021q: adding VLAN 0 to HW filter on device eth0
> [   77.825045] br-lan: port 1(eth0.1) entered blocking state
> [   77.836032] br-lan: port 1(eth0.1) entered disabled state
> [   77.847156] device eth0.1 entered promiscuous mode
> [   77.856739] device eth0 entered promiscuous mode
> [   77.931043] br-lan: port 1(eth0.1) entered blocking state
> [   77.941861] br-lan: port 1(eth0.1) entered forwarding state
> [   77.953171] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
> [   78.849852] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
> [   82.302306] Init RT6352 registers
> 
> Perhaps rt2x00_is_soc(rt2x00dev) does not work on this particular system
> that you have and device is configured as RT5390 ? I.e. maybe this is
> PCIe device. This should be printed in :
> 
> ieee80211 phy0: rt2x00_set_rt: Info - RT chipset 6352, rev 0500 detected
> 
> line, you should have 'RT chipset 5390' instead.

RT6352 is the pre-mediatek-merge name of MT7620A/N. It is always a SoC.
The RF part of both MT7620A and MT7620N identifies as RT5390. The
vendor driver also uses an equivalent check to destinguish between the
actual PCIe/USB RT5390xx and RT6352, see

https://github.com/i80s/mtk-sources/blob/master/mt7620/src/include/rtmp_chip.h#L114


Cheers


Daniel

> 
> Thanks
> Stanislaw

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v3 4/4] rt2800: fix registers init for MT7620
  2018-10-10 12:06       ` Daniel Golle
@ 2018-10-10 12:45         ` Stanislaw Gruszka
  2018-10-10 14:11           ` Tom Psyborg
  0 siblings, 1 reply; 19+ messages in thread
From: Stanislaw Gruszka @ 2018-10-10 12:45 UTC (permalink / raw)
  To: Daniel Golle; +Cc: Tom Psyborg, linux-wireless, Mathias Kresin, Felix Fietkau

Hello

On Wed, Oct 10, 2018 at 02:06:58PM +0200, Daniel Golle wrote:
> > > https://github.com/psyborg55/linux/commit/24b46d482590a87553df1de0b5c8032f363cb7cf
> > >  ?
> > > 
> > >  using this code to determine 7620 soc
> > > 
> > >  if (rt == RT5390 && rt2x00_is_soc(rt2x00dev))
> > >          rt = RT6352;
> > > 
> > >  somehow did not work in rt2800_init_registers routine. i could verify
> > >  that by removing tx_sw_cfg registers from rt6352 and the wifi would
> > >  still work, unless removed them from rt5390 also
> > 
> > I tested by adding additional printk("Init RT6352 registers\n"); in 
> > if (rt2x00_rt(rt2x00dev, RT6352)) branch. The message was printed:
> > 
> > [   68.049946] ieee80211 phy0: rt2x00_set_rt: Info - RT chipset 6352, rev 0500 detected
> > [   68.065392] ieee80211 phy0: rt2x00_set_rf: Info - RF chipset 7620 detected
> > [   68.079777] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
> > [   68.177760] kmodloader: done loading kernel modules from /etc/modules.d/*
> > [   68.825758] urandom_read: 5 callbacks suppressed
> > [   68.825768] random: jshn: uninitialized urandom read (4 bytes read)
> > [   77.792400] 8021q: adding VLAN 0 to HW filter on device eth0
> > [   77.825045] br-lan: port 1(eth0.1) entered blocking state
> > [   77.836032] br-lan: port 1(eth0.1) entered disabled state
> > [   77.847156] device eth0.1 entered promiscuous mode
> > [   77.856739] device eth0 entered promiscuous mode
> > [   77.931043] br-lan: port 1(eth0.1) entered blocking state
> > [   77.941861] br-lan: port 1(eth0.1) entered forwarding state
> > [   77.953171] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
> > [   78.849852] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
> > [   82.302306] Init RT6352 registers
> > 
> > Perhaps rt2x00_is_soc(rt2x00dev) does not work on this particular system
> > that you have and device is configured as RT5390 ? I.e. maybe this is
> > PCIe device. This should be printed in :
> > 
> > ieee80211 phy0: rt2x00_set_rt: Info - RT chipset 6352, rev 0500 detected
> > 
> > line, you should have 'RT chipset 5390' instead.
> 
> RT6352 is the pre-mediatek-merge name of MT7620A/N. It is always a SoC.
> The RF part of both MT7620A and MT7620N identifies as RT5390. The
> vendor driver also uses an equivalent check to destinguish between the
> actual PCIe/USB RT5390xx and RT6352, see
> 
> https://github.com/i80s/mtk-sources/blob/master/mt7620/src/include/rtmp_chip.h#L114

Yes , but this does not explain why things do not work as
expected for Tomislav, which IIUC use RT5390 configuration.

Perhaps the check:

	if (rt == RT5390 && rt2x00_is_soc(rt2x00dev))
		rt = RT6352;

should be some how modified to work on Tomislav's hardware ?

Thanks
Stanislaw

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v3 4/4] rt2800: fix registers init for MT7620
  2018-10-10 12:45         ` Stanislaw Gruszka
@ 2018-10-10 14:11           ` Tom Psyborg
  2018-10-10 15:40             ` Stanislaw Gruszka
  0 siblings, 1 reply; 19+ messages in thread
From: Tom Psyborg @ 2018-10-10 14:11 UTC (permalink / raw)
  To: Stanislaw Gruszka
  Cc: Daniel Golle, linux-wireless, Mathias Kresin, Felix Fietkau

case 1:

	} else if (rt2x00_rt(rt2x00dev, RT5390) ||
		   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);
	} else if (rt2x00_rt(rt2x00dev, RT5592)) {
		rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
		rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00000000);
		rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000);
	} else if (rt2x00_rt(rt2x00dev, RT5350)) {
		rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
	} else if (rt2x00_rt(rt2x00dev, RT6352)) {
		rt2800_register_write(rt2x00dev, MIMO_PS_CFG, 0x00000002);
		rt2800_register_write(rt2x00dev, TX_PIN_CFG, 0x00150F0F);
		rt2800_register_write(rt2x00dev, TX_ALC_VGA3, 0x06060606);
		rt2800_register_write(rt2x00dev, TX0_BB_GAIN_ATTEN, 0x0);
		rt2800_register_write(rt2x00dev, TX1_BB_GAIN_ATTEN, 0x0);
		rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN, 0x6C6C666C);
		rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN, 0x6C6C666C);

does your 6352 wifi work?

case 2:

	} else if (rt2x00_rt(rt2x00dev, RT5390) ||
		   rt2x00_rt(rt2x00dev, RT5392)) {
	} else if (rt2x00_rt(rt2x00dev, RT5592)) {
		rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
		rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00000000);
		rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000);
	} else if (rt2x00_rt(rt2x00dev, RT5350)) {
		rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
	} else if (rt2x00_rt(rt2x00dev, RT6352)) {
		rt2800_register_write(rt2x00dev, MIMO_PS_CFG, 0x00000002);
		rt2800_register_write(rt2x00dev, TX_PIN_CFG, 0x00150F0F);
		rt2800_register_write(rt2x00dev, TX_ALC_VGA3, 0x06060606);
		rt2800_register_write(rt2x00dev, TX0_BB_GAIN_ATTEN, 0x0);
		rt2800_register_write(rt2x00dev, TX1_BB_GAIN_ATTEN, 0x0);
		rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN, 0x6C6C666C);
		rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN, 0x6C6C666C);

does your 6352 wifi still work?


On 10/10/2018, Stanislaw Gruszka <sgruszka@redhat.com> wrote:
> Hello
>
> On Wed, Oct 10, 2018 at 02:06:58PM +0200, Daniel Golle wrote:
>> > > https://github.com/psyborg55/linux/commit/24b46d482590a87553df1de0b5c8032f363cb7cf
>> > >  ?
>> > >
>> > >  using this code to determine 7620 soc
>> > >
>> > >  if (rt == RT5390 && rt2x00_is_soc(rt2x00dev))
>> > >          rt = RT6352;
>> > >
>> > >  somehow did not work in rt2800_init_registers routine. i could
>> > > verify
>> > >  that by removing tx_sw_cfg registers from rt6352 and the wifi would
>> > >  still work, unless removed them from rt5390 also
>> >
>> > I tested by adding additional printk("Init RT6352 registers\n"); in
>> > if (rt2x00_rt(rt2x00dev, RT6352)) branch. The message was printed:
>> >
>> > [   68.049946] ieee80211 phy0: rt2x00_set_rt: Info - RT chipset 6352,
>> > rev 0500 detected
>> > [   68.065392] ieee80211 phy0: rt2x00_set_rf: Info - RF chipset 7620
>> > detected
>> > [   68.079777] ieee80211 phy0: Selected rate control algorithm
>> > 'minstrel_ht'
>> > [   68.177760] kmodloader: done loading kernel modules from
>> > /etc/modules.d/*
>> > [   68.825758] urandom_read: 5 callbacks suppressed
>> > [   68.825768] random: jshn: uninitialized urandom read (4 bytes read)
>> > [   77.792400] 8021q: adding VLAN 0 to HW filter on device eth0
>> > [   77.825045] br-lan: port 1(eth0.1) entered blocking state
>> > [   77.836032] br-lan: port 1(eth0.1) entered disabled state
>> > [   77.847156] device eth0.1 entered promiscuous mode
>> > [   77.856739] device eth0 entered promiscuous mode
>> > [   77.931043] br-lan: port 1(eth0.1) entered blocking state
>> > [   77.941861] br-lan: port 1(eth0.1) entered forwarding state
>> > [   77.953171] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
>> > [   78.849852] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes
>> > ready
>> > [   82.302306] Init RT6352 registers
>> >
>> > Perhaps rt2x00_is_soc(rt2x00dev) does not work on this particular
>> > system
>> > that you have and device is configured as RT5390 ? I.e. maybe this is
>> > PCIe device. This should be printed in :
>> >
>> > ieee80211 phy0: rt2x00_set_rt: Info - RT chipset 6352, rev 0500
>> > detected
>> >
>> > line, you should have 'RT chipset 5390' instead.
>>
>> RT6352 is the pre-mediatek-merge name of MT7620A/N. It is always a SoC.
>> The RF part of both MT7620A and MT7620N identifies as RT5390. The
>> vendor driver also uses an equivalent check to destinguish between the
>> actual PCIe/USB RT5390xx and RT6352, see
>>
>> https://github.com/i80s/mtk-sources/blob/master/mt7620/src/include/rtmp_chip.h#L114
>
> Yes , but this does not explain why things do not work as
> expected for Tomislav, which IIUC use RT5390 configuration.
>
> Perhaps the check:
>
> 	if (rt == RT5390 && rt2x00_is_soc(rt2x00dev))
> 		rt = RT6352;
>
> should be some how modified to work on Tomislav's hardware ?
>
> Thanks
> Stanislaw
>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v3 4/4] rt2800: fix registers init for MT7620
  2018-10-10 14:11           ` Tom Psyborg
@ 2018-10-10 15:40             ` Stanislaw Gruszka
  2018-10-10 20:03               ` Tom Psyborg
  0 siblings, 1 reply; 19+ messages in thread
From: Stanislaw Gruszka @ 2018-10-10 15:40 UTC (permalink / raw)
  To: Tom Psyborg; +Cc: Daniel Golle, linux-wireless, Mathias Kresin, Felix Fietkau

On Wed, Oct 10, 2018 at 04:11:12PM +0200, Tom Psyborg wrote:
> case 1:
> 
> 	} else if (rt2x00_rt(rt2x00dev, RT5390) ||
> 		   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);
> 	} else if (rt2x00_rt(rt2x00dev, RT5592)) {
> 		rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
> 		rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00000000);
> 		rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000);
> 	} else if (rt2x00_rt(rt2x00dev, RT5350)) {
> 		rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
> 	} else if (rt2x00_rt(rt2x00dev, RT6352)) {
> 		rt2800_register_write(rt2x00dev, MIMO_PS_CFG, 0x00000002);
> 		rt2800_register_write(rt2x00dev, TX_PIN_CFG, 0x00150F0F);
> 		rt2800_register_write(rt2x00dev, TX_ALC_VGA3, 0x06060606);
> 		rt2800_register_write(rt2x00dev, TX0_BB_GAIN_ATTEN, 0x0);
> 		rt2800_register_write(rt2x00dev, TX1_BB_GAIN_ATTEN, 0x0);
> 		rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN, 0x6C6C666C);
> 		rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN, 0x6C6C666C);
> 
> does your 6352 wifi work?
> 
> case 2:
> 
> 	} else if (rt2x00_rt(rt2x00dev, RT5390) ||
> 		   rt2x00_rt(rt2x00dev, RT5392)) {
> 	} else if (rt2x00_rt(rt2x00dev, RT5592)) {
> 		rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
> 		rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00000000);
> 		rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000);
> 	} else if (rt2x00_rt(rt2x00dev, RT5350)) {
> 		rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
> 	} else if (rt2x00_rt(rt2x00dev, RT6352)) {
> 		rt2800_register_write(rt2x00dev, MIMO_PS_CFG, 0x00000002);
> 		rt2800_register_write(rt2x00dev, TX_PIN_CFG, 0x00150F0F);
> 		rt2800_register_write(rt2x00dev, TX_ALC_VGA3, 0x06060606);
> 		rt2800_register_write(rt2x00dev, TX0_BB_GAIN_ATTEN, 0x0);
> 		rt2800_register_write(rt2x00dev, TX1_BB_GAIN_ATTEN, 0x0);
> 		rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN, 0x6C6C666C);
> 		rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN, 0x6C6C666C);
> 
> does your 6352 wifi still work?

I checked 'case 2' (on my 'rt2x00' branch on top of 'openwrt-18.06'):

https://github.com/sgruszka/openwrt/commit/8abecc22605bd0221022673a3671201256cff72b

wifi still does work on my MT7620 router with above change and print
is correct.

If it does not work for you, we have to figure this out. Maybe there are
extra patches that broke things or there are some race conditions when
setting "rt =" . Hard to tell. Perhaps you could provide dmesg 
from router where is does not work ?

Thanks
Stanislaw

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v3 4/4] rt2800: fix registers init for MT7620
  2018-10-10 15:40             ` Stanislaw Gruszka
@ 2018-10-10 20:03               ` Tom Psyborg
  2018-10-11 10:05                 ` Stanislaw Gruszka
  0 siblings, 1 reply; 19+ messages in thread
From: Tom Psyborg @ 2018-10-10 20:03 UTC (permalink / raw)
  To: Stanislaw Gruszka
  Cc: Daniel Golle, linux-wireless, Mathias Kresin, Felix Fietkau

ok, that is strange. do you see any performance differences without
TX_SW_CFG regs? iperf test is a good pointer.

this was a problem on xiaomi mini with old DD trunk builds on 4.4
kernel and LEDE builds from last year. i ain't got no chance to try
this on 18.06. which device you tried this on? if ipa/ilna it might
make no difference

On 10/10/2018, Stanislaw Gruszka <sgruszka@redhat.com> wrote:
> On Wed, Oct 10, 2018 at 04:11:12PM +0200, Tom Psyborg wrote:
>> case 1:
>>
>> 	} else if (rt2x00_rt(rt2x00dev, RT5390) ||
>> 		   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);
>> 	} else if (rt2x00_rt(rt2x00dev, RT5592)) {
>> 		rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
>> 		rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00000000);
>> 		rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000);
>> 	} else if (rt2x00_rt(rt2x00dev, RT5350)) {
>> 		rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
>> 	} else if (rt2x00_rt(rt2x00dev, RT6352)) {
>> 		rt2800_register_write(rt2x00dev, MIMO_PS_CFG, 0x00000002);
>> 		rt2800_register_write(rt2x00dev, TX_PIN_CFG, 0x00150F0F);
>> 		rt2800_register_write(rt2x00dev, TX_ALC_VGA3, 0x06060606);
>> 		rt2800_register_write(rt2x00dev, TX0_BB_GAIN_ATTEN, 0x0);
>> 		rt2800_register_write(rt2x00dev, TX1_BB_GAIN_ATTEN, 0x0);
>> 		rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN, 0x6C6C666C);
>> 		rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN, 0x6C6C666C);
>>
>> does your 6352 wifi work?
>>
>> case 2:
>>
>> 	} else if (rt2x00_rt(rt2x00dev, RT5390) ||
>> 		   rt2x00_rt(rt2x00dev, RT5392)) {
>> 	} else if (rt2x00_rt(rt2x00dev, RT5592)) {
>> 		rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
>> 		rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00000000);
>> 		rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000);
>> 	} else if (rt2x00_rt(rt2x00dev, RT5350)) {
>> 		rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
>> 	} else if (rt2x00_rt(rt2x00dev, RT6352)) {
>> 		rt2800_register_write(rt2x00dev, MIMO_PS_CFG, 0x00000002);
>> 		rt2800_register_write(rt2x00dev, TX_PIN_CFG, 0x00150F0F);
>> 		rt2800_register_write(rt2x00dev, TX_ALC_VGA3, 0x06060606);
>> 		rt2800_register_write(rt2x00dev, TX0_BB_GAIN_ATTEN, 0x0);
>> 		rt2800_register_write(rt2x00dev, TX1_BB_GAIN_ATTEN, 0x0);
>> 		rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN, 0x6C6C666C);
>> 		rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN, 0x6C6C666C);
>>
>> does your 6352 wifi still work?
>
> I checked 'case 2' (on my 'rt2x00' branch on top of 'openwrt-18.06'):
>
> https://github.com/sgruszka/openwrt/commit/8abecc22605bd0221022673a3671201256cff72b
>
> wifi still does work on my MT7620 router with above change and print
> is correct.
>
> If it does not work for you, we have to figure this out. Maybe there are
> extra patches that broke things or there are some race conditions when
> setting "rt =" . Hard to tell. Perhaps you could provide dmesg
> from router where is does not work ?
>
> Thanks
> Stanislaw
>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v3 4/4] rt2800: fix registers init for MT7620
  2018-10-10 20:03               ` Tom Psyborg
@ 2018-10-11 10:05                 ` Stanislaw Gruszka
  2018-10-11 12:39                   ` Tom Psyborg
  0 siblings, 1 reply; 19+ messages in thread
From: Stanislaw Gruszka @ 2018-10-11 10:05 UTC (permalink / raw)
  To: Tom Psyborg; +Cc: Daniel Golle, linux-wireless, Mathias Kresin, Felix Fietkau

On Wed, Oct 10, 2018 at 10:03:12PM +0200, Tom Psyborg wrote:
> ok, that is strange. do you see any performance differences without
> TX_SW_CFG regs? iperf test is a good pointer.
> 
> this was a problem on xiaomi mini with old DD trunk builds on 4.4
> kernel and LEDE builds from last year. i ain't got no chance to try
> this on 18.06. which device you tried this on? if ipa/ilna it might
> make no difference

No diffrence for me. I have nexx wt3020 8M.

However I notice this set couse performance regression for me. 
When connecting to iwl 7265 . Without the set I have:

root@LEDE:~# iperf3 -c 192.168.10.243
Connecting to host 192.168.10.243, port 5201
[  5] local 192.168.10.1 port 59304 connected to 192.168.10.243 port 5201
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec  5.37 MBytes  44.9 Mbits/sec    0    279 KBytes       
[  5]   1.00-2.00   sec  5.80 MBytes  48.8 Mbits/sec    0    494 KBytes       
[  5]   2.00-3.00   sec  6.03 MBytes  50.5 Mbits/sec    0    513 KBytes       
[  5]   3.00-4.01   sec  5.90 MBytes  49.2 Mbits/sec    0    513 KBytes       
[  5]   4.01-5.01   sec  5.90 MBytes  49.5 Mbits/sec    0    515 KBytes       
[  5]   5.01-6.00   sec  5.78 MBytes  48.9 Mbits/sec    0    515 KBytes       
[  5]   6.00-7.00   sec  5.66 MBytes  47.4 Mbits/sec    0    515 KBytes       
[  5]   7.00-8.00   sec  6.03 MBytes  50.6 Mbits/sec    0    515 KBytes       
[  5]   8.00-9.00   sec  6.09 MBytes  50.9 Mbits/sec    0    515 KBytes       
[  5]   9.00-10.00  sec  5.72 MBytes  48.2 Mbits/sec    0    515 KBytes       
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec  58.3 MBytes  48.9 Mbits/sec    0             sender
[  5]   0.00-10.00  sec  58.3 MBytes  48.9 Mbits/sec                  receiver

With the set I have:

root@LEDE:~# iperf3  -c 192.168.10.243
Connecting to host 192.168.10.243, port 5201
[  5] local 192.168.10.1 port 45824 connected to 192.168.10.243 port 5201
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec  3.78 MBytes  31.7 Mbits/sec    0    197 KBytes
[  5]   1.00-2.00   sec  3.71 MBytes  31.0 Mbits/sec    0    369 KBytes
[  5]   2.00-3.00   sec  3.51 MBytes  29.5 Mbits/sec    0    484 KBytes
[  5]   3.00-4.00   sec  3.36 MBytes  28.1 Mbits/sec    0    519 KBytes
[  5]   4.00-5.00   sec  4.10 MBytes  34.4 Mbits/sec    0    519 KBytes
[  5]   5.00-6.00   sec  3.73 MBytes  31.2 Mbits/sec    0    519 KBytes
[  5]   6.00-7.00   sec  4.29 MBytes  36.0 Mbits/sec    0    519 KBytes
[  5]   7.00-8.00   sec  4.16 MBytes  34.9 Mbits/sec    0    519 KBytes
[  5]   8.00-9.00   sec  4.35 MBytes  36.5 Mbits/sec    0    519 KBytes
[  5]   9.00-10.00  sec  4.41 MBytes  37.0 Mbits/sec    0    519 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec  39.4 MBytes  33.0 Mbits/sec    0             sender
[  5]   0.00-10.00  sec  39.4 MBytes  33.0 Mbits/sec                  receiver


Stanislaw


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v3 1/4] rt2x00: remove unneeded check
  2018-10-09 11:56 [PATCH v3 1/4] rt2x00: remove unneeded check Stanislaw Gruszka
                   ` (2 preceding siblings ...)
  2018-10-09 11:56 ` [PATCH v3 4/4] rt2800: fix registers init for MT7620 Stanislaw Gruszka
@ 2018-10-11 10:06 ` Stanislaw Gruszka
  3 siblings, 0 replies; 19+ messages in thread
From: Stanislaw Gruszka @ 2018-10-11 10:06 UTC (permalink / raw)
  To: linux-wireless, Kalle Valo
  Cc: Daniel Golle, Mathias Kresin, Felix Fietkau, Tomislav Požega

Kalle, plese drop this set it has to be reworked.

Thanks
Stanislaw

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v3 4/4] rt2800: fix registers init for MT7620
  2018-10-11 10:05                 ` Stanislaw Gruszka
@ 2018-10-11 12:39                   ` Tom Psyborg
  2018-10-12  8:50                     ` Stanislaw Gruszka
  0 siblings, 1 reply; 19+ messages in thread
From: Tom Psyborg @ 2018-10-11 12:39 UTC (permalink / raw)
  To: Stanislaw Gruszka
  Cc: Daniel Golle, linux-wireless, Mathias Kresin, Felix Fietkau

so this is RX test where I assume your 7265 card is sending data. is
that HT20 or HT40 mode and do you get regression on TX too?

can you try same case 2 test but with registers set to:

TX_SW_CFG0, 0x00000401
TX_SW_CFG1, 0x000C0000
TX_SW_CFG2, 0x00000000 (or 0x000C0408)

did you ever notice any tx power difference between nexx fw and openwrt fw?

On 11/10/2018, Stanislaw Gruszka <sgruszka@redhat.com> wrote:
> On Wed, Oct 10, 2018 at 10:03:12PM +0200, Tom Psyborg wrote:
>> ok, that is strange. do you see any performance differences without
>> TX_SW_CFG regs? iperf test is a good pointer.
>>
>> this was a problem on xiaomi mini with old DD trunk builds on 4.4
>> kernel and LEDE builds from last year. i ain't got no chance to try
>> this on 18.06. which device you tried this on? if ipa/ilna it might
>> make no difference
>
> No diffrence for me. I have nexx wt3020 8M.
>
> However I notice this set couse performance regression for me.
> When connecting to iwl 7265 . Without the set I have:
>
> root@LEDE:~# iperf3 -c 192.168.10.243
> Connecting to host 192.168.10.243, port 5201
> [  5] local 192.168.10.1 port 59304 connected to 192.168.10.243 port 5201
> [ ID] Interval           Transfer     Bitrate         Retr  Cwnd
> [  5]   0.00-1.00   sec  5.37 MBytes  44.9 Mbits/sec    0    279 KBytes
>
> [  5]   1.00-2.00   sec  5.80 MBytes  48.8 Mbits/sec    0    494 KBytes
>
> [  5]   2.00-3.00   sec  6.03 MBytes  50.5 Mbits/sec    0    513 KBytes
>
> [  5]   3.00-4.01   sec  5.90 MBytes  49.2 Mbits/sec    0    513 KBytes
>
> [  5]   4.01-5.01   sec  5.90 MBytes  49.5 Mbits/sec    0    515 KBytes
>
> [  5]   5.01-6.00   sec  5.78 MBytes  48.9 Mbits/sec    0    515 KBytes
>
> [  5]   6.00-7.00   sec  5.66 MBytes  47.4 Mbits/sec    0    515 KBytes
>
> [  5]   7.00-8.00   sec  6.03 MBytes  50.6 Mbits/sec    0    515 KBytes
>
> [  5]   8.00-9.00   sec  6.09 MBytes  50.9 Mbits/sec    0    515 KBytes
>
> [  5]   9.00-10.00  sec  5.72 MBytes  48.2 Mbits/sec    0    515 KBytes
>
> - - - - - - - - - - - - - - - - - - - - - - - - -
> [ ID] Interval           Transfer     Bitrate         Retr
> [  5]   0.00-10.00  sec  58.3 MBytes  48.9 Mbits/sec    0
> sender
> [  5]   0.00-10.00  sec  58.3 MBytes  48.9 Mbits/sec
> receiver
>
> With the set I have:
>
> root@LEDE:~# iperf3  -c 192.168.10.243
> Connecting to host 192.168.10.243, port 5201
> [  5] local 192.168.10.1 port 45824 connected to 192.168.10.243 port 5201
> [ ID] Interval           Transfer     Bitrate         Retr  Cwnd
> [  5]   0.00-1.00   sec  3.78 MBytes  31.7 Mbits/sec    0    197 KBytes
> [  5]   1.00-2.00   sec  3.71 MBytes  31.0 Mbits/sec    0    369 KBytes
> [  5]   2.00-3.00   sec  3.51 MBytes  29.5 Mbits/sec    0    484 KBytes
> [  5]   3.00-4.00   sec  3.36 MBytes  28.1 Mbits/sec    0    519 KBytes
> [  5]   4.00-5.00   sec  4.10 MBytes  34.4 Mbits/sec    0    519 KBytes
> [  5]   5.00-6.00   sec  3.73 MBytes  31.2 Mbits/sec    0    519 KBytes
> [  5]   6.00-7.00   sec  4.29 MBytes  36.0 Mbits/sec    0    519 KBytes
> [  5]   7.00-8.00   sec  4.16 MBytes  34.9 Mbits/sec    0    519 KBytes
> [  5]   8.00-9.00   sec  4.35 MBytes  36.5 Mbits/sec    0    519 KBytes
> [  5]   9.00-10.00  sec  4.41 MBytes  37.0 Mbits/sec    0    519 KBytes
> - - - - - - - - - - - - - - - - - - - - - - - - -
> [ ID] Interval           Transfer     Bitrate         Retr
> [  5]   0.00-10.00  sec  39.4 MBytes  33.0 Mbits/sec    0
> sender
> [  5]   0.00-10.00  sec  39.4 MBytes  33.0 Mbits/sec
> receiver
>
>
> Stanislaw
>
>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v3 4/4] rt2800: fix registers init for MT7620
  2018-10-11 12:39                   ` Tom Psyborg
@ 2018-10-12  8:50                     ` Stanislaw Gruszka
  0 siblings, 0 replies; 19+ messages in thread
From: Stanislaw Gruszka @ 2018-10-12  8:50 UTC (permalink / raw)
  To: Tom Psyborg; +Cc: Daniel Golle, linux-wireless, Mathias Kresin, Felix Fietkau

On Thu, Oct 11, 2018 at 02:39:25PM +0200, Tom Psyborg wrote:
> so this is RX test where I assume your 7265 card is sending data. is
> that HT20 or HT40 mode and do you get regression on TX too?
> 
> can you try same case 2 test but with registers set to:
> 
> TX_SW_CFG0, 0x00000401
> TX_SW_CFG1, 0x000C0000
> TX_SW_CFG2, 0x00000000 (or 0x000C0408)
> 
> did you ever notice any tx power difference between nexx fw and openwrt fw?

Changing only TX_SW_CFG* does not make any diffrence on my router,
but this patch also start to configure other registers i.e.
MIMO_PS_CFG and that coused performance regression. I'll repost
without additional register programming.

Thanks
Stanislaw

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2018-10-12  8:50 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-09 11:56 [PATCH v3 1/4] rt2x00: remove unneeded check Stanislaw Gruszka
2018-10-09 11:56 ` [PATCH v3 2/4] rt2x00: remove confusing AGC register Stanislaw Gruszka
2018-10-09 12:27   ` Daniel Golle
2018-10-09 12:47     ` Stanislaw Gruszka
2018-10-09 13:07       ` Daniel Golle
2018-10-09 13:23         ` Stanislaw Gruszka
2018-10-09 11:56 ` [PATCH v3 3/4] rt2x00: update TX_SW_CFG2 value Stanislaw Gruszka
2018-10-09 11:56 ` [PATCH v3 4/4] rt2800: fix registers init for MT7620 Stanislaw Gruszka
2018-10-09 23:27   ` Tom Psyborg
2018-10-10  7:14     ` Stanislaw Gruszka
2018-10-10 12:06       ` Daniel Golle
2018-10-10 12:45         ` Stanislaw Gruszka
2018-10-10 14:11           ` Tom Psyborg
2018-10-10 15:40             ` Stanislaw Gruszka
2018-10-10 20:03               ` Tom Psyborg
2018-10-11 10:05                 ` Stanislaw Gruszka
2018-10-11 12:39                   ` Tom Psyborg
2018-10-12  8:50                     ` Stanislaw Gruszka
2018-10-11 10:06 ` [PATCH v3 1/4] rt2x00: remove unneeded check Stanislaw Gruszka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.