2013-10-24 05:47:16

by Kevin Lo

[permalink] [raw]
Subject: [PATCH] rt2x00: rt2800lib: update RF registers for RT5390

Mirror the latest MediaTek/Ralink driver with respect to RT5390 RF register
programming. The PCI and USB devices use different init values.

Signed-off-by: Kevin Lo <[email protected]>
---

diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index c5738f1..2c4e436 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -6453,7 +6453,7 @@ static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev)
rt2800_rfcsr_write(rt2x00dev, 7, 0x00);
rt2800_rfcsr_write(rt2x00dev, 10, 0x53);
rt2800_rfcsr_write(rt2x00dev, 11, 0x4a);
- rt2800_rfcsr_write(rt2x00dev, 12, 0xc6);
+ rt2800_rfcsr_write(rt2x00dev, 12, 0x46);
rt2800_rfcsr_write(rt2x00dev, 13, 0x9f);
rt2800_rfcsr_write(rt2x00dev, 14, 0x00);
rt2800_rfcsr_write(rt2x00dev, 15, 0x00);
@@ -6466,7 +6466,8 @@ static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev)
rt2800_rfcsr_write(rt2x00dev, 22, 0x20);
rt2800_rfcsr_write(rt2x00dev, 23, 0x00);
rt2800_rfcsr_write(rt2x00dev, 24, 0x00);
- if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F))
+ if (rt2x00_is_usb(rt2x00dev) &&
+ rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F))
rt2800_rfcsr_write(rt2x00dev, 25, 0x80);
else
rt2800_rfcsr_write(rt2x00dev, 25, 0xc0);
@@ -6486,10 +6487,7 @@ static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev)
rt2800_rfcsr_write(rt2x00dev, 38, 0x85);
rt2800_rfcsr_write(rt2x00dev, 39, 0x1b);

- if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F))
- rt2800_rfcsr_write(rt2x00dev, 40, 0x0b);
- else
- rt2800_rfcsr_write(rt2x00dev, 40, 0x4b);
+ rt2800_rfcsr_write(rt2x00dev, 40, 0x0b);
rt2800_rfcsr_write(rt2x00dev, 41, 0xbb);
rt2800_rfcsr_write(rt2x00dev, 42, 0xd2);
rt2800_rfcsr_write(rt2x00dev, 43, 0x9a);
@@ -6510,16 +6508,26 @@ static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev)
rt2800_rfcsr_write(rt2x00dev, 53, 0x84);
rt2800_rfcsr_write(rt2x00dev, 54, 0x78);
rt2800_rfcsr_write(rt2x00dev, 55, 0x44);
- rt2800_rfcsr_write(rt2x00dev, 56, 0x22);
+ if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F))
+ rt2800_rfcsr_write(rt2x00dev, 56, 0x42);
+ else
+ rt2800_rfcsr_write(rt2x00dev, 56, 0x22);
rt2800_rfcsr_write(rt2x00dev, 57, 0x80);
rt2800_rfcsr_write(rt2x00dev, 58, 0x7f);
rt2800_rfcsr_write(rt2x00dev, 59, 0x8f);

rt2800_rfcsr_write(rt2x00dev, 60, 0x45);
- if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F))
- rt2800_rfcsr_write(rt2x00dev, 61, 0xd1);
- else
- rt2800_rfcsr_write(rt2x00dev, 61, 0xdd);
+ if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) {
+ if (rt2x00_is_usb(rt2x00dev))
+ rt2800_rfcsr_write(rt2x00dev, 61, 0xd1);
+ else
+ rt2800_rfcsr_write(rt2x00dev, 61, 0xd5);
+ } else {
+ if (rt2x00_is_usb(rt2x00dev))
+ rt2800_rfcsr_write(rt2x00dev, 61, 0xdd);
+ else
+ rt2800_rfcsr_write(rt2x00dev, 61, 0xb5);
+ }
rt2800_rfcsr_write(rt2x00dev, 62, 0x00);
rt2800_rfcsr_write(rt2x00dev, 63, 0x00);



2013-10-27 16:32:30

by Andreas Hartmann

[permalink] [raw]
Subject: Re: [rt2x00-users] [PATCH] rt2x00: rt2800lib: update RF registers for RT5390

Hello Kevin!

