rt61pci: fix module reloading with power saving enabled
RFC PATCH 1/1 rt61pci: fix module reloading with power saving enabled
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.
---
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(-)
drivers/net/wireless/rt2x00/rt61pci.c +2 -0
@@ -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. */
Signature · 2 lines
Regards, Pavel Roskin
Hi,
Quoted 9 lines · Pavel Roskin
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_CSRshould be set to the same value asrt61pci_config_ps()uses to wake up the device.
Quoted 5 lines
Signed-off-by Pavel Roskin <[email protected]>---
I don't know what
0x00000007is and I don't want to make up a name for it.
I'll look it up in the specification document.
Quoted 19 lines
rt61pci_config_ps()does other things, but this is the minimal required change. If anyone has a specification for rt61, it should mentionSOFT_RESET_CSRand 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(-)drivers/net/wireless/rt2x00/rt61pci.c +0
-0
drivers/net/wireless/rt2x00/rt61pci.c static int rt61pci_probe_hw(struct rt2x00_dev *rt2x00dev) · line 2607
Quoted 8 lines
drivers/net/wireless/rt2x00/rt61pci.c +2
-0@@ -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. */
The only comment about the patch at this time is that it might require a nice comment. ;) I'll also think that perhaps a more generic approach is required where rt2x00lib forces PS to be disabled before probe_hw(), just in case other hardware also have these problems.
Thanks,
Ivo