From patchwork Wed Jul 29 05:52:41 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Roskin X-Patchwork-Id: 38068 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n6T5r16h018543 for ; Wed, 29 Jul 2009 05:53:01 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751920AbZG2Fw7 (ORCPT ); Wed, 29 Jul 2009 01:52:59 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751876AbZG2Fw7 (ORCPT ); Wed, 29 Jul 2009 01:52:59 -0400 Received: from c60.cesmail.net ([216.154.195.49]:59959 "EHLO c60.cesmail.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751843AbZG2Fw6 (ORCPT ); Wed, 29 Jul 2009 01:52:58 -0400 Received: from unknown (HELO smtprelay1.cesmail.net) ([192.168.1.111]) by c60.cesmail.net with ESMTP; 29 Jul 2009 01:52:59 -0400 Received: from [192.168.1.151] (c-69-141-194-35.hsd1.pa.comcast.net [69.141.194.35]) by smtprelay1.cesmail.net (Postfix) with ESMTPSA id 0B3F534C6D; Wed, 29 Jul 2009 01:52:55 -0400 (EDT) Subject: [RFC PATCH] rt61pci: fix module reloading with power saving enabled From: Pavel Roskin To: linux-wireless , users@host1.serialmonkey.com Date: Wed, 29 Jul 2009 01:52:41 -0400 Message-Id: <1248846761.18329.20.camel@ct> Mime-Version: 1.0 X-Mailer: Evolution 2.26.3 (2.26.3-1.fc11) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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 --- 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. */