2012-01-24 13:09:34

by Stanislaw Gruszka

[permalink] [raw]
Subject: [PATCH 1/4] rt2800usb: initialize H2M_INT_SRC register

Ralink USB driver initialize H2M_INT_SRC to 0 after firmware load, and
never touch this register later. It is not touched at all by Ralink PCI
driver.

Acked-by: Helmut Schaa <[email protected]>
Acked-by: Ivo van Doorn <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/rt2x00/rt2800lib.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 22a1a8f..3e194b7 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -448,6 +448,8 @@ int rt2800_load_firmware(struct rt2x00_dev *rt2x00dev,
*/
rt2800_register_write(rt2x00dev, H2M_BBP_AGENT, 0);
rt2800_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0);
+ if (rt2x00_is_usb(rt2x00dev))
+ rt2800_register_write(rt2x00dev, H2M_INT_SRC, 0);
msleep(1);

return 0;
--
1.7.1



2012-01-25 13:02:19

by Andreas Hartmann

[permalink] [raw]
Subject: Re: [rt2x00-users] [PATCH 4/4] rt2800usb: remove PWR_PIN_CFG=0x3 during init

Stanislaw Gruszka schrieb:
> Hello
>
> On Tue, Jan 24, 2012 at 06:37:45PM +0100, Andreas Hartmann wrote:
>> Stanislaw Gruszka schrieb:
>>> This seems to be only needed as workaround for hardware problem on
>>> PCI devices.
>>
>> I tested this series (with all other resent patches applied) against a
>> rt3572usb based device (Linksys WUSB600N) on to different machines
>> (64bit smp (linux 3.2.1) and 32bit single core (linux 2.6.37.6)). I
>> couldn't see any functional change. Unfortunately it's as bad as
>> always :-(.
>>
>> But one thing is new: I'm getting now these errors in messages (with
>> kernel 3.2.1) in the moment of the stall (which never stops until the
>> module is unloaded (or I didn't display enough patience)):
>>
>>
>> Jan 24 18:10:23 nb kernel: [ 798.289036] phy0 -> rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x101c with error -71.
> This is write to BBP_CSR_CFG. I don't know, which patch is is responsible
> for that error (patch4 looks most suspicious), can you check those 4 patches
> one by one, and tell us which is causing this error?

I removed Patch 1 and 4 - the problem didn't change. I think it's not
patch related, but system related: This was the first time, I tested
with this notebook (because compiling is much more fast :-)) and to get
more timing issues: this notebook is a Core i5 (the other was a
CeleronM). Besides that, there is another kernel version (3.2 vs.
2.6.37.6) and a completely new compat-wireless.

But I can say one more thing:

If this error above came up, the device isn't detected any more. Even
reloading of the complete wireless stack is useless:

11329.157039] cfg80211: Calling CRDA to update world regulatory domain
[11329.164191] cfg80211: World regulatory domain updated:
[11329.164200] cfg80211: (start_freq - end_freq @ bandwidth),
(max_antenna_gain, max_eirp)
[11329.164202] cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz), (300
mBi, 2000 mBm)
[11329.164204] cfg80211: (2457000 KHz - 2482000 KHz @ 20000 KHz), (300
mBi, 2000 mBm)
[11329.164206] cfg80211: (2474000 KHz - 2494000 KHz @ 20000 KHz), (300
mBi, 2000 mBm)
[11329.164208] cfg80211: (5170000 KHz - 5250000 KHz @ 40000 KHz), (300
mBi, 2000 mBm)
[11329.164209] cfg80211: (5735000 KHz - 5835000 KHz @ 40000 KHz), (300
mBi, 2000 mBm)
[11329.246554] phy0 -> rt2x00usb_vendor_request: Error - Vendor Request
0x07 failed for offset 0x0580 with error -19.
[11329.246585] phy0 -> rt2800_init_eeprom: Error - Invalid RT chipset
detected.
[11329.246590] phy0 -> rt2x00lib_probe_dev: Error - Failed to allocate
device.
[11329.246688] usbcore: registered new interface driver rt2800usb
[11329.246863] usb 2-1.6: USB disconnect, device number 4


