diff mbox series

[v3,4/4] rt2800: fix registers init for MT7620

Message ID 1539086170-32528-4-git-send-email-sgruszka@redhat.com (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show
Series [v3,1/4] rt2x00: remove unneeded check | expand

Commit Message

Stanislaw Gruszka Oct. 9, 2018, 11:56 a.m. UTC
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(-)

Comments

Tom Psyborg Oct. 9, 2018, 11:27 p.m. UTC | #1
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
Stanislaw Gruszka Oct. 10, 2018, 7:14 a.m. UTC | #2
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
Daniel Golle Oct. 10, 2018, 12:06 p.m. UTC | #3
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
Stanislaw Gruszka Oct. 10, 2018, 12:45 p.m. UTC | #4
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
Tom Psyborg Oct. 10, 2018, 2:11 p.m. UTC | #5
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
>
Stanislaw Gruszka Oct. 10, 2018, 3:40 p.m. UTC | #6
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
Tom Psyborg Oct. 10, 2018, 8:03 p.m. UTC | #7
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
>
Stanislaw Gruszka Oct. 11, 2018, 10:05 a.m. UTC | #8
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
Tom Psyborg Oct. 11, 2018, 12:39 p.m. UTC | #9
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
>
>
Stanislaw Gruszka Oct. 12, 2018, 8:50 a.m. UTC | #10
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
diff mbox series

Patch

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);