RTL8192SE blank EFUSE readout after suspend resume cycle
I recently discussed this with Larry Finger and Chaomin Li, but every once in a while, after having resumed from suspending to RAM, my NIC (10ec:8172) doesn't work anymore, even after reloading the module. Even worse, after reloading the module, my NIC's name gets changed (because of udev rules) as a result of the MAC address changing, which means I have to temporarily reconfigure whatever I'm using to make a connection (wicd in my case).
Now, as a byproduct of the other discussion I had (RTL8192SE and 802.11n problems), I've patched the driver to dump the EFUSE when appropriate hardware is detected, and this time, I got the following:
rtl8192se 0000:06:00.0: PCI INT A -> GSI 18 (level, low) -> IRQ 18 rtl8192se 0000:06:00.0: setting latency timer to 64
rtl8192se: In process "modprobe" (pid 17913):MAP
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
rtl8192se: Driver for Realtek RTL8192SE/RTL8191SE Loading firmware rtlwifi/rtl8192sefw.bin ieee80211 phy1: Selected rate control algorithm 'rtl_rc' udevd[17907]: renamed network interface wlan0 to wlan26
As you can see, the EFUSE is completely messed up. To fix this problem, I have to reboot my laptop. I'm not quite sure what could be causing this, and I was hoping someone here might.
Greetings,
Stefan Zwanenburg
Quoted 7 lines · Stefan Zwanenburg
I recently discussed this with Larry Finger and Chaomin Li, but every once in a while, after having resumed from suspending to RAM, my NIC (10ec:8172) doesn't work anymore, even after reloading the module. Even worse, after reloading the module, my NIC's name gets changed (because of udev rules) as a result of the MAC address changing, which means I have to temporarily reconfigure whatever I'm using to make a connection (wicd in my case).
You might try configure pm-utils to unload module before suspend, by something like this:
echo 'SUSPEND_MODULES="rtl8192se rtlwifi"' >> /etc/pm/config.d/modules.conf
Other than that, would be good to try if converting to new PM framework helps. It can be done quite simply, similar way like in this ath9k commit:
commit f0e94b479c987abef17eb18e5c8e0ed178d00cd4
Author: Rafael J. Wysocki <[email protected]> Date: Sat Oct 16 00:36:17 2010 +0200
ath9k: Convert to new PCI PM framework
Stanislaw
Quoted 14 lines · Stanislaw Gruszka
Quoted 7 lines · Stefan Zwanenburg
I recently discussed this with Larry Finger and Chaomin Li, but every once in a while, after having resumed from suspending to RAM, my NIC (10ec:8172) doesn't work anymore, even after reloading the module. Even worse, after reloading the module, my NIC's name gets changed (because of udev rules) as a result of the MAC address changing, which means I have to temporarily reconfigure whatever I'm using to make a connection (wicd in my case).
You might try configure pm-utils to unload module before suspend, by something like this:
echo 'SUSPEND_MODULES="rtl8192se rtlwifi"'>>
/etc/pm/config.d/modules.conf
Quoted 8 lines
Other than that, would be good to try if converting to new PM framework helps. It can be done quite simply, similar way like in this ath9k commit:
commit
f0e94b479c987abef17eb18e5c8e0ed178d00cd4Author: Rafael J. Wysocki<[email protected]> Date: Sat Oct 16 00:36:17 2010 +0200ath9k: Convert to new PCI PM framework
Stefan,
Following Stanislaw's suggestion, I have reworked the PM routines to use the new framework. Attached is a patch. My system does not sleep and I cannot test it, but it does hibernate. Let me know what happens.
Larry
drivers/net/wireless/rtlwifi/rtl8192se/sw.c +10 -6
@@ -397,17 +397,21 @@ MODULE_PARM_DESC(ips, "Set to 0 to not uMODULE_PARM_DESC (swlps,"Set to 1 to use SW control power save (default 0)\n" );MODULE_PARM_DESC (fwlps,"Set to 1 to use FW control power save (default 1)\n" ); +static const struct dev_pm_ops rtlwifi_pm_ops = { + .suspend = rtl_pci_suspend, + .resume = rtl_pci_resume, + .freeze = rtl_pci_suspend, + .thaw = rtl_pci_resume, + .poweroff = rtl_pci_suspend, + .restore = rtl_pci_resume, +}; +static struct pci_driver rtl92se_driver = { .name =KBUILD_MODNAME , .id_table = rtl92se_pci_ids, .probe = rtl_pci_probe, .remove = rtl_pci_disconnect, - -#ifdef CONFIG_PM - .suspend = rtl_pci_suspend, - .resume = rtl_pci_resume, -#endif - + .driver.pm = &rtlwifi_pm_ops, };static int __init rtl92se_module_init (void )
drivers/net/wireless/rtlwifi/pci.c +4 -15
@@ -1993,36 +1993,25 @@ call rtl_mac_stop() from the mac80211suspend function first, So there is no need to call hw_disable here. ****************************************/ -int rtl_pci_suspend (struct pci_dev *pdev,pm_message_t state) +int rtl_pci_suspend (struct device *dev) { +struct pci_dev *pdev =to_pci_dev (dev);struct ieee80211_hw *hw =pci_get_drvdata (pdev);struct rtl_priv *rtlpriv =rtl_priv (hw); rtlpriv->cfg->ops->hw_suspend (hw);rtl_deinit_rfkill (hw); -pci_save_state (pdev); -pci_disable_device (pdev); -pci_set_power_state (pdev, PCI_D3hot);return 0 ; }EXPORT_SYMBOL (rtl_pci_suspend); -int rtl_pci_resume (struct pci_dev *pdev) +int rtl_pci_resume (struct device *dev) { -int ret; +struct pci_dev *pdev =to_pci_dev (dev);struct ieee80211_hw *hw =pci_get_drvdata (pdev);struct rtl_priv *rtlpriv =rtl_priv (hw); -pci_set_power_state (pdev,PCI_D0 ); - ret =pci_enable_device (pdev); -if (ret) { -RT_ASSERT (false, ("ERR: <======\n" )); -return ret; - } - -pci_restore_state (pdev); - rtlpriv->cfg->ops->hw_resume (hw);rtl_init_rfkill (hw);return 0 ;
drivers/net/wireless/rtlwifi/pci.h +2 -2
@@ -237,8 +237,8 @@ extern struct rtl_intf_ops rtl_pci_ops;int __devinit rtl_pci_probe (struct pci_dev *pdev,const struct pci_device_id *id);void rtl_pci_disconnect (struct pci_dev *pdev); -int rtl_pci_suspend (struct pci_dev *pdev,pm_message_t state); -int rtl_pci_resume (struct pci_dev *pdev); +int rtl_pci_suspend (struct device *dev); +int rtl_pci_resume (struct device *dev);static inline u8 pci_read8_sync (struct rtl_priv *rtlpriv,u32 addr) {
drivers/net/wireless/rtlwifi/rtl8192ce/sw.c +10 -6
@@ -365,17 +365,21 @@ MODULE_PARM_DESC(ips, "Set to 0 to not uMODULE_PARM_DESC (swlps,"Set to 1 to use SW control power save (default 0)\n" );MODULE_PARM_DESC (fwlps,"Set to 1 to use FW control power save (default 1)\n" ); +static const struct dev_pm_ops rtlwifi_pm_ops = { + .suspend = rtl_pci_suspend, + .resume = rtl_pci_resume, + .freeze = rtl_pci_suspend, + .thaw = rtl_pci_resume, + .poweroff = rtl_pci_suspend, + .restore = rtl_pci_resume, +}; +static struct pci_driver rtl92ce_driver = { .name =KBUILD_MODNAME , .id_table = rtl92ce_pci_ids, .probe = rtl_pci_probe, .remove = rtl_pci_disconnect, - -#ifdef CONFIG_PM - .suspend = rtl_pci_suspend, - .resume = rtl_pci_resume, -#endif - + .driver.pm = &rtlwifi_pm_ops, };static int __init rtl92ce_module_init (void )
drivers/net/wireless/rtlwifi/rtl8192de/sw.c +10 -6
@@ -385,17 +385,21 @@ MODULE_PARM_DESC(ips, "Set to 0 to not uMODULE_PARM_DESC (swlps,"Set to 1 to use SW control power save (default 0)\n" );MODULE_PARM_DESC (fwlps,"Set to 1 to use FW control power save (default 1)\n" ); +static const struct dev_pm_ops rtlwifi_pm_ops = { + .suspend = rtl_pci_suspend, + .resume = rtl_pci_resume, + .freeze = rtl_pci_suspend, + .thaw = rtl_pci_resume, + .poweroff = rtl_pci_suspend, + .restore = rtl_pci_resume, +}; +static struct pci_driver rtl92de_driver = { .name =KBUILD_MODNAME , .id_table = rtl92de_pci_ids, .probe = rtl_pci_probe, .remove = rtl_pci_disconnect, - -#ifdef CONFIG_PM - .suspend = rtl_pci_suspend, - .resume = rtl_pci_resume, -#endif - + .driver.pm = &rtlwifi_pm_ops, };/* add global spin lock to solve the problem that