All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ondrej Zary <linux@rainbow-software.org>
To: Gertjan van Wingerde <gwingerde@gmail.com>
Cc: rt2x00 Users List <users@rt2x00.serialmonkey.com>,
	linux-wireless@vger.kernel.org
Subject: Re: [rt2x00-users] [PATCH] [RFC] rt2500pci: fix powersaving
Date: Tue, 30 Mar 2010 23:35:59 +0200	[thread overview]
Message-ID: <201003302336.01897.linux@rainbow-software.org> (raw)
In-Reply-To: <4BB266E9.2010404@gmail.com>

On Tuesday 30 March 2010 23:02:33 Gertjan van Wingerde wrote:
> On 03/30/10 22:09, Ondrej Zary wrote:
> > On Tuesday 30 March 2010, Matthijs Kooijman wrote:
> >> Hi all,
> >>
> >>> phy0 -> rt2500pci_set_device_state: Error - Device failed to enter
> >>> state 1 (-16).
> >>
> >> I'm seeing this one on my rt2500pci as well (and also works ok
> >> otherwise).
> >
> > OK, so let's try to fix it.
> >
> > The first patch below fixes this problem. And reveals two other problems.
> > Now the device has problems entering states 3 and 4 (remains stuck in
> > state 1) - the driver seems to not like this and oopses.
> > The second patch fixes the "stuck state 1" problem (same fix as in
> > rt2500usb). The oops does not appear anymore with the second patch - but
> > I think that it should be fixed anyway separately.
> > (I'm testing this with "while true; do ifdown wlan0; ifup wlan0; done")
>
> Thanks again for your hard and persistent work on this.
>
> > oops removed
> >
> >
> > ---
> > linux-2.6.34-rc2-orig/drivers/net/wireless/rt2x00/rt2500pci.c	2010-03-20
> > 02:17:57.000000000 +0100 +++
> > linux-2.6.34-rc2/drivers/net/wireless/rt2x00/rt2500pci.c	2010-03-30
> > 15:04:50.000000000 +0200 @@ -1079,7 +1079,7 @@
> >  static int rt2500pci_set_state(struct rt2x00_dev *rt2x00dev,
> >  			       enum dev_state state)
> >  {
> > -	u32 reg;
> > +	u32 reg, reg2;
> >  	unsigned int i;
> >  	char put_to_sleep;
> >  	char bbp_state;
> > @@ -1100,11 +1100,12 @@
> >  	 * device has entered the correct state.
> >  	 */
> >  	for (i = 0; i < REGISTER_BUSY_COUNT; i++) {
> > -		rt2x00pci_register_read(rt2x00dev, PWRCSR1, &reg);
> > -		bbp_state = rt2x00_get_field32(reg, PWRCSR1_BBP_CURR_STATE);
> > -		rf_state = rt2x00_get_field32(reg, PWRCSR1_RF_CURR_STATE);
> > +		rt2x00pci_register_read(rt2x00dev, PWRCSR1, &reg2);
> > +		bbp_state = rt2x00_get_field32(reg2, PWRCSR1_BBP_CURR_STATE);
> > +		rf_state = rt2x00_get_field32(reg2, PWRCSR1_RF_CURR_STATE);
> >  		if (bbp_state == state && rf_state == state)
> >  			return 0;
> > +		rt2x00pci_register_write(rt2x00dev, PWRCSR1, reg);
> >  		msleep(10);
> >  	}
>
> Hmmm, checking the old legacy Ralink rt2500 driver it shows that the legacy
> driver never waits and checks whether the device has come in the right
> power state. What does happen to the stability of the connection if you
> simply remove this entire for-loop?

It works without the loop - But I suspect that the device never enters 
STATE_SLEEP. With the loop present, it needs 3 loop passes to enter 
STATE_SLEEP (with that register write added). It never enters STATE_SLEEP 
without that added register write (I took it from rt2500usb) and that's why 
the error message was printed in log.

-- 
Ondrej Zary

  reply	other threads:[~2010-03-30 21:36 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-29  7:56 [PATCH] rt2500usb: fix powersaving random failures Ondrej Zary
2010-03-29 19:47 ` Gertjan van Wingerde
2010-03-29 21:00   ` [rt2x00-users] " Ivo van Doorn
2010-03-30  5:11     ` Gertjan van Wingerde
2010-03-30  6:01       ` Ondrej Zary
2010-03-30 12:33       ` Ondrej Zary
2010-03-30 12:38         ` Ondrej Zary
2010-03-30 12:56         ` Matthijs Kooijman
2010-03-30 20:09           ` [PATCH] [RFC] rt2500pci: fix powersaving Ondrej Zary
2010-03-30 20:32             ` Matthijs Kooijman
2010-03-30 20:38               ` [rt2x00-users] " Gertjan van Wingerde
2010-03-30 21:02             ` Gertjan van Wingerde
2010-03-30 21:35               ` Ondrej Zary [this message]
2010-03-30 21:44                 ` Gertjan van Wingerde
2010-03-31 17:41             ` Matthijs Kooijman
2010-03-31 18:38               ` Gertjan van Wingerde
2010-03-31 18:46                 ` Gertjan van Wingerde
2010-03-31 19:00                   ` [rt2x00-users] " Matthijs Kooijman
2010-04-03 14:11                     ` Gertjan van Wingerde
2010-04-03 15:28                       ` Matthijs Kooijman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201003302336.01897.linux@rainbow-software.org \
    --to=linux@rainbow-software.org \
    --cc=gwingerde@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=users@rt2x00.serialmonkey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.