Kevin Lo wrote:
> Andreas Hartmann wrote:
[...]
>> In a nutshell: Use a few, but big USB packets instead of a lot of small
>> ones, which needs a lot of interrupts / s and therefore needs a lot of
>> CPU resources - which aren't available on the PI at all.
>
> I have a lot of embedded devices (Freescale imx5/imx6, Marvell armanda xp
> ... etc) here and I've also noticed usb performance issues.
>
> Firstly, I want to sync register settings, which is obtained from the
> vendor driver. When it's done, I will take a look at how usb is handled by
> the vendor driver and fix performance issues. Since I don't have
> datasheets,
> I'm not sure updating register values won't help much...

The problem is: as long as the USB interface "filters" as bottleneck
each small change, it's hard to tell if the change was successful or not.
But I'm happy to hear that you see the same problems and I would be
happy if you could fix them. I can test the fixes you hopefully provide
with big (SMP hardware) and small (ARM) hardware and with rt3572 and rt3573.


Thanks,
kind regards,
Andreas

2013-10-24 17:07:25

by Andreas Hartmann

[permalink] [raw]
Subject: Re: [rt2x00-users] [PATCH] rt2x00: rt2800lib: update RF registers for RT5390

Hi Kevin,

Kevin Lo wrote:
> Mirror the latest MediaTek/Ralink driver with respect to RT5390 RF register
> programming. The PCI and USB devices use different init values.

If you (and others here) really want to improve anything for rt2800usb,
change your development system and use a raspberry pi (PI).

Why PI? Because the PI doesn't cover any broken code / concept / driver
architecture with hardware resources.

You want to have an example?

This device[1] achieves 140 MBit/s (data receiving) on the PI, measured
with netperf and rt5572sta compared to rt2800usb, which achieves very
very very poor 30 MBit/s(! - even w/ best radio conditions can't be
achieved any more) but an extremely high CPU load at the same time!

If you compare the basic behaviour of rt5572sta and rt2800usb, you will
see, that rt5572sta uses a completely different usb handling, which
doesn't need that much CPU resources as the one used by rt2800usb.

Therefore: If you really want to improve rt2800usb, at first take a
serious look at how usb is handled by rt5572sta and how to save CPU
resources.

In a nutshell: Use a few, but big USB packets instead of a lot of small
ones, which needs a lot of interrupts / s and therefore needs a lot of
CPU resources - which aren't available on the PI at all.


Kind regards,
Andreas



[1] http://wikidevi.com/wiki/Linksys_AE3000

2013-10-25 02:29:39

by Kevin Lo

[permalink] [raw]
Subject: Re: [rt2x00-users] [PATCH] rt2x00: rt2800lib: update RF registers for RT5390

Andreas Hartmann wrote:
> Hi Kevin,

Hi Andreas,

> Kevin Lo wrote:
>> Mirror the latest MediaTek/Ralink driver with respect to RT5390 RF register
>> programming. The PCI and USB devices use different init values.
> If you (and others here) really want to improve anything for rt2800usb,
> change your development system and use a raspberry pi (PI).
>
> Why PI? Because the PI doesn't cover any broken code / concept / driver
> architecture with hardware resources.
>
> You want to have an example?
>
> This device[1] achieves 140 MBit/s (data receiving) on the PI, measured
> with netperf and rt5572sta compared to rt2800usb, which achieves very
> very very poor 30 MBit/s(! - even w/ best radio conditions can't be
> achieved any more) but an extremely high CPU load at the same time!
>
> If you compare the basic behaviour of rt5572sta and rt2800usb, you will
> see, that rt5572sta uses a completely different usb handling, which
> doesn't need that much CPU resources as the one used by rt2800usb.
>
> Therefore: If you really want to improve rt2800usb, at first take a
> serious look at how usb is handled by rt5572sta and how to save CPU
> resources.
>
> In a nutshell: Use a few, but big USB packets instead of a lot of small
> ones, which needs a lot of interrupts / s and therefore needs a lot of
> CPU resources - which aren't available on the PI at all.

I have a lot of embedded devices (Freescale imx5/imx6, Marvell armanda xp
... etc) here and I've also noticed usb performance issues.

Firstly, I want to sync register settings, which is obtained from the
vendor driver. When it's done, I will take a look at how usb is handled by
the vendor driver and fix performance issues. Since I don't have
datasheets,
I'm not sure updating register values won't help much...

>
>
> Kind regards,
> Andreas
>
>
>
> [1] http://wikidevi.com/wiki/Linksys_AE3000

Kevin