You have to replug the device to get it detected again.

Some more details about what is concretely broken (tested with netperf):

AP -> STA 2.4 MBit/s (if it doesn't stall)
STA -> AP doesn't work at all

BTW: the performance should be at this location about 65 MBit/s
(AP->STA) or 55 MBit/s (STA-AP).


Well, I think, that the device is just overrun. The USB-handling looks
really odd. See here:
http://rt2x00.serialmonkey.com/pipermail/users_rt2x00.serialmonkey.com/2011-November/004278.html


Kind regards,
Andreas

2012-01-25 09:54:28

by Stanislaw Gruszka

[permalink] [raw]
Subject: Re: [rt2x00-users] [PATCH 4/4] rt2800usb: remove PWR_PIN_CFG=0x3 during init

Hello

On Tue, Jan 24, 2012 at 06:37:45PM +0100, Andreas Hartmann wrote:
> Stanislaw Gruszka schrieb:
> > This seems to be only needed as workaround for hardware problem on
> > PCI devices.
>
> I tested this series (with all other resent patches applied) against a
> rt3572usb based device (Linksys WUSB600N) on to different machines
> (64bit smp (linux 3.2.1) and 32bit single core (linux 2.6.37.6)). I
> couldn't see any functional change. Unfortunately it's as bad as
> always :-(.
>
> But one thing is new: I'm getting now these errors in messages (with
> kernel 3.2.1) in the moment of the stall (which never stops until the
> module is unloaded (or I didn't display enough patience)):
>
>
> Jan 24 18:10:23 nb kernel: [ 798.289036] phy0 -> rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x101c with error -71.
This is write to BBP_CSR_CFG. I don't know, which patch is is responsible
for that error (patch4 looks most suspicious), can you check those 4 patches
one by one, and tell us which is causing this error?

Thanks
Stanislaw

2012-01-24 17:40:24

by Andreas Hartmann

[permalink] [raw]
Subject: Re: [rt2x00-users] [PATCH 4/4] rt2800usb: remove PWR_PIN_CFG=0x3 during init

Hi Stanislaw,

Stanislaw Gruszka schrieb:
> This seems to be only needed as workaround for hardware problem on
> PCI devices.

I tested this series (with all other resent patches applied) against a
rt3572usb based device (Linksys WUSB600N) on to different machines
(64bit smp (linux 3.2.1) and 32bit single core (linux 2.6.37.6)). I
couldn't see any functional change. Unfortunately it's as bad as
always :-(.

But one thing is new: I'm getting now these errors in messages (with
kernel 3.2.1) in the moment of the stall (which never stops until the
module is unloaded (or I didn't display enough patience)):


Jan 24 18:10:23 nb kernel: [ 798.289036] phy0 -> rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x101c with error -71.
Jan 24 18:10:24 nb kernel: [ 798.701293] phy0 -> rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x101c with error -71.
Jan 24 18:10:24 nb kernel: [ 799.113537] phy0 -> rt2x00usb_vendor_request: Error - Vendor Request 0x06 failed for offset 0x101c with error -71.
Jan 24 18:10:25 nb kernel: [ 799.525923] phy0 -> rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x101c with error -71.
Jan 24 18:10:25 nb kernel: [ 799.938177] phy0 -> rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x101c with error -71.
Jan 24 18:10:25 nb kernel: [ 800.350428] phy0 -> rt2x00usb_vendor_request: Error - Vendor Request 0x06 failed for offset 0x101c with error -71.
Jan 24 18:10:26 nb kernel: [ 800.762682] phy0 -> rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x101c with error -71.
Jan 24 18:10:26 nb kernel: [ 801.174804] phy0 -> rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x101c with error -71.
Jan 24 18:10:27 nb kernel: [ 801.586928] phy0 -> rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x101c with error -71.
Jan 24 18:10:27 nb kernel: [ 801.999047] phy0 -> rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x101c with error -71.
Jan 24 18:10:28 nb kernel: [ 802.411208] phy0 -> rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x101c with error -71.
Jan 24 18:10:28 nb kernel: [ 802.823413] phy0 -> rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x101c with error -71.
Jan 24 18:10:28 nb kernel: [ 803.235584] phy0 -> rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x101c with error -71.
Jan 24 18:10:28 nb kernel: [ 803.278183] tx session timer expired on tid 0
Jan 24 18:10:29 nb kernel: [ 803.647830] phy0 -> rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x101c with error -71.
Jan 24 18:10:29 nb kernel: [ 804.059961] phy0 -> rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x101c with error -71.
Jan 24 18:10:30 nb kernel: [ 804.472326] phy0 -> rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x101c with error -71.
Jan 24 18:10:30 nb kernel: [ 804.884463] phy0 -> rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x101c with error -71.
Jan 24 18:10:30 nb kernel: [ 805.296625] phy0 -> rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x101c with error -71.
Jan 24 18:10:31 nb kernel: [ 805.708686] phy0 -> rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x101c with error -71.
Jan 24 18:10:31 nb kernel: [ 806.120842] phy0 -> rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x101c with error -71.
Jan 24 18:10:32 nb kernel: [ 806.533120] phy0 -> rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x101c with error -71.
Jan 24 18:10:32 nb kernel: [ 806.945222] phy0 -> rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x101c with error -71.
Jan 24 18:10:33 nb kernel: [ 807.357495] phy0 -> rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x101c with error -71.
Jan 24 18:10:33 nb kernel: [ 807.769588] phy0 -> rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x101c with error -71.
Jan 24 18:10:33 nb kernel: [ 808.181876] phy0 -> rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x101c with error -71.
Jan 24 18:10:34 nb kernel: [ 808.594125] phy0 -> rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x101c with error -71.
Jan 24 18:10:34 nb kernel: [ 809.006261] phy0 -> rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x101c with error -71.
...
Jan 24 18:11:07 nb kernel: [ 841.590496] phy0 -> rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x101c with error -71.
Jan 24 18:11:07 nb kernel: [ 841.590604] phy0 -> rt2x00usb_regbusy_read: Error - Indirect register access failed: offset=0x0000101c, value=0xffff8800
Jan 24 18:11:07 nb kernel: [ 842.003019] phy0 -> rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x101c with error -71.
Jan 24 18:11:08 nb kernel: [ 842.415369] phy0 -> rt2x00usb_vendor_request: Error - Vendor Request 0x06 failed for offset 0x101c with error -71.


Kind regards,
Andreas

2012-01-24 13:09:33

by Stanislaw Gruszka

[permalink] [raw]
Subject: [PATCH 2/4] rt2800: disable DMA after firmware load

We can receive frames just after firmware load with current code, so
disable DMA just after firmware is loaded, not before.

Acked-by: Ivo van Doorn <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/rt2x00/rt2800lib.c | 21 +++++++++------------
1 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 3e194b7..165535c 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -412,18 +412,6 @@ int rt2800_load_firmware(struct rt2x00_dev *rt2x00dev,
}

/*
- * Disable DMA, will be reenabled later when enabling
- * the radio.
- */
- rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG, &reg);
- rt2x00_set_field32(&reg, WPDMA_GLO_CFG_ENABLE_TX_DMA, 0);
- rt2x00_set_field32(&reg, WPDMA_GLO_CFG_TX_DMA_BUSY, 0);
- rt2x00_set_field32(&reg, WPDMA_GLO_CFG_ENABLE_RX_DMA, 0);
- rt2x00_set_field32(&reg, WPDMA_GLO_CFG_RX_DMA_BUSY, 0);
- rt2x00_set_field32(&reg, WPDMA_GLO_CFG_TX_WRITEBACK_DONE, 1);
- rt2800_register_write(rt2x00dev, WPDMA_GLO_CFG, reg);
-
- /*
* Write firmware to the device.
*/
rt2800_drv_write_firmware(rt2x00dev, data, len);
@@ -444,6 +432,15 @@ int rt2800_load_firmware(struct rt2x00_dev *rt2x00dev,
}

/*
+ * Disable DMA, will be reenabled later when enabling
+ * the radio.
+ */
+ rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG, &reg);
+ rt2x00_set_field32(&reg, WPDMA_GLO_CFG_ENABLE_TX_DMA, 0);
+ rt2x00_set_field32(&reg, WPDMA_GLO_CFG_ENABLE_RX_DMA, 0);
+ rt2800_register_write(rt2x00dev, WPDMA_GLO_CFG, reg);
+
+ /*
* Initialize firmware.
*/
rt2800_register_write(rt2x00dev, H2M_BBP_AGENT, 0);
--
1.7.1


2012-01-24 13:09:51

by Stanislaw Gruszka

[permalink] [raw]
Subject: [PATCH 4/4] rt2800usb: remove PWR_PIN_CFG=0x3 during init

This seems to be only needed as workaround for hardware problem on
PCI devices.

Acked-by: Helmut Schaa <[email protected]>
Acked-by: Ivo van Doorn <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/rt2x00/rt2800usb.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index 425267a..f0074bc 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -226,8 +226,6 @@ static int rt2800usb_init_registers(struct rt2x00_dev *rt2x00dev)
rt2x00usb_register_read(rt2x00dev, PBF_SYS_CTRL, &reg);
rt2x00usb_register_write(rt2x00dev, PBF_SYS_CTRL, reg & ~0x00002000);

- rt2x00usb_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000003);
-
reg = 0;
rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_CSR, 1);
rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_BBP, 1);
--
1.7.1


