linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Roskin <proski@gnu.org>
To: linux-wireless <linux-wireless@vger.kernel.org>,
	users@rt2x00.serialmonkey.com
Subject: [RFC PATCH] rt61pci: fix module reloading with power saving enabled
Date: Wed, 29 Jul 2009 01:52:41 -0400	[thread overview]
Message-ID: <1248846761.18329.20.camel@ct> (raw)

Unloading rt61pci can leave the device in such state that reloading
rt61pci would fail to reinitialize it.  Bogus data would be read from
the EEPROM and the RF version won't be recognized.  Only reboot would
return the device to a sane state.

It appears that it happens if rt61pci is unloaded while power saving is
active.  To initialize the device properly, SOFT_RESET_CSR should be set
to the same value as rt61pci_config_ps() uses to wake up the device.

Signed-off-by: Pavel Roskin <proski@gnu.org>
---

I don't know what 0x00000007 is and I don't want to make up a name for
it.

rt61pci_config_ps() does other things, but this is the minimal required
change.  If anyone has a specification for rt61, it should mention
SOFT_RESET_CSR and possibly other registers to be set before EEPROM may
be accessed.

Please note that unloading rt61pci (as well as rt73usb) can trigger an
oops or panic in sysfs code that I didn't have a chance to fix yet.
It's very elusive and manifests differently every time.  Fortunately
(for everyone not debugging it), it's rare.


 drivers/net/wireless/rt2x00/rt61pci.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index fb95b8c..f615fe6 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -2600,6 +2600,8 @@ static int rt61pci_probe_hw(struct rt2x00_dev *rt2x00dev)
 {
 	int retval;
 
+	rt2x00pci_register_write(rt2x00dev, SOFT_RESET_CSR, 0x00000007);
+
 	/*
 	 * Allocate eeprom data.
 	 */

-- 
Regards,
Pavel Roskin

             reply	other threads:[~2009-07-29  5:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-29  5:52 Pavel Roskin [this message]
2009-07-30 18:47 ` [RFC PATCH] rt61pci: fix module reloading with power saving enabled Ivo van Doorn

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=1248846761.18329.20.camel@ct \
    --to=proski@gnu.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).