Skip to contentSkip to conversation

rt2x00: rt2800lib: update RF registers for RT5390

PATCH In review Kevin Lo 2 participants 4 messages Oct 24, 2013 – Oct 27, 2013 Networking drivers (wireless)

lore
Share & tools
lore

Kevin Lo

author
#0 lore raw

PATCH 1/1 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.

---

drivers/net/wireless/rt2x00/rt2800lib.c +19 -11
index c5738f1..2c4e436 100644
@@ -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);
 
#1 lore raw

Hi Kevin,

Quoted 2 lines · Kevin Lo

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

author
#2 lore raw
Quoted 1 line · Andreas Hartmann

Hi Kevin,

Hi Andreas,

Quoted 20 lines
Quoted 2 lines · Kevin Lo

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.

Quoted 7 lines

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...

Quoted 8 lines

Kind regards,
Andreas

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

Kevin

#3 lore raw

Hello Kevin!

Quoted 1 line · Kevin Lo

Andreas Hartmann wrote:

[...]

Quoted 4 lines
Quoted 3 lines

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.

Quoted 8 lines

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