2012-01-25 14:17:01

by Stanislaw Gruszka

[permalink] [raw]
Subject: Re: [rt2x00-users] [PATCH 4/4] rt2800usb: remove PWR_PIN_CFG=0x3 during init

On Wed, Jan 25, 2012 at 01:58:47PM +0100, Andreas Hartmann wrote:
> I removed Patch 1 and 4 - the problem didn't change. I think it's not
> patch related, but system related: This was the first time, I tested
> with this notebook (because compiling is much more fast :-)) and to get
> more timing issues: this notebook is a Core i5 (the other was a
> CeleronM). Besides that, there is another kernel version (3.2 vs.
> 2.6.37.6) and a completely new compat-wireless.

Ok, so this seems to be usb core regression between 2.6.37 and 3.2, not
related with patches. Since you sent your email as reply for my patch
posting, I was confused.

Stanislaw

2012-01-24 13:09:39

by Stanislaw Gruszka

[permalink] [raw]
Subject: [PATCH 3/4] rt2800: zero MAC_SYS_CTRL bits during BBP and MAC reset

Zero all other bits than RESET_CSR and RESET_BBP when want to do the
reset, that the vendor driver behaviour.

Acked-by: Helmut Schaa <[email protected]>
Acked-by: Ivo van Doorn <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/rt2x00/rt2800pci.c | 2 +-
drivers/net/wireless/rt2x00/rt2800usb.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
index dc88bae..4e98502 100644
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -489,7 +489,7 @@ static int rt2800pci_init_registers(struct rt2x00_dev *rt2x00dev)

rt2x00pci_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000003);

- rt2x00pci_register_read(rt2x00dev, MAC_SYS_CTRL, &reg);
+ reg = 0;
rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_CSR, 1);
rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_BBP, 1);
rt2x00pci_register_write(rt2x00dev, MAC_SYS_CTRL, reg);
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index 262ee9e..425267a 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -228,7 +228,7 @@ static int rt2800usb_init_registers(struct rt2x00_dev *rt2x00dev)

rt2x00usb_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000003);

- rt2x00usb_register_read(rt2x00dev, MAC_SYS_CTRL, &reg);
+ reg = 0;
rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_CSR, 1);
rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_BBP, 1);
rt2x00usb_register_write(rt2x00dev, MAC_SYS_CTRL, reg);
--
1.